MainFrm.cpp 457 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605
  1. // MainFrm.cpp : implementation of the CMainFrame class 员工工作
  2. #include "stdafx.h"
  3. #include "YLGL.h"
  4. #include "resource.h"
  5. #include "MainFrm.h"
  6. #include <afxinet.h>
  7. #include "ConnectDlg.h"
  8. #include "SendDataDlg.h"
  9. #include "DinDanHistroy.h"
  10. #include "ShangPin.h"
  11. #include "SPLBDlg.h"
  12. #include "BuMenDlg.h"
  13. #include "Worker.h"
  14. #include "ShowPic3.h"
  15. #include "TXDlg.h"
  16. #include "TXSPDlg.h"
  17. #include "MsgReg2.h"
  18. #include "ProviderDlg.h"
  19. #include "Booking.h"
  20. #include "Booking2.h"
  21. #include "PayOutSet.h"
  22. #include "PayOutInput.h"
  23. #include "IncomeInput.h"
  24. #include "IncomeInput2.h"
  25. #include "IncomeInput3.h"
  26. #include "IncomeInput4.h"
  27. #include "DressEarlyWarning.h"
  28. #include "DailyForm.h"
  29. #include "MonthForm.h"
  30. #include "ProcessAlarm.h"
  31. #include "MonthForm2.h"
  32. #include "YearForm.h"
  33. #include "ClientForm.h"
  34. #include "ClientForm2.h"
  35. #include "ClientForm3.h"
  36. #include "DinDanFrom.h"
  37. #include "Satisfaction.h"
  38. //#include "SatisfactionForm.h"
  39. #include "SatisfactionReportForm.h"
  40. #include "TodayForm.h"
  41. #include "TodayForm2.h"
  42. #include "SendInsideMsg2.h"
  43. #include "StoreInfoChart.h"
  44. #include "FixedAssets.h"
  45. #include "SPForm.h"
  46. #include "ShowMsg.h"
  47. #include "Account.h"
  48. #include "Login.h"
  49. #include "Login3.h"
  50. #include "Psw.h"
  51. #include "AreaDlg.h"
  52. #include "TakeFrom.h"
  53. #include "ChoosePhotoForm.h"
  54. #include "BeautifySkinFrom.h"
  55. #include "DesignFrom.h"
  56. #include "outsourcing.h"
  57. #include "ChoosePhotoSkin.h"
  58. #include "SalarySet.h"
  59. #include "SalarySet2.h"
  60. #include "MySalary.h"
  61. #include "PrintRX.h"
  62. #include "LoadRect.h"
  63. #include "PrintPreview.h"
  64. #include "SearchClient.h"
  65. #include "BeautifySkinFrom2.h"
  66. #include "FinanceForm.h"
  67. #include "PhotoPrintFrom.h"
  68. //#include "SqlDlg.h"
  69. #include "YearForm2.h"
  70. #include "AreaClient.h"
  71. #include "DBConfig.h"
  72. #include "SetPathDlg2.h"
  73. #include "StaffAchievement.h"
  74. #include "BurnCD.h"
  75. #include "StaffAchievementSet.h"
  76. #include "StaffAchievementShowAll.h"
  77. #include "SelContent.h"
  78. #include "ClientMoney.h"
  79. #include "DelPhotoSet.h"
  80. #include "ompanyInfo.h"
  81. #include "ClientForm.h"
  82. #include "PhotoBak.h"
  83. #include "MsgReg.h"
  84. #include "SendMsg.h"
  85. #include "MsgSet.h"
  86. #include "ShowMember.h"
  87. #include "ShowMember2.h"
  88. #include "MemberSet.h"
  89. #include "DressManage.h"
  90. #include "ShowDress.h"
  91. #include "ShowPic.h"
  92. #include "ShowHireReg.h"
  93. #include "InputGoods.h"
  94. #include "ShowGoods.h"
  95. #include "CostCal.h"
  96. #include "Welcome.h"
  97. #include "EmployeeMsg.h"
  98. #include "TXFG.h"
  99. #include "EmployeeForm.h"
  100. #include "EmployeeForm2.h"
  101. #include "Client2Form.h"
  102. #include "Client2FormLYFZ.h"
  103. #include "OldClient.h"
  104. #include "ClientReasonChart.h"
  105. #include "ClientFromChart.h"
  106. #include "WorkMsg.h"
  107. #include "SetLoginTime.h"
  108. #include "SetLoginBan.h"
  109. #include "LoginReg.h"
  110. #include "LoginReg2.h"
  111. #include "PhoneRecord.h"
  112. #include "PhoneRecordOut.h"
  113. #include "MissCall.h"
  114. #include "InsideMsg.h"
  115. #include "Card2Reg.h"
  116. #include "Card2RegChart.h"
  117. #include "ShowMemberBlue.h"
  118. #include "Card2RegBlue.h"
  119. #include "Card2RegChartBlue.h"
  120. #include "DigitalWork.h"
  121. #include "HideWindow.h"
  122. #include "SalarySet3.h"
  123. #include "YearFormBranch.h"
  124. #include "YearFormBranch2.h"
  125. #include "Set.h"
  126. #include "DinDanFromBranch.h"
  127. #include "MemberChart.h"
  128. #include "ShowMemberMsg.h"
  129. #include "ShowBakState.h"
  130. #include "DinDanForm.h"
  131. #include "CalendarConvert.h"
  132. #include "ShowLOg.h"
  133. #include "HospitalClient.h"
  134. #include "HospitalClientAlarm.h"
  135. #include "HospitalInfoSet.h"
  136. #include "AddHospitalClient.h"
  137. #include "HospitalClientMsg.h"
  138. #ifndef VC60
  139. #include "msgId_def.h"
  140. #include "struct_def.h"
  141. #endif //#ifndef VC60
  142. #ifdef _DEBUG
  143. #define new DEBUG_NEW
  144. #undef THIS_FILE
  145. static char THIS_FILE[] = __FILE__;
  146. #endif
  147. #ifndef WINVER
  148. #define WINVER 0x0400
  149. #endif
  150. #ifndef _WIN32_WINNT
  151. #define _WIN32_WINNT 0x0400
  152. #endif
  153. #ifndef _WIN32_WINDOWS
  154. #define _WIN32_WINDOWS 0x0410
  155. #endif
  156. #ifndef _WIN32_IE
  157. #define _WIN32_IE 0x0400
  158. #endif
  159. #include "uxtheme.h "
  160. typedef HTHEME(__stdcall * POPENTHEMEDATA)(HWND hwnd, LPCWSTR pszClassList);
  161. typedef HRESULT(__stdcall * PCLOSETHEMEDATA)(HTHEME hTheme);
  162. HHOOK g_hmouse = NULL; //g_sendhead zx.dll
  163. //extern void WriteTextLog(CString str); // Jeff写客户端日志;
  164. // Jeff.remark;
  165. // 函数:MouseProc
  166. // 参数:
  167. // nCode hook code
  168. // wParam message identifier
  169. // lParam mouse coordinates
  170. // 返回:
  171. //
  172. LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam)
  173. {
  174. if (g_pMainWnd)
  175. {
  176. if(g_cominfoarray.GetSize() > 0)
  177. {
  178. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(133)) && atoi(g_cominfoarray.ElementAt(0).ElementAt(134)) > 0)
  179. {
  180. g_pMainWnd->KillTimer(5);
  181. g_pMainWnd->SetTimer(5, atoi(g_cominfoarray.ElementAt(0).ElementAt(134)) * 60 * 1000, NULL);
  182. }
  183. }
  184. if (g_bSendLYFZ)
  185. {
  186. g_pMainWnd->KillTimer(7);
  187. #ifdef _DEBUG
  188. g_pMainWnd->SetTimer(7, 3 * 1000, NULL);
  189. #else
  190. g_pMainWnd->SetTimer(7, 5 * 60 * 1000, NULL);
  191. #endif
  192. }
  193. }
  194. return CallNextHookEx(g_hmouse, nCode, wParam, lParam);
  195. }
  196. CRect g_rc; // 屏幕坐标值,区域是放置对话框。
  197. CMainFrame *g_pMainWnd = NULL;
  198. extern HWND g_hSendWnd;
  199. extern HWND g_hConnectWnd;
  200. //extern CString newGUID();
  201. #ifdef USE_KERNEL_DLL
  202. /************************************************************************/
  203. /*
  204. 函数:kernelCallback
  205. 描述:kernel.dll的回调函数;
  206. 参数:
  207. lpStrBranchId: 域名;
  208. lpStrOrder: 订单号;
  209. dwImgType: 相片类型;
  210. dwImgNum: 重命名使用,返回的相片编号;
  211. lpStrImg: IncrementalBack表使用的content字段内容,指定备份文件名的相片;
  212. lpStrImgExt: IncrementalBack表使用的backupExt字段内容,指定要备份的扩展名相片;
  213. 返回:void
  214. */
  215. /************************************************************************/
  216. #include "ImportPhoto.h"
  217. // 导入原片、初修、精修、设计结束后的回调函数(三合一);
  218. void CALLBACK ImgImportMergeCallback(IN LPCTSTR lpStrBranchId, IN LPCTSTR lpStrOrderNum, IN CONST INT& dwImgType, IN CONST DWORD& dwImgNum, IN LPCTSTR lpStrImgs, IN LPCTSTR lpStrImgExt)
  219. {
  220. AfxSetResourceHandle(g_Instance);
  221. // 1.判断参数有效性;
  222. if (lpStrBranchId == NULL || !strstr(lpStrBranchId, _T(".ly.com")) || lpStrOrderNum == NULL || _tcscmp(lpStrOrderNum, _T("")) == 0)
  223. {
  224. OutputDebugString(_T("回调函数参数(域名、订单号)无效\n"));
  225. return;
  226. }
  227. // 2.是否需要备份分店相片;
  228. BOOL bIsNeedBranchImg = FALSE;
  229. switch (dwImgType)
  230. {
  231. case 1://是否备份分店原片;
  232. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck1;
  233. break;
  234. case 2://是否备份分店修片;
  235. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck2;
  236. break;
  237. case 3://是否备份分店精修;
  238. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck3;
  239. break;
  240. case 4://是否备份分店设计;
  241. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck4;
  242. break;
  243. default:
  244. OutputDebugString(_T("未知相片类型!\n"));
  245. break;
  246. }
  247. // 3.同时更新IncrementalBack表;
  248. CString strSQLInsert = _T("");
  249. strSQLInsert.Format(INSERT_INCREMENT, 0, lpStrBranchId, CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S"), lpStrOrderNum, dwImgType, lpStrImgs, g_user.account, g_user.name);
  250. // 4.连接服务器,更新dindan和IncrementalBackup;
  251. g_sendhead.bsql = 1;
  252. if (g_bAllBranch)
  253. {// 多店汇总时;
  254. g_branchip = GetBranchIPbyId(lpStrBranchId);
  255. g_pMainWnd->OnDisconnect();
  256. g_branchname = GetBranchNamebyId(lpStrBranchId);
  257. g_bBranchModify = 1;
  258. if (dwImgType == OImgtype)
  259. {// 如果导入的是原片;
  260. CString strSQL = _T("");
  261. strSQL.Format(_T("update dindan set curno = '%d' where id = '%s' ***%s"), dwImgNum, lpStrOrderNum, strSQLInsert);
  262. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  263. }
  264. else
  265. {//导入的不是原片;
  266. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  267. }
  268. // 如果连接服务器失败,要记录下来;
  269. // if () .........
  270. g_pMainWnd->OnDisconnect();
  271. g_bBranchModify = 0;
  272. g_branchip = g_branchname = _T("");
  273. if (g_domain.CompareNoCase(lpStrBranchId) != 0 && bIsNeedBranchImg)
  274. {// 如果不是本店,且本店设置中需要备份分店相片,需要向本店添加导入相片记录;
  275. g_sendhead.bsql = 1;
  276. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  277. g_pMainWnd->OnDisconnect();
  278. g_bBranchModify = 0;
  279. }
  280. }
  281. else
  282. {// 连接本店或分店时;
  283. if (dwImgType == OImgtype)
  284. {// 如果导入的是原片;
  285. CString strSQL = _T("");
  286. strSQL.Format(_T("update dindan set curno = '%d' where id = '%s' ***%s"), dwImgNum, lpStrOrderNum, strSQLInsert);
  287. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  288. }
  289. else
  290. {//导入的不是原片;
  291. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  292. }
  293. if (g_domain.CompareNoCase(lpStrBranchId) != 0 && bIsNeedBranchImg)
  294. {// 如果不是本店,且本店设置中需要备份分店相片,需要向本店添加导入相片记录;
  295. #if 1
  296. ::SendMessage(g_pMainWnd->m_hWnd, MSG_KERNEL_SENDMSG, (WPARAM)lpStrBranchId, (LPARAM)&strSQLInsert);
  297. #else // 可能是VC6.0与VC9.0间DLL调用产生的问题,下面代码执行时会出错;
  298. // 如果连接的是分店,断开分店,回连本店;
  299. g_bBranchModify = FALSE;
  300. g_pMainWnd->OnDisconnect();
  301. g_branchname = g_branchip = _T("");
  302. g_sendhead.bsql = 1;
  303. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  304. g_pMainWnd->OnDisconnect();
  305. // 设置回分店连接;
  306. g_branchip = GetBranchIPbyId(lpStrBranchId);
  307. g_branchname = GetBranchNamebyId(lpStrBranchId);
  308. g_bBranchModify = TRUE;
  309. #endif
  310. }
  311. }
  312. if ( dwImgType == OImgtype )
  313. {// 最后一步,更新完了数据库,刷新TakFrom类所对应的对话框;
  314. HWND hWnd = ::FindWindowEx(g_pMainWnd->GetSafeHwnd(), NULL, _T("MDIClient"), NULL);
  315. if (hWnd)
  316. {
  317. hWnd = ::FindWindowEx(hWnd, NULL, NULL, _T("拍照"));
  318. if (hWnd)
  319. {
  320. hWnd = ::FindWindowEx(hWnd, NULL, _T("#32770"), NULL);
  321. if (hWnd)
  322. {
  323. ::SendMessage(hWnd, MSG_KERNEL_CALLBACK, 0, 0);
  324. }
  325. }
  326. }
  327. }
  328. }
  329. #endif
  330. /////////////////////////////////////////////////////////////////////////////
  331. // CMainFrame客人付款
  332. /////////////////////////////////////////////////////////////////////////////
  333. /////////////////////////////////////////////////////////////////////////////
  334. static void HandleClientNetEvent(IN SOCKET hSocket,
  335. IN ETransportEvent eEvent,
  336. IN void *pDataBuf,
  337. IN unsigned long nDataLen,
  338. IN int nError,
  339. IN void *pContext)
  340. {
  341. if (nError != TRANSPORT_OK)
  342. return;
  343. CMainFrame *pDlg = (CMainFrame *)pContext;
  344. if (NULL == pDlg)
  345. return;
  346. pDlg->ProcessNetEvent(eEvent, pDataBuf, nDataLen);
  347. }
  348. BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam)
  349. {
  350. CRect rtCtrl, rtWnd; // 子窗口,父窗口;
  351. if (hwnd)
  352. {
  353. ::GetWindowRect(hwnd, &rtCtrl); // 获取控件大小;
  354. ::GetWindowRect(GetParent(hwnd), &rtWnd); // 获取父窗口大小;
  355. // printf("Jeff:g_WidthScale=%d,g_HeightScale=%d,rtWnd.left=%d,rtWnd.top=%d\n\n",g_WidthScale,g_HeightScale,rtWnd.left,rtWnd.top);
  356. // printf("Jeff:old:ctrl.left=%d,ctrl.top=%d,ctrl.right=%d,ctrl.bottom=%d\n\n",rtCtrl.left,rtCtrl.top,rtCtrl.right,rtCtrl.bottom);
  357. rtCtrl.OffsetRect(-rtWnd.left, -rtWnd.top);
  358. float temp;
  359. temp = (float)rtCtrl.left*g_WidthScale;
  360. rtCtrl.left = (int)temp + g_dx;
  361. temp = (float)rtCtrl.top*g_HeightScale;
  362. rtCtrl.top = (int)temp + g_dy;
  363. temp = (float)rtCtrl.right*g_WidthScale;
  364. rtCtrl.right = (int)temp + g_dx;
  365. temp = (float)rtCtrl.bottom*g_HeightScale;
  366. rtCtrl.bottom = (int)temp + g_dy;
  367. //printf("Jeff:new:ctrl.left=%d,ctrl.top=%d,ctrl.right=%d,ctrl.bottom=%d\n\n",rtCtrl.left,rtCtrl.top,rtCtrl.right,rtCtrl.bottom);
  368. ::MoveWindow(hwnd, rtCtrl.left, rtCtrl.top, rtCtrl.Width(), rtCtrl.Height(), TRUE);
  369. return TRUE;
  370. }
  371. else
  372. {
  373. return FALSE;
  374. }
  375. }
  376. IMPLEMENT_DYNCREATE(CMainFrame, CMDIFrameWnd)
  377. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  378. //{{AFX_MSG_MAP(CMainFrame)
  379. ON_WM_CREATE()
  380. ON_WM_DESTROY()
  381. ON_WM_CLOSE()
  382. ON_WM_TIMER()
  383. ON_COMMAND(IDM_choosephotoskin, Onchoosephotoskin)
  384. ON_COMMAND(IDM_PATH, OnPath)
  385. ON_COMMAND(IDM_SERVER, OnServer)
  386. ON_COMMAND(IDM_SHOWHIS, OnShowhis)
  387. ON_COMMAND(IDM_StaffAchievementShow, OnStaffAchievementShow)
  388. ON_COMMAND(IDM_AUTODELPHOTO, OnAutodelphoto)
  389. ON_COMMAND(IDM_PHOTOMANAGE, Onphotomanage)
  390. ON_COMMAND(IDM_COMPANYINFO, OnCompanyinfo)
  391. ON_COMMAND(IDM_HELPFILE, OnHelpfile)
  392. ON_COMMAND(IDM_PHOTOBAK, OnPhotobak)
  393. ON_COMMAND(IDM_TAOXIFG, OnTaoxifg)
  394. ON_COMMAND(IDM_ShowBakState, OnShowBakState)
  395. ON_WM_NCLBUTTONDBLCLK()
  396. ON_WM_NCHITTEST()
  397. ON_COMMAND(IDM_LOG, OnLog)
  398. //}}AFX_MSG_MAP
  399. ON_COMMAND_RANGE(0, 50000, OnCommandMenu)
  400. ON_MESSAGE(MSG_KERNEL_SENDMSG, OnKernelSendMessaage)
  401. END_MESSAGE_MAP()
  402. static UINT indicators[] =
  403. {
  404. ID_SEPARATOR, // status line indicator
  405. ID_INDICATOR_CAPS,
  406. ID_INDICATOR_NUM,
  407. ID_INDICATOR_SCRL,
  408. };
  409. /////////////////////////////////////////////////////////////////////////////
  410. // CMainFrame construction/destruction
  411. #if defined(VC70) || defined(VC60)
  412. UINT CMainFrame::OnNcHitTest(CPoint point)
  413. {
  414. if (CWnd::OnNcHitTest(point) == HTRIGHT || CWnd::OnNcHitTest(point) == HTLEFT || CWnd::OnNcHitTest(point) == HTTOP || CWnd::OnNcHitTest(point) == HTBOTTOM)
  415. return HTCLIENT;
  416. return CWnd::OnNcHitTest(point);
  417. }
  418. #else
  419. LRESULT CMainFrame::OnNcHitTest(CPoint point)
  420. {
  421. if (CWnd::OnNcHitTest(point) == HTRIGHT || CWnd::OnNcHitTest(point) == HTLEFT || CWnd::OnNcHitTest(point) == HTTOP || CWnd::OnNcHitTest(point) == HTBOTTOM)
  422. return HTCLIENT;
  423. return CWnd::OnNcHitTest(point);
  424. }
  425. #endif
  426. void CMainFrame::OnNcLButtonDblClk(UINT nFlags, CPoint point)
  427. {
  428. if (nFlags != HTCAPTION)
  429. CMDIFrameWnd::OnNcLButtonDblClk(nFlags, point);
  430. }
  431. // 回调使用;
  432. LRESULT CMainFrame::OnKernelSendMessaage(WPARAM wp, LPARAM lp)
  433. {
  434. CString strBranchId = (LPCTSTR)wp;
  435. CString strSQLInsert = *(CString*)lp;
  436. // 如果连接的是分店,断开分店,回连本店;
  437. g_bBranchModify = FALSE;
  438. g_pMainWnd->OnDisconnect();
  439. g_branchname = g_branchip = _T("");
  440. g_sendhead.bsql = 1;
  441. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  442. g_pMainWnd->OnDisconnect();
  443. // 设置回分店连接;
  444. g_branchip = GetBranchIPbyId(strBranchId);
  445. g_branchname = GetBranchNamebyId(strBranchId);
  446. g_bBranchModify = TRUE;
  447. g_pMainWnd->OnConnect();
  448. return 0;
  449. }
  450. CMainFrame::CMainFrame()
  451. {
  452. // TODO: add member initialization code here
  453. SetConnectionID(INVALID_SOCKET);
  454. m_pMainFrimDlg2 = NULL;
  455. m_bCheckF2F3 = AfxGetApp()->GetProfileInt(LYFZVERSION, "f2f3", 0);
  456. if (0 == ::PathFileExists(g_mainpath + "\\skin\\5.lia"))
  457. {
  458. g_bNoLoginLia = 1;
  459. }
  460. }
  461. CMainFrame::~CMainFrame()
  462. {
  463. if (m_pMainFrimDlg2)
  464. {
  465. m_pMainFrimDlg2->DestroyWindow();
  466. delete m_pMainFrimDlg2;
  467. }
  468. }
  469. void InTheMe(HWND m_hWnd)
  470. {
  471. BOOL bXpVisualStyle = FALSE;
  472. OSVERSIONINFO osvi;
  473. osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  474. ::GetVersionEx(&osvi);
  475. if ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) && (osvi.dwMajorVersion >= 5) && (osvi.dwMinorVersion >= 1))
  476. {
  477. HMODULE hUxTheme = ::LoadLibrary(_T("UxTheme.dll"));
  478. POPENTHEMEDATA pOpenThemeData;
  479. PCLOSETHEMEDATA pCloseThemeData;
  480. if (hUxTheme != NULL)
  481. {
  482. pOpenThemeData = (POPENTHEMEDATA)::GetProcAddress(hUxTheme, "OpenThemeData");
  483. pCloseThemeData = (PCLOSETHEMEDATA)::GetProcAddress(hUxTheme, "CloseThemeData");
  484. HTHEME hButtonTheme = (*pOpenThemeData)(m_hWnd, L"BUTTON");
  485. if (hButtonTheme != NULL)
  486. bXpVisualStyle = TRUE;
  487. (*pCloseThemeData)(hButtonTheme);
  488. }
  489. ::FreeLibrary(hUxTheme);
  490. }
  491. if (bXpVisualStyle)
  492. AfxMessageBox(_T("正在使用视觉主题 "));
  493. else
  494. AfxMessageBox(_T("没有使用视觉主题 "));
  495. }
  496. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  497. {
  498. if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  499. {
  500. // Jeff.创建失败的可能性小,加日志输出;
  501. return -1;
  502. }
  503. if (::PathFileExists(g_mainpath + "\\logo.ico"))
  504. {
  505. Bitmap *bmp = NULL;
  506. LoadImageFromFile((Image**)&bmp, g_mainpath + "\\logo.ico");
  507. // m_hIcon = AfxGetApp()->LoadIcon(g_mainpath+"\\logo.ico");
  508. bmp->GetHICON(&m_hIcon);
  509. delete bmp;
  510. SetIcon(m_hIcon, TRUE); // Set big icon
  511. SetIcon(m_hIcon, FALSE); // Set small icon
  512. }
  513. if (!m_wndClient.SubclassWindow(m_hWndMDIClient))
  514. {
  515. return -1;
  516. }
  517. if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  518. | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  519. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  520. {
  521. TRACE0("Failed to create toolbar\n");
  522. return -1; // fail to create
  523. }
  524. m_wndToolBar.LoadTrueColorToolBar(90, IDB_NORMAL, 0, IDB_DISABLE);
  525. // second toolbar must have different ID
  526. if (!m_wndToolBar2.Create(this, WS_CHILD | WS_VISIBLE | CBRS_LEFT | CBRS_NOALIGN,
  527. AFX_IDW_CONTROLBAR_FIRST + 32) ||
  528. !m_wndToolBar2.LoadToolBar(IDR_TOOLBAR1))
  529. {
  530. TRACE0("Failed to create toolbar\n");
  531. return -1; // fail to create
  532. }
  533. #ifndef NEW_SKIN
  534. if (!m_wndStatusBar.Create(this) ||
  535. !m_wndStatusBar.SetIndicators(indicators,
  536. sizeof(indicators)/sizeof(UINT)))
  537. {
  538. // Jeff.创建失败的可能性小,加日志输出;
  539. TRACE0("Failed to create status bar\n");
  540. return -1; // fail to create
  541. }
  542. m_wndStatusBar.SetPaneInfo(1,ID_INDICATOR_USER,SBPS_NORMAL,200);
  543. m_wndStatusBar.SetPaneText(1,"未登录",TRUE);
  544. #endif
  545. // TODO: Delete these three lines if you don't want the toolbar to
  546. // be dockable
  547. NewMenu2();
  548. ::GetWindowRect(this->m_hWndMDIClient, g_rc);
  549. g_pMainWnd = this;
  550. m_wndToolBar2.Init();
  551. g_rc.top += 38;
  552. g_rc.left += 160;
  553. /* m_WidthScale = (float)g_rc.Width ()/722;
  554. m_HeightScale = (float)g_rc.Height ()/533;*/
  555. g_user.bLongin = 0;
  556. SetTimer(1, 100, NULL);
  557. #ifdef USE_KERNEL_DLL
  558. if ( g_pIMGProcess )
  559. g_pIMGProcess->SetCallBack(ImgImportMergeCallback);
  560. #endif
  561. return 0;
  562. }
  563. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  564. {
  565. if (!CMDIFrameWnd::PreCreateWindow(cs))
  566. return FALSE;
  567. // TODO: Modify the Window class or styles here by modifying
  568. // the CREATESTRUCT cs
  569. cs.style &= ~WS_MAXIMIZEBOX;
  570. cs.style &= ~WS_THICKFRAME;
  571. cs.lpszName = g_title + "影楼管理系统";
  572. cs.style &= ~FWS_ADDTOTITLE;
  573. RECT rect;
  574. HWND hWnd = ::FindWindow("Shell_TrayWnd", 0);
  575. ::GetWindowRect(hWnd, &rect);
  576. cs.x = 0;
  577. cs.y = 0;
  578. cs.cx = GetSystemMetrics(SM_CXSCREEN);
  579. cs.cy = GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top) + 3;
  580. return TRUE;
  581. }
  582. /////////////////////////////////////////////////////////////////////////////
  583. // CMainFrame diagnostics
  584. #ifdef _DEBUG
  585. void CMainFrame::AssertValid() const
  586. {
  587. CMDIFrameWnd::AssertValid();
  588. }
  589. void CMainFrame::Dump(CDumpContext& dc) const
  590. {
  591. CMDIFrameWnd::Dump(dc);
  592. }
  593. #endif //_DEBUG
  594. /////////////////////////////////////////////////////////////////////////////
  595. // CMainFrame message handlers
  596. void CMainFrame::OnDestroy()
  597. {
  598. OnDisconnect();
  599. #if defined(VC70) || defined(VC60)
  600. Transport_UnInit();
  601. #else
  602. CClientTunnel::Transport_UnInit();
  603. #endif //#ifdef VC60
  604. m_Mdi.DeleteAll();
  605. if (g_hmouse)UnhookWindowsHookEx(g_hmouse);
  606. CMDIFrameWnd::OnDestroy();
  607. }
  608. void CMainFrame::OnClose()
  609. {
  610. g_bShowBar = 0;
  611. if (m_Mdi.MainClose())
  612. CMDIFrameWnd::OnClose();
  613. }//连接
  614. void CMainFrame::NewMenu2()
  615. {
  616. CMenu *pMemu = GetMenu();
  617. #ifdef BASIC_VERSION
  618. CMenu* submenu = pMemu->GetSubMenu(1);
  619. //submenu->RemoveMenu (IDM_StaffAchievementShow, MF_BYCOMMAND );//Jeff del 2014.06.16
  620. submenu->RemoveMenu (IDM_salaryset, MF_BYCOMMAND );
  621. #endif
  622. #if 0 // 此机用选片菜单项,去掉不用;
  623. {
  624. BOOL checked=AfxGetApp()->GetProfileInt (LYFZVERSION, "status", 0);
  625. if(checked)
  626. {
  627. CMenu* submenu = pMemu->GetSubMenu(1);
  628. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  629. }
  630. }
  631. #endif
  632. #ifndef BASIC_VERSION
  633. {
  634. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status2", 0);
  635. if (checked)
  636. {
  637. #if 0 // Jeff:去掉菜单,此机用于员工业绩查看的菜单选项;
  638. CMenu* submenu = pMemu->GetSubMenu(1);
  639. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  640. #endif
  641. g_bStaffAchievementShow = 1;
  642. SetTimer(3, 100, NULL);
  643. }
  644. }
  645. #endif
  646. if (g_bShowOK == 0)
  647. {
  648. CMenu* submenu = pMemu->GetSubMenu(2);
  649. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  650. }
  651. }
  652. HMENU CMainFrame::NewMenu()
  653. {
  654. //设置菜单为XP风格 IDM_SHOWHIS
  655. BCMenu::SetMenuDrawMode(1);
  656. //若取消下面这句注释,则可看到菜单的图标栏和文字栏背景颜色为白色,
  657. //文字颜色为蓝色,选中项的前景色为紫红色
  658. //m_menuXP.SetMenuXPItemColor(0x00FFFFFF,0x00FFFFFF,0x00FF0000,0x00FF00FF);
  659. // 设置菜单中图标大小为32×32
  660. // m_menuXP.SetIconSize(32,32);
  661. // 加载菜单资源
  662. m_menuXP.LoadMenu(IDR_MAINFRAME);
  663. // 加载菜单对应的工具栏资源
  664. // m_menuXP.LoadToolbar(IDR_MAINFRAME);
  665. /*由于菜单左边栏中默认的图标大小为16×16,而与之对应的Toolbar中图标大小为32×32,
  666. 因此菜单中图标不能正确显示,只显示出工具栏中图标的左上角部分,所以修改菜单中各
  667. 项对应的图标为24b色位图资源IDB_***,或者在LoadMenu之前调用SetIconSize,设置菜单
  668. 中图标大小为32×32*/
  669. // m_menuXP.SetIconSize(24,24);
  670. // m_menuXP.ModifyODMenu(NULL,IDM_YWBU,IDB_YW); //
  671. /* m_menuXP.ModifyODMenu(NULL,ID_FILE_OPEN,IDB_BITMAP5);
  672. m_menuXP.ModifyODMenu(NULL,ID_FILE_SAVE,IDB_BITMAP7);
  673. m_menuXP.ModifyODMenu(NULL,ID_FILE_PRINT,IDB_BITMAP6);
  674. m_menuXP.ModifyODMenu(NULL,ID_APP_ABOUT,IDB_BITMAP3);
  675. m_menuXP.ModifyODMenu(NULL,ID_APP_EXIT,IDB_BITMAP2);*/
  676. // m_menuXP.EnableMenuItem (0, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  677. // m_menuXP.EnableMenuItem (2, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  678. // m_menuXP.EnableMenuItem (3, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  679. // m_menuXP.EnableMenuItem (4, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  680. // m_menuXP.EnableMenuItem (5, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  681. // m_menuXP.EnableMenuItem (8, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  682. #if 0 // Jeff此机用选片菜单项不用;
  683. {
  684. BOOL checked=AfxGetApp()->GetProfileInt (LYFZVERSION, "status", 0);
  685. if(checked)
  686. {
  687. CMenu* submenu = m_menuXP.GetSubMenu(1);
  688. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  689. }
  690. }
  691. #endif
  692. {
  693. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status2", 0);
  694. if (checked)
  695. {
  696. #if 0 // Jeff:去掉此机用于员工业绩查看的菜单选项;
  697. CMenu* submenu = m_menuXP.GetSubMenu(1);
  698. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  699. #endif
  700. g_bStaffAchievementShow = 1;
  701. SetTimer(3, 100, NULL);
  702. }
  703. }
  704. if (g_bShowOK == 0)
  705. {
  706. CMenu* submenu = m_menuXP.GetSubMenu(2);
  707. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  708. }
  709. return(m_menuXP.Detach());
  710. }
  711. ///////////////////////////////////////////////////////
  712. //减少代码
  713. #define OPEN_MENU(x) m_Mdi.Append(pName, RUNTIME_CLASS(x), IDR_MAINFRAME, this, nID)
  714. //响应菜单命令
  715. void CMainFrame::OnCommandMenu(UINT nID) // 所有菜单命令都在这里处理;
  716. {
  717. if (nID >= 2000 && nID <= 2100)
  718. {
  719. OnBranchData(nID);
  720. return;
  721. }
  722. if (g_user.bLongin == 0)
  723. {
  724. if (g_bNoLoginLia)
  725. {
  726. Login dlg;
  727. dlg.SetLiaPath("5.lia");
  728. dlg.DoModal();
  729. }
  730. else
  731. {
  732. Login3 dlg;
  733. dlg.SetLiaPath("5.lia");
  734. dlg.DoModal();
  735. }
  736. return;
  737. if (g_user.bLongin == 0)return;
  738. }
  739. else
  740. {
  741. InsideMsg();
  742. }
  743. ResetTimer();
  744. if (nID >= 1000 && nID <= 1100)
  745. {
  746. OnHistory(nID);
  747. return;
  748. }
  749. LPSTR pName;
  750. //打开窗口
  751. switch (nID)
  752. {
  753. case IDM_PayOutSet:
  754. {
  755. if (IsHasRights(16) == 0)return;
  756. PayOutSet dlg;
  757. dlg.DoModal();
  758. return;
  759. }
  760. case IDM_SPLB:
  761. {
  762. if (IsHasRightsnew(29) == 0)return;
  763. SPLBDlg dlg;
  764. dlg.DoModal();
  765. return;
  766. }
  767. case IDM_JD:
  768. {
  769. if (IsHasRightsnew(49) == 0)return;
  770. SPLBDlg dlg;
  771. dlg.m_mode = 1;
  772. dlg.DoModal();
  773. return;
  774. }
  775. case IDM_AREA:
  776. {
  777. if (IsHasRightsnew(47) == 0)return;
  778. AreaDlg dlg;
  779. dlg.DoModal();
  780. return;
  781. }
  782. case IDM_Psw:
  783. {
  784. Psw dlg;
  785. dlg.DoModal();
  786. return;
  787. }
  788. case IDM_Set:
  789. {
  790. if (IsHasRightsnew(49) == 0)return;
  791. Set dlg;
  792. dlg.DoModal();
  793. return;
  794. }
  795. case IDM_HIDEWINDOW:
  796. {
  797. HideWindow dlg;
  798. dlg.DoModal();
  799. return;
  800. }
  801. case IDM_Logout:// Jeff.注销;
  802. {
  803. if(g_user.bLongin)
  804. WriteLog("退出系统!", "退出系统!");
  805. g_user.bLongin = 0;
  806. g_user.name.Empty();
  807. g_user.rights.Empty();
  808. g_user.account.Empty();
  809. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  810. g_pMainWnd2->RefreshOutlookBar();
  811. #ifndef NEW_SKIN
  812. m_wndStatusBar.SetPaneText(1, "未登录", TRUE);
  813. #endif
  814. m_Mdi.CloseAll();
  815. #ifdef ENTERPRISE_VERSION
  816. g_branchname.Empty();
  817. g_branchip.Empty();
  818. g_pMainWnd->OnDisconnect();
  819. g_bBranchModify = 0;
  820. #endif
  821. if (g_pMainWnd2)
  822. {
  823. g_pMainWnd2->DrawLogin();
  824. g_pMainWnd2->ShowBar(0);
  825. }
  826. g_hisyeararray.RemoveAll();
  827. g_pMainWnd->AddHistoryMenu(&g_hisyeararray);
  828. g_brancharray.RemoveAll();
  829. g_pMainWnd->AddBranchMenu(&g_brancharray);
  830. if (g_bNoLoginLia)
  831. {
  832. Login dlg;
  833. dlg.SetLiaPath("5.lia");
  834. dlg.DoModal();
  835. }
  836. else
  837. {
  838. Login3 dlg;
  839. dlg.SetLiaPath("5.lia");
  840. dlg.DoModal();
  841. }
  842. if (g_user.bLongin == 1)
  843. {
  844. if (g_pMainWnd2)
  845. {
  846. g_pMainWnd2->ShowBar(TRUE,TRUE);
  847. }
  848. }
  849. return;
  850. }
  851. case IDM_TODAY:
  852. pName = (LPSTR)(LPCSTR)"历史订单";
  853. // OPEN_MENU(SalarySet3);
  854. OPEN_MENU(DinDanHistroy);
  855. break;
  856. case IDM_TAKECONTROL:
  857. pName = (LPSTR)(LPCSTR)"摄控表";
  858. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(117)))
  859. OPEN_MENU(TodayForm2);
  860. else
  861. OPEN_MENU(TodayForm);
  862. break;
  863. case IDM_CLIENTMONEY:
  864. pName = (LPSTR)(LPCSTR)"客人付款";
  865. OPEN_MENU(ClientMoney);
  866. break;
  867. case IDM_TAKEAWAYBOOK:
  868. pName = (LPSTR)(LPCSTR)"发片/取件";
  869. OPEN_MENU(outsourcing);
  870. break;
  871. case IDM_CODE:
  872. pName = (LPSTR)(LPCSTR)"商品报表";
  873. OPEN_MENU(SPForm);
  874. break;
  875. case IDM_Daily:
  876. // if(IsHasRightsnew(22)==0)return;
  877. // pName = (LPSTR)(LPCSTR)"日财务表";
  878. // OPEN_MENU(DailyForm);
  879. pName = (LPSTR)(LPCSTR)"沟通助手";
  880. OPEN_MENU(InsideMsg);
  881. break;
  882. case IDM_ProcessAlarm:
  883. pName = (LPSTR)(LPCSTR)"流程监控";
  884. OPEN_MENU(ProcessAlarm);
  885. break;
  886. case IDM_DINDAN:
  887. // if(IsHasRights(7)==0)return;
  888. pName = (LPSTR)(LPCSTR)"订单报表";
  889. OPEN_MENU(DinDanFrom);
  890. break;
  891. case IDM_CLIENT:
  892. //if(IsHasRights(8)==0)return;
  893. pName = (LPSTR)(LPCSTR)"客户报表";
  894. OPEN_MENU(CClientForm);
  895. break;
  896. case IDM_PayOutInput:
  897. if (IsHasRightsnew(20) == 0)return;
  898. pName = (LPSTR)(LPCSTR)"现金支出";
  899. OPEN_MENU(PayOutInput);
  900. break;
  901. case IDM_salaryset:
  902. if (IsHasRightsnew(25) == 0)return;
  903. pName = (LPSTR)(LPCSTR)"工资设置";
  904. OPEN_MENU(SalarySet);
  905. break;
  906. case IDM_mysalary:
  907. if (IsHasRights(16) == 0)return;
  908. pName = (LPSTR)(LPCSTR)"我的工资";
  909. OPEN_MENU(MySalary);
  910. break;
  911. case IDM_SP:
  912. // if(IsHasRightsnew(29)==0)return;
  913. pName = (LPSTR)(LPCSTR)"商品设置";
  914. OPEN_MENU(ShangPin);
  915. break;
  916. case IDM_WORKER:
  917. if (IsHasRightsnew(27) == 0)return;
  918. pName = (LPSTR)(LPCSTR)"员工设置";
  919. OPEN_MENU(Worker);
  920. break;
  921. case IDM_TAOXI:
  922. if (IsHasRightsnew(30) == 0)return;
  923. pName = (LPSTR)(LPCSTR)"套系设置";
  924. OPEN_MENU(TXDlg);
  925. break;
  926. case IDM_TAOXISP:
  927. if (IsHasRightsnew(30) == 0)return;
  928. pName = (LPSTR)(LPCSTR)"套系赠送商品设置";
  929. OPEN_MENU(TXSPDlg);
  930. break;
  931. case IDM_Provider:
  932. if (IsHasRightsnew(32) == 0)return;
  933. pName = (LPSTR)(LPCSTR)"供应商设置";
  934. OPEN_MENU(ProviderDlg);
  935. break;
  936. case IDM_BUMEN:
  937. {
  938. if (IsHasRightsnew(49) == 0)return;
  939. BuMenDlg dlg;
  940. dlg.DoModal();
  941. return;
  942. }
  943. case IDM_Account:
  944. if (IsHasRightsnew(49) == 0)return;
  945. pName = (LPSTR)(LPCSTR)"账号管理";
  946. OPEN_MENU(Account);
  947. break;
  948. case IDM_YLCD:
  949. {
  950. //AfxMessageBox("IDM_YLCD");
  951. ::CopyFile(_T(g_path7 + "\\接单系统\\Regsvr32.exe"), _T(g_mainpath + "\\Regsvr32.exe"), 0);
  952. ::CopyFile(_T(g_path7 + "\\接单系统\\Flash9f.ocx"), _T(g_mainpath + "\\Flash9f.ocx"), 0);
  953. CString temp;
  954. temp.Format("%s\\regsvr32.exe /s %s\\Flash9f.OCX", g_mainpath, g_mainpath);
  955. WinExec(temp, SW_HIDE);
  956. ::CopyFile(_T(g_path7 + "\\接单系统\\接单系统.exe"), _T(g_mainpath + "\\接单系统.exe"), 0);
  957. ::CopyFile(_T(g_path7 + "\\接单系统\\my32.dll"), _T(g_mainpath + "\\my32.dll"), 0);
  958. ::CopyFile(_T(g_path7 + "\\接单系统\\server.dat"), _T(g_mainpath + "\\server.dat"), 0);
  959. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\接单系统.exe"), g_server, NULL, SW_SHOWNORMAL);
  960. }
  961. break;
  962. case IDM_YLCDMANAGE:
  963. ::CopyFile(_T(g_path7 + "\\接单系统\\资源管理器.exe"), _T(g_mainpath + "\\资源管理器.exe"), 0);
  964. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\资源管理器.exe"), g_server, NULL, SW_SHOWNORMAL);
  965. break;
  966. }
  967. }
  968. //减少代码
  969. ///////////////////////////////////////////////////////////////////////////////
  970. void CMainFrame::OnDisconnect()
  971. {
  972. printf("断开TCP连接\n");
  973. m_tClientTunnel.net_CloseSocket();
  974. SetConnectionID(INVALID_SOCKET);
  975. }
  976. void CMainFrame::ProcessLoginResponse(void *pLoginResult)
  977. {
  978. if (NULL == pLoginResult) return;
  979. LOGIN_RESULT_STRU *ptLoginResult = (LOGIN_RESULT_STRU *)pLoginResult;
  980. DWORD dwConnectionID = ptLoginResult->tCommonMsg.dwConnectionID;
  981. SetConnectionID(dwConnectionID);
  982. BYTE byResult = ptLoginResult->byResult;
  983. if (LOGIN_RESULT_SUC == byResult)
  984. {
  985. //AfxMessageBox("登录成功"); // Jeff test;
  986. }
  987. else
  988. {
  989. OnDisconnect();
  990. }
  991. }
  992. /************************************************************************/
  993. /* 函数:ProcessLoginRequest[3/3/2016 IT];
  994. /* 描述:登陆服务器;
  995. /* 参数:;
  996. /* [IN] :;
  997. /* [OUT] :;
  998. /* [IN/OUT] :;
  999. /* 返回:登陆成功返回TRUE;
  1000. /* 注意:;
  1001. /* 示例:;
  1002. /*
  1003. /* 修改:;
  1004. /* 日期:;
  1005. /* 内容:;
  1006. /************************************************************************/
  1007. BOOL CMainFrame::ProcessLoginRequest()
  1008. {
  1009. // 1.设置通信类型MSG_LOGIN_REQ,为登陆请求;
  1010. WORD wMessageId = 0;
  1011. if (g_conntype == 0 && !g_bConnLYFZ)
  1012. wMessageId = (MSG_LOGIN_REQ + 0X1FFF);
  1013. else// if (g_bConnLYFZ )
  1014. wMessageId = MSG_LOGIN_REQ;
  1015. // 2.填充发送数据;
  1016. TLOGIN_STRU tLogonInfo = { 0 };
  1017. tLogonInfo.tCommonMsg.dwConnectionID = GetConnectionID();//此时m_dwConnectionID为INVALIDE_SOCKET;
  1018. tLogonInfo.tCommonMsg.wMessageId = wMessageId;
  1019. CString strUserName = newGUID();// 以随机数作为登陆时的用户名称;
  1020. strUserName.TrimLeft();
  1021. strUserName.TrimRight();
  1022. #if defined(VC70) || defined(VC60)
  1023. strcpy(tLogonInfo.tUserInfo.szUserName, strUserName);
  1024. #else
  1025. strcpy_s(tLogonInfo.tUserInfo.szUserName, 31, strUserName);
  1026. #endif
  1027. DWORD dwDataLen = sizeof(TLOGIN_STRU);
  1028. // 3.填充数据头;
  1029. TMessageHeader tHeader = { 0 };
  1030. tHeader.wMessageId = wMessageId;
  1031. tHeader.dwDataLen = dwDataLen;
  1032. // 4.发送数据;
  1033. unsigned long ulSendLen = m_tClientTunnel.net_Send(&tHeader, (void *)&tLogonInfo, dwDataLen);
  1034. if (ulSendLen == SOCKET_ERROR)
  1035. {
  1036. return 0;
  1037. }
  1038. return 1;
  1039. }
  1040. DWORD CMainFrame::GetConnectionID()
  1041. {
  1042. return m_dwConnectionID;
  1043. }
  1044. void CMainFrame::SetConnectionID(DWORD dwConnection)
  1045. {
  1046. m_dwConnectionID = dwConnection;
  1047. }
  1048. /************************************************************************/
  1049. /* 函数:ProcessChatMessageRequest2[3/3/2016 IT];
  1050. /* 描述:;
  1051. /* 参数:;
  1052. /* [IN] code:;
  1053. /* 返回:void;
  1054. /* 注意:
  1055. OnConnect() -> ProcessChatMessageRequest()
  1056. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1057. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1058. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1059. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1060. 5.关闭对话框和断开连接;;
  1061. /* 示例:;
  1062. /*
  1063. /* 修改:;
  1064. /* 日期:;
  1065. /* 内容:;
  1066. /************************************************************************/
  1067. void CMainFrame::ProcessChatMessageRequest2(BYTE code)
  1068. {
  1069. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1070. SendDataDlg dlg;
  1071. dlg.m_bycode = code;
  1072. dlg.DoModal();
  1073. }
  1074. //*********************************************//
  1075. /*
  1076. 函数:ProcessChatMessageRequest2
  1077. 参数:CString sql [IN]
  1078. 返回:无
  1079. 过程:OnConnect() -> ProcessChatMessageRequest()
  1080. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1081. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1082. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1083. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1084. 5.关闭对话框和断开连接;
  1085. */
  1086. //*********************************************//
  1087. void CMainFrame::ProcessChatMessageRequest2(CString sql)
  1088. {
  1089. if ((sql.Find("insert") != -1 || sql.Find("update") != -1 || sql.Find("delete") != -1) && g_branchname != "" && g_bBranchModify == 0)
  1090. {
  1091. AfxMessageBox("当前为分店数据查看状态,不能更改分店数据!", MB_ICONSTOP);
  1092. g_bSendOK = 0;
  1093. return;
  1094. }
  1095. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1096. SendDataDlg dlg;
  1097. dlg.m_strSQL = sql;
  1098. dlg.DoModal();
  1099. }
  1100. //*********************************************//
  1101. /*
  1102. 函数:ProcessChatMessageRequest2
  1103. 参数:BYTE *pData [IN], int length [IN]
  1104. 返回:无
  1105. 过程:OnConnect() -> ProcessChatMessageRequest()
  1106. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1107. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1108. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1109. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1110. 5.关闭对话框和断开连接;
  1111. */
  1112. //*********************************************//
  1113. void CMainFrame::ProcessChatMessageRequest2(BYTE *pData, int length)
  1114. {
  1115. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1116. SendDataDlg dlg;
  1117. dlg.m_pData = pData;
  1118. dlg.m_nlength = length;
  1119. dlg.DoModal(); // DoModal未执行完时,就被其他函数销毁,导致局部函数dlg无效;
  1120. }
  1121. /************************************************************************/
  1122. /*
  1123. 函数:ProcessChatMessageRequest
  1124. 描述:对服务发送数据;
  1125. 参数:void *szDataBuf[IN], int nDataLen[IN]
  1126. 返回:发送成功与否;
  1127. */
  1128. /************************************************************************/
  1129. BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)
  1130. {
  1131. // 1.获取当前与服务器连接的id;
  1132. DWORD dwFromUserID = GetConnectionID();
  1133. // 2.设置通信类型为MSG_CHATMESSAGE_REQ;
  1134. WORD wMessageId = 0;
  1135. if (g_conntype == 0 && !g_bConnLYFZ)
  1136. wMessageId = (MSG_CHATMESSAGE_REQ + 0X3FFF);
  1137. else
  1138. wMessageId = MSG_CHATMESSAGE_REQ;
  1139. // 3.计算出欲发送的数据的长度 dwDataLen;
  1140. DWORD dwDataLen = sizeof(TCHAT_MESSAGE_STRU) + nDataLen;
  1141. BYTE *pSendData = new BYTE[dwDataLen];
  1142. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU*)pSendData;
  1143. memset(pChatMessage, 0x00, dwDataLen);
  1144. // 3.1.g_nYearpos==-1,表示连接是当前主数据库,其他值表示历史数据库;
  1145. if (g_nYearpos == -1)
  1146. g_sendhead.length[99] = g_nYearpos;
  1147. else
  1148. g_sendhead.length[99] = g_nYearpos * 32142953 + 10966236;
  1149. g_sendhead.length[98] = 987123768;
  1150. memcpy(pSendData, &g_sendhead, sizeof(g_sendhead));
  1151. #ifdef ENTERPRISE_VERSION
  1152. if (g_bBranchModify == 0)
  1153. #if defined(VC60) || defined(VC70)
  1154. strcpy(pChatMessage->szFromUserName, g_branchname);
  1155. #else
  1156. strcpy_s(pChatMessage->szFromUserName, 30, g_branchname);
  1157. #endif
  1158. #endif
  1159. // 4.填充发送的数据结构;
  1160. pChatMessage->tCommonMsg.dwConnectionID = GetConnectionID();
  1161. pChatMessage->tCommonMsg.wMessageId = wMessageId;
  1162. pChatMessage->dwFromUserID = dwFromUserID;
  1163. pChatMessage->dwToUserID = g_nSendCode;//▲▲g_nSendCode在服务端同为dwToUserID;
  1164. pChatMessage->wMessageLen = nDataLen;
  1165. memcpy(pChatMessage->byFileContent, szDataBuf, nDataLen);
  1166. // 5.填充数据头;
  1167. TMessageHeader tHeader = { 0 };
  1168. tHeader.wMessageId = wMessageId;
  1169. tHeader.dwDataLen = dwDataLen;
  1170. // 6.发送数据;
  1171. BOOL bRet = 0;
  1172. unsigned long ulSendLen = m_tClientTunnel.net_Send(&tHeader, (void *)pChatMessage, dwDataLen);
  1173. if (ulSendLen != SOCKET_ERROR)
  1174. {
  1175. bRet = 1;
  1176. }
  1177. // 7.发送完毕,释放内存;
  1178. delete[] pSendData;
  1179. return bRet;
  1180. }
  1181. /************************************************************************/
  1182. /*
  1183. 函数:ProcessChatMessageResponse
  1184. 描述:接收服务返回的数据;
  1185. 参数:void *pResponse[IN]
  1186. 返回:无;
  1187. 调用关系:
  1188. 1.由 void CMainFrame::ProcessNetEvent(...)调用
  1189. */
  1190. /************************************************************************/
  1191. void CMainFrame::ProcessChatMessageResponse(void *pResponse)
  1192. {
  1193. // 1.数据空,直接返回;
  1194. if (NULL == pResponse)
  1195. return;
  1196. // 2.数据解析过程;
  1197. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pResponse;
  1198. int nMessageLen = pChatMessage->wMessageLen;
  1199. int nMessageLen2 = pChatMessage->dwToUserID; // 在服务器中被处理了,一般使dwToUserID=wMessageLen;
  1200. // Jeff.dwFromUserID==8888表示的内容是更新客户端skin界面数据,只有两处dwToUserID==211和dwToUserID==21;
  1201. // Jeff.其余的大多数都是 dwFromUserID = wMessageLen = dwToUserID 三者相等;
  1202. if (nMessageLen == nMessageLen2 && pChatMessage->dwFromUserID != 8888)
  1203. {
  1204. // 2.1.清除全局变量g_pData数据,用于保存接收的实际数据;
  1205. if (g_pData)
  1206. delete[]g_pData;
  1207. g_pData = NULL;
  1208. g_pData = new BYTE[nMessageLen];
  1209. memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
  1210. memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
  1211. g_nLeng = nMessageLen;
  1212. if (nMessageLen <= sizeof(DWORD))
  1213. {
  1214. memcpy(&g_ncount, pChatMessage->byFileContent, sizeof(DWORD));
  1215. }
  1216. KillTimer(2);
  1217. if (g_hSendWnd)
  1218. {
  1219. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);//关闭发送对话框;
  1220. }
  1221. }
  1222. else if (nMessageLen == nMessageLen2 && pChatMessage->dwFromUserID == 8888)
  1223. {
  1224. if (g_pData2)
  1225. delete[]g_pData2;
  1226. g_pData2 = NULL;
  1227. g_pData2 = new BYTE[nMessageLen2];
  1228. memcpy(g_pData2, pChatMessage->byFileContent, nMessageLen2);
  1229. g_nLeng2 = nMessageLen2;
  1230. KillTimer(2);
  1231. if (g_hSendWnd)
  1232. {
  1233. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1234. }
  1235. }
  1236. else // 登陆返回;
  1237. {
  1238. if (g_bConnLYFZ)
  1239. {
  1240. if (g_pData)
  1241. delete[]g_pData;
  1242. g_pData = NULL;
  1243. g_pData = new BYTE[nMessageLen];
  1244. memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
  1245. memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
  1246. g_nLeng = nMessageLen;
  1247. if (nMessageLen <= sizeof(DWORD))
  1248. {
  1249. memcpy(&g_ncount, pChatMessage->byFileContent, sizeof(DWORD));
  1250. }
  1251. KillTimer(2);
  1252. if (g_hSendWnd)
  1253. {
  1254. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1255. }
  1256. return;
  1257. }
  1258. if (g_conntype) // Jeff.g_conntype == 1,表示连接公司服务器的返回,用于集团版解析*.ly.com的IP地址;
  1259. {
  1260. // KillTimer(2);
  1261. char *szChatMessage = new char[nMessageLen + 1];
  1262. memset(szChatMessage, 0x00, nMessageLen + 1);
  1263. memcpy(szChatMessage, pChatMessage->byFileContent, nMessageLen);
  1264. g_server = szChatMessage;
  1265. delete[]szChatMessage;
  1266. CStdioFile fp;
  1267. CString path = g_mainpath + "\\ip.txt";
  1268. ::DeleteFile(path); // 删除ip.txt;
  1269. fp.Open(path, CFile::modeCreate | CFile::modeWrite);
  1270. fp.WriteString(g_server);
  1271. fp.Close();
  1272. g_conntype = 0;
  1273. // g_serverip=g_server;
  1274. return;
  1275. }
  1276. if (g_pData2 == NULL)
  1277. {
  1278. g_pData2 = new BYTE[nMessageLen2];
  1279. g_nLeng2 = 0;
  1280. }
  1281. memcpy(g_pData2 + g_nLeng2, pChatMessage->byFileContent, nMessageLen);
  1282. g_nLeng2 += nMessageLen;
  1283. if (g_nLeng2 == nMessageLen2)//已收完
  1284. {
  1285. KillTimer(2);
  1286. if (g_hSendWnd)
  1287. {
  1288. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1289. }
  1290. }
  1291. else
  1292. {
  1293. KillTimer(2);
  1294. SetTimer(2, g_ntimeout, NULL);
  1295. }
  1296. }
  1297. }
  1298. #if USE_SHARE_FLORD
  1299. /************************************************************************/
  1300. /*
  1301. Date: 2015-04-11
  1302. Author: Jeff
  1303. 函数:GetSharePathInfo
  1304. 描述:获取共享目录表的所有信息;
  1305. 参数:
  1306. 返回:成功返回TRUE;
  1307. 注意:获取的表记录存储在全局变量g_aryOfSharePathInfo中;
  1308. 调用约定:在登陆软件时调用,且必须连接的服务器是本店的;
  1309. */
  1310. /************************************************************************/
  1311. BOOL CMainFrame::GetSharePathInfo()
  1312. {
  1313. // 1.连接的数据库必须是本局域网的服务器;
  1314. if ( g_bAllBranch || !g_branchname.IsEmpty() || !g_branchip.IsEmpty() )
  1315. {
  1316. // 非当前局域网服务器;
  1317. return FALSE;
  1318. }
  1319. // 2.获取当前连接的分店域名是否与g_domain一致;
  1320. g_sendhead.bsql = 0;
  1321. g_sendhead.code[0] = 29;
  1322. g_sendhead.tabcount = 1;
  1323. g_pMainWnd->ProcessChatMessageRequest2(23);
  1324. if ( !g_bSendOK )
  1325. {
  1326. // 连接服务器失败;
  1327. return FALSE;
  1328. }
  1329. CArray<CStringArray,CStringArray> strArray;
  1330. DataToArray(&strArray);
  1331. CString strCurBranchDomain = _T("");
  1332. if ( strArray.GetSize() )
  1333. {
  1334. strCurBranchDomain = strArray.ElementAt(0).ElementAt(0);
  1335. if ( strCurBranchDomain.Find(_T(".ly.com")) == -1)
  1336. {
  1337. // 当前获取的域名有错;
  1338. return FALSE;
  1339. }
  1340. }
  1341. if ( g_domain.CompareNoCase(strCurBranchDomain) != 0)
  1342. {
  1343. // 当前连接的分店域名与局域网服务器域名不一致;
  1344. return FALSE;
  1345. }
  1346. // 3.获取可用的共享信息;//select * from NetShareInfo where enable = 1;
  1347. CString strFilter = _T("");
  1348. strFilter.Format(_T("enable = 1"));
  1349. int g_nYearposTemp=g_nYearpos;
  1350. g_nYearpos=-1;
  1351. g_bSendOK = 0;
  1352. g_sendhead.bsql = 0;
  1353. g_sendhead.code[0] = 236;
  1354. g_sendhead.tabcount = 1;
  1355. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  1356. g_nYearpos = g_nYearposTemp;
  1357. if ( !g_bSendOK )
  1358. {
  1359. // 获取共享信息失败;
  1360. return FALSE;
  1361. }
  1362. g_aryOfSharePathInfo.RemoveAll();
  1363. DataToArray(&g_aryOfSharePathInfo);
  1364. return g_aryOfSharePathInfo.GetSize() ? TRUE : FALSE;
  1365. }
  1366. #endif
  1367. BOOL CMainFrame::OnConnectBranch()
  1368. {
  1369. if (g_branchip == "")
  1370. {
  1371. return 0;
  1372. }
  1373. g_conntype = 0;
  1374. CString strServerAddress = g_branchip;
  1375. char *szServerAddress = strServerAddress.GetBuffer(0);
  1376. strServerAddress.ReleaseBuffer();
  1377. /*for Client, IP and Port can be 0,
  1378. and for Server, IP is LocalIP, and Port is Listening Port*/
  1379. int nResult = m_tClientTunnel.net_OpenSocket(
  1380. Transport_Client,
  1381. 0,
  1382. HandleClientNetEvent,
  1383. this);
  1384. if (TRANSPORT_OK != nResult)
  1385. {
  1386. // AfxMessageBox("网络初始化失败!");
  1387. return 0;
  1388. }
  1389. GetSysIniInfo(g_szModulePath, g_branchname + _T(".ini"));
  1390. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1391. DWORD wPort = g_dwCSPort;
  1392. #if defined(VC70) || defined(VC60)
  1393. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1394. if (TRANSPORT_OK != nResult)
  1395. #else
  1396. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1397. if (!nResult)
  1398. #endif
  1399. {
  1400. m_tClientTunnel.net_CloseSocket();
  1401. return OnConnectBranch2();
  1402. }
  1403. return ProcessLoginRequest();
  1404. }
  1405. BOOL CMainFrame::OnConnectBranch2()
  1406. {
  1407. if (g_branchip2 == "")
  1408. {
  1409. return 0;
  1410. }
  1411. g_conntype = 0;
  1412. CString strServerAddress = g_branchip2;
  1413. char *szServerAddress = strServerAddress.GetBuffer(0);
  1414. strServerAddress.ReleaseBuffer();
  1415. /*for Client, IP and Port can be 0,
  1416. and for Server, IP is LocalIP, and Port is Listening Port*/
  1417. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1418. 0,
  1419. HandleClientNetEvent,
  1420. this);
  1421. if (TRANSPORT_OK != nResult)
  1422. {
  1423. // AfxMessageBox("网络初始化失败!");
  1424. return 0;
  1425. }
  1426. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1427. DWORD wPort = SERVER_PORT; // 5678
  1428. #if defined(VC70) || defined(VC60)
  1429. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1430. if (TRANSPORT_OK != nResult)
  1431. #else
  1432. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1433. if (!nResult)
  1434. #endif
  1435. {
  1436. m_tClientTunnel.net_CloseSocket();
  1437. return 0;
  1438. }
  1439. return ProcessLoginRequest();
  1440. }
  1441. BOOL CMainFrame::OnConnectIP()
  1442. {
  1443. CString strServerAddress = g_server;
  1444. char *szServerAddress = strServerAddress.GetBuffer(0);
  1445. strServerAddress.ReleaseBuffer();
  1446. /*for Client, IP and Port can be 0,
  1447. and for Server, IP is LocalIP, and Port is Listening Port*/
  1448. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1449. 0,
  1450. HandleClientNetEvent,
  1451. this);
  1452. if (TRANSPORT_OK != nResult)
  1453. {
  1454. // AfxMessageBox("网络初始化失败!");
  1455. return 0;
  1456. }
  1457. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1458. DWORD wPort = SERVER_PORT; // 5678
  1459. #if defined(VC70) || defined(VC60)
  1460. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1461. if (TRANSPORT_OK != nResult)
  1462. #else
  1463. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1464. if (!nResult)
  1465. #endif
  1466. {
  1467. m_tClientTunnel.net_CloseSocket();
  1468. return 0;
  1469. }
  1470. return ProcessLoginRequest();
  1471. }
  1472. //ip.txt
  1473. BOOL CMainFrame::OnConnectLYFZ()
  1474. {
  1475. #ifdef _DEBUG
  1476. CString strBranchIP = "192.168.1.66";
  1477. #else
  1478. CString strBranchIP = "lijiafz.vicp.net";
  1479. #endif
  1480. MyGetIPByName2(strBranchIP);
  1481. if (strBranchIP == "")
  1482. {
  1483. return 0;
  1484. }
  1485. g_conntype = 0; // Jeff.Delete at 2014.10.18
  1486. //g_conntype = 1;
  1487. CString strServerAddress = strBranchIP;
  1488. char *szServerAddress = strServerAddress.GetBuffer(0);
  1489. strServerAddress.ReleaseBuffer();
  1490. /*for Client, IP and Port can be 0,
  1491. and for Server, IP is LocalIP, and Port is Listening Port*/
  1492. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1493. 0,
  1494. HandleClientNetEvent,
  1495. this);
  1496. if (TRANSPORT_OK != nResult)
  1497. {
  1498. return 0;
  1499. }
  1500. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1501. #ifdef _DEBUG
  1502. DWORD wPort = 8387;
  1503. #else
  1504. DWORD wPort = GetPort();
  1505. #endif
  1506. #if defined(VC70) || defined(VC60)
  1507. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1508. if (TRANSPORT_OK != nResult)
  1509. #else
  1510. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1511. if (!nResult)
  1512. #endif
  1513. {
  1514. m_tClientTunnel.net_CloseSocket();
  1515. return 0;
  1516. }
  1517. return ProcessLoginRequest();
  1518. }
  1519. BOOL CMainFrame::OnConnect()
  1520. {
  1521. // 1.Jeff 断开(如果有在在未关的连接)之前的连接;
  1522. OnDisconnect();
  1523. // 2.根据需要连接指定的服务器;
  1524. if (g_bBranchModify)
  1525. {
  1526. // Jeff.g_bBranchModify在g_bGenBranchData=1时,在welcome::OnTimer里被设置为1;
  1527. return OnConnectBranch();// 连接集团版分店;
  1528. }
  1529. if (g_bConnLYFZ)
  1530. {
  1531. return OnConnectLYFZ();// 连接公司服务端程序;
  1532. }
  1533. g_conntype = 0;
  1534. CString strServerAddress = g_server;
  1535. // 3.如果dbconfig.dat里保存的是*.ly.com的信息,就要读取ip.txt里的IP地址;
  1536. if (g_serverbak.Find(".ly.com") != -1)
  1537. {
  1538. strServerAddress = g_serverbak;
  1539. CStdioFile fp;
  1540. CString path = g_mainpath + "\\ip.txt";
  1541. if (::PathFileExists(path))
  1542. {
  1543. fp.Open(path, CFile::modeRead);
  1544. fp.ReadString(g_server);
  1545. fp.Close();
  1546. if (OnConnectIP())
  1547. {
  1548. // g_serverip=g_server;
  1549. return 1;
  1550. }
  1551. g_server = strServerAddress;
  1552. OnDisconnect();//MessageBox("ip失败");
  1553. }
  1554. g_conntype = 1; // Jeff.连接公司服务器,用于获取集团版*.ly.com的解析IP结果;
  1555. strServerAddress = "lijiafz.vicp.net";
  1556. MyGetIPByName2(strServerAddress);
  1557. if (strServerAddress.IsEmpty())
  1558. {
  1559. return 0;//OnConnect2();
  1560. }
  1561. }
  1562. else if (g_ntimeout == 29000)//非远程 30000
  1563. {
  1564. strServerAddress = g_serverarray.ElementAt(g_conpos);
  1565. }
  1566. // 4.如果没有IP.txt或dbconfig.dat里的不是ly.com信息,而是一般的计算机名称;
  1567. char *szServerAddress = strServerAddress.GetBuffer(0);
  1568. strServerAddress.ReleaseBuffer();
  1569. // AfxMessageBox("连接:"+strServerAddress);
  1570. /*for Client, IP and Port can be 0,
  1571. and for Server, IP is LocalIP, and Port is Listening Port*/
  1572. // 5.创建通信对象连接;
  1573. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1574. 0,
  1575. HandleClientNetEvent,
  1576. this);
  1577. if (TRANSPORT_OK != nResult)
  1578. {
  1579. return 0;
  1580. }
  1581. GetSysIniInfo();
  1582. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1583. DWORD wPort = g_dwCSPort;
  1584. if (g_conntype) wPort = GetPort();
  1585. // 6.连接公司服务器或影楼服务器;
  1586. #if defined(VC70) || defined(VC60)
  1587. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1588. if (TRANSPORT_OK != nResult)
  1589. #else
  1590. nResult = m_tClientTunnel.net_Connect(szServerAddress,wPort);
  1591. if (!nResult)
  1592. #endif
  1593. {
  1594. m_tClientTunnel.net_CloseSocket();
  1595. if (g_conntype)// Jeff.连接公司服务器,用于获取集团版*.ly.com的解析IP结果;
  1596. {
  1597. return 0;//OnConnect2();
  1598. }
  1599. if (g_serverarray.GetSize() > 1)
  1600. {
  1601. if (g_conpos < (g_serverarray.GetSize() - 1))
  1602. {
  1603. g_conpos++;
  1604. return OnConnect();
  1605. }
  1606. else
  1607. {
  1608. g_conpos = 0;
  1609. return 0;
  1610. }
  1611. }
  1612. return 0;
  1613. }
  1614. return ProcessLoginRequest();
  1615. }
  1616. BOOL CMainFrame::OnConnect2()
  1617. {
  1618. g_conntype = 2;
  1619. CString server = "http://www.lyfz.net/download/ip.txt";
  1620. char buf[MAX_PATH];
  1621. ::GetTempPath(sizeof(buf), buf);
  1622. CString m_strTempDir = buf;
  1623. DWORD m_dwHttpRequestFlags = HSR_DOWNLOAD | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
  1624. INTERNET_PORT m_dwPort;
  1625. DWORD dwType;
  1626. CInternetSession m_cis;
  1627. CHttpConnection *m_pHttp;
  1628. CString m_strServer;
  1629. CString m_strIniPath;
  1630. AfxParseURL(server, dwType, m_strServer, m_strIniPath, m_dwPort);
  1631. if (dwType != AFX_INET_SERVICE_HTTP)
  1632. {
  1633. return 0;//OnConnect3();
  1634. }
  1635. m_cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5);
  1636. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1637. try
  1638. {
  1639. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1640. }
  1641. catch (CInternetException* pEx)
  1642. {
  1643. return 0;//OnConnect3();
  1644. }
  1645. CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_GET,
  1646. m_strIniPath, NULL, 1, NULL, NULL, m_dwHttpRequestFlags);
  1647. try
  1648. {
  1649. pFile->SendRequest();
  1650. }
  1651. catch (CInternetException* pEx)
  1652. {
  1653. pFile->Close();
  1654. return 0;//OnConnect3();
  1655. }
  1656. if (pFile)
  1657. {
  1658. CStdioFile csf;
  1659. csf.Open(m_strTempDir + "\\ip.txt", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
  1660. char buf[2048];
  1661. int n;
  1662. while ((n = pFile->Read(buf, 2048)) > 0)
  1663. csf.Write(buf, n);
  1664. csf.Close();
  1665. pFile->Close();
  1666. }
  1667. CString strServerAddress;
  1668. CStdioFile fp;
  1669. fp.Open(m_strTempDir + "\\ip.txt", CFile::modeRead);
  1670. fp.ReadString(strServerAddress);
  1671. fp.Close();
  1672. char *szServerAddress = strServerAddress.GetBuffer(0);
  1673. strServerAddress.ReleaseBuffer();
  1674. /*for Client, IP and Port can be 0,
  1675. and for Server, IP is LocalIP, and Port is Listening Port*/
  1676. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1677. 0,
  1678. HandleClientNetEvent,
  1679. this);
  1680. if (TRANSPORT_OK != nResult)
  1681. {
  1682. return 0;
  1683. }
  1684. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1685. DWORD wPort = SERVER_PORT; // 5678
  1686. if (g_conntype)wPort = GetPort();
  1687. #if defined(VC70) || defined(VC60)
  1688. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1689. if (TRANSPORT_OK != nResult)
  1690. #else
  1691. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1692. if (!nResult)
  1693. #endif
  1694. {
  1695. m_tClientTunnel.net_CloseSocket();
  1696. return 0;//OnConnect3();
  1697. }
  1698. return ProcessLoginRequest();
  1699. }
  1700. BOOL CMainFrame::OnConnect3()
  1701. {
  1702. g_conntype = 3;
  1703. CString server = "http://photo.bjlyfz.com/download/ip.txt";
  1704. char buf[MAX_PATH];
  1705. ::GetTempPath(sizeof(buf), buf);
  1706. CString m_strTempDir = buf;
  1707. DWORD m_dwHttpRequestFlags = HSR_DOWNLOAD | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
  1708. INTERNET_PORT m_dwPort;
  1709. DWORD dwType;
  1710. CInternetSession m_cis;
  1711. CHttpConnection *m_pHttp;
  1712. CString m_strServer;
  1713. CString m_strIniPath;
  1714. AfxParseURL(server, dwType, m_strServer, m_strIniPath, m_dwPort);
  1715. if (dwType != AFX_INET_SERVICE_HTTP)
  1716. {
  1717. return FALSE;
  1718. }
  1719. m_cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5);
  1720. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1721. try
  1722. {
  1723. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1724. }
  1725. catch (CInternetException* pEx)
  1726. {
  1727. return false;
  1728. }
  1729. CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_GET,
  1730. m_strIniPath, NULL, 1, NULL, NULL, m_dwHttpRequestFlags);
  1731. try
  1732. {
  1733. pFile->SendRequest();
  1734. }
  1735. catch (CInternetException* pEx)
  1736. {
  1737. pFile->Close();
  1738. return false;
  1739. }
  1740. if (pFile)
  1741. {
  1742. CStdioFile csf;
  1743. csf.Open(m_strTempDir + "\\ip.txt", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
  1744. char buf[2048];
  1745. int n;
  1746. while ((n = pFile->Read(buf, 2048)) > 0)
  1747. csf.Write(buf, n);
  1748. csf.Close();
  1749. pFile->Close();
  1750. }
  1751. CString strServerAddress;
  1752. CStdioFile fp;
  1753. fp.Open(m_strTempDir + "\\ip.txt", CFile::modeRead);
  1754. fp.ReadString(strServerAddress);
  1755. fp.Close();
  1756. char *szServerAddress = strServerAddress.GetBuffer(0);
  1757. strServerAddress.ReleaseBuffer();
  1758. /*for Client, IP and Port can be 0,
  1759. and for Server, IP is LocalIP, and Port is Listening Port*/
  1760. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1761. 0,
  1762. HandleClientNetEvent,
  1763. this);
  1764. if (TRANSPORT_OK != nResult)
  1765. {
  1766. return 0;
  1767. }
  1768. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1769. DWORD wPort = SERVER_PORT; // 5678
  1770. if (g_conntype)wPort = GetPort();
  1771. #if defined(VC70) || defined(VC60)
  1772. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1773. if (TRANSPORT_OK != nResult)
  1774. #else
  1775. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1776. if (!nResult)
  1777. #endif
  1778. {
  1779. m_tClientTunnel.net_CloseSocket();
  1780. return 0;
  1781. }
  1782. return ProcessLoginRequest();
  1783. }
  1784. void CMainFrame::ProcessNetEvent(int nEventType, void *pRecvMsg, DWORD dwDataLen)
  1785. {
  1786. //printf("Jeff:ProcessNetEvent\n\n");//Jeff Printf;
  1787. if (Transport_ReadEv == nEventType)
  1788. {
  1789. if (NULL == pRecvMsg) return;
  1790. TMessageHeader* pHeader = (TMessageHeader *)pRecvMsg;
  1791. char *pDataBuf = (char *)pRecvMsg + MESSAGE_HEADER_LEN;
  1792. WORD dwMessageID = pHeader->wMessageId;
  1793. switch (dwMessageID)
  1794. {
  1795. case MSG_LOGIN_RESP:
  1796. case (MSG_LOGIN_RESP + 0X2FFF) :
  1797. {
  1798. LOGIN_RESULT_STRU tLoginResult = { 0 };
  1799. memcpy(&tLoginResult, pDataBuf, sizeof(LOGIN_RESULT_STRU));
  1800. ProcessLoginResponse(&tLoginResult);
  1801. break;
  1802. }
  1803. case MSG_USERINFO_RESP:
  1804. {
  1805. break;
  1806. }
  1807. case MSG_LOGOUT_RESP:
  1808. {
  1809. break;
  1810. }
  1811. case MSG_CHATMESSAGE_RESP:
  1812. case (MSG_CHATMESSAGE_RESP + 0X4FFF) :
  1813. {
  1814. static int i = 0;
  1815. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pDataBuf;
  1816. ProcessChatMessageResponse((void *)pChatMessage);
  1817. break;
  1818. }
  1819. default:
  1820. {
  1821. break;
  1822. }
  1823. }
  1824. }
  1825. else if (Transport_CloseEv == nEventType)
  1826. {
  1827. OnDisconnect();
  1828. }
  1829. }
  1830. //extern BOOL g_bNeedCoon;
  1831. extern BOOL EncryptFile2(BYTE *buffer, DWORD leng, PCHAR szPassword);
  1832. void CMainFrame::OnTimer(UINT nIDEvent)
  1833. {
  1834. // TODO: Add your message handler code here and/or call default
  1835. if (1 == nIDEvent)
  1836. {
  1837. KillTimer(nIDEvent);
  1838. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status", 0);//status:此机用选片菜单项
  1839. // checked==1:此机用选片菜单项
  1840. // g_bStaffAchievementShow==1:此机用于员工业绩查看
  1841. if (checked && g_bStaffAchievementShow == 0) // .此机用选片菜单项;
  1842. {
  1843. KillTimer(3);
  1844. #ifdef NEW_SKIN
  1845. Welcome weldlg;
  1846. weldlg.DoModal();
  1847. #endif
  1848. ChoosePhotoSkin dlg;
  1849. dlg.SetLiaPath("1.lia");
  1850. if (dlg.DoModal() != IDOK)
  1851. {
  1852. PostMessage(WM_QUIT);
  1853. return;
  1854. }
  1855. if (dlg.m_exitcode == 3)
  1856. {
  1857. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  1858. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  1859. }
  1860. else
  1861. {
  1862. ShowWindow(SW_SHOW);
  1863. #ifdef NEW_SKIN
  1864. if (m_pMainFrimDlg2 == NULL)
  1865. {
  1866. m_pMainFrimDlg2 = new MainFrimDlg2;
  1867. m_pMainFrimDlg2->SetLiaPath("10.lia");
  1868. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  1869. }
  1870. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1871. #endif
  1872. }
  1873. }
  1874. else if (g_bStaffAchievementShow == 0) // .非选片、非查看员工业绩;
  1875. {
  1876. #ifdef NEW_SKIN
  1877. g_bNoConnDlg = 1;
  1878. Welcome weldlg;
  1879. weldlg.DoModal();
  1880. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1881. ShowWindow(SW_SHOW);
  1882. g_bNoConnDlg = 0;
  1883. if (g_bNoLoginLia) // Jeff.OnCreate里判断skin文件有5.lia, g_bNoLoginLia = 0, 无 g_bNoLoginLia = 1;
  1884. {
  1885. Login dlg;
  1886. dlg.SetLiaPath("5.lia");
  1887. dlg.DoModal();
  1888. }
  1889. else
  1890. {
  1891. Login3 dlg;
  1892. dlg.SetLiaPath("5.lia"); // Login3的父类为MyDlg,在BOOL MyDlg::OnInitDialog()里调用了纯虚函数Init();
  1893. dlg.DoModal();
  1894. // 数据库完整性提醒;
  1895. if ( 1 == atoi(g_cominfoarray.ElementAt(0).ElementAt(159)) )
  1896. {
  1897. MessageBox(_T("贵店数据库可能已损坏,请尽快联系售后人员进行确认或维护,联系电话:0752-2398865 或 4006-067-068!"), _T("重要提示:"), MB_OK | MB_TOPMOST /*| MB_SETFOREGROUND*/ | MB_ICONWARNING);
  1898. if ( !g_bRunOnCorruptdb )
  1899. exit(0);
  1900. }
  1901. }
  1902. if (g_user.bLongin && g_pMainWnd2)
  1903. {
  1904. g_pMainWnd2->ShowBar(TRUE,TRUE);
  1905. InsideMsg();
  1906. }
  1907. #else
  1908. ShowWindow(SW_SHOW);
  1909. if (g_bNoLoginLia)
  1910. {
  1911. Login dlg;
  1912. dlg.SetLiaPath ("5.lia");
  1913. dlg.DoModal();
  1914. }
  1915. else
  1916. {
  1917. Login3 dlg;
  1918. dlg.SetLiaPath ("5.lia");
  1919. dlg.DoModal();
  1920. }
  1921. #endif
  1922. }
  1923. if (g_hmouse == NULL)
  1924. {
  1925. g_hmouse = SetWindowsHookEx(WH_MOUSE, MouseProc, 0, ::GetCurrentThreadId());
  1926. }
  1927. }
  1928. else if (2 == nIDEvent) //29秒后,若连接和发送未完成,将关闭连接和发送框;
  1929. {
  1930. KillTimer(2);
  1931. if (g_hConnectWnd)
  1932. ::PostMessage(g_hConnectWnd, WM_CLOSE, 0, 0);
  1933. if (g_hSendWnd)
  1934. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1935. if (g_bStaffAchievementShow == 0 && g_bConnLYFZ == 0)
  1936. {
  1937. if (g_bGenBranchData == 0)
  1938. {
  1939. if (g_branchip != "")
  1940. AfxMessageBox("连接分店:" + g_branchname + "失败!", MB_ICONINFORMATION);
  1941. else
  1942. AfxMessageBox("连接服务器失败!", MB_ICONINFORMATION);
  1943. }
  1944. OnDisconnect();
  1945. }
  1946. g_bSendOK = 0;
  1947. g_bNeedCoon = 1;
  1948. }
  1949. else if (3 == nIDEvent)
  1950. {
  1951. KillTimer(3);
  1952. #ifdef NEW_SKIN
  1953. Welcome weldlg;
  1954. weldlg.DoModal();
  1955. #endif
  1956. ShowWindow(SW_SHOW);
  1957. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1958. g_sendhead.bsql = 0;
  1959. g_sendhead.code[0] = 24;
  1960. g_sendhead.code[1] = 1;
  1961. g_sendhead.tabcount = 2;
  1962. g_pMainWnd->ProcessChatMessageRequest2(1);
  1963. if (g_bSendOK == 0)
  1964. {
  1965. return;
  1966. }
  1967. CArray<CStringArray, CStringArray>patharray;
  1968. CArray<CStringArray, CStringArray>userarray;
  1969. DataToArray(&g_cominfoarray, &g_hisyeararray);
  1970. g_userarray.SetSize(userarray.GetSize(), 1);
  1971. int count = 0;
  1972. for (int ii = 0; ii < userarray.GetSize(); ii++)
  1973. {
  1974. if (userarray.ElementAt(ii).ElementAt(10) == "在职")
  1975. g_userarray.ElementAt(count++).Copy(userarray.ElementAt(ii));
  1976. }
  1977. g_userarray.SetSize(count, 1);
  1978. StaffAchievementShowAll dlg;
  1979. g_pMainWnd->GetOcx();
  1980. dlg.DoModal();
  1981. }
  1982. else if (5 == nIDEvent)
  1983. {
  1984. if (g_bInSkin)
  1985. {
  1986. OutputDebugString("使用皮肤\n");
  1987. return;
  1988. }
  1989. if (g_nAutoShowStaffAchievement == 1){
  1990. OutputDebugString("用于选片\n");
  1991. return;
  1992. }
  1993. if (g_bAllBranch){
  1994. OutputDebugString("多店汇总当中\n");
  1995. return;
  1996. }
  1997. if (g_user.bLongin)
  1998. {
  1999. // m_Mdi.CloseAll();
  2000. g_pMainWnd->OnCommandMenu(IDM_Logout);
  2001. }
  2002. /* g_nAutoShowStaffAchievement=1;
  2003. KillTimer(5);
  2004. StaffAchievementShowAll dlg;
  2005. g_pMainWnd->GetOcx();
  2006. dlg.DoModal ();*/
  2007. }
  2008. else if (6 == nIDEvent)
  2009. {
  2010. static BOOL bDouble = 0;
  2011. bDouble = !bDouble;
  2012. if (bDouble)
  2013. g_pMainWnd->OnCommandMenu(IDM_TAKEAWAYBOOK);
  2014. else
  2015. g_pMainWnd->OnCommandMenu(IDM_CLIENTMONEY);
  2016. }
  2017. else if (7 == nIDEvent)
  2018. {
  2019. #if 0
  2020. // Jeff,当g_bSendLYFZ==TRUE时;
  2021. // 向lijiafz.vicp.net发送影楼信息,防止有盗版用户;
  2022. KillTimer(7);
  2023. if (g_bInSkin)return;
  2024. if (g_nAutoShowStaffAchievement == 1)return;
  2025. if (g_bAllBranch)return;
  2026. CString str = g_sInfo;
  2027. g_bConnLYFZ = 1; // Jeff指示连接的服务器为lijiafz.vicp.net
  2028. // 断开当前连接;
  2029. OnDisconnect();
  2030. BYTE *pData = new BYTE[str.GetLength()];
  2031. memcpy(pData, str.GetBuffer(0), str.GetLength());
  2032. str.ReleaseBuffer();
  2033. EncryptFile2(pData, str.GetLength(), "888666333");
  2034. g_nSendCode = 16;
  2035. g_pMainWnd->ProcessChatMessageRequest2(pData, str.GetLength());
  2036. g_nSendCode = 0;
  2037. delete[]pData;
  2038. OnDisconnect();
  2039. g_bSendLYFZ = 0;
  2040. g_bConnLYFZ = 0;
  2041. if (g_bSendOK)
  2042. {
  2043. char *pStr = new char[g_nLeng + 1];
  2044. memset(pStr, 0, g_nLeng + 1);
  2045. memcpy(pStr, g_pData, g_nLeng);
  2046. CString str = pStr;
  2047. delete[]pStr;
  2048. if (str == "g_bInSkin")
  2049. {
  2050. g_sendhead.bsql = 1;
  2051. g_pMainWnd->ProcessChatMessageRequest2("update version set [setcheck1]='ok'");
  2052. }
  2053. }
  2054. #else
  2055. KillTimer(7);
  2056. if (g_bInSkin)return;
  2057. if (g_nAutoShowStaffAchievement == 1)return;
  2058. if (g_bAllBranch)return;
  2059. g_bConnLYFZ = 1; // Jeff指示连接的服务器为lijiafz.vicp.net
  2060. g_bNeedCoon = 1;
  2061. // 组织要发送的数据;
  2062. g_GuradInfo.m_bUseYtUsb = g_bExistSpecialUsb;
  2063. g_GuradInfo.m_StudioGuid = g_strStudioGuid;
  2064. g_GuradInfo.m_StudioMac = g_strMacAddress;
  2065. g_GuradInfo.m_ExecResult = _T("");
  2066. g_GuradInfo.m_Uptodate = CTime::GetCurrentTime().Format(_T("%Y-%m-%d %H:%M:%S "));
  2067. CMemFile memfile;
  2068. CArchive ar(&memfile, CArchive::store);
  2069. g_GuradInfo.Serialize(ar);
  2070. ar.Close();
  2071. DWORD dwGuarInfoLen = memfile.GetLength();
  2072. BYTE *pGuardInfo = memfile.Detach();
  2073. memfile.Close();
  2074. // 断开当前连接;
  2075. OnDisconnect();
  2076. EncryptFile2(pGuardInfo, dwGuarInfoLen, "888666333");
  2077. g_nSendCode = 17;
  2078. g_pMainWnd->ProcessChatMessageRequest2(pGuardInfo, dwGuarInfoLen);
  2079. g_nSendCode = 0;
  2080. delete[]pGuardInfo;
  2081. OnDisconnect();
  2082. g_bNeedCoon = 1;
  2083. g_bSendLYFZ = 0;
  2084. g_bConnLYFZ = 0;
  2085. if (g_bSendOK)
  2086. {
  2087. g_nSendCode = 100;
  2088. g_pMainWnd->ProcessChatMessageRequest2(g_pData, g_nLeng);
  2089. g_nSendCode = 0;
  2090. }
  2091. #endif
  2092. }
  2093. }
  2094. void CMainFrame::OnOutbarNotify(CString strMsg)
  2095. {
  2096. if (g_user.bLongin == 0)
  2097. {
  2098. if (g_bNoLoginLia)
  2099. {
  2100. Login dlg;
  2101. dlg.SetLiaPath("5.lia");
  2102. dlg.DoModal();
  2103. }
  2104. else
  2105. {
  2106. Login3 dlg;
  2107. dlg.SetLiaPath("5.lia");
  2108. dlg.DoModal();
  2109. }
  2110. return;
  2111. if (g_user.bLongin == 0)return;
  2112. }
  2113. else
  2114. {
  2115. InsideMsg();
  2116. }
  2117. ResetTimer();
  2118. if (strMsg == "开单")
  2119. {
  2120. if (IsHasRights(0) == 0)return;
  2121. Booking2 dlg;
  2122. dlg.DoModal();
  2123. return;
  2124. }
  2125. else if (strMsg == "拍照")
  2126. {
  2127. if (IsHasRights(1) == 0)return;
  2128. UINT nID = 1;
  2129. LPSTR pName;
  2130. pName = (LPSTR)(LPCSTR)"拍照";
  2131. OPEN_MENU(TakeFrom);
  2132. return;
  2133. }
  2134. else if (strMsg == "修片")
  2135. {
  2136. if (IsHasRights(1) == 0)return;
  2137. UINT nID = 1;
  2138. LPSTR pName;
  2139. pName = (LPSTR)(LPCSTR)"修片";
  2140. OPEN_MENU(BeautifySkinFrom);
  2141. return;
  2142. }
  2143. else if (strMsg == "选片")
  2144. {
  2145. if (IsHasRights(2) == 0)return;
  2146. UINT nID = 1;
  2147. LPSTR pName;
  2148. pName = (LPSTR)(LPCSTR)"选片";
  2149. OPEN_MENU(ChoosePhotoForm);
  2150. return;
  2151. }
  2152. else if (strMsg == "精修")
  2153. {
  2154. if (IsHasRights(2) == 0)return;
  2155. UINT nID = 1;
  2156. LPSTR pName;
  2157. pName = (LPSTR)(LPCSTR)"精修";
  2158. OPEN_MENU(BeautifySkinFrom2);
  2159. return;
  2160. }
  2161. else if (strMsg == "设计")
  2162. {
  2163. if (IsHasRights(2) == 0)return;
  2164. UINT nID = 1;
  2165. LPSTR pName;
  2166. pName = (LPSTR)(LPCSTR)"设计";
  2167. OPEN_MENU(DesignFrom);
  2168. return;
  2169. }
  2170. else if (strMsg == "数码安排")
  2171. {
  2172. UINT nID = 1;
  2173. LPSTR pName;
  2174. pName = (LPSTR)(LPCSTR)"数码安排";
  2175. OPEN_MENU(DigitalWork);
  2176. return;
  2177. }
  2178. else if (strMsg == "刻盘")
  2179. {
  2180. UINT nID = 1;
  2181. LPSTR pName;
  2182. pName = (LPSTR)(LPCSTR)"刻盘";
  2183. OPEN_MENU(BurnCD);
  2184. return;
  2185. }
  2186. else if (strMsg == "相片冲印")
  2187. {
  2188. UINT nID = 1;
  2189. LPSTR pName;
  2190. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  2191. OPEN_MENU(PhotoPrintFrom);
  2192. return;
  2193. }
  2194. else if (strMsg == "发片/取件")
  2195. {
  2196. if (IsHasRights(3) == 0)return;
  2197. UINT nID = 1;
  2198. LPSTR pName;
  2199. pName = (LPSTR)(LPCSTR)"发片/取件";
  2200. OPEN_MENU(outsourcing);
  2201. return;
  2202. }
  2203. else if (strMsg == "满意度")
  2204. {
  2205. UINT nID = 1;
  2206. LPSTR pName;
  2207. pName = (LPSTR)(LPCSTR)"满意度";
  2208. OPEN_MENU(Satisfaction);
  2209. return;
  2210. }
  2211. else if (strMsg == "满意度汇总")
  2212. {
  2213. UINT nID = 1;
  2214. LPSTR pName;
  2215. pName = (LPSTR)(LPCSTR)"满意度汇总";
  2216. OPEN_MENU(SatisfactionReportForm);
  2217. return;
  2218. }
  2219. #if JEFF_DELETE_ON // 2014.11.14-PM 16:20
  2220. else if (strMsg == "回复统计")
  2221. {
  2222. UINT nID = 1;
  2223. LPSTR pName;
  2224. pName = (LPSTR)(LPCSTR)"回复统计";
  2225. OPEN_MENU(MsgReg2);
  2226. return;
  2227. }
  2228. #endif
  2229. /* else if(strMsg=="取件")
  2230. {
  2231. if(IsHasRights(3)==0)return;
  2232. UINT nID=1;
  2233. LPSTR pName ;
  2234. pName = (LPSTR)(LPCSTR)"取件";
  2235. OPEN_MENU(TakeAwayFrom);
  2236. return;
  2237. }*/
  2238. else if (strMsg == "其它收入")
  2239. {
  2240. if (IsHasRightsnew(16) == 0)return;
  2241. // if(IsHasRightsnew(48)==0)return;
  2242. UINT nID = 1;
  2243. LPSTR pName;
  2244. pName = (LPSTR)(LPCSTR)"其它收入";
  2245. OPEN_MENU(IncomeInput);
  2246. return;
  2247. }
  2248. else if (strMsg == "其它二销")
  2249. {
  2250. if (IsHasRightsnew(16) == 0)return;
  2251. UINT nID = 1;
  2252. LPSTR pName;
  2253. pName = (LPSTR)(LPCSTR)"其它二销";
  2254. OPEN_MENU(IncomeInput2);
  2255. return;
  2256. }
  2257. else if (strMsg == "员工奖罚")
  2258. {
  2259. if (IsHasRightsnew(16) == 0)return;
  2260. UINT nID = 1;
  2261. LPSTR pName;
  2262. pName = (LPSTR)(LPCSTR)"员工奖罚";
  2263. OPEN_MENU(IncomeInput3);
  2264. return;
  2265. }
  2266. else if (strMsg == "员工奖惩")
  2267. {
  2268. if (IsHasRightsnew(16) == 0)return;
  2269. UINT nID = 1;
  2270. LPSTR pName;
  2271. pName = (LPSTR)(LPCSTR)"员工奖惩";
  2272. OPEN_MENU(IncomeInput4);
  2273. return;
  2274. }
  2275. else if (strMsg == "订单收款")
  2276. {
  2277. if (IsHasRights(17) == 0)return;
  2278. UINT nID = 1;
  2279. LPSTR pName;
  2280. pName = (LPSTR)(LPCSTR)"订单收款";
  2281. OPEN_MENU(FinanceForm);
  2282. return;
  2283. }
  2284. else if (strMsg == "日财务表")
  2285. {
  2286. if (IsHasRightsnew(22) == 0)return;
  2287. UINT nID = 2;
  2288. LPSTR pName;
  2289. pName = (LPSTR)(LPCSTR)"日财务表";
  2290. OPEN_MENU(DailyForm);
  2291. return;
  2292. }
  2293. else if (strMsg == "提成比例")
  2294. {
  2295. #ifndef ENTERPRISE_VERSION
  2296. #ifndef CHILD_VERSION
  2297. #ifdef BASIC_VERSION
  2298. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2299. {
  2300. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2301. exit(0);return;
  2302. }
  2303. #else
  2304. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2305. {
  2306. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2307. exit(0);return;
  2308. }
  2309. #endif
  2310. #else
  2311. #ifdef BASIC_VERSION
  2312. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2313. {
  2314. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2315. exit(0);return;
  2316. }
  2317. #else
  2318. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2319. {
  2320. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2321. exit(0); return;
  2322. }
  2323. #endif
  2324. #endif
  2325. #else
  2326. #ifndef CHILD_VERSION
  2327. #ifdef BASIC_VERSION
  2328. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2329. {
  2330. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2331. exit(0); return;
  2332. }
  2333. #else
  2334. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2335. {
  2336. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2337. exit(0); return;
  2338. }
  2339. #endif
  2340. #else
  2341. #ifdef BASIC_VERSION
  2342. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2343. {
  2344. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2345. exit(0);return;
  2346. }
  2347. #else
  2348. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2349. {
  2350. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2351. exit(0); return;
  2352. }
  2353. #endif
  2354. #endif
  2355. #endif
  2356. UINT nID = 2;
  2357. LPSTR pName;
  2358. pName = (LPSTR)(LPCSTR)"提成比例";
  2359. OPEN_MENU(SalarySet2);
  2360. return;
  2361. }
  2362. //else if(strMsg=="员工工作")
  2363. else if (strMsg == "计件提成")
  2364. {
  2365. UINT nID = 2;
  2366. LPSTR pName;
  2367. //pName = (LPSTR)(LPCSTR)"员工工作";
  2368. pName = (LPSTR)(LPCSTR)"计件提成";
  2369. OPEN_MENU(SalarySet3);
  2370. return;
  2371. }
  2372. else if (strMsg == "工资管理")
  2373. {
  2374. #ifndef ENTERPRISE_VERSION
  2375. #ifndef CHILD_VERSION
  2376. #ifdef BASIC_VERSION
  2377. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2378. {
  2379. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2380. exit(0);return;
  2381. }
  2382. #else
  2383. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2384. {
  2385. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2386. exit(0);return;
  2387. }
  2388. #endif
  2389. #else
  2390. #ifdef BASIC_VERSION
  2391. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2392. {
  2393. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2394. exit(0);return;
  2395. }
  2396. #else
  2397. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2398. {
  2399. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2400. exit(0); return;
  2401. }
  2402. #endif
  2403. #endif
  2404. #else
  2405. #ifndef CHILD_VERSION
  2406. #ifdef BASIC_VERSION
  2407. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2408. {
  2409. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2410. exit(0); return;
  2411. }
  2412. #else
  2413. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2414. {
  2415. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2416. exit(0); return;
  2417. }
  2418. #endif
  2419. #else
  2420. #ifdef BASIC_VERSION
  2421. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2422. {
  2423. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2424. exit(0);return;
  2425. }
  2426. #else
  2427. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2428. {
  2429. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2430. exit(0); return;
  2431. }
  2432. #endif
  2433. #endif
  2434. #endif
  2435. UINT nID = 2;
  2436. LPSTR pName;
  2437. pName = (LPSTR)(LPCSTR)"工资管理";
  2438. OPEN_MENU(MySalary);
  2439. return;
  2440. }
  2441. else if (strMsg == "客人付款")
  2442. {
  2443. UINT nID = 2;
  2444. LPSTR pName;
  2445. pName = (LPSTR)(LPCSTR)"客人付款";
  2446. OPEN_MENU(ClientMoney);
  2447. return;
  2448. }
  2449. else if (strMsg == "工资报表")
  2450. {
  2451. #ifndef ENTERPRISE_VERSION
  2452. #ifndef CHILD_VERSION
  2453. #ifdef BASIC_VERSION
  2454. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2455. {
  2456. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2457. exit(0);return;
  2458. }
  2459. #else
  2460. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2461. {
  2462. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2463. exit(0);return;
  2464. }
  2465. #endif
  2466. #else
  2467. #ifdef BASIC_VERSION
  2468. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2469. {
  2470. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2471. exit(0);return;
  2472. }
  2473. #else
  2474. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2475. {
  2476. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2477. exit(0); return;
  2478. }
  2479. #endif
  2480. #endif
  2481. #else
  2482. #ifndef CHILD_VERSION
  2483. #ifdef BASIC_VERSION
  2484. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2485. {
  2486. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2487. exit(0); return;
  2488. }
  2489. #else
  2490. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2491. {
  2492. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2493. exit(0); return;
  2494. }
  2495. #endif
  2496. #else
  2497. #ifdef BASIC_VERSION
  2498. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2499. {
  2500. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2501. exit(0);return;
  2502. }
  2503. #else
  2504. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2505. {
  2506. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2507. exit(0); return;
  2508. }
  2509. #endif
  2510. #endif
  2511. #endif
  2512. if (IsHasRightsnew(25) == 0)return;
  2513. UINT nID = 2;
  2514. LPSTR pName;
  2515. pName = (LPSTR)(LPCSTR)"工资报表";
  2516. g_ncount = 100;
  2517. OPEN_MENU(MySalary);
  2518. return;
  2519. }
  2520. else if (strMsg == "员工业绩")
  2521. {
  2522. #ifndef ENTERPRISE_VERSION
  2523. #ifndef CHILD_VERSION
  2524. #ifdef BASIC_VERSION
  2525. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2526. {
  2527. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2528. exit(0);return;
  2529. }
  2530. #else
  2531. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2532. {
  2533. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2534. exit(0);return;
  2535. }
  2536. #endif
  2537. #else
  2538. #ifdef BASIC_VERSION
  2539. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2540. {
  2541. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2542. exit(0);return;
  2543. }
  2544. #else
  2545. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2546. {
  2547. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2548. exit(0); return;
  2549. }
  2550. #endif
  2551. #endif
  2552. #else
  2553. #ifndef CHILD_VERSION
  2554. #ifdef BASIC_VERSION
  2555. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2556. {
  2557. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2558. exit(0); return;
  2559. }
  2560. #else
  2561. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2562. {
  2563. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2564. exit(0); return;
  2565. }
  2566. #endif
  2567. #else
  2568. #ifdef BASIC_VERSION
  2569. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2570. {
  2571. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2572. exit(0);return;
  2573. }
  2574. #else
  2575. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2576. {
  2577. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2578. exit(0); return;
  2579. }
  2580. #endif
  2581. #endif
  2582. #endif
  2583. if (IsHasRightsnew(33) == 0)return;
  2584. UINT nID = 2;
  2585. LPSTR pName;
  2586. pName = (LPSTR)(LPCSTR)"员工业绩";
  2587. OPEN_MENU(StaffAchievement);
  2588. return;
  2589. }
  2590. else if (strMsg == "订单客户")
  2591. {
  2592. UINT nID = 2;
  2593. LPSTR pName;
  2594. pName = (LPSTR)(LPCSTR)"订单客户";
  2595. g_dx += 10000;
  2596. OPEN_MENU(CClientForm);
  2597. if (g_dx >= 10000)g_dx -= 10000;
  2598. return;
  2599. }
  2600. else if (strMsg == "意向客户")
  2601. {
  2602. UINT nID = 2;
  2603. LPSTR pName;
  2604. pName = (LPSTR)(LPCSTR)"意向客户";
  2605. OPEN_MENU(Client2Form);
  2606. return;
  2607. }
  2608. else if (strMsg == "老客户")
  2609. {
  2610. UINT nID = 2;
  2611. LPSTR pName;
  2612. pName = (LPSTR)(LPCSTR)"老客户";
  2613. OPEN_MENU(OldClient);
  2614. return;
  2615. }
  2616. else if (strMsg == "客户来电")
  2617. {
  2618. UINT nID = 2;
  2619. LPSTR pName;
  2620. pName = (LPSTR)(LPCSTR)"客户来电";
  2621. OPEN_MENU(PhoneRecord);
  2622. return;
  2623. }
  2624. else if (strMsg == "拨出电话")
  2625. {
  2626. UINT nID = 2;
  2627. LPSTR pName;
  2628. pName = (LPSTR)(LPCSTR)"拨出电话";
  2629. OPEN_MENU(PhoneRecordOut);
  2630. return;
  2631. }
  2632. else if (strMsg == "未接来电")
  2633. {
  2634. UINT nID = 2;
  2635. LPSTR pName;
  2636. pName = (LPSTR)(LPCSTR)"未接来电";
  2637. OPEN_MENU(MissCall);
  2638. return;
  2639. }
  2640. else if (strMsg == "客户流失")
  2641. {
  2642. UINT nID = 2;
  2643. LPSTR pName;
  2644. pName = (LPSTR)(LPCSTR)"客户流失";
  2645. OPEN_MENU(ClientReasonChart);
  2646. return;
  2647. }
  2648. else if (strMsg == "客户来源")
  2649. {
  2650. UINT nID = 2;
  2651. LPSTR pName;
  2652. pName = (LPSTR)(LPCSTR)"客户来源";
  2653. OPEN_MENU(ClientFromChart);
  2654. return;
  2655. }
  2656. else if (strMsg == "月财务表")
  2657. {
  2658. if (IsHasRightsnew(23) == 0)return;
  2659. UINT nID = 2;
  2660. LPSTR pName;
  2661. pName = (LPSTR)(LPCSTR)"月财务表";
  2662. OPEN_MENU(MonthForm);
  2663. return;
  2664. }
  2665. else if (strMsg == "支出报表")
  2666. {
  2667. if (IsHasRightsnew(23) == 0)return;
  2668. UINT nID = 2;
  2669. LPSTR pName;
  2670. pName = (LPSTR)(LPCSTR)"支出报表";
  2671. OPEN_MENU(MonthForm2);
  2672. return;
  2673. }
  2674. else if (strMsg == "年财务表")
  2675. {
  2676. if (IsHasRightsnew(24) == 0)return;
  2677. UINT nID = 2;
  2678. LPSTR pName;
  2679. pName = (LPSTR)(LPCSTR)"年财务表";
  2680. OPEN_MENU(YearForm);
  2681. return;
  2682. }
  2683. else if (strMsg == "年财务图表")
  2684. {
  2685. if (IsHasRightsnew(24) == 0)return;
  2686. GetOcx();
  2687. UINT nID = 2;
  2688. LPSTR pName;
  2689. pName = (LPSTR)(LPCSTR)"年财务图表";
  2690. OPEN_MENU(YearForm2);
  2691. return;
  2692. }
  2693. else if (strMsg == "订单图表")
  2694. {
  2695. GetOcx();
  2696. UINT nID = 2;
  2697. LPSTR pName;
  2698. pName = (LPSTR)(LPCSTR)"订单图表";
  2699. OPEN_MENU(DinDanForm);
  2700. return;
  2701. }
  2702. #ifdef ENTERPRISE_VERSION
  2703. else if (strMsg == "订单报表")
  2704. {
  2705. GetOcx();
  2706. UINT nID = 2;
  2707. LPSTR pName;
  2708. pName = (LPSTR)(LPCSTR)"订单报表2";
  2709. OPEN_MENU(DinDanFromBranch);
  2710. return;
  2711. }
  2712. else if (strMsg == "财务图表")
  2713. {
  2714. GetOcx();
  2715. UINT nID = 2;
  2716. LPSTR pName;
  2717. pName = (LPSTR)(LPCSTR)"财务图表";
  2718. OPEN_MENU(YearFormBranch);
  2719. return;
  2720. }
  2721. else if (strMsg == "订单图表")
  2722. {
  2723. GetOcx();
  2724. UINT nID = 2;
  2725. LPSTR pName;
  2726. pName = (LPSTR)(LPCSTR)"订单图表";
  2727. OPEN_MENU(YearFormBranch2);
  2728. return;
  2729. }
  2730. else if (strMsg == "摄控安排")
  2731. {
  2732. UINT nID = 2;
  2733. LPSTR pName;
  2734. pName = (LPSTR)(LPCSTR)"摄控安排";
  2735. g_bookingtype = 0;
  2736. OPEN_MENU(TodayForm);
  2737. return;
  2738. }
  2739. else if (strMsg == "选片预约")
  2740. {
  2741. UINT nID = 2;
  2742. LPSTR pName;
  2743. pName = (LPSTR)(LPCSTR)"选片预约";
  2744. g_bookingtype = 1;
  2745. OPEN_MENU(TodayForm);
  2746. return;
  2747. }
  2748. else if (strMsg == "看样预约")
  2749. {
  2750. UINT nID = 2;
  2751. LPSTR pName;
  2752. pName = (LPSTR)(LPCSTR)"看样预约";
  2753. g_bookingtype = 2;
  2754. OPEN_MENU(TodayForm);
  2755. return;
  2756. }
  2757. else if (strMsg == "取件预约")
  2758. {
  2759. UINT nID = 2;
  2760. LPSTR pName;
  2761. pName = (LPSTR)(LPCSTR)"取件预约";
  2762. g_bookingtype = 3;
  2763. OPEN_MENU(TodayForm);
  2764. return;
  2765. }
  2766. else if (strMsg == "婚庆安排")
  2767. {
  2768. UINT nID = 2;
  2769. LPSTR pName;
  2770. pName = (LPSTR)(LPCSTR)"婚庆安排";
  2771. g_bookingtype = 4;
  2772. OPEN_MENU(TodayForm);
  2773. return;
  2774. }
  2775. #endif
  2776. else if (strMsg == "员工资料")
  2777. {
  2778. UINT nID = 2;
  2779. LPSTR pName;
  2780. pName = (LPSTR)(LPCSTR)"员工资料";
  2781. if (g_bAllBranch)
  2782. OPEN_MENU(EmployeeForm2);
  2783. else
  2784. OPEN_MENU(EmployeeForm);
  2785. return;
  2786. }
  2787. else if (strMsg == "客户区域")
  2788. {
  2789. // if(IsHasRightsnew(48)==0)return;
  2790. GetOcx();
  2791. UINT nID = 2;
  2792. LPSTR pName;
  2793. pName = (LPSTR)(LPCSTR)"客户区域";
  2794. OPEN_MENU(AreaClient);
  2795. return;
  2796. }
  2797. else if (strMsg == "客户报表")
  2798. {
  2799. UINT nID = 3;
  2800. LPSTR pName;
  2801. pName = (LPSTR)(LPCSTR)"客户报表";
  2802. OPEN_MENU(CClientForm);
  2803. return;
  2804. }
  2805. else if (strMsg == "现金支出")
  2806. {
  2807. if (IsHasRightsnew(16) == 0)return;
  2808. UINT nID = 3;
  2809. LPSTR pName;
  2810. pName = (LPSTR)(LPCSTR)"现金支出";
  2811. OPEN_MENU(PayOutInput);
  2812. return;
  2813. }
  2814. else if (strMsg == "短信群发")
  2815. {
  2816. UINT nID = 3;
  2817. LPSTR pName;
  2818. pName = (LPSTR)(LPCSTR)"短信群发";
  2819. OPEN_MENU(SendMsg);
  2820. return;
  2821. }
  2822. else if (strMsg == "短信发送")
  2823. {
  2824. UINT nID = 3;
  2825. LPSTR pName;
  2826. pName = (LPSTR)(LPCSTR)"客户报表";
  2827. OPEN_MENU(CClientForm);
  2828. return;
  2829. }
  2830. else if (strMsg == "流程短信")
  2831. {
  2832. UINT nID = 3;
  2833. LPSTR pName;
  2834. pName = (LPSTR)(LPCSTR)"流程短信";
  2835. OPEN_MENU(WorkMsg);
  2836. return;
  2837. }
  2838. else if (strMsg == "员工短信")
  2839. {
  2840. UINT nID = 3;
  2841. LPSTR pName;
  2842. pName = (LPSTR)(LPCSTR)"员工短信";
  2843. OPEN_MENU(EmployeeMsg);
  2844. return;
  2845. }
  2846. else if (strMsg == "发送记录")
  2847. {
  2848. UINT nID = 3;
  2849. LPSTR pName;
  2850. pName = (LPSTR)(LPCSTR)"发送记录";
  2851. OPEN_MENU(MsgReg);
  2852. return;
  2853. }
  2854. else if (strMsg == "短信设置")
  2855. {
  2856. if (IsHasRightsnew(49) == 0)return;
  2857. MsgSet dlg;
  2858. dlg.DoModal();
  2859. return;
  2860. }
  2861. else if (strMsg == "金卡会员")
  2862. {
  2863. #ifndef ENTERPRISE_VERSION
  2864. #ifndef CHILD_VERSION
  2865. #ifdef BASIC_VERSION
  2866. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2867. {
  2868. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2869. exit(0);return;
  2870. }
  2871. #else
  2872. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2873. {
  2874. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2875. exit(0);return;
  2876. }
  2877. #endif
  2878. #else
  2879. #ifdef BASIC_VERSION
  2880. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2881. {
  2882. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2883. exit(0);return;
  2884. }
  2885. #else
  2886. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2887. {
  2888. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2889. exit(0); return;
  2890. }
  2891. #endif
  2892. #endif
  2893. #else
  2894. #ifndef CHILD_VERSION
  2895. #ifdef BASIC_VERSION
  2896. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2897. {
  2898. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2899. exit(0); return;
  2900. }
  2901. #else
  2902. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2903. {
  2904. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2905. exit(0); return;
  2906. }
  2907. #endif
  2908. #else
  2909. #ifdef BASIC_VERSION
  2910. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2911. {
  2912. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2913. exit(0);return;
  2914. }
  2915. #else
  2916. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2917. {
  2918. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2919. exit(0); return;
  2920. }
  2921. #endif
  2922. #endif
  2923. #endif
  2924. UINT nID = 3;
  2925. LPSTR pName;
  2926. pName = (LPSTR)(LPCSTR)"金卡会员";
  2927. OPEN_MENU(ShowMember);
  2928. return;
  2929. }
  2930. else if (strMsg == "现金子卡")
  2931. {
  2932. UINT nID = 3;
  2933. LPSTR pName;
  2934. pName = (LPSTR)(LPCSTR)"现金子卡";
  2935. OPEN_MENU(ShowMember2);
  2936. return;
  2937. }
  2938. else if (strMsg == "蓝钻会员")
  2939. {
  2940. #ifndef ENTERPRISE_VERSION
  2941. #ifndef CHILD_VERSION
  2942. #ifdef BASIC_VERSION
  2943. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2944. {
  2945. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2946. exit(0);return;
  2947. }
  2948. #else
  2949. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2950. {
  2951. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2952. exit(0);return;
  2953. }
  2954. #endif
  2955. #else
  2956. #ifdef BASIC_VERSION
  2957. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2958. {
  2959. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2960. exit(0);return;
  2961. }
  2962. #else
  2963. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2964. {
  2965. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2966. exit(0); return;
  2967. }
  2968. #endif
  2969. #endif
  2970. #else
  2971. #ifndef CHILD_VERSION
  2972. #ifdef BASIC_VERSION
  2973. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2974. {
  2975. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2976. exit(0); return;
  2977. }
  2978. #else
  2979. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2980. {
  2981. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2982. exit(0); return;
  2983. }
  2984. #endif
  2985. #else
  2986. #ifdef BASIC_VERSION
  2987. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2988. {
  2989. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2990. exit(0);return;
  2991. }
  2992. #else
  2993. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2994. {
  2995. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2996. exit(0); return;
  2997. }
  2998. #endif
  2999. #endif
  3000. #endif
  3001. UINT nID = 3;
  3002. LPSTR pName;
  3003. pName = (LPSTR)(LPCSTR)"蓝钻会员";
  3004. OPEN_MENU(ShowMemberBlue);
  3005. return;
  3006. }
  3007. else if (strMsg == "转介绍积分")
  3008. {
  3009. #ifndef ENTERPRISE_VERSION
  3010. #ifndef CHILD_VERSION
  3011. #ifdef BASIC_VERSION
  3012. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3013. {
  3014. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3015. exit(0);return;
  3016. }
  3017. #else
  3018. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3019. {
  3020. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3021. exit(0);return;
  3022. }
  3023. #endif
  3024. #else
  3025. #ifdef BASIC_VERSION
  3026. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3027. {
  3028. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3029. exit(0);return;
  3030. }
  3031. #else
  3032. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3033. {
  3034. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3035. exit(0); return;
  3036. }
  3037. #endif
  3038. #endif
  3039. #else
  3040. #ifndef CHILD_VERSION
  3041. #ifdef BASIC_VERSION
  3042. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3043. {
  3044. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3045. exit(0); return;
  3046. }
  3047. #else
  3048. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3049. {
  3050. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3051. exit(0); return;
  3052. }
  3053. #endif
  3054. #else
  3055. #ifdef BASIC_VERSION
  3056. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3057. {
  3058. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3059. exit(0);return;
  3060. }
  3061. #else
  3062. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3063. {
  3064. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3065. exit(0); return;
  3066. }
  3067. #endif
  3068. #endif
  3069. #endif
  3070. UINT nID = 3;
  3071. LPSTR pName;
  3072. pName = (LPSTR)(LPCSTR)"转介绍积分";
  3073. OPEN_MENU(Card2Reg);
  3074. return;
  3075. }
  3076. /* else if(strMsg=="转介绍图表")
  3077. {
  3078. #ifndef ENTERPRISE_VERSION
  3079. #ifndef CHILD_VERSION
  3080. #ifdef BASIC_VERSION
  3081. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="0")
  3082. {
  3083. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3084. exit(0);return;
  3085. }
  3086. #else
  3087. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3088. {
  3089. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3090. exit(0);return;
  3091. }
  3092. #endif
  3093. #else
  3094. #ifdef BASIC_VERSION
  3095. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3096. {
  3097. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3098. exit(0);return;
  3099. }
  3100. #else
  3101. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  3102. {
  3103. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3104. exit(0);return;
  3105. }
  3106. #endif
  3107. #endif
  3108. #else
  3109. #ifndef CHILD_VERSION
  3110. #ifdef BASIC_VERSION
  3111. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3112. {
  3113. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3114. exit(0);return;
  3115. }
  3116. #else
  3117. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="5")
  3118. {
  3119. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3120. exit(0);return;
  3121. }
  3122. #endif
  3123. #else
  3124. #ifdef BASIC_VERSION
  3125. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="6")
  3126. {
  3127. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3128. exit(0);return;
  3129. }
  3130. #else
  3131. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="7")
  3132. {
  3133. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3134. exit(0);return;
  3135. }
  3136. #endif
  3137. #endif
  3138. #endif
  3139. UINT nID=3;
  3140. LPSTR pName ;
  3141. pName = (LPSTR)(LPCSTR)"转介绍图表";
  3142. OPEN_MENU(Card2RegChart);
  3143. return;
  3144. }*/
  3145. else if (strMsg == "金卡图表")
  3146. {
  3147. UINT nID = 3;
  3148. LPSTR pName;
  3149. pName = (LPSTR)(LPCSTR)"金卡图表";
  3150. OPEN_MENU(MemberChart);
  3151. return;
  3152. }
  3153. else if (strMsg == "积分短信")
  3154. {
  3155. UINT nID = 3;
  3156. LPSTR pName;
  3157. pName = (LPSTR)(LPCSTR)"积分短信";
  3158. OPEN_MENU(ShowMemberMsg);
  3159. return;
  3160. }
  3161. else if (strMsg == "转介绍返现")
  3162. {
  3163. #ifndef ENTERPRISE_VERSION
  3164. #ifndef CHILD_VERSION
  3165. #ifdef BASIC_VERSION
  3166. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3167. {
  3168. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3169. exit(0);return;
  3170. }
  3171. #else
  3172. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3173. {
  3174. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3175. exit(0);return;
  3176. }
  3177. #endif
  3178. #else
  3179. #ifdef BASIC_VERSION
  3180. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3181. {
  3182. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3183. exit(0);return;
  3184. }
  3185. #else
  3186. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3187. {
  3188. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3189. exit(0); return;
  3190. }
  3191. #endif
  3192. #endif
  3193. #else
  3194. #ifndef CHILD_VERSION
  3195. #ifdef BASIC_VERSION
  3196. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3197. {
  3198. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3199. exit(0); return;
  3200. }
  3201. #else
  3202. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3203. {
  3204. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3205. exit(0); return;
  3206. }
  3207. #endif
  3208. #else
  3209. #ifdef BASIC_VERSION
  3210. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3211. {
  3212. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3213. exit(0);return;
  3214. }
  3215. #else
  3216. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3217. {
  3218. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3219. exit(0); return;
  3220. }
  3221. #endif
  3222. #endif
  3223. #endif
  3224. UINT nID = 3;
  3225. LPSTR pName;
  3226. pName = (LPSTR)(LPCSTR)"转介绍返现";
  3227. OPEN_MENU(Card2RegBlue);
  3228. return;
  3229. }
  3230. else if (strMsg == "转介绍图表")
  3231. {
  3232. #ifndef ENTERPRISE_VERSION
  3233. #ifndef CHILD_VERSION
  3234. #ifdef BASIC_VERSION
  3235. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3236. {
  3237. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3238. exit(0);return;
  3239. }
  3240. #else
  3241. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3242. {
  3243. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3244. exit(0);return;
  3245. }
  3246. #endif
  3247. #else
  3248. #ifdef BASIC_VERSION
  3249. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3250. {
  3251. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3252. exit(0);return;
  3253. }
  3254. #else
  3255. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3256. {
  3257. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3258. exit(0); return;
  3259. }
  3260. #endif
  3261. #endif
  3262. #else
  3263. #ifndef CHILD_VERSION
  3264. #ifdef BASIC_VERSION
  3265. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3266. {
  3267. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3268. exit(0); return;
  3269. }
  3270. #else
  3271. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3272. {
  3273. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3274. exit(0); return;
  3275. }
  3276. #endif
  3277. #else
  3278. #ifdef BASIC_VERSION
  3279. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3280. {
  3281. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3282. exit(0);return;
  3283. }
  3284. #else
  3285. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3286. {
  3287. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3288. exit(0); return;
  3289. }
  3290. #endif
  3291. #endif
  3292. #endif
  3293. UINT nID = 3;
  3294. LPSTR pName;
  3295. pName = (LPSTR)(LPCSTR)"转介绍图表";
  3296. OPEN_MENU(Card2RegChartBlue);
  3297. return;
  3298. }
  3299. else if (strMsg == "积分设置")
  3300. {
  3301. if (IsHasRightsnew(49) == 0)return;
  3302. MemberSet dlg;
  3303. dlg.DoModal();
  3304. return;
  3305. }
  3306. else if (strMsg == "礼服录入")
  3307. {
  3308. if (IsHasRightsnew(39) == 0)return;
  3309. UINT nID = 3;
  3310. LPSTR pName;
  3311. pName = (LPSTR)(LPCSTR)"礼服录入";
  3312. OPEN_MENU(DressManage);
  3313. return;
  3314. }
  3315. else if (strMsg == "礼服查看")
  3316. {
  3317. #ifndef ENTERPRISE_VERSION
  3318. #ifndef CHILD_VERSION
  3319. #ifdef BASIC_VERSION
  3320. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3321. {
  3322. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3323. exit(0);return;
  3324. }
  3325. #else
  3326. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3327. {
  3328. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3329. exit(0);return;
  3330. }
  3331. #endif
  3332. #else
  3333. #ifdef BASIC_VERSION
  3334. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3335. {
  3336. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3337. exit(0);return;
  3338. }
  3339. #else
  3340. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3341. {
  3342. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3343. exit(0); return;
  3344. }
  3345. #endif
  3346. #endif
  3347. #else
  3348. #ifndef CHILD_VERSION
  3349. #ifdef BASIC_VERSION
  3350. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3351. {
  3352. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3353. exit(0); return;
  3354. }
  3355. #else
  3356. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3357. {
  3358. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3359. exit(0); return;
  3360. }
  3361. #endif
  3362. #else
  3363. #ifdef BASIC_VERSION
  3364. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3365. {
  3366. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3367. exit(0);return;
  3368. }
  3369. #else
  3370. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3371. {
  3372. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3373. exit(0); return;
  3374. }
  3375. #endif
  3376. #endif
  3377. #endif
  3378. if (IsHasRightsnew(40) == 0)return;
  3379. UINT nID = 3;
  3380. LPSTR pName;
  3381. pName = (LPSTR)(LPCSTR)"礼服查看";
  3382. OPEN_MENU(ShowDress);
  3383. return;
  3384. }
  3385. else if (strMsg == "撞期预警")
  3386. {
  3387. UINT nID = 3;
  3388. LPSTR pName;
  3389. pName = (LPSTR)(LPCSTR)"撞期预警";
  3390. OPEN_MENU(DressEarlyWarning);
  3391. return;
  3392. }
  3393. else if (strMsg == "礼服出租")
  3394. {
  3395. UINT nID = 3;
  3396. LPSTR pName;
  3397. pName = (LPSTR)(LPCSTR)"礼服出租";
  3398. OPEN_MENU(ShowHireReg);
  3399. return;
  3400. }
  3401. else if (strMsg == "礼服图片")
  3402. {
  3403. ShowPic dlg;
  3404. dlg.m_mode = 4;
  3405. //dlg.m_path = g_path5 + "\\";
  3406. dlg.m_id = g_path5 + "\\";
  3407. dlg.DoModal();
  3408. return;
  3409. }
  3410. else if (strMsg == "商品类别设置")
  3411. {
  3412. if (IsHasRightsnew(29) == 0)return;
  3413. SPLBDlg dlg;
  3414. dlg.DoModal();
  3415. return;
  3416. }
  3417. else if (strMsg == "商品名称设置")
  3418. {
  3419. if (IsHasRightsnew(29) == 0)return;
  3420. UINT nID = 3;
  3421. LPSTR pName;
  3422. pName = (LPSTR)(LPCSTR)"商品设置";
  3423. OPEN_MENU(ShangPin);
  3424. return;
  3425. }
  3426. else if (strMsg == "固定资产管理")
  3427. {
  3428. UINT nID = 3;
  3429. LPSTR pName;
  3430. pName = (LPSTR)(LPCSTR)"固定资产管理";
  3431. OPEN_MENU(FixedAssets);
  3432. return;
  3433. }
  3434. else if (strMsg == "入库单")
  3435. {
  3436. if (IsHasRightsnew(44) == 0)return;
  3437. InputGoods dlg;
  3438. dlg.DoModal();
  3439. return;
  3440. }
  3441. else if (strMsg == "出库单")
  3442. {
  3443. #ifndef ENTERPRISE_VERSION
  3444. #ifndef CHILD_VERSION
  3445. #ifdef BASIC_VERSION
  3446. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3447. {
  3448. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3449. exit(0);return;
  3450. }
  3451. #else
  3452. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3453. {
  3454. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3455. exit(0);return;
  3456. }
  3457. #endif
  3458. #else
  3459. #ifdef BASIC_VERSION
  3460. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3461. {
  3462. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3463. exit(0);return;
  3464. }
  3465. #else
  3466. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3467. {
  3468. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3469. exit(0); return;
  3470. }
  3471. #endif
  3472. #endif
  3473. #else
  3474. #ifndef CHILD_VERSION
  3475. #ifdef BASIC_VERSION
  3476. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3477. {
  3478. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3479. exit(0); return;
  3480. }
  3481. #else
  3482. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3483. {
  3484. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3485. exit(0); return;
  3486. }
  3487. #endif
  3488. #else
  3489. #ifdef BASIC_VERSION
  3490. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3491. {
  3492. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3493. exit(0);return;
  3494. }
  3495. #else
  3496. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3497. {
  3498. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3499. exit(0); return;
  3500. }
  3501. #endif
  3502. #endif
  3503. #endif
  3504. if (IsHasRightsnew(45) == 0)return;
  3505. InputGoods dlg;
  3506. dlg.m_mode = 1;
  3507. dlg.DoModal();
  3508. return;
  3509. }
  3510. else if (strMsg == "库存查询")
  3511. {
  3512. #ifndef ENTERPRISE_VERSION
  3513. #ifndef CHILD_VERSION
  3514. #ifdef BASIC_VERSION
  3515. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3516. {
  3517. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3518. exit(0);return;
  3519. }
  3520. #else
  3521. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3522. {
  3523. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3524. exit(0);return;
  3525. }
  3526. #endif
  3527. #else
  3528. #ifdef BASIC_VERSION
  3529. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3530. {
  3531. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3532. exit(0);return;
  3533. }
  3534. #else
  3535. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3536. {
  3537. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3538. exit(0); return;
  3539. }
  3540. #endif
  3541. #endif
  3542. #else
  3543. #ifndef CHILD_VERSION
  3544. #ifdef BASIC_VERSION
  3545. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3546. {
  3547. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3548. exit(0); return;
  3549. }
  3550. #else
  3551. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3552. {
  3553. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3554. exit(0); return;
  3555. }
  3556. #endif
  3557. #else
  3558. #ifdef BASIC_VERSION
  3559. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3560. {
  3561. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3562. exit(0);return;
  3563. }
  3564. #else
  3565. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3566. {
  3567. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3568. exit(0); return;
  3569. }
  3570. #endif
  3571. #endif
  3572. #endif
  3573. UINT nID = 3;
  3574. LPSTR pName;
  3575. pName = (LPSTR)(LPCSTR)"库存查询";
  3576. OPEN_MENU(ShowGoods);
  3577. return;
  3578. }
  3579. else if (strMsg == "商品图表")
  3580. {
  3581. UINT nID = 3;
  3582. LPSTR pName;
  3583. pName = (LPSTR)(LPCSTR)"商品图表";
  3584. OPEN_MENU(StoreInfoChart);
  3585. return;
  3586. }
  3587. else if (strMsg == "成本核算")
  3588. {
  3589. UINT nID = 3;
  3590. LPSTR pName;
  3591. pName = (LPSTR)(LPCSTR)"成本核算";
  3592. OPEN_MENU(CostCal);
  3593. return;
  3594. }
  3595. else if (strMsg == "考勤记录")
  3596. {
  3597. UINT nID = 3;
  3598. LPSTR pName;
  3599. pName = (LPSTR)(LPCSTR)"考勤记录";
  3600. OPEN_MENU(LoginReg);
  3601. return;
  3602. }
  3603. else if (strMsg == "月统计")
  3604. {
  3605. UINT nID = 3;
  3606. LPSTR pName;
  3607. pName = (LPSTR)(LPCSTR)"月统计";
  3608. OPEN_MENU(LoginReg2);
  3609. return;
  3610. }
  3611. else if (strMsg == "时间设置")
  3612. {
  3613. if (IsHasRightsnew(21) == 0)return;
  3614. SetLoginTime dlg;
  3615. dlg.DoModal();
  3616. return;
  3617. }
  3618. else if (strMsg == "排班设置")
  3619. {
  3620. if (IsHasRightsnew(21) == 0)return;
  3621. SetLoginBan dlg;
  3622. dlg.DoModal();
  3623. return;
  3624. }
  3625. else if (strMsg == "意向查询")
  3626. {
  3627. UINT nID = 3;
  3628. LPSTR pName;
  3629. pName = (LPSTR)(LPCSTR)"意向查询";
  3630. OPEN_MENU(HospitalClient);
  3631. return;
  3632. }
  3633. else if (strMsg == "今日提醒")
  3634. {
  3635. UINT nID = 3;
  3636. LPSTR pName;
  3637. pName = (LPSTR)(LPCSTR)"今日提醒";
  3638. OPEN_MENU(HospitalClientAlarm);
  3639. return;
  3640. }
  3641. else if (strMsg == "跟踪短信")
  3642. {
  3643. UINT nID = 3;
  3644. LPSTR pName;
  3645. pName = (LPSTR)(LPCSTR)"跟踪短信";
  3646. OPEN_MENU(HospitalClientMsg);
  3647. return;
  3648. }
  3649. else if (strMsg == "意向单录入")
  3650. {
  3651. AddHospitalClient dlg;
  3652. dlg.DoModal();
  3653. return;
  3654. }
  3655. else if (strMsg == "资料设置")
  3656. {
  3657. HospitalInfoSet dlg;
  3658. dlg.DoModal();
  3659. return;
  3660. }
  3661. else if ( strMsg == _T("公众号设置"))
  3662. {
  3663. if (IsHasRightsnew(62) == 0)return;
  3664. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3665. {
  3666. lyfzLibrary::g_PtrShowWeiXinDialog(g_rc, g_bkcol);
  3667. lyfzLibrary::FreeWeiXinLibaray();
  3668. }
  3669. return;
  3670. }
  3671. else if ( strMsg == _T("模板消息设置"))
  3672. {
  3673. if (IsHasRightsnew(63) == 0)return;
  3674. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3675. {
  3676. lyfzLibrary::g_PtrShowWXMsgconfigDialog(g_rc, g_bkcol);
  3677. lyfzLibrary::FreeWeiXinLibaray();
  3678. }
  3679. return;
  3680. }
  3681. else if ( strMsg == _T("推送记录") )
  3682. {
  3683. if (IsHasRightsnew(64) == 0)return;
  3684. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3685. {
  3686. lyfzLibrary::g_PtrShowWXMsgRcordDialog(g_rc, g_bkcol);
  3687. lyfzLibrary::FreeWeiXinLibaray();
  3688. }
  3689. return;
  3690. }
  3691. AfxMessageBox(strMsg + ",开发中...");
  3692. }
  3693. // Jeff.当版本号不一致时,调用AutoUpdate.exe来升级YLGL.exe
  3694. void CMainFrame::AutoUpdate()
  3695. {
  3696. if (g_bBranchModify)
  3697. {
  3698. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3699. return;
  3700. }
  3701. else if (g_branchname != "")
  3702. {
  3703. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3704. return;
  3705. }
  3706. g_ntimeout = 30000;
  3707. if (!::PathFileExists(g_mainpath + "\\AutoUpdate.exe"))
  3708. {
  3709. g_sendhead.bsql = 0;
  3710. g_sendhead.code[0] = 99;
  3711. g_sendhead.tabcount = 1;
  3712. g_pMainWnd->ProcessChatMessageRequest2(99);
  3713. if (g_bSendOK == 0)
  3714. goto failed;
  3715. CFile fp;
  3716. fp.Open(g_mainpath + "\\AutoUpdate.exe", CFile::modeWrite | CFile::modeCreate);
  3717. fp.Write(g_pData, g_nLeng);
  3718. fp.Close();
  3719. }
  3720. {
  3721. ::DeleteFile(g_mainpath + "\\YLGL2.exe"); // 删除ylgl.exe;
  3722. g_sendhead.bsql = 0;
  3723. g_sendhead.code[0] = 98;
  3724. g_sendhead.tabcount = 1;
  3725. g_pMainWnd->ProcessChatMessageRequest2(99); if (g_bSendOK == 0)goto failed;
  3726. CFile fp;
  3727. fp.Open(g_mainpath + "\\YLGL2.exe", CFile::modeWrite | CFile::modeCreate);
  3728. fp.Write(g_pData, g_nLeng);
  3729. fp.Close();
  3730. }
  3731. AfxMessageBox("自动升级成功!", MB_ICONINFORMATION);
  3732. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\AutoUpdate.exe"), "12345", NULL, SW_SHOWNORMAL);
  3733. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3734. exit(0);
  3735. return;
  3736. failed:
  3737. AfxMessageBox("自动升级失败!", MB_ICONINFORMATION);
  3738. if (g_ntimeout == 30000)//非远程
  3739. {
  3740. AfxMessageBox("提醒:升级过程中需要传输较多的数据,如果网速慢可能导致远程升级失败!\r\n\
  3741. 可拷贝店内客户端用QQ传过来覆盖除dbconfig.dat的文件即可。", MB_ICONINFORMATION);
  3742. }
  3743. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3744. }
  3745. void CMainFrame::Onchoosephotoskin() //Jeff:此机用于选片菜单项;不在使用2014.06.16
  3746. {
  3747. if (g_user.bLongin == 0)
  3748. {
  3749. if (g_bNoLoginLia)
  3750. {
  3751. Login dlg;
  3752. dlg.SetLiaPath("5.lia");
  3753. dlg.DoModal();
  3754. }
  3755. else
  3756. {
  3757. Login3 dlg;
  3758. dlg.SetLiaPath("5.lia");
  3759. dlg.DoModal();
  3760. }
  3761. if (g_user.bLongin == 0)return;
  3762. }
  3763. // TODO: Add your command handler code here
  3764. CMenu *pMenu = GetMenu();
  3765. CMenu* submenu = pMenu->GetSubMenu(1);
  3766. UINT status = submenu->GetMenuState(IDM_choosephotoskin, MF_BYCOMMAND);
  3767. if (status&MF_CHECKED)
  3768. {
  3769. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_UNCHECKED);
  3770. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status", 0);
  3771. }
  3772. else
  3773. {
  3774. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  3775. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status", 1);
  3776. }
  3777. }
  3778. /*BOOL g_bInSkin = 0;*/
  3779. BOOL CMainFrame::IsCtrlDown()
  3780. {
  3781. short state = GetKeyState(VK_LCONTROL);
  3782. BYTE sta = (BYTE)(state >> 8);
  3783. state = GetKeyState(VK_RCONTROL);
  3784. BYTE sta2 = (BYTE)(state >> 8);
  3785. if (sta || sta2)
  3786. return 1;
  3787. else
  3788. return 0;
  3789. }//IsShiftDown
  3790. BOOL CMainFrame::IsShiftDown()
  3791. {
  3792. short state = GetKeyState(VK_LSHIFT);
  3793. BYTE sta = (BYTE)(state >> 8);
  3794. state = GetKeyState(VK_RSHIFT);
  3795. BYTE sta2 = (BYTE)(state >> 8);
  3796. if (sta || sta2)
  3797. return 1;
  3798. else
  3799. return 0;
  3800. }
  3801. BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
  3802. {
  3803. // TODO: Add your specialized code here and/or call the base class IDM_Logout
  3804. if (pMsg->message == WM_KEYDOWN)
  3805. {
  3806. switch (pMsg->wParam)
  3807. {
  3808. case VK_F12:
  3809. g_pMainWnd->OnCommandMenu(IDM_Logout);
  3810. return 1;
  3811. case VK_F1:
  3812. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  3813. return 1;
  3814. case VK_F2: // 此机用于选片和选设计;
  3815. {
  3816. if (g_pMainWnd->m_bCheckF2F3 && (IsShiftDown() == 0 || IsCtrlDown() == 0))return 1;
  3817. m_Mdi.MainClose();
  3818. if (g_user.bLongin)
  3819. {
  3820. SearchClient dlg;
  3821. dlg.SetLiaPath("2.lia");
  3822. if (dlg.DoModal() != IDOK)
  3823. {
  3824. if (dlg.m_bLogout)
  3825. {
  3826. g_user.bLongin = 0;
  3827. g_user.name.Empty();
  3828. g_user.rights.Empty();
  3829. g_user.account.Empty();
  3830. goto ll;
  3831. }
  3832. PostMessage(WM_QUIT);
  3833. return 1;
  3834. }
  3835. if (dlg.m_exitcode == 3)
  3836. {
  3837. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3838. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3839. }
  3840. else
  3841. {
  3842. ShowWindow(SW_SHOW);
  3843. #ifdef NEW_SKIN
  3844. if (m_pMainFrimDlg2 == NULL)
  3845. {
  3846. m_pMainFrimDlg2 = new MainFrimDlg2;
  3847. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3848. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3849. }
  3850. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3851. g_bInSkin = 0;
  3852. #endif
  3853. }
  3854. }
  3855. else
  3856. {
  3857. ll:
  3858. ChoosePhotoSkin dlg;
  3859. dlg.SetLiaPath("1.lia");
  3860. if (dlg.DoModal() != IDOK)
  3861. {
  3862. PostMessage(WM_QUIT);
  3863. return 1;
  3864. }
  3865. if (dlg.m_exitcode == 3)
  3866. {
  3867. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3868. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3869. }
  3870. else
  3871. {
  3872. ShowWindow(SW_SHOW);
  3873. #ifdef NEW_SKIN
  3874. if (m_pMainFrimDlg2 == NULL)
  3875. {
  3876. m_pMainFrimDlg2 = new MainFrimDlg2;
  3877. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3878. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3879. }
  3880. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3881. g_bInSkin = 0;
  3882. #endif
  3883. }
  3884. }
  3885. }
  3886. return 1;
  3887. case VK_F3: // 此机用于选片和选设计;
  3888. {
  3889. if (g_pMainWnd->m_bCheckF2F3 && (g_pMainWnd->IsShiftDown() == 0 || g_pMainWnd->IsCtrlDown() == 0))return 1;
  3890. m_Mdi.MainClose();
  3891. if (g_user.bLongin)
  3892. {
  3893. SearchClient dlg;
  3894. dlg.m_mode = 1;
  3895. dlg.SetLiaPath("2.lia");
  3896. if (dlg.DoModal() != IDOK)
  3897. {
  3898. if (dlg.m_bLogout)
  3899. {
  3900. g_user.bLongin = 0;
  3901. g_user.name.Empty();
  3902. g_user.rights.Empty();
  3903. g_user.account.Empty();
  3904. goto mm;
  3905. }
  3906. PostMessage(WM_QUIT);
  3907. return 1;
  3908. }
  3909. if (dlg.m_exitcode == 2)
  3910. {
  3911. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3912. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3913. }
  3914. else
  3915. {
  3916. ShowWindow(SW_SHOW);
  3917. #ifdef NEW_SKIN
  3918. if (m_pMainFrimDlg2 == NULL)
  3919. {
  3920. m_pMainFrimDlg2 = new MainFrimDlg2;
  3921. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3922. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3923. }
  3924. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3925. g_bInSkin = 0;
  3926. #endif
  3927. }
  3928. }
  3929. else
  3930. {
  3931. mm:
  3932. ChoosePhotoSkin dlg;
  3933. dlg.m_mode = 1;
  3934. dlg.SetLiaPath("1.lia");
  3935. if (dlg.DoModal() != IDOK)
  3936. {
  3937. PostMessage(WM_QUIT);
  3938. return 1;
  3939. }
  3940. if (dlg.m_exitcode == 2)
  3941. {
  3942. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3943. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3944. }
  3945. else
  3946. {
  3947. ShowWindow(SW_SHOW);
  3948. #ifdef NEW_SKIN
  3949. if (m_pMainFrimDlg2 == NULL)
  3950. {
  3951. m_pMainFrimDlg2 = new MainFrimDlg2;
  3952. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3953. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3954. }
  3955. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3956. g_bInSkin = 0;
  3957. #endif
  3958. }
  3959. }
  3960. }
  3961. return 1;
  3962. //#if 0 // 2015-05-30 禁用F11功能;
  3963. // case VK_F11:
  3964. // if (g_bInSkin)return 1;
  3965. // if (g_user.bLongin)
  3966. // {
  3967. // SqlDlg dlg;
  3968. // dlg.DoModal();
  3969. // }
  3970. // break;
  3971. //#endif
  3972. }
  3973. }
  3974. return CMDIFrameWnd::PreTranslateMessage(pMsg);
  3975. }
  3976. void CMainFrame::GetSkin()
  3977. {
  3978. return;
  3979. #ifdef MNLS_VERSION
  3980. if (::PathFileExists(g_mainpath + "\\skin\\4.lia"))
  3981. {
  3982. CFile fp;
  3983. fp.Open(g_mainpath + "\\skin\\4.lia", CFile::modeRead);
  3984. DWORD leng=fp.GetLength ();
  3985. fp.Close ();
  3986. if(leng!=194987)
  3987. ::DeleteFile (g_mainpath+"\\skin\\4.lia"); // 删除4.lia
  3988. }
  3989. if(!::PathFileExists (g_mainpath+"\\skin\\4.lia"))
  3990. {
  3991. ::CreateDirectory (g_mainpath+"\\skin", NULL);
  3992. g_sendhead.bsql=0;
  3993. g_sendhead.code[0]=100;
  3994. g_sendhead.tabcount=1;
  3995. g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return;
  3996. CFile fp;
  3997. fp.Open (g_mainpath+"\\skin\\4.lia", CFile::modeWrite|CFile::modeCreate);
  3998. fp.Write (g_pData, g_nLeng);
  3999. fp.Close ();
  4000. }
  4001. #endif
  4002. }
  4003. void AutoDraw(CPrintRX &m_Print, CRect &StrRect, CString &str, float fscale)
  4004. {
  4005. CString tempbz =_T(""), temp = _T("");
  4006. BOOL bRun = 0;
  4007. CSize size;
  4008. int fontsize = 12;
  4009. int i = 0;
  4010. ll: tempbz = str;
  4011. i = 0;
  4012. m_Print.SetFontFace(fontsize, 1, "宋体");
  4013. while (1)
  4014. {
  4015. if (!tempbz.IsEmpty())
  4016. {
  4017. temp = tempbz;
  4018. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4019. int right = 0;
  4020. CRect temprc = StrRect;
  4021. temprc.top += i*(fontsize*fscale); i++;
  4022. temprc.bottom = temprc.top + fontsize;
  4023. if (temprc.bottom > StrRect.bottom)break;
  4024. while (size.cx > temprc.Width())
  4025. {
  4026. right++;
  4027. temp = tempbz.Left(tempbz.GetLength() - (right));
  4028. if (GIsHalfHZ(temp))
  4029. {
  4030. right++;
  4031. temp.Delete(temp.GetLength() - 1);
  4032. }
  4033. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4034. }
  4035. // 判断最后的字符是否还含有半个汉字;
  4036. if ( GIsHalfHZ(temp) )
  4037. {
  4038. right++;
  4039. temp.Delete(temp.GetLength() -1);
  4040. temp = tempbz.Left(tempbz.GetLength() - (right));
  4041. }
  4042. if (temp.Find("\r\n") != -1)
  4043. {
  4044. temp = temp.Left(temp.Find("\r\n"));//i++;
  4045. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength() - 2);
  4046. }
  4047. else
  4048. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  4049. if (bRun)
  4050. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, temprc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4051. }
  4052. else
  4053. break;
  4054. }
  4055. if (tempbz.IsEmpty() == 0)
  4056. {
  4057. fontsize--;
  4058. goto ll;
  4059. }
  4060. if (bRun == 0)
  4061. {
  4062. bRun = 1;
  4063. goto ll;
  4064. }
  4065. }
  4066. void CMainFrame::PrintDinDan3(CString strOrderNumber)
  4067. {
  4068. // TODO: Add your control notification handler code here
  4069. CPrintRX m_Print;
  4070. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  4071. {
  4072. m_Print.InitToPrint(NULL, 1);
  4073. }
  4074. else
  4075. {
  4076. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  4077. if (name.IsEmpty())
  4078. m_Print.InitToPrint(NULL, 1);
  4079. else
  4080. {
  4081. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  4082. if (nret == -1)
  4083. {
  4084. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  4085. }
  4086. }
  4087. }
  4088. m_Print.StartPrint();
  4089. m_Print.StartPage();
  4090. LoadRect load;
  4091. load.SetLiaPath("11.lia");
  4092. load.SetMargins(0, 0);
  4093. if (!load.Load())return;
  4094. LoadRect load2;
  4095. load2.SetLiaPath("12.lia");
  4096. load2.SetMargins(0, 0);
  4097. if (!load2.Load())return;
  4098. LoadRect load3;
  4099. load3.SetLiaPath("13.lia");
  4100. load3.SetMargins(-6, 520);
  4101. if (!load3.Load())return;
  4102. int i;
  4103. //////////////////////////////////////////////////////////////
  4104. CStringArray txarray;
  4105. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "'";
  4106. g_sendhead.code[0] = 11;
  4107. g_sendhead.code[1] = 52;
  4108. g_sendhead.code[2] = 50;
  4109. g_sendhead.code[3] = 150;
  4110. g_sendhead.tabcount = 4;
  4111. g_sendhead.bsql = 0;
  4112. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  4113. CArray<CStringArray, CStringArray>sparray;
  4114. CArray<CStringArray, CStringArray>clientarray;
  4115. CArray<CStringArray, CStringArray>jdarray;
  4116. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray);
  4117. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  4118. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  4119. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  4120. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  4121. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  4122. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  4123. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  4124. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  4125. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  4126. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  4127. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  4128. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  4129. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  4130. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  4131. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  4132. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  4133. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  4134. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  4135. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  4136. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  4137. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  4138. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  4139. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  4140. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  4141. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  4142. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  4143. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  4144. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  4145. CString m_bz = "其它要求: " + g_List1array.ElementAt(0).ElementAt(38);
  4146. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  4147. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  4148. if (IsHasRights2new(31) == 0)
  4149. {
  4150. m_phone1 = "***";
  4151. m_phone2 = "***";
  4152. }
  4153. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  4154. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  4155. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  4156. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  4157. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  4158. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  4159. CString m_addr = m_addr1 + ";";
  4160. m_addr.TrimLeft(";");
  4161. m_addr += m_addr2;
  4162. CString m_qq = m_qq1 + ";";
  4163. m_qq.TrimLeft(";");
  4164. m_qq += m_qq2;
  4165. CString m_jd;
  4166. for (i = 0; i < jdarray.GetSize(); i++)
  4167. {
  4168. m_jd += jdarray.ElementAt(i).ElementAt(1);
  4169. m_jd += ";";
  4170. }
  4171. m_jd.TrimRight(";");
  4172. m_money1.Format("%f", atof(m_taoxijiage));
  4173. m_money2.Format("%f", atof(m_payed1));
  4174. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  4175. ConvertToPrice(m_money1);
  4176. ConvertToPrice(m_money2);
  4177. ConvertToPrice(m_money3);
  4178. ////////////////////////////////////////////////////////////////
  4179. int rcpos = -1;
  4180. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  4181. m_Print.SetFontFace(17, 1, "宋体");
  4182. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4183. StrRect.top -= 0;
  4184. StrRect.bottom -= 10;
  4185. StrRect.left -= 140;
  4186. StrRect.right = StrRect.left + 48;
  4187. m_Print.SetFontFace(15, 1, "宋体");
  4188. m_Print.SetColor(0xffffff);
  4189. m_Print.DrawRect(StrRect, 0);
  4190. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4191. StrRect.left = StrRect.right;
  4192. StrRect.right = StrRect.left + 48;
  4193. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  4194. m_Print.SetColor(0, RGB(255, 0, 0));
  4195. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4196. m_Print.SetColor(0);
  4197. m_Print.SetFontFace(12, 1, "宋体");
  4198. StrRect.left -= 48;
  4199. int hei = StrRect.Height();
  4200. StrRect.top = StrRect.bottom + 2;
  4201. StrRect.bottom += hei + 2;
  4202. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4203. StrRect.top = StrRect.bottom - 2;
  4204. StrRect.bottom += hei - 5;
  4205. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  4206. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4207. m_Print.SetFontFace(12, 1, "宋体");
  4208. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4209. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4210. m_Print.SetFontFace(11, 1, "宋体");
  4211. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4212. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4213. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4214. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4215. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4216. m_Print.DrawRect2(StrRect, 2);
  4217. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4218. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4219. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4220. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4221. m_Print.DrawRect2(StrRect, 2);
  4222. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4223. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4224. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4225. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4226. m_Print.DrawRect2(StrRect, 2);
  4227. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4228. m_Print.DrawText((LPTSTR)(LPCTSTR)"约单时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4229. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4230. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4231. m_Print.DrawRect2(StrRect, 2);
  4232. ////////////
  4233. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4234. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4235. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4236. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4237. m_Print.DrawRect2(StrRect, 2);
  4238. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4239. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4240. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4241. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4242. m_Print.DrawRect2(StrRect, 2);
  4243. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4244. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4245. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4246. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4247. m_Print.DrawRect2(StrRect, 2);
  4248. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4249. m_Print.DrawText((LPTSTR)(LPCTSTR)"大婚时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4250. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4251. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4252. m_Print.DrawRect2(StrRect, 2);
  4253. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4254. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客地址:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4255. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4256. m_Print.DrawText((LPTSTR)(LPCTSTR)m_addr, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4257. m_Print.DrawRect2(StrRect, 2);
  4258. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4259. m_Print.DrawText((LPTSTR)(LPCTSTR)"QQ/邮箱:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4260. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4261. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4262. m_Print.DrawRect2(StrRect, 2);
  4263. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4264. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系金额:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4265. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4266. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4267. m_Print.DrawRect2(StrRect, 2);
  4268. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4269. m_Print.DrawText((LPTSTR)(LPCTSTR)"定金:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4270. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4271. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4272. m_Print.DrawRect2(StrRect, 2);
  4273. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4274. m_Print.DrawText((LPTSTR)(LPCTSTR)"余额:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4275. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4276. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4277. m_Print.DrawRect2(StrRect, 2);
  4278. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4279. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4280. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4281. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4282. m_Print.DrawRect2(StrRect, 2);
  4283. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4284. m_Print.DrawText((LPTSTR)(LPCTSTR)"拍摄景点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4285. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4286. m_Print.DrawText((LPTSTR)(LPCTSTR)m_jd, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4287. m_Print.DrawRect2(StrRect, 2);
  4288. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4289. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内容提供: 男士服装:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4290. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4291. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4292. m_Print.DrawRect2(StrRect, 2);
  4293. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4294. m_Print.DrawText((LPTSTR)(LPCTSTR)"套", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4295. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4296. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4297. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4298. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4299. m_Print.DrawRect2(StrRect, 2);
  4300. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4301. m_Print.DrawText((LPTSTR)(LPCTSTR)"套", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4302. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4303. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内提供拍摄区服装/头饰造型", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4304. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4305. m_Print.DrawText((LPTSTR)(LPCTSTR)"其它:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4306. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4307. m_Print.DrawText((LPTSTR)(LPCTSTR)" ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4308. m_Print.DrawRect2(StrRect, 2);
  4309. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4310. m_Print.DrawText((LPTSTR)(LPCTSTR)"专业数码拍摄:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4311. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4312. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4313. m_Print.DrawRect2(StrRect, 2);
  4314. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4315. m_Print.DrawText((LPTSTR)(LPCTSTR)"张", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4316. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4317. m_Print.DrawText((LPTSTR)(LPCTSTR)"(JPG格式数据)", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4318. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4319. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内赠送:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4320. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4321. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_List1array.ElementAt(0).ElementAt(9)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4322. m_Print.DrawRect2(StrRect, 2);
  4323. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4324. m_Print.DrawText((LPTSTR)(LPCTSTR)"张设计排版精修入册", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4325. //////////////////////load2
  4326. rcpos = -1;
  4327. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4328. m_Print.DrawText((LPTSTR)(LPCTSTR)"原始数据套系内张数JPG格式光盘壹只", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4329. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4330. m_Print.DrawText((LPTSTR)(LPCTSTR)"其它:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4331. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4332. // m_Print.DrawText((LPTSTR)(LPCTSTR)"", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4333. // AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4334. m_Print.DrawRect2(StrRect, 2);
  4335. m_Print.SetFontFace(11, 1, "宋体");
  4336. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4337. m_Print.DrawText((LPTSTR)(LPCTSTR)"客人产品:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4338. int rowcount = sparray.GetSize() / 8;
  4339. int needaddrow = 0;
  4340. while (sparray.GetSize() > rowcount * 8 + needaddrow)
  4341. needaddrow++;
  4342. int pos = 0;
  4343. CString str = "";
  4344. int addcount = 0;
  4345. if (needaddrow > 0)
  4346. addcount = 1;
  4347. else
  4348. addcount = 0;
  4349. needaddrow--;
  4350. str.Empty();
  4351. for (i = 0; i < rowcount + addcount; i++)
  4352. {
  4353. str += sparray.ElementAt(pos).ElementAt(5);
  4354. str += " 数量:";
  4355. str += sparray.ElementAt(pos).ElementAt(3);
  4356. str += ";";
  4357. pos++;
  4358. }
  4359. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4360. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4361. m_Print.DrawRect2(StrRect, 2);
  4362. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4363. if (needaddrow > 0)
  4364. addcount = 1;
  4365. else
  4366. addcount = 0;
  4367. needaddrow--;
  4368. str.Empty();
  4369. for (i = 0; i < rowcount + addcount; i++)
  4370. {
  4371. str += sparray.ElementAt(pos).ElementAt(5);
  4372. str += " 数量:";
  4373. str += sparray.ElementAt(pos).ElementAt(3);
  4374. str += ";";
  4375. pos++;
  4376. }
  4377. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4378. m_Print.DrawRect2(StrRect, 2);
  4379. StrRect = load2.m_rcarray.ElementAt(++rcpos);//7
  4380. if (needaddrow > 0)
  4381. addcount = 1;
  4382. else
  4383. addcount = 0;
  4384. needaddrow--;
  4385. str.Empty();
  4386. for (i = 0; i < rowcount + addcount; i++)
  4387. {
  4388. str += sparray.ElementAt(pos).ElementAt(5);
  4389. str += " 数量:";
  4390. str += sparray.ElementAt(pos).ElementAt(3);
  4391. str += ";";
  4392. pos++;
  4393. }
  4394. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4395. m_Print.DrawRect2(StrRect, 2);
  4396. StrRect = load2.m_rcarray.ElementAt(++rcpos);//8
  4397. if (needaddrow > 0)
  4398. addcount = 1;
  4399. else
  4400. addcount = 0;
  4401. needaddrow--;
  4402. str.Empty();
  4403. for (i = 0; i < rowcount + addcount; i++)
  4404. {
  4405. str += sparray.ElementAt(pos).ElementAt(5);
  4406. str += " 数量:";
  4407. str += sparray.ElementAt(pos).ElementAt(3);
  4408. str += ";";
  4409. pos++;
  4410. }
  4411. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4412. m_Print.DrawRect2(StrRect, 2);
  4413. StrRect = load2.m_rcarray.ElementAt(++rcpos);//9
  4414. if (needaddrow > 0)
  4415. addcount = 1;
  4416. else
  4417. addcount = 0;
  4418. needaddrow--;
  4419. str.Empty();
  4420. for (i = 0; i < rowcount + addcount; i++)
  4421. {
  4422. str += sparray.ElementAt(pos).ElementAt(5);
  4423. str += " 数量:";
  4424. str += sparray.ElementAt(pos).ElementAt(3);
  4425. str += ";";
  4426. pos++;
  4427. }
  4428. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4429. m_Print.DrawRect2(StrRect, 2);
  4430. StrRect = load2.m_rcarray.ElementAt(++rcpos);//10
  4431. if (needaddrow > 0)
  4432. addcount = 1;
  4433. else
  4434. addcount = 0;
  4435. needaddrow--;
  4436. str.Empty();
  4437. for (i = 0; i < rowcount + addcount; i++)
  4438. {
  4439. str += sparray.ElementAt(pos).ElementAt(5);
  4440. str += " 数量:";
  4441. str += sparray.ElementAt(pos).ElementAt(3);
  4442. str += ";";
  4443. pos++;
  4444. }
  4445. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4446. m_Print.DrawRect2(StrRect, 2);
  4447. StrRect = load2.m_rcarray.ElementAt(++rcpos);//11
  4448. if (needaddrow > 0)
  4449. addcount = 1;
  4450. else
  4451. addcount = 0;
  4452. needaddrow--;
  4453. str.Empty();
  4454. for (i = 0; i < rowcount + addcount; i++)
  4455. {
  4456. str += sparray.ElementAt(pos).ElementAt(5);
  4457. str += " 数量:";
  4458. str += sparray.ElementAt(pos).ElementAt(3);
  4459. str += ";";
  4460. pos++;
  4461. }
  4462. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4463. m_Print.DrawRect2(StrRect, 2);
  4464. StrRect = load2.m_rcarray.ElementAt(++rcpos);//12
  4465. if (needaddrow > 0)
  4466. addcount = 1;
  4467. else
  4468. addcount = 0;
  4469. needaddrow--;
  4470. str.Empty();
  4471. for (i = 0; i < rowcount + addcount; i++)
  4472. {
  4473. str += sparray.ElementAt(pos).ElementAt(5);
  4474. str += " 数量:";
  4475. str += sparray.ElementAt(pos).ElementAt(3);
  4476. str += ";";
  4477. pos++;
  4478. }
  4479. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4480. m_Print.DrawRect2(StrRect, 2);
  4481. /* StrRect=load2.m_rcarray .ElementAt (++rcpos);//12
  4482. if(needaddrow>0)
  4483. addcount=1;
  4484. else
  4485. addcount=0;
  4486. needaddrow--;
  4487. str.Empty ();
  4488. for( i=0; i<rowcount+addcount; i++)
  4489. {
  4490. str+=sparray.ElementAt (pos).ElementAt (5);
  4491. str+=" 数量:";
  4492. str+=sparray.ElementAt (pos).ElementAt (3);
  4493. str+=";";
  4494. pos++;
  4495. }
  4496. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4497. m_Print.DrawRect2(StrRect, 2);
  4498. StrRect=load2.m_rcarray .ElementAt (++rcpos);//14
  4499. if(needaddrow>0)
  4500. addcount=1;
  4501. else
  4502. addcount=0;
  4503. needaddrow--;
  4504. str.Empty ();
  4505. for( i=0; i<rowcount+addcount; i++)
  4506. {
  4507. str+=sparray.ElementAt (pos).ElementAt (5);
  4508. str+=" 数量:";
  4509. str+=sparray.ElementAt (pos).ElementAt (3);
  4510. str+=";";
  4511. pos++;
  4512. }
  4513. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4514. m_Print.DrawRect2(StrRect, 2);*/
  4515. CRect sprc[2];
  4516. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4517. // AutoDraw(m_Print, StrRect, m_bz.Left (leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4518. m_Print.DrawRect2(StrRect, 2);
  4519. sprc[0] = StrRect;
  4520. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4521. // AutoDraw(m_Print, StrRect, m_bz.Right (leng-leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4522. m_Print.DrawRect2(StrRect, 2);
  4523. sprc[1] = StrRect;
  4524. //AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4525. {
  4526. CString temp, tempspno, tempbz;
  4527. CSize size;
  4528. BOOL bRun = 0;
  4529. int fontsize = 12;
  4530. ll: tempspno = m_bz;
  4531. m_Print.SetFontFace(fontsize, 1, "宋体");
  4532. for (i = 0; i<2; i++)
  4533. {
  4534. if (!tempspno.IsEmpty())
  4535. {
  4536. temp = tempspno;
  4537. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4538. int right = 0;
  4539. CRect temprc = sprc[i];
  4540. while (size.cx>temprc.Width())
  4541. {
  4542. right++;
  4543. temp = tempspno.Left(tempspno.GetLength() - (right));
  4544. if (GIsHalfHZ(temp))
  4545. {
  4546. right++;
  4547. temp.Delete(temp.GetLength() - 1);
  4548. }
  4549. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4550. }
  4551. if (bRun)
  4552. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4553. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  4554. if (tempspno.IsEmpty())i++;
  4555. }
  4556. }
  4557. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  4558. {
  4559. fontsize--;
  4560. goto ll;
  4561. }
  4562. if (bRun == 0)
  4563. {
  4564. bRun = 1;
  4565. goto ll;
  4566. }
  4567. }
  4568. m_Print.SetFontFace(11, 1, "宋体");
  4569. //////////////////////load3
  4570. rcpos = -1;
  4571. for (i = 0; i < 24; i++)
  4572. {
  4573. StrRect = load3.m_rcarray.ElementAt(i);
  4574. m_Print.DrawRect2(StrRect, 1);
  4575. }
  4576. CStringArray strarray;
  4577. strarray.Add("营业员");
  4578. strarray.Add("前台接待");
  4579. strarray.Add("化妆师");
  4580. strarray.Add("礼服师");
  4581. strarray.Add("摄影师");
  4582. strarray.Add("摄影助理");
  4583. strarray.Add("美工师");
  4584. strarray.Add("设计师");
  4585. for (i = 0; i < 8; i++)
  4586. {
  4587. StrRect = load3.m_rcarray.ElementAt(i);
  4588. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4589. }
  4590. strarray.RemoveAll();
  4591. strarray.Add(m_ren);
  4592. strarray.Add(g_List1array.ElementAt(0).ElementAt(49));
  4593. strarray.Add(m_waiter2);
  4594. strarray.Add(g_List1array.ElementAt(0).ElementAt(51));
  4595. strarray.Add(m_waiter1);
  4596. strarray.Add(g_List1array.ElementAt(0).ElementAt(50));
  4597. strarray.Add("");
  4598. strarray.Add(m_waiter4);
  4599. for (i = 8; i < 16; i++)
  4600. {
  4601. StrRect = load3.m_rcarray.ElementAt(i);
  4602. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 8), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4603. }
  4604. StrRect = load3.m_rcarray.ElementAt(27);
  4605. m_Print.DrawText((LPTSTR)(LPCTSTR)"客户电话: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4606. StrRect = load3.m_rcarray.ElementAt(28);
  4607. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4608. m_Print.SetFontFace(13, 1, "宋体");
  4609. StrRect = load3.m_rcarray.ElementAt(25);
  4610. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4611. StrRect = load3.m_rcarray.ElementAt(26);
  4612. m_Print.DrawRect2(StrRect, 2);
  4613. StrRect = load3.m_rcarray.ElementAt(24);
  4614. str = "\
  4615. 顾客须知\r\n\
  4616. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  4617. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  4618. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  4619. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  4620. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  4621. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  4622. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  4623. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  4624. AutoDraw(m_Print, StrRect, str, 1.8f);
  4625. PrintPreview dlg;
  4626. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4627. dlg.m_pDC = m_Print.GetPDC();
  4628. if (dlg.DoModal() != IDOK)return;
  4629. //结束打印
  4630. m_Print.EndPage();
  4631. m_Print.EndPrint();
  4632. }
  4633. void CMainFrame::PrintDailyForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4634. {
  4635. // TODO: Add your control notification handler code here
  4636. int pages = Listarray->GetSize() / 46;
  4637. if (Listarray->GetSize() % 46)pages++;
  4638. for (int aa = 0; aa < pages; aa++)
  4639. {
  4640. PrintPreview dlg;
  4641. CPrintRX m_Print;
  4642. m_Print.InitToPrint(NULL, 1);
  4643. m_Print.StartPrint();
  4644. m_Print.StartPage();
  4645. CRect mainrc(0, 0, 560, 793);
  4646. float fscale;
  4647. {
  4648. int w, h;
  4649. m_Print.GetWidHei(w, h);
  4650. fscale = (float)w / (float)h;
  4651. }
  4652. mainrc.DeflateRect(25, 40, 10, 0);
  4653. CRect rc, rc2;
  4654. rc = mainrc;
  4655. rc.bottom = rc.top;
  4656. rc.top -= 20;
  4657. m_Print.SetFontFace(16, 1, "黑体");
  4658. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4659. m_Print.SetFontFace(9, 1, "宋体");
  4660. CString str;
  4661. int wid[4] = { 320, 60, 60, 90 };
  4662. int hei = 16;
  4663. if (fscale > 0.71)hei = 15;
  4664. rc = mainrc;
  4665. rc.bottom = rc.top + hei;
  4666. for (int i = 0; i < 47; i++)
  4667. {
  4668. rc2.top = rc.top + i*hei;
  4669. rc2.bottom = rc.bottom + i*hei;
  4670. rc2.left = rc.left;
  4671. rc2.right = rc.left + wid[0];
  4672. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  4673. for (int j = 0; j<4; j++)
  4674. {
  4675. m_Print.DrawRect2(rc2, 1);
  4676. if (Listarray->GetSize()>aa * 46 + i)
  4677. {
  4678. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  4679. rc2.left += 3;
  4680. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4681. rc2.left -= 3;
  4682. }
  4683. rc2.left += wid[j];
  4684. rc2.right = rc2.left + wid[j + 1];
  4685. }
  4686. }
  4687. rc2.top += 2;
  4688. rc2.left += 2; rc2.right = mainrc.right + 4;
  4689. m_Print.SetFontFace(8, 1, "宋体");
  4690. int infopos = info.Find("***");
  4691. if (infopos != -1)
  4692. {
  4693. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Left(infopos), rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4694. CRect rc3 = rc2;
  4695. rc3.top = rc2.bottom - 4;
  4696. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Right(info.GetLength() - infopos - 3), rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4697. }
  4698. else
  4699. m_Print.DrawText((LPTSTR)(LPCTSTR)info, rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4700. str.Format(" 页:%d/%d", aa + 1, pages);
  4701. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4702. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  4703. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4704. dlg.m_pDC = m_Print.GetPDC();
  4705. // dlg.m_mode=1;
  4706. if (aa == 0)
  4707. {
  4708. if (dlg.DoModal() != IDOK)
  4709. return;
  4710. }
  4711. //结束打印
  4712. m_Print.EndPage();
  4713. m_Print.EndPrint();
  4714. }
  4715. }
  4716. void CMainFrame::PrintLoginForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4717. {
  4718. // TODO: Add your control notification handler code here
  4719. int sinlecount = 33 * 6;
  4720. int pages = Listarray->GetSize() / sinlecount;
  4721. if (Listarray->GetSize() % sinlecount)pages++;
  4722. for (int aa = 0; aa < pages; aa++)
  4723. {
  4724. PrintPreview dlg;
  4725. CPrintRX m_Print;
  4726. m_Print.InitToPrint(NULL, 1);
  4727. m_Print.StartPrint();
  4728. m_Print.StartPage();
  4729. CRect mainrc(0, 0, 560, 793);
  4730. float fscale;
  4731. {
  4732. int w, h;
  4733. m_Print.GetWidHei(w, h);
  4734. fscale = (float)w / (float)h;
  4735. }
  4736. mainrc.DeflateRect(25, 40, 10, 0);
  4737. CString str;
  4738. CRect rc, rc2;
  4739. rc = mainrc;
  4740. rc.bottom = rc.top;
  4741. rc.top -= 20;
  4742. rc.left -= 20;
  4743. m_Print.SetFontFace(12, 1, "黑体");
  4744. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4745. m_Print.SetFontFace(6, 1, "宋体");
  4746. str.Format(" 页:%d/%d", aa + 1, pages);
  4747. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4748. rc.right = mainrc.right + 20;
  4749. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4750. int wid[2] = { 50, 110 };
  4751. int hei = 11;
  4752. rc = mainrc;
  4753. rc.bottom = rc.top + hei;
  4754. rc.top += 10;
  4755. rc.bottom += 10;
  4756. int dtx = rc.Width() / 3 + 18;
  4757. int dty = 380;
  4758. for (int j = 0; j < 6; j++)
  4759. {
  4760. if (Listarray->GetSize() < aa*sinlecount + 33 * (j + 1))continue;
  4761. for (int i = 0; i < 33; i++)
  4762. {
  4763. rc2.top = rc.top + i*hei;
  4764. rc2.bottom = rc.bottom + i*hei;
  4765. rc2.left = rc.left;
  4766. rc2.right = rc.left + wid[0];
  4767. if (i == 0)
  4768. {
  4769. // rc2.left +=wid[1];
  4770. rc2.right += wid[1];
  4771. }
  4772. if (j == 1 || j == 4)
  4773. {
  4774. rc2.left += dtx;
  4775. rc2.right += dtx;
  4776. }
  4777. if (j == 2 || j == 5)
  4778. {
  4779. rc2.left += dtx * 2;
  4780. rc2.right += dtx * 2;
  4781. }
  4782. if (j == 3 || j == 4 || j == 5)
  4783. {
  4784. rc2.top += dty;
  4785. rc2.bottom += dty;
  4786. }
  4787. m_Print.DrawRect2(rc2, 1);
  4788. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4789. {
  4790. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(0);
  4791. rc2.left += 3;
  4792. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4793. rc2.left -= 3;
  4794. }
  4795. if (i == 0)continue;
  4796. rc2.left = rc2.right;
  4797. rc2.right += wid[1];
  4798. m_Print.DrawRect2(rc2, 1);
  4799. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4800. {
  4801. if (Listarray->ElementAt(aa*sinlecount + 33 * j + i).GetSize() > 1)
  4802. {
  4803. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(1);
  4804. rc2.left += 3;
  4805. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4806. rc2.left -= 3;
  4807. }
  4808. }
  4809. /* if(Listarray->GetSize ()>aa*46+i)
  4810. {
  4811. str=Listarray->ElementAt (aa*46+i).ElementAt (j);
  4812. rc2.left +=3;
  4813. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4814. rc2.left -=3;
  4815. }
  4816. rc2.left +=wid[j];
  4817. rc2.right =rc2.left+wid[j+1];*/
  4818. }
  4819. }
  4820. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4821. dlg.m_pDC = m_Print.GetPDC();
  4822. if (aa == 0)
  4823. {
  4824. if (dlg.DoModal() != IDOK)
  4825. return;
  4826. }
  4827. //结束打印
  4828. m_Print.EndPage();
  4829. m_Print.EndPrint();
  4830. }
  4831. }
  4832. void CMainFrame::PrintTakeForm(CArray<CStringArray, CStringArray>*Listarray)
  4833. {
  4834. CString title;
  4835. CString info;
  4836. // TODO: Add your control notification handler code here
  4837. int sinlecount = 4;
  4838. int pages = Listarray->GetSize() / sinlecount;
  4839. if (Listarray->GetSize() % sinlecount)pages++;
  4840. for (int aa = 0; aa < pages; aa++)
  4841. {
  4842. PrintPreview dlg;
  4843. CPrintRX m_Print;
  4844. m_Print.InitToPrint(NULL, 1);
  4845. m_Print.StartPrint();
  4846. m_Print.StartPage();
  4847. CRect mainrc(0, 0, 560, 793);
  4848. float fscale;
  4849. {
  4850. int w, h;
  4851. m_Print.GetWidHei(w, h);
  4852. fscale = (float)w / (float)h;
  4853. }
  4854. mainrc.DeflateRect(25, 40, 10, 0);
  4855. CString str;
  4856. CRect rc, rc2;
  4857. rc = mainrc;
  4858. rc.bottom = rc.top;
  4859. rc.top -= 20;
  4860. rc.left -= 20;
  4861. m_Print.SetFontFace(6, 1, "宋体");
  4862. str.Format(" 页:%d/%d", aa + 1, pages);
  4863. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4864. rc.right = mainrc.right + 10;
  4865. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4866. m_Print.SetFontFace(12, 1, "宋体");
  4867. int wid[2] = { 70, 190 };
  4868. int hei = 22;
  4869. rc = mainrc;
  4870. rc.bottom = rc.top + hei;
  4871. rc.top += 10;
  4872. rc.bottom += 10;
  4873. int dtx = rc.Width() / 2 + 18;
  4874. int dty = 380;
  4875. int arraysize = Listarray->ElementAt(0).GetSize();
  4876. for (int j = 0; j < 4; j++)
  4877. {
  4878. if (Listarray->GetSize() <= aa*sinlecount + j)continue;
  4879. for (int i = 0; i < arraysize; i++)
  4880. {
  4881. rc2.top = rc.top + i / 2 * hei;
  4882. rc2.bottom = rc.bottom + i / 2 * hei;
  4883. rc2.left = rc.left;
  4884. rc2.right = rc.left + wid[0];
  4885. if (i % 2)
  4886. {
  4887. rc2.left = rc2.right;
  4888. rc2.right += wid[1];
  4889. }
  4890. if (j == 1 || j == 3)
  4891. {
  4892. rc2.left += dtx;
  4893. rc2.right += dtx;
  4894. }
  4895. if (j == 2 || j == 3)
  4896. {
  4897. rc2.top += dty;
  4898. rc2.bottom += dty;
  4899. }
  4900. if (i == arraysize - 1 || i == arraysize - 2)
  4901. {
  4902. rc2.bottom += hei * 2;
  4903. }
  4904. m_Print.DrawRect2(rc2, 1);
  4905. {
  4906. str = Listarray->ElementAt(aa*sinlecount + j).ElementAt(i);
  4907. if (i == arraysize - 1)
  4908. {
  4909. CRect rc3 = rc2;
  4910. rc3.left += 3;
  4911. rc3.top += 3;
  4912. AutoDraw(m_Print, rc3, str, 1.4f);
  4913. }
  4914. else if (i == arraysize - 2)
  4915. {
  4916. CRect rc3 = rc2;
  4917. rc3.left += 3;
  4918. rc3.top += 3;
  4919. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4920. }
  4921. else
  4922. {
  4923. rc2.left += 3;
  4924. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4925. rc2.left -= 3;
  4926. }
  4927. }
  4928. }
  4929. }
  4930. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4931. dlg.m_pDC = m_Print.GetPDC();
  4932. if (aa == 0)
  4933. {
  4934. if (dlg.DoModal() != IDOK)
  4935. return;
  4936. }
  4937. //结束打印
  4938. m_Print.EndPage();
  4939. m_Print.EndPrint();
  4940. }
  4941. }
  4942. void CMainFrame::PrintThumbNail(CStringArray *array, CString client, BOOL bDir, CString m_size)
  4943. {
  4944. // TODO: Add your control notification handler code here
  4945. CStringArray titlearray;
  4946. CStringArray namearray;
  4947. CStringArray noarray;
  4948. CArray<CRect, CRect>rcarray;
  4949. CArray<CRect, CRect>widtharray;
  4950. if (m_size != "")
  4951. {
  4952. int pos = m_size.Find(";");
  4953. while (pos != -1)
  4954. {
  4955. CString size = m_size.Left(pos);
  4956. int pos2 = size.Find(":");
  4957. if (pos2 != -1)
  4958. {
  4959. CString str;
  4960. CRect rc;
  4961. str = size.Left(pos2);
  4962. noarray.Add(str);
  4963. str = size.Right(size.GetLength() - pos2 - 1);
  4964. pos2 = str.Find(",");
  4965. namearray.Add(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4966. pos2 = str.Find(",");
  4967. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4968. pos2 = str.Find(",");
  4969. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4970. widtharray.Add(rc);
  4971. pos2 = str.Find(",");
  4972. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4973. pos2 = str.Find(",");
  4974. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4975. pos2 = str.Find(",");
  4976. rc.right = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4977. rc.bottom = atoi(str);
  4978. rcarray.Add(rc);
  4979. }
  4980. m_size = m_size.Right(m_size.GetLength() - pos - 1);
  4981. pos = m_size.Find(";");
  4982. }
  4983. }
  4984. PrintPreview dlg;
  4985. CPrintRX m_Print;
  4986. m_Print.InitToPrint(NULL, 1);
  4987. m_Print.StartPrint();
  4988. m_Print.StartPage();
  4989. CRect mainrc(0, 0, 560, 793);
  4990. mainrc.DeflateRect(25, 50, 10, 0);
  4991. m_Print.SetFontFace(10, 1, "宋体");
  4992. CRect rc, rc2;
  4993. rc = mainrc;
  4994. rc.bottom = rc.top;
  4995. rc.top -= 20;
  4996. m_Print.DrawText((LPTSTR)(LPCTSTR)client, rc, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4997. rc.bottom -= 5;
  4998. m_Print.DrawRect2(rc, 2);
  4999. if (array->GetSize() > 130)m_Print.SetFontFace(8, 1, "宋体");
  5000. if (bDir)m_Print.SetFontFace(6, 1, "宋体");
  5001. ////////////////////////////////////////////////////////////////
  5002. int imgcount = array->GetSize();
  5003. int dtx = 5;
  5004. int dty = 15;
  5005. int cx, cy;
  5006. int countx = 5;
  5007. int county = 1;
  5008. while (1)
  5009. {
  5010. if (countx*county >= imgcount)
  5011. {
  5012. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  5013. cy = cx * 4 / 3;
  5014. break;
  5015. }
  5016. else
  5017. {
  5018. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  5019. cy = cx * 4 / 3;
  5020. if (cy*(county + 1) + dty*county < mainrc.Height())//Y方向可以增加一个
  5021. {
  5022. county++;
  5023. }
  5024. else//Y方向不能加,X方向加
  5025. {
  5026. countx++;
  5027. county = 1;
  5028. }
  5029. }
  5030. }
  5031. int imgpos = 0;
  5032. CString stemp;
  5033. CPen pen(PS_SOLID, 1, RGB(255, 0, 0));
  5034. CPen *oldpen = m_Print.m_DC.SelectObject(&pen);
  5035. CPen *oldpen2 = m_Print.m_memdc.SelectObject(&pen);
  5036. for (int i = 0; i < county; i++)
  5037. {
  5038. for (int j = 0; j < countx; j++)
  5039. {
  5040. rc = mainrc;
  5041. rc.top += i*(cy + dty);
  5042. rc.left += j*(cx + dtx);
  5043. rc.right = rc.left + cx;
  5044. rc.bottom = rc.top + cy;
  5045. Image *pImg = NULL;
  5046. if (imgpos >= array->GetSize())break;
  5047. CString str = array->ElementAt(imgpos);
  5048. CString spath = str.Left(str.ReverseFind('\\') + 1);
  5049. spath += "m";
  5050. spath += str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5051. if (PathFileExists(spath))
  5052. ::LoadImageFromBuf(&pImg, spath);
  5053. else
  5054. {
  5055. ::LoadImageFromBuf(&pImg, str);
  5056. if (pImg == NULL)continue;
  5057. int orientation = GetOrientation(pImg);
  5058. if (orientation == 8)
  5059. pImg->RotateFlip(Rotate270FlipNone);
  5060. else if (orientation == 6)
  5061. pImg->RotateFlip(Rotate90FlipNone);
  5062. }
  5063. if (pImg == NULL)continue;
  5064. rc2 = rc;
  5065. RectFitDes(pImg->GetWidth(), pImg->GetHeight(), rc);
  5066. imgpos++;
  5067. m_Print.DrawImage(pImg, rc);
  5068. int imgwidth = pImg->GetWidth();
  5069. delete pImg;
  5070. rc2.top = rc2.bottom + 3;
  5071. rc2.bottom += 10;
  5072. if (bDir == 0)
  5073. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5074. else
  5075. {
  5076. stemp = str.Left(str.ReverseFind('\\'));
  5077. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5078. if (stemp.ReverseFind('\\') != -1)
  5079. {
  5080. stemp = stemp.Right(stemp.GetLength() - stemp.ReverseFind('\\') - 1);
  5081. str = stemp + "\\" + str;
  5082. }
  5083. }
  5084. if (str.Find(".") != -1)
  5085. str = str.Left(str.Find("."));
  5086. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5087. if (noarray.GetSize())
  5088. {
  5089. rc2 = rc;
  5090. for (int aa = 0; aa < noarray.GetSize(); aa++)
  5091. {
  5092. float scale = (float)rc2.Width() / (float)imgwidth;
  5093. if (noarray.ElementAt(aa) == str)
  5094. {
  5095. int nIndex = aa;
  5096. CRect rc = rcarray.ElementAt(nIndex);
  5097. int wid = widtharray.ElementAt(nIndex).left;
  5098. int hei = widtharray.ElementAt(nIndex).top;
  5099. scale *= (float)imgwidth / (float)wid;
  5100. rc.left *= scale;
  5101. rc.right *= scale;
  5102. rc.top *= scale;
  5103. rc.bottom *= scale;
  5104. rc.left += rc2.left;
  5105. rc.right += rc2.left;
  5106. rc.top += rc2.top;
  5107. rc.bottom += rc2.top;
  5108. if (rc.left < rc2.left)rc.left = rc2.left;
  5109. if (rc.right > rc2.right)rc.right = rc2.right;
  5110. if (rc.top < rc2.top)rc.top = rc2.top;
  5111. if (rc.bottom > rc2.bottom)rc.bottom = rc2.bottom;
  5112. m_Print.DrawRect2(rc, 1);
  5113. }
  5114. }
  5115. }
  5116. }
  5117. }
  5118. m_Print.m_DC.SelectObject(oldpen);
  5119. m_Print.m_memdc.SelectObject(oldpen2);
  5120. /* CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  5121. StrRect.top -=15;StrRect.bottom -=15;
  5122. Image *pImg=NULL;
  5123. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  5124. m_Print.DrawImage(pImg, StrRect);
  5125. delete pImg;
  5126. m_Print.SetFontFace(10, 1, "宋体");
  5127. StrRect=load.m_rcarray .ElementAt (20);
  5128. StrRect.right=load.m_rcarray .ElementAt (23).right;
  5129. StrRect.top -=18;StrRect.bottom -=18;
  5130. CString str="地址:"+g_cominfoarray.ElementAt (0).ElementAt (12);
  5131. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5132. */
  5133. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  5134. dlg.m_pDC = m_Print.GetPDC();
  5135. if (dlg.DoModal() != IDOK)
  5136. return;
  5137. //结束打印
  5138. m_Print.EndPage();
  5139. m_Print.EndPrint();
  5140. }
  5141. // remark by Jeff
  5142. // 函数:PrintDinDan
  5143. // 参数:
  5144. // strOrderNumber:订单单号;(Order number)
  5145. // 返回:void
  5146. // 注意:#
  5147. void CMainFrame::PrintDinDan(CString strOrderNumber)//打印订单报表;
  5148. {
  5149. int printcot = 1;
  5150. for (int aa = 0; aa < printcot; aa++)
  5151. {
  5152. PrintPreview dlg;
  5153. CPrintRX m_Print;
  5154. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  5155. {
  5156. m_Print.InitToPrint(NULL, 1);
  5157. }
  5158. else
  5159. {
  5160. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  5161. if (name.IsEmpty())
  5162. m_Print.InitToPrint(NULL, 1);
  5163. else
  5164. {
  5165. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  5166. if (nret == -1 && aa == 0)
  5167. {
  5168. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  5169. }
  5170. }
  5171. }
  5172. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 0)
  5173. {
  5174. #ifdef ZHIAI_VERSION
  5175. PrintDinDan3(strOrderNumber);
  5176. return;
  5177. #endif
  5178. #ifdef SZBLCT_VERSION
  5179. PrintDinDan4(strOrderNumber);
  5180. return;
  5181. #endif
  5182. m_Print.StartPrint();
  5183. m_Print.StartPage();
  5184. LoadRect load;
  5185. load.SetLiaPath("6.lia");
  5186. load.SetMargins(-14, 15);
  5187. if (!load.Load())return;
  5188. LoadRect load2;
  5189. load2.SetLiaPath("7.lia");
  5190. load2.SetMargins(-14, 216 + 15);
  5191. if (!load2.Load())return;
  5192. LoadRect load3;
  5193. load3.SetLiaPath("8.lia");
  5194. load3.SetMargins(-14, 705 + 15);
  5195. if (!load3.Load())return;
  5196. int i;
  5197. //////////////////////////////////////////////////////////////
  5198. CStringArray txarray;
  5199. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  5200. g_sendhead.code[0] = 11;
  5201. g_sendhead.code[1] = 52;
  5202. g_sendhead.code[2] = 50;
  5203. g_sendhead.code[3] = 150;
  5204. g_sendhead.code[4] = 77;
  5205. g_sendhead.code[5] = 4;
  5206. g_sendhead.tabcount = 6;
  5207. g_sendhead.bsql = 0;
  5208. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5209. CArray<CStringArray, CStringArray>sparray;
  5210. CArray<CStringArray, CStringArray>clientarray;
  5211. CArray<CStringArray, CStringArray>phonearray;
  5212. CArray<CStringArray, CStringArray>fgarray;
  5213. CArray<CStringArray, CStringArray>danweiarray;
  5214. CArray<CStringArray, CStringArray>jdarray;
  5215. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5216. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5217. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5218. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5219. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5220. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5221. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5222. CString m_taoxiname;
  5223. if (m_zs.Find("\\") != -1)
  5224. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  5225. else
  5226. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  5227. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5228. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5229. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5230. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5231. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5232. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5233. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5234. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5235. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5236. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5237. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5238. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5239. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5240. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5241. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5242. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5243. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5244. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5245. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5246. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5247. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5248. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5249. if (jdarray.GetSize())
  5250. {
  5251. if (m_bz.IsEmpty() == 0)
  5252. m_bz = "\r\n" + m_bz;
  5253. m_bz += "景点:";
  5254. }
  5255. #ifdef DDF_VERSION
  5256. m_bz += "219店:219路馨园小区对面\r\n";
  5257. m_bz += "金色店:万科金色家园小区东门南走20米荣光社区一楼\r\n";
  5258. m_bz += "万泰店:万泰锦绣华城小区正门\r\n";
  5259. #else
  5260. for (i = 0; i < jdarray.GetSize(); i++)
  5261. {
  5262. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5263. }
  5264. m_bz.TrimRight(";");
  5265. #endif
  5266. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5267. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5268. if (IsHasRights2new(31) == 0)
  5269. {
  5270. m_phone1 = "***";
  5271. m_phone2 = "***";
  5272. }
  5273. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5274. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5275. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  5276. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  5277. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  5278. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  5279. filter = "name='" + m_ren + "'";
  5280. g_sendhead.code[0] = 5;
  5281. g_sendhead.tabcount = 1;
  5282. g_sendhead.bsql = 0;
  5283. int g_nYearposTemp = g_nYearpos;
  5284. g_nYearpos = -1;
  5285. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5286. g_nYearpos = g_nYearposTemp;
  5287. if (g_bSendOK == 0)return;
  5288. DataToArray(&phonearray);
  5289. m_money1.Format("%f", atof(m_taoxijiage));
  5290. m_money2.Format("%f", atof(m_payed1));
  5291. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5292. ConvertToPrice(m_money1);
  5293. ConvertToPrice(m_money2);
  5294. ConvertToPrice(m_money3);
  5295. ////////////////////////////////////////////////////////////////
  5296. int rcpos = -1;
  5297. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  5298. StrRect.top -= 15; StrRect.bottom -= 15;
  5299. Image *pImg = NULL;
  5300. #ifdef MNLS_VERSION
  5301. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  5302. #else
  5303. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  5304. #endif
  5305. m_Print.DrawImage(pImg, StrRect);
  5306. delete pImg;
  5307. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5308. {
  5309. Image *pImg = NULL;
  5310. g_nSendCode = 31;
  5311. int g_nYearposTemp = g_nYearpos;
  5312. g_nYearpos = -1;
  5313. g_pMainWnd->ProcessChatMessageRequest2(1);
  5314. g_nYearpos = g_nYearposTemp;
  5315. g_nSendCode = 0;
  5316. if (g_bSendOK == 0)return;
  5317. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5318. if (pImg)
  5319. {
  5320. StrRect.left = 30;
  5321. StrRect.top = 12;
  5322. StrRect.right = StrRect.left + 60;
  5323. StrRect.bottom = StrRect.top + 60;
  5324. m_Print.DrawImage(pImg, StrRect);
  5325. delete pImg; pImg = NULL;
  5326. }
  5327. }
  5328. m_Print.SetFontFace(11, 1, "宋体");
  5329. StrRect = load.m_rcarray.ElementAt(20);
  5330. StrRect.right = load.m_rcarray.ElementAt(23).right;
  5331. StrRect.top -= 18; StrRect.bottom -= 18;
  5332. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  5333. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5334. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  5335. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5336. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5337. StrRect.top -= 15; StrRect.bottom -= 15;
  5338. #ifdef MNLS_VERSION
  5339. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5340. #endif
  5341. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5342. StrRect.top -= 15; StrRect.bottom -= 15;
  5343. #ifdef MNLS_VERSION
  5344. m_Print.DrawRect(StrRect);
  5345. #endif
  5346. m_Print.SetFontFace(7, 1, "黑体");
  5347. m_Print.SetColor(0xffffff);
  5348. #ifdef MNLS_VERSION
  5349. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5350. #endif
  5351. m_Print.SetColor(0);
  5352. m_Print.SetFontFace(15, 1, "宋体");
  5353. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5354. StrRect.top -= 15; StrRect.bottom -= 15;
  5355. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同预约订单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5356. CStringArray strarray;
  5357. strarray.Add("NO: " + strOrderNumber);
  5358. CString date;
  5359. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  5360. strarray.Add(date);
  5361. strarray.Add("喜爱");
  5362. strarray.Add("格调");
  5363. if (fgarray.GetSize() == 12)
  5364. {
  5365. for (int i = 0; i < 12; i++)
  5366. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  5367. }
  5368. else
  5369. {
  5370. strarray.Add("复古典雅");
  5371. strarray.Add("温文尔雅");
  5372. strarray.Add("豪华艳丽");
  5373. strarray.Add("传统大方");
  5374. strarray.Add("新潮个性");
  5375. strarray.Add("浪漫奔放");
  5376. strarray.Add("简单素雅");
  5377. strarray.Add("活泼俏丽");
  5378. strarray.Add("妩媚温馨");
  5379. strarray.Add("温柔贤惠");
  5380. strarray.Add("成熟感性");
  5381. strarray.Add("清纯可爱");
  5382. }
  5383. strarray.Add("姓名");
  5384. // strarray.Add("职业");
  5385. strarray.Add("");
  5386. strarray.Add("地址");
  5387. strarray.Add("电话");
  5388. #ifdef CHILD_VERSION
  5389. strarray.Add("家长");
  5390. strarray.Add("宝宝");
  5391. #else
  5392. strarray.Add("先生");
  5393. strarray.Add("女士");
  5394. #endif
  5395. m_Print.SetFontFace(11, 1, "宋体");
  5396. for (i = 0; i < strarray.GetSize(); i++)
  5397. {
  5398. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5399. if (i < 2)
  5400. {
  5401. StrRect.top -= 15; StrRect.bottom -= 15;
  5402. }
  5403. if (i>15)
  5404. m_Print.DrawRect2(StrRect, 1);
  5405. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5406. }
  5407. for (i = 29; i <= 40; i++)
  5408. {
  5409. if (m_style.GetLength() <= (i - 29))continue;
  5410. if (m_style.GetAt(i - 29) != '1')continue;
  5411. StrRect = load.m_rcarray.ElementAt(i - 1);
  5412. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5413. }
  5414. for (i = 27; i <= 48; i++)
  5415. {
  5416. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5417. m_Print.DrawRect2(StrRect, 1);
  5418. }
  5419. #ifdef CHILD_VERSION
  5420. StrRect = load.m_rcarray.ElementAt(45);
  5421. StrRect.right = StrRect.left + 62;
  5422. m_Print.DrawRect2(StrRect, 1);
  5423. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5424. StrRect.left = StrRect.right;
  5425. StrRect.right = StrRect.left + 62;
  5426. m_Print.DrawRect2(StrRect, 1);
  5427. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5428. StrRect.left = StrRect.right;
  5429. StrRect.right = StrRect.left + 62;
  5430. m_Print.DrawRect2(StrRect, 1);
  5431. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5432. StrRect.left = StrRect.right;
  5433. StrRect.right = StrRect.left + 62;
  5434. m_Print.DrawRect2(StrRect, 1);
  5435. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5436. #endif
  5437. /////////////////////////
  5438. strarray.RemoveAll();
  5439. CString temp;
  5440. temp.Format("拍摄多款选 %d 款,其中影", atoi(m_outside) + atoi(m_outside2));
  5441. strarray.Add(temp);
  5442. temp.Format("棚景 %d 款,景点 %d 款.", atoi(m_outside2), atoi(m_outside));
  5443. strarray.Add(temp);
  5444. strarray.Add("化妆");
  5445. strarray.Add("造型");
  5446. #ifdef CHILD_VERSION
  5447. strarray.Add("");
  5448. #else
  5449. strarray.Add("婚纱");
  5450. #endif
  5451. strarray.Add("服饰");
  5452. strarray.Add("配");
  5453. strarray.Add("置");
  5454. strarray.Add("其");
  5455. strarray.Add("它");
  5456. strarray.Add("套系名称");
  5457. strarray.Add("镜款");
  5458. strarray.Add("套系总价");
  5459. strarray.Add("主摄影师");
  5460. strarray.Add("拍摄日期");
  5461. strarray.Add("定金");
  5462. #ifdef CHILD_VERSION
  5463. strarray.Add("主引导师");
  5464. #else
  5465. strarray.Add("主化妆师");
  5466. #endif
  5467. strarray.Add("看样日期");
  5468. strarray.Add("欠款余额");
  5469. strarray.Add("总监");
  5470. strarray.Add("取件日期");
  5471. rcpos = -1;
  5472. for (i = 0; i < strarray.GetSize(); i++)
  5473. {
  5474. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5475. if (i>9)
  5476. m_Print.DrawRect2(StrRect, 1);
  5477. #ifdef CHILD_VERSION
  5478. if (i == 5)
  5479. StrRect.top -= StrRect.Height();
  5480. #endif
  5481. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5482. }
  5483. for (i = 22; i <= 41; i++)
  5484. {
  5485. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5486. m_Print.DrawRect2(StrRect, 1);
  5487. }
  5488. /////////////////////////////
  5489. strarray.RemoveAll();
  5490. #ifdef CHILD_VERSION
  5491. strarray.Add("顾客方 家长:");
  5492. strarray.Add("宝宝:");
  5493. #else
  5494. strarray.Add("顾客方 先生:");
  5495. strarray.Add("女士:");
  5496. #endif
  5497. strarray.Add("电话:");
  5498. strarray.Add("影楼方 店长:");
  5499. strarray.Add("接单人:");
  5500. strarray.Add("电话:");
  5501. rcpos = -1;
  5502. for (i = 0; i < strarray.GetSize(); i++)
  5503. {
  5504. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5505. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5506. }
  5507. for (i = 7; i <= 12; i++)
  5508. {
  5509. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5510. // if(i!=10)
  5511. m_Print.DrawRect2(StrRect, 2);
  5512. }
  5513. //////////////////////////////////////
  5514. //开始打数据
  5515. strarray.RemoveAll();
  5516. strarray.Add(m_name1);
  5517. strarray.Add(m_name2);
  5518. /// strarray.Add (m_occupation1);
  5519. // strarray.Add (m_occupation2);
  5520. strarray.Add("");
  5521. strarray.Add("");
  5522. strarray.Add(m_addr1);
  5523. #ifdef CHILD_VERSION
  5524. strarray.Add("");
  5525. #else
  5526. strarray.Add(m_addr2);
  5527. #endif
  5528. strarray.Add(m_phone1);
  5529. strarray.Add(m_phone2);
  5530. for (i = 41; i <= 48; i++)
  5531. {
  5532. StrRect = load.m_rcarray.ElementAt(i - 1);
  5533. StrRect.left += 4;
  5534. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5535. }
  5536. ///////////////////////////////
  5537. strarray.RemoveAll();
  5538. strarray.Add(m_money1);
  5539. strarray.Add(m_waiter1);
  5540. strarray.Add(m_time2);
  5541. strarray.Add(m_money2);
  5542. strarray.Add(m_waiter2);
  5543. strarray.Add(m_time4);
  5544. strarray.Add(m_money3);
  5545. strarray.Add("");
  5546. strarray.Add(m_time5);
  5547. for (i = 32; i <= 40; i++)
  5548. {
  5549. StrRect = load2.m_rcarray.ElementAt(i - 1);
  5550. StrRect.left += 4;
  5551. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5552. }
  5553. ///////////////////////////////
  5554. strarray.RemoveAll();
  5555. strarray.Add(m_name1);
  5556. strarray.Add(m_name2);
  5557. CString phone;
  5558. if (m_phone1.IsEmpty() == 0)
  5559. phone = m_phone1 + ",";
  5560. phone += m_phone2;
  5561. phone.TrimRight(",");
  5562. strarray.Add(phone);
  5563. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  5564. strarray.Add(m_ren);
  5565. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  5566. for (i = 7; i <= 12; i++)
  5567. {
  5568. StrRect = load3.m_rcarray.ElementAt(i - 1);
  5569. StrRect.left += 4;
  5570. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5571. }
  5572. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  5573. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5574. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  5575. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5576. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  5577. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5578. //////////////////////////////
  5579. //开始画文字
  5580. StrRect = load2.m_rcarray.ElementAt(30);
  5581. StrRect.left += 3;
  5582. StrRect.top += 3;
  5583. StrRect.right -= 2;
  5584. StrRect.bottom -= 2;
  5585. AutoDraw(m_Print, StrRect, m_bz, 1.4f);
  5586. StrRect = load2.m_rcarray.ElementAt(29);
  5587. StrRect.left += 3;
  5588. StrRect.top += 3;
  5589. StrRect.right -= 2;
  5590. StrRect.bottom -= 2;
  5591. str = "";
  5592. for (i = 0; i < sparray.GetSize(); i++)
  5593. {
  5594. str += sparray.ElementAt(i).ElementAt(5);
  5595. str += " 数量:";
  5596. str += sparray.ElementAt(i).ElementAt(3);
  5597. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5598. str += "\r\n";
  5599. }
  5600. str.TrimRight("\r\n");
  5601. AutoDraw(m_Print, StrRect, str, 1.4);
  5602. StrRect = load2.m_rcarray.ElementAt(40);
  5603. StrRect.top += 8;
  5604. m_Print.SetFontFace(12, 1, "黑体");
  5605. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5606. StrRect.left += 3;
  5607. StrRect.top += 30;
  5608. StrRect.right -= 2;
  5609. StrRect.bottom -= 2;
  5610. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5611. if (str.IsEmpty())
  5612. {
  5613. str = "\
  5614. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5615. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5616. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5617. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5618. 持良好的心境.\r\n\
  5619. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5620. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5621. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5622. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5623. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5624. 勿进影室, 以免影响拍摄.\r\n\
  5625. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5626. 师或店长沟通.\r\n\
  5627. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5628. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5629. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5630. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5631. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5632. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5633. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5634. 还.";
  5635. }
  5636. AutoDraw(m_Print, StrRect, str, 1.8);
  5637. }
  5638. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 1)
  5639. {//AfxMessageBox("yyy");
  5640. m_Print.StartPrint();
  5641. m_Print.StartPage();
  5642. LoadRect load;
  5643. load.SetLiaPath("6-2.lia");
  5644. load.SetMargins(0, 0);
  5645. if (!load.Load())return;
  5646. int i;
  5647. //////////////////////////////////////////////////////////////
  5648. CStringArray txarray;
  5649. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  5650. g_sendhead.code[0] = 11;
  5651. g_sendhead.code[1] = 52;
  5652. g_sendhead.code[2] = 50;
  5653. g_sendhead.code[3] = 150;
  5654. g_sendhead.code[4] = 77;
  5655. g_sendhead.code[5] = 4;
  5656. g_sendhead.tabcount = 6;
  5657. g_sendhead.bsql = 0;
  5658. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5659. CArray<CStringArray, CStringArray>sparray;
  5660. CArray<CStringArray, CStringArray>clientarray;
  5661. CArray<CStringArray, CStringArray>phonearray;
  5662. CArray<CStringArray, CStringArray>fgarray;
  5663. CArray<CStringArray, CStringArray>danweiarray;
  5664. CArray<CStringArray, CStringArray>jdarray;
  5665. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5666. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5667. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5668. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5669. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5670. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5671. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  5672. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5673. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5674. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5675. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5676. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5677. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5678. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5679. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5680. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5681. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5682. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5683. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5684. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5685. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5686. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5687. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5688. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5689. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5690. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5691. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5692. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5693. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5694. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5695. if (jdarray.GetSize())
  5696. {
  5697. if (m_bz.IsEmpty() == 0)
  5698. m_bz = "\r\n" + m_bz;
  5699. m_bz += "景点:";
  5700. }
  5701. for (i = 0; i < jdarray.GetSize(); i++)
  5702. {
  5703. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5704. }
  5705. m_bz.TrimRight(";");
  5706. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5707. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5708. if (IsHasRights2new(31) == 0)
  5709. {
  5710. m_phone1 = "***";
  5711. m_phone2 = "***";
  5712. }
  5713. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5714. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5715. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  5716. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  5717. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  5718. CString str;
  5719. filter = "name='" + m_ren + "'";
  5720. g_sendhead.code[0] = 5;
  5721. g_sendhead.tabcount = 1;
  5722. g_sendhead.bsql = 0;
  5723. int g_nYearposTemp = g_nYearpos;
  5724. g_nYearpos = -1;
  5725. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5726. g_nYearpos = g_nYearposTemp;
  5727. if (g_bSendOK == 0)return;
  5728. DataToArray(&phonearray);
  5729. m_money1.Format("%f", atof(m_taoxijiage));
  5730. m_money2.Format("%f", atof(m_payed1));
  5731. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5732. ConvertToPrice(m_money1);
  5733. ConvertToPrice(m_money2);
  5734. ConvertToPrice(m_money3);
  5735. ////////////////////////////////////////////////////////////////
  5736. int rcpos = -1;
  5737. CRect StrRect = load.m_rcarray.ElementAt(0);
  5738. m_Print.SetFontFace(25, 1, "黑体");
  5739. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "预约单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5740. m_Print.SetFontFace(11, 1, "宋体");
  5741. StrRect = load.m_rcarray.ElementAt(1);
  5742. if (m_time1.GetLength() == 10)
  5743. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  5744. else
  5745. str = "开单日期:";
  5746. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5747. StrRect = load.m_rcarray.ElementAt(2);
  5748. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + strOrderNumber), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5749. CStringArray strarray;
  5750. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5751. {
  5752. Image *pImg = NULL;
  5753. g_nSendCode = 31;
  5754. int g_nYearposTemp = g_nYearpos;
  5755. g_nYearpos = -1;
  5756. g_pMainWnd->ProcessChatMessageRequest2(1);
  5757. g_nYearpos = g_nYearposTemp;
  5758. g_nSendCode = 0;
  5759. if (g_bSendOK == 0)return;
  5760. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5761. if (pImg)
  5762. {
  5763. StrRect.left = 47;
  5764. StrRect.top = 12;
  5765. StrRect.right = StrRect.left + 60;
  5766. StrRect.bottom = StrRect.top + 60;
  5767. m_Print.DrawImage(pImg, StrRect);
  5768. delete pImg; pImg = NULL;
  5769. }
  5770. }
  5771. #ifdef CHILD_VERSION
  5772. strarray.Add("家长姓名");
  5773. strarray.Add("宝宝姓名");
  5774. #else
  5775. strarray.Add("先生姓名");
  5776. strarray.Add("女士姓名");
  5777. #endif
  5778. strarray.Add("服装套数");
  5779. // strarray.Add ("拍摄张数");
  5780. #ifdef CHILD_VERSION
  5781. strarray.Add("出生日期");
  5782. #else
  5783. strarray.Add("结婚日期");
  5784. #endif
  5785. strarray.Add("拍摄日期");
  5786. strarray.Add("联系电话");
  5787. strarray.Add("联系电话");
  5788. strarray.Add("造型套数");
  5789. if (m_zs.Find("\\") != -1)
  5790. strarray.Add("入底\\入册");
  5791. else
  5792. strarray.Add("入底张数");
  5793. strarray.Add("选片日期");
  5794. strarray.Add("QQ/邮箱");
  5795. strarray.Add("套系总额");
  5796. strarray.Add("定金");
  5797. strarray.Add("余款金额");
  5798. strarray.Add("取件日期");
  5799. strarray.Add(m_name1);
  5800. strarray.Add(m_name2);
  5801. strarray.Add(m_clothescount);
  5802. // str.Format("%d", atoi(m_zs)*3);
  5803. // strarray.Add (str);
  5804. #ifdef CHILD_VERSION
  5805. strarray.Add(m_birthday1);
  5806. #else
  5807. strarray.Add(m_time3);
  5808. #endif
  5809. strarray.Add(m_time2);
  5810. strarray.Add(m_phone1);
  5811. strarray.Add(m_phone2);
  5812. strarray.Add(m_clothescount2);
  5813. strarray.Add(m_zs);
  5814. strarray.Add(m_time4);
  5815. strarray.Add(m_qq1);
  5816. strarray.Add(m_money1);
  5817. strarray.Add(m_money2);
  5818. strarray.Add(m_money3);
  5819. strarray.Add(m_time5);
  5820. for (i = 4; i <= 33; i++)
  5821. {
  5822. StrRect = load.m_rcarray.ElementAt(i - 1);
  5823. m_Print.DrawRect2(StrRect, 1);
  5824. if (strarray.GetSize() > (i - 4))
  5825. {
  5826. if (i <= 18)
  5827. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5828. else
  5829. {
  5830. StrRect.left += 4;
  5831. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5832. }
  5833. }
  5834. }
  5835. int dt = 413;
  5836. StrRect = load.m_rcarray.ElementAt(36); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5837. m_Print.DrawText((LPTSTR)(LPCTSTR)"门市签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5838. StrRect = load.m_rcarray.ElementAt(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5839. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5840. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5841. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5842. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  5843. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5844. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  5845. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5846. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  5847. m_Print.DrawText((LPTSTR)(LPCTSTR)("网址:" + g_cominfoarray.ElementAt(0).ElementAt(13)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5848. //////////////////////////////
  5849. //开始画文字
  5850. StrRect = load.m_rcarray.ElementAt(7);
  5851. int hei = StrRect.Height();
  5852. StrRect.top += hei;
  5853. StrRect.bottom += hei;
  5854. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5855. StrRect.top += dt;
  5856. StrRect.bottom += dt;
  5857. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5858. StrRect = load.m_rcarray.ElementAt(17);
  5859. StrRect.top += hei;
  5860. StrRect.bottom += hei;
  5861. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5862. StrRect = load.m_rcarray.ElementAt(33);
  5863. StrRect.bottom = StrRect.top + dt; m_Print.DrawRect2(StrRect, 1);
  5864. StrRect.top += hei;
  5865. StrRect.left += 3;
  5866. StrRect.top += 3;
  5867. StrRect.right -= 2;
  5868. StrRect.bottom -= 2;
  5869. str = "";
  5870. for (i = 0; i < sparray.GetSize(); i++)
  5871. {
  5872. str += sparray.ElementAt(i).ElementAt(5);
  5873. str += " 数量:";
  5874. str += sparray.ElementAt(i).ElementAt(3);
  5875. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5876. str += "\r\n";
  5877. }
  5878. str.TrimRight("\r\n");
  5879. AutoDraw(m_Print, StrRect, str, 1.4);
  5880. StrRect = load.m_rcarray.ElementAt(33);
  5881. StrRect.top += dt;
  5882. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5883. StrRect.top += hei;
  5884. StrRect.left += 3;
  5885. StrRect.top += 3;
  5886. StrRect.right -= 2;
  5887. StrRect.bottom -= 2;
  5888. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  5889. StrRect = load.m_rcarray.ElementAt(34);
  5890. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5891. StrRect.top += hei;
  5892. StrRect.left += 3;
  5893. StrRect.top += 3;
  5894. StrRect.right -= 2;
  5895. StrRect.bottom -= 2;
  5896. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5897. if (str.IsEmpty())
  5898. {
  5899. str = "\
  5900. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5901. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5902. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5903. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5904. 持良好的心境.\r\n\
  5905. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5906. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5907. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5908. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5909. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5910. 勿进影室, 以免影响拍摄.\r\n\
  5911. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5912. 师或店长沟通.\r\n\
  5913. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5914. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5915. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5916. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5917. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5918. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5919. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5920. 还.";
  5921. }
  5922. AutoDraw(m_Print, StrRect, str, 1.8);
  5923. StrRect = load.m_rcarray.ElementAt(35);
  5924. StrRect.bottom += 100;
  5925. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  5926. str = "第\r\n一\r\n联\r\n存\r\n根\r\n∧\r\n白\r\n∨\r\n第\r\n二\r\n联\r\n客\r\n户\r\n∧\r\n红\r\n∨\r\n第\r\n三\r\n联\r\n流\r\n程\r\n∧\r\n黄\r\n∨";
  5927. // AutoDraw(m_Print, StrRect, str, 1.4);
  5928. }
  5929. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 2)
  5930. {
  5931. PrintDinDan5(strOrderNumber);
  5932. return;
  5933. }
  5934. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  5935. {
  5936. PrintDinDan6(strOrderNumber);
  5937. return;
  5938. }
  5939. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  5940. dlg.m_pDC = m_Print.GetPDC();
  5941. dlg.m_mode = 1;
  5942. if (aa == 0)
  5943. {
  5944. if (dlg.DoModal() != IDOK)
  5945. return;
  5946. printcot = dlg.m_num;
  5947. }
  5948. //结束打印
  5949. m_Print.EndPage();
  5950. m_Print.EndPrint();
  5951. }
  5952. }
  5953. void CovertDate2(CString date, CString &date2)
  5954. {
  5955. try
  5956. {
  5957. if (date == "2013-04-09")
  5958. {
  5959. date2 = "2013-02-29";
  5960. return;
  5961. }
  5962. ///////////////////////////////////
  5963. date2 = date;
  5964. GongToLong(date2);
  5965. ////////////////////////////////////
  5966. return;
  5967. CCalendarConvert m_CalendarConvert;
  5968. SYSTEMTIME src = { 0 };
  5969. SYSTEMTIME dst = { 0 };
  5970. COleDateTime m_timeLunar(atoi(date.Mid(0, 4)), atoi(date.Mid(5, 2)), atoi(date.Mid(8, 2)), 0, 0, 0);
  5971. COleDateTime m_timeGregorian;
  5972. m_timeLunar.GetAsSystemTime(src);
  5973. BOOL bEmbolism = 0;
  5974. if (m_CalendarConvert.Gregorian2Lunar(&src, &dst, &bEmbolism))
  5975. {
  5976. m_timeGregorian = m_CalendarConvert.ConvertSysTime2OleDateTime(&dst);
  5977. date2.Format("%04d-%02d-%02d", m_timeGregorian.GetYear(), m_timeGregorian.GetMonth(), m_timeGregorian.GetDay());
  5978. if (m_timeGregorian.GetYear() == -1)date2 = "2000-13-32";
  5979. }
  5980. else
  5981. {
  5982. date2.Empty();
  5983. }
  5984. }
  5985. catch (...)
  5986. {
  5987. }
  5988. }
  5989. void CMainFrame::PrintDinDan5(CString m_id)
  5990. {
  5991. int printcot = 1;
  5992. for (int aa = 0; aa < printcot; aa++)
  5993. {
  5994. PrintPreview dlg;
  5995. CPrintRX m_Print;
  5996. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  5997. {
  5998. m_Print.InitToPrint(NULL, 1);
  5999. }
  6000. else
  6001. {
  6002. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  6003. if (name.IsEmpty())
  6004. m_Print.InitToPrint(NULL, 1);
  6005. else
  6006. {
  6007. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6008. if (nret == -1 && aa == 0)
  6009. {
  6010. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6011. }
  6012. }
  6013. }
  6014. {
  6015. m_Print.StartPrint();
  6016. m_Print.StartPage();
  6017. LoadRect load;
  6018. load.SetLiaPath("19.lia");
  6019. load.SetMargins(0, -20);
  6020. if (!load.Load())return;
  6021. int i;
  6022. //////////////////////////////////////////////////////////////
  6023. CStringArray txarray;
  6024. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  6025. g_sendhead.code[0] = 11;
  6026. g_sendhead.code[1] = 52;
  6027. g_sendhead.code[2] = 50;
  6028. g_sendhead.code[3] = 150;
  6029. g_sendhead.code[4] = 77;
  6030. g_sendhead.code[5] = 4;
  6031. g_sendhead.tabcount = 6;
  6032. g_sendhead.bsql = 0;
  6033. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  6034. CArray<CStringArray, CStringArray>sparray;
  6035. CArray<CStringArray, CStringArray>clientarray;
  6036. CArray<CStringArray, CStringArray>phonearray;
  6037. CArray<CStringArray, CStringArray>fgarray;
  6038. CArray<CStringArray, CStringArray>danweiarray;
  6039. CArray<CStringArray, CStringArray>jdarray;
  6040. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  6041. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  6042. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  6043. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  6044. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  6045. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  6046. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  6047. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  6048. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  6049. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  6050. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  6051. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  6052. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  6053. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  6054. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  6055. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  6056. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  6057. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  6058. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  6059. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  6060. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  6061. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  6062. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  6063. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  6064. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  6065. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  6066. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  6067. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  6068. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(36);
  6069. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  6070. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6071. CString m_txtype = g_List1array.ElementAt(0).ElementAt(52);
  6072. CString m_memberno = g_List1array.ElementAt(0).ElementAt(47);
  6073. CString str;
  6074. if (jdarray.GetSize())
  6075. {
  6076. if (m_bz.IsEmpty() == 0)
  6077. m_bz = "\r\n" + m_bz;
  6078. m_bz += "景点:";
  6079. }
  6080. for (i = 0; i < jdarray.GetSize(); i++)
  6081. {
  6082. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  6083. }
  6084. m_bz.TrimRight(";");
  6085. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  6086. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  6087. if (IsHasRights2new(31) == 0)
  6088. {
  6089. m_phone1 = "***";
  6090. m_phone2 = "***";
  6091. }
  6092. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  6093. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  6094. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  6095. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  6096. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  6097. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  6098. BOOL check1 = atoi(clientarray.ElementAt(0).ElementAt(15));
  6099. filter = "name='" + m_ren + "'";
  6100. g_sendhead.code[0] = 5;
  6101. g_sendhead.tabcount = 1;
  6102. g_sendhead.bsql = 0;
  6103. int g_nYearposTemp = g_nYearpos;
  6104. g_nYearpos = -1;
  6105. g_pMainWnd->ProcessChatMessageRequest2(filter);
  6106. g_nYearpos = g_nYearposTemp;
  6107. if (g_bSendOK == 0)return;
  6108. DataToArray(&phonearray);
  6109. m_money1.Format("%f", atof(m_taoxijiage));
  6110. m_money2.Format("%f", atof(m_payed1));
  6111. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  6112. ConvertToPrice(m_money1);
  6113. ConvertToPrice(m_money2);
  6114. ConvertToPrice(m_money3);
  6115. ////////////////////////////////////////////////////////////////
  6116. int rcpos = -1;
  6117. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6118. //Image *pImg=NULL;
  6119. // ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  6120. // m_Print.DrawImage(pImg, StrRect);
  6121. // delete pImg;
  6122. m_Print.SetFontFace(20, 1, "宋体");
  6123. StrRect = load.m_rcarray.ElementAt(1);
  6124. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "定单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6125. m_Print.SetFontFace(12, 1, "宋体");
  6126. StrRect = load.m_rcarray.ElementAt(2);
  6127. m_Print.DrawText((LPTSTR)(LPCTSTR)("NO." + m_id), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6128. StrRect = load.m_rcarray.ElementAt(3);
  6129. str.Format("%s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  6130. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6131. StrRect = load.m_rcarray.ElementAt(4);
  6132. m_Print.DrawText((LPTSTR)(LPCTSTR)("联系人:" + m_name1), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6133. CStringArray strarray;
  6134. strarray.Add("姓名");
  6135. strarray.Add("性别");
  6136. strarray.Add("年龄");
  6137. strarray.Add("出生年月");
  6138. strarray.Add("套系价格");
  6139. strarray.Add("定金");
  6140. strarray.Add("欠款");
  6141. strarray.Add("拍摄类型");
  6142. strarray.Add("会员卡号");
  6143. strarray.Add("定单人");
  6144. strarray.Add("入底\\入册");
  6145. strarray.Add("联系电话");
  6146. for (i = 6; i <= 17; i++)
  6147. {
  6148. StrRect = load.m_rcarray.ElementAt(i - 1);
  6149. m_Print.DrawRect2(StrRect, 1);
  6150. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 6), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6151. }
  6152. strarray.RemoveAll();
  6153. strarray.Add(m_name2);
  6154. strarray.Add(m_sex);
  6155. if (m_birthday.GetLength() != 10)
  6156. strarray.Add("");
  6157. else
  6158. {
  6159. int year = 0;
  6160. if (check1)
  6161. {
  6162. CString date2;
  6163. CovertDate2(g_date, date2);
  6164. year = atoi(date2.Left(4)) - atoi(m_birthday.Left(4));
  6165. if (date2.Right(5) >= m_birthday.Right(5))
  6166. year++;
  6167. }
  6168. else
  6169. {
  6170. year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  6171. if (g_date.Right(5) >= m_birthday.Right(5))
  6172. year++;
  6173. }
  6174. str.Format("%d", year);
  6175. strarray.Add(str);
  6176. }
  6177. strarray.Add(m_birthday);
  6178. strarray.Add(m_money1);
  6179. strarray.Add(m_money2);
  6180. strarray.Add(m_money3);
  6181. strarray.Add(m_txtype);
  6182. strarray.Add(m_memberno);
  6183. strarray.Add(m_ren);
  6184. strarray.Add(m_zs);
  6185. if (!m_phone1.IsEmpty())
  6186. strarray.Add(m_phone1);
  6187. else
  6188. strarray.Add(m_phone2);
  6189. for (i = 18; i <= 29; i++)
  6190. {
  6191. StrRect = load.m_rcarray.ElementAt(i - 1);
  6192. m_Print.DrawRect2(StrRect, 1);
  6193. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6194. }
  6195. strarray.RemoveAll();
  6196. strarray.Add("摄影师");
  6197. strarray.Add("拍照时间");
  6198. strarray.Add("选片人");
  6199. strarray.Add("选片时间");
  6200. strarray.Add("引导师");
  6201. strarray.Add("设计师");
  6202. strarray.Add("取件时间");
  6203. strarray.Add("顾客签字");
  6204. for (i = 34; i <= 41; i++)
  6205. {
  6206. StrRect = load.m_rcarray.ElementAt(i - 1);
  6207. m_Print.DrawRect2(StrRect, 1);
  6208. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 34), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6209. }
  6210. strarray.RemoveAll();
  6211. strarray.Add(m_waiter1);
  6212. strarray.Add(m_time2);
  6213. strarray.Add(m_waiter3);
  6214. strarray.Add(m_time4);
  6215. strarray.Add(m_waiter2);
  6216. strarray.Add(m_waiter4);
  6217. strarray.Add(m_time5);
  6218. strarray.Add("");
  6219. for (i = 42; i <= 49; i++)
  6220. {
  6221. StrRect = load.m_rcarray.ElementAt(i - 1);
  6222. m_Print.DrawRect2(StrRect, 1);
  6223. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6224. }
  6225. m_Print.SetFontFace(15, 1, "宋体");
  6226. StrRect = load.m_rcarray.ElementAt(29);
  6227. m_Print.DrawRect2(StrRect, 1);
  6228. StrRect.top += 45;
  6229. m_Print.DrawText((LPTSTR)(LPCTSTR)"拍", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6230. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6231. m_Print.DrawText((LPTSTR)(LPCTSTR)"内", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6232. m_Print.DrawText((LPTSTR)(LPCTSTR)"容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  6233. StrRect = load.m_rcarray.ElementAt(30);
  6234. m_Print.DrawRect2(StrRect, 1);
  6235. StrRect.top += 45;
  6236. m_Print.DrawText((LPTSTR)(LPCTSTR)"友", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6237. m_Print.DrawText((LPTSTR)(LPCTSTR)"情", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6238. m_Print.DrawText((LPTSTR)(LPCTSTR)"提", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6239. m_Print.DrawText((LPTSTR)(LPCTSTR)"示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  6240. m_Print.SetFontFace(10, 1, "宋体");
  6241. StrRect = load.m_rcarray.ElementAt(37); StrRect.top = StrRect.bottom + 2;
  6242. str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  6243. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  6244. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  6245. StrRect = load.m_rcarray.ElementAt(48); StrRect.top = StrRect.bottom + 2; StrRect.left -= 200;
  6246. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  6247. //开始画文字
  6248. StrRect = load.m_rcarray.ElementAt(31);
  6249. StrRect.left += 3;
  6250. StrRect.top += 3;
  6251. StrRect.right -= 2;
  6252. StrRect.bottom -= 2;
  6253. str = "";
  6254. for (i = 0; i < sparray.GetSize(); i++)
  6255. {
  6256. str += sparray.ElementAt(i).ElementAt(5);
  6257. str += " 数量:";
  6258. str += sparray.ElementAt(i).ElementAt(3);
  6259. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6260. str += "\r\n";
  6261. }
  6262. str.TrimRight("\r\n");
  6263. m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6264. m_bz.TrimLeft();
  6265. if (m_bz != "")
  6266. {
  6267. str += "\r\n"; str += "\r\n";
  6268. str += "备注:" + m_bz;
  6269. }
  6270. AutoDraw(m_Print, StrRect, str, 1.4);
  6271. StrRect = load.m_rcarray.ElementAt(32); m_Print.DrawRect2(StrRect, 1);
  6272. StrRect.left += 3;
  6273. StrRect.top += 3;
  6274. StrRect.right -= 2;
  6275. StrRect.bottom -= 2;
  6276. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6277. if (str.IsEmpty())
  6278. {
  6279. str = "\
  6280. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6281. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6282. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6283. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6284. 持良好的心境.\r\n\
  6285. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6286. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6287. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6288. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6289. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6290. 勿进影室, 以免影响拍摄.\r\n\
  6291. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6292. 师或店长沟通.\r\n\
  6293. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6294. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6295. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6296. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6297. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6298. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6299. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6300. 还.";
  6301. }
  6302. AutoDraw(m_Print, StrRect, str, 1.8);
  6303. }
  6304. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6305. dlg.m_pDC = m_Print.GetPDC();
  6306. dlg.m_mode = 1;
  6307. if (aa == 0)
  6308. {
  6309. if (dlg.DoModal() != IDOK)
  6310. return;
  6311. printcot = dlg.m_num;
  6312. }
  6313. //结束打印
  6314. m_Print.EndPage();
  6315. m_Print.EndPrint();
  6316. }
  6317. }
  6318. void CMainFrame::PrintDinDan4(CString m_id)
  6319. {
  6320. // TODO: Add your control notification handler code here
  6321. CPrintRX m_Print;
  6322. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6323. {
  6324. m_Print.InitToPrint(NULL, 1);
  6325. }
  6326. else
  6327. {
  6328. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  6329. if (name.IsEmpty())
  6330. m_Print.InitToPrint(NULL, 1);
  6331. else
  6332. {
  6333. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6334. if (nret == -1)
  6335. {
  6336. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6337. }
  6338. }
  6339. }
  6340. m_Print.StartPrint();
  6341. m_Print.StartPage();
  6342. LoadRect load;
  6343. load.SetLiaPath("6-2.lia");
  6344. load.SetMargins(0, 0);
  6345. if (!load.Load())return;
  6346. int i;
  6347. //////////////////////////////////////////////////////////////
  6348. CStringArray txarray;
  6349. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  6350. g_sendhead.code[0] = 11;
  6351. g_sendhead.code[1] = 52;
  6352. g_sendhead.code[2] = 50;
  6353. g_sendhead.code[3] = 150;
  6354. g_sendhead.code[4] = 77;
  6355. g_sendhead.code[5] = 4;
  6356. g_sendhead.tabcount = 6;
  6357. g_sendhead.bsql = 0;
  6358. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  6359. CArray<CStringArray, CStringArray>sparray;
  6360. CArray<CStringArray, CStringArray>clientarray;
  6361. CArray<CStringArray, CStringArray>phonearray;
  6362. CArray<CStringArray, CStringArray>fgarray;
  6363. CArray<CStringArray, CStringArray>danweiarray;
  6364. CArray<CStringArray, CStringArray>jdarray;
  6365. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  6366. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  6367. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  6368. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  6369. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  6370. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  6371. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  6372. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  6373. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  6374. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  6375. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  6376. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  6377. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  6378. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  6379. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  6380. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  6381. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  6382. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  6383. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  6384. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  6385. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  6386. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  6387. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  6388. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  6389. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  6390. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  6391. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  6392. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  6393. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  6394. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6395. if (jdarray.GetSize())
  6396. {
  6397. if (m_bz.IsEmpty() == 0)
  6398. m_bz = "\r\n" + m_bz;
  6399. m_bz += "景点:";
  6400. }
  6401. for (i = 0; i < jdarray.GetSize(); i++)
  6402. {
  6403. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  6404. }
  6405. m_bz.TrimRight(";");
  6406. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  6407. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  6408. if (IsHasRights2new(31) == 0)
  6409. {
  6410. m_phone1 = "***";
  6411. m_phone2 = "***";
  6412. }
  6413. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  6414. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  6415. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  6416. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  6417. CString str;
  6418. filter = "name='" + m_ren + "'";
  6419. g_sendhead.code[0] = 5;
  6420. g_sendhead.tabcount = 1;
  6421. g_sendhead.bsql = 0;
  6422. int g_nYearposTemp = g_nYearpos;
  6423. g_nYearpos = -1;
  6424. g_pMainWnd->ProcessChatMessageRequest2(filter);
  6425. g_nYearpos = g_nYearposTemp;
  6426. if (g_bSendOK == 0)return;
  6427. DataToArray(&phonearray);
  6428. m_money1.Format("%f", atof(m_taoxijiage));
  6429. m_money2.Format("%f", atof(m_payed1));
  6430. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  6431. ConvertToPrice(m_money1);
  6432. ConvertToPrice(m_money2);
  6433. ConvertToPrice(m_money3);
  6434. ////////////////////////////////////////////////////////////////
  6435. int rcpos = -1;
  6436. CRect StrRect = load.m_rcarray.ElementAt(0);
  6437. m_Print.SetFontFace(25, 1, "黑体");
  6438. m_Print.DrawText((LPTSTR)(LPCTSTR)"巴黎春天婚纱摄影预约单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6439. m_Print.SetFontFace(11, 1, "宋体");
  6440. StrRect = load.m_rcarray.ElementAt(1);
  6441. if (m_time1.GetLength() == 10)
  6442. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  6443. else
  6444. str = "开单日期:";
  6445. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6446. StrRect = load.m_rcarray.ElementAt(2);
  6447. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + m_id), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6448. CStringArray strarray;
  6449. strarray.Add("先生姓名");
  6450. strarray.Add("女士姓名");
  6451. strarray.Add("服装套数");
  6452. strarray.Add("拍摄张数");
  6453. strarray.Add("拍摄日期");
  6454. strarray.Add("联系电话");
  6455. strarray.Add("联系电话");
  6456. strarray.Add("造型套数");
  6457. strarray.Add("入册张数");
  6458. strarray.Add("选片日期");
  6459. strarray.Add("QQ/邮箱");
  6460. strarray.Add("套系总额");
  6461. strarray.Add("定金");
  6462. strarray.Add("余款金额");
  6463. strarray.Add("取件日期");
  6464. strarray.Add(m_name1);
  6465. strarray.Add(m_name2);
  6466. strarray.Add(m_clothescount);
  6467. str.Format("%d", atoi(m_zs) * 3);
  6468. strarray.Add(str);
  6469. strarray.Add(m_time2);
  6470. strarray.Add(m_phone1);
  6471. strarray.Add(m_phone2);
  6472. strarray.Add(m_clothescount2);
  6473. strarray.Add(m_zs);
  6474. strarray.Add(m_time4);
  6475. strarray.Add(m_qq1);
  6476. strarray.Add(m_money1);
  6477. strarray.Add(m_money2);
  6478. strarray.Add(m_money3);
  6479. strarray.Add(m_time5);
  6480. for (i = 4; i <= 33; i++)
  6481. {
  6482. StrRect = load.m_rcarray.ElementAt(i - 1);
  6483. m_Print.DrawRect2(StrRect, 1);
  6484. if (strarray.GetSize() > (i - 4))
  6485. {
  6486. if (i <= 18)
  6487. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6488. else
  6489. {
  6490. StrRect.left += 4;
  6491. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6492. }
  6493. }
  6494. }
  6495. int dt = 413;
  6496. StrRect = load.m_rcarray.ElementAt(36); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6497. m_Print.DrawText((LPTSTR)(LPCTSTR)"门市签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6498. StrRect = load.m_rcarray.ElementAt(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6499. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6500. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6501. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6502. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  6503. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址:深圳市红岭中路中深国际大厦首层,二十二层", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6504. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  6505. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:0755-61308198 61308199 25860696 25860697", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6506. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  6507. m_Print.DrawText((LPTSTR)(LPCTSTR)"网址:www.paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6508. StrRect = load.m_rcarray.ElementAt(43); StrRect.top += dt; StrRect.bottom += dt;
  6509. m_Print.DrawText((LPTSTR)(LPCTSTR)"邮箱:blct@paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6510. //////////////////////////////
  6511. //开始画文字
  6512. StrRect = load.m_rcarray.ElementAt(7);
  6513. int hei = StrRect.Height();
  6514. StrRect.top += hei;
  6515. StrRect.bottom += hei;
  6516. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6517. StrRect.top += dt;
  6518. StrRect.bottom += dt;
  6519. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6520. StrRect = load.m_rcarray.ElementAt(17);
  6521. StrRect.top += hei;
  6522. StrRect.bottom += hei;
  6523. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6524. StrRect = load.m_rcarray.ElementAt(33);
  6525. StrRect.bottom = StrRect.top + dt; m_Print.DrawRect2(StrRect, 1);
  6526. StrRect.top += hei;
  6527. StrRect.left += 3;
  6528. StrRect.top += 3;
  6529. StrRect.right -= 2;
  6530. StrRect.bottom -= 2;
  6531. str = "";
  6532. for (i = 0; i < sparray.GetSize(); i++)
  6533. {
  6534. str += sparray.ElementAt(i).ElementAt(5);
  6535. str += " 数量:";
  6536. str += sparray.ElementAt(i).ElementAt(3);
  6537. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6538. str += "\r\n";
  6539. }
  6540. str.TrimRight("\r\n");
  6541. AutoDraw(m_Print, StrRect, str, 1.4);
  6542. StrRect = load.m_rcarray.ElementAt(33);
  6543. StrRect.top += dt;
  6544. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6545. StrRect.top += hei;
  6546. StrRect.left += 3;
  6547. StrRect.top += 3;
  6548. StrRect.right -= 2;
  6549. StrRect.bottom -= 2;
  6550. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  6551. StrRect = load.m_rcarray.ElementAt(34);
  6552. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6553. StrRect.top += hei;
  6554. StrRect.left += 3;
  6555. StrRect.top += 3;
  6556. StrRect.right -= 2;
  6557. StrRect.bottom -= 2;
  6558. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6559. if (str.IsEmpty())
  6560. {
  6561. str = "\
  6562. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6563. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6564. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6565. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6566. 持良好的心境.\r\n\
  6567. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6568. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6569. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6570. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6571. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6572. 勿进影室, 以免影响拍摄.\r\n\
  6573. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6574. 师或店长沟通.\r\n\
  6575. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6576. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6577. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6578. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6579. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6580. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6581. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6582. 还.";
  6583. }
  6584. AutoDraw(m_Print, StrRect, str, 1.8);
  6585. StrRect = load.m_rcarray.ElementAt(35);
  6586. StrRect.bottom += 100;
  6587. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  6588. str = "第\r\n一\r\n联\r\n存\r\n根\r\n∧\r\n白\r\n∨\r\n第\r\n二\r\n联\r\n客\r\n户\r\n∧\r\n红\r\n∨\r\n第\r\n三\r\n联\r\n流\r\n程\r\n∧\r\n黄\r\n∨";
  6589. AutoDraw(m_Print, StrRect, str, 1.4);
  6590. PrintPreview dlg;
  6591. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6592. dlg.m_pDC = m_Print.GetPDC();
  6593. if (dlg.DoModal() != IDOK)return;
  6594. //结束打印
  6595. m_Print.EndPage();
  6596. m_Print.EndPrint();
  6597. }
  6598. int CalHeight_01(CRect &rc, CStringArray *saContent, CPrintRX *Print, int FORMAT)
  6599. {
  6600. CSize size;
  6601. int nMaxheight = 0;
  6602. CString strTemp;
  6603. CString strContent;
  6604. int nSize = saContent->GetSize();
  6605. int nRow = 0; // 行数;
  6606. for (int i = 0; i < nSize; i++)
  6607. {
  6608. strTemp = "";
  6609. strContent = saContent->ElementAt(i);
  6610. while (FALSE == strContent.IsEmpty())
  6611. {
  6612. strContent = strContent.Mid(strTemp.GetLength());
  6613. if (strContent.IsEmpty())
  6614. break;
  6615. Print->GetStrSize((LPTSTR)(LPCTSTR)strContent, size);
  6616. if (size.cx <= rc.Width())
  6617. {
  6618. CRect rc2 = rc;
  6619. rc2.top += nRow*(size.cy + 1);
  6620. rc2.bottom = rc2.top + (size.cy + 1);
  6621. Print->DrawText((LPTSTR)(LPCTSTR)strContent, rc2, 0, 0, FORMAT | FORMAT_UP);
  6622. nMaxheight = max(nMaxheight, rc2.bottom);
  6623. nRow++;
  6624. break;
  6625. }
  6626. int right = 0;
  6627. while (size.cx > rc.Width())
  6628. {
  6629. right++;
  6630. strTemp = strContent.Left(strContent.GetLength() - (right));
  6631. if (GIsHalfHZ(strTemp))
  6632. {
  6633. right++;
  6634. strTemp.Delete(strTemp.GetLength() - 1);
  6635. }
  6636. Print->GetStrSize((LPTSTR)(LPCTSTR)strTemp, size);
  6637. }
  6638. CRect rc2 = rc;
  6639. rc2.top += nRow*(size.cy + 1);
  6640. rc2.bottom = rc2.top + (size.cy + 1);
  6641. Print->DrawText((LPTSTR)(LPCTSTR)strTemp, rc2, 0, 0, FORMAT | FORMAT_UP); //printf("Jeff:str=%s\n\n",str);// Jeff Printf;
  6642. nRow++;
  6643. nMaxheight = max(nMaxheight, rc2.bottom);
  6644. }
  6645. }
  6646. return (nMaxheight == 0) ? (rc.bottom + 1) : (nMaxheight + 1);
  6647. }
  6648. /************************************************************************/
  6649. /*
  6650. 多字节字符编码下的CaleHeight函数;
  6651. 函数:CaleHeight
  6652. 描述:计算出一行高度可变,宽度特定的表格(CArray<CRect,CRect>),在输入指定内容时(CStringArray),表格高度变化最大的值。
  6653. 参数:
  6654. aRowRect: 一行表格,CArray::GetSize()表示表格列数;
  6655. aRowStr: 与表格对应的一行字符,CStringArray::GetSize()大小与CArray::GetSize()一致。
  6656. pPrinter: 打印机实例指针;
  6657. nFormat: 字符串的显示格式。
  6658. 返回:返回最大的表格高度;
  6659. 注意:只能多字节下使用,因为函数GIsHalfHZ。
  6660. */
  6661. /************************************************************************/
  6662. INT CalcHeight( IN CArray<CRect, CRect> &aRowRect, IN CStringArray &aRowStr, IN CPrintRX *pPrinter, IN CONST INT& nFormat)
  6663. {
  6664. // 参数有效性;
  6665. if( aRowRect.GetSize() != aRowStr.GetSize() )
  6666. {
  6667. OutputDebugString(_T("表格列数与字符列数不等!\n"));
  6668. return -1;
  6669. }
  6670. if( pPrinter == NULL )
  6671. {
  6672. OutputDebugString(_T("打印机句柄指针无效\n"));
  6673. return -1;
  6674. }
  6675. // 表格字串长度;
  6676. CSize size;
  6677. // 当前表格字体高度;
  6678. INT nGridFontHeight = 0;
  6679. // 当前表格区域;
  6680. CRect curGrid;
  6681. // 当前表格字符串;
  6682. CString strGridContent;
  6683. // 最大值高底;
  6684. INT nMaxHeigth = 0;
  6685. // 当前换行数;
  6686. INT nWrapRows = 0;
  6687. // 当前换行字串;
  6688. CString strWrapRow = _T("");
  6689. // 表格列数;
  6690. INT nColumns = aRowRect.GetSize();
  6691. // 临时表格;
  6692. CRect rcGrid;
  6693. // 循环计算每个表格的高度;
  6694. for( INT i = 0; i < nColumns; i++ )
  6695. {
  6696. nWrapRows = 0;
  6697. strWrapRow.Empty();
  6698. curGrid = aRowRect.ElementAt(i);
  6699. strGridContent = aRowStr.ElementAt(i);
  6700. nMaxHeigth = max(nMaxHeigth, curGrid.bottom);
  6701. while( !strGridContent.IsEmpty() )
  6702. {
  6703. strGridContent = strGridContent.Right(strGridContent.GetLength() - strWrapRow.GetLength());
  6704. if ( strGridContent.IsEmpty() )
  6705. {
  6706. OutputDebugString(_T("表格字符已空\n"));
  6707. break;
  6708. }
  6709. pPrinter->GetStrSize((LPTSTR)(LPCTSTR)strGridContent, size);
  6710. nGridFontHeight = size.cy + 1;
  6711. // 字串长度 <= 表格宽度;
  6712. if( size.cx <= curGrid.Width() )
  6713. {
  6714. rcGrid = curGrid;
  6715. rcGrid.top += nWrapRows*nGridFontHeight;
  6716. rcGrid.bottom = rcGrid.top + nGridFontHeight;
  6717. nMaxHeigth = max(nMaxHeigth, rcGrid.bottom);
  6718. pPrinter->DrawText((LPTSTR)(LPCTSTR)strGridContent, rcGrid, 0, 0, nFormat|FORMAT_UP);
  6719. break;
  6720. }
  6721. else
  6722. {// 字串长度 >= 表格宽度;
  6723. INT nRight = 0; // 字串右位置;
  6724. // 从右边开始逐个字符取出,直到左边字串小于表格宽度;
  6725. while( size.cx > curGrid.Width() )
  6726. {
  6727. nRight++;
  6728. strWrapRow = strGridContent.Left(strGridContent.GetLength() - nRight);
  6729. if( GIsHalfHZ(strWrapRow) )
  6730. {// 判断字串最后一个字符是否是汉字;
  6731. nRight++;
  6732. strWrapRow.Delete(strWrapRow.GetLength() - 1);
  6733. }
  6734. pPrinter->GetStrSize((LPTSTR)(LPCTSTR)strWrapRow, size);
  6735. }
  6736. rcGrid = curGrid;
  6737. rcGrid.top += nWrapRows*nGridFontHeight;
  6738. rcGrid.bottom = rcGrid.top + nGridFontHeight;
  6739. nMaxHeigth = max(nMaxHeigth, rcGrid.bottom);
  6740. pPrinter->DrawText((LPTSTR)(LPCTSTR)strWrapRow, rcGrid, 0, 0, nFormat|FORMAT_UP);
  6741. // 换行加+1;
  6742. nWrapRows++;
  6743. }
  6744. }
  6745. }
  6746. return nMaxHeigth + 1;
  6747. }
  6748. void CMainFrame::PrintReceipt(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  6749. {
  6750. //AfxMessageBox("abce");
  6751. int i = 0;
  6752. int printcot = 1;
  6753. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  6754. {
  6755. g_sendhead.bsql = 0;
  6756. g_sendhead.code[0] = 24;
  6757. g_sendhead.tabcount = 1;
  6758. int g_nYearposTemp = g_nYearpos;
  6759. g_nYearpos = -1;
  6760. g_pMainWnd->ProcessChatMessageRequest2(1);
  6761. g_nYearpos = g_nYearposTemp;
  6762. if (0 == g_bSendOK)return;
  6763. DataToArray(&g_cominfoarray);
  6764. CString SerialNo;
  6765. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6766. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  6767. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6768. CString sql;
  6769. sql.Format("update version set [serialno]='%s'", SerialNo);
  6770. g_sendhead.bsql=1;
  6771. g_nYearposTemp=g_nYearpos;
  6772. g_nYearpos=-1;
  6773. g_pMainWnd->ProcessChatMessageRequest2(sql);
  6774. g_nYearpos=g_nYearposTemp;
  6775. #endif
  6776. // 1.创建打印对象
  6777. CPrintRX m_Print;
  6778. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6779. {
  6780. m_Print.InitToPrint(NULL, 1);
  6781. }
  6782. else
  6783. {
  6784. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  6785. if (name.IsEmpty())
  6786. m_Print.InitToPrint(NULL, 1);
  6787. else
  6788. {
  6789. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6790. if (nret == -1 && aa == 0)
  6791. {
  6792. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6793. }
  6794. }
  6795. }
  6796. // 2.开始打印
  6797. m_Print.StartPrint();
  6798. m_Print.StartPage();
  6799. LoadRect load;
  6800. BOOL bSmall = 0;
  6801. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  6802. {
  6803. bSmall = 1;
  6804. load.SetLiaPath("20.lia");
  6805. }
  6806. else
  6807. load.SetLiaPath("10.lia");
  6808. if (bSmall)
  6809. load.SetMargins(0, 0);
  6810. else
  6811. load.SetMargins(10, 0);
  6812. if (!load.Load())return;
  6813. int rcpos = -1;
  6814. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6815. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  6816. {
  6817. Image *pImg = NULL;
  6818. g_nSendCode = 31;
  6819. int g_nYearposTemp = g_nYearpos;
  6820. g_nYearpos = -1;
  6821. g_pMainWnd->ProcessChatMessageRequest2(1);
  6822. g_nYearpos = g_nYearposTemp;
  6823. g_nSendCode = 0;
  6824. if (g_bSendOK == 0)return;
  6825. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  6826. if (pImg)
  6827. {
  6828. StrRect.left = 65;
  6829. if (bSmall) StrRect.left = 55;
  6830. StrRect.top = 10;
  6831. StrRect.right = StrRect.left + 58;
  6832. StrRect.bottom = StrRect.top + 58;
  6833. // 3.打印2维码图像;
  6834. m_Print.DrawImage(pImg, StrRect);
  6835. delete pImg;
  6836. pImg = NULL;
  6837. }
  6838. }
  6839. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  6840. if (bSmall)
  6841. {
  6842. m_Print.SetFontFace(18, 1, "黑体");
  6843. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6844. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6845. m_Print.SetFontFace(9, 1, "宋体");
  6846. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6847. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6848. m_Print.SetFontFace(6, 1, "宋体");
  6849. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6850. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6851. m_Print.SetFontFace(9, 1, "宋体");
  6852. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6853. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6854. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6855. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6856. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6857. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6858. int hei = StrRect.Height();
  6859. StrRect.bottom = StrRect.top;
  6860. StrRect.top -= 8;
  6861. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6862. m_Print.SetFontFace(11, 1, "宋体");
  6863. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6864. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6865. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6866. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6867. m_Print.SetFontFace(8, 1, "宋体");
  6868. for (i = 7; i < 24; i++)
  6869. {
  6870. StrRect = load.m_rcarray.ElementAt(i);
  6871. m_Print.DrawRect2(StrRect, 1);
  6872. }
  6873. for (i = 9; i < 24; i++)
  6874. {
  6875. StrRect = load.m_rcarray.ElementAt(i);
  6876. StrRect.left += 2;
  6877. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6878. }
  6879. m_Print.SetFontFace(6, 1, "宋体");
  6880. for (i = 24; i < 26; i++)
  6881. {
  6882. StrRect = load.m_rcarray.ElementAt(i);
  6883. StrRect.left += 2;
  6884. if (i == 24)
  6885. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6886. else
  6887. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6888. }
  6889. // StrRect=load.m_rcarray .ElementAt (27);
  6890. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  6891. }
  6892. else//大单
  6893. {
  6894. // 1.打印表头(蒙娜丽莎收款单)
  6895. m_Print.SetFontFace(20, 1, "黑体");
  6896. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6897. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6898. m_Print.SetFontFace(11, 1, "宋体");
  6899. // 2.打印订单号(NO.20140608-001)
  6900. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6901. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6902. // 3.打印SerialNo(SerialNo.01062)
  6903. int hei = StrRect.Height();
  6904. StrRect.bottom = StrRect.top;
  6905. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6906. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6907. // 4.打印影楼地址信息、电话;
  6908. m_Print.SetFontFace(8, 1, "宋体");
  6909. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6910. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6911. m_Print.SetFontFace(11, 1, "宋体");
  6912. // 5.打印客户姓名
  6913. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6914. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6915. // 6.打印客户联系电话
  6916. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6917. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6918. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6919. // 7.打印开单日期
  6920. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6921. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6922. // 8.打印列字段:收款项目
  6923. m_Print.SetFontFace(13, 1, "宋体");
  6924. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6925. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6926. //printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6927. // 9.打印列字段:金额
  6928. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6929. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6930. //printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6931. // 10.打印列字段:开单人
  6932. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6933. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6934. //printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6935. // 11.画表格-画3列;
  6936. m_Print.SetFontFace(11, 1, "宋体");
  6937. for (i = 7; i < 10; i++)
  6938. {
  6939. StrRect = load.m_rcarray.ElementAt(i);
  6940. m_Print.DrawRect2(StrRect, 1);
  6941. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6942. }
  6943. // 12.打印详细内容
  6944. int dty = 0;
  6945. int dtytemp = 0;
  6946. // for( i=10; i<14; i+=3)
  6947. for (i = 10; i<22; i += 3) // 循环4次,再画
  6948. {
  6949. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  6950. CArray<CRect, CRect>rcarray;
  6951. CStringArray strarray2;
  6952. StrRect = load.m_rcarray.ElementAt(i);
  6953. StrRect.top += dty;
  6954. StrRect.bottom += dty;
  6955. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  6956. {
  6957. StrRect = load.m_rcarray.ElementAt(i - 1);
  6958. StrRect.top += dty;
  6959. StrRect.bottom += dty;
  6960. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  6961. break;
  6962. }
  6963. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  6964. StrRect.left += 2;
  6965. StrRect.right -= 2;
  6966. StrRect.top += 4;
  6967. rcarray.Add(StrRect);
  6968. strarray2.Add(pArray->ElementAt(i));
  6969. // 指定格子宽度,计算字符串占几行(高度).
  6970. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  6971. dtytemp = bottom - StrRect.bottom;
  6972. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  6973. // 重新获取表格大小,并画出表格;
  6974. StrRect = load.m_rcarray.ElementAt(i);
  6975. StrRect.bottom += dtytemp;
  6976. StrRect.top += dty;
  6977. StrRect.bottom += dty;
  6978. m_Print.DrawRect2(StrRect, 1);
  6979. // 获取下一表格大小,并画出表格;
  6980. StrRect = load.m_rcarray.ElementAt(i + 1);
  6981. StrRect.top += dty;
  6982. StrRect.bottom += dty;
  6983. StrRect.bottom += dtytemp;
  6984. m_Print.DrawRect2(StrRect, 1);
  6985. StrRect.left += 2;
  6986. // 打印出金额字段内容
  6987. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6988. //printf("Jeff:%d:%s\n\n",i+1,pArray->ElementAt(i+1));//Jeff Printf;
  6989. StrRect = load.m_rcarray.ElementAt(i + 2);
  6990. StrRect.top += dty;
  6991. StrRect.bottom += dty;
  6992. StrRect.bottom += dtytemp;
  6993. m_Print.DrawRect2(StrRect, 1);
  6994. StrRect.left += 2;
  6995. // 打印开单人字段内容
  6996. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6997. //printf("Jeff:%d:%s\n\n",i+2,pArray->ElementAt(i+2));//Jeff Printf;
  6998. dty += dtytemp;
  6999. }
  7000. //.打印->付款情况 应付 实付 欠款.
  7001. i = 22;
  7002. StrRect = load.m_rcarray.ElementAt(i);
  7003. StrRect.top += dty;
  7004. StrRect.bottom += dty;
  7005. m_Print.DrawRect2(StrRect, 1);
  7006. StrRect.left += 2;
  7007. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7008. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7009. //.打印->合计人民币(大写):.......
  7010. i = 23;
  7011. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  7012. m_Print.DrawRect2(StrRect, 1);
  7013. StrRect.left += 2;
  7014. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7015. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7016. m_Print.SetFontFace(7, 1, "宋体");
  7017. for (i = 24; i < 27; i++)
  7018. {
  7019. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  7020. StrRect.left += 2;
  7021. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7022. }
  7023. StrRect = load.m_rcarray.ElementAt(24); StrRect.top += dty; StrRect.bottom += dty;
  7024. hei = StrRect.Height();
  7025. StrRect.top += hei;
  7026. StrRect.bottom += hei;
  7027. StrRect.right += 100;
  7028. StrRect.left += 2;
  7029. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  7030. AutoDraw(m_Print, StrRect, pArray->ElementAt(27), 1.0);
  7031. }
  7032. PrintPreview dlg;
  7033. dlg.m_mode = 3;
  7034. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  7035. dlg.m_pDC = m_Print.GetPDC();
  7036. if (aa == 0)
  7037. {
  7038. if (dlg.DoModal() != IDOK)
  7039. return;
  7040. printcot = dlg.m_num;
  7041. }
  7042. //结束打印
  7043. m_Print.EndPage();
  7044. m_Print.EndPrint();
  7045. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7046. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7047. CString sql;
  7048. sql.Format("update version set [serialno]='%s'", SerialNo);
  7049. g_sendhead.bsql = 1;
  7050. g_nYearposTemp = g_nYearpos;
  7051. g_nYearpos = -1;
  7052. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7053. g_nYearpos = g_nYearposTemp;
  7054. #endif
  7055. }
  7056. }
  7057. /************************************************************************/
  7058. /*
  7059. 函数:PrintRechargeRecord
  7060. 描述:打印会员卡充值记录;
  7061. 参数:
  7062. pArryRechargeRecod[IN]:要打印的数据;
  7063. 返回:
  7064. 注意:
  7065. 示例:
  7066. */
  7067. /************************************************************************/
  7068. void CMainFrame::PrintRechargeRecord(CStringArray *pArryRechargeRecod)
  7069. {
  7070. }
  7071. void CMainFrame::PrintReceipt_01(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  7072. {
  7073. //AfxMessageBox("abce");
  7074. int i = 0;
  7075. int printcot = 1;
  7076. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  7077. {
  7078. g_sendhead.bsql = 0;
  7079. g_sendhead.code[0] = 24;
  7080. g_sendhead.tabcount = 1;
  7081. int g_nYearposTemp = g_nYearpos;
  7082. g_nYearpos = -1;
  7083. g_pMainWnd->ProcessChatMessageRequest2(1);
  7084. g_nYearpos = g_nYearposTemp;
  7085. if (0 == g_bSendOK)return;
  7086. DataToArray(&g_cominfoarray);
  7087. CString SerialNo;
  7088. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7089. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7090. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7091. CString sql;
  7092. sql.Format("update version set [serialno]='%s'", SerialNo);
  7093. g_sendhead.bsql=1;
  7094. g_nYearposTemp=g_nYearpos;
  7095. g_nYearpos=-1;
  7096. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7097. g_nYearpos=g_nYearposTemp;
  7098. #endif
  7099. // 1.创建打印对象
  7100. CPrintRX m_Print;
  7101. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7102. {
  7103. m_Print.InitToPrint(NULL, 1);
  7104. }
  7105. else
  7106. {
  7107. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  7108. if (name.IsEmpty())
  7109. m_Print.InitToPrint(NULL, 1);
  7110. else
  7111. {
  7112. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  7113. if (nret == -1 && aa == 0)
  7114. {
  7115. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  7116. m_Print.InitToPrint(NULL, 1);
  7117. }
  7118. }
  7119. }
  7120. // 2.开始打印
  7121. m_Print.StartPrint();
  7122. m_Print.StartPage();
  7123. LoadRect load;
  7124. BOOL bSmall = 0;
  7125. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  7126. {
  7127. bSmall = 1;
  7128. load.SetLiaPath("20.lia");
  7129. }
  7130. else
  7131. load.SetLiaPath("10.lia");
  7132. if (bSmall)
  7133. load.SetMargins(0, 0);
  7134. else
  7135. load.SetMargins(10, 0);
  7136. if (!load.Load())return;
  7137. int rcpos = -1;
  7138. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7139. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  7140. {
  7141. Image *pImg = NULL;
  7142. g_nSendCode = 31;
  7143. int g_nYearposTemp = g_nYearpos;
  7144. g_nYearpos = -1;
  7145. g_pMainWnd->ProcessChatMessageRequest2(1);
  7146. g_nYearpos = g_nYearposTemp;
  7147. g_nSendCode = 0;
  7148. if (g_bSendOK == 0)return;
  7149. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7150. if (pImg)
  7151. {
  7152. StrRect.left = 65;
  7153. if (bSmall) StrRect.left = 55;
  7154. StrRect.top = 10;
  7155. StrRect.right = StrRect.left + 58;
  7156. StrRect.bottom = StrRect.top + 58;
  7157. // 3.打印2维码图像;
  7158. m_Print.DrawImage(pImg, StrRect);
  7159. delete pImg;
  7160. pImg = NULL;
  7161. }
  7162. }
  7163. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  7164. if (bSmall)
  7165. {
  7166. m_Print.SetFontFace(18, 1, "黑体");
  7167. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7168. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7169. m_Print.SetFontFace(9, 1, "宋体");
  7170. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7171. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7172. m_Print.SetFontFace(6, 1, "宋体");
  7173. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7174. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7175. m_Print.SetFontFace(9, 1, "宋体");
  7176. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7177. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7178. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7179. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7180. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7181. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7182. int hei = StrRect.Height();
  7183. StrRect.bottom = StrRect.top;
  7184. StrRect.top -= 8;
  7185. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7186. m_Print.SetFontFace(11, 1, "宋体");
  7187. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7188. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7189. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7190. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7191. m_Print.SetFontFace(8, 1, "宋体");
  7192. for ( i = 7; i < 24; i++)
  7193. {
  7194. StrRect = load.m_rcarray.ElementAt(i);
  7195. m_Print.DrawRect2(StrRect, 1);
  7196. }
  7197. for (i = 9; i < 24; i++)
  7198. {
  7199. StrRect = load.m_rcarray.ElementAt(i);
  7200. StrRect.left += 2;
  7201. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7202. }
  7203. m_Print.SetFontFace(6, 1, "宋体");
  7204. for (i = 24; i < 26; i++)
  7205. {
  7206. StrRect = load.m_rcarray.ElementAt(i);
  7207. StrRect.left += 2;
  7208. if (i == 24)
  7209. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7210. else
  7211. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7212. }
  7213. // StrRect=load.m_rcarray .ElementAt (27);
  7214. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  7215. }
  7216. else//大单
  7217. {
  7218. // 1.打印表头(蒙娜丽莎收款单)
  7219. m_Print.SetFontFace(20, 1, "黑体");
  7220. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7221. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7222. m_Print.SetFontFace(11, 1, "宋体");
  7223. // 2.打印订单号(NO.20140608-001)
  7224. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7225. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7226. // 3.打印SerialNo(SerialNo.01062)
  7227. int hei = StrRect.Height();
  7228. StrRect.bottom = StrRect.top;
  7229. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7230. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7231. // 4.打印影楼地址信息、电话;
  7232. m_Print.SetFontFace(8, 1, "宋体");
  7233. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7234. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7235. m_Print.SetFontFace(11, 1, "宋体");
  7236. // 5.打印客户姓名
  7237. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7238. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7239. // 6.打印客户联系电话
  7240. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7241. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7242. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7243. // 7.打印开单日期
  7244. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7245. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7246. #if 0 // Original Edition
  7247. // 8.打印列字段:收款项目
  7248. m_Print.SetFontFace(13, 1, "宋体");
  7249. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7250. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7251. printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7252. // 9.打印列字段:金额
  7253. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7254. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7255. printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7256. // 10.打印列字段:开单人
  7257. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7258. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7259. printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7260. #else
  7261. // 8.打印列字段:收款项目
  7262. m_Print.SetFontFace(13, 1, "宋体");
  7263. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7264. StrRect = CRect(66, 85, 280, 105);
  7265. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7266. //m_Print.DrawText("收款项目",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7267. // 8.1 Jeff add:支付方式
  7268. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7269. StrRect = CRect(280, 85, 350, 105);
  7270. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7271. //m_Print.DrawText("支付方式",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7272. // 9.打印列字段:金额
  7273. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7274. StrRect = CRect(350, 85, 442, 105);
  7275. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7276. //m_Print.DrawText("金额",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7277. // 10.打印列字段:开单人
  7278. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7279. StrRect = CRect(442, 85, 535, 105);
  7280. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7281. //m_Print.DrawText("开单人",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7282. //rcpos += 3;
  7283. #endif
  7284. // 11.画表格-画3列;old
  7285. // 11.draw 4 column
  7286. m_Print.SetFontFace(11, 1, "宋体");
  7287. //for( i=7; i<10; i++)
  7288. //{
  7289. // StrRect=load.m_rcarray.ElementAt(i);
  7290. // m_Print.DrawRect2(StrRect, 1);
  7291. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7292. //}
  7293. m_Print.DrawRect2(CRect(66, 85, 280, 105), 1);
  7294. m_Print.DrawRect2(CRect(280, 85, 350, 105), 1);
  7295. m_Print.DrawRect2(CRect(350, 85, 442, 105), 1);
  7296. m_Print.DrawRect2(CRect(442, 85, 535, 105), 1);
  7297. // 12.打印详细内容
  7298. int dty = 0;
  7299. int dtytemp = 0;
  7300. // for( i=10; i<14; i+=3)
  7301. //for( i=10; i<22; i+=3) // 循环4次,再画
  7302. int j = 0;
  7303. for (i = 10, j = 11; i<22; i += 3, j += 4) // 循环4次,再画
  7304. {
  7305. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  7306. CArray<CRect, CRect>rcarray;
  7307. CStringArray strarray2;
  7308. StrRect = load.m_rcarray.ElementAt(i);
  7309. StrRect.top += dty;
  7310. StrRect.bottom += dty;
  7311. StrRect.right -= 70; // Jeff add
  7312. //printf("Jeff:i=%d:left=%d,top=%d,right=%d,bottom=%d.\n\n",i,StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7313. /*
  7314. 4次的CRect
  7315. 66,105,350,125
  7316. 66,126,350,146
  7317. 66,147,350,167
  7318. 66,168,350,188
  7319. */
  7320. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  7321. {
  7322. StrRect = load.m_rcarray.ElementAt(i - 1);
  7323. StrRect.top += dty;
  7324. StrRect.bottom += dty;
  7325. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  7326. break;
  7327. }
  7328. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  7329. StrRect.left += 2;
  7330. StrRect.right -= 2;
  7331. StrRect.top += 4;
  7332. rcarray.Add(StrRect);
  7333. //strarray2.Add(pArray->ElementAt(i+1));
  7334. strarray2.Add(pArray->ElementAt(j));
  7335. //printf("Jeff:%d:%s\n\n",j,pArray->ElementAt(j));//Jeff Printf;
  7336. // 指定格子宽度,计算字符串占几行(高度).
  7337. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  7338. dtytemp = bottom - StrRect.bottom;
  7339. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7340. // 重新获取表格大小,并画出表格;
  7341. /*
  7342. CRect(66,85,280,105),
  7343. CRect(280,85,350,105)
  7344. CRect(350,85,442,105)
  7345. CRect(442,85,535,105)
  7346. CRect(66,105,350,125),
  7347. CRect(66,126,350,146)
  7348. CRect(66,147,350,167)
  7349. CRect(66,168,350,188)
  7350. */
  7351. // 画收款项目框及打印内容;
  7352. StrRect = load.m_rcarray.ElementAt(i);
  7353. //StrRect=CRect(66,85,280,105);
  7354. StrRect.bottom += dtytemp;
  7355. StrRect.top += dty;
  7356. StrRect.bottom += dty;
  7357. //StrRect.left -= 70; // Jeff add
  7358. StrRect.right -= 70; // Jeff add
  7359. //printf("Jeff:1.i=%d:left=%d,top=%d,right=%d,bottom=%d.\n\n",i,StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7360. m_Print.DrawRect2(StrRect, 1);
  7361. // 画支付方式框及打印内容;
  7362. StrRect = load.m_rcarray.ElementAt(i);
  7363. //StrRect=CRect(280,85,350,105);
  7364. StrRect.bottom += dtytemp;
  7365. StrRect.top += dty;
  7366. StrRect.bottom += dty;
  7367. StrRect.left += StrRect.Width() - 70;
  7368. //StrRect.right += 70; // Jeff add
  7369. //printf("Jeff:2.i=%d:left=%d,top=%d,right=%d,bottom=%d.\n\n",i,StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7370. m_Print.DrawRect2(StrRect, 1);
  7371. StrRect.left += 2;
  7372. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7373. //printf("Jeff:%d:%s\n\n",j+1,pArray->ElementAt(j+1));//Jeff Printf;
  7374. // 画金额框及打印内容;
  7375. StrRect = load.m_rcarray.ElementAt(i + 1);
  7376. //StrRect=CRect(350,85,442,105);
  7377. StrRect.top += dty;
  7378. StrRect.bottom += dty;
  7379. StrRect.bottom += dtytemp;
  7380. //StrRect.right -= 70; // Jeff add
  7381. //printf("Jeff:i=%d:left=%d,top=%d,right=%d,bottom=%d.\n\n",i,StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7382. m_Print.DrawRect2(StrRect, 1);
  7383. StrRect.left += 2;
  7384. // 打印出金额字段内容
  7385. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7386. //printf("Jeff:%d:%s\n\n",j+2,pArray->ElementAt(j+2));//Jeff Printf;
  7387. // 画开单人框及打印内容;
  7388. StrRect = load.m_rcarray.ElementAt(i + 2);
  7389. //StrRect=CRect(442,85,535,105);
  7390. StrRect.top += dty;
  7391. StrRect.bottom += dty;
  7392. StrRect.bottom += dtytemp;
  7393. //StrRect.right -= 70; // Jeff add
  7394. //printf("Jeff:i=%d:left=%d,top=%d,right=%d,bottom=%d.\n\n",i,StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7395. m_Print.DrawRect2(StrRect, 1);
  7396. StrRect.left += 2;
  7397. // 打印开单人字段内容
  7398. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 3), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7399. //printf("Jeff:%d:%s\n\n",j+3,pArray->ElementAt(j+3));//Jeff Printf;
  7400. dty += dtytemp;
  7401. }
  7402. //.打印->付款情况 应付 实付 欠款.
  7403. i = 22;
  7404. j = 27;
  7405. StrRect = load.m_rcarray.ElementAt(i);
  7406. StrRect.top += dty;
  7407. StrRect.bottom += dty;
  7408. m_Print.DrawRect2(StrRect, 1);
  7409. StrRect.left += 2;
  7410. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7411. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7412. //.打印->合计人民币(大写):.......
  7413. i = 23;
  7414. j = 28;
  7415. StrRect = load.m_rcarray.ElementAt(i);
  7416. StrRect.top += dty;
  7417. StrRect.bottom += dty;
  7418. m_Print.DrawRect2(StrRect, 1);
  7419. StrRect.left += 2;
  7420. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7421. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7422. // 打印总金额;
  7423. m_Print.SetFontFace(7, 1, "宋体");
  7424. for (i = 24, j = 29; i < 27; i++, j++)
  7425. {
  7426. StrRect = load.m_rcarray.ElementAt(i);
  7427. StrRect.top += dty;
  7428. StrRect.bottom += dty;
  7429. StrRect.left += 2;
  7430. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7431. }
  7432. StrRect = load.m_rcarray.ElementAt(24);
  7433. StrRect.top += dty;
  7434. StrRect.bottom += dty;
  7435. hei = StrRect.Height();
  7436. StrRect.top += hei;
  7437. StrRect.bottom += hei;
  7438. StrRect.right += 100;
  7439. StrRect.left += 2;
  7440. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  7441. AutoDraw(m_Print, StrRect, pArray->ElementAt(32), 1.0);
  7442. }
  7443. PrintPreview dlg;
  7444. dlg.m_mode = 3;
  7445. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  7446. dlg.m_pDC = m_Print.GetPDC();
  7447. if (aa == 0)
  7448. {
  7449. if (dlg.DoModal() != IDOK)
  7450. {
  7451. return;
  7452. }
  7453. printcot = dlg.m_num;
  7454. }
  7455. //结束打印
  7456. m_Print.EndPage();
  7457. m_Print.EndPrint();
  7458. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7459. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7460. CString sql;
  7461. sql.Format("update version set [serialno]='%s'", SerialNo);
  7462. g_sendhead.bsql = 1;
  7463. g_nYearposTemp = g_nYearpos;
  7464. g_nYearpos = -1;
  7465. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7466. g_nYearpos = g_nYearposTemp;
  7467. #endif
  7468. }
  7469. }
  7470. void CMainFrame::PrintReceipt_02(CStringArray *pArray, CPrintRX *pPrinter, const int &nCount, const BOOL bPrintImmediately) // 打印订单*预约收款、预约补款*
  7471. {
  7472. //AfxMessageBox("abce");
  7473. int printcot = 1;
  7474. // for(int aa=0; aa<printcot; aa++) // Jeff, printcot=1....
  7475. // {
  7476. g_sendhead.bsql = 0;
  7477. g_sendhead.code[0] = 24;
  7478. g_sendhead.tabcount = 1;
  7479. int g_nYearposTemp = g_nYearpos;
  7480. g_nYearpos = -1;
  7481. g_pMainWnd->ProcessChatMessageRequest2(1);
  7482. g_nYearpos = g_nYearposTemp;
  7483. if (0 == g_bSendOK)return;
  7484. DataToArray(&g_cominfoarray);
  7485. CString SerialNo;
  7486. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7487. CPrintRX *tagPrinter = NULL;
  7488. if (pPrinter == NULL)
  7489. {
  7490. // 1.创建打印对象
  7491. tagPrinter = new CPrintRX;
  7492. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7493. {
  7494. tagPrinter->InitToPrint(NULL, 1);
  7495. }
  7496. else
  7497. {
  7498. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  7499. if (name.IsEmpty())
  7500. {
  7501. tagPrinter->InitToPrint(NULL, 1);
  7502. }
  7503. else
  7504. {
  7505. int nret = tagPrinter->InitToPrint((char*)(LPCTSTR)name, 1);
  7506. ///if(nret==-1 && aa==0)
  7507. if (nret == -1)
  7508. {
  7509. if (bPrintImmediately == FALSE)
  7510. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  7511. tagPrinter->InitToPrint(NULL, 1);
  7512. }
  7513. }
  7514. }
  7515. // 2.开始打印
  7516. tagPrinter->StartPrint();
  7517. tagPrinter->StartPage();
  7518. }
  7519. else
  7520. {
  7521. //SerialNo.Format ("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126))+1);
  7522. tagPrinter = pPrinter;
  7523. }
  7524. LoadRect load;
  7525. BOOL bSmall = 0;
  7526. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  7527. {
  7528. bSmall = 1;
  7529. load.SetLiaPath("20.lia");
  7530. }
  7531. else
  7532. load.SetLiaPath("10.lia");
  7533. if (bSmall)
  7534. load.SetMargins(0, 0);
  7535. else
  7536. load.SetMargins(10, 0);
  7537. if (!load.Load())return;
  7538. int rcpos = -1;
  7539. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7540. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  7541. {
  7542. Image *pImg = NULL;
  7543. g_nSendCode = 31;
  7544. int g_nYearposTemp = g_nYearpos;
  7545. g_nYearpos = -1;
  7546. g_pMainWnd->ProcessChatMessageRequest2(1);
  7547. g_nYearpos = g_nYearposTemp;
  7548. g_nSendCode = 0;
  7549. if (g_bSendOK == 0)return;
  7550. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7551. if (pImg)
  7552. {
  7553. StrRect.left = 65;
  7554. if (bSmall) StrRect.left = 55;
  7555. StrRect.top = 10;
  7556. StrRect.right = StrRect.left + 58;
  7557. StrRect.bottom = StrRect.top + 58;
  7558. // 3.打印2维码图像;
  7559. tagPrinter->DrawImage(pImg, StrRect);
  7560. delete pImg;
  7561. pImg = NULL;
  7562. }
  7563. }
  7564. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  7565. if (bSmall)
  7566. {
  7567. tagPrinter->SetFontFace(18, 1, "黑体");
  7568. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7569. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7570. tagPrinter->SetFontFace(9, 1, "宋体");
  7571. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7572. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7573. tagPrinter->SetFontFace(6, 1, "宋体");
  7574. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7575. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7576. tagPrinter->SetFontFace(9, 1, "宋体");
  7577. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7578. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7579. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7580. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7581. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7582. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7583. int hei = StrRect.Height();
  7584. StrRect.bottom = StrRect.top;
  7585. StrRect.top -= 8;
  7586. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7587. tagPrinter->SetFontFace(11, 1, "宋体");
  7588. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7589. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7590. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7591. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7592. tagPrinter->SetFontFace(8, 1, "宋体");
  7593. int i = 0;
  7594. for (i = 7; i < 24; i++)
  7595. {
  7596. StrRect = load.m_rcarray.ElementAt(i);
  7597. tagPrinter->DrawRect2(StrRect, 1);
  7598. }
  7599. for (i = 9; i < 24; i++)
  7600. {
  7601. StrRect = load.m_rcarray.ElementAt(i);
  7602. StrRect.left += 2;
  7603. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7604. }
  7605. tagPrinter->SetFontFace(6, 1, "宋体");
  7606. for (i = 24; i < 26; i++)
  7607. {
  7608. StrRect = load.m_rcarray.ElementAt(i);
  7609. StrRect.left += 2;
  7610. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7611. }
  7612. StrRect = load.m_rcarray.ElementAt(22);
  7613. int nH = StrRect.Height();
  7614. int nW = StrRect.Width();
  7615. int nlen = load.m_rcarray.GetSize();
  7616. int nLeft = StrRect.left;
  7617. int j = 0;
  7618. for (i = 27; i<32; i++)
  7619. {
  7620. CRect rct = StrRect;
  7621. if(i == 31)
  7622. {
  7623. rct.top = rct.top + (nH*(j - 1));
  7624. rct.bottom = rct.top + nH;
  7625. rct.left = rct.left + 200;
  7626. rct.right = rct.left + 200;
  7627. }
  7628. else
  7629. {
  7630. rct.top = rct.top + (nH*j);
  7631. rct.bottom = rct.top + nH;
  7632. rct.left = rct.left + 2;
  7633. rct.right = rct.left + 200;
  7634. }
  7635. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), rct, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7636. j++;
  7637. }
  7638. }
  7639. else//大单
  7640. {
  7641. // 1.打印表头(蒙娜丽莎收款单)
  7642. tagPrinter->SetFontFace(20, 1, "黑体");
  7643. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7644. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7645. tagPrinter->SetFontFace(11, 1, "宋体");
  7646. // 2.打印订单号(NO.20140608-001)
  7647. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7648. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7649. // 3.打印SerialNo(SerialNo.01062)
  7650. int hei = StrRect.Height();
  7651. StrRect.bottom = StrRect.top;
  7652. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7653. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7654. // 4.打印影楼地址信息、电话;
  7655. tagPrinter->SetFontFace(8, 1, "宋体");
  7656. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7657. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7658. tagPrinter->SetFontFace(11, 1, "宋体");
  7659. // 5.打印客户姓名
  7660. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7661. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7662. // 6.打印客户联系电话
  7663. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7664. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7665. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7666. // 7.打印开单日期
  7667. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7668. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7669. #if 0 // Original Edition
  7670. // 8.打印列字段:收款项目
  7671. tagPrinter->SetFontFace(13, 1, "宋体");
  7672. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7673. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7674. printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7675. // 9.打印列字段:金额
  7676. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7677. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7678. printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7679. // 10.打印列字段:开单人
  7680. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7681. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7682. printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7683. #else
  7684. // 8.打印列字段:收款项目
  7685. tagPrinter->SetFontFace(13, 1, "宋体");
  7686. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7687. StrRect = CRect(66, 85, 280, 105);
  7688. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7689. //m_Print.DrawText("收款项目",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7690. // 8.1 Jeff add:支付方式
  7691. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7692. StrRect = CRect(280, 85, 350, 105);
  7693. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7694. //m_Print.DrawText("支付方式",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7695. // 9.打印列字段:金额
  7696. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7697. StrRect = CRect(350, 85, 442, 105);
  7698. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7699. //m_Print.DrawText("金额",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7700. // 10.打印列字段:开单人
  7701. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7702. StrRect = CRect(442, 85, 535, 105);
  7703. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7704. //m_Print.DrawText("开单人",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7705. //rcpos += 3;
  7706. #endif
  7707. // 11.画表格-画3列;old
  7708. // 11.draw 4 column
  7709. tagPrinter->SetFontFace(11, 1, "宋体");
  7710. int i;
  7711. //for( i=7; i<10; i++)
  7712. //{
  7713. // StrRect=load.m_rcarray.ElementAt(i);
  7714. // m_Print.DrawRect2(StrRect, 1);
  7715. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7716. //}
  7717. tagPrinter->DrawRect2(CRect(66, 85, 280, 105), 1);
  7718. tagPrinter->DrawRect2(CRect(280, 85, 350, 105), 1);
  7719. tagPrinter->DrawRect2(CRect(350, 85, 442, 105), 1);
  7720. tagPrinter->DrawRect2(CRect(442, 85, 535, 105), 1);
  7721. // 12.打印详细内容
  7722. int dty = 0;
  7723. int dtytemp = 0;
  7724. // for( i=10; i<14; i+=3)
  7725. //for( i=10; i<22; i+=3) // 循环4次,再画
  7726. int j = 0;
  7727. for (i = 10, j = 11; i<22; i += 3, j += 4) // 循环4次,再画
  7728. {
  7729. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  7730. CArray<CRect, CRect>rcarray;
  7731. CStringArray strarray2;
  7732. StrRect = load.m_rcarray.ElementAt(i);
  7733. StrRect.top += dty;
  7734. StrRect.bottom += dty;
  7735. StrRect.right -= 70; // Jeff add
  7736. //printf("Jeff:i=%d:left=%d,top=%d,right=%d,bottom=%d.\n\n",i,StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7737. /*
  7738. 4次的CRect
  7739. 66,105,350,125
  7740. 66,126,350,146
  7741. 66,147,350,167
  7742. 66,168,350,188
  7743. */
  7744. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  7745. {
  7746. StrRect = load.m_rcarray.ElementAt(i - 1);
  7747. StrRect.top += dty;
  7748. StrRect.bottom += dty;
  7749. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  7750. break;
  7751. }
  7752. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  7753. StrRect.left += 2;
  7754. StrRect.right -= 2;
  7755. StrRect.top += 4;
  7756. rcarray.Add(StrRect);
  7757. //strarray2.Add(pArray->ElementAt(i+1));
  7758. strarray2.Add(pArray->ElementAt(j));
  7759. //printf("Jeff:%d:%s\n\n",j,pArray->ElementAt(j));//Jeff Printf;
  7760. // 指定格子宽度,计算字符串占几行(高度).
  7761. INT bottom = CalcHeight(rcarray, strarray2, tagPrinter, FORMAT_LEFT);
  7762. dtytemp = bottom - StrRect.bottom;
  7763. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7764. // 重新获取表格大小,并画出表格;
  7765. /*
  7766. CRect(66,85,280,105),
  7767. CRect(280,85,350,105)
  7768. CRect(350,85,442,105)
  7769. CRect(442,85,535,105)
  7770. CRect(66,105,350,125),
  7771. CRect(66,126,350,146)
  7772. CRect(66,147,350,167)
  7773. CRect(66,168,350,188)
  7774. */
  7775. // 画收款项目框及打印内容;
  7776. StrRect = load.m_rcarray.ElementAt(i);
  7777. //StrRect=CRect(66,85,280,105);
  7778. StrRect.bottom += dtytemp;
  7779. StrRect.top += dty;
  7780. StrRect.bottom += dty;
  7781. //StrRect.left -= 70; // Jeff add
  7782. StrRect.right -= 70; // Jeff add
  7783. //printf("Jeff:1.i=%d:left=%d,top=%d,right=%d,bottom=%d.\n\n",i,StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7784. tagPrinter->DrawRect2(StrRect, 1);
  7785. // 画支付方式框及打印内容;
  7786. StrRect = load.m_rcarray.ElementAt(i);
  7787. //StrRect=CRect(280,85,350,105);
  7788. StrRect.bottom += dtytemp;
  7789. StrRect.top += dty;
  7790. StrRect.bottom += dty;
  7791. StrRect.left += StrRect.Width() - 70;
  7792. //StrRect.right += 70; // Jeff add
  7793. //printf("Jeff:2.i=%d:left=%d,top=%d,right=%d,bottom=%d.\n\n",i,StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7794. tagPrinter->DrawRect2(StrRect, 1);
  7795. StrRect.left += 2;
  7796. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7797. //printf("Jeff:%d:%s\n\n",j+1,pArray->ElementAt(j+1));//Jeff Printf;
  7798. // 画金额框及打印内容;
  7799. StrRect = load.m_rcarray.ElementAt(i + 1);
  7800. //StrRect=CRect(350,85,442,105);
  7801. StrRect.top += dty;
  7802. StrRect.bottom += dty;
  7803. StrRect.bottom += dtytemp;
  7804. //StrRect.right -= 70; // Jeff add
  7805. //printf("Jeff:i=%d:left=%d,top=%d,right=%d,bottom=%d.\n\n",i,StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7806. tagPrinter->DrawRect2(StrRect, 1);
  7807. StrRect.left += 2;
  7808. // 打印出金额字段内容
  7809. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7810. //printf("Jeff:%d:%s\n\n",j+2,pArray->ElementAt(j+2));//Jeff Printf;
  7811. // 画开单人框及打印内容;
  7812. StrRect = load.m_rcarray.ElementAt(i + 2);
  7813. //StrRect=CRect(442,85,535,105);
  7814. StrRect.top += dty;
  7815. StrRect.bottom += dty;
  7816. StrRect.bottom += dtytemp;
  7817. //StrRect.right -= 70; // Jeff add
  7818. //printf("Jeff:i=%d:left=%d,top=%d,right=%d,bottom=%d.\n\n",i,StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7819. tagPrinter->DrawRect2(StrRect, 1);
  7820. StrRect.left += 2;
  7821. // 打印开单人字段内容
  7822. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 3), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7823. //printf("Jeff:%d:%s\n\n",j+3,pArray->ElementAt(j+3));//Jeff Printf;
  7824. dty += dtytemp;
  7825. }
  7826. //.打印->付款情况 应付 实付 欠款.
  7827. i = 22;
  7828. j = 27;
  7829. StrRect = load.m_rcarray.ElementAt(i);
  7830. StrRect.top += dty;
  7831. StrRect.bottom += dty;
  7832. tagPrinter->DrawRect2(StrRect, 1);
  7833. StrRect.left += 2;
  7834. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7835. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7836. //.打印->合计人民币(大写):.......
  7837. i = 23;
  7838. j = 28;
  7839. StrRect = load.m_rcarray.ElementAt(i);
  7840. StrRect.top += dty;
  7841. StrRect.bottom += dty;
  7842. tagPrinter->DrawRect2(StrRect, 1);
  7843. StrRect.left += 2;
  7844. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7845. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7846. // 打印总金额;
  7847. tagPrinter->SetFontFace(7, 1, "宋体");
  7848. for (i = 24, j = 29; i < 27; i++, j++)
  7849. {
  7850. StrRect = load.m_rcarray.ElementAt(i);
  7851. StrRect.top += dty;
  7852. StrRect.bottom += dty;
  7853. StrRect.left += 2;
  7854. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7855. }
  7856. StrRect = load.m_rcarray.ElementAt(24);
  7857. StrRect.top += dty;
  7858. StrRect.bottom += dty;
  7859. hei = StrRect.Height();
  7860. StrRect.top += hei;
  7861. StrRect.bottom += hei;
  7862. StrRect.right += 100;
  7863. StrRect.left += 2;
  7864. StrRect = load.m_rcarray.ElementAt(27);
  7865. StrRect.top += dty;
  7866. StrRect.bottom += dty;
  7867. AutoDraw(*tagPrinter, StrRect, pArray->ElementAt(32), 1.0);
  7868. }
  7869. if (bPrintImmediately == TRUE)
  7870. {
  7871. printcot = nCount;
  7872. ////结束打印
  7873. tagPrinter->EndPage();
  7874. tagPrinter->EndPrint();
  7875. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7876. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7877. CString sql;
  7878. sql.Format("update version set [serialno]='%s'", SerialNo);
  7879. g_sendhead.bsql = 1;
  7880. g_nYearposTemp = g_nYearpos;
  7881. g_nYearpos = -1;
  7882. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7883. g_nYearpos = g_nYearposTemp;
  7884. #endif
  7885. }
  7886. else
  7887. {
  7888. PrintPreview dlg;
  7889. dlg.m_mode = 3;
  7890. tagPrinter->GetWidHei(dlg.m_w, dlg.m_h);
  7891. dlg.m_pDC = tagPrinter->GetPDC();
  7892. //if(aa==0)
  7893. //{
  7894. if (dlg.DoModal() != IDOK)
  7895. {
  7896. return;
  7897. }
  7898. else
  7899. {
  7900. printcot = dlg.m_num;
  7901. //m_Print.deletePrinter();
  7902. for (int i = 0; i < printcot; i++)
  7903. {
  7904. //tagPrinter->EndPage();
  7905. //tagPrinter->m_DC.AbortDoc(); // 结束清空由StartDoc写入的内容;2014-09-15;
  7906. //tagPrinter->m_DC.EndDoc();
  7907. //Sleep(10000);
  7908. //tagPrinter->StartPrint();
  7909. //tagPrinter->NewPage();
  7910. //PrintReceipt_02(pArray,/*tagPrinter*/NULL,printcot,TRUE);
  7911. PrintReceipt_02(pArray, tagPrinter, printcot, TRUE);
  7912. }
  7913. }
  7914. if (tagPrinter) delete tagPrinter;
  7915. //}
  7916. }
  7917. //}
  7918. }
  7919. void CMainFrame::PrintFlowChart(CString strOrderNumber) // 选片打单;
  7920. {
  7921. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(75)))
  7922. {
  7923. // Jeff 使用风格2打印;
  7924. //PrintFlowChart3_20151116(strOrderNumber);
  7925. PrintFlowChart3(strOrderNumber);
  7926. return;
  7927. }
  7928. #ifdef ZHIAI_VERSION
  7929. PrintFlowChart2(strOrderNumber);
  7930. return;
  7931. #endif
  7932. int i = 0;
  7933. int printcot = 1;
  7934. for (int aa = 0; aa < printcot; aa++)
  7935. {
  7936. CPrintRX m_Print;
  7937. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7938. {
  7939. m_Print.InitToPrint(NULL, 1);
  7940. }
  7941. else
  7942. {
  7943. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  7944. if (name.IsEmpty())
  7945. m_Print.InitToPrint(NULL, 1);
  7946. else
  7947. {
  7948. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  7949. if (nret == -1 && aa == 0)
  7950. {
  7951. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  7952. }
  7953. }
  7954. }
  7955. m_Print.StartPrint();
  7956. m_Print.StartPage();
  7957. // CRect StrRect(0,0,560,818);
  7958. LoadRect load;
  7959. load.SetLiaPath("4.lia");
  7960. load.SetMargins(-14, -14);
  7961. if (!load.Load())return;
  7962. LoadRect load2;
  7963. load2.SetMargins(-14, 472 + 27 - 14);
  7964. load2.SetLiaPath("5.lia");
  7965. if (!load2.Load())return;
  7966. //////////////////////////////////////////////////////////////
  7967. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2'";
  7968. g_sendhead.code[0] = 54;
  7969. g_sendhead.code[1] = 223;
  7970. g_sendhead.tabcount = 2;
  7971. g_sendhead.bsql = 0;
  7972. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  7973. CArray<CStringArray, CStringArray>sparray;
  7974. DataToArray(&g_List1array, &sparray);
  7975. CString spno;
  7976. for ( i = 0; i < sparray.GetSize(); i++)
  7977. {
  7978. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  7979. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  7980. if (sparray.ElementAt(i).ElementAt(5) == "入册" && sparray.ElementAt(i).ElementAt(5) == "入底" && sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  7981. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  7982. spno += sparray.ElementAt(i).ElementAt(5);
  7983. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  7984. spno += "; ";
  7985. else
  7986. {
  7987. spno += ":";
  7988. spno += sparray.ElementAt(i).ElementAt(6);
  7989. spno += "; ";
  7990. }
  7991. }
  7992. spno += " 加挑:";
  7993. for (i = 0; i < sparray.GetSize(); i++)
  7994. {
  7995. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  7996. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  7997. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  7998. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  7999. spno += sparray.ElementAt(i).ElementAt(5);
  8000. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  8001. spno += "; ";
  8002. else
  8003. {
  8004. spno += ":";
  8005. spno += sparray.ElementAt(i).ElementAt(6);
  8006. spno += "; ";
  8007. }
  8008. }
  8009. if (spno.Right(6) == " 加挑:")
  8010. {
  8011. spno = spno.Left(spno.GetLength() - 6);
  8012. }
  8013. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8014. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8015. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8016. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8017. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8018. if (m_urgent.IsEmpty())m_urgent = "否";
  8019. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8020. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8021. // CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  8022. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8023. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8024. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8025. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8026. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8027. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8028. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8029. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8030. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(17) + g_List1array.ElementAt(0).ElementAt(29);
  8031. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8032. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8033. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8034. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8035. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8036. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8037. CString m_sum3;
  8038. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8039. ::ConvertToPrice(m_sum3);
  8040. if (m_money3.IsEmpty())m_money3 = "0";
  8041. // m_money3=m_money3+"/"+m_sum3;
  8042. CString name;
  8043. if (!m_name1.IsEmpty())
  8044. name = m_name1 + ",";
  8045. name += m_name2;
  8046. name.TrimRight(",");
  8047. CString phone;
  8048. if (!m_phone1.IsEmpty())
  8049. phone = m_phone1 + ",";
  8050. phone += m_phone2; phone.TrimRight(",");
  8051. if (IsHasRights2new(31) == 0)
  8052. phone = "***";
  8053. CStringArray strarray;
  8054. strarray.Add(m_urgent);
  8055. strarray.Add(m_ren);
  8056. strarray.Add(m_waiter3);
  8057. strarray.Add(name);
  8058. strarray.Add(m_time2);
  8059. strarray.Add(m_time4);
  8060. strarray.Add(m_money3);
  8061. strarray.Add(m_sum3);
  8062. strarray.Add(m_takezs);
  8063. strarray.Add(m_taoxizs);
  8064. strarray.Add(m_choosezs);
  8065. strarray.Add(strOrderNumber);
  8066. strarray.Add(phone);
  8067. ////////////////////////////////////////////////////////////////
  8068. int rcpos = -1;
  8069. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8070. Image *pImg = NULL;
  8071. #ifdef MNLS_VERSION
  8072. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  8073. #else
  8074. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  8075. #endif
  8076. m_Print.DrawImage(pImg, StrRect);
  8077. delete pImg;
  8078. m_Print.SetFontFace(11, 1, "宋体");
  8079. StrRect = load2.m_rcarray.ElementAt(7);
  8080. StrRect.top = load2.m_rcarray.ElementAt(15).top - 15;
  8081. StrRect.bottom = load2.m_rcarray.ElementAt(15).bottom - 15;
  8082. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  8083. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8084. StrRect.top += 15;
  8085. StrRect.bottom += 15;
  8086. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  8087. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8088. m_Print.SetFontFace(15, 1, "宋体");
  8089. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8090. #ifdef MNLS_VERSION
  8091. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8092. #endif
  8093. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8094. #ifdef MNLS_VERSION
  8095. m_Print.DrawRect(StrRect);
  8096. #endif
  8097. m_Print.SetFontFace(7, 1, "黑体");
  8098. m_Print.SetColor(0xffffff);
  8099. #ifdef MNLS_VERSION
  8100. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8101. #endif
  8102. m_Print.SetColor(0);
  8103. m_Print.SetFontFace(25, 1, "黑体");
  8104. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8105. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8106. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  8107. {
  8108. Image *pImg = NULL;
  8109. g_nSendCode = 31;
  8110. int g_nYearposTemp = g_nYearpos;
  8111. g_nYearpos = -1;
  8112. g_pMainWnd->ProcessChatMessageRequest2(1);
  8113. g_nYearpos = g_nYearposTemp;
  8114. g_nSendCode = 0;
  8115. if (g_bSendOK == 0)return;
  8116. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8117. if (pImg)
  8118. {
  8119. StrRect.left = 450;
  8120. StrRect.top = 22;
  8121. StrRect.right = StrRect.left + 60;
  8122. StrRect.bottom = StrRect.top + 60;
  8123. m_Print.DrawImage(pImg, StrRect);
  8124. delete pImg; pImg = NULL;
  8125. }
  8126. }
  8127. #ifdef CHILD_VERSION
  8128. CString title[13] = { "是否加急:", "接单门市:", \
  8129. "选样人员:", "客人姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  8130. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:"
  8131. };
  8132. #else
  8133. CString title[13] = { "是否加急:", "接单门市:", \
  8134. "选样人员:", "新郎新娘姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  8135. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:" };
  8136. #endif
  8137. m_Print.SetFontFace(12, 1, "宋体");
  8138. for (i = 0; i < 13; i++)
  8139. {
  8140. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8141. if (i < 3)
  8142. m_Print.DrawRect2(StrRect, 0);
  8143. else
  8144. m_Print.DrawRect2(StrRect, 1);
  8145. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8146. }
  8147. for (i = 18; i <= 37; i++)
  8148. {
  8149. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8150. if (i >= 19 && i <= 21)
  8151. m_Print.DrawRect2(StrRect, 2);
  8152. /* else if(i==26)
  8153. {
  8154. CRect rc=StrRect;
  8155. CRect rc2=rc;
  8156. rc.right -=rc2.Width ()/2;
  8157. m_Print.DrawRect2(rc, 1);
  8158. rc2.left +=rc.Width ();
  8159. m_Print.DrawRect2(rc2, 1);
  8160. }*/
  8161. else
  8162. m_Print.DrawRect2(StrRect, 1);
  8163. if (i == 18)
  8164. {
  8165. StrRect.left += 5;
  8166. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8167. }
  8168. }
  8169. //////////////////////////////////////
  8170. rcpos = -1;
  8171. for (i = 0; i < 8; i++)
  8172. {
  8173. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8174. m_Print.DrawRect2(StrRect, 1);
  8175. }
  8176. #ifdef CHILD_VERSION
  8177. CString title2[4] = { "引导师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  8178. #else
  8179. CString title2[4] = { "化妆师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  8180. #endif
  8181. for (i = 0; i < 4; i++)
  8182. {
  8183. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8184. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8185. }
  8186. for (i = 0; i < 4; i++)
  8187. {
  8188. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8189. m_Print.DrawRect2(StrRect, 2);
  8190. }
  8191. StrRect = load2.m_rcarray.ElementAt(11);
  8192. StrRect.top -= 15;
  8193. StrRect.bottom -= 15;
  8194. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客选片签名:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8195. StrRect = load2.m_rcarray.ElementAt(15);
  8196. StrRect.top -= 15;
  8197. StrRect.bottom -= 15;
  8198. m_Print.DrawRect2(StrRect, 2);
  8199. ///////////////////////////////////////////
  8200. for (i = 19; i <= 31; i++)
  8201. {
  8202. StrRect = load.m_rcarray.ElementAt(i - 1);
  8203. StrRect.left += 4;
  8204. if (i == 31)
  8205. {
  8206. if (m_phone1.IsEmpty() == 0 && m_phone2.IsEmpty() == 0)
  8207. {
  8208. StrRect.top += 2;
  8209. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  8210. StrRect.top += 8;
  8211. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8212. }
  8213. else
  8214. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8215. }
  8216. /* else if((i-19)==7)
  8217. {
  8218. CRect rc=StrRect;
  8219. CRect rc2=rc;
  8220. rc.right -=rc2.Width ()/2;
  8221. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8222. rc2.left +=rc.Width ()+3;
  8223. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8224. }*/
  8225. else
  8226. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8227. }
  8228. strarray.RemoveAll();
  8229. strarray.Add(m_waiter2);
  8230. strarray.Add(m_waiter1);
  8231. strarray.Add(m_waiter4);
  8232. for (i = 13; i <= 15; i++)
  8233. {
  8234. StrRect = load2.m_rcarray.ElementAt(i - 1);
  8235. StrRect.left += 4;
  8236. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8237. }
  8238. ///////////spno
  8239. CRect sprc[14];
  8240. for (i = 0; i < 14; i++)
  8241. {
  8242. if (i < 7)
  8243. {
  8244. if (i == 0)
  8245. {
  8246. StrRect = load.m_rcarray.ElementAt(17); StrRect.left += 94; StrRect.right -= 3;
  8247. }
  8248. else
  8249. {
  8250. StrRect = load.m_rcarray.ElementAt(30 + i); StrRect.left += 4; StrRect.right -= 3;
  8251. }
  8252. }
  8253. else
  8254. {
  8255. StrRect = load2.m_rcarray.ElementAt(i - 7); StrRect.left += 4; StrRect.right -= 3;
  8256. }
  8257. sprc[i] = StrRect;
  8258. }
  8259. CString temp, tempspno, tempbz;
  8260. CSize size;
  8261. BOOL bRun = 0;
  8262. int fontsize = 12;
  8263. ll: tempspno = spno;
  8264. tempbz = m_bz;
  8265. m_Print.SetFontFace(fontsize, 1, "宋体");
  8266. for (i = 0; i<14; i++)
  8267. {
  8268. if (!tempspno.IsEmpty())
  8269. {
  8270. temp = tempspno;
  8271. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8272. int right = 0;
  8273. CRect temprc = sprc[i];
  8274. while (size.cx>temprc.Width())
  8275. {
  8276. right++;
  8277. temp = tempspno.Left(tempspno.GetLength() - (right));
  8278. if (GIsHalfHZ(temp))
  8279. {
  8280. right++;
  8281. temp.Delete(temp.GetLength() - 1);
  8282. }
  8283. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8284. }
  8285. if (bRun)
  8286. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8287. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  8288. if (tempspno.IsEmpty())i++;
  8289. }
  8290. else if (!tempbz.IsEmpty())
  8291. {
  8292. temp = tempbz;
  8293. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8294. int right = 0;
  8295. CRect temprc = sprc[i];
  8296. while (size.cx > temprc.Width())
  8297. {
  8298. right++;
  8299. temp = tempbz.Left(tempbz.GetLength() - (right));
  8300. if (GIsHalfHZ(temp))
  8301. {
  8302. right++;
  8303. temp.Delete(temp.GetLength() - 1);
  8304. }
  8305. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8306. }
  8307. if (bRun)
  8308. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8309. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  8310. }
  8311. }
  8312. if (tempspno.IsEmpty() == 0 || tempbz.IsEmpty() == 0)
  8313. {
  8314. fontsize--;
  8315. goto ll;
  8316. }
  8317. if (bRun == 0)
  8318. {
  8319. bRun = 1;
  8320. goto ll;
  8321. }
  8322. PrintPreview dlg;
  8323. dlg.m_mode = 2;
  8324. dlg.m_name = name;
  8325. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8326. dlg.m_pDC = m_Print.GetPDC();
  8327. if (aa == 0)
  8328. {
  8329. if (dlg.DoModal() != IDOK)
  8330. return;
  8331. printcot = dlg.m_num;
  8332. }
  8333. //结束打印
  8334. m_Print.EndPage();
  8335. m_Print.EndPrint();
  8336. }
  8337. }
  8338. void CMainFrame::PrintFlowChart3LKAY(CString strOrderNumber)
  8339. {
  8340. int i = 0;
  8341. int printcot = 1;
  8342. for (int aa = 0; aa < printcot; aa++)
  8343. {
  8344. CPrintRX m_Print;
  8345. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  8346. {
  8347. m_Print.InitToPrint(NULL, 1);
  8348. }
  8349. else
  8350. {
  8351. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  8352. if (name.IsEmpty())
  8353. m_Print.InitToPrint(NULL, 1);
  8354. else
  8355. {
  8356. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8357. if (nret == -1 && aa == 0)
  8358. {
  8359. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8360. }
  8361. }
  8362. }
  8363. m_Print.StartPrint();
  8364. m_Print.StartPage();
  8365. LoadRect load;
  8366. load.SetLiaPath("18.lia");
  8367. load.SetMargins(10, 0);
  8368. if (!load.Load())return;
  8369. CString str;
  8370. int rcpos = -1;
  8371. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8372. m_Print.SetFontFace(25, 1, "宋体");
  8373. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8374. m_Print.SetFontFace(15, 1, "宋体");
  8375. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8376. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8377. m_Print.SetFontFace(9, 1, "宋体");
  8378. //////////////////////////////////////////////////////////////
  8379. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8380. g_sendhead.code[0] = 54;
  8381. g_sendhead.code[1] = 223;
  8382. g_sendhead.code[2] = 52;
  8383. g_sendhead.tabcount = 3;
  8384. g_sendhead.bsql = 0;
  8385. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  8386. CArray<CStringArray, CStringArray>sparray;
  8387. CArray<CStringArray, CStringArray>clientarray;
  8388. DataToArray(&g_List1array, &sparray, &clientarray);
  8389. CString spno;
  8390. CStringArray sparray2;
  8391. for ( i = 0; i < sparray.GetSize(); i++)
  8392. {
  8393. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8394. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8395. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8396. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8397. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8398. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8399. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8400. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8401. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8402. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8403. }
  8404. for (i = 0; i < sparray.GetSize(); i++)
  8405. {
  8406. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8407. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8408. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8409. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8410. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8411. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8412. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8413. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8414. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8415. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8416. }
  8417. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8418. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8419. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8420. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8421. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8422. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8423. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8424. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8425. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8426. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8427. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8428. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8429. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8430. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8431. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8432. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8433. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8434. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8435. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8436. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8437. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8438. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8439. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8440. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8441. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8442. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8443. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8444. CString m_sum3;
  8445. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8446. ::ConvertToPrice(m_sum3);
  8447. if (m_money3.IsEmpty())m_money3 = "0";
  8448. int dty = 0;
  8449. CString name;
  8450. if (!m_name1.IsEmpty())
  8451. name = m_name1 + ",";
  8452. name += m_name2;
  8453. name.TrimRight(",");
  8454. CString phone;
  8455. if (!m_phone1.IsEmpty())
  8456. phone = m_phone1 + ",";
  8457. phone += m_phone2; phone.TrimRight(",");
  8458. if (IsHasRights2new(31) == 0)
  8459. phone = "***";
  8460. CStringArray strarray;
  8461. #ifdef CHILD_VERSION
  8462. if (m_birthday.IsEmpty())
  8463. strarray.Add("姓名/性别");
  8464. else
  8465. strarray.Add("姓名/性别/年龄");
  8466. #else
  8467. strarray.Add("客人姓名");
  8468. #endif
  8469. strarray.Add("电话");
  8470. strarray.Add("单号");
  8471. strarray.Add("套系");
  8472. strarray.Add("选样");
  8473. strarray.Add("余款/加挑");
  8474. strarray.Add("选片/日期");
  8475. #ifdef CHILD_VERSION
  8476. if (m_birthday.IsEmpty())
  8477. strarray.Add(name + "/" + m_sex);
  8478. else
  8479. {
  8480. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8481. m_birthday.Format("%d", year + 1);
  8482. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8483. }
  8484. #else
  8485. strarray.Add(name);
  8486. #endif
  8487. strarray.Add(phone);
  8488. strarray.Add(strOrderNumber);
  8489. strarray.Add(m_taoxiname);
  8490. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8491. strarray.Add(str);
  8492. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8493. strarray.Add(str);
  8494. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8495. for (i = 3; i <= 16; i++)
  8496. {
  8497. StrRect = load.m_rcarray.ElementAt(i - 1);
  8498. if (i < 10)
  8499. {
  8500. m_Print.DrawRect2(StrRect, 1);
  8501. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8502. }
  8503. }
  8504. StrRect = load.m_rcarray.ElementAt(29);
  8505. m_Print.DrawRect2(StrRect, 1);
  8506. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8507. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  8508. {
  8509. Image *pImg = NULL;
  8510. g_nSendCode = 31;
  8511. int g_nYearposTemp = g_nYearpos;
  8512. g_nYearpos = -1;
  8513. g_pMainWnd->ProcessChatMessageRequest2(1);
  8514. g_nYearpos = g_nYearposTemp;
  8515. g_nSendCode = 0;
  8516. if (g_bSendOK == 0)return;
  8517. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8518. if (pImg)
  8519. {
  8520. StrRect.left = 485;
  8521. StrRect.top = 12;
  8522. StrRect.right = StrRect.left + 60;
  8523. StrRect.bottom = StrRect.top + 60;
  8524. m_Print.DrawImage(pImg, StrRect);
  8525. delete pImg; pImg = NULL;
  8526. }
  8527. }
  8528. CArray<CRect, CRect>rcarray;
  8529. CStringArray strarray2;
  8530. for (i = 10; i <= 16; i++)
  8531. {
  8532. StrRect = load.m_rcarray.ElementAt(i - 1);
  8533. StrRect.left += 2;
  8534. StrRect.right -= 2;
  8535. StrRect.top += 2;
  8536. rcarray.Add(StrRect);
  8537. strarray2.Add(strarray.ElementAt(7 + i - 10));
  8538. }
  8539. if (1)
  8540. {
  8541. StrRect = load.m_rcarray.ElementAt(30);
  8542. StrRect.left += 2;
  8543. StrRect.right -= 2;
  8544. StrRect.top += 2;
  8545. rcarray.Add(StrRect);
  8546. strarray2.Add(m_time6 + "/" + m_time5);
  8547. }
  8548. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8549. for (i = 10; i <= 16; i++)
  8550. {
  8551. StrRect = load.m_rcarray.ElementAt(i - 1);
  8552. if (i == 10)
  8553. {
  8554. dty += bottom - StrRect.bottom;
  8555. }
  8556. StrRect.bottom = bottom;
  8557. m_Print.DrawRect2(StrRect, 1);
  8558. }
  8559. if (1)
  8560. {
  8561. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  8562. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  8563. // m_Print.DrawText((LPTSTR)(LPCTSTR)(m_time6+"/"+m_time5), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER );
  8564. }
  8565. m_Print.SetFontFace(15, 1, "宋体");
  8566. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  8567. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8568. m_Print.SetFontFace(9, 1, "宋体");
  8569. strarray.RemoveAll();
  8570. strarray.Add("产品名称");
  8571. strarray.Add("数量");
  8572. strarray.Add("P数");
  8573. strarray.Add("张数");
  8574. strarray.Add("照片编号");
  8575. CArray<CRect, CRect>rc2array;
  8576. int wid = 25;
  8577. for (i = 18; i <= 22; i++)
  8578. {
  8579. StrRect = load.m_rcarray.ElementAt(i - 1);
  8580. if (i == 19)
  8581. {
  8582. StrRect.right = StrRect.left + wid;
  8583. }
  8584. if (i == 20)
  8585. {
  8586. StrRect = load.m_rcarray.ElementAt(i - 2);
  8587. StrRect.left += wid; StrRect.right = StrRect.left;
  8588. StrRect.right += wid;
  8589. }
  8590. if (i == 21)
  8591. {
  8592. StrRect = load.m_rcarray.ElementAt(i - 3);
  8593. StrRect.left += wid * 2; StrRect.right = StrRect.left;
  8594. StrRect.right += wid;
  8595. wid = StrRect.right;
  8596. }
  8597. if (i == 22)
  8598. {
  8599. StrRect = load.m_rcarray.ElementAt(i - 3);
  8600. StrRect.left = wid;
  8601. }
  8602. StrRect.top += dty; StrRect.bottom += dty;
  8603. m_Print.DrawRect2(StrRect, 1);
  8604. StrRect.left += 2;
  8605. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8606. StrRect.left -= 2;
  8607. StrRect.top = StrRect.bottom;
  8608. StrRect.bottom += 18;
  8609. rc2array.Add(StrRect);
  8610. }
  8611. int curypos = 0;
  8612. for (i = 0; i < sparray2.GetSize(); i += 5)
  8613. {
  8614. rcarray.RemoveAll();
  8615. strarray2.RemoveAll();
  8616. int j = 0;
  8617. for ( j = 0; j < 5; j++)
  8618. {
  8619. StrRect = rc2array.ElementAt(j);
  8620. StrRect.left += 2;
  8621. StrRect.right -= 2;
  8622. StrRect.top += 2;
  8623. rcarray.Add(StrRect);
  8624. strarray2.Add(sparray2.ElementAt(i + j));
  8625. }
  8626. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8627. rcarray.RemoveAll();
  8628. for (j = 0; j < 5; j++)
  8629. {
  8630. StrRect = rc2array.ElementAt(j);
  8631. if (j == 0)
  8632. {
  8633. dty += bottom - StrRect.bottom;
  8634. }
  8635. StrRect.bottom = bottom;
  8636. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8637. StrRect.top = StrRect.bottom;
  8638. StrRect.bottom += 18;
  8639. rcarray.Add(StrRect);
  8640. }
  8641. rc2array.RemoveAll();
  8642. rc2array.Copy(rcarray);
  8643. }
  8644. m_Print.SetFontFace(15, 1, "宋体");
  8645. StrRect = load.m_rcarray.ElementAt(20);
  8646. dty = curypos - StrRect.bottom + 35;
  8647. StrRect.top += dty; StrRect.bottom += dty;
  8648. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8649. m_Print.SetFontFace(9, 1, "宋体");
  8650. rcarray.RemoveAll();
  8651. strarray2.RemoveAll();
  8652. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8653. StrRect.left += 2;
  8654. StrRect.right -= 2;
  8655. StrRect.top += 2;
  8656. rcarray.Add(StrRect);
  8657. strarray2.Add(m_bz);
  8658. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8659. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8660. dty += bottom - StrRect.bottom;
  8661. StrRect.bottom = bottom;
  8662. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8663. m_Print.SetFontFace(10, 1, "宋体");
  8664. StrRect = load.m_rcarray.ElementAt(22);
  8665. dty = curypos - StrRect.bottom + 25;
  8666. StrRect.top += dty; StrRect.bottom += dty;
  8667. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  8668. if (m_edit9.IsEmpty())
  8669. {
  8670. m_edit9 = "\
  8671. 经确认后的照片均排入制作流程,\r\n\
  8672. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  8673. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  8674. }
  8675. CString info1, info2, info3;
  8676. int newlinepos = m_edit9.Find("\r\n");
  8677. if (newlinepos != -1)
  8678. {
  8679. info1 = m_edit9.Left(newlinepos);
  8680. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8681. }
  8682. newlinepos = m_edit9.Find("\r\n");
  8683. if (newlinepos != -1)
  8684. {
  8685. info2 = m_edit9.Left(newlinepos);
  8686. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8687. info3 = m_edit9;
  8688. }
  8689. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8690. StrRect = load.m_rcarray.ElementAt(23);
  8691. StrRect.top += dty; StrRect.bottom += dty;
  8692. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8693. StrRect = load.m_rcarray.ElementAt(24);
  8694. StrRect.top += dty; StrRect.bottom += dty;
  8695. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8696. StrRect.top += 15;
  8697. StrRect.bottom += 15;
  8698. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8699. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  8700. StrRect = load.m_rcarray.ElementAt(25);
  8701. StrRect.top += dty - dy;
  8702. StrRect.bottom += dty - dy;
  8703. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8704. StrRect = load.m_rcarray.ElementAt(26);
  8705. StrRect.top += dty - dy;
  8706. StrRect.bottom += dty - dy;
  8707. m_Print.DrawRect2(StrRect, 2);
  8708. StrRect = load.m_rcarray.ElementAt(25);
  8709. StrRect.top += dty + 15 - dy;
  8710. StrRect.bottom += dty + 15 - dy;
  8711. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8712. StrRect = load.m_rcarray.ElementAt(26);
  8713. StrRect.top += dty + 15 - dy;
  8714. StrRect.bottom += dty + 15 - dy;
  8715. m_Print.DrawRect2(StrRect, 2);
  8716. StrRect = load.m_rcarray.ElementAt(25);
  8717. StrRect.top += dty + 15 * 2 - dy;
  8718. StrRect.bottom += dty + 15 * 2 - dy;
  8719. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8720. StrRect = load.m_rcarray.ElementAt(26);
  8721. StrRect.top += dty + 15 * 2 - dy;
  8722. StrRect.bottom += dty + 15 * 2 - dy;
  8723. m_Print.DrawRect2(StrRect, 2);
  8724. PrintPreview dlg; dlg.m_mode = 2;
  8725. dlg.m_name = name;
  8726. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8727. dlg.m_pDC = m_Print.GetPDC();
  8728. if (aa == 0)
  8729. {
  8730. if (dlg.DoModal() != IDOK)
  8731. return;
  8732. printcot = dlg.m_num;
  8733. }
  8734. //结束打印
  8735. m_Print.EndPage();
  8736. m_Print.EndPrint();
  8737. }
  8738. }
  8739. void CMainFrame::PrintFlowChart3(CString strOrderNumber) // 选片打单 风格2;
  8740. {
  8741. #ifdef LKAY_VERSION
  8742. PrintFlowChart3LKAY(strOrderNumber);
  8743. return;
  8744. #endif
  8745. int i = 0;
  8746. int j = 0;
  8747. int printcot = 1;
  8748. for (int aa = 0; aa < printcot; aa++)
  8749. {
  8750. BOOL bSecondPage = 0;
  8751. int nPrintedPos = 0;
  8752. for (int bb = 0; bb < 2; bb++)
  8753. {
  8754. if (bb && bSecondPage == 0)break;
  8755. CPrintRX m_Print;
  8756. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58))) // 58-[version].[setcheck1] ==1,使用默认打印机;
  8757. {
  8758. m_Print.InitToPrint(NULL, 1);
  8759. }
  8760. else // 否则使用指定的打印机;
  8761. {
  8762. CString name = g_cominfoarray.ElementAt(0).ElementAt(64); // 64-[version].[printer2] 制作单打印机;
  8763. if (name.IsEmpty())
  8764. m_Print.InitToPrint(NULL, 1);
  8765. else
  8766. {
  8767. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8768. if (nret == -1 && aa == 0)
  8769. {
  8770. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8771. }
  8772. }
  8773. }
  8774. m_Print.StartPrint();
  8775. m_Print.StartPage();
  8776. LoadRect load;
  8777. load.SetLiaPath("18.lia");
  8778. load.SetMargins(10, 0);
  8779. if (!load.Load())return;
  8780. CString str;
  8781. int rcpos = -1;
  8782. // ■■■■■■从18.lia获取到第一个区域大小 - 1.显示店名;
  8783. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8784. if ((bb == 0 && bSecondPage == 0))
  8785. {
  8786. m_Print.SetFontFace(25, 1, "宋体");
  8787. // 10-[version].[info1] 店名;
  8788. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8789. m_Print.SetFontFace(15, 1, "宋体");
  8790. // ■■■■■■从18.lia获取第二个区域大小 - 2.显示"基本资料";
  8791. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8792. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8793. m_Print.SetFontFace(9, 1, "宋体");
  8794. }
  8795. //////////////////////////////////////////////////////////////
  8796. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8797. g_sendhead.code[0] = 54; // dindan;
  8798. g_sendhead.code[1] = 223; // dindanspview2; shangpin+dindansp;
  8799. g_sendhead.code[2] = 52; // client;
  8800. g_sendhead.tabcount = 3;
  8801. g_sendhead.bsql = 0;
  8802. g_pMainWnd->ProcessChatMessageRequest2(filter);
  8803. if (g_bSendOK == 0)return;
  8804. CArray<CStringArray, CStringArray>sparray;
  8805. CArray<CStringArray, CStringArray>clientarray;
  8806. DataToArray(&g_List1array, &sparray, &clientarray);
  8807. CString spno;
  8808. CStringArray sparray2;
  8809. for ( i = 0; i < sparray.GetSize(); i++)
  8810. {
  8811. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8812. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8813. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8814. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8815. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8816. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8817. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8818. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8819. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8820. }
  8821. for (i = 0; i < sparray.GetSize(); i++)
  8822. {
  8823. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8824. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8825. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8826. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8827. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8828. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8829. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8830. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8831. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8832. }
  8833. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8834. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8835. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8836. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8837. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8838. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8839. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8840. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8841. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8842. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8843. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8844. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8845. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8846. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8847. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8848. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8849. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8850. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8851. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  8852. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8853. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8854. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8855. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8856. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8857. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8858. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8859. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8860. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8861. CString m_sum3;
  8862. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8863. ::ConvertToPrice(m_sum3);
  8864. if (m_money3.IsEmpty())m_money3 = "0";
  8865. int dty = 0;
  8866. CString name;
  8867. if (!m_name1.IsEmpty())
  8868. name = m_name1 + ",";
  8869. name += m_name2;
  8870. name.TrimRight(",");
  8871. CString phone;
  8872. if (!m_phone1.IsEmpty())
  8873. phone = m_phone1 + ",";
  8874. phone += m_phone2; phone.TrimRight(",");
  8875. if (IsHasRights2new(31) == 0)
  8876. phone = "***";
  8877. CStringArray strarray;
  8878. CArray<CRect, CRect>rcarray;
  8879. CStringArray strarray2; CArray<CRect, CRect>rc2array;
  8880. int bottom;
  8881. if ((bb == 0 && bSecondPage == 0))
  8882. {
  8883. #ifdef CHILD_VERSION
  8884. if (m_birthday.IsEmpty())
  8885. strarray.Add("姓名/性别");
  8886. else
  8887. strarray.Add("姓名/性别/年龄");
  8888. #else
  8889. strarray.Add("客人姓名"); // 第3.1区域 -3.显示客人姓名;
  8890. #endif
  8891. strarray.Add("电话");
  8892. strarray.Add("单号");
  8893. strarray.Add("套系");
  8894. strarray.Add("选样");
  8895. strarray.Add("余款/加挑");
  8896. strarray.Add("选片/日期");
  8897. #ifdef CHILD_VERSION
  8898. if (m_birthday.IsEmpty())
  8899. strarray.Add(name + "/" + m_sex);
  8900. else
  8901. {
  8902. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8903. m_birthday.Format("%d", year + 1);
  8904. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8905. }
  8906. #else
  8907. strarray.Add(name); // 第4.1区域 -3.显示客人姓名;
  8908. #endif
  8909. strarray.Add(phone);
  8910. strarray.Add(strOrderNumber);
  8911. strarray.Add(m_taoxiname);
  8912. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8913. strarray.Add(str);
  8914. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8915. strarray.Add(str);
  8916. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8917. for (i = 3; i <= 16; i++)
  8918. {
  8919. // ■■■■■■从18.lia中获取第3~16的区域大小;
  8920. StrRect = load.m_rcarray.ElementAt(i - 1);
  8921. if (i < 10)
  8922. {
  8923. m_Print.DrawRect2(StrRect, 1);
  8924. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8925. }
  8926. }
  8927. // ■■■■■■从18.lia中获取第30的区域大小;
  8928. StrRect = load.m_rcarray.ElementAt(29);
  8929. m_Print.DrawRect2(StrRect, 1);
  8930. BOOL bPrintDate = 1;
  8931. #ifdef DDF_VERSION
  8932. // bPrintDate=0;
  8933. #else
  8934. if (m_time5 == "" && m_time6 == "")
  8935. bPrintDate = 0;
  8936. #endif
  8937. if (bPrintDate)
  8938. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8939. else
  8940. {
  8941. #ifdef CHILD_VERSION
  8942. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/引导", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8943. #else
  8944. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/化妆", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8945. #endif
  8946. }
  8947. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138))) // [version].[reverse3]
  8948. {
  8949. Image *pImg = NULL;
  8950. g_nSendCode = 31;
  8951. int g_nYearposTemp = g_nYearpos;
  8952. g_nYearpos = -1;
  8953. g_pMainWnd->ProcessChatMessageRequest2(1);
  8954. g_nYearpos = g_nYearposTemp;
  8955. g_nSendCode = 0;
  8956. if (g_bSendOK == 0)return;
  8957. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8958. // Jeff二维码的区域不是从18.lia里获取的,是固定在右上角指定区域;
  8959. if (pImg)
  8960. {
  8961. StrRect.left = 485;
  8962. StrRect.top = 12;
  8963. StrRect.right = StrRect.left + 60;
  8964. StrRect.bottom = StrRect.top + 60;
  8965. m_Print.DrawImage(pImg, StrRect);
  8966. delete pImg; pImg = NULL;
  8967. }
  8968. }
  8969. // CArray<CRect,CRect>rcarray;
  8970. // CStringArray strarray2;
  8971. // ■■■■■■从18.lia中获取第10的区域大小;
  8972. for (i = 10; i <= 16; i++)
  8973. {
  8974. StrRect = load.m_rcarray.ElementAt(i - 1);
  8975. StrRect.left += 2;
  8976. StrRect.right -= 2;
  8977. StrRect.top += 2;
  8978. rcarray.Add(StrRect);
  8979. strarray2.Add(strarray.ElementAt(7 + i - 10));
  8980. }
  8981. if (1)
  8982. {
  8983. // ■■■■■■从18.lia中获取第31的区域大小;
  8984. StrRect = load.m_rcarray.ElementAt(30);
  8985. StrRect.left += 2;
  8986. StrRect.right -= 2;
  8987. StrRect.top += 2;
  8988. rcarray.Add(StrRect);
  8989. if (bPrintDate)
  8990. strarray2.Add(m_time6 + "/" + m_time5);
  8991. else
  8992. {
  8993. strarray2.Add(m_waiter1 + "/" + m_waiter2);
  8994. }
  8995. }
  8996. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  8997. for (i = 10; i <= 16; i++)
  8998. {
  8999. StrRect = load.m_rcarray.ElementAt(i - 1);
  9000. if (i == 10)
  9001. {
  9002. dty += bottom - StrRect.bottom;
  9003. }
  9004. StrRect.bottom = bottom;
  9005. m_Print.DrawRect2(StrRect, 1);
  9006. }
  9007. if (1)
  9008. {
  9009. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  9010. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  9011. }
  9012. m_Print.SetFontFace(15, 1, "宋体");
  9013. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  9014. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9015. }
  9016. int curypos = 0;
  9017. int oldpos = 0;
  9018. if (bb == 1)
  9019. {
  9020. dty = -100;
  9021. oldpos = nPrintedPos;
  9022. if (oldpos == 0)oldpos = 10000;
  9023. }
  9024. m_Print.SetFontFace(9, 1, "宋体");
  9025. strarray.RemoveAll();
  9026. if ((oldpos != 10000 && oldpos < sparray2.GetSize()) || bb == 0)
  9027. {
  9028. strarray.Add("产品名称");
  9029. strarray.Add("数量");
  9030. strarray.Add("照片编号");
  9031. for (i = 18; i <= 20; i++)
  9032. {
  9033. StrRect = load.m_rcarray.ElementAt(i - 1);
  9034. StrRect.top += dty;
  9035. StrRect.bottom += dty;
  9036. m_Print.DrawRect2(StrRect, 1);
  9037. StrRect.left += 2;
  9038. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9039. StrRect.left -= 2;
  9040. StrRect.top = StrRect.bottom;
  9041. StrRect.bottom += 18;
  9042. rc2array.Add(StrRect);
  9043. }
  9044. }
  9045. for (i = oldpos; i < sparray2.GetSize(); i += 3)
  9046. {
  9047. rcarray.RemoveAll();
  9048. strarray2.RemoveAll();
  9049. for ( j = 0; j < 3; j++)
  9050. {
  9051. StrRect = rc2array.ElementAt(j);
  9052. StrRect.left += 2;
  9053. StrRect.right -= 2;
  9054. StrRect.top += 2;
  9055. rcarray.Add(StrRect);
  9056. #if JEFF_TEST_ON
  9057. if (2 == j)
  9058. {
  9059. CString strImg = sparray2.ElementAt(i + 2);
  9060. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  9061. if (nImgCount != 0)
  9062. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  9063. else if (!strImg.IsEmpty())
  9064. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  9065. strarray2.Add(strImg);
  9066. }
  9067. else
  9068. strarray2.Add(sparray2.ElementAt(i + j));
  9069. #else
  9070. strarray2.Add(sparray2.ElementAt(i + j));
  9071. #endif
  9072. }
  9073. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9074. rcarray.RemoveAll();
  9075. for (j = 0; j < 3; j++)
  9076. {
  9077. StrRect = rc2array.ElementAt(j);
  9078. if (j == 0)
  9079. {
  9080. dty += bottom - StrRect.bottom;
  9081. }
  9082. StrRect.bottom = bottom;
  9083. m_Print.DrawRect2(StrRect, 1);
  9084. curypos = StrRect.bottom;
  9085. StrRect.top = StrRect.bottom;
  9086. StrRect.bottom += 18;
  9087. rcarray.Add(StrRect);
  9088. }
  9089. rc2array.RemoveAll();
  9090. rc2array.Copy(rcarray);
  9091. if (bottom > 750)
  9092. {
  9093. bSecondPage = 1;
  9094. nPrintedPos = i + 3;
  9095. break;
  9096. }
  9097. }
  9098. if ((bb == 0 && bSecondPage == 0) || (bb == 1 && bSecondPage == 1))
  9099. {
  9100. m_Print.SetFontFace(15, 1, "宋体");
  9101. StrRect = load.m_rcarray.ElementAt(20);
  9102. dty = curypos - StrRect.bottom + 35;
  9103. StrRect.top += dty;
  9104. StrRect.bottom += dty;
  9105. if (StrRect.bottom > 700 && bb == 0)
  9106. {
  9107. bSecondPage = 1;
  9108. }
  9109. else
  9110. {
  9111. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9112. m_Print.SetFontFace(9, 1, "宋体");
  9113. rcarray.RemoveAll();
  9114. strarray2.RemoveAll();
  9115. StrRect = load.m_rcarray.ElementAt(21);
  9116. StrRect.top += dty;
  9117. StrRect.bottom += dty;
  9118. StrRect.left += 2;
  9119. StrRect.right -= 2;
  9120. StrRect.top += 2;
  9121. rcarray.Add(StrRect);
  9122. #if JEFF_TEST_ON
  9123. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9124. strarray2.RemoveAll();
  9125. CString strFind = "要求:";
  9126. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  9127. do
  9128. {
  9129. int nIndex = strbz3.Find(strFind, 1);
  9130. if (nIndex != -1)
  9131. {
  9132. CString strbz = strbz3.Left(nIndex);
  9133. strbz3 = strbz3.Mid(nIndex);
  9134. strarray2.Add(strbz);
  9135. }
  9136. else
  9137. {
  9138. strarray2.Add(strbz3);
  9139. strbz3 = "";
  9140. }
  9141. } while (strbz3.Find(strFind) != -1);
  9142. strarray2.Add(g_List1array.ElementAt(0).ElementAt(29));
  9143. strarray2.Add(g_List1array.ElementAt(0).ElementAt(23));
  9144. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  9145. #else
  9146. strarray2.Add(m_bz);
  9147. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9148. #endif
  9149. StrRect = load.m_rcarray.ElementAt(21);
  9150. StrRect.top += dty;
  9151. StrRect.bottom += dty;
  9152. dty += bottom - StrRect.bottom;
  9153. StrRect.bottom = bottom;
  9154. m_Print.DrawRect2(StrRect, 1);
  9155. curypos = StrRect.bottom;
  9156. m_Print.SetFontFace(10, 1, "宋体");
  9157. StrRect = load.m_rcarray.ElementAt(22);
  9158. dty = curypos - StrRect.bottom + 25;
  9159. StrRect.top += dty;
  9160. StrRect.bottom += dty;
  9161. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  9162. if (m_edit9.IsEmpty())
  9163. {
  9164. m_edit9 = "\
  9165. 经确认后的照片均排入制作流程,\r\n\
  9166. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9167. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9168. }
  9169. CString info1, info2, info3;
  9170. int newlinepos = m_edit9.Find("\r\n");
  9171. if (newlinepos != -1)
  9172. {
  9173. info1 = m_edit9.Left(newlinepos);
  9174. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9175. }
  9176. newlinepos = m_edit9.Find("\r\n");
  9177. if (newlinepos != -1)
  9178. {
  9179. info2 = m_edit9.Left(newlinepos);
  9180. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9181. info3 = m_edit9;
  9182. }
  9183. #ifdef QCH_VERSION
  9184. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9185. StrRect = load.m_rcarray.ElementAt(23);
  9186. StrRect.top += dty; StrRect.bottom += dty;
  9187. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9188. StrRect=load.m_rcarray .ElementAt (24);
  9189. StrRect.top +=dty;StrRect.bottom +=dty;
  9190. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9191. StrRect.top +=15;
  9192. StrRect.bottom +=15;
  9193. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9194. #else
  9195. if (1)
  9196. {
  9197. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9198. StrRect = load.m_rcarray.ElementAt(23);
  9199. StrRect.top += dty; StrRect.bottom += dty;
  9200. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9201. StrRect = load.m_rcarray.ElementAt(24);
  9202. StrRect.top += dty; StrRect.bottom += dty;
  9203. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9204. }
  9205. else
  9206. {
  9207. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9208. StrRect = load.m_rcarray.ElementAt(23);
  9209. StrRect.top += dty; StrRect.bottom += dty;
  9210. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9211. StrRect = load.m_rcarray.ElementAt(24);
  9212. StrRect.top += dty; StrRect.bottom += dty;
  9213. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9214. }
  9215. StrRect.top += 15;
  9216. StrRect.bottom += 15;
  9217. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9218. #endif
  9219. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  9220. StrRect = load.m_rcarray.ElementAt(25);
  9221. StrRect.top += dty - dy;
  9222. StrRect.bottom += dty - dy;
  9223. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9224. StrRect = load.m_rcarray.ElementAt(26);
  9225. StrRect.top += dty - dy;
  9226. StrRect.bottom += dty - dy;
  9227. m_Print.DrawRect2(StrRect, 2);
  9228. StrRect = load.m_rcarray.ElementAt(25);
  9229. StrRect.top += dty + 15 - dy;
  9230. StrRect.bottom += dty + 15 - dy;
  9231. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9232. StrRect = load.m_rcarray.ElementAt(26);
  9233. StrRect.top += dty + 15 - dy;
  9234. StrRect.bottom += dty + 15 - dy;
  9235. m_Print.DrawRect2(StrRect, 2);
  9236. StrRect = load.m_rcarray.ElementAt(25);
  9237. StrRect.top += dty + 15 * 2 - dy;
  9238. StrRect.bottom += dty + 15 * 2 - dy;
  9239. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9240. StrRect = load.m_rcarray.ElementAt(26);
  9241. StrRect.top += dty + 15 * 2 - dy;
  9242. StrRect.bottom += dty + 15 * 2 - dy;
  9243. m_Print.DrawRect2(StrRect, 2);
  9244. }
  9245. }
  9246. PrintPreview dlg; dlg.m_mode = 2;
  9247. dlg.m_name = name;
  9248. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  9249. dlg.m_pDC = m_Print.GetPDC();
  9250. if (aa == 0)
  9251. {
  9252. if (dlg.DoModal() != IDOK)
  9253. return;
  9254. printcot = dlg.m_num;
  9255. }
  9256. //结束打印
  9257. m_Print.EndPage();
  9258. m_Print.EndPrint();
  9259. }
  9260. }
  9261. }
  9262. void CMainFrame::PrintFlowChart3_20151116(CString strOrderNumber) // 选片打单 风格2;
  9263. {
  9264. #ifdef LKAY_VERSION
  9265. PrintFlowChart3LKAY(strOrderNumber);
  9266. return;
  9267. #endif
  9268. int i = 0;
  9269. int j = 0;
  9270. int printcot = 1;
  9271. for (int aa = 0; aa < printcot; aa++)
  9272. {
  9273. BOOL bSecondPage = 0;
  9274. int nPrintedPos = 0;
  9275. for (int bb = 0; bb < 3; bb++)
  9276. {
  9277. if (bb && bSecondPage == 0)break;
  9278. CPrintRX m_Print;
  9279. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58))) // 58-[version].[setcheck1] ==1,使用默认打印机;
  9280. {
  9281. m_Print.InitToPrint(NULL, 1);
  9282. }
  9283. else // 否则使用指定的打印机;
  9284. {
  9285. CString name = g_cominfoarray.ElementAt(0).ElementAt(64); // 64-[version].[printer2] 制作单打印机;
  9286. if (name.IsEmpty())
  9287. m_Print.InitToPrint(NULL, 1);
  9288. else
  9289. {
  9290. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9291. if (nret == -1 && aa == 0)
  9292. {
  9293. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9294. }
  9295. }
  9296. }
  9297. m_Print.StartPrint();
  9298. m_Print.StartPage();
  9299. LoadRect load;
  9300. load.SetLiaPath("18.lia");
  9301. load.SetMargins(10, 0);
  9302. if (!load.Load())return;
  9303. CString str;
  9304. int rcpos = -1;
  9305. // ■■■■■■从18.lia获取到第一个区域大小 - 1.显示店名;
  9306. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  9307. if ((bb == 0 && bSecondPage == 0))
  9308. {
  9309. m_Print.SetFontFace(25, 1, "宋体");
  9310. // 10-[version].[info1] 店名;
  9311. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9312. m_Print.SetFontFace(15, 1, "宋体");
  9313. // ■■■■■■从18.lia获取第二个区域大小 - 2.显示"基本资料";
  9314. StrRect = load.m_rcarray.ElementAt(++rcpos);
  9315. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9316. m_Print.SetFontFace(9, 1, "宋体");
  9317. }
  9318. //////////////////////////////////////////////////////////////////////////
  9319. // 获取打印所需要的数据,并布局好;
  9320. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  9321. g_sendhead.code[0] = 54; // dindan;
  9322. g_sendhead.code[1] = 223; // dindanspview2; shangpin+dindansp;
  9323. g_sendhead.code[2] = 52; // client;
  9324. g_sendhead.tabcount = 3;
  9325. g_sendhead.bsql = 0;
  9326. g_pMainWnd->ProcessChatMessageRequest2(filter);
  9327. if (g_bSendOK == 0)return;
  9328. CArray<CStringArray, CStringArray>sparray;
  9329. CArray<CStringArray, CStringArray>clientarray;
  9330. DataToArray(&g_List1array, &sparray, &clientarray);
  9331. CString spno;
  9332. CStringArray sparray2;
  9333. for ( i = 0; i < sparray.GetSize(); i++)
  9334. {
  9335. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  9336. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  9337. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  9338. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9339. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  9340. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9341. sparray2.Add(sparray.ElementAt(i).ElementAt(5)); // 商品名称;
  9342. sparray2.Add(sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  9343. sparray2.Add(sparray.ElementAt(i).ElementAt(6)); // 选中的相片串;
  9344. sparray2.Add(sparray.ElementAt(i).ElementAt(10)); // 商品备注;
  9345. }
  9346. for (i = 0; i < sparray.GetSize(); i++)
  9347. {
  9348. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  9349. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  9350. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  9351. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9352. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  9353. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9354. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+"); // 商品名称;
  9355. sparray2.Add(sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  9356. sparray2.Add(sparray.ElementAt(i).ElementAt(6)); // 选中的相片串;
  9357. sparray2.Add(sparray.ElementAt(i).ElementAt(10)); // 商品备注;
  9358. }
  9359. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  9360. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  9361. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  9362. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  9363. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  9364. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  9365. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  9366. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  9367. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  9368. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  9369. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  9370. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  9371. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  9372. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  9373. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  9374. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  9375. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  9376. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  9377. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9378. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  9379. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  9380. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  9381. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  9382. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  9383. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  9384. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  9385. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  9386. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  9387. CString m_sum3;
  9388. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  9389. ::ConvertToPrice(m_sum3);
  9390. if (m_money3.IsEmpty())m_money3 = "0";
  9391. int dty = 0;
  9392. CString name;
  9393. if (!m_name1.IsEmpty())
  9394. name = m_name1 + ",";
  9395. name += m_name2;
  9396. name.TrimRight(",");
  9397. CString phone;
  9398. if (!m_phone1.IsEmpty())
  9399. phone = m_phone1 + ",";
  9400. phone += m_phone2; phone.TrimRight(",");
  9401. if (IsHasRights2new(31) == 0)
  9402. phone = "***";
  9403. CStringArray strarray;
  9404. CArray<CRect, CRect>rcarray;
  9405. CStringArray strarray2; CArray<CRect, CRect>rc2array;
  9406. int bottom;
  9407. //////////////////////////////////////////////////////////////////////////
  9408. // 开始画打印DC;
  9409. if ((bb == 0 && bSecondPage == 0))
  9410. {
  9411. #ifdef CHILD_VERSION
  9412. if (m_birthday.IsEmpty())
  9413. strarray.Add("姓名/性别");
  9414. else
  9415. strarray.Add("姓名/性别/年龄");
  9416. #else
  9417. strarray.Add("客人姓名"); // 第3.1区域 -3.显示客人姓名;
  9418. #endif
  9419. strarray.Add("电话");
  9420. strarray.Add("单号");
  9421. strarray.Add("套系");
  9422. strarray.Add("选样");
  9423. strarray.Add("余款/加挑");
  9424. strarray.Add("选片/日期");
  9425. #ifdef CHILD_VERSION
  9426. if (m_birthday.IsEmpty())
  9427. strarray.Add(name + "/" + m_sex);
  9428. else
  9429. {
  9430. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  9431. m_birthday.Format("%d", year + 1);
  9432. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  9433. }
  9434. #else
  9435. strarray.Add(name); // 第4.1区域 -3.显示客人姓名;
  9436. #endif
  9437. strarray.Add(phone);
  9438. strarray.Add(strOrderNumber);
  9439. strarray.Add(m_taoxiname);
  9440. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9441. strarray.Add(str);
  9442. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  9443. strarray.Add(str);
  9444. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  9445. for (i = 3; i <= 16; i++)
  9446. {
  9447. // ■■■■■■从18.lia中获取第3~16的区域大小;
  9448. StrRect = load.m_rcarray.ElementAt(i - 1);
  9449. if (i < 10)
  9450. {
  9451. m_Print.DrawRect2(StrRect, 1);
  9452. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9453. }
  9454. }
  9455. // ■■■■■■从18.lia中获取第30的区域大小;
  9456. StrRect = load.m_rcarray.ElementAt(29);
  9457. m_Print.DrawRect2(StrRect, 1);
  9458. BOOL bPrintDate = 1;
  9459. #ifdef DDF_VERSION
  9460. // bPrintDate=0;
  9461. #else
  9462. if (m_time5 == "" && m_time6 == "")
  9463. bPrintDate = 0;
  9464. #endif
  9465. if (bPrintDate)
  9466. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9467. else
  9468. {
  9469. #ifdef CHILD_VERSION
  9470. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/引导", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9471. #else
  9472. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/化妆", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9473. #endif
  9474. }
  9475. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138))) // [version].[reverse3]
  9476. {
  9477. Image *pImg = NULL;
  9478. g_nSendCode = 31;
  9479. int g_nYearposTemp = g_nYearpos;
  9480. g_nYearpos = -1;
  9481. g_pMainWnd->ProcessChatMessageRequest2(1);
  9482. g_nYearpos = g_nYearposTemp;
  9483. g_nSendCode = 0;
  9484. if (g_bSendOK == 0)return;
  9485. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  9486. // Jeff二维码的区域不是从18.lia里获取的,是固定在右上角指定区域;
  9487. if (pImg)
  9488. {
  9489. StrRect.left = 485;
  9490. StrRect.top = 12;
  9491. StrRect.right = StrRect.left + 60;
  9492. StrRect.bottom = StrRect.top + 60;
  9493. m_Print.DrawImage(pImg, StrRect);
  9494. delete pImg; pImg = NULL;
  9495. }
  9496. }
  9497. // CArray<CRect,CRect>rcarray;
  9498. // CStringArray strarray2;
  9499. // ■■■■■■从18.lia中获取第10的区域大小;
  9500. for (i = 10; i <= 16; i++)
  9501. {
  9502. StrRect = load.m_rcarray.ElementAt(i - 1);
  9503. StrRect.left += 2;
  9504. StrRect.right -= 2;
  9505. StrRect.top += 2;
  9506. rcarray.Add(StrRect);
  9507. strarray2.Add(strarray.ElementAt(7 + i - 10));
  9508. }
  9509. if (1)
  9510. {
  9511. // ■■■■■■从18.lia中获取第31的区域大小;
  9512. StrRect = load.m_rcarray.ElementAt(30);
  9513. StrRect.left += 2;
  9514. StrRect.right -= 2;
  9515. StrRect.top += 2;
  9516. rcarray.Add(StrRect);
  9517. if (bPrintDate)
  9518. strarray2.Add(m_time6 + "/" + m_time5);
  9519. else
  9520. {
  9521. strarray2.Add(m_waiter1 + "/" + m_waiter2);
  9522. }
  9523. }
  9524. int bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  9525. for (i = 10; i <= 16; i++)
  9526. {
  9527. StrRect = load.m_rcarray.ElementAt(i - 1);
  9528. if (i == 10)
  9529. {
  9530. dty += bottom - StrRect.bottom;
  9531. }
  9532. StrRect.bottom = bottom;
  9533. m_Print.DrawRect2(StrRect, 1);
  9534. }
  9535. if (1)
  9536. {
  9537. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  9538. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  9539. }
  9540. m_Print.SetFontFace(15, 1, "宋体");
  9541. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  9542. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9543. }
  9544. int curypos = 0;
  9545. int oldpos = 0;
  9546. if (bb == 1)
  9547. {
  9548. dty = -100;
  9549. oldpos = nPrintedPos;
  9550. if (oldpos == 0)oldpos = 10000;
  9551. }
  9552. m_Print.SetFontFace(9, 1, "宋体");
  9553. strarray.RemoveAll();
  9554. if ((oldpos != 10000 && oldpos < sparray2.GetSize()) || bb == 0)
  9555. {
  9556. strarray.Add("产品名称");
  9557. strarray.Add("数量");
  9558. strarray.Add("照片编号");
  9559. strarray.Add(_T("备注"));
  9560. CRect mycr[4] = {
  9561. CRect(39,172,130,189), // 产品名称;
  9562. CRect(130,172,157,189), // 产品数量;
  9563. CRect(157,172,407,189), // 相片;
  9564. CRect(407,172,546,189) // 备注;
  9565. };
  9566. for (i = 0; i <= 3; i++)
  9567. {
  9568. StrRect = mycr[i];
  9569. StrRect.top += dty;
  9570. StrRect.bottom += dty;
  9571. m_Print.DrawRect2(StrRect, 1);
  9572. StrRect.left += 2;
  9573. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9574. StrRect.left -= 2;
  9575. StrRect.top = StrRect.bottom;
  9576. StrRect.bottom += 18;
  9577. rc2array.Add(StrRect);
  9578. }
  9579. }
  9580. for (i = oldpos; i < sparray2.GetSize(); i += 4)
  9581. {
  9582. rcarray.RemoveAll();
  9583. strarray2.RemoveAll();
  9584. for ( j = 0; j < 4; j++)
  9585. {
  9586. StrRect = rc2array.ElementAt(j);
  9587. StrRect.left += 2;
  9588. StrRect.right -= 2;
  9589. StrRect.top += 2;
  9590. rcarray.Add(StrRect);
  9591. #if JEFF_TEST_ON
  9592. if (2 == j)
  9593. {
  9594. CString strImg = sparray2.ElementAt(i + 2);
  9595. //int nImgCount = strImg.Replace(",", ",");
  9596. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  9597. if (nImgCount != 0)
  9598. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  9599. else if (!strImg.IsEmpty())
  9600. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  9601. strarray2.Add(strImg);
  9602. }
  9603. else
  9604. strarray2.Add(sparray2.ElementAt(i + j));
  9605. #else
  9606. strarray2.Add(sparray2.ElementAt(i + j));
  9607. #endif
  9608. }
  9609. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9610. rcarray.RemoveAll();
  9611. for (j = 0; j < 4; j++)
  9612. {
  9613. StrRect = rc2array.ElementAt(j);
  9614. if (j == 0)
  9615. {
  9616. dty += bottom - StrRect.bottom;
  9617. }
  9618. StrRect.bottom = bottom;
  9619. m_Print.DrawRect2(StrRect, 1);
  9620. curypos = StrRect.bottom;
  9621. StrRect.top = StrRect.bottom;
  9622. StrRect.bottom += 18;
  9623. rcarray.Add(StrRect);
  9624. }
  9625. rc2array.RemoveAll();
  9626. rc2array.Copy(rcarray);
  9627. if (bottom > 750)
  9628. {
  9629. bSecondPage = 1;
  9630. nPrintedPos = i + 3;
  9631. break;
  9632. }
  9633. }
  9634. if ((bb == 0 && bSecondPage == 0) || (bb == 1 && bSecondPage == 1))
  9635. {
  9636. m_Print.SetFontFace(15, 1, "宋体");
  9637. StrRect = load.m_rcarray.ElementAt(20);
  9638. dty = curypos - StrRect.bottom + 35;
  9639. StrRect.top += dty;
  9640. StrRect.bottom += dty;
  9641. if (StrRect.bottom > 700 && bb == 0)
  9642. {
  9643. bSecondPage = 1;
  9644. }
  9645. else
  9646. {
  9647. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9648. m_Print.SetFontFace(9, 1, "宋体");
  9649. rcarray.RemoveAll();
  9650. strarray2.RemoveAll();
  9651. StrRect = load.m_rcarray.ElementAt(21);
  9652. StrRect.top += dty;
  9653. StrRect.bottom += dty;
  9654. StrRect.left += 2;
  9655. StrRect.right -= 2;
  9656. StrRect.top += 2;
  9657. rcarray.Add(StrRect);
  9658. #if JEFF_TEST_ON
  9659. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9660. strarray2.RemoveAll();
  9661. CString strFind = "要求:";
  9662. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  9663. do
  9664. {
  9665. int nIndex = strbz3.Find(strFind, 1);
  9666. if (nIndex != -1)
  9667. {
  9668. CString strbz = strbz3.Left(nIndex);
  9669. strbz3 = strbz3.Mid(nIndex);
  9670. strarray2.Add(strbz);
  9671. }
  9672. else
  9673. {
  9674. strarray2.Add(strbz3);
  9675. strbz3 = "";
  9676. }
  9677. } while (strbz3.Find(strFind) != -1);
  9678. strarray2.Add(g_List1array.ElementAt(0).ElementAt(29));
  9679. strarray2.Add(g_List1array.ElementAt(0).ElementAt(23));
  9680. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  9681. #else
  9682. strarray2.Add(m_bz);
  9683. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9684. #endif
  9685. StrRect = load.m_rcarray.ElementAt(21);
  9686. StrRect.top += dty;
  9687. StrRect.bottom += dty;
  9688. dty += bottom - StrRect.bottom;
  9689. StrRect.bottom = bottom;
  9690. m_Print.DrawRect2(StrRect, 1);
  9691. curypos = StrRect.bottom;
  9692. m_Print.SetFontFace(10, 1, "宋体");
  9693. StrRect = load.m_rcarray.ElementAt(22);
  9694. dty = curypos - StrRect.bottom + 25;
  9695. StrRect.top += dty;
  9696. StrRect.bottom += dty;
  9697. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  9698. if (m_edit9.IsEmpty())
  9699. {
  9700. m_edit9 = "\
  9701. 经确认后的照片均排入制作流程,\r\n\
  9702. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9703. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9704. }
  9705. CString info1, info2, info3;
  9706. int newlinepos = m_edit9.Find("\r\n");
  9707. if (newlinepos != -1)
  9708. {
  9709. info1 = m_edit9.Left(newlinepos);
  9710. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9711. }
  9712. newlinepos = m_edit9.Find("\r\n");
  9713. if (newlinepos != -1)
  9714. {
  9715. info2 = m_edit9.Left(newlinepos);
  9716. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9717. info3 = m_edit9;
  9718. }
  9719. #ifdef QCH_VERSION
  9720. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9721. StrRect = load.m_rcarray.ElementAt(23);
  9722. StrRect.top += dty; StrRect.bottom += dty;
  9723. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9724. StrRect=load.m_rcarray .ElementAt (24);
  9725. StrRect.top +=dty;StrRect.bottom +=dty;
  9726. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9727. StrRect.top +=15;
  9728. StrRect.bottom +=15;
  9729. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9730. #else
  9731. if (1)
  9732. {
  9733. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9734. StrRect = load.m_rcarray.ElementAt(23);
  9735. StrRect.top += dty; StrRect.bottom += dty;
  9736. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9737. StrRect = load.m_rcarray.ElementAt(24);
  9738. StrRect.top += dty; StrRect.bottom += dty;
  9739. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9740. }
  9741. else
  9742. {
  9743. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9744. StrRect = load.m_rcarray.ElementAt(23);
  9745. StrRect.top += dty; StrRect.bottom += dty;
  9746. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9747. StrRect = load.m_rcarray.ElementAt(24);
  9748. StrRect.top += dty; StrRect.bottom += dty;
  9749. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9750. }
  9751. StrRect.top += 15;
  9752. StrRect.bottom += 15;
  9753. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9754. #endif
  9755. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  9756. StrRect = load.m_rcarray.ElementAt(25);
  9757. StrRect.top += dty - dy;
  9758. StrRect.bottom += dty - dy;
  9759. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9760. StrRect = load.m_rcarray.ElementAt(26);
  9761. StrRect.top += dty - dy;
  9762. StrRect.bottom += dty - dy;
  9763. m_Print.DrawRect2(StrRect, 2);
  9764. StrRect = load.m_rcarray.ElementAt(25);
  9765. StrRect.top += dty + 15 - dy;
  9766. StrRect.bottom += dty + 15 - dy;
  9767. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9768. StrRect = load.m_rcarray.ElementAt(26);
  9769. StrRect.top += dty + 15 - dy;
  9770. StrRect.bottom += dty + 15 - dy;
  9771. m_Print.DrawRect2(StrRect, 2);
  9772. StrRect = load.m_rcarray.ElementAt(25);
  9773. StrRect.top += dty + 15 * 2 - dy;
  9774. StrRect.bottom += dty + 15 * 2 - dy;
  9775. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9776. StrRect = load.m_rcarray.ElementAt(26);
  9777. StrRect.top += dty + 15 * 2 - dy;
  9778. StrRect.bottom += dty + 15 * 2 - dy;
  9779. m_Print.DrawRect2(StrRect, 2);
  9780. }
  9781. }
  9782. PrintPreview dlg; dlg.m_mode = 2;
  9783. dlg.m_name = name;
  9784. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  9785. dlg.m_pDC = m_Print.GetPDC();
  9786. if (aa == 0)
  9787. {
  9788. if (dlg.DoModal() != IDOK)
  9789. return;
  9790. printcot = dlg.m_num;
  9791. }
  9792. //结束打印
  9793. m_Print.EndPage();
  9794. m_Print.EndPrint();
  9795. }
  9796. }
  9797. }
  9798. //void CMainFrame::PrintFlowChart4(CString m_id) // 选设计打单函数;
  9799. void CMainFrame::PrintFlowChart4(CString strOrderNumber) // 选设计打单函数,使用18.lia文件;
  9800. {
  9801. int i = 0;
  9802. int j = 0;
  9803. int printcot = 1;
  9804. for (int aa = 0; aa < printcot; aa++)
  9805. {
  9806. CPrintRX m_Print;
  9807. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  9808. {
  9809. m_Print.InitToPrint(NULL, 1);
  9810. }
  9811. else
  9812. {
  9813. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  9814. if (name.IsEmpty())
  9815. m_Print.InitToPrint(NULL, 1);
  9816. else
  9817. {
  9818. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9819. if (nret == -1 && aa == 0)
  9820. {
  9821. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9822. }
  9823. }
  9824. }
  9825. m_Print.StartPrint();
  9826. m_Print.StartPage();
  9827. LoadRect load;
  9828. load.SetLiaPath("18.lia");
  9829. load.SetMargins(10, 0);
  9830. if (!load.Load())return;
  9831. CString str;
  9832. int rcpos = -1;
  9833. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  9834. m_Print.SetFontFace(25, 1, "宋体");
  9835. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9836. m_Print.SetFontFace(15, 1, "宋体");
  9837. StrRect = load.m_rcarray.ElementAt(++rcpos);
  9838. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9839. m_Print.SetFontFace(9, 1, "宋体");
  9840. //////////////////////////////////////////////////////////////
  9841. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  9842. g_sendhead.code[0] = 54;
  9843. g_sendhead.code[1] = 223;
  9844. g_sendhead.code[2] = 52;
  9845. g_sendhead.tabcount = 3;
  9846. g_sendhead.bsql = 0;
  9847. g_pMainWnd->ProcessChatMessageRequest2(filter);
  9848. if (g_bSendOK == 0)return;
  9849. CArray<CStringArray, CStringArray>sparray;
  9850. CArray<CStringArray, CStringArray>clientarray;
  9851. DataToArray(&g_List1array, &sparray, &clientarray);
  9852. CString spno;
  9853. CStringArray sparray2;
  9854. for ( i = 0; i < sparray.GetSize(); i++)
  9855. {
  9856. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  9857. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(8).IsEmpty())continue;
  9858. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9859. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9860. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  9861. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9862. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9863. }
  9864. for (i = 0; i < sparray.GetSize(); i++)
  9865. {
  9866. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  9867. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  9868. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  9869. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9870. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9871. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  9872. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9873. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9874. }
  9875. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  9876. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  9877. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  9878. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  9879. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  9880. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  9881. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  9882. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  9883. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  9884. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  9885. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  9886. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  9887. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  9888. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  9889. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  9890. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  9891. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  9892. CString m_bz = g_List1array.ElementAt(0).ElementAt(17);
  9893. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(25);
  9894. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  9895. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  9896. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  9897. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  9898. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  9899. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  9900. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  9901. CString m_waiter8 = g_List1array.ElementAt(0).ElementAt(27);
  9902. CString m_replace = g_List1array.ElementAt(0).ElementAt(28);
  9903. if (!m_replace.IsEmpty())
  9904. {
  9905. m_replace = "设计替换照片:" + m_replace;
  9906. m_replace.Replace("$", ";");
  9907. m_replace.TrimLeft(";");
  9908. m_bz += ";";
  9909. m_bz += m_replace;
  9910. }
  9911. CString m_sum3;
  9912. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  9913. ::ConvertToPrice(m_sum3);
  9914. if (m_money3.IsEmpty())m_money3 = "0";
  9915. int dty = 0;
  9916. CString name;
  9917. if (!m_name1.IsEmpty())
  9918. name = m_name1 + ",";
  9919. name += m_name2;
  9920. name.TrimRight(",");
  9921. CString phone;
  9922. if (!m_phone1.IsEmpty())
  9923. phone = m_phone1 + ",";
  9924. phone += m_phone2; phone.TrimRight(",");
  9925. if (IsHasRights2new(31) == 0)
  9926. phone = "***";
  9927. CStringArray strarray;
  9928. #ifdef CHILD_VERSION
  9929. if (m_birthday.IsEmpty())
  9930. strarray.Add("姓名/性别");
  9931. else
  9932. strarray.Add("姓名/性别/年龄");
  9933. #else
  9934. strarray.Add("客人姓名");
  9935. #endif
  9936. strarray.Add("电话");
  9937. strarray.Add("单号");
  9938. strarray.Add("套系");
  9939. strarray.Add("");
  9940. strarray.Add("余款/加挑");
  9941. strarray.Add("看设计/日期");
  9942. #ifdef CHILD_VERSION
  9943. if (m_birthday.IsEmpty())
  9944. strarray.Add(name + "/" + m_sex);
  9945. else
  9946. {
  9947. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  9948. m_birthday.Format("%d", year + 1);
  9949. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  9950. }
  9951. #else
  9952. strarray.Add(name);
  9953. #endif
  9954. strarray.Add(phone);
  9955. strarray.Add(strOrderNumber);
  9956. strarray.Add(m_taoxiname);
  9957. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9958. strarray.Add("");
  9959. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  9960. strarray.Add(str);
  9961. strarray.Add(m_waiter8 + "/" + m_time6);
  9962. //////////////////////////////////////////////
  9963. if (1)
  9964. {
  9965. StrRect = load.m_rcarray.ElementAt(6);
  9966. int addwid = StrRect.Width() / 6;
  9967. for (i = 3; i <= 6; i++)
  9968. {
  9969. StrRect = load.m_rcarray.ElementAt(i - 1);
  9970. StrRect.left += (i - 3)*addwid;
  9971. StrRect.right += (i - 2)*addwid;
  9972. load.m_rcarray.SetAt(i - 1, StrRect);
  9973. }
  9974. StrRect.left = StrRect.right = -1;
  9975. load.m_rcarray.SetAt(6, StrRect);
  9976. for (i = 10; i <= 13; i++)
  9977. {
  9978. StrRect = load.m_rcarray.ElementAt(i - 1);
  9979. StrRect.left += (i - 10)*addwid;
  9980. StrRect.right += (i - 9)*addwid;
  9981. load.m_rcarray.SetAt(i - 1, StrRect);
  9982. }
  9983. StrRect.left = StrRect.right = -1;
  9984. load.m_rcarray.SetAt(13, StrRect);
  9985. StrRect = load.m_rcarray.ElementAt(7);
  9986. int rcwid = StrRect.Width();
  9987. StrRect.left = load.m_rcarray.ElementAt(5).right;
  9988. StrRect.right = StrRect.left + rcwid + addwid;
  9989. load.m_rcarray.SetAt(7, StrRect);
  9990. StrRect = load.m_rcarray.ElementAt(8);
  9991. StrRect.left = load.m_rcarray.ElementAt(7).right;
  9992. StrRect.right = load.m_rcarray.ElementAt(29).left;
  9993. load.m_rcarray.SetAt(8, StrRect);
  9994. StrRect = load.m_rcarray.ElementAt(14);
  9995. rcwid = StrRect.Width();
  9996. StrRect.left = load.m_rcarray.ElementAt(12).right;
  9997. StrRect.right = StrRect.left + rcwid + addwid;
  9998. load.m_rcarray.SetAt(14, StrRect);
  9999. StrRect = load.m_rcarray.ElementAt(15);
  10000. StrRect.left = load.m_rcarray.ElementAt(14).right;
  10001. StrRect.right = load.m_rcarray.ElementAt(29).left;
  10002. load.m_rcarray.SetAt(15, StrRect);
  10003. }
  10004. ////////////////////////////////////////////////
  10005. for (i = 3; i <= 16; i++)
  10006. {
  10007. StrRect = load.m_rcarray.ElementAt(i - 1);
  10008. if (i < 10)
  10009. {
  10010. m_Print.DrawRect2(StrRect, 1);
  10011. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10012. }
  10013. }
  10014. StrRect = load.m_rcarray.ElementAt(29);
  10015. m_Print.DrawRect2(StrRect, 1);
  10016. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10017. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  10018. {
  10019. Image *pImg = NULL;
  10020. g_nSendCode = 31;
  10021. int g_nYearposTemp = g_nYearpos;
  10022. g_nYearpos = -1;
  10023. g_pMainWnd->ProcessChatMessageRequest2(1);
  10024. g_nYearpos = g_nYearposTemp;
  10025. g_nSendCode = 0;
  10026. if (g_bSendOK == 0)return;
  10027. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  10028. if (pImg)
  10029. {
  10030. StrRect.left = 485;
  10031. StrRect.top = 12;
  10032. StrRect.right = StrRect.left + 60;
  10033. StrRect.bottom = StrRect.top + 60;
  10034. m_Print.DrawImage(pImg, StrRect);
  10035. delete pImg; pImg = NULL;
  10036. }
  10037. }
  10038. CArray<CRect, CRect>rcarray;
  10039. CStringArray strarray2;
  10040. for (i = 10; i <= 16; i++)
  10041. {
  10042. StrRect = load.m_rcarray.ElementAt(i - 1);
  10043. StrRect.left += 2;
  10044. StrRect.right -= 2;
  10045. StrRect.top += 2;
  10046. rcarray.Add(StrRect);
  10047. strarray2.Add(strarray.ElementAt(7 + i - 10));
  10048. }
  10049. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  10050. for (i = 10; i <= 16; i++)
  10051. {
  10052. StrRect = load.m_rcarray.ElementAt(i - 1);
  10053. if (i == 10)
  10054. {
  10055. dty += bottom - StrRect.bottom;
  10056. }
  10057. StrRect.bottom = bottom;
  10058. m_Print.DrawRect2(StrRect, 1);
  10059. }
  10060. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  10061. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  10062. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time5, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  10063. m_Print.SetFontFace(15, 1, "宋体");
  10064. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  10065. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10066. m_Print.SetFontFace(9, 1, "宋体");
  10067. strarray.RemoveAll();
  10068. strarray.Add("产品名称");
  10069. strarray.Add("数量");
  10070. strarray.Add("照片编号");
  10071. CArray<CRect, CRect>rc2array;
  10072. for (i = 18; i <= 20; i++)
  10073. {
  10074. StrRect = load.m_rcarray.ElementAt(i - 1); StrRect.top += dty; StrRect.bottom += dty;
  10075. m_Print.DrawRect2(StrRect, 1);
  10076. StrRect.left += 2;
  10077. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10078. StrRect.left -= 2;
  10079. StrRect.top = StrRect.bottom;
  10080. StrRect.bottom += 18;
  10081. rc2array.Add(StrRect);
  10082. }
  10083. int curypos = 0;
  10084. for (i = 0; i < sparray2.GetSize(); i += 3)
  10085. {
  10086. rcarray.RemoveAll();
  10087. strarray2.RemoveAll();
  10088. for ( j = 0; j < 3; j++)
  10089. {
  10090. StrRect = rc2array.ElementAt(j);
  10091. StrRect.left += 2;
  10092. StrRect.right -= 2;
  10093. StrRect.top += 2;
  10094. rcarray.Add(StrRect);
  10095. #if JEFF_TEST_ON
  10096. if (2 == j)
  10097. {
  10098. CString strImg = sparray2.ElementAt(i + 2);
  10099. //int nImgCount = strImg.Replace(",", ",");
  10100. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  10101. if (nImgCount != 0)
  10102. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  10103. else if (!strImg.IsEmpty())
  10104. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  10105. strarray2.Add(strImg);
  10106. }
  10107. else
  10108. strarray2.Add(sparray2.ElementAt(i + j));
  10109. #else
  10110. strarray2.Add(sparray2.ElementAt(i + j));
  10111. #endif
  10112. }
  10113. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  10114. rcarray.RemoveAll();
  10115. for (j = 0; j < 3; j++)
  10116. {
  10117. StrRect = rc2array.ElementAt(j);
  10118. if (j == 0)
  10119. {
  10120. dty += bottom - StrRect.bottom;
  10121. }
  10122. StrRect.bottom = bottom;
  10123. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  10124. StrRect.top = StrRect.bottom;
  10125. StrRect.bottom += 18;
  10126. rcarray.Add(StrRect);
  10127. }
  10128. rc2array.RemoveAll();
  10129. rc2array.Copy(rcarray);
  10130. }
  10131. m_Print.SetFontFace(15, 1, "宋体");
  10132. StrRect = load.m_rcarray.ElementAt(20);
  10133. dty = curypos - StrRect.bottom + 35;
  10134. StrRect.top += dty; StrRect.bottom += dty;
  10135. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10136. m_Print.SetFontFace(9, 1, "宋体");
  10137. rcarray.RemoveAll();
  10138. strarray2.RemoveAll();
  10139. StrRect = load.m_rcarray.ElementAt(21);
  10140. StrRect.top += dty;
  10141. StrRect.bottom += dty;
  10142. StrRect.left += 2;
  10143. StrRect.right -= 2;
  10144. StrRect.top += 2;
  10145. rcarray.Add(StrRect);
  10146. #if JEFF_TEST_ON
  10147. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  10148. strarray2.RemoveAll();
  10149. CString strFind = "要求:";
  10150. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  10151. do
  10152. {
  10153. int nIndex = strbz3.Find(strFind, 1);
  10154. if (nIndex != -1)
  10155. {
  10156. CString strbz = strbz3.Left(nIndex);
  10157. strbz3 = strbz3.Mid(nIndex);
  10158. strarray2.Add(strbz);
  10159. }
  10160. else
  10161. {
  10162. strarray2.Add(strbz3);
  10163. strbz3 = "";
  10164. }
  10165. } while (strbz3.Find(strFind) != -1);
  10166. strarray2.Add(g_List1array.ElementAt(0).ElementAt(25));
  10167. if (!m_replace.IsEmpty())
  10168. {
  10169. m_replace = "设计替换照片:" + m_replace;
  10170. m_replace.Replace("$", ";");
  10171. m_replace.TrimLeft(";");
  10172. }
  10173. strarray2.Add(m_replace);
  10174. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  10175. #else
  10176. strarray2.Add(m_bz);
  10177. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  10178. #endif
  10179. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  10180. dty += bottom - StrRect.bottom;
  10181. StrRect.bottom = bottom;
  10182. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  10183. m_Print.SetFontFace(10, 1, "宋体");
  10184. StrRect = load.m_rcarray.ElementAt(22);
  10185. dty = curypos - StrRect.bottom + 25;
  10186. StrRect.top += dty; StrRect.bottom += dty;
  10187. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  10188. if (m_edit9.IsEmpty())
  10189. {
  10190. m_edit9 = "\
  10191. 经确认后的照片均排入制作流程,\r\n\
  10192. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  10193. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  10194. }
  10195. CString info1, info2, info3;
  10196. int newlinepos = m_edit9.Find("\r\n");
  10197. if (newlinepos != -1)
  10198. {
  10199. info1 = m_edit9.Left(newlinepos);
  10200. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  10201. }
  10202. newlinepos = m_edit9.Find("\r\n");
  10203. if (newlinepos != -1)
  10204. {
  10205. info2 = m_edit9.Left(newlinepos);
  10206. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  10207. info3 = m_edit9;
  10208. }
  10209. if (1)
  10210. {
  10211. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10212. StrRect = load.m_rcarray.ElementAt(23);
  10213. StrRect.top += dty; StrRect.bottom += dty;
  10214. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10215. StrRect = load.m_rcarray.ElementAt(24);
  10216. StrRect.top += dty; StrRect.bottom += dty;
  10217. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10218. }
  10219. else
  10220. {
  10221. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10222. StrRect = load.m_rcarray.ElementAt(23);
  10223. StrRect.top += dty; StrRect.bottom += dty;
  10224. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10225. StrRect = load.m_rcarray.ElementAt(24);
  10226. StrRect.top += dty; StrRect.bottom += dty;
  10227. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10228. }
  10229. StrRect = load.m_rcarray.ElementAt(25);
  10230. StrRect.top += dty; StrRect.bottom += dty;
  10231. m_Print.DrawText((LPTSTR)(LPCTSTR)"贵宾签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10232. StrRect = load.m_rcarray.ElementAt(26);
  10233. StrRect.top += dty; StrRect.bottom += dty;
  10234. m_Print.DrawRect2(StrRect, 2);
  10235. m_Print.SetFontFace(9, 1, "宋体");
  10236. StrRect = load.m_rcarray.ElementAt(27);
  10237. StrRect.top += dty; StrRect.bottom += dty;
  10238. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10239. StrRect = load.m_rcarray.ElementAt(28);
  10240. StrRect.top += dty; StrRect.bottom += dty;
  10241. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10242. PrintPreview dlg;//dlg.m_mode=2;
  10243. dlg.m_name = name;
  10244. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  10245. dlg.m_pDC = m_Print.GetPDC();
  10246. if (aa == 0)
  10247. {
  10248. if (dlg.DoModal() != IDOK)
  10249. return;
  10250. printcot = dlg.m_num;
  10251. }
  10252. //结束打印
  10253. m_Print.EndPage();
  10254. m_Print.EndPrint();
  10255. }
  10256. }
  10257. /*
  10258. void CMainFrame::PrintFlowChart(CString m_id)
  10259. {
  10260. CPrintRX m_Print;
  10261. m_Print.InitToPrint(NULL, 1);
  10262. m_Print.StartPrint();
  10263. m_Print.StartPage();
  10264. // CRect StrRect(0,0,560,818);
  10265. LoadRect load;
  10266. load.SetLiaPath ("4.lia");
  10267. load.SetMargins(-14,-14);
  10268. if(!load.Load ())return;
  10269. LoadRect load2;
  10270. load2.SetMargins(-14,472+27-14);
  10271. load2.SetLiaPath ("5.lia");
  10272. if(!load2.Load ())return;
  10273. //////////////////////////////////////////////////////////////
  10274. CString filter="id='"+m_id+"';id='"+m_id+"'";
  10275. g_sendhead.code[0]=54;
  10276. g_sendhead.code[1]=50;
  10277. g_sendhead.tabcount=2;
  10278. g_sendhead.bsql=0;
  10279. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  10280. CArray<CStringArray, CStringArray>sparray;
  10281. DataToArray(&g_List1array,&sparray);
  10282. CString spno;
  10283. for(int i=0; i<sparray.GetSize (); i++)
  10284. {
  10285. if(sparray.ElementAt (i).ElementAt (4)=="4" && sparray.ElementAt (i).ElementAt (5)!="入册")continue;
  10286. if(sparray.ElementAt (i).ElementAt (5)=="入册"&&sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  10287. spno+=sparray.ElementAt (i).ElementAt (5);
  10288. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  10289. spno+=";";
  10290. else
  10291. {
  10292. spno+=":";
  10293. spno+=sparray.ElementAt (i).ElementAt (6);
  10294. spno+=";";
  10295. }
  10296. }
  10297. spno+=" 加挑:";
  10298. for( i=0; i<sparray.GetSize (); i++)
  10299. {
  10300. if(sparray.ElementAt (i).ElementAt (4)!="4")continue;
  10301. if(sparray.ElementAt (i).ElementAt (5)=="入册")continue;
  10302. spno+=sparray.ElementAt (i).ElementAt (5);
  10303. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  10304. spno+=";";
  10305. else
  10306. {
  10307. spno+=":";
  10308. spno+=sparray.ElementAt (i).ElementAt (6);
  10309. spno+=";";
  10310. }
  10311. }
  10312. if(spno.Right (6)==" 加挑:")
  10313. {
  10314. spno=spno.Left (spno.GetLength ()-6);
  10315. }
  10316. CString m_name1 = g_List1array.ElementAt (0).ElementAt (1);
  10317. CString m_name2 = g_List1array.ElementAt (0).ElementAt (2);
  10318. CString m_phone1=g_List1array.ElementAt (0).ElementAt (3);
  10319. CString m_phone2=g_List1array.ElementAt (0).ElementAt (4);
  10320. CString m_urgent=g_List1array.ElementAt (0).ElementAt (5);
  10321. if(m_urgent.IsEmpty ())m_urgent="否";
  10322. CString m_time2 = g_List1array.ElementAt (0).ElementAt (6);
  10323. CString m_time4 = g_List1array.ElementAt (0).ElementAt (7);
  10324. CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  10325. CString m_takezs = g_List1array.ElementAt (0).ElementAt (9);
  10326. CString m_taoxizs = g_List1array.ElementAt (0).ElementAt (10);
  10327. CString m_choosezs = g_List1array.ElementAt (0).ElementAt (11);
  10328. CString m_ren = g_List1array.ElementAt (0).ElementAt (12);
  10329. CString m_waiter3 = g_List1array.ElementAt (0).ElementAt (13);
  10330. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (14);
  10331. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (15);
  10332. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (16);
  10333. CString m_bz = "客人要求: "+g_List1array.ElementAt (0).ElementAt (17);
  10334. CString m_money3 = g_List1array.ElementAt (0).ElementAt (18);
  10335. CString m_money1 = g_List1array.ElementAt (0).ElementAt (19);
  10336. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (20);
  10337. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (21);
  10338. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (22);
  10339. CString m_sum3;
  10340. m_sum3.Format ("%0.2f", atof(m_taoxijiage)+atof(m_payed4)-(atof(m_payed5)+atof(m_money1)));
  10341. ::ConvertToPrice (m_sum3);
  10342. if(m_money3.IsEmpty ())m_money3="0";
  10343. // m_money3=m_money3+"/"+m_sum3;
  10344. CString name;
  10345. if(!m_name1.IsEmpty ())
  10346. name=m_name1+",";
  10347. name+=m_name2;
  10348. name.TrimRight (",");
  10349. CString phone;
  10350. if(!m_phone1.IsEmpty ())
  10351. phone=m_phone1+",";
  10352. phone+=m_phone2;phone.TrimRight (",");
  10353. CStringArray strarray;
  10354. strarray.Add (m_urgent);
  10355. strarray.Add (m_ren);
  10356. strarray.Add (m_waiter3);
  10357. strarray.Add (name);
  10358. strarray.Add (m_time2);
  10359. strarray.Add (m_time4);
  10360. strarray.Add (m_time5);
  10361. strarray.Add (m_money3);
  10362. strarray.Add (m_takezs);
  10363. strarray.Add (m_taoxizs);
  10364. strarray.Add (m_choosezs);
  10365. strarray.Add (m_id);
  10366. strarray.Add (phone);
  10367. ////////////////////////////////////////////////////////////////
  10368. int rcpos=-1;
  10369. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  10370. Image *pImg=NULL;
  10371. #ifdef MNLS_VERSION
  10372. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG") );
  10373. #else
  10374. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  10375. #endif
  10376. m_Print.DrawImage(pImg, StrRect);
  10377. delete pImg;
  10378. m_Print.SetFontFace(15, 1, "宋体");
  10379. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10380. #ifdef MNLS_VERSION
  10381. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10382. #endif
  10383. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10384. #ifdef MNLS_VERSION
  10385. m_Print.DrawRect(StrRect);
  10386. #endif
  10387. m_Print.SetFontFace(7, 1, "黑体");
  10388. m_Print.SetColor(0xffffff);
  10389. #ifdef MNLS_VERSION
  10390. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10391. #endif
  10392. m_Print.SetColor(0);
  10393. m_Print.SetFontFace(25, 1, "黑体");
  10394. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10395. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10396. CString title[13]={"是否加急:","接单门市:","选样人员:","新郎新娘姓名:","拍照日期:","选片日期:","取件日期:","加挑/余款:","拍摄总张数:","应挑选张数:","额外加挑张数:","票号:","客户联系电话:"};
  10397. m_Print.SetFontFace(12, 1, "宋体");
  10398. for( i=0; i<13; i++)
  10399. {
  10400. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10401. if(i<3)
  10402. m_Print.DrawRect2(StrRect, 0);
  10403. else
  10404. m_Print.DrawRect2(StrRect, 1);
  10405. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10406. }
  10407. for( i=18; i<=37; i++)
  10408. {
  10409. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10410. if(i>=19&&i<=21)
  10411. m_Print.DrawRect2(StrRect, 2);
  10412. else if(i==26)
  10413. {
  10414. CRect rc=StrRect;
  10415. CRect rc2=rc;
  10416. rc.right -=rc2.Width ()/2;
  10417. m_Print.DrawRect2(rc, 1);
  10418. rc2.left +=rc.Width ();
  10419. m_Print.DrawRect2(rc2, 1);
  10420. }
  10421. else
  10422. m_Print.DrawRect2(StrRect, 1);
  10423. if(i==18)
  10424. {
  10425. StrRect.left +=5;
  10426. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10427. }
  10428. }
  10429. //////////////////////////////////////
  10430. rcpos=-1;
  10431. for( i=0; i<8; i++)
  10432. {
  10433. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10434. m_Print.DrawRect2(StrRect, 1);
  10435. }
  10436. CString title2[4]={"化妆师:","摄影师:","数码设计师:","顾客签名:"};
  10437. for( i=0; i<4; i++)
  10438. {
  10439. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10440. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10441. }
  10442. for( i=0; i<4; i++)
  10443. {
  10444. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10445. m_Print.DrawRect2(StrRect, 2);
  10446. }
  10447. ///////////////////////////////////////////
  10448. for( i=19; i<=31; i++)
  10449. {
  10450. StrRect=load.m_rcarray .ElementAt (i-1);
  10451. StrRect.left +=4;
  10452. if(i==31)
  10453. {
  10454. if(m_phone1.IsEmpty ()==0 && m_phone2.IsEmpty ()==0)
  10455. {
  10456. StrRect.top +=2;
  10457. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  10458. StrRect.top +=8;
  10459. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10460. }
  10461. else
  10462. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10463. }
  10464. else if((i-19)==7)
  10465. {
  10466. CRect rc=StrRect;
  10467. CRect rc2=rc;
  10468. rc.right -=rc2.Width ()/2;
  10469. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10470. rc2.left +=rc.Width ()+3;
  10471. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10472. }
  10473. else
  10474. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10475. }
  10476. strarray.RemoveAll ();
  10477. strarray.Add (m_waiter2);
  10478. strarray.Add (m_waiter1);
  10479. strarray.Add (m_waiter4);
  10480. for( i=13; i<=15; i++)
  10481. {
  10482. StrRect=load2.m_rcarray .ElementAt (i-1);
  10483. StrRect.left +=4;
  10484. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10485. }
  10486. ///////////spno
  10487. CRect sprc[14];
  10488. for(i=0; i<14; i++)
  10489. {
  10490. if(i<7)
  10491. {
  10492. if(i==0)
  10493. {
  10494. StrRect=load.m_rcarray .ElementAt (17);StrRect.left +=94;StrRect.right -=3;
  10495. }
  10496. else
  10497. {
  10498. StrRect=load.m_rcarray .ElementAt (30+i);StrRect.left +=4;StrRect.right -=3;
  10499. }
  10500. }
  10501. else
  10502. {
  10503. StrRect=load2.m_rcarray .ElementAt (i-7);StrRect.left +=4;StrRect.right -=3;
  10504. }
  10505. sprc[i]=StrRect;
  10506. // m_Print.DrawText((LPTSTR)(LPCTSTR)"xxx", sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10507. }
  10508. CString temp,tempspno,tempbz;
  10509. CSize size;
  10510. BOOL bRun=0;
  10511. int fontsize=12;
  10512. ll: tempspno=spno;
  10513. tempbz=m_bz;
  10514. m_Print.SetFontFace(fontsize, 1, "宋体");
  10515. for( i=0; i<14; i++)
  10516. {
  10517. if(!tempspno.IsEmpty ())
  10518. {
  10519. temp=tempspno;
  10520. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10521. int right=0;
  10522. CRect temprc=sprc[i];
  10523. while(size.cx>temprc.Width ())
  10524. {
  10525. right++;
  10526. temp=tempspno.Left (tempspno.GetLength ()-(right));
  10527. if(GIsHalfHZ(temp))
  10528. {
  10529. right++;
  10530. temp.Delete (temp.GetLength ()-1);
  10531. }
  10532. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10533. }
  10534. if(bRun)
  10535. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10536. tempspno=tempspno.Right (tempspno.GetLength ()-temp.GetLength ());
  10537. if(tempspno.IsEmpty ())i++;
  10538. }
  10539. else if(!tempbz.IsEmpty ())
  10540. {
  10541. temp=tempbz;
  10542. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10543. int right=0;
  10544. CRect temprc=sprc[i];
  10545. while(size.cx>temprc.Width ())
  10546. {
  10547. right++;
  10548. temp=tempbz.Left (tempbz.GetLength ()-(right));
  10549. if(GIsHalfHZ(temp))
  10550. {
  10551. right++;
  10552. temp.Delete (temp.GetLength ()-1);
  10553. }
  10554. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10555. }
  10556. if(bRun)
  10557. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10558. tempbz=tempbz.Right (tempbz.GetLength ()-temp.GetLength ());
  10559. }
  10560. }
  10561. if(tempspno.IsEmpty ()==0 || tempbz.IsEmpty ()==0)
  10562. {
  10563. fontsize--;
  10564. goto ll;
  10565. }
  10566. if(bRun==0)
  10567. {
  10568. bRun=1;
  10569. goto ll;
  10570. }
  10571. PrintPreview dlg;
  10572. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  10573. dlg.m_pDC =m_Print.GetPDC() ;
  10574. if(dlg.DoModal ()!=IDOK)return;
  10575. //结束打印
  10576. m_Print.EndPage();
  10577. m_Print.EndPrint();
  10578. }
  10579. void CMainFrame::SetSelFolder(int pos)
  10580. {
  10581. m_wndToolBar2.SetSelFolder(pos);
  10582. }*/
  10583. void CMainFrame::ToPhotoPrint()
  10584. {
  10585. UINT nID = 1;
  10586. LPSTR pName;
  10587. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  10588. OPEN_MENU(PhotoPrintFrom);
  10589. }
  10590. void CMainFrame::GetOcx()
  10591. {
  10592. char path[MAX_PATH];
  10593. ::GetSystemDirectory(path, MAX_PATH);
  10594. CString syspath = path;
  10595. try
  10596. {
  10597. if (!::PathFileExists(syspath + "\\MSCHRT20.OCX"))
  10598. {
  10599. g_sendhead.bsql = 0;
  10600. g_sendhead.code[0] = 103;
  10601. g_sendhead.tabcount = 1;
  10602. g_pMainWnd->ProcessChatMessageRequest2(1); if (g_bSendOK == 0)return;
  10603. CFile fp;
  10604. if (fp.Open(syspath + "\\MSCHRT20.OCX", CFile::modeWrite | CFile::modeCreate))
  10605. {
  10606. fp.Write(g_pData, g_nLeng);
  10607. fp.Close();
  10608. ::Sleep(1000);
  10609. }
  10610. }
  10611. CString temp;
  10612. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10613. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10614. }
  10615. catch (...)
  10616. {
  10617. }
  10618. try
  10619. {
  10620. CString temp;
  10621. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10622. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10623. }
  10624. catch (...)
  10625. {
  10626. }
  10627. }
  10628. void CMainFrame::OnServer()
  10629. {
  10630. // TODO: Add your command handler code here
  10631. DBConfig dlg;
  10632. dlg.DoModal();
  10633. }
  10634. void CMainFrame::OnPath()
  10635. {
  10636. // TODO: Add your command handler code here
  10637. if (g_user.bLongin == 0)
  10638. {
  10639. if (g_bNoLoginLia)
  10640. {
  10641. Login dlg;
  10642. dlg.SetLiaPath("5.lia");
  10643. dlg.DoModal();
  10644. }
  10645. else
  10646. {
  10647. Login3 dlg;
  10648. dlg.SetLiaPath("5.lia");
  10649. dlg.DoModal();
  10650. }
  10651. if (g_user.bLongin == 0)return;
  10652. }
  10653. if (IsHasRightsnew(49) == 0)return;
  10654. SetPathDlg2 dlg;
  10655. dlg.DoModal();
  10656. }
  10657. void CMainFrame::OnShowhis()
  10658. {
  10659. // TODO: Add your command handler code here
  10660. if (g_user.bLongin == 0)
  10661. {
  10662. if (g_bNoLoginLia)
  10663. {
  10664. Login dlg;
  10665. dlg.SetLiaPath("5.lia");
  10666. dlg.DoModal();
  10667. }
  10668. else
  10669. {
  10670. Login3 dlg;
  10671. dlg.SetLiaPath("5.lia");
  10672. dlg.DoModal();
  10673. }
  10674. if (g_user.bLongin == 0)return;
  10675. }
  10676. if (IsHasRightsnew(52) == 0)return;
  10677. CMenu *pMenu = GetMenu();
  10678. CMenu* submenu = pMenu->GetSubMenu(2);
  10679. UINT status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10680. if (status&MF_CHECKED)
  10681. {
  10682. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_UNCHECKED);
  10683. g_bShowOK = 1;
  10684. }
  10685. else
  10686. {
  10687. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  10688. g_bShowOK = 0;
  10689. } m_Mdi.CloseAll();
  10690. }
  10691. void CMainFrame::AddHistoryMenu(CArray<CStringArray, CStringArray>*hisyeararray) // 添加历史数据库菜单;
  10692. {
  10693. #ifdef NEW_SKIN
  10694. CMenu* m_menuXP = GetMenu();
  10695. CMenu* submenu = m_menuXP->GetSubMenu(2);
  10696. // 删除原有菜单;
  10697. int i = 0;
  10698. for ( i = 0; i < 100; i++)
  10699. {
  10700. submenu->DeleteMenu(1000 + i, MF_BYCOMMAND);
  10701. }
  10702. // 重创菜单,从资源ID1000开始;
  10703. for (i = 0; i < hisyeararray->GetSize(); i++)
  10704. {
  10705. submenu->AppendMenu(MF_STRING, 1000 + i, "查看历史数据:" + hisyeararray->ElementAt(i).ElementAt(0)); // 第一项菜单项;
  10706. }
  10707. g_nYearpos = -1;
  10708. #else
  10709. HMENU hMenu = ::GetMenu(m_hWnd);
  10710. m_menuXP.Attach(hMenu);
  10711. BCMenu* submenu = (BCMenu*)m_menuXP.GetSubMenu(2);
  10712. for (int i = 0; i < 100; i++)
  10713. {
  10714. submenu->DeleteMenu (1000+i, MF_BYCOMMAND);
  10715. }
  10716. for( i=0; i<hisyeararray->GetSize (); i++)
  10717. {
  10718. submenu->AppendMenu(MF_STRING, 1000+i, "查看历史数据:"+hisyeararray->ElementAt (i).ElementAt (0)); // 第一项菜单项
  10719. }
  10720. m_menuXP.Detach ();
  10721. g_nYearpos = -1;
  10722. #endif
  10723. }
  10724. /************************************************************************/
  10725. /*
  10726. Jeff
  10727. 函数:AddBranchMenu()
  10728. 参数:CArray<CStringArray, CStringArray> *branchArray
  10729. 返回:void
  10730. 注意:
  10731. 调用关系:
  10732. */
  10733. /************************************************************************/
  10734. void CMainFrame::AddBranchMenu(CArray<CStringArray, CStringArray>*branchArray)
  10735. {
  10736. //WriteTextLog("AddBranchMenu,添加集团版菜单");
  10737. #ifdef ENTERPRISE_VERSION
  10738. CMenu *m_menuXP = GetMenu();
  10739. CMenu* submenu = m_menuXP->GetSubMenu(0);
  10740. int i = 0;
  10741. for ( i = 0; i < 100; i++)
  10742. {
  10743. submenu->DeleteMenu(2000 + i, MF_BYCOMMAND);
  10744. }
  10745. g_menubranchname.RemoveAll();
  10746. CString name;
  10747. int a = 0;
  10748. #if 0 // Jeff.add for test
  10749. CString strCount;
  10750. strCount.Format("历史数据库个数=%d", branchArray->GetSize());
  10751. WriteTextLog(strCount);
  10752. #endif
  10753. for (i = 0; i < branchArray->GetSize() - 1; i++)
  10754. {
  10755. //WriteTextLog("111");
  10756. //WriteTextLog(hisyeararray->ElementAt(i).ElementAt(0));
  10757. //WriteTextLog(name);
  10758. if (name == "")
  10759. {
  10760. name = branchArray->ElementAt(i).ElementAt(0);
  10761. #ifndef SQLSERVER_VERSION
  10762. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10763. a++;
  10764. #endif
  10765. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10766. a++;
  10767. g_menubranchname.Add(name);
  10768. continue;
  10769. }
  10770. else if (branchArray->ElementAt(i).ElementAt(0).Find(name) != -1 && ((branchArray->ElementAt(i).ElementAt(0).GetLength() - name.GetLength()) == 4))
  10771. {
  10772. continue;
  10773. }
  10774. name = branchArray->ElementAt(i).ElementAt(0);
  10775. #ifndef SQLSERVER_VERSION
  10776. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10777. a++;
  10778. #endif
  10779. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10780. g_menubranchname.Add(name);
  10781. a++;
  10782. //WriteTextLog("222");
  10783. }
  10784. if ((branchArray->GetSize() - 1) > 0)
  10785. {
  10786. if (branchArray->ElementAt(0).ElementAt(3) == "总店")
  10787. submenu->AppendMenu(MF_STRING, 2000 + a, "多店数据汇总");
  10788. }
  10789. #endif
  10790. }
  10791. // Jeff:如果选择了历史数据库,则开单的数据会录入到该历史数据库中,而非当前数据库;
  10792. // g_nYearpos==-1,表示当前主数据库,其他>=0的值表示历史数据库在g_historydb中的索引值;
  10793. void CMainFrame::OnHistory(UINT nID) // 选择历史数据库菜单响应;
  10794. {
  10795. CMenu* pMenu = GetMenu();
  10796. CMenu* submenu = pMenu->GetSubMenu(2);
  10797. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10798. if (g_user.bLongin == 0)
  10799. {
  10800. if (g_bNoLoginLia)
  10801. {
  10802. Login dlg;
  10803. dlg.SetLiaPath("5.lia");
  10804. dlg.DoModal();
  10805. }
  10806. else
  10807. {
  10808. Login3 dlg;
  10809. dlg.SetLiaPath("5.lia");
  10810. dlg.DoModal();
  10811. }
  10812. if (g_user.bLongin == 0)return;
  10813. }
  10814. if (IsHasRightsnew(52) == 0)return;
  10815. m_Mdi.CloseAll();
  10816. for (int i = 0; i < 100; i++)
  10817. {
  10818. submenu->CheckMenuItem(1000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10819. }
  10820. if (status&MF_CHECKED)
  10821. {
  10822. g_nYearpos = -1;
  10823. status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10824. if (status&MF_CHECKED)
  10825. g_bShowOK = 0;
  10826. else
  10827. g_bShowOK = 1;
  10828. }
  10829. else
  10830. {
  10831. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10832. g_nYearpos = nID - 1000;
  10833. g_bShowOK = 1;
  10834. }
  10835. }
  10836. void CMainFrame::OnBranchData(UINT nID)
  10837. {
  10838. #ifdef ENTERPRISE_VERSION
  10839. #ifdef SQLSERVER_VERSION
  10840. OnBranchData2(nID);
  10841. return;
  10842. #endif
  10843. #endif
  10844. }
  10845. void CMainFrame::OnBranchData2(UINT nID)
  10846. {
  10847. #ifdef ENTERPRISE_VERSION
  10848. g_bAllBranch = 0;
  10849. m_Mdi.CloseAll();
  10850. OnDisconnect();
  10851. CMenu *pMenu = GetMenu();
  10852. CMenu* submenu = pMenu->GetSubMenu(0);
  10853. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10854. for (int i = 0; i < 100; i++)
  10855. {
  10856. submenu->CheckMenuItem(2000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10857. }
  10858. if (status&MF_CHECKED)
  10859. {
  10860. g_branchname.Empty();
  10861. g_branchip.Empty();
  10862. g_bBranchModify = 0;
  10863. g_user.bLongin = 0;
  10864. if (g_bNoLoginLia)
  10865. {
  10866. Login dlg;
  10867. dlg.SetLiaPath("5.lia");
  10868. dlg.DoModal();
  10869. }
  10870. else
  10871. {
  10872. Login3 dlg;
  10873. dlg.SetLiaPath("5.lia");
  10874. dlg.DoModal();
  10875. }
  10876. g_pMainWnd2->RefreshOutlookBar();
  10877. g_pMainWnd2->DrawLogin();
  10878. g_path1 = g_path1bak;
  10879. g_path2 = g_path2bak;
  10880. g_path3 = g_path3bak;
  10881. g_path4 = g_path4bak;
  10882. g_path5 = g_path5bak;
  10883. g_path6 = g_path6bak;
  10884. g_path7 = g_path7bak;
  10885. g_pMainWnd2->EnableBtns(1);
  10886. }
  10887. else
  10888. {
  10889. BOOL bNeedCheckRights = 1;
  10890. if (g_user.bLongin && g_branchname == "")//无需登陆本店判断其访问分店权限
  10891. {
  10892. bNeedCheckRights = 0;
  10893. }
  10894. #ifndef SQLSERVER_VERSION
  10895. if ((g_menubranchname.GetSize() * 2) == nID - 2000)//多店数据汇总
  10896. #else
  10897. if ((g_menubranchname.GetSize()) == nID - 2000)//多店数据汇总
  10898. #endif
  10899. {
  10900. g_branchname.Empty();
  10901. g_branchip.Empty();
  10902. g_bBranchModify = 0;
  10903. if (bNeedCheckRights)
  10904. {
  10905. g_user.bLongin = 0;
  10906. if (g_user.bLongin == 0)
  10907. {
  10908. if (g_bNoLoginLia)
  10909. {
  10910. Login dlg;
  10911. dlg.SetLiaPath("5.lia");
  10912. dlg.DoModal();
  10913. }
  10914. else
  10915. {
  10916. Login3 dlg;
  10917. dlg.SetLiaPath("5.lia");
  10918. dlg.DoModal();
  10919. }
  10920. if (g_user.bLongin == 0)return;
  10921. }
  10922. }
  10923. if (IsHasRightsnew(28) == 0)
  10924. {
  10925. return;
  10926. }
  10927. g_bAllBranch = 1; g_pMainWnd2->ShowBar(0);
  10928. g_pMainWnd2->RefreshOutlookBar2();
  10929. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10930. g_branchname.Empty();
  10931. g_branchip.Empty();
  10932. g_bBranchModify = 0;
  10933. g_pMainWnd2->DrawLogin();
  10934. g_pMainWnd2->EnableBtns(0);
  10935. g_path1 = g_path1bak;
  10936. g_path2 = g_path2bak;
  10937. g_path3 = g_path3bak;
  10938. g_path4 = g_path4bak;
  10939. g_path5 = g_path5bak;
  10940. g_path6 = g_path6bak;
  10941. g_path7 = g_path7bak;
  10942. }
  10943. else
  10944. {
  10945. if (bNeedCheckRights)
  10946. {
  10947. g_branchname.Empty();
  10948. g_branchip.Empty();
  10949. g_bBranchModify = 0;
  10950. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_UNCHECKED);
  10951. g_user.bLongin = 0;
  10952. if (g_pMainWnd2)
  10953. {
  10954. g_pMainWnd2->DrawLogin();
  10955. g_pMainWnd2->ShowBar(0);
  10956. }
  10957. if (g_bNoLoginLia)
  10958. {
  10959. Login dlg;
  10960. dlg.SetLiaPath("5.lia");
  10961. dlg.DoModal();
  10962. }
  10963. else
  10964. {
  10965. Login3 dlg;
  10966. dlg.SetLiaPath("5.lia");
  10967. dlg.DoModal();
  10968. }
  10969. if (g_user.bLongin == 0)return;
  10970. }
  10971. if (IsHasRightsnew(28) == 0)
  10972. {
  10973. return;
  10974. }
  10975. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10976. #ifndef SQLSERVER_VERSION
  10977. if (nID % 2 == 0)
  10978. g_branchname = g_menubranchname.ElementAt((nID - 2000) / 2);
  10979. else
  10980. g_branchname = g_menubranchname.ElementAt((nID - 2001) / 2);
  10981. #else
  10982. g_branchname = g_menubranchname.ElementAt(nID - 2000);
  10983. #endif
  10984. //printf("选择分店:%s\n", g_branchname);
  10985. g_branchip.Empty();
  10986. CString domainname = "";
  10987. for (int i = 0; i < g_brancharray.GetSize(); i++)
  10988. {
  10989. /*
  10990. for(int j=0; j<g_brancharray.GetSize(); j++)
  10991. printf("%s\n", g_brancharray.ElementAt(i).ElementAt(j));
  10992. */
  10993. if (g_branchname == g_brancharray.ElementAt(i).ElementAt(0))
  10994. {
  10995. g_branchip = g_brancharray.ElementAt(i).ElementAt(1);
  10996. g_branchip2 = g_brancharray.ElementAt(i).ElementAt(4);
  10997. domainname = g_brancharray.ElementAt(i).ElementAt(2);
  10998. }
  10999. }
  11000. g_path1 = g_path1bak;
  11001. g_path2 = g_path2bak;
  11002. g_path3 = g_path3bak;
  11003. g_path4 = g_path4bak;
  11004. g_path5 = g_path5bak;
  11005. g_path6 = g_path6bak;
  11006. g_path7 = g_path7bak;
  11007. if (domainname.IsEmpty())
  11008. {
  11009. g_path1 = g_path2 = g_path3 = g_path4 = g_path5 = g_path6 = g_path7 = "xxx";
  11010. }
  11011. else
  11012. {
  11013. g_path1 += "\\" + domainname;
  11014. g_path2 += "\\" + domainname;
  11015. g_path3 += "\\" + domainname;
  11016. g_path4 += "\\" + domainname;
  11017. g_path5 += "\\" + domainname;
  11018. g_path6 += "\\" + domainname;
  11019. g_path7 += "\\" + domainname;
  11020. }
  11021. g_bBranchModify = 1;
  11022. /* CArray<CStringArray, CStringArray>yeararray;
  11023. for( i=0; i<g_brancharray.GetSize (); i++)
  11024. {
  11025. if(g_brancharray.ElementAt (i).ElementAt (0).Find (g_branchname)!=-1 && g_branchname!=g_brancharray.ElementAt (i).ElementAt (0))
  11026. {
  11027. int size=yeararray.GetSize ();
  11028. yeararray.SetSize(size+1,1);
  11029. CString str=g_brancharray.ElementAt (i).ElementAt (0);
  11030. str.Delete (0, g_branchname.GetLength ());
  11031. yeararray.ElementAt (size).Add (str);
  11032. }
  11033. }
  11034. AddHistoryMenu(&yeararray);*/
  11035. if (g_bBranchModify)OnDisconnect();
  11036. if (1)
  11037. {
  11038. g_user.bLongin = 0;
  11039. g_user.name.Empty();
  11040. g_user.rights.Empty();
  11041. g_user.account.Empty();
  11042. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  11043. g_pMainWnd2->RefreshOutlookBar();
  11044. m_Mdi.CloseAll();
  11045. if (g_pMainWnd2)
  11046. {
  11047. g_pMainWnd2->DrawLogin();
  11048. g_pMainWnd2->ShowBar(0);
  11049. }
  11050. if (g_bNoLoginLia)
  11051. {
  11052. Login dlg;
  11053. dlg.SetLiaPath("5.lia");
  11054. dlg.DoModal();
  11055. }
  11056. else
  11057. {
  11058. Login3 dlg;
  11059. dlg.SetLiaPath("5.lia");
  11060. dlg.DoModal();
  11061. }
  11062. if (g_user.bLongin == 0)return;
  11063. if (g_pMainWnd2)g_pMainWnd2->ShowBar(1);
  11064. }
  11065. g_pMainWnd2->DrawLogin();
  11066. g_pMainWnd2->EnableBtns(1);
  11067. }
  11068. g_nYearpos = -1;
  11069. }
  11070. #endif
  11071. }
  11072. void CMainFrame::OnStaffAchievementShow() //Jeff:此机只用于员工看业绩;
  11073. {
  11074. // TODO: Add your command handler code here
  11075. if (g_user.bLongin == 0) // 是否登陆系统;
  11076. {
  11077. if (g_bNoLoginLia)
  11078. {
  11079. Login dlg;
  11080. dlg.SetLiaPath("5.lia");
  11081. dlg.DoModal();
  11082. }
  11083. else
  11084. {
  11085. Login3 dlg;
  11086. dlg.SetLiaPath("5.lia");
  11087. dlg.DoModal();
  11088. }
  11089. if (g_user.bLongin == 0)return;
  11090. }
  11091. if (IsHasRightsnew(49) == 0)return;// 是否有权限进行设置;
  11092. CMenu *pMenu = GetMenu();
  11093. CMenu* submenu = pMenu->GetSubMenu(1);
  11094. UINT status = submenu->GetMenuState(IDM_StaffAchievementShow, MF_BYCOMMAND);
  11095. if (status&MF_CHECKED)
  11096. {
  11097. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_UNCHECKED);
  11098. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status2", 0);
  11099. g_bStaffAchievementShow = 0;
  11100. TCHAR szKey[MAX_PATH];
  11101. TCHAR szDir[MAX_PATH];
  11102. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  11103. HKEY hKey = 0;
  11104. DWORD disp = 0;
  11105. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  11106. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  11107. if (lResult == ERROR_SUCCESS)
  11108. {
  11109. RegDeleteValue(hKey, "YLGLMAINAUTORUN");
  11110. RegDeleteKey(hKey, "YLGLMAINAUTORUN");
  11111. RegCloseKey(hKey);
  11112. }
  11113. }
  11114. else
  11115. {
  11116. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  11117. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status2", 1);
  11118. g_bStaffAchievementShow = 1;
  11119. TCHAR szKey[MAX_PATH];
  11120. TCHAR szDir[MAX_PATH];
  11121. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  11122. HKEY hKey = 0;
  11123. DWORD disp = 0;
  11124. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  11125. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  11126. if (lResult == ERROR_SUCCESS)
  11127. {
  11128. lResult = RegSetValueEx(hKey, "YLGLMAINAUTORUN", 0, REG_SZ, (const unsigned char*)szDir, lstrlen(szDir));
  11129. RegCloseKey(hKey);
  11130. }
  11131. StaffAchievementSet dlg;
  11132. dlg.DoModal();
  11133. }
  11134. }
  11135. void CMainFrame::PrintDinDan2(CString m_id)
  11136. {
  11137. #ifdef MODERN_VERSION
  11138. SelContent seldlg;
  11139. if (seldlg.DoModal() != IDOK)return;
  11140. CPrintRX m_Print;
  11141. m_Print.InitToPrint(NULL, 1);
  11142. m_Print.StartPrint();
  11143. m_Print.StartPage();
  11144. // CRect StrRect(0,0,560,818);
  11145. LoadRect load;
  11146. LoadRect load2;
  11147. LoadRect load3;
  11148. load.SetLiaPath ("9.lia");
  11149. load.SetMargins(-14,0);
  11150. if(!load.Load ())return;
  11151. int i;
  11152. //////////////////////////////////////////////////////////////
  11153. CStringArray txarray;
  11154. CString filter="id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"'";
  11155. g_sendhead.code[0]=11;
  11156. g_sendhead.code[1]=52;
  11157. g_sendhead.code[2]=50;
  11158. g_sendhead.code[3]=38;
  11159. g_sendhead.code[4]=27;
  11160. g_sendhead.tabcount=5;
  11161. g_sendhead.bsql=0;
  11162. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  11163. CArray<CStringArray, CStringArray>sparray;
  11164. CArray<CStringArray, CStringArray>clientarray;
  11165. CArray<CStringArray, CStringArray>phonearray;
  11166. CArray<CStringArray, CStringArray>bukuan2array;
  11167. CArray<CStringArray, CStringArray>bukuanarray;
  11168. DataToArray(&g_List1array, &clientarray, &sparray, &bukuan2array, &bukuanarray);
  11169. CTime tm=CTime::GetCurrentTime ();
  11170. CString str;
  11171. CString m_money1 = g_List1array.ElementAt (0).ElementAt (1);
  11172. CString m_money2 = g_List1array.ElementAt (0).ElementAt (2);
  11173. CString m_money3 = g_List1array.ElementAt (0).ElementAt (3);
  11174. CString m_name1 = g_List1array.ElementAt (0).ElementAt (4);
  11175. CString m_name2 = g_List1array.ElementAt (0).ElementAt (5);
  11176. CString m_taoxiname= g_List1array.ElementAt (0).ElementAt (7);
  11177. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (8);
  11178. CString m_zs = g_List1array.ElementAt (0).ElementAt (9);
  11179. CString m_time1 = g_List1array.ElementAt (0).ElementAt (10);
  11180. CString m_time2 = g_List1array.ElementAt (0).ElementAt (11);
  11181. CString m_time3 = g_List1array.ElementAt (0).ElementAt (12);
  11182. CString m_ren = g_List1array.ElementAt (0).ElementAt (14);
  11183. CString m_discount = g_List1array.ElementAt (0).ElementAt (15);
  11184. CString m_payed1 = g_List1array.ElementAt (0).ElementAt (16);
  11185. CString m_payed2 = g_List1array.ElementAt (0).ElementAt (17);
  11186. CString m_payed3 = g_List1array.ElementAt (0).ElementAt (18);
  11187. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (19);
  11188. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (20);
  11189. CString m_time4 = g_List1array.ElementAt (0).ElementAt (21);
  11190. CString m_time5 = g_List1array.ElementAt (0).ElementAt (22);
  11191. CString m_clothescount = g_List1array.ElementAt (0).ElementAt (26);
  11192. CString m_clothescount2 = g_List1array.ElementAt (0).ElementAt (27);
  11193. CString m_outside = g_List1array.ElementAt (0).ElementAt (28);
  11194. CString m_outside2 = g_List1array.ElementAt (0).ElementAt (29);
  11195. CString m_style = g_List1array.ElementAt (0).ElementAt (30);
  11196. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (34);
  11197. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (35);
  11198. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (37);
  11199. CString m_bz = g_List1array.ElementAt (0).ElementAt (38);
  11200. CString m_phone1=clientarray.ElementAt (0).ElementAt (3);
  11201. CString m_phone2=clientarray.ElementAt (0).ElementAt (4);
  11202. CString m_addr1=clientarray.ElementAt (0).ElementAt (7);
  11203. CString m_addr2=clientarray.ElementAt (0).ElementAt (8);
  11204. CString m_occupation1=clientarray.ElementAt (0).ElementAt (9);
  11205. CString m_occupation2=clientarray.ElementAt (0).ElementAt (10);
  11206. filter="name='"+m_ren+"'";
  11207. g_sendhead.code[0]=5;
  11208. g_sendhead.tabcount=1;
  11209. g_sendhead.bsql=0;
  11210. int g_nYearposTemp=g_nYearpos;
  11211. g_nYearpos=-1;
  11212. g_pMainWnd->ProcessChatMessageRequest2(filter);
  11213. g_nYearpos=g_nYearposTemp;
  11214. if(g_bSendOK==0)return;
  11215. DataToArray(&phonearray);
  11216. m_money2.Format ("%f", atof(m_payed5)+atof(m_money1));
  11217. m_money1.Format ("%f", atof(m_taoxijiage)+atof(m_payed4));
  11218. m_money3.Format ("%f", atof(m_money1)-atof(m_money2));
  11219. ConvertToPrice(m_money1);
  11220. ConvertToPrice(m_money2);
  11221. ConvertToPrice(m_money3);
  11222. ////////////////////////////////////////////////////////////////
  11223. int rcpos=-1;
  11224. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  11225. Image *pImg=NULL;
  11226. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo2.jpg");
  11227. if(seldlg.m_bFrame)
  11228. m_Print.DrawImage(pImg, StrRect);
  11229. delete pImg;
  11230. m_Print.SetFontFace(16, 1, "黑体");
  11231. StrRect=load.m_rcarray .ElementAt (++rcpos);
  11232. if(seldlg.m_bFrame)
  11233. ///////////////////////////////不用改
  11234. m_Print.DrawText((LPTSTR)(LPCTSTR)"摩登新娘工作流程单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11235. m_Print.SetFontFace(10, 1, "宋体");
  11236. for( i=3; i<=6; i++)
  11237. {
  11238. StrRect=load.m_rcarray .ElementAt (i-1);
  11239. if(seldlg.m_bFrame)
  11240. m_Print.DrawRect2(StrRect, 1);
  11241. }
  11242. CStringArray strarray;
  11243. if(seldlg.m_bBooking==0)
  11244. {
  11245. m_name1.Empty ();
  11246. m_name2.Empty ();
  11247. m_phone1.Empty ();
  11248. m_phone2.Empty ();
  11249. m_addr1.Empty ();
  11250. m_addr2.Empty ();
  11251. m_taoxiname.Empty ();
  11252. m_taoxijiage.Empty ();
  11253. }
  11254. if(seldlg.m_bFrame )
  11255. {
  11256. strarray.Add("新郎:"+m_name1);
  11257. strarray.Add("H");
  11258. strarray.Add("O");
  11259. strarray.Add("手机:"+m_phone1);
  11260. strarray.Add("新娘:"+m_name2);
  11261. strarray.Add("H");
  11262. strarray.Add("O");
  11263. strarray.Add("手机:"+m_phone2);
  11264. }
  11265. else
  11266. {
  11267. strarray.Add(" "+m_name1);
  11268. strarray.Add("");
  11269. strarray.Add("");
  11270. strarray.Add(" "+m_phone1);
  11271. strarray.Add(" "+m_name2);
  11272. strarray.Add("");
  11273. strarray.Add("");
  11274. strarray.Add(" "+m_phone2);
  11275. }
  11276. for( i=7; i<=14; i++)
  11277. {
  11278. StrRect=load.m_rcarray .ElementAt (i-1);
  11279. StrRect.left +=2;
  11280. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11281. }
  11282. StrRect=load.m_rcarray .ElementAt (3);
  11283. StrRect.left +=2;
  11284. if(seldlg.m_bFrame)
  11285. str="地址:"+m_addr1;
  11286. else
  11287. str=" "+m_addr1;
  11288. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11289. StrRect=load.m_rcarray .ElementAt (5);
  11290. StrRect.left +=2;
  11291. if(seldlg.m_bFrame)
  11292. str="地址:"+m_addr2;
  11293. else
  11294. str=" "+m_addr2;
  11295. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11296. //////////////////////////////////////////////////////
  11297. StrRect=load.m_rcarray .ElementAt (14);
  11298. str="预\r\n约";
  11299. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11300. StrRect.top +=46;
  11301. StrRect.left +=2;
  11302. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11303. m_Print.SetFontFace(10, 1, "宋体");
  11304. StrRect=load.m_rcarray .ElementAt (15);
  11305. if(seldlg.m_bFrame)
  11306. str="套系名称:"+m_taoxiname;
  11307. else
  11308. str=" "+m_taoxiname;
  11309. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11310. StrRect.left +=4;
  11311. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11312. StrRect=load.m_rcarray .ElementAt (16);
  11313. if(seldlg.m_bFrame)
  11314. str="单价:"+m_taoxijiage;
  11315. else
  11316. str=" "+m_taoxijiage;
  11317. StrRect.left +=2;
  11318. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11319. StrRect=load.m_rcarray .ElementAt (21);
  11320. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11321. str="新人签名:";
  11322. StrRect.left +=2;
  11323. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11324. StrRect=load.m_rcarray .ElementAt (22);
  11325. if(seldlg.m_bBooking==0)
  11326. {
  11327. if(seldlg.m_bFrame)
  11328. str="未付款:";
  11329. else
  11330. str=" ";
  11331. }
  11332. else
  11333. {
  11334. if(seldlg.m_bFrame)
  11335. str="未付款:"+m_money3;
  11336. else
  11337. str=" "+m_money3;
  11338. }
  11339. StrRect.left +=2;
  11340. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11341. StrRect=load.m_rcarray .ElementAt (23);
  11342. str="结婚秘书:";
  11343. StrRect.left +=2;
  11344. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11345. StrRect=load.m_rcarray .ElementAt (24);
  11346. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11347. StrRect.left +=3;
  11348. StrRect.top +=3;
  11349. StrRect.right -=2;
  11350. StrRect.bottom -=2;
  11351. int realpos=0;str="";
  11352. for(i=0; i<sparray.GetSize (); i++)
  11353. {
  11354. if(atoi(sparray.ElementAt (i).ElementAt (4))!=1)continue;
  11355. str+=sparray.ElementAt (i).ElementAt (5);
  11356. str+=" 数量:";
  11357. str+=sparray.ElementAt (i).ElementAt (3);
  11358. if(realpos%2)
  11359. str+="\r\n";
  11360. else
  11361. str+=" ";
  11362. realpos++;
  11363. }
  11364. str.TrimRight ("\r\n");
  11365. str.TrimRight (" ");
  11366. if(seldlg.m_bBooking)AutoDraw(m_Print, StrRect, str, 1.4);
  11367. ///////////////////////////////////////////////////////////
  11368. StrRect=load.m_rcarray .ElementAt (14);
  11369. StrRect.top +=1*122;
  11370. StrRect.bottom +=1*122;
  11371. str="拍\r\n照";
  11372. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11373. StrRect.top +=46;
  11374. StrRect.left +=2;
  11375. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11376. m_Print.SetFontFace(10, 1, "宋体");
  11377. StrRect=load.m_rcarray .ElementAt (15);
  11378. StrRect.top +=1*122;
  11379. StrRect.bottom +=1*122;
  11380. str="拍照内容: 白 晚 特 便";
  11381. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11382. StrRect.left +=4;
  11383. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11384. StrRect=load.m_rcarray .ElementAt (21);
  11385. StrRect.top +=1*122;
  11386. StrRect.bottom +=1*122;
  11387. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11388. str=" 新人签名:";
  11389. StrRect.left +=2;
  11390. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11391. StrRect=load.m_rcarray .ElementAt (22);
  11392. StrRect.top +=1*122;
  11393. StrRect.bottom +=1*122;
  11394. if(seldlg.m_bTake)
  11395. {
  11396. if(seldlg.m_bFrame)
  11397. str="未付款:"+m_money3;
  11398. else
  11399. str=" "+m_money3;
  11400. }
  11401. else
  11402. {
  11403. if(seldlg.m_bFrame)
  11404. str="未付款:";
  11405. else
  11406. str=" ";
  11407. }
  11408. StrRect.left +=2;
  11409. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11410. StrRect=load.m_rcarray .ElementAt (23);
  11411. StrRect.top +=1*122;
  11412. StrRect.bottom +=1*122;
  11413. str="结婚秘书:";
  11414. StrRect.left +=2;
  11415. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11416. StrRect=load.m_rcarray .ElementAt (24);
  11417. StrRect.top +=1*122;
  11418. StrRect.bottom +=1*122;
  11419. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11420. StrRect.left +=3;
  11421. StrRect.top +=3;
  11422. StrRect.right -=2;
  11423. StrRect.bottom -=2;
  11424. if(seldlg.m_bTake)
  11425. {
  11426. str="";
  11427. for(i=0; i<bukuan2array.GetSize (); i++)
  11428. {
  11429. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=1)continue;
  11430. str+="加挑: ";
  11431. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11432. str+="\r\n";
  11433. }
  11434. str.TrimRight ("\r\n");
  11435. str.TrimRight (" ");
  11436. AutoDraw(m_Print, StrRect, str, 1.4);
  11437. }
  11438. ///////////////////////////////////////////////////////////
  11439. StrRect=load.m_rcarray .ElementAt (14);
  11440. StrRect.top +=2*122;
  11441. StrRect.bottom +=2*122;
  11442. str="选\r\n样";
  11443. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11444. StrRect.top +=46;
  11445. StrRect.left +=2;
  11446. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11447. m_Print.SetFontFace(10, 1, "宋体");
  11448. StrRect=load.m_rcarray .ElementAt (15);
  11449. StrRect.top +=2*122;
  11450. StrRect.bottom +=2*122;
  11451. str="选片内容:";
  11452. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11453. StrRect.left +=4;
  11454. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11455. StrRect=load.m_rcarray .ElementAt (21);
  11456. StrRect.top +=2*122;
  11457. StrRect.bottom +=2*122;
  11458. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11459. str=" 新人签名:";
  11460. StrRect.left +=2;
  11461. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11462. StrRect=load.m_rcarray .ElementAt (22);
  11463. StrRect.top +=2*122;
  11464. StrRect.bottom +=2*122;
  11465. if(seldlg.m_bChoose)
  11466. {
  11467. if(seldlg.m_bFrame)
  11468. str="未付款:"+m_money3;
  11469. else
  11470. str=" "+m_money3;
  11471. }
  11472. else
  11473. {
  11474. if(seldlg.m_bFrame)
  11475. str="未付款:";
  11476. else
  11477. str=" ";
  11478. }
  11479. StrRect.left +=2;
  11480. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11481. StrRect=load.m_rcarray .ElementAt (23);
  11482. StrRect.top +=2*122;
  11483. StrRect.bottom +=2*122;
  11484. str="结婚秘书:";
  11485. StrRect.left +=2;
  11486. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11487. StrRect=load.m_rcarray .ElementAt (24);
  11488. StrRect.top +=2*122;
  11489. StrRect.bottom +=2*122;
  11490. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11491. if(seldlg.m_bChoose)
  11492. {
  11493. StrRect.left +=3;
  11494. StrRect.top +=3;
  11495. StrRect.right -=2;
  11496. StrRect.bottom -=2;
  11497. str="";
  11498. for(i=0; i<bukuan2array.GetSize (); i++)
  11499. {
  11500. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=2)continue;
  11501. str+="加挑: ";
  11502. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11503. str+="\r\n";
  11504. }
  11505. str.TrimRight ("\r\n");
  11506. str.TrimRight (" ");
  11507. AutoDraw(m_Print, StrRect, str, 1.4);
  11508. }
  11509. ///////////////////////////////////////////////////////////
  11510. StrRect=load.m_rcarray .ElementAt (14);
  11511. StrRect.top +=3*122;
  11512. StrRect.bottom +=3*122;
  11513. str="结\r\n婚";
  11514. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11515. StrRect.top +=46;
  11516. StrRect.left +=2;
  11517. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11518. m_Print.SetFontFace(10, 1, "宋体");
  11519. StrRect=load.m_rcarray .ElementAt (15);
  11520. StrRect.top +=3*122;
  11521. StrRect.bottom +=3*122;
  11522. str="结婚内容: 区 白 晚 押金:";
  11523. if(seldlg.m_bFrame) m_Print.DrawRect2(StrRect, 1);
  11524. StrRect.left +=4;
  11525. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11526. StrRect=load.m_rcarray .ElementAt (21);
  11527. StrRect.top +=3*122;
  11528. StrRect.bottom +=3*122;
  11529. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11530. str=" 新人签名:";
  11531. StrRect.left +=2;
  11532. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11533. StrRect=load.m_rcarray .ElementAt (22);
  11534. StrRect.top +=3*122;
  11535. StrRect.bottom +=3*122;
  11536. if(seldlg.m_bBooking)
  11537. {
  11538. if(seldlg.m_bFrame)
  11539. str="未付款:"+m_money3;
  11540. else
  11541. str=" "+m_money3;
  11542. }
  11543. else
  11544. {
  11545. if(seldlg.m_bFrame)
  11546. str="未付款:";
  11547. else
  11548. str=" ";
  11549. }
  11550. StrRect.left +=2;
  11551. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11552. StrRect=load.m_rcarray .ElementAt (23);
  11553. StrRect.top +=3*122;
  11554. StrRect.bottom +=3*122;
  11555. str="结婚秘书:";
  11556. StrRect.left +=2;
  11557. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11558. StrRect=load.m_rcarray .ElementAt (24);
  11559. StrRect.top +=3*122;
  11560. StrRect.bottom +=3*122;
  11561. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11562. if(seldlg.m_bBooking)
  11563. {
  11564. StrRect.left +=3;
  11565. StrRect.top +=3;
  11566. StrRect.right -=2;
  11567. StrRect.bottom -=2;
  11568. realpos=0;str="";
  11569. for(i=0; i<sparray.GetSize (); i++)
  11570. {
  11571. if(atoi(sparray.ElementAt (i).ElementAt (4))!=2)continue;
  11572. str+=sparray.ElementAt (i).ElementAt (5);
  11573. str+=" 数量:";
  11574. str+=sparray.ElementAt (i).ElementAt (3);
  11575. if(realpos%2)
  11576. str+="\r\n";
  11577. else
  11578. str+=" ";
  11579. realpos++;
  11580. }
  11581. str.TrimRight ("\r\n");
  11582. str.TrimRight (" ");
  11583. AutoDraw(m_Print, StrRect, str, 1.4);
  11584. }
  11585. ///////////////////////////////////////
  11586. strarray.RemoveAll ();
  11587. if(seldlg.m_bFrame)
  11588. {
  11589. strarray.Add ("项目");
  11590. strarray.Add ("万");
  11591. strarray.Add ("千");
  11592. strarray.Add ("百");
  11593. strarray.Add ("十");
  11594. strarray.Add ("个");
  11595. strarray.Add ("收 银");
  11596. }
  11597. else
  11598. {
  11599. strarray.Add ("");
  11600. strarray.Add ("");
  11601. strarray.Add ("");
  11602. strarray.Add ("");
  11603. strarray.Add ("");
  11604. strarray.Add ("");
  11605. strarray.Add ("");
  11606. }
  11607. CStringArray strarray2;
  11608. float ftotal=0;
  11609. int realcount=0;
  11610. if(seldlg.m_bBooking)
  11611. {
  11612. for(i=0; i<bukuanarray.GetSize (); i++)
  11613. {
  11614. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=3 && atoi(bukuanarray.ElementAt (i).ElementAt (6))!=4)continue;
  11615. realcount++;
  11616. if(realcount>6)break;
  11617. str=bukuanarray.ElementAt (i).ElementAt (1);
  11618. ftotal+=atof(str);
  11619. strarray2.Add (GetW(str));
  11620. strarray2.Add (GetK(str));
  11621. strarray2.Add (GetB(str));
  11622. strarray2.Add (GetS(str));
  11623. strarray2.Add (GetG(str));
  11624. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11625. }
  11626. }
  11627. while(strarray2.GetSize ()<36)
  11628. strarray2.Add ("");
  11629. str.Format ("%f", ftotal);
  11630. strarray2.Add (GetW(str));
  11631. strarray2.Add (GetK(str));
  11632. strarray2.Add (GetB(str));
  11633. strarray2.Add (GetS(str));
  11634. strarray2.Add (GetG(str));
  11635. strarray2.Add ("");
  11636. //拍照
  11637. ftotal=0;
  11638. realcount=0;
  11639. if(seldlg.m_bTake)
  11640. {
  11641. for(i=0; i<bukuanarray.GetSize (); i++)
  11642. {
  11643. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=1)continue;
  11644. realcount++;
  11645. if(realcount>6)break;
  11646. str=bukuanarray.ElementAt (i).ElementAt (1);
  11647. ftotal+=atof(str);
  11648. strarray2.Add (GetW(str));
  11649. strarray2.Add (GetK(str));
  11650. strarray2.Add (GetB(str));
  11651. strarray2.Add (GetS(str));
  11652. strarray2.Add (GetG(str));
  11653. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11654. }
  11655. }
  11656. while(strarray2.GetSize ()<42+36)
  11657. strarray2.Add ("");
  11658. str.Format ("%f", ftotal);
  11659. strarray2.Add (GetW(str));
  11660. strarray2.Add (GetK(str));
  11661. strarray2.Add (GetB(str));
  11662. strarray2.Add (GetS(str));
  11663. strarray2.Add (GetG(str));
  11664. strarray2.Add ("");
  11665. //选片
  11666. ftotal=0;
  11667. realcount=0;
  11668. if(seldlg.m_bChoose)
  11669. {
  11670. for(i=0; i<bukuanarray.GetSize (); i++)
  11671. {
  11672. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=2)continue;
  11673. realcount++;
  11674. if(realcount>6)break;
  11675. str=bukuanarray.ElementAt (i).ElementAt (1);
  11676. ftotal+=atof(str);
  11677. strarray2.Add (GetW(str));
  11678. strarray2.Add (GetK(str));
  11679. strarray2.Add (GetB(str));
  11680. strarray2.Add (GetS(str));
  11681. strarray2.Add (GetG(str));
  11682. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11683. }
  11684. }
  11685. while(strarray2.GetSize ()<42*2+36)
  11686. strarray2.Add ("");
  11687. str.Format ("%f", ftotal);
  11688. strarray2.Add (GetW(str));
  11689. strarray2.Add (GetK(str));
  11690. strarray2.Add (GetB(str));
  11691. strarray2.Add (GetS(str));
  11692. strarray2.Add (GetG(str));
  11693. strarray2.Add ("");
  11694. /////////////////////////////
  11695. CRect temprc;
  11696. for(int n=0; n<4; n++)
  11697. {
  11698. StrRect=load.m_rcarray .ElementAt (17);
  11699. StrRect.top +=n*122;
  11700. StrRect.bottom +=n*122;
  11701. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11702. StrRect=load.m_rcarray .ElementAt (18);
  11703. if(n)
  11704. {
  11705. StrRect.left +=36;
  11706. StrRect.right +=36;
  11707. }
  11708. StrRect.top +=n*122;
  11709. StrRect.bottom +=n*122;
  11710. if(seldlg.m_bFrame)
  11711. str.Format("%d年", tm.GetYear ());
  11712. else
  11713. str.Format("%d ", tm.GetYear ());
  11714. if( (seldlg.m_bBooking==0 && n==3) ||(seldlg.m_bBooking==0 && n==0) || (seldlg.m_bTake==0 && n==1) || (seldlg.m_bChoose==0 && n==2))
  11715. {
  11716. if(seldlg.m_bFrame)
  11717. str=" 年";
  11718. else
  11719. str=" ";
  11720. }
  11721. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11722. StrRect=load.m_rcarray .ElementAt (19);
  11723. if(n)
  11724. {
  11725. StrRect.left +=38;
  11726. StrRect.right +=38;
  11727. }
  11728. StrRect.top +=n*122;
  11729. StrRect.bottom +=n*122;
  11730. if(seldlg.m_bFrame)
  11731. str.Format("%02d月", tm.GetMonth ());
  11732. else
  11733. str.Format("%02d ", tm.GetMonth ());
  11734. if( (seldlg.m_bBooking==0 && n==3) ||(seldlg.m_bBooking==0 && n==0) || (seldlg.m_bTake==0 && n==1) || (seldlg.m_bChoose==0 && n==2))
  11735. {
  11736. if(seldlg.m_bFrame)
  11737. str=" 月";
  11738. else
  11739. str=" ";
  11740. }
  11741. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11742. StrRect=load.m_rcarray .ElementAt (20);
  11743. if(n)
  11744. {
  11745. StrRect.left +=36;
  11746. StrRect.right +=36;
  11747. }
  11748. StrRect.top +=n*122;
  11749. StrRect.bottom +=n*122;
  11750. if(seldlg.m_bFrame)
  11751. str.Format("%02d日", tm.GetDay ());
  11752. else
  11753. str.Format("%02d ", tm.GetDay ());
  11754. if( (seldlg.m_bBooking==0 && n==3) ||(seldlg.m_bBooking==0 && n==0) || (seldlg.m_bTake==0 && n==1) || (seldlg.m_bChoose==0 && n==2))
  11755. {
  11756. if(seldlg.m_bFrame)
  11757. str=" 日";
  11758. else
  11759. str=" ";
  11760. }
  11761. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11762. for(i=26; i<=32; i++)
  11763. {
  11764. StrRect=load.m_rcarray .ElementAt (i-1);
  11765. StrRect.bottom -=14;
  11766. for(int j=0; j<8; j++)
  11767. {
  11768. StrRect.top=StrRect.bottom;
  11769. if(j>2)
  11770. {
  11771. StrRect.bottom =StrRect.top+14;
  11772. }
  11773. else
  11774. {
  11775. StrRect.bottom =StrRect.top+13;
  11776. }
  11777. temprc=StrRect;
  11778. StrRect.top +=n*122;
  11779. StrRect.bottom +=n*122;
  11780. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11781. if(i==26 && j==4 && seldlg.m_bFrame)
  11782. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11783. else if(i==26 && j==5 && seldlg.m_bFrame)
  11784. m_Print.DrawText((LPTSTR)(LPCTSTR)"付款", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11785. else if(i==26 && j==7 && seldlg.m_bFrame)
  11786. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11787. else if(j==0)
  11788. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-26), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11789. else if(j && i>26 && n<3)
  11790. {
  11791. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray2.ElementAt ((j-1)*6+(i-27)+n*42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11792. }
  11793. StrRect=temprc;
  11794. }
  11795. }
  11796. }
  11797. if(seldlg.m_bFrame)
  11798. {
  11799. StrRect=load.m_rcarray .ElementAt (32);
  11800. str="注\r\n意\r\n事\r\n项";
  11801. StrRect.top +=367;
  11802. StrRect.bottom +=367;
  11803. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11804. StrRect.top +=17;
  11805. StrRect.left +=2;
  11806. AutoDraw(m_Print, StrRect, str, 1.4);
  11807. StrRect=load.m_rcarray .ElementAt (33);
  11808. str="1: 本预约单自预定日期起一年内有效.定金在拍照套系金额中扣出.预定金一概不退\r\n\
  11809. 2: 多拍照片只供筛选.恕不奉送.版权所有.不得私自拷贝\r\n\
  11810. 3: 拍照款请于拍照时一次付清\r\n\
  11811. 4: 新娘装AM8:00前钟点费另计.婚纱礼服出租押金500-2000元\r\n\
  11812. 5: 本公司设有豪华VIP礼服区.及皇家御用礼服展区.但需另外加价.详情请咨本店人员\r\n\
  11813. 6: 安瓶, 美甲一次性化妆用具等均属增值服务部分,则需另外加价,详情咨询本店工作人员\r\n\
  11814. 7: 本电脑机械故障导致文件资料丢失.本公司只提供补拍服务\r\n\
  11815. 8: 每次前来请务必携带本单交给工作人员.本单是您在摩登新娘拍照的凭证.办理有关手续凭本单办理盖\r\n\
  11816. 章后方可生效";
  11817. StrRect.top +=367;
  11818. StrRect.bottom +=367;
  11819. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11820. StrRect.top +=4;
  11821. StrRect.left +=2;
  11822. AutoDraw(m_Print, StrRect, str, 1.0);
  11823. StrRect=load.m_rcarray .ElementAt (34);
  11824. str="第\r\n一\r\n联\r\n:\r\n存\r\n根\r\n(\r\n白\r\n色\r\n)\r\n \r\n \r\n \r\n第\r\n二\r\n联\r\n:\r\n客\r\n户\r\n联\r\n(\r\n红\r\n色\r\n)\r\n \r\n \r\n \r\n第\r\n三\r\n联\r\n:\r\n作\r\n业\r\n联\r\n(\r\n绿\r\n色\r\n)";
  11825. AutoDraw(m_Print, StrRect, str, 1.0);
  11826. m_Print.SetFontFace(13, 1, "宋体");
  11827. StrRect=load.m_rcarray .ElementAt (35);
  11828. str="地 址: 汉口 . 解放大道 . 头道街东部购物公园C栋二,三层";
  11829. StrRect.top +=367;
  11830. StrRect.bottom +=367;
  11831. StrRect.left +=2;
  11832. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11833. StrRect=load.m_rcarray .ElementAt (36);
  11834. str="喜讯热线: 027-81888799 81888599 81888699";
  11835. StrRect.top +=367;
  11836. StrRect.bottom +=367;
  11837. StrRect.left +=2;
  11838. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11839. }
  11840. PrintPreview dlg;
  11841. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  11842. dlg.m_pDC =m_Print.GetPDC() ;
  11843. if(dlg.DoModal ()!=IDOK)return;
  11844. //结束打印
  11845. m_Print.EndPage();
  11846. m_Print.EndPrint();
  11847. #endif
  11848. }
  11849. extern CString GetHMoney(CString str);
  11850. void CMainFrame::PrintReceipt3(CString strOrderNumber, CStringArray *pArray, float money)
  11851. {
  11852. int printcot = 1;
  11853. for (int aa = 0; aa < printcot; aa++)
  11854. {
  11855. g_sendhead.bsql = 0;
  11856. g_sendhead.code[0] = 24;
  11857. g_sendhead.tabcount = 1;
  11858. int g_nYearposTemp = g_nYearpos;
  11859. g_nYearpos = -1;
  11860. g_pMainWnd->ProcessChatMessageRequest2(1);
  11861. g_nYearpos = g_nYearposTemp;
  11862. if (0 == g_bSendOK)return;
  11863. DataToArray(&g_cominfoarray);
  11864. CString SerialNo;
  11865. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  11866. CPrintRX m_Print;
  11867. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  11868. {
  11869. m_Print.InitToPrint(NULL, 1);
  11870. }
  11871. else
  11872. {
  11873. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  11874. if (name.IsEmpty())
  11875. m_Print.InitToPrint(NULL, 1);
  11876. else
  11877. {
  11878. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  11879. if (nret == -1 && aa == 0)
  11880. {
  11881. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  11882. }
  11883. }
  11884. }
  11885. m_Print.StartPrint();
  11886. m_Print.StartPage();
  11887. LoadRect load;
  11888. load.SetLiaPath("15.lia");
  11889. load.SetMargins(0, 0);
  11890. if (!load.Load())return;
  11891. int i;
  11892. //////////////////////////////////////////////////////////////
  11893. CStringArray txarray;
  11894. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  11895. g_sendhead.code[0] = 11;
  11896. g_sendhead.code[1] = 52;
  11897. g_sendhead.tabcount = 2;
  11898. g_sendhead.bsql = 0;
  11899. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  11900. CArray<CStringArray, CStringArray>sparray;
  11901. CArray<CStringArray, CStringArray>clientarray;
  11902. DataToArray(&g_List1array, &clientarray);
  11903. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  11904. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  11905. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  11906. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  11907. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  11908. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  11909. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  11910. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  11911. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  11912. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  11913. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  11914. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  11915. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  11916. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  11917. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  11918. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  11919. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  11920. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  11921. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  11922. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  11923. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  11924. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  11925. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  11926. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  11927. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  11928. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  11929. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  11930. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  11931. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  11932. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  11933. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  11934. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  11935. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  11936. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  11937. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  11938. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  11939. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  11940. CString m_addr = m_addr1 + ";";
  11941. m_addr.TrimLeft(";");
  11942. m_addr += m_addr2;
  11943. CString m_qq = m_qq1 + ";";
  11944. m_qq.TrimLeft(";");
  11945. m_qq += m_qq2;
  11946. m_money1.Format("%f", atof(m_taoxijiage));
  11947. m_money2.Format("%f", atof(m_payed1));
  11948. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  11949. ConvertToPrice(m_money1);
  11950. ConvertToPrice(m_money2);
  11951. ConvertToPrice(m_money3);
  11952. ////////////////////////////////////////////////////////////////
  11953. int rcpos = -1;
  11954. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  11955. m_Print.SetFontFace(17, 1, "宋体");
  11956. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11957. StrRect.top -= 0;
  11958. StrRect.bottom -= 10;
  11959. StrRect.left -= 140;
  11960. StrRect.right = StrRect.left + 48;
  11961. m_Print.SetFontFace(15, 1, "宋体");
  11962. m_Print.SetColor(0xffffff);
  11963. m_Print.DrawRect(StrRect, 0);
  11964. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11965. StrRect.left = StrRect.right;
  11966. StrRect.right = StrRect.left + 48;
  11967. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  11968. m_Print.SetColor(0, RGB(255, 0, 0));
  11969. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11970. m_Print.SetColor(0);
  11971. m_Print.SetFontFace(12, 1, "宋体");
  11972. StrRect.left -= 48;
  11973. int hei = StrRect.Height();
  11974. StrRect.top = StrRect.bottom + 2;
  11975. StrRect.bottom += hei + 2;
  11976. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11977. StrRect.top = StrRect.bottom - 2;
  11978. StrRect.bottom += hei - 5;
  11979. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  11980. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11981. m_Print.SetFontFace(12, 1, "宋体");
  11982. m_Print.DrawText((LPTSTR)(LPCTSTR)"收款单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11983. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11984. m_Print.SetFontFace(9, 1, "宋体");
  11985. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11986. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11987. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11988. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11989. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11990. m_Print.DrawRect2(StrRect, 2);
  11991. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11992. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11993. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11994. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11995. m_Print.DrawRect2(StrRect, 2);
  11996. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11997. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11998. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11999. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12000. m_Print.DrawRect2(StrRect, 2);
  12001. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12002. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约地点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12003. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12004. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12005. m_Print.DrawRect2(StrRect, 2);
  12006. ////////////
  12007. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12008. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12009. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12010. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12011. m_Print.DrawRect2(StrRect, 2);
  12012. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12013. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12014. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12015. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12016. m_Print.DrawRect2(StrRect, 2);
  12017. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12018. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12019. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12020. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12021. m_Print.DrawRect2(StrRect, 2);
  12022. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12023. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12024. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12025. m_Print.DrawText((LPTSTR)(LPCTSTR)g_date, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12026. m_Print.DrawRect2(StrRect, 2);
  12027. for (i = 19; i < 49; i++)
  12028. {
  12029. if (i >= 44)
  12030. {
  12031. StrRect = load.m_rcarray.ElementAt(i - 5);
  12032. int hei = StrRect.Height();
  12033. StrRect.top += hei;
  12034. StrRect.bottom += hei;
  12035. }
  12036. else
  12037. StrRect = load.m_rcarray.ElementAt(i);
  12038. m_Print.DrawRect2(StrRect, 1);
  12039. }
  12040. float fmoney = 0;
  12041. for (i = 19; i < 49; i++)
  12042. {
  12043. if (i >= 44)
  12044. {
  12045. StrRect = load.m_rcarray.ElementAt(i - 5);
  12046. int hei = StrRect.Height();
  12047. StrRect.top += hei;
  12048. StrRect.bottom += hei;
  12049. }
  12050. else
  12051. StrRect = load.m_rcarray.ElementAt(i);
  12052. StrRect.left += 2;
  12053. /* if((i-19)%5==2)
  12054. {
  12055. fmoney+=atof(pArray->ElementAt (i-19));
  12056. }*/
  12057. m_Print.DrawText((LPTSTR)(LPCTSTR)(pArray->ElementAt(i - 19)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12058. }
  12059. m_money2.Format("%f", money);
  12060. ConvertToPrice(m_money2);
  12061. StrRect = load.m_rcarray.ElementAt(44);
  12062. CString str;
  12063. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 实收¥: %s 元 收银员: %s", \
  12064. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  12065. m_money2, g_user.name);
  12066. m_Print.DrawRect2(StrRect, 1);
  12067. StrRect.left += 3;
  12068. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12069. StrRect = load.m_rcarray.ElementAt(46);
  12070. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12071. StrRect = load.m_rcarray.ElementAt(47);
  12072. m_Print.DrawRect2(StrRect, 2);
  12073. StrRect = load.m_rcarray.ElementAt(48);
  12074. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12075. StrRect = load.m_rcarray.ElementAt(45);
  12076. str = "\
  12077. 顾客须知\r\n\
  12078. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  12079. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  12080. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  12081. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  12082. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  12083. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  12084. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  12085. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12086. AutoDraw(m_Print, StrRect, str, 1.8);
  12087. PrintPreview dlg;
  12088. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12089. dlg.m_pDC = m_Print.GetPDC();
  12090. if (aa == 0)
  12091. {
  12092. if (dlg.DoModal() != IDOK)
  12093. return;
  12094. printcot = dlg.m_num;
  12095. }
  12096. //结束打印
  12097. m_Print.EndPage();
  12098. m_Print.EndPrint();
  12099. }
  12100. }
  12101. void CMainFrame::PrintReceipt2(CString strOrderNumber)
  12102. {
  12103. int printcot = 1;
  12104. for (int aa = 0; aa < printcot; aa++)
  12105. {
  12106. g_sendhead.bsql = 0;
  12107. g_sendhead.code[0] = 24;
  12108. g_sendhead.tabcount = 1;
  12109. int g_nYearposTemp = g_nYearpos;
  12110. g_nYearpos = -1;
  12111. g_pMainWnd->ProcessChatMessageRequest2(1);
  12112. g_nYearpos = g_nYearposTemp;
  12113. if (0 == g_bSendOK)return;
  12114. DataToArray(&g_cominfoarray);
  12115. CString SerialNo;
  12116. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  12117. CPrintRX m_Print;
  12118. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12119. {
  12120. m_Print.InitToPrint(NULL, 1);
  12121. }
  12122. else
  12123. {
  12124. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  12125. if (name.IsEmpty())
  12126. m_Print.InitToPrint(NULL, 1);
  12127. else
  12128. {
  12129. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12130. if (nret == -1 && aa == 0)
  12131. {
  12132. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12133. }
  12134. }
  12135. }
  12136. m_Print.StartPrint();
  12137. m_Print.StartPage();
  12138. LoadRect load;
  12139. load.SetLiaPath("14.lia");
  12140. load.SetMargins(0, 0);
  12141. if (!load.Load())return;
  12142. int i;
  12143. //////////////////////////////////////////////////////////////
  12144. CStringArray txarray;
  12145. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  12146. g_sendhead.code[0] = 11;
  12147. g_sendhead.code[1] = 52;
  12148. g_sendhead.code[2] = 93;
  12149. g_sendhead.tabcount = 3;
  12150. g_sendhead.bsql = 0;
  12151. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12152. CArray<CStringArray, CStringArray>sparray;
  12153. CArray<CStringArray, CStringArray>clientarray;
  12154. CArray<CStringArray, CStringArray>moneyarray;
  12155. DataToArray(&g_List1array, &clientarray, &moneyarray);
  12156. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12157. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12158. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12159. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12160. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12161. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  12162. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12163. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12164. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12165. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12166. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12167. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12168. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12169. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12170. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12171. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12172. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12173. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12174. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12175. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12176. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12177. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12178. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12179. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12180. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12181. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12182. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12183. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12184. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  12185. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12186. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12187. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  12188. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  12189. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  12190. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  12191. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  12192. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  12193. CString m_addr = m_addr1 + ";";
  12194. m_addr.TrimLeft(";");
  12195. m_addr += m_addr2;
  12196. CString m_qq = m_qq1 + ";";
  12197. m_qq.TrimLeft(";");
  12198. m_qq += m_qq2;
  12199. m_money1.Format("%f", atof(m_taoxijiage));
  12200. m_money2 = "0";
  12201. for (i = 0; i < moneyarray.GetSize(); i++)
  12202. {
  12203. if (moneyarray.ElementAt(i).ElementAt(5) == "预约收款")
  12204. m_money2 = moneyarray.ElementAt(i).ElementAt(1);
  12205. }
  12206. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  12207. ConvertToPrice(m_money1);
  12208. ConvertToPrice(m_money2);
  12209. ConvertToPrice(m_money3);
  12210. ////////////////////////////////////////////////////////////////
  12211. int rcpos = -1;
  12212. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12213. m_Print.SetFontFace(17, 1, "宋体");
  12214. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12215. StrRect.top -= 0;
  12216. StrRect.bottom -= 10;
  12217. StrRect.left -= 140;
  12218. StrRect.right = StrRect.left + 48;
  12219. m_Print.SetFontFace(15, 1, "宋体");
  12220. m_Print.SetColor(0xffffff);
  12221. m_Print.DrawRect(StrRect, 0);
  12222. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12223. StrRect.left = StrRect.right;
  12224. StrRect.right = StrRect.left + 48;
  12225. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12226. m_Print.SetColor(0, RGB(255, 0, 0));
  12227. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12228. m_Print.SetColor(0);
  12229. m_Print.SetFontFace(12, 1, "宋体");
  12230. StrRect.left -= 48;
  12231. int hei = StrRect.Height();
  12232. StrRect.top = StrRect.bottom + 2;
  12233. StrRect.bottom += hei + 2;
  12234. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12235. StrRect.top = StrRect.bottom - 2;
  12236. StrRect.bottom += hei - 5;
  12237. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12238. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12239. m_Print.SetFontFace(12, 1, "宋体");
  12240. m_Print.DrawText((LPTSTR)(LPCTSTR)"定金单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12241. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12242. m_Print.SetFontFace(9, 1, "宋体");
  12243. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12244. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12245. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12246. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12247. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12248. m_Print.DrawRect2(StrRect, 2);
  12249. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12250. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12251. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12252. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12253. m_Print.DrawRect2(StrRect, 2);
  12254. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12255. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12256. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12257. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12258. m_Print.DrawRect2(StrRect, 2);
  12259. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12260. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约地点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12261. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12262. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12263. m_Print.DrawRect2(StrRect, 2);
  12264. ////////////
  12265. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12266. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12267. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12268. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12269. m_Print.DrawRect2(StrRect, 2);
  12270. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12271. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12272. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12273. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12274. m_Print.DrawRect2(StrRect, 2);
  12275. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12276. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12277. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12278. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12279. m_Print.DrawRect2(StrRect, 2);
  12280. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12281. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12282. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12283. m_Print.DrawText((LPTSTR)(LPCTSTR)g_date, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12284. m_Print.DrawRect2(StrRect, 2);
  12285. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12286. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客地址:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12287. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12288. m_Print.DrawText((LPTSTR)(LPCTSTR)m_addr, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12289. m_Print.DrawRect2(StrRect, 2);
  12290. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12291. m_Print.DrawText((LPTSTR)(LPCTSTR)"大婚时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12292. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12293. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12294. m_Print.DrawRect2(StrRect, 2);
  12295. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12296. m_Print.DrawText((LPTSTR)(LPCTSTR)"QQ/MSN:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12297. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12298. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12299. m_Print.DrawRect2(StrRect, 2);
  12300. CStringArray strarray;
  12301. strarray.Add("套系名称");
  12302. strarray.Add("总 额");
  12303. strarray.Add("定 金");
  12304. strarray.Add("余 款");
  12305. strarray.Add("摄影日期");
  12306. strarray.Add(m_taoxiname);
  12307. strarray.Add(m_money1);
  12308. strarray.Add(m_money2);
  12309. strarray.Add(m_money3);
  12310. strarray.Add(m_time2);
  12311. for (i = 25; i < 37; i++)
  12312. {
  12313. StrRect = load.m_rcarray.ElementAt(i);
  12314. m_Print.DrawRect2(StrRect, 1);
  12315. }
  12316. for (i = 25; i < 35; i++)
  12317. {
  12318. StrRect = load.m_rcarray.ElementAt(i);
  12319. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 25), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12320. }
  12321. StrRect = load.m_rcarray.ElementAt(35);
  12322. StrRect.left += 5;
  12323. StrRect.top += 5;
  12324. m_Print.DrawText((LPTSTR)(LPCTSTR)" 备 注:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  12325. StrRect = load.m_rcarray.ElementAt(36);
  12326. CString str;
  12327. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 ¥: %s 元 收银员: %s", \
  12328. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  12329. m_money2, g_user.name);
  12330. StrRect.left += 3;
  12331. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12332. StrRect = load.m_rcarray.ElementAt(38);
  12333. m_Print.DrawText((LPTSTR)(LPCTSTR)"营业员:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12334. StrRect = load.m_rcarray.ElementAt(39);
  12335. m_Print.DrawText((LPTSTR)(LPCTSTR)m_ren, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12336. m_Print.DrawRect2(StrRect, 2);
  12337. StrRect = load.m_rcarray.ElementAt(40);
  12338. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12339. StrRect = load.m_rcarray.ElementAt(41);
  12340. m_Print.DrawRect2(StrRect, 2);
  12341. StrRect = load.m_rcarray.ElementAt(42);
  12342. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12343. StrRect = load.m_rcarray.ElementAt(37);
  12344. str = "\
  12345. 顾客须知\r\n\
  12346. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  12347. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  12348. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  12349. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  12350. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  12351. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  12352. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  12353. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12354. AutoDraw(m_Print, StrRect, str, 1.8);
  12355. PrintPreview dlg;
  12356. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12357. dlg.m_pDC = m_Print.GetPDC();
  12358. if (aa == 0)
  12359. {
  12360. if (dlg.DoModal() != IDOK)
  12361. return;
  12362. printcot = dlg.m_num;
  12363. }
  12364. //结束打印
  12365. m_Print.EndPage();
  12366. m_Print.EndPrint();
  12367. }
  12368. }
  12369. void CMainFrame::OnAutodelphoto()
  12370. {
  12371. // TODO: Add your command handler code here
  12372. if (g_user.bLongin == 0)
  12373. {
  12374. if (g_bNoLoginLia)
  12375. {
  12376. Login dlg;
  12377. dlg.SetLiaPath("5.lia");
  12378. dlg.DoModal();
  12379. }
  12380. else
  12381. {
  12382. Login3 dlg;
  12383. dlg.SetLiaPath("5.lia");
  12384. dlg.DoModal();
  12385. }
  12386. if (g_user.bLongin == 0)return;
  12387. }
  12388. if (IsHasRightsnew(49) == 0)return;
  12389. DelPhotoSet dlg;
  12390. dlg.DoModal();
  12391. }
  12392. void CMainFrame::Onphotomanage() // 客照管理中心;
  12393. {
  12394. if (g_user.bLongin == 0)
  12395. {
  12396. if (g_bNoLoginLia)
  12397. {
  12398. Login dlg;
  12399. dlg.SetLiaPath("5.lia");
  12400. dlg.DoModal();
  12401. }
  12402. else
  12403. {
  12404. Login3 dlg;
  12405. dlg.SetLiaPath("5.lia");
  12406. dlg.DoModal();
  12407. }
  12408. if (g_user.bLongin == 0)return;
  12409. }
  12410. if (IsHasRightsnew(49) == 0)return;
  12411. ShowPic3 dlg;
  12412. dlg.DoModal();
  12413. }
  12414. void CMainFrame::OnCompanyinfo()
  12415. {
  12416. // TODO: Add your command handler code here
  12417. if (g_user.bLongin == 0)
  12418. {
  12419. if (g_bNoLoginLia)
  12420. {
  12421. Login dlg;
  12422. dlg.SetLiaPath("5.lia");
  12423. dlg.DoModal();
  12424. }
  12425. else
  12426. {
  12427. Login3 dlg;
  12428. dlg.SetLiaPath("5.lia");
  12429. dlg.DoModal();
  12430. }
  12431. if (g_user.bLongin == 0)return;
  12432. }
  12433. if (IsHasRightsnew(49) == 0)return;
  12434. CompanyInfo dlg;
  12435. dlg.DoModal();
  12436. }
  12437. void CMainFrame::OnTaoxifg()
  12438. {
  12439. // TODO: Add your command handler code here
  12440. if (g_user.bLongin == 0)
  12441. {
  12442. if (g_bNoLoginLia)
  12443. {
  12444. Login dlg;
  12445. dlg.SetLiaPath("5.lia");
  12446. dlg.DoModal();
  12447. }
  12448. else
  12449. {
  12450. Login3 dlg;
  12451. dlg.SetLiaPath("5.lia");
  12452. dlg.DoModal();
  12453. }
  12454. if (g_user.bLongin == 0)return;
  12455. }
  12456. if (IsHasRightsnew(49) == 0)return;
  12457. TXFG dlg;
  12458. dlg.DoModal();
  12459. }
  12460. void CMainFrame::OnHelpfile()
  12461. {
  12462. // TODO: Add your command handler code here
  12463. // ShellExecute(NULL, _T("open"), _T(g_mainpath+"\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  12464. // if(::PathFileExists (g_mainpath+"\\zx.dll"))
  12465. // ShellExecute(NULL, _T("open"), _T("www.zcsmkj.com"), "", NULL, SW_SHOWNORMAL);
  12466. // else
  12467. ShellExecute(NULL, _T("open"), _T("www.lyfz.net"), "", NULL, SW_SHOWNORMAL);
  12468. }
  12469. void CMainFrame::OnPhotobak()
  12470. {
  12471. // TODO: Add your command handler code here
  12472. if (g_user.bLongin == 0)
  12473. {
  12474. if (g_bNoLoginLia)
  12475. {
  12476. Login dlg;
  12477. dlg.SetLiaPath("5.lia");
  12478. dlg.DoModal();
  12479. }
  12480. else
  12481. {
  12482. Login3 dlg;
  12483. dlg.SetLiaPath("5.lia");
  12484. dlg.DoModal();
  12485. }
  12486. if (g_user.bLongin == 0)return;
  12487. }
  12488. if (IsHasRightsnew(49) == 0)return;
  12489. PhotoBak dlg;
  12490. dlg.DoModal();
  12491. }
  12492. //客户报表
  12493. void CMainFrame::OnClose2()
  12494. { // TODO: Add your message handler code here and/or call default
  12495. if (AfxMessageBox("是否退出系统?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  12496. if(g_user.bLongin)
  12497. WriteLog("退出系统!", "退出系统!");
  12498. g_bShowBar = 0;
  12499. if (m_Mdi.MainClose())
  12500. CMDIFrameWnd::OnClose();
  12501. }
  12502. //
  12503. void CMainFrame::ResetTimer()
  12504. {
  12505. }
  12506. void CMainFrame::LinkClick(CString str, int nParent)
  12507. {
  12508. g_pMainWnd2->m_bar.LinkClick(str);
  12509. }
  12510. void CMainFrame::PrintFlowChart2(CString m_id)
  12511. {
  12512. CPrintRX m_Print;
  12513. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12514. {
  12515. m_Print.InitToPrint(NULL, 1);
  12516. }
  12517. else
  12518. {
  12519. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  12520. if (name.IsEmpty())
  12521. m_Print.InitToPrint(NULL, 1);
  12522. else
  12523. {
  12524. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12525. if (nret == -1)
  12526. {
  12527. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12528. }
  12529. }
  12530. }
  12531. m_Print.StartPrint();
  12532. m_Print.StartPage();
  12533. LoadRect load;
  12534. load.SetLiaPath("16.lia");
  12535. load.SetMargins(0, 0);
  12536. if (!load.Load())return;
  12537. LoadRect load2;
  12538. load2.SetLiaPath("17.lia");
  12539. load2.SetMargins(0, 660);
  12540. if (!load2.Load())return;
  12541. int i;
  12542. //////////////////////////////////////////////////////////////
  12543. CStringArray txarray;
  12544. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and kind<>'2'";
  12545. g_sendhead.code[0] = 11;
  12546. g_sendhead.code[1] = 52;
  12547. g_sendhead.code[2] = 223;
  12548. g_sendhead.tabcount = 3;
  12549. g_sendhead.bsql = 0;
  12550. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12551. CArray<CStringArray, CStringArray>sparray;
  12552. CArray<CStringArray, CStringArray>clientarray;
  12553. DataToArray(&g_List1array, &clientarray, &sparray);
  12554. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12555. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12556. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12557. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12558. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12559. CString m_photocount = g_List1array.ElementAt(0).ElementAt(9);
  12560. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12561. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12562. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12563. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12564. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12565. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12566. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12567. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12568. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12569. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12570. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12571. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12572. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12573. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12574. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12575. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12576. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12577. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12578. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12579. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12580. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12581. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12582. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(39) + g_List1array.ElementAt(0).ElementAt(75);
  12583. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12584. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12585. CString spno;
  12586. for (i = 0; i < sparray.GetSize(); i++)
  12587. {
  12588. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  12589. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  12590. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  12591. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12592. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12593. spno += sparray.ElementAt(i).ElementAt(5);
  12594. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12595. spno += "; ";
  12596. else
  12597. {
  12598. spno += ":";
  12599. spno += sparray.ElementAt(i).ElementAt(6);
  12600. spno += "; ";
  12601. }
  12602. }
  12603. spno += " 加挑:";
  12604. for (i = 0; i < sparray.GetSize(); i++)
  12605. {
  12606. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  12607. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  12608. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  12609. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12610. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12611. spno += sparray.ElementAt(i).ElementAt(5);
  12612. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12613. spno += "; ";
  12614. else
  12615. {
  12616. spno += ":";
  12617. spno += sparray.ElementAt(i).ElementAt(6);
  12618. spno += "; ";
  12619. }
  12620. }
  12621. if (spno.Right(6) == " 加挑:")
  12622. {
  12623. spno = spno.Left(spno.GetLength() - 6);
  12624. }
  12625. ////////////////////////////////////////////////////////////////
  12626. int rcpos = -1;
  12627. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12628. m_Print.SetFontFace(17, 1, "宋体");
  12629. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12630. StrRect.top -= 0;
  12631. StrRect.bottom -= 10;
  12632. StrRect.left -= 140;
  12633. StrRect.right = StrRect.left + 48;
  12634. m_Print.SetFontFace(15, 1, "宋体");
  12635. m_Print.SetColor(0xffffff);
  12636. m_Print.DrawRect(StrRect, 0);
  12637. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12638. StrRect.left = StrRect.right;
  12639. StrRect.right = StrRect.left + 48;
  12640. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12641. m_Print.SetColor(0, RGB(255, 0, 0));
  12642. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12643. m_Print.SetColor(0);
  12644. m_Print.SetFontFace(12, 1, "宋体");
  12645. StrRect.left -= 48;
  12646. int hei = StrRect.Height();
  12647. StrRect.top = StrRect.bottom + 2;
  12648. StrRect.bottom += hei + 2;
  12649. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12650. StrRect.top = StrRect.bottom - 2;
  12651. StrRect.bottom += hei - 5;
  12652. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12653. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12654. m_Print.SetFontFace(12, 1, "宋体");
  12655. m_Print.DrawText((LPTSTR)(LPCTSTR)"加做取件单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12656. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12657. m_Print.SetFontFace(11, 1, "宋体");
  12658. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + m_id), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12659. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12660. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12661. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12662. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12663. m_Print.DrawRect2(StrRect, 2);
  12664. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12665. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12666. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12667. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12668. m_Print.DrawRect2(StrRect, 2);
  12669. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12670. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12671. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12672. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time4, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12673. m_Print.DrawRect2(StrRect, 2);
  12674. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12675. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12676. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12677. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time5, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12678. m_Print.DrawRect2(StrRect, 2);
  12679. ////////////
  12680. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12681. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12682. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12683. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12684. m_Print.DrawRect2(StrRect, 2);
  12685. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12686. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12687. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12688. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12689. m_Print.DrawRect2(StrRect, 2);
  12690. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12691. m_Print.DrawText((LPTSTR)(LPCTSTR)"赠送张数:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12692. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12693. m_Print.DrawText((LPTSTR)(LPCTSTR)m_photocount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12694. m_Print.DrawRect2(StrRect, 2);
  12695. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12696. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12697. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12698. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12699. m_Print.DrawRect2(StrRect, 2);
  12700. ////////////
  12701. ///////////spno
  12702. CRect sprc[22];
  12703. StrRect = load.m_rcarray.ElementAt(19);
  12704. StrRect.left += 4; StrRect.right -= 3;
  12705. hei = StrRect.Height();
  12706. for (i = 0; i < 22; i++)
  12707. {
  12708. sprc[i] = StrRect;
  12709. m_Print.DrawRect2(StrRect, 1);
  12710. if (i == 0)
  12711. {
  12712. StrRect.left += 5;
  12713. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12714. StrRect.left -= 5;
  12715. }
  12716. StrRect.top = StrRect.bottom;
  12717. StrRect.bottom = StrRect.top + hei;
  12718. sprc[i].left += 4; sprc[i].right -= 3;
  12719. }
  12720. StrRect.bottom = StrRect.top + 60;
  12721. m_Print.DrawRect2(StrRect, 1);
  12722. StrRect.left += 3; StrRect.top += 3;
  12723. StrRect.right -= 3; StrRect.bottom -= 3;
  12724. AutoDraw(m_Print, StrRect, m_bz, 1.8);
  12725. CString temp, tempspno, tempbz;
  12726. CSize size;
  12727. BOOL bRun = 0;
  12728. int fontsize = 12;
  12729. ll: tempspno = spno;
  12730. m_Print.SetFontFace(fontsize, 1, "宋体");
  12731. for (i = 1; i<22; i++)
  12732. {
  12733. if (!tempspno.IsEmpty())
  12734. {
  12735. temp = tempspno;
  12736. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12737. int right = 0;
  12738. CRect temprc = sprc[i];
  12739. while (size.cx>temprc.Width())
  12740. {
  12741. right++;
  12742. temp = tempspno.Left(tempspno.GetLength() - (right));
  12743. if (GIsHalfHZ(temp))
  12744. {
  12745. right++;
  12746. temp.Delete(temp.GetLength() - 1);
  12747. }
  12748. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12749. }
  12750. if (bRun)
  12751. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12752. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  12753. if (tempspno.IsEmpty())i++;
  12754. }
  12755. }
  12756. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  12757. {
  12758. fontsize--;
  12759. goto ll;
  12760. }
  12761. if (bRun == 0)
  12762. {
  12763. bRun = 1;
  12764. goto ll;
  12765. }
  12766. m_Print.SetFontFace(12, 1, "宋体");
  12767. StrRect = load2.m_rcarray.ElementAt(1);
  12768. m_Print.DrawText((LPTSTR)(LPCTSTR)"喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12769. StrRect = load2.m_rcarray.ElementAt(2);
  12770. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12771. StrRect = load2.m_rcarray.ElementAt(3);
  12772. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12773. StrRect = load2.m_rcarray.ElementAt(4);
  12774. m_Print.DrawRect2(StrRect, 2);
  12775. StrRect = load2.m_rcarray.ElementAt(0);
  12776. CString str = "\
  12777. 爱心提示:如对制作有任何要求请清楚列出,所有制作内容一经确认将按要求制作。\r\n\
  12778. 选样文件从拍摄日期计算将保留二个月;套相成品按取件日期保留三个月,逾期不做保留。\r\n\
  12779. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12780. AutoDraw(m_Print, StrRect, str, 1.8);
  12781. PrintPreview dlg; dlg.m_mode = 2;
  12782. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12783. dlg.m_pDC = m_Print.GetPDC();
  12784. if (dlg.DoModal() != IDOK)return;
  12785. //结束打印
  12786. m_Print.EndPage();
  12787. m_Print.EndPrint();
  12788. }
  12789. //分店
  12790. CString CMainFrame::GetDanWei(CString name, CArray<CStringArray, CStringArray>*array)
  12791. {
  12792. for (int i = 0; i < array->GetSize(); i++)
  12793. {
  12794. if (name == array->ElementAt(i).ElementAt(1))
  12795. return array->ElementAt(i).ElementAt(2);
  12796. }
  12797. return "";
  12798. }
  12799. //g_sendhead
  12800. int CMainFrame::GetPort()
  12801. {
  12802. static int aaa = -1;
  12803. if (aaa == -1)
  12804. {
  12805. aaa = CTime::GetCurrentTime().GetSecond() % 7;
  12806. }
  12807. aaa++;
  12808. if (aaa >= 7)aaa = 0;
  12809. return 8387 + aaa;
  12810. }
  12811. void CMainFrame::OnShowBakState()
  12812. {
  12813. // TODO: Add your command handler code here
  12814. g_sendhead.bsql = 0;
  12815. g_sendhead.code[0] = 171;
  12816. g_sendhead.tabcount = 1;
  12817. g_pMainWnd->ProcessChatMessageRequest2(1);
  12818. if (g_bSendOK == 0)
  12819. {
  12820. return;
  12821. }
  12822. CArray<CStringArray, CStringArray>g_bakstatearray;
  12823. DataToArray(&g_bakstatearray);
  12824. while (g_bakstatearray.GetSize() > 7)
  12825. {
  12826. g_bakstatearray.RemoveAt(0);
  12827. }
  12828. int photocount = 0;
  12829. int infocount = 0;
  12830. for (int i = 0; i < g_bakstatearray.GetSize(); i++)
  12831. {
  12832. if (g_bakstatearray.ElementAt(i).ElementAt(1) != "1")photocount++;
  12833. if (g_bakstatearray.ElementAt(i).ElementAt(2) != "1")infocount++;
  12834. }
  12835. ShowBakState dlg;
  12836. dlg.m_pArray = &g_bakstatearray;
  12837. dlg.DoModal();
  12838. }
  12839. void CMainFrame::PrintReceipt2(CStringArray *pArray)
  12840. {
  12841. int i = 0;
  12842. int printcot = 1;
  12843. for (int aa = 0; aa < printcot; aa++)
  12844. {
  12845. g_sendhead.bsql = 0;
  12846. g_sendhead.code[0] = 24;
  12847. g_sendhead.tabcount = 1;
  12848. int g_nYearposTemp = g_nYearpos;
  12849. g_nYearpos = -1;
  12850. g_pMainWnd->ProcessChatMessageRequest2(1);
  12851. g_nYearpos = g_nYearposTemp;
  12852. if (0 == g_bSendOK)return;
  12853. DataToArray(&g_cominfoarray);
  12854. CString SerialNo;
  12855. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  12856. CPrintRX m_Print;
  12857. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12858. {
  12859. m_Print.InitToPrint(NULL, 1);
  12860. }
  12861. else
  12862. {
  12863. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  12864. if (name.IsEmpty())
  12865. m_Print.InitToPrint(NULL, 1);
  12866. else
  12867. {
  12868. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12869. if (nret == -1 && aa == 0)
  12870. {
  12871. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12872. }
  12873. }
  12874. }
  12875. m_Print.StartPrint();
  12876. m_Print.StartPage();
  12877. LoadRect load;
  12878. BOOL bSmall = 0;
  12879. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  12880. {
  12881. bSmall = 1;
  12882. load.SetLiaPath("20.lia");
  12883. }
  12884. else
  12885. load.SetLiaPath("10.lia");
  12886. if (bSmall)
  12887. load.SetMargins(-10, 0);
  12888. else
  12889. load.SetMargins(10, 0);
  12890. if (!load.Load())return;
  12891. int rcpos = -1;
  12892. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12893. Image *pImg = NULL;
  12894. #ifdef MNLS_VERSION
  12895. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  12896. #else
  12897. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  12898. #endif
  12899. // m_Print.DrawImage(pImg, StrRect);
  12900. delete pImg;
  12901. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  12902. {
  12903. Image *pImg = NULL;
  12904. g_nSendCode = 31;
  12905. int g_nYearposTemp = g_nYearpos;
  12906. g_nYearpos = -1;
  12907. g_pMainWnd->ProcessChatMessageRequest2(1);
  12908. g_nYearpos = g_nYearposTemp;
  12909. g_nSendCode = 0;
  12910. if (g_bSendOK == 0)return;
  12911. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  12912. if (pImg)
  12913. {
  12914. StrRect.left = 65;
  12915. if (bSmall)StrRect.left = 55;
  12916. StrRect.top = 10;
  12917. StrRect.right = StrRect.left + 58;
  12918. StrRect.bottom = StrRect.top + 58;
  12919. m_Print.DrawImage(pImg, StrRect);
  12920. delete pImg; pImg = NULL;
  12921. }
  12922. }
  12923. if (bSmall)
  12924. {
  12925. m_Print.SetFontFace(18, 1, "黑体");
  12926. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12927. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12928. m_Print.SetFontFace(9, 1, "宋体");
  12929. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12930. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12931. m_Print.SetFontFace(6, 1, "宋体");
  12932. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12933. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12934. m_Print.SetFontFace(9, 1, "宋体");
  12935. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12936. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12937. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12938. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12939. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12940. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12941. int hei = StrRect.Height();
  12942. StrRect.bottom = StrRect.top;
  12943. StrRect.top -= 8;
  12944. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  12945. m_Print.SetFontFace(10, 1, "宋体");
  12946. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12947. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12948. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12949. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12950. m_Print.SetFontFace(9, 1, "宋体");
  12951. for ( i = 7; i < 24; i++)
  12952. {
  12953. StrRect = load.m_rcarray.ElementAt(i);
  12954. m_Print.DrawRect2(StrRect, 1);
  12955. }
  12956. for (i = 9; i < 24; i++)
  12957. {
  12958. StrRect = load.m_rcarray.ElementAt(i);
  12959. StrRect.left += 2;
  12960. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12961. }
  12962. m_Print.SetFontFace(6, 1, "宋体");
  12963. for (i = 24; i < 26; i++)
  12964. {
  12965. StrRect = load.m_rcarray.ElementAt(i);
  12966. StrRect.left += 2;
  12967. if (i == 24)
  12968. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12969. else
  12970. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12971. }
  12972. }
  12973. else//大单
  12974. {
  12975. m_Print.SetFontFace(20, 1, "黑体");
  12976. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12977. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12978. m_Print.SetFontFace(11, 1, "宋体");
  12979. // StrRect=load.m_rcarray .ElementAt (++rcpos);
  12980. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12981. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15;
  12982. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12983. int hei = StrRect.Height();
  12984. StrRect.bottom = StrRect.top;
  12985. StrRect.top -= 10;
  12986. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  12987. m_Print.SetFontFace(8, 1, "宋体");
  12988. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12989. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12990. m_Print.SetFontFace(11, 1, "宋体");
  12991. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12992. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12993. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12994. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12995. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12996. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12997. m_Print.SetFontFace(13, 1, "宋体");
  12998. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12999. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13000. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13001. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13002. m_Print.SetFontFace(11, 1, "宋体");
  13003. for ( i = 7; i < 24; i++)
  13004. {
  13005. StrRect = load.m_rcarray.ElementAt(i);
  13006. m_Print.DrawRect2(StrRect, 1);
  13007. }
  13008. for (i = 9; i < 24; i++)
  13009. {
  13010. StrRect = load.m_rcarray.ElementAt(i);
  13011. StrRect.left += 2;
  13012. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13013. }
  13014. m_Print.SetFontFace(8, 1, "宋体");
  13015. for (i = 24; i < 27; i++)
  13016. {
  13017. StrRect = load.m_rcarray.ElementAt(i);
  13018. StrRect.left += 2;
  13019. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13020. }
  13021. }
  13022. PrintPreview dlg;
  13023. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13024. dlg.m_pDC = m_Print.GetPDC();
  13025. if (aa == 0)
  13026. {
  13027. if (dlg.DoModal() != IDOK)
  13028. return;
  13029. printcot = dlg.m_num;
  13030. }
  13031. //结束打印
  13032. m_Print.EndPage();
  13033. m_Print.EndPrint();
  13034. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  13035. CString sql;
  13036. sql.Format("update version set [serialno2]='%s'", SerialNo);
  13037. g_sendhead.bsql = 1;
  13038. g_nYearposTemp = g_nYearpos;
  13039. g_nYearpos = -1;
  13040. g_pMainWnd->ProcessChatMessageRequest2(sql);
  13041. g_nYearpos = g_nYearposTemp;
  13042. }
  13043. }
  13044. //出生年月
  13045. //第一联
  13046. void CMainFrame::OnLog()
  13047. {
  13048. // TODO: Add your command handler code here OnShowBakState
  13049. if (IsHasRightsnew(49) == 0)return;
  13050. ShowLOg dlg;
  13051. dlg.DoModal();
  13052. }
  13053. // www.lyfz.net 8888
  13054. void CMainFrame::PrintDinDan6(CString m_id)
  13055. {
  13056. // TODO: Add your control notification handler code here 预约订单
  13057. int printcot = 1;
  13058. for (int aa = 0; aa < printcot; aa++)
  13059. {
  13060. PrintPreview dlg;
  13061. CPrintRX m_Print;
  13062. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13063. {
  13064. m_Print.InitToPrint(NULL, 1);
  13065. }
  13066. else
  13067. {
  13068. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  13069. if (name.IsEmpty())
  13070. m_Print.InitToPrint(NULL, 1);
  13071. else
  13072. {
  13073. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13074. if (nret == -1 && aa == 0)
  13075. {
  13076. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  13077. }
  13078. }
  13079. }
  13080. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  13081. {
  13082. m_Print.StartPrint();
  13083. m_Print.StartPage();
  13084. LoadRect load;
  13085. load.SetLiaPath("6.lia");
  13086. load.SetMargins(-14, 15);
  13087. if (!load.Load())return;
  13088. LoadRect load2;
  13089. load2.SetLiaPath("7.lia");
  13090. load2.SetMargins(-14, 216 + 15);
  13091. if (!load2.Load())return;
  13092. LoadRect load3;
  13093. load3.SetLiaPath("8.lia");
  13094. load3.SetMargins(-14, 705 + 15);
  13095. if (!load3.Load())return;
  13096. int i;
  13097. //////////////////////////////////////////////////////////////
  13098. CStringArray txarray;
  13099. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  13100. g_sendhead.code[0] = 11;
  13101. g_sendhead.code[1] = 52;
  13102. g_sendhead.code[2] = 50;
  13103. g_sendhead.code[3] = 150;
  13104. g_sendhead.code[4] = 77;
  13105. g_sendhead.code[5] = 4;
  13106. g_sendhead.tabcount = 6;
  13107. g_sendhead.bsql = 0;
  13108. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  13109. CArray<CStringArray, CStringArray>sparray;
  13110. CArray<CStringArray, CStringArray>clientarray;
  13111. CArray<CStringArray, CStringArray>phonearray;
  13112. CArray<CStringArray, CStringArray>fgarray;
  13113. CArray<CStringArray, CStringArray>danweiarray;
  13114. CArray<CStringArray, CStringArray>jdarray;
  13115. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  13116. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  13117. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  13118. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  13119. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  13120. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  13121. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  13122. CString m_taoxiname;
  13123. if (m_zs.Find("\\") != -1)
  13124. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  13125. else
  13126. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  13127. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  13128. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  13129. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  13130. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  13131. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  13132. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  13133. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  13134. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  13135. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  13136. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  13137. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  13138. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  13139. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  13140. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  13141. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  13142. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  13143. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  13144. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  13145. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  13146. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  13147. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  13148. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  13149. if (jdarray.GetSize())
  13150. {
  13151. if (m_bz.IsEmpty() == 0)
  13152. m_bz = "\r\n" + m_bz;
  13153. m_bz += "景点:";
  13154. }
  13155. for (i = 0; i < jdarray.GetSize(); i++)
  13156. {
  13157. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  13158. }
  13159. m_bz.TrimRight(";");
  13160. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  13161. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13162. if (IsHasRights2new(31) == 0)
  13163. {
  13164. m_phone1 = "***";
  13165. m_phone2 = "***";
  13166. }
  13167. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  13168. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13169. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  13170. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  13171. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  13172. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  13173. filter = "name='" + m_ren + "'";
  13174. g_sendhead.code[0] = 5;
  13175. g_sendhead.tabcount = 1;
  13176. g_sendhead.bsql = 0;
  13177. int g_nYearposTemp = g_nYearpos;
  13178. g_nYearpos = -1;
  13179. g_pMainWnd->ProcessChatMessageRequest2(filter);
  13180. g_nYearpos = g_nYearposTemp;
  13181. if (g_bSendOK == 0)return;
  13182. DataToArray(&phonearray);
  13183. m_money1.Format("%f", atof(m_taoxijiage));
  13184. m_money2.Format("%f", atof(m_payed1));
  13185. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  13186. ConvertToPrice(m_money1);
  13187. ConvertToPrice(m_money2);
  13188. ConvertToPrice(m_money3);
  13189. ////////////////////////////////////////////////////////////////
  13190. int rcpos = -1;
  13191. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13192. StrRect.top -= 15; StrRect.bottom -= 15;
  13193. Image *pImg = NULL;
  13194. #ifdef MNLS_VERSION
  13195. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  13196. #else
  13197. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  13198. #endif
  13199. m_Print.DrawImage(pImg, StrRect);
  13200. delete pImg;
  13201. m_Print.SetFontFace(11, 1, "宋体");
  13202. StrRect = load.m_rcarray.ElementAt(20);
  13203. StrRect.right = load.m_rcarray.ElementAt(23).right;
  13204. StrRect.top -= 18; StrRect.bottom -= 18;
  13205. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  13206. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13207. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  13208. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13209. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13210. StrRect.top -= 15; StrRect.bottom -= 15;
  13211. #ifdef MNLS_VERSION
  13212. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13213. #endif
  13214. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13215. StrRect.top -= 15; StrRect.bottom -= 15;
  13216. #ifdef MNLS_VERSION
  13217. m_Print.DrawRect(StrRect);
  13218. #endif
  13219. m_Print.SetFontFace(7, 1, "黑体");
  13220. m_Print.SetColor(0xffffff);
  13221. #ifdef MNLS_VERSION
  13222. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13223. #endif
  13224. m_Print.SetColor(0);
  13225. m_Print.SetFontFace(15, 1, "宋体");
  13226. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13227. StrRect.top -= 15; StrRect.bottom -= 15;
  13228. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同拍摄单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13229. CStringArray strarray;
  13230. strarray.Add("NO: " + m_id);
  13231. CString date;
  13232. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  13233. strarray.Add(date);
  13234. strarray.Add("喜爱");
  13235. strarray.Add("格调");
  13236. if (fgarray.GetSize() == 12)
  13237. {
  13238. for (int i = 0; i < 12; i++)
  13239. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  13240. }
  13241. else
  13242. {
  13243. strarray.Add("复古典雅");
  13244. strarray.Add("温文尔雅");
  13245. strarray.Add("豪华艳丽");
  13246. strarray.Add("传统大方");
  13247. strarray.Add("新潮个性");
  13248. strarray.Add("浪漫奔放");
  13249. strarray.Add("简单素雅");
  13250. strarray.Add("活泼俏丽");
  13251. strarray.Add("妩媚温馨");
  13252. strarray.Add("温柔贤惠");
  13253. strarray.Add("成熟感性");
  13254. strarray.Add("清纯可爱");
  13255. }
  13256. strarray.Add("姓名");
  13257. // strarray.Add("职业");
  13258. strarray.Add("");
  13259. strarray.Add("地址");
  13260. strarray.Add("电话");
  13261. #ifdef CHILD_VERSION
  13262. strarray.Add("家长");
  13263. strarray.Add("宝宝");
  13264. #else
  13265. strarray.Add("先生");
  13266. strarray.Add("女士");
  13267. #endif
  13268. m_Print.SetFontFace(11, 1, "宋体");
  13269. for (i = 0; i < strarray.GetSize(); i++)
  13270. {
  13271. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13272. if (i < 2)
  13273. {
  13274. StrRect.top -= 15; StrRect.bottom -= 15;
  13275. }
  13276. if (i>15)
  13277. m_Print.DrawRect2(StrRect, 1);
  13278. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13279. }
  13280. for (i = 29; i <= 40; i++)
  13281. {
  13282. if (m_style.GetLength() <= (i - 29))continue;
  13283. if (m_style.GetAt(i - 29) != '1')continue;
  13284. StrRect = load.m_rcarray.ElementAt(i - 1);
  13285. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13286. }
  13287. for (i = 27; i <= 48; i++)
  13288. {
  13289. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13290. m_Print.DrawRect2(StrRect, 1);
  13291. }
  13292. #ifdef CHILD_VERSION
  13293. StrRect = load.m_rcarray.ElementAt(45);
  13294. StrRect.right = StrRect.left + 62;
  13295. m_Print.DrawRect2(StrRect, 1);
  13296. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13297. StrRect.left = StrRect.right;
  13298. StrRect.right = StrRect.left + 62;
  13299. m_Print.DrawRect2(StrRect, 1);
  13300. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13301. StrRect.left = StrRect.right;
  13302. StrRect.right = StrRect.left + 62;
  13303. m_Print.DrawRect2(StrRect, 1);
  13304. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13305. StrRect.left = StrRect.right;
  13306. StrRect.right = StrRect.left + 62;
  13307. m_Print.DrawRect2(StrRect, 1);
  13308. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13309. #endif
  13310. /////////////////////////
  13311. strarray.RemoveAll();
  13312. CString temp;
  13313. temp.Format("拍摄 选 %d 款,其中", atoi(m_outside) + atoi(m_outside2));
  13314. strarray.Add(temp);
  13315. temp.Format("内景 %d 款,外景 %d 款.", atoi(m_outside2), atoi(m_outside));
  13316. strarray.Add(temp);
  13317. strarray.Add("化妆");
  13318. strarray.Add("造型");
  13319. #ifdef CHILD_VERSION
  13320. strarray.Add("");
  13321. #else
  13322. strarray.Add("婚纱");
  13323. #endif
  13324. strarray.Add("服饰");
  13325. strarray.Add("配");
  13326. strarray.Add("置");
  13327. strarray.Add("其");
  13328. strarray.Add("它");
  13329. strarray.Add("套系名称");
  13330. strarray.Add("镜款");
  13331. strarray.Add("套系总价");
  13332. strarray.Add("主摄影师");
  13333. strarray.Add("拍摄日期");
  13334. strarray.Add("定金");
  13335. #ifdef CHILD_VERSION
  13336. strarray.Add("主引导师");
  13337. #else
  13338. strarray.Add("主化妆师");
  13339. #endif
  13340. strarray.Add("看样日期");
  13341. strarray.Add("补 余 款");
  13342. strarray.Add("总监");
  13343. strarray.Add("取件日期");
  13344. rcpos = -1;
  13345. for (i = 0; i < strarray.GetSize(); i++)
  13346. {
  13347. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13348. if (i>9)
  13349. m_Print.DrawRect2(StrRect, 1);
  13350. #ifdef CHILD_VERSION
  13351. if (i == 5)
  13352. StrRect.top -= StrRect.Height();
  13353. #endif
  13354. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13355. }
  13356. for (i = 22; i <= 41; i++)
  13357. {
  13358. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13359. m_Print.DrawRect2(StrRect, 1);
  13360. }
  13361. /////////////////////////////
  13362. strarray.RemoveAll();
  13363. #ifdef CHILD_VERSION
  13364. strarray.Add("顾客方 家长:");
  13365. strarray.Add("宝宝:");
  13366. #else
  13367. strarray.Add("顾客方 先生:");
  13368. strarray.Add("女士:");
  13369. #endif
  13370. strarray.Add("电话:");
  13371. strarray.Add("影楼方 店长:");
  13372. strarray.Add("接单人:");
  13373. strarray.Add("电话:");
  13374. rcpos = -1;
  13375. for (i = 0; i < strarray.GetSize(); i++)
  13376. {
  13377. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13378. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13379. }
  13380. for (i = 7; i <= 12; i++)
  13381. {
  13382. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13383. // if(i!=10)
  13384. m_Print.DrawRect2(StrRect, 2);
  13385. }
  13386. //////////////////////////////////////
  13387. //开始打数据
  13388. strarray.RemoveAll();
  13389. strarray.Add(m_name1);
  13390. strarray.Add(m_name2);
  13391. strarray.Add("");
  13392. strarray.Add("");
  13393. strarray.Add(m_addr1);
  13394. #ifdef CHILD_VERSION
  13395. strarray.Add("");
  13396. #else
  13397. strarray.Add(m_addr2);
  13398. #endif
  13399. strarray.Add(m_phone1);
  13400. strarray.Add(m_phone2);
  13401. for (i = 41; i <= 48; i++)
  13402. {
  13403. StrRect = load.m_rcarray.ElementAt(i - 1);
  13404. StrRect.left += 4;
  13405. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13406. }
  13407. ///////////////////////////////
  13408. strarray.RemoveAll();
  13409. strarray.Add(m_money1);
  13410. strarray.Add(m_waiter1);
  13411. strarray.Add(m_time2);
  13412. strarray.Add(m_money2);
  13413. strarray.Add(m_waiter2);
  13414. strarray.Add(m_time4);
  13415. strarray.Add(m_money3);
  13416. strarray.Add("");
  13417. strarray.Add(m_time5);
  13418. for (i = 32; i <= 40; i++)
  13419. {
  13420. StrRect = load2.m_rcarray.ElementAt(i - 1);
  13421. StrRect.left += 4;
  13422. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13423. }
  13424. ///////////////////////////////
  13425. strarray.RemoveAll();
  13426. strarray.Add("");//m_name1);
  13427. strarray.Add("");//m_name2);
  13428. CString phone;
  13429. if (m_phone1.IsEmpty() == 0)
  13430. phone = m_phone1 + ",";
  13431. phone += m_phone2;
  13432. phone.TrimRight(",");
  13433. strarray.Add("");//phone);
  13434. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  13435. strarray.Add(m_ren);
  13436. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13437. for (i = 7; i <= 12; i++)
  13438. {
  13439. StrRect = load3.m_rcarray.ElementAt(i - 1);
  13440. StrRect.left += 4;
  13441. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13442. }
  13443. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  13444. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13445. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  13446. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13447. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  13448. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13449. //////////////////////////////
  13450. //开始画文字
  13451. StrRect = load2.m_rcarray.ElementAt(30);
  13452. StrRect.left += 3;
  13453. StrRect.top += 3;
  13454. StrRect.right -= 2;
  13455. StrRect.bottom -= 2;
  13456. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  13457. StrRect = load2.m_rcarray.ElementAt(29);
  13458. StrRect.left += 3;
  13459. StrRect.top += 3;
  13460. StrRect.right -= 2;
  13461. StrRect.bottom -= 2;
  13462. str = "";
  13463. for (i = 0; i < sparray.GetSize(); i++)
  13464. {
  13465. str += sparray.ElementAt(i).ElementAt(5);
  13466. str += " 数量:";
  13467. str += sparray.ElementAt(i).ElementAt(3);
  13468. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  13469. str += "\r\n";
  13470. }
  13471. str.TrimRight("\r\n");
  13472. AutoDraw(m_Print, StrRect, str, 1.4);
  13473. StrRect = load2.m_rcarray.ElementAt(40);
  13474. StrRect.top += 8;
  13475. m_Print.SetFontFace(12, 1, "黑体");
  13476. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  13477. StrRect.left += 3;
  13478. StrRect.top += 30;
  13479. StrRect.right -= 2;
  13480. StrRect.bottom -= 2;
  13481. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  13482. if (str.IsEmpty())
  13483. {
  13484. str = "\
  13485. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  13486. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  13487. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  13488. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  13489. 持良好的心境.\r\n\
  13490. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  13491. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  13492. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  13493. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  13494. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  13495. 勿进影室, 以免影响拍摄.\r\n\
  13496. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  13497. 师或店长沟通.\r\n\
  13498. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  13499. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  13500. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  13501. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  13502. 9. 本合同余额欠款须在拍照前付清.\r\n\
  13503. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  13504. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  13505. 还.";
  13506. }
  13507. AutoDraw(m_Print, StrRect, str, 1.8);
  13508. }
  13509. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13510. dlg.m_pDC = m_Print.GetPDC();
  13511. dlg.m_mode = 1;
  13512. if (aa == 0)
  13513. {
  13514. if (dlg.DoModal() != IDOK)
  13515. return;
  13516. printcot = dlg.m_num;
  13517. }
  13518. //结束打印
  13519. m_Print.EndPage();
  13520. m_Print.EndPrint();
  13521. }
  13522. }
  13523. void CMainFrame::InsideMsg()
  13524. {
  13525. ///内部消息
  13526. CString str;
  13527. g_sendhead.bsql = 0;
  13528. g_sendhead.code[0] = 126;
  13529. g_sendhead.tabcount = 1;
  13530. g_bNoConnDlg = 1;
  13531. g_pMainWnd->ProcessChatMessageRequest2(1); g_bNoConnDlg = 0;
  13532. if (g_bSendOK == 0)return;
  13533. CArray<CStringArray, CStringArray>m_List1array;
  13534. DataToArray(&g_List1array);//, &m_List1array);
  13535. int i = 0;
  13536. m_List1array.SetSize(g_List1array.GetSize());
  13537. for ( i = 0; i < g_List1array.GetSize(); i++)
  13538. {
  13539. m_List1array.ElementAt(i).Copy(g_List1array.ElementAt(i));
  13540. }
  13541. str = "," + g_user.name + ",";
  13542. for (i = g_List1array.GetSize() - 1; i >= 0; i--)
  13543. {
  13544. CString receivers2 = g_List1array.ElementAt(i).ElementAt(4);
  13545. receivers2.TrimLeft(",");
  13546. receivers2.TrimRight(",");
  13547. receivers2 = "," + receivers2 + ",";
  13548. CString receivers = g_List1array.ElementAt(i).ElementAt(3);
  13549. receivers.TrimLeft(",");
  13550. receivers.TrimRight(",");
  13551. receivers = "," + receivers + ",";
  13552. if (receivers.Find(str) == -1)
  13553. g_List1array.RemoveAt(i);
  13554. else if (receivers2.Find(str) != -1)
  13555. g_List1array.RemoveAt(i);
  13556. }
  13557. if (g_List1array.GetSize())
  13558. {
  13559. ShowMsg dlg;
  13560. dlg.DoModal();
  13561. }
  13562. for (i = m_List1array.GetSize() - 1; i >= 0; i--)
  13563. {
  13564. CString receivers2 = m_List1array.ElementAt(i).ElementAt(4);
  13565. receivers2.TrimLeft(",");
  13566. receivers2.TrimRight(",");
  13567. receivers2 = "," + receivers2 + ",";
  13568. CString receivers = m_List1array.ElementAt(i).ElementAt(3);
  13569. if (receivers != "")
  13570. m_List1array.RemoveAt(i);
  13571. else if (receivers2.Find(str) != -1)
  13572. m_List1array.RemoveAt(i);
  13573. }
  13574. if (m_List1array.GetSize())
  13575. {
  13576. SendInsideMsg2 dlg;
  13577. dlg.m_bShow = 1;
  13578. dlg.m_pArray = &m_List1array;
  13579. dlg.DoModal();
  13580. }
  13581. }
  13582. //定金
  13583. /************************************************************************/
  13584. /*
  13585. 函数:PrintHireDress
  13586. 描述:打印礼服出租单;
  13587. 参数:
  13588. strOrderNumber 礼服订单号;
  13589. 注意:
  13590. */
  13591. /************************************************************************/
  13592. void CMainFrame::PrintHireDress(CString strOrderNumber) // 打印礼服出租单;
  13593. {
  13594. int printcot = 1;
  13595. for (int aa = 0; aa < printcot; aa++)
  13596. {
  13597. CPrintRX m_Print;
  13598. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13599. {
  13600. m_Print.InitToPrint(NULL, 1);
  13601. }
  13602. else
  13603. {
  13604. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13605. if (name.IsEmpty())
  13606. m_Print.InitToPrint(NULL, 1);
  13607. else
  13608. {
  13609. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13610. if (nret == -1 && aa == 0)
  13611. {
  13612. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  13613. }
  13614. }
  13615. }
  13616. m_Print.StartPrint();
  13617. m_Print.StartPage();
  13618. LoadRect load;
  13619. load.SetLiaPath("21.lia");
  13620. load.SetMargins(0, 0);
  13621. if (!load.Load())
  13622. {
  13623. return;
  13624. }
  13625. int i;
  13626. //////////////////////////////////////////////////////////////
  13627. //CString filter="id='"+strOrderNumber+"';id='"+strOrderNumber+"';id='"+strOrderNumber+"'";
  13628. CString strFilter;
  13629. strFilter.Format("id='%s';id='%s';id='%s'", strOrderNumber, strOrderNumber, strOrderNumber);
  13630. g_sendhead.bsql = 0;
  13631. g_sendhead.code[0] = 73;
  13632. g_sendhead.code[1] = 74;
  13633. g_sendhead.code[2] = 52;
  13634. g_sendhead.tabcount = 3;
  13635. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  13636. if (g_bSendOK == 0)
  13637. {
  13638. return;
  13639. }
  13640. CArray<CStringArray, CStringArray>dresshirearray;
  13641. CArray<CStringArray, CStringArray>dresshiredataarray;
  13642. CArray<CStringArray, CStringArray>clientarray;
  13643. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13644. if (dresshirearray.GetSize() == 0)
  13645. {
  13646. return;
  13647. }
  13648. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10);
  13649. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7);
  13650. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8);
  13651. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6);
  13652. if (clientarray.GetSize() == 0)
  13653. {
  13654. return;
  13655. }
  13656. //AfxMessageBox("打印礼服出租单-()");
  13657. CString m_name2 = clientarray.ElementAt(0).ElementAt(2);
  13658. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13659. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13660. CString m_time3 = clientarray.ElementAt(0).ElementAt(20);
  13661. //#if JEFF_TEST
  13662. // if ( dresshiredataarray.GetSize() == 0 )
  13663. // {
  13664. // AfxMessageBox("没衣服");
  13665. // }
  13666. //#endif
  13667. CString sItem;
  13668. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13669. {
  13670. sItem += "编号:";
  13671. sItem += dresshiredataarray.ElementAt(i).ElementAt(1);
  13672. sItem += " ";
  13673. sItem += " 名称:";
  13674. sItem += dresshiredataarray.ElementAt(i).ElementAt(2);
  13675. sItem += " 数量:";
  13676. sItem += dresshiredataarray.ElementAt(i).ElementAt(3) + "\r\n";
  13677. }
  13678. sItem += "金额:";
  13679. sItem += dresshirearray.ElementAt(0).ElementAt(1);
  13680. sItem += " ";
  13681. sItem += " 押金:";
  13682. sItem += dresshirearray.ElementAt(0).ElementAt(2) + "\r\n";
  13683. ////////////////////////////////////////////////////////////////
  13684. int rcpos = -1;
  13685. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13686. m_Print.SetFontFace(17, 1, "宋体");
  13687. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13688. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13689. m_Print.SetFontFace(10, 1, "宋体");
  13690. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13691. CStringArray strarray;
  13692. strarray.Add("客户姓名");
  13693. strarray.Add("客户电话");
  13694. strarray.Add("预定日期");
  13695. strarray.Add("结婚日期");
  13696. strarray.Add("取件日期");
  13697. strarray.Add("归还日期");
  13698. strarray.Add("本店地址");
  13699. strarray.Add("电 话");
  13700. strarray.Add("客户地址");
  13701. strarray.Add("客户签名");
  13702. for (i = 2; i < 12; i++)
  13703. {
  13704. StrRect = load.m_rcarray.ElementAt(i);
  13705. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13706. }
  13707. strarray.RemoveAll();
  13708. strarray.Add(m_name2);
  13709. strarray.Add(m_phone2);
  13710. strarray.Add(m_inputdate);
  13711. strarray.Add(m_time3);
  13712. strarray.Add(m_date1);
  13713. strarray.Add(m_date2);
  13714. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13715. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13716. strarray.Add(m_addr2);
  13717. strarray.Add("");
  13718. for (i = 12; i < 22; i++)
  13719. {
  13720. StrRect = load.m_rcarray.ElementAt(i);
  13721. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13722. m_Print.DrawRect2(StrRect, 2);
  13723. }
  13724. for (i = 25; i < 30; i++)
  13725. {
  13726. StrRect = load.m_rcarray.ElementAt(i);
  13727. m_Print.DrawRect2(StrRect, 1);
  13728. }
  13729. StrRect = load.m_rcarray.ElementAt(22);
  13730. StrRect.top += 7;
  13731. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13732. StrRect = load.m_rcarray.ElementAt(23);
  13733. StrRect.top += 7;
  13734. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13735. StrRect = load.m_rcarray.ElementAt(24);
  13736. StrRect.top += 7;
  13737. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13738. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13739. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13740. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13741. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13742. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13743. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13744. if (str.IsEmpty())
  13745. {
  13746. str = "\
  13747. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13748. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13749. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13750. 4. 如有破损酌情赔偿.";
  13751. }
  13752. AutoDraw(m_Print, StrRect, str, 1.5);
  13753. PrintPreview dlg;
  13754. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13755. dlg.m_pDC = m_Print.GetPDC();
  13756. if (aa == 0)
  13757. {
  13758. if (dlg.DoModal() != IDOK)
  13759. return;
  13760. printcot = dlg.m_num;
  13761. }
  13762. //结束打印
  13763. m_Print.EndPage();
  13764. m_Print.EndPrint();
  13765. }
  13766. }
  13767. void CMainFrame::PrintHireDress_01(CString strOrderNumber) // 打印礼服出租单,无法改变结构,需要修改21.lia才能改变打印的布局;
  13768. {
  13769. int printcot = 1;
  13770. for (int aa = 0; aa < printcot; aa++)
  13771. {
  13772. CPrintRX m_Print;
  13773. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13774. {
  13775. m_Print.InitToPrint(NULL, 1);
  13776. }
  13777. else
  13778. {
  13779. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13780. if (name.IsEmpty())
  13781. m_Print.InitToPrint(NULL, 1);
  13782. else
  13783. {
  13784. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13785. if (nret == -1 && aa == 0)
  13786. {
  13787. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  13788. m_Print.InitToPrint(NULL, 1);
  13789. }
  13790. }
  13791. }
  13792. m_Print.StartPrint();
  13793. m_Print.StartPage();
  13794. LoadRect load;
  13795. load.SetLiaPath("21.lia");
  13796. load.SetMargins(0, 0);
  13797. if (!load.Load())return;
  13798. int i;
  13799. //////////////////////////////////////////////////////////////
  13800. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  13801. g_sendhead.bsql = 0;
  13802. g_sendhead.code[0] = 73; // dresshire表;
  13803. g_sendhead.code[1] = 74; // dresshiredata表;
  13804. g_sendhead.code[2] = 52; // client表;
  13805. g_sendhead.tabcount = 3;
  13806. g_pMainWnd->ProcessChatMessageRequest2(filter);
  13807. if (g_bSendOK == 0)
  13808. {
  13809. return;
  13810. }
  13811. CArray<CStringArray, CStringArray>dresshirearray;
  13812. CArray<CStringArray, CStringArray>dresshiredataarray;
  13813. CArray<CStringArray, CStringArray>clientarray;
  13814. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13815. if (dresshirearray.GetSize() == 0)return;
  13816. // dresshire;
  13817. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10); // 备注;
  13818. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7); // 取衣日期;
  13819. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8); // 还衣日期;
  13820. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6); // 记录日期;
  13821. CString strPrice = dresshirearray.ElementAt(0).ElementAt(1); // 金额;
  13822. CString strDeposit = dresshirearray.ElementAt(0).ElementAt(2); // 押金;
  13823. // client表;
  13824. if (clientarray.GetSize() == 0)return;
  13825. CString m_name2 = clientarray.ElementAt(0).ElementAt(2); // 女宾姓名;
  13826. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4); // 女宾手机;
  13827. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8); // 女宾地址;
  13828. CString m_time3 = clientarray.ElementAt(0).ElementAt(20); // 婚期;
  13829. // dresshiredata表;
  13830. CString sItem;
  13831. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13832. {
  13833. sItem += dresshiredataarray.ElementAt(i).ElementAt(1); // 礼服编号;
  13834. sItem += " ";
  13835. sItem += dresshiredataarray.ElementAt(i).ElementAt(2); // 礼服名称;
  13836. sItem += " 数量:";
  13837. sItem += dresshiredataarray.ElementAt(i).ElementAt(3) + "\r\n"; // 礼服数量;
  13838. }
  13839. sItem += " 金额:";
  13840. sItem += dresshirearray.ElementAt(0).ElementAt(1); // 出租金额;
  13841. sItem += " 押金:";
  13842. sItem += dresshirearray.ElementAt(0).ElementAt(2) + "\r\n"; // 押金;
  13843. ////////////////////////////////////////////////////////////////
  13844. int rcpos = -1;
  13845. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13846. m_Print.SetFontFace(17, 1, "宋体");
  13847. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13848. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13849. m_Print.SetFontFace(10, 1, "宋体");
  13850. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13851. CStringArray strarray;
  13852. strarray.Add("客户姓名"); // 1.
  13853. strarray.Add("客户电话");
  13854. strarray.Add("预定日期");
  13855. strarray.Add("结婚日期");
  13856. strarray.Add("取件日期"); // 5.
  13857. strarray.Add("归还日期");
  13858. strarray.Add("本店地址");
  13859. strarray.Add("电 话");
  13860. strarray.Add("客户地址");
  13861. strarray.Add("客户签名"); // 10.
  13862. //strarray.Add("金额");
  13863. //strarray.Add("押金");
  13864. for( i=2; i<12; i++)
  13865. //for (i = 2; i < 14; i++)
  13866. {
  13867. StrRect = load.m_rcarray.ElementAt(i);
  13868. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13869. }
  13870. strarray.RemoveAll();
  13871. strarray.Add(m_name2);
  13872. strarray.Add(m_phone2);
  13873. strarray.Add(m_inputdate);
  13874. strarray.Add(m_time3);
  13875. strarray.Add(m_date1);
  13876. strarray.Add(m_date2);
  13877. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13878. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13879. strarray.Add(m_addr2);
  13880. strarray.Add("");
  13881. strarray.Add(strPrice); // 金额;
  13882. strarray.Add(strDeposit); // 押金;
  13883. for( i=12; i<22; i++)
  13884. //for (i = 14; i < 24; i++)
  13885. {
  13886. StrRect = load.m_rcarray.ElementAt(i);
  13887. //m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i-12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13888. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 14), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13889. m_Print.DrawRect2(StrRect, 2);
  13890. }
  13891. for (i = 25; i < 30; i++)
  13892. {
  13893. StrRect = load.m_rcarray.ElementAt(i);
  13894. m_Print.DrawRect2(StrRect, 1);
  13895. }
  13896. StrRect = load.m_rcarray.ElementAt(22);
  13897. StrRect.top += 7;
  13898. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13899. StrRect = load.m_rcarray.ElementAt(23);
  13900. StrRect.top += 7;
  13901. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13902. StrRect = load.m_rcarray.ElementAt(24);
  13903. StrRect.top += 7;
  13904. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13905. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13906. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13907. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13908. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13909. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13910. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13911. if (str.IsEmpty())
  13912. {
  13913. str = "\
  13914. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13915. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13916. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13917. 4. 如有破损酌情赔偿.";
  13918. }
  13919. AutoDraw(m_Print, StrRect, str, 1.5);
  13920. PrintPreview dlg;
  13921. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13922. dlg.m_pDC = m_Print.GetPDC();
  13923. if (aa == 0)
  13924. {
  13925. if (dlg.DoModal() != IDOK)
  13926. return;
  13927. printcot = dlg.m_num;
  13928. }
  13929. //结束打印
  13930. m_Print.EndPage();
  13931. m_Print.EndPrint();
  13932. }
  13933. }
  13934. // ****************************************************************************
  13935. // Jeff:
  13936. // 函数:PrintHireDress2
  13937. // 无参;
  13938. // 调用者:DinDanFrom.cpp
  13939. // void DinDanFrom::GetData(),订单报表调用时,判断订单数是否大于1000
  13940. // 当订单数大于1000,设置连接公司服务器开关量为真;
  13941. // -----------------------------------------------------------------------------
  13942. // 修改:Jeff
  13943. // 时间:2014.10.18
  13944. // 内容:将 g_ncot 比较值改为100;
  13945. // ****************************************************************************
  13946. void CMainFrame::PrintHireDress2()
  13947. {
  13948. #ifdef _DEBUG
  13949. if (g_ncot > 100) g_bSendLYFZ = 1;
  13950. #else
  13951. if (g_ncot > 500) g_bSendLYFZ = 1;
  13952. #endif
  13953. }
  13954. void CMainFrame::PrintTakeForm2(CArray<CStringArray, CStringArray>*Listarray)
  13955. {
  13956. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "选片客人明细表";
  13957. int pages = Listarray->GetSize() / 46;
  13958. if (Listarray->GetSize() % 46)pages++;
  13959. for (int aa = 0; aa < pages; aa++)
  13960. {
  13961. PrintPreview dlg;
  13962. CPrintRX m_Print;
  13963. m_Print.InitToPrint(NULL, 1);
  13964. m_Print.StartPrint();
  13965. m_Print.StartPage();
  13966. CRect mainrc(0, 0, 560, 793);
  13967. float fscale;
  13968. {
  13969. int w, h;
  13970. m_Print.GetWidHei(w, h);
  13971. fscale = (float)w / (float)h;
  13972. }
  13973. mainrc.DeflateRect(25, 40, 10, 0);
  13974. CRect rc, rc2;
  13975. rc = mainrc;
  13976. rc.bottom = rc.top;
  13977. rc.top -= 20;
  13978. m_Print.SetFontFace(16, 1, "黑体");
  13979. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13980. m_Print.SetFontFace(9, 1, "宋体");
  13981. CString str;
  13982. int wid[5] = { 200, 110, 70, 85, 62 };
  13983. int hei = 16;
  13984. if (fscale > 0.71)hei = 15;
  13985. rc = mainrc;
  13986. rc.bottom = rc.top + hei;
  13987. for (int i = 0; i < 47; i++)
  13988. {
  13989. rc2.top = rc.top + i*hei;
  13990. rc2.bottom = rc.bottom + i*hei;
  13991. rc2.left = rc.left;
  13992. rc2.right = rc.left + wid[0];
  13993. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  13994. for (int j = 0; j<5; j++)
  13995. {
  13996. m_Print.DrawRect2(rc2, 1);
  13997. if (Listarray->GetSize()>aa * 46 + i)
  13998. {
  13999. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14000. rc2.left += 3;
  14001. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14002. rc2.left -= 3;
  14003. }
  14004. rc2.left += wid[j];
  14005. rc2.right = rc2.left + wid[j + 1];
  14006. }
  14007. }
  14008. rc2.top += 2;
  14009. rc2.left += 2; rc2.right = mainrc.right + 4;
  14010. m_Print.SetFontFace(8, 1, "宋体");
  14011. str.Format(" 页:%d/%d", aa + 1, pages);
  14012. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14013. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14014. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14015. dlg.m_pDC = m_Print.GetPDC();
  14016. // dlg.m_mode=1;
  14017. if (aa == 0)
  14018. {
  14019. if (dlg.DoModal() != IDOK)
  14020. return;
  14021. }
  14022. //结束打印
  14023. m_Print.EndPage();
  14024. m_Print.EndPrint();
  14025. }
  14026. }
  14027. void CMainFrame::PrintTakeForm3(CArray<CStringArray, CStringArray>*Listarray)
  14028. {
  14029. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "看设计客人明细表";
  14030. int pages = Listarray->GetSize() / 46;
  14031. if (Listarray->GetSize() % 46)pages++;
  14032. for (int aa = 0; aa < pages; aa++)
  14033. {
  14034. PrintPreview dlg;
  14035. CPrintRX m_Print;
  14036. m_Print.InitToPrint(NULL, 1);
  14037. m_Print.StartPrint();
  14038. m_Print.StartPage();
  14039. CRect mainrc(0, 0, 560, 793);
  14040. float fscale;
  14041. {
  14042. int w, h;
  14043. m_Print.GetWidHei(w, h);
  14044. fscale = (float)w / (float)h;
  14045. }
  14046. mainrc.DeflateRect(25, 40, 10, 0);
  14047. CRect rc, rc2;
  14048. rc = mainrc;
  14049. rc.bottom = rc.top;
  14050. rc.top -= 20;
  14051. m_Print.SetFontFace(16, 1, "黑体");
  14052. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14053. m_Print.SetFontFace(9, 1, "宋体");
  14054. CString str;
  14055. int wid[5] = { 200, 110, 70, 85, 62 };
  14056. int hei = 16;
  14057. if (fscale > 0.71)hei = 15;
  14058. rc = mainrc;
  14059. rc.bottom = rc.top + hei;
  14060. for (int i = 0; i < 47; i++)
  14061. {
  14062. rc2.top = rc.top + i*hei;
  14063. rc2.bottom = rc.bottom + i*hei;
  14064. rc2.left = rc.left;
  14065. rc2.right = rc.left + wid[0];
  14066. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14067. for (int j = 0; j<5; j++)
  14068. {
  14069. m_Print.DrawRect2(rc2, 1);
  14070. if (Listarray->GetSize()>aa * 46 + i)
  14071. {
  14072. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14073. rc2.left += 3;
  14074. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14075. rc2.left -= 3;
  14076. }
  14077. rc2.left += wid[j];
  14078. rc2.right = rc2.left + wid[j + 1];
  14079. }
  14080. }
  14081. rc2.top += 2;
  14082. rc2.left += 2; rc2.right = mainrc.right + 4;
  14083. m_Print.SetFontFace(8, 1, "宋体");
  14084. str.Format(" 页:%d/%d", aa + 1, pages);
  14085. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14086. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14087. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14088. dlg.m_pDC = m_Print.GetPDC();
  14089. // dlg.m_mode=1;
  14090. if (aa == 0)
  14091. {
  14092. if (dlg.DoModal() != IDOK)
  14093. return;
  14094. }
  14095. //结束打印
  14096. m_Print.EndPage();
  14097. m_Print.EndPrint();
  14098. }
  14099. }
  14100. void CMainFrame::PrintTakeForm4(CArray<CStringArray, CStringArray>*Listarray)
  14101. {
  14102. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "取件客人明细表";
  14103. int pages = Listarray->GetSize() / 46;
  14104. if (Listarray->GetSize() % 46)pages++;
  14105. for (int aa = 0; aa < pages; aa++)
  14106. {
  14107. PrintPreview dlg;
  14108. CPrintRX m_Print;
  14109. m_Print.InitToPrint(NULL, 1);
  14110. m_Print.StartPrint();
  14111. m_Print.StartPage();
  14112. CRect mainrc(0, 0, 560, 793);
  14113. float fscale;
  14114. {
  14115. int w, h;
  14116. m_Print.GetWidHei(w, h);
  14117. fscale = (float)w / (float)h;
  14118. }
  14119. mainrc.DeflateRect(25, 40, 10, 0);
  14120. CRect rc, rc2;
  14121. rc = mainrc;
  14122. rc.bottom = rc.top;
  14123. rc.top -= 20;
  14124. m_Print.SetFontFace(16, 1, "黑体");
  14125. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14126. m_Print.SetFontFace(9, 1, "宋体");
  14127. CString str;
  14128. int wid[5] = { 200, 110, 70, 85, 62 };
  14129. int hei = 16;
  14130. if (fscale > 0.71)hei = 15;
  14131. rc = mainrc;
  14132. rc.bottom = rc.top + hei;
  14133. for (int i = 0; i < 47; i++)
  14134. {
  14135. rc2.top = rc.top + i*hei;
  14136. rc2.bottom = rc.bottom + i*hei;
  14137. rc2.left = rc.left;
  14138. rc2.right = rc.left + wid[0];
  14139. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14140. for (int j = 0; j<5; j++)
  14141. {
  14142. m_Print.DrawRect2(rc2, 1);
  14143. if (Listarray->GetSize()>aa * 46 + i)
  14144. {
  14145. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14146. rc2.left += 3;
  14147. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14148. rc2.left -= 3;
  14149. }
  14150. rc2.left += wid[j];
  14151. rc2.right = rc2.left + wid[j + 1];
  14152. }
  14153. }
  14154. rc2.top += 2;
  14155. rc2.left += 2; rc2.right = mainrc.right + 4;
  14156. m_Print.SetFontFace(8, 1, "宋体");
  14157. str.Format(" 页:%d/%d", aa + 1, pages);
  14158. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14159. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14160. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14161. dlg.m_pDC = m_Print.GetPDC();
  14162. // dlg.m_mode=1;
  14163. if (aa == 0)
  14164. {
  14165. if (dlg.DoModal() != IDOK)
  14166. return;
  14167. }
  14168. //结束打印
  14169. m_Print.EndPage();
  14170. m_Print.EndPrint();
  14171. }
  14172. }
  14173. void CMainFrame::PrintTakeForm5(CArray<CStringArray, CStringArray>*Listarray)
  14174. {
  14175. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "婚庆客人明细表";
  14176. int pages = Listarray->GetSize() / 46;
  14177. if (Listarray->GetSize() % 46)pages++;
  14178. for (int aa = 0; aa < pages; aa++)
  14179. {
  14180. PrintPreview dlg;
  14181. CPrintRX m_Print;
  14182. m_Print.InitToPrint(NULL, 1);
  14183. m_Print.StartPrint();
  14184. m_Print.StartPage();
  14185. CRect mainrc(0, 0, 560, 793);
  14186. float fscale;
  14187. {
  14188. int w, h;
  14189. m_Print.GetWidHei(w, h);
  14190. fscale = (float)w / (float)h;
  14191. }
  14192. mainrc.DeflateRect(25, 40, 10, 0);
  14193. CRect rc, rc2;
  14194. rc = mainrc;
  14195. rc.bottom = rc.top;
  14196. rc.top -= 20;
  14197. m_Print.SetFontFace(16, 1, "黑体");
  14198. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14199. m_Print.SetFontFace(8, 1, "宋体");
  14200. CString str;
  14201. int wid[7] = { 165, 90, 90, 45, 45, 60, 35 };
  14202. int hei = 16;
  14203. if (fscale > 0.71)hei = 15;
  14204. rc = mainrc;
  14205. rc.bottom = rc.top + hei;
  14206. for (int i = 0; i < 47; i++)
  14207. {
  14208. rc2.top = rc.top + i*hei;
  14209. rc2.bottom = rc.bottom + i*hei;
  14210. rc2.left = rc.left;
  14211. rc2.right = rc.left + wid[0];
  14212. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14213. for (int j = 0; j<7; j++)
  14214. {
  14215. m_Print.DrawRect2(rc2, 1);
  14216. if (Listarray->GetSize()>aa * 46 + i)
  14217. {
  14218. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14219. rc2.left += 3;
  14220. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14221. rc2.left -= 3;
  14222. }
  14223. rc2.left += wid[j];
  14224. rc2.right = rc2.left + wid[j + 1];
  14225. }
  14226. }
  14227. rc2.top += 2;
  14228. rc2.left += 2; rc2.right = mainrc.right + 4;
  14229. m_Print.SetFontFace(8, 1, "宋体");
  14230. str.Format(" 页:%d/%d", aa + 1, pages);
  14231. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14232. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14233. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14234. dlg.m_pDC = m_Print.GetPDC();
  14235. // dlg.m_mode=1;
  14236. if (aa == 0)
  14237. {
  14238. if (dlg.DoModal() != IDOK)
  14239. return;
  14240. }
  14241. //结束打印
  14242. m_Print.EndPage();
  14243. m_Print.EndPrint();
  14244. }
  14245. }
  14246. void CMainFrame::PrintTakeForm1(CArray<CStringArray, CStringArray>*Listarray)
  14247. {
  14248. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "拍照客人明细表";
  14249. int pages = Listarray->GetSize() / 46;
  14250. if (Listarray->GetSize() % 46)pages++;
  14251. for (int aa = 0; aa < pages; aa++)
  14252. {
  14253. PrintPreview dlg;
  14254. CPrintRX m_Print;
  14255. m_Print.InitToPrint(NULL, 1);
  14256. m_Print.StartPrint();
  14257. m_Print.StartPage();
  14258. CRect mainrc(0, 0, 560, 793);
  14259. float fscale;
  14260. {
  14261. int w, h;
  14262. m_Print.GetWidHei(w, h);
  14263. fscale = (float)w / (float)h;
  14264. }
  14265. mainrc.DeflateRect(25, 40, 10, 0);
  14266. CRect rc, rc2;
  14267. rc = mainrc;
  14268. rc.bottom = rc.top;
  14269. rc.top -= 20;
  14270. m_Print.SetFontFace(16, 1, "黑体");
  14271. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14272. m_Print.SetFontFace(8, 1, "宋体");
  14273. CString str;
  14274. int wid[7] = { 165, 60, 90, 60, 60, 60, 35 };
  14275. int hei = 16;
  14276. if (fscale > 0.71)hei = 15;
  14277. rc = mainrc;
  14278. rc.bottom = rc.top + hei;
  14279. for (int i = 0; i < 47; i++)
  14280. {
  14281. rc2.top = rc.top + i*hei;
  14282. rc2.bottom = rc.bottom + i*hei;
  14283. rc2.left = rc.left;
  14284. rc2.right = rc.left + wid[0];
  14285. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14286. for (int j = 0; j<7; j++)
  14287. {
  14288. m_Print.DrawRect2(rc2, 1);
  14289. if (Listarray->GetSize()>aa * 46 + i)
  14290. {
  14291. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14292. rc2.left += 3;
  14293. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14294. rc2.left -= 3;
  14295. }
  14296. rc2.left += wid[j];
  14297. rc2.right = rc2.left + wid[j + 1];
  14298. }
  14299. }
  14300. rc2.top += 2;
  14301. rc2.left += 2; rc2.right = mainrc.right + 4;
  14302. m_Print.SetFontFace(8, 1, "宋体");
  14303. str.Format(" 页:%d/%d", aa + 1, pages);
  14304. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14305. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14306. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14307. dlg.m_pDC = m_Print.GetPDC();
  14308. // dlg.m_mode=1;
  14309. if (aa == 0)
  14310. {
  14311. if (dlg.DoModal() != IDOK)
  14312. return;
  14313. }
  14314. //结束打印
  14315. m_Print.EndPage();
  14316. m_Print.EndPrint();
  14317. }
  14318. }
  14319. void CMainFrame::ShowMonthForm2()
  14320. {
  14321. }
  14322. // dlg;