MainFrm.cpp 457 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619
  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 "Booking2.h"
  20. #include "PayOutSet.h"
  21. #include "PayOutInput.h"
  22. #include "IncomeInput.h"
  23. #include "IncomeInput2.h"
  24. #include "IncomeInput3.h"
  25. #include "IncomeInput4.h"
  26. #include "DressEarlyWarning.h"
  27. #include "DailyForm.h"
  28. #include "MonthForm.h"
  29. #include "ProcessAlarm.h"
  30. #include "MonthForm2.h"
  31. #include "YearForm.h"
  32. #include "ClientForm.h"
  33. #include "ClientForm2.h"
  34. #include "ClientForm3.h"
  35. #include "DinDanFrom.h"
  36. #include "Satisfaction.h"
  37. //#include "SatisfactionForm.h"
  38. #include "SatisfactionReportForm.h"
  39. #include "TodayForm.h"
  40. #include "TodayForm2.h"
  41. #include "SendInsideMsg2.h"
  42. #include "StoreInfoChart.h"
  43. #include "FixedAssets.h"
  44. #include "SPForm.h"
  45. #include "ShowMsg.h"
  46. #include "Account.h"
  47. #include "Login.h"
  48. #include "Login3.h"
  49. #include "Psw.h"
  50. #include "AreaDlg.h"
  51. #include "TakeFrom.h"
  52. #include "ChoosePhotoForm.h"
  53. #include "BeautifySkinFrom.h"
  54. #include "DesignFrom.h"
  55. #include "outsourcing.h"
  56. #include "ChoosePhotoSkin.h"
  57. #include "SalarySet.h"
  58. #include "SalarySet2.h"
  59. #include "MySalary.h"
  60. #include "PrintRX.h"
  61. #include "LoadRect.h"
  62. #include "PrintPreview.h"
  63. #include "SearchClient.h"
  64. #include "BeautifySkinFrom2.h"
  65. #include "FinanceForm.h"
  66. #include "PhotoPrintFrom.h"
  67. //#include "SqlDlg.h"
  68. #include "YearForm2.h"
  69. #include "AreaClient.h"
  70. #include "DBConfig.h"
  71. #include "SetPathDlg2.h"
  72. #include "StaffAchievement.h"
  73. #include "BurnCD.h"
  74. #include "StaffAchievementSet.h"
  75. #include "StaffAchievementShowAll.h"
  76. #include "SelContent.h"
  77. #include "ClientMoney.h"
  78. #include "DelPhotoSet.h"
  79. #include "ompanyInfo.h"
  80. #include "ClientForm.h"
  81. #include "PhotoBak.h"
  82. #include "MsgReg.h"
  83. #include "SendMsg.h"
  84. #include "MsgSet.h"
  85. #include "ShowMember.h"
  86. #include "ShowMember2.h"
  87. #include "MemberSet.h"
  88. #include "DressManage.h"
  89. #include "ShowDress.h"
  90. #include "ShowPic.h"
  91. #include "ShowHireReg.h"
  92. #include "InputGoods.h"
  93. #include "ShowGoods.h"
  94. #include "CostCal.h"
  95. #include "Welcome.h"
  96. #include "EmployeeMsg.h"
  97. #include "TXFG.h"
  98. #include "EmployeeForm.h"
  99. #include "EmployeeForm2.h"
  100. #include "Client2Form.h"
  101. #include "Client2FormLYFZ.h"
  102. #include "OldClient.h"
  103. #include "ClientReasonChart.h"
  104. #include "ClientFromChart.h"
  105. #include "WorkMsg.h"
  106. #include "SetLoginTime.h"
  107. #include "SetLoginBan.h"
  108. #include "LoginReg.h"
  109. #include "LoginReg2.h"
  110. #include "PhoneRecord.h"
  111. #include "PhoneRecordOut.h"
  112. #include "MissCall.h"
  113. #include "InsideMsg.h"
  114. #include "Card2Reg.h"
  115. #include "Card2RegChart.h"
  116. #include "ShowMemberBlue.h"
  117. #include "Card2RegBlue.h"
  118. #include "Card2RegChartBlue.h"
  119. #include "DigitalWork.h"
  120. #include "HideWindow.h"
  121. #include "SalarySet3.h"
  122. #include "YearFormBranch.h"
  123. #include "YearFormBranch2.h"
  124. #include "Set.h"
  125. #include "DinDanFromBranch.h"
  126. #include "MemberChart.h"
  127. #include "ShowMemberMsg.h"
  128. #include "ShowBakState.h"
  129. #include "DinDanForm.h"
  130. #include "CalendarConvert.h"
  131. #include "ShowLOg.h"
  132. #include "HospitalClient.h"
  133. #include "HospitalClientAlarm.h"
  134. #include "HospitalInfoSet.h"
  135. #include "AddHospitalClient.h"
  136. #include "HospitalClientMsg.h"
  137. // 防盗模块;
  138. //#include "AntiTheft.h"
  139. #ifndef VC60
  140. #include "msgId_def.h"
  141. #include "struct_def.h"
  142. #endif //#ifndef VC60
  143. #ifdef _DEBUG
  144. #define new DEBUG_NEW
  145. #undef THIS_FILE
  146. static char THIS_FILE[] = __FILE__;
  147. #endif
  148. #ifndef WINVER
  149. #define WINVER 0x0400
  150. #endif
  151. #ifndef _WIN32_WINNT
  152. #define _WIN32_WINNT 0x0400
  153. #endif
  154. #ifndef _WIN32_WINDOWS
  155. #define _WIN32_WINDOWS 0x0410
  156. #endif
  157. #ifndef _WIN32_IE
  158. #define _WIN32_IE 0x0400
  159. #endif
  160. #include "uxtheme.h "
  161. typedef HTHEME(__stdcall * POPENTHEMEDATA)(HWND hwnd, LPCWSTR pszClassList);
  162. typedef HRESULT(__stdcall * PCLOSETHEMEDATA)(HTHEME hTheme);
  163. HHOOK g_hmouse = NULL; //g_sendhead zx.dll
  164. //extern void WriteTextLog(CString str); // Jeff写客户端日志;
  165. // Jeff.remark;
  166. // 函数:MouseProc
  167. // 参数:
  168. // nCode hook code
  169. // wParam message identifier
  170. // lParam mouse coordinates
  171. // 返回:
  172. //
  173. LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam)
  174. {
  175. if (g_pMainWnd)
  176. {
  177. if(g_cominfoarray.GetSize() > 0)
  178. {
  179. // 133:version.setcheck24是否启用无操作时自动注销软件;
  180. // 134:version.outtime无操作多少时间自动注销软件;
  181. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(133)) && atoi(g_cominfoarray.ElementAt(0).ElementAt(134)) > 0)
  182. {
  183. g_pMainWnd->KillTimer(5);
  184. g_pMainWnd->SetTimer(5, atoi(g_cominfoarray.ElementAt(0).ElementAt(134)) * 60 * 1000, NULL);
  185. }
  186. }
  187. // 是否记录信息;
  188. if (g_bSendLYFZ && g_bAntiTheft)
  189. {
  190. g_pMainWnd->KillTimer(7);
  191. #ifdef _DEBUG
  192. g_pMainWnd->SetTimer(7, 2000, NULL);
  193. #else
  194. g_pMainWnd->SetTimer(7, 5 * 60 * 1000, NULL);
  195. #endif
  196. }
  197. }
  198. return CallNextHookEx(g_hmouse, nCode, wParam, lParam);
  199. }
  200. CRect g_rc; // 屏幕坐标值,区域是放置对话框。
  201. CMainFrame *g_pMainWnd = NULL;
  202. extern HWND g_hSendWnd;
  203. extern HWND g_hConnectWnd;
  204. //extern CString newGUID();
  205. #ifdef USE_KERNEL_DLL
  206. /************************************************************************/
  207. /*
  208. 函数:kernelCallback
  209. 描述:kernel.dll的回调函数;
  210. 参数:
  211. lpStrBranchId: 域名;
  212. lpStrOrder: 订单号;
  213. dwImgType: 相片类型;
  214. dwImgNum: 重命名使用,返回的相片编号;
  215. lpStrImg: IncrementalBack表使用的content字段内容,指定备份文件名的相片;
  216. lpStrImgExt: IncrementalBack表使用的backupExt字段内容,指定要备份的扩展名相片;
  217. 返回:void
  218. */
  219. /************************************************************************/
  220. #include "ImportPhoto.h"
  221. // 导入原片、初修、精修、设计结束后的回调函数(三合一);
  222. void CALLBACK ImgImportMergeCallback(IN LPCTSTR lpStrBranchId, IN LPCTSTR lpStrOrderNum, IN CONST INT& dwImgType, IN CONST DWORD& dwImgNum, IN LPCTSTR lpStrImgs, IN LPCTSTR lpStrImgExt)
  223. {
  224. AfxSetResourceHandle(g_Instance);
  225. // 1.判断参数有效性;
  226. if (lpStrBranchId == NULL || !strstr(lpStrBranchId, _T(".ly.com")) || lpStrOrderNum == NULL || _tcscmp(lpStrOrderNum, _T("")) == 0)
  227. {
  228. OutputDebugString(_T("回调函数参数(域名、订单号)无效\n"));
  229. return;
  230. }
  231. // 2.是否需要备份分店相片;
  232. BOOL bIsNeedBranchImg = FALSE;
  233. switch (dwImgType)
  234. {
  235. case 1://是否备份分店原片;
  236. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck1;
  237. break;
  238. case 2://是否备份分店修片;
  239. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck2;
  240. break;
  241. case 3://是否备份分店精修;
  242. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck3;
  243. break;
  244. case 4://是否备份分店设计;
  245. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck4;
  246. break;
  247. default:
  248. OutputDebugString(_T("未知相片类型!\n"));
  249. break;
  250. }
  251. // 3.同时更新IncrementalBack表;
  252. CString strSQLInsert = _T("");
  253. strSQLInsert.Format(INSERT_INCREMENT, 0, lpStrBranchId, CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S"), lpStrOrderNum, dwImgType, lpStrImgs, g_user.account, g_user.name);
  254. // 4.连接服务器,更新dindan和IncrementalBackup;
  255. g_sendhead.bsql = 1;
  256. if (g_bAllBranch)
  257. {// 多店汇总时;
  258. g_branchip = GetBranchIPbyId(lpStrBranchId);
  259. g_pMainWnd->OnDisconnect();
  260. g_branchname = GetBranchNamebyId(lpStrBranchId);
  261. g_bBranchModify = 1;
  262. if (dwImgType == OImgtype)
  263. {// 如果导入的是原片;
  264. CString strSQL = _T("");
  265. strSQL.Format(_T("update dindan set curno = '%d' where id = '%s' ***%s"), dwImgNum, lpStrOrderNum, strSQLInsert);
  266. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  267. }
  268. else
  269. {//导入的不是原片;
  270. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  271. }
  272. // 如果连接服务器失败,要记录下来;
  273. // if () .........
  274. g_pMainWnd->OnDisconnect();
  275. g_bBranchModify = 0;
  276. g_branchip = g_branchname = _T("");
  277. if (g_domain.CompareNoCase(lpStrBranchId) != 0 && bIsNeedBranchImg)
  278. {// 如果不是本店,且本店设置中需要备份分店相片,需要向本店添加导入相片记录;
  279. g_sendhead.bsql = 1;
  280. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  281. g_pMainWnd->OnDisconnect();
  282. g_bBranchModify = 0;
  283. }
  284. }
  285. else
  286. {// 连接本店或分店时;
  287. if (dwImgType == OImgtype)
  288. {// 如果导入的是原片;
  289. CString strSQL = _T("");
  290. strSQL.Format(_T("update dindan set curno = '%d' where id = '%s' ***%s"), dwImgNum, lpStrOrderNum, strSQLInsert);
  291. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  292. }
  293. else
  294. {//导入的不是原片;
  295. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  296. }
  297. if (g_domain.CompareNoCase(lpStrBranchId) != 0 && bIsNeedBranchImg)
  298. {// 如果不是本店,且本店设置中需要备份分店相片,需要向本店添加导入相片记录;
  299. #if 1
  300. ::SendMessage(g_pMainWnd->m_hWnd, MSG_KERNEL_SENDMSG, (WPARAM)lpStrBranchId, (LPARAM)&strSQLInsert);
  301. #else // 可能是VC6.0与VC9.0间DLL调用产生的问题,下面代码执行时会出错;
  302. // 如果连接的是分店,断开分店,回连本店;
  303. g_bBranchModify = FALSE;
  304. g_pMainWnd->OnDisconnect();
  305. g_branchname = g_branchip = _T("");
  306. g_sendhead.bsql = 1;
  307. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  308. g_pMainWnd->OnDisconnect();
  309. // 设置回分店连接;
  310. g_branchip = GetBranchIPbyId(lpStrBranchId);
  311. g_branchname = GetBranchNamebyId(lpStrBranchId);
  312. g_bBranchModify = TRUE;
  313. #endif
  314. }
  315. }
  316. if ( dwImgType == OImgtype )
  317. {// 最后一步,更新完了数据库,刷新TakFrom类所对应的对话框;
  318. HWND hWnd = ::FindWindowEx(g_pMainWnd->GetSafeHwnd(), NULL, _T("MDIClient"), NULL);
  319. if (hWnd)
  320. {
  321. hWnd = ::FindWindowEx(hWnd, NULL, NULL, _T("拍照"));
  322. if (hWnd)
  323. {
  324. hWnd = ::FindWindowEx(hWnd, NULL, _T("#32770"), NULL);
  325. if (hWnd)
  326. {
  327. ::SendMessage(hWnd, MSG_KERNEL_CALLBACK, 0, 0);
  328. }
  329. }
  330. }
  331. }
  332. }
  333. #endif
  334. /////////////////////////////////////////////////////////////////////////////
  335. // CMainFrame客人付款
  336. /////////////////////////////////////////////////////////////////////////////
  337. /////////////////////////////////////////////////////////////////////////////
  338. static void HandleClientNetEvent(IN SOCKET hSocket,
  339. IN ETransportEvent eEvent,
  340. IN void *pDataBuf,
  341. IN unsigned long nDataLen,
  342. IN int nError,
  343. IN void *pContext)
  344. {
  345. if (nError != TRANSPORT_OK)
  346. return;
  347. CMainFrame *pDlg = (CMainFrame *)pContext;
  348. if (NULL == pDlg)
  349. return;
  350. pDlg->ProcessNetEvent(eEvent, pDataBuf, nDataLen);
  351. }
  352. BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam)
  353. {
  354. CRect rtCtrl, rtWnd; // 子窗口,父窗口;
  355. if (hwnd)
  356. {
  357. ::GetWindowRect(hwnd, &rtCtrl); // 获取控件大小;
  358. ::GetWindowRect(GetParent(hwnd), &rtWnd); // 获取父窗口大小;
  359. rtCtrl.OffsetRect(-rtWnd.left, -rtWnd.top);
  360. float temp;
  361. temp = (float)rtCtrl.left*g_WidthScale;
  362. rtCtrl.left = (int)temp + g_dx;
  363. temp = (float)rtCtrl.top*g_HeightScale;
  364. rtCtrl.top = (int)temp + g_dy;
  365. temp = (float)rtCtrl.right*g_WidthScale;
  366. rtCtrl.right = (int)temp + g_dx;
  367. temp = (float)rtCtrl.bottom*g_HeightScale;
  368. rtCtrl.bottom = (int)temp + g_dy;
  369. ::MoveWindow(hwnd, rtCtrl.left, rtCtrl.top, rtCtrl.Width(), rtCtrl.Height(), TRUE);
  370. return TRUE;
  371. }
  372. else
  373. {
  374. return FALSE;
  375. }
  376. }
  377. IMPLEMENT_DYNCREATE(CMainFrame, CMDIFrameWnd)
  378. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  379. //{{AFX_MSG_MAP(CMainFrame)
  380. ON_WM_CREATE()
  381. ON_WM_DESTROY()
  382. ON_WM_CLOSE()
  383. ON_WM_TIMER()
  384. ON_COMMAND(IDM_choosephotoskin, Onchoosephotoskin)
  385. ON_COMMAND(IDM_PATH, OnPath)
  386. ON_COMMAND(IDM_SERVER, OnServer)
  387. ON_COMMAND(IDM_SHOWHIS, OnShowhis)
  388. ON_COMMAND(IDM_StaffAchievementShow, OnStaffAchievementShow)
  389. ON_COMMAND(IDM_AUTODELPHOTO, OnAutodelphoto)
  390. ON_COMMAND(IDM_PHOTOMANAGE, Onphotomanage)
  391. ON_COMMAND(IDM_COMPANYINFO, OnCompanyinfo)
  392. ON_COMMAND(IDM_HELPFILE, OnHelpfile)
  393. ON_COMMAND(IDM_PHOTOBAK, OnPhotobak)
  394. ON_COMMAND(IDM_TAOXIFG, OnTaoxifg)
  395. ON_COMMAND(IDM_ShowBakState, OnShowBakState)
  396. ON_WM_NCLBUTTONDBLCLK()
  397. ON_WM_NCHITTEST()
  398. ON_COMMAND(IDM_LOG, OnLog)
  399. //}}AFX_MSG_MAP
  400. ON_COMMAND_RANGE(0, 50000, OnCommandMenu)
  401. ON_MESSAGE(MSG_KERNEL_SENDMSG, OnKernelSendMessaage)
  402. END_MESSAGE_MAP()
  403. static UINT indicators[] =
  404. {
  405. ID_SEPARATOR, // status line indicator
  406. ID_INDICATOR_CAPS,
  407. ID_INDICATOR_NUM,
  408. ID_INDICATOR_SCRL,
  409. };
  410. /////////////////////////////////////////////////////////////////////////////
  411. // CMainFrame construction/destruction
  412. #if defined(VC70) || defined(VC60)
  413. UINT CMainFrame::OnNcHitTest(CPoint point)
  414. {
  415. if (CWnd::OnNcHitTest(point) == HTRIGHT || CWnd::OnNcHitTest(point) == HTLEFT || CWnd::OnNcHitTest(point) == HTTOP || CWnd::OnNcHitTest(point) == HTBOTTOM)
  416. return HTCLIENT;
  417. return CWnd::OnNcHitTest(point);
  418. }
  419. #else
  420. LRESULT CMainFrame::OnNcHitTest(CPoint point)
  421. {
  422. if (CWnd::OnNcHitTest(point) == HTRIGHT || CWnd::OnNcHitTest(point) == HTLEFT || CWnd::OnNcHitTest(point) == HTTOP || CWnd::OnNcHitTest(point) == HTBOTTOM)
  423. return HTCLIENT;
  424. return CWnd::OnNcHitTest(point);
  425. }
  426. #endif
  427. void CMainFrame::OnNcLButtonDblClk(UINT nFlags, CPoint point)
  428. {
  429. if (nFlags != HTCAPTION)
  430. CMDIFrameWnd::OnNcLButtonDblClk(nFlags, point);
  431. }
  432. // 回调使用;
  433. LRESULT CMainFrame::OnKernelSendMessaage(WPARAM wp, LPARAM lp)
  434. {
  435. CString strBranchId = (LPCTSTR)wp;
  436. CString strSQLInsert = *(CString*)lp;
  437. // 如果连接的是分店,断开分店,回连本店;
  438. g_bBranchModify = FALSE;
  439. g_pMainWnd->OnDisconnect();
  440. g_branchname = g_branchip = _T("");
  441. g_sendhead.bsql = 1;
  442. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  443. g_pMainWnd->OnDisconnect();
  444. // 设置回分店连接;
  445. g_branchip = GetBranchIPbyId(strBranchId);
  446. g_branchname = GetBranchNamebyId(strBranchId);
  447. g_bBranchModify = TRUE;
  448. g_pMainWnd->OnConnect();
  449. return 0;
  450. }
  451. CMainFrame::CMainFrame()
  452. {
  453. // TODO: add member initialization code here
  454. SetConnectionID(INVALID_SOCKET);
  455. m_pMainFrimDlg2 = NULL;
  456. m_bCheckF2F3 = AfxGetApp()->GetProfileInt(LYFZVERSION, "f2f3", 0);
  457. if (0 == ::PathFileExists(g_mainpath + "\\skin\\5.lia"))
  458. {
  459. g_bNoLoginLia = 1;
  460. }
  461. }
  462. CMainFrame::~CMainFrame()
  463. {
  464. if (m_pMainFrimDlg2)
  465. {
  466. m_pMainFrimDlg2->DestroyWindow();
  467. delete m_pMainFrimDlg2;
  468. }
  469. }
  470. void InTheMe(HWND m_hWnd)
  471. {
  472. BOOL bXpVisualStyle = FALSE;
  473. OSVERSIONINFO osvi;
  474. osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  475. ::GetVersionEx(&osvi);
  476. if ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) && (osvi.dwMajorVersion >= 5) && (osvi.dwMinorVersion >= 1))
  477. {
  478. HMODULE hUxTheme = ::LoadLibrary(_T("UxTheme.dll"));
  479. POPENTHEMEDATA pOpenThemeData;
  480. PCLOSETHEMEDATA pCloseThemeData;
  481. if (hUxTheme != NULL)
  482. {
  483. pOpenThemeData = (POPENTHEMEDATA)::GetProcAddress(hUxTheme, "OpenThemeData");
  484. pCloseThemeData = (PCLOSETHEMEDATA)::GetProcAddress(hUxTheme, "CloseThemeData");
  485. HTHEME hButtonTheme = (*pOpenThemeData)(m_hWnd, L"BUTTON");
  486. if (hButtonTheme != NULL)
  487. bXpVisualStyle = TRUE;
  488. (*pCloseThemeData)(hButtonTheme);
  489. }
  490. ::FreeLibrary(hUxTheme);
  491. }
  492. if (bXpVisualStyle)
  493. AfxMessageBox(_T("正在使用视觉主题 "));
  494. else
  495. AfxMessageBox(_T("没有使用视觉主题 "));
  496. }
  497. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  498. {
  499. if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  500. {
  501. // Jeff.创建失败的可能性小,加日志输出;
  502. return -1;
  503. }
  504. if (::PathFileExists(g_mainpath + "\\logo.ico"))
  505. {
  506. Bitmap *bmp = NULL;
  507. LoadImageFromFile((Image**)&bmp, g_mainpath + "\\logo.ico");
  508. // m_hIcon = AfxGetApp()->LoadIcon(g_mainpath+"\\logo.ico");
  509. bmp->GetHICON(&m_hIcon);
  510. delete bmp;
  511. SetIcon(m_hIcon, TRUE); // Set big icon
  512. SetIcon(m_hIcon, FALSE); // Set small icon
  513. }
  514. if (!m_wndClient.SubclassWindow(m_hWndMDIClient))
  515. {
  516. return -1;
  517. }
  518. if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  519. | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  520. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  521. {
  522. TRACE0("Failed to create toolbar\n");
  523. return -1; // fail to create
  524. }
  525. m_wndToolBar.LoadTrueColorToolBar(90, IDB_NORMAL, 0, IDB_DISABLE);
  526. // second toolbar must have different ID
  527. if (!m_wndToolBar2.Create(this, WS_CHILD | WS_VISIBLE | CBRS_LEFT | CBRS_NOALIGN,
  528. AFX_IDW_CONTROLBAR_FIRST + 32) ||
  529. !m_wndToolBar2.LoadToolBar(IDR_TOOLBAR1))
  530. {
  531. TRACE0("Failed to create toolbar\n");
  532. return -1; // fail to create
  533. }
  534. #ifndef NEW_SKIN
  535. if (!m_wndStatusBar.Create(this) ||
  536. !m_wndStatusBar.SetIndicators(indicators,
  537. sizeof(indicators)/sizeof(UINT)))
  538. {
  539. // Jeff.创建失败的可能性小,加日志输出;
  540. TRACE0("Failed to create status bar\n");
  541. return -1; // fail to create
  542. }
  543. m_wndStatusBar.SetPaneInfo(1,ID_INDICATOR_USER,SBPS_NORMAL,200);
  544. m_wndStatusBar.SetPaneText(1,"未登录",TRUE);
  545. #endif
  546. // TODO: Delete these three lines if you don't want the toolbar to
  547. // be dockable
  548. NewMenu2();
  549. ::GetWindowRect(this->m_hWndMDIClient, g_rc);
  550. g_pMainWnd = this;
  551. m_wndToolBar2.Init();
  552. g_rc.top += 38;
  553. g_rc.left += 160;
  554. /* m_WidthScale = (float)g_rc.Width ()/722;
  555. m_HeightScale = (float)g_rc.Height ()/533;*/
  556. g_user.bLongin = 0;
  557. SetTimer(1, 100, NULL);
  558. #ifdef USE_KERNEL_DLL
  559. if ( g_pIMGProcess )
  560. g_pIMGProcess->SetCallBack(ImgImportMergeCallback);
  561. #endif
  562. return 0;
  563. }
  564. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  565. {
  566. if (!CMDIFrameWnd::PreCreateWindow(cs))
  567. return FALSE;
  568. // TODO: Modify the Window class or styles here by modifying
  569. // the CREATESTRUCT cs
  570. cs.style &= ~WS_MAXIMIZEBOX;
  571. cs.style &= ~WS_THICKFRAME;
  572. cs.lpszName = g_title + "影楼管理系统";
  573. cs.style &= ~FWS_ADDTOTITLE;
  574. RECT rect;
  575. HWND hWnd = ::FindWindow("Shell_TrayWnd", 0);
  576. ::GetWindowRect(hWnd, &rect);
  577. cs.x = 0;
  578. cs.y = 0;
  579. cs.cx = GetSystemMetrics(SM_CXSCREEN);
  580. cs.cy = GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top) + 3;
  581. return TRUE;
  582. }
  583. /////////////////////////////////////////////////////////////////////////////
  584. // CMainFrame diagnostics
  585. #ifdef _DEBUG
  586. void CMainFrame::AssertValid() const
  587. {
  588. CMDIFrameWnd::AssertValid();
  589. }
  590. void CMainFrame::Dump(CDumpContext& dc) const
  591. {
  592. CMDIFrameWnd::Dump(dc);
  593. }
  594. #endif //_DEBUG
  595. /////////////////////////////////////////////////////////////////////////////
  596. // CMainFrame message handlers
  597. void CMainFrame::OnDestroy()
  598. {
  599. OnDisconnect();
  600. Transport_UnInit();
  601. m_Mdi.DeleteAll();
  602. if (g_hmouse)UnhookWindowsHookEx(g_hmouse);
  603. CMDIFrameWnd::OnDestroy();
  604. }
  605. void CMainFrame::OnClose()
  606. {
  607. g_bShowBar = 0;
  608. if (m_Mdi.MainClose())
  609. CMDIFrameWnd::OnClose();
  610. }//连接
  611. void CMainFrame::NewMenu2()
  612. {
  613. CMenu *pMemu = GetMenu();
  614. #ifdef BASIC_VERSION
  615. CMenu* submenu = pMemu->GetSubMenu(1);
  616. //submenu->RemoveMenu (IDM_StaffAchievementShow, MF_BYCOMMAND );//Jeff del 2014.06.16
  617. submenu->RemoveMenu (IDM_salaryset, MF_BYCOMMAND );
  618. #endif
  619. #if 0 // 此机用选片菜单项,去掉不用;
  620. {
  621. BOOL checked=AfxGetApp()->GetProfileInt (LYFZVERSION, "status", 0);
  622. if(checked)
  623. {
  624. CMenu* submenu = pMemu->GetSubMenu(1);
  625. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  626. }
  627. }
  628. #endif
  629. #ifndef BASIC_VERSION
  630. {
  631. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status2", 0);
  632. if (checked)
  633. {
  634. #if 0 // Jeff:去掉菜单,此机用于员工业绩查看的菜单选项;
  635. CMenu* submenu = pMemu->GetSubMenu(1);
  636. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  637. #endif
  638. g_bStaffAchievementShow = 1;
  639. SetTimer(3, 100, NULL);
  640. }
  641. }
  642. #endif
  643. if (g_bShowOK == 0)
  644. {
  645. CMenu* submenu = pMemu->GetSubMenu(2);
  646. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  647. }
  648. }
  649. HMENU CMainFrame::NewMenu()
  650. {
  651. //设置菜单为XP风格 IDM_SHOWHIS
  652. BCMenu::SetMenuDrawMode(1);
  653. //若取消下面这句注释,则可看到菜单的图标栏和文字栏背景颜色为白色,
  654. //文字颜色为蓝色,选中项的前景色为紫红色
  655. //m_menuXP.SetMenuXPItemColor(0x00FFFFFF,0x00FFFFFF,0x00FF0000,0x00FF00FF);
  656. // 设置菜单中图标大小为32×32
  657. // m_menuXP.SetIconSize(32,32);
  658. // 加载菜单资源
  659. m_menuXP.LoadMenu(IDR_MAINFRAME);
  660. // 加载菜单对应的工具栏资源
  661. // m_menuXP.LoadToolbar(IDR_MAINFRAME);
  662. /*由于菜单左边栏中默认的图标大小为16×16,而与之对应的Toolbar中图标大小为32×32,
  663. 因此菜单中图标不能正确显示,只显示出工具栏中图标的左上角部分,所以修改菜单中各
  664. 项对应的图标为24b色位图资源IDB_***,或者在LoadMenu之前调用SetIconSize,设置菜单
  665. 中图标大小为32×32*/
  666. // m_menuXP.SetIconSize(24,24);
  667. // m_menuXP.ModifyODMenu(NULL,IDM_YWBU,IDB_YW); //
  668. /* m_menuXP.ModifyODMenu(NULL,ID_FILE_OPEN,IDB_BITMAP5);
  669. m_menuXP.ModifyODMenu(NULL,ID_FILE_SAVE,IDB_BITMAP7);
  670. m_menuXP.ModifyODMenu(NULL,ID_FILE_PRINT,IDB_BITMAP6);
  671. m_menuXP.ModifyODMenu(NULL,ID_APP_ABOUT,IDB_BITMAP3);
  672. m_menuXP.ModifyODMenu(NULL,ID_APP_EXIT,IDB_BITMAP2);*/
  673. // m_menuXP.EnableMenuItem (0, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  674. // m_menuXP.EnableMenuItem (2, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  675. // m_menuXP.EnableMenuItem (3, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  676. // m_menuXP.EnableMenuItem (4, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  677. // m_menuXP.EnableMenuItem (5, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  678. // m_menuXP.EnableMenuItem (8, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  679. #if 0 // Jeff此机用选片菜单项不用;
  680. {
  681. BOOL checked=AfxGetApp()->GetProfileInt (LYFZVERSION, "status", 0);
  682. if(checked)
  683. {
  684. CMenu* submenu = m_menuXP.GetSubMenu(1);
  685. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  686. }
  687. }
  688. #endif
  689. {
  690. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status2", 0);
  691. if (checked)
  692. {
  693. #if 0 // Jeff:去掉此机用于员工业绩查看的菜单选项;
  694. CMenu* submenu = m_menuXP.GetSubMenu(1);
  695. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  696. #endif
  697. g_bStaffAchievementShow = 1;
  698. SetTimer(3, 100, NULL);
  699. }
  700. }
  701. if (g_bShowOK == 0)
  702. {
  703. CMenu* submenu = m_menuXP.GetSubMenu(2);
  704. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  705. }
  706. return(m_menuXP.Detach());
  707. }
  708. ///////////////////////////////////////////////////////
  709. //减少代码
  710. #define OPEN_MENU(x) m_Mdi.Append(pName, RUNTIME_CLASS(x), IDR_MAINFRAME, this, nID)
  711. //响应菜单命令
  712. void CMainFrame::OnCommandMenu(UINT nID) // 所有菜单命令都在这里处理;
  713. {
  714. if (nID >= 2000 && nID <= 2100)
  715. {
  716. OnBranchData(nID);
  717. return;
  718. }
  719. if (g_user.bLongin == 0)
  720. {
  721. if (g_bNoLoginLia)
  722. {
  723. Login dlg;
  724. dlg.SetLiaPath("5.lia");
  725. dlg.DoModal();
  726. }
  727. else
  728. {
  729. Login3 dlg;
  730. dlg.SetLiaPath("5.lia");
  731. dlg.DoModal();
  732. }
  733. return;
  734. if (g_user.bLongin == 0)return;
  735. }
  736. else
  737. {
  738. InsideMsg();
  739. }
  740. ResetTimer();
  741. if (nID >= 1000 && nID <= 1100)
  742. {
  743. OnHistory(nID);
  744. return;
  745. }
  746. LPSTR pName;
  747. //打开窗口
  748. switch (nID)
  749. {
  750. case IDM_PayOutSet:
  751. {
  752. if (IsHasRights(16) == 0)return;
  753. PayOutSet dlg;
  754. dlg.DoModal();
  755. return;
  756. }
  757. case IDM_SPLB:
  758. {
  759. if (IsHasRightsnew(29) == 0)return;
  760. SPLBDlg dlg;
  761. dlg.DoModal();
  762. return;
  763. }
  764. case IDM_JD:
  765. {
  766. if (IsHasRightsnew(49) == 0)return;
  767. SPLBDlg dlg;
  768. dlg.m_mode = 1;
  769. dlg.DoModal();
  770. return;
  771. }
  772. case IDM_AREA:
  773. {
  774. if (IsHasRightsnew(47) == 0)return;
  775. AreaDlg dlg;
  776. dlg.DoModal();
  777. return;
  778. }
  779. case IDM_Psw:
  780. {
  781. Psw dlg;
  782. dlg.DoModal();
  783. return;
  784. }
  785. case IDM_Set:
  786. {
  787. if (IsHasRightsnew(49) == 0)return;
  788. Set dlg;
  789. dlg.DoModal();
  790. return;
  791. }
  792. case IDM_HIDEWINDOW:
  793. {
  794. HideWindow dlg;
  795. dlg.DoModal();
  796. return;
  797. }
  798. case IDM_Logout:// Jeff.注销;
  799. {
  800. if(g_user.bLongin)
  801. WriteLog("退出系统!", "退出系统!");
  802. g_user.bLongin = 0;
  803. g_user.name.Empty();
  804. g_user.rights.Empty();
  805. g_user.account.Empty();
  806. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  807. g_pMainWnd2->RefreshOutlookBar();
  808. #ifndef NEW_SKIN
  809. m_wndStatusBar.SetPaneText(1, "未登录", TRUE);
  810. #endif
  811. m_Mdi.CloseAll();
  812. #ifdef ENTERPRISE_VERSION
  813. g_branchname.Empty();
  814. g_branchip.Empty();
  815. g_pMainWnd->OnDisconnect();
  816. g_bBranchModify = 0;
  817. #endif
  818. if (g_pMainWnd2)
  819. {
  820. g_pMainWnd2->DrawLogin();
  821. g_pMainWnd2->ShowBar(0);
  822. }
  823. g_hisyeararray.RemoveAll();
  824. g_pMainWnd->AddHistoryMenu(&g_hisyeararray);
  825. g_brancharray.RemoveAll();
  826. g_pMainWnd->AddBranchMenu(&g_brancharray);
  827. if (g_bNoLoginLia)
  828. {
  829. Login dlg;
  830. dlg.SetLiaPath("5.lia");
  831. dlg.DoModal();
  832. }
  833. else
  834. {
  835. Login3 dlg;
  836. dlg.SetLiaPath("5.lia");
  837. dlg.DoModal();
  838. }
  839. if (g_user.bLongin == 1)
  840. {
  841. if (g_pMainWnd2)
  842. {
  843. g_pMainWnd2->ShowBar(TRUE,TRUE);
  844. }
  845. }
  846. return;
  847. }
  848. case IDM_TODAY:
  849. pName = (LPSTR)(LPCSTR)"历史订单";
  850. // OPEN_MENU(SalarySet3);
  851. OPEN_MENU(DinDanHistroy);
  852. break;
  853. case IDM_TAKECONTROL:
  854. pName = (LPSTR)(LPCSTR)"摄控表";
  855. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(117)))
  856. OPEN_MENU(TodayForm2);
  857. else
  858. OPEN_MENU(TodayForm);
  859. break;
  860. case IDM_CLIENTMONEY:
  861. pName = (LPSTR)(LPCSTR)"客人付款";
  862. OPEN_MENU(ClientMoney);
  863. break;
  864. case IDM_TAKEAWAYBOOK:
  865. pName = (LPSTR)(LPCSTR)"发片/取件";
  866. OPEN_MENU(outsourcing);
  867. break;
  868. case IDM_CODE:
  869. pName = (LPSTR)(LPCSTR)"商品报表";
  870. OPEN_MENU(SPForm);
  871. break;
  872. case IDM_Daily:
  873. // if(IsHasRightsnew(22)==0)return;
  874. // pName = (LPSTR)(LPCSTR)"日财务表";
  875. // OPEN_MENU(DailyForm);
  876. pName = (LPSTR)(LPCSTR)"沟通助手";
  877. OPEN_MENU(InsideMsg);
  878. break;
  879. case IDM_ProcessAlarm:
  880. pName = (LPSTR)(LPCSTR)"流程监控";
  881. OPEN_MENU(ProcessAlarm);
  882. break;
  883. case IDM_DINDAN:
  884. // if(IsHasRights(7)==0)return;
  885. pName = (LPSTR)(LPCSTR)"订单报表";
  886. OPEN_MENU(DinDanFrom);
  887. break;
  888. case IDM_CLIENT:
  889. //if(IsHasRights(8)==0)return;
  890. pName = (LPSTR)(LPCSTR)"客户报表";
  891. OPEN_MENU(CClientForm);
  892. break;
  893. case IDM_PayOutInput:
  894. if (IsHasRightsnew(20) == 0)return;
  895. pName = (LPSTR)(LPCSTR)"现金支出";
  896. OPEN_MENU(PayOutInput);
  897. break;
  898. case IDM_salaryset:
  899. if (IsHasRightsnew(25) == 0)return;
  900. pName = (LPSTR)(LPCSTR)"工资设置";
  901. OPEN_MENU(SalarySet);
  902. break;
  903. case IDM_mysalary:
  904. if (IsHasRights(16) == 0)return;
  905. pName = (LPSTR)(LPCSTR)"我的工资";
  906. OPEN_MENU(MySalary);
  907. break;
  908. case IDM_SP:
  909. // if(IsHasRightsnew(29)==0)return;
  910. pName = (LPSTR)(LPCSTR)"商品设置";
  911. OPEN_MENU(ShangPin);
  912. break;
  913. case IDM_WORKER:
  914. if (IsHasRightsnew(27) == 0)return;
  915. pName = (LPSTR)(LPCSTR)"员工设置";
  916. OPEN_MENU(Worker);
  917. break;
  918. case IDM_TAOXI:
  919. if (IsHasRightsnew(30) == 0)return;
  920. pName = (LPSTR)(LPCSTR)"套系设置";
  921. OPEN_MENU(TXDlg);
  922. break;
  923. case IDM_TAOXISP:
  924. if (IsHasRightsnew(30) == 0)return;
  925. pName = (LPSTR)(LPCSTR)"套系赠送商品设置";
  926. OPEN_MENU(TXSPDlg);
  927. break;
  928. case IDM_Provider:
  929. if (IsHasRightsnew(32) == 0)return;
  930. pName = (LPSTR)(LPCSTR)"供应商设置";
  931. OPEN_MENU(ProviderDlg);
  932. break;
  933. case IDM_BUMEN:
  934. {
  935. if (IsHasRightsnew(49) == 0)return;
  936. BuMenDlg dlg;
  937. dlg.DoModal();
  938. return;
  939. }
  940. case IDM_Account:
  941. if (IsHasRightsnew(49) == 0)return;
  942. pName = (LPSTR)(LPCSTR)"账号管理";
  943. OPEN_MENU(Account);
  944. break;
  945. case IDM_YLCD:
  946. {
  947. //AfxMessageBox("IDM_YLCD");
  948. ::CopyFile(_T(g_path7 + "\\接单系统\\Regsvr32.exe"), _T(g_mainpath + "\\Regsvr32.exe"), 0);
  949. ::CopyFile(_T(g_path7 + "\\接单系统\\Flash9f.ocx"), _T(g_mainpath + "\\Flash9f.ocx"), 0);
  950. CString temp;
  951. temp.Format("%s\\regsvr32.exe /s %s\\Flash9f.OCX", g_mainpath, g_mainpath);
  952. WinExec(temp, SW_HIDE);
  953. ::CopyFile(_T(g_path7 + "\\接单系统\\接单系统.exe"), _T(g_mainpath + "\\接单系统.exe"), 0);
  954. ::CopyFile(_T(g_path7 + "\\接单系统\\my32.dll"), _T(g_mainpath + "\\my32.dll"), 0);
  955. ::CopyFile(_T(g_path7 + "\\接单系统\\server.dat"), _T(g_mainpath + "\\server.dat"), 0);
  956. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\接单系统.exe"), g_server, NULL, SW_SHOWNORMAL);
  957. }
  958. break;
  959. case IDM_YLCDMANAGE:
  960. ::CopyFile(_T(g_path7 + "\\接单系统\\资源管理器.exe"), _T(g_mainpath + "\\资源管理器.exe"), 0);
  961. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\资源管理器.exe"), g_server, NULL, SW_SHOWNORMAL);
  962. break;
  963. }
  964. }
  965. //减少代码
  966. ///////////////////////////////////////////////////////////////////////////////
  967. void CMainFrame::OnDisconnect()
  968. {
  969. printf("断开TCP连接\n");
  970. //CClientTunnel::GetInstance()->net_CloseSocket();
  971. m_tClientTunnel.net_CloseSocket();
  972. SetConnectionID(INVALID_SOCKET);
  973. }
  974. void CMainFrame::ProcessLoginResponse(void *pLoginResult)
  975. {
  976. if (NULL == pLoginResult) return;
  977. LOGIN_RESULT_STRU *ptLoginResult = (LOGIN_RESULT_STRU *)pLoginResult;
  978. DWORD dwConnectionID = ptLoginResult->tCommonMsg.dwConnectionID;
  979. SetConnectionID(dwConnectionID);
  980. BYTE byResult = ptLoginResult->byResult;
  981. if (LOGIN_RESULT_SUC == byResult)
  982. {
  983. //AfxMessageBox("登录成功"); // Jeff test;
  984. }
  985. else
  986. {
  987. OnDisconnect();
  988. }
  989. }
  990. /************************************************************************/
  991. /* 函数:ProcessLoginRequest[3/3/2016 IT];
  992. /* 描述:登陆服务器;
  993. /* 参数:;
  994. /* [IN] :;
  995. /* [OUT] :;
  996. /* [IN/OUT] :;
  997. /* 返回:登陆成功返回TRUE;
  998. /* 注意:;
  999. /* 示例:;
  1000. /*
  1001. /* 修改:;
  1002. /* 日期:;
  1003. /* 内容:;
  1004. /************************************************************************/
  1005. BOOL CMainFrame::ProcessLoginRequest()
  1006. {
  1007. // 1.设置通信类型MSG_LOGIN_REQ,为登陆请求;
  1008. WORD wMessageId = 0;
  1009. if (g_conntype == 0 && !g_bConnLYFZ)
  1010. wMessageId = (MSG_LOGIN_REQ + 0X1FFF);
  1011. else// if (g_bConnLYFZ )
  1012. wMessageId = MSG_LOGIN_REQ;
  1013. // 2.填充发送数据;
  1014. TLOGIN_STRU tLogonInfo = { 0 };
  1015. tLogonInfo.tCommonMsg.dwConnectionID = GetConnectionID();//此时m_dwConnectionID为INVALIDE_SOCKET;
  1016. tLogonInfo.tCommonMsg.wMessageId = wMessageId;
  1017. CString strUserName = newGUID();// 以随机数作为登陆时的用户名称;
  1018. strUserName.TrimLeft();
  1019. strUserName.TrimRight();
  1020. #if defined(VC80) || defined(VC70) || defined(VC60)
  1021. strcpy(tLogonInfo.tUserInfo.szUserName, strUserName);
  1022. #else
  1023. strcpy_s(tLogonInfo.tUserInfo.szUserName, 31, strUserName);
  1024. #endif
  1025. DWORD dwDataLen = sizeof(TLOGIN_STRU);
  1026. // 3.填充数据头;
  1027. TMessageHeader tHeader = { 0 };
  1028. tHeader.wMessageId = wMessageId;
  1029. tHeader.dwDataLen = dwDataLen;
  1030. // 4.发送数据;
  1031. //unsigned long ulSendLen = CClientTunnel::GetInstance()->net_Send(&tHeader, (void *)&tLogonInfo, dwDataLen);
  1032. unsigned long ulSendLen = m_tClientTunnel.net_Send(&tHeader, (void *)&tLogonInfo, dwDataLen);
  1033. if (ulSendLen == SOCKET_ERROR)
  1034. {
  1035. return 0;
  1036. }
  1037. return 1;
  1038. }
  1039. DWORD CMainFrame::GetConnectionID()
  1040. {
  1041. return m_dwConnectionID;
  1042. }
  1043. void CMainFrame::SetConnectionID(DWORD dwConnection)
  1044. {
  1045. m_dwConnectionID = dwConnection;
  1046. }
  1047. /************************************************************************/
  1048. /* 函数:ProcessChatMessageRequest2[3/3/2016 IT];
  1049. /* 描述:;
  1050. /* 参数:;
  1051. /* [IN] code:;
  1052. /* 返回:void;
  1053. /* 注意:
  1054. OnConnect() -> ProcessChatMessageRequest()
  1055. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1056. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1057. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1058. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1059. 5.关闭对话框和断开连接;;
  1060. /* 示例:;
  1061. /*
  1062. /* 修改:;
  1063. /* 日期:;
  1064. /* 内容:;
  1065. /************************************************************************/
  1066. void CMainFrame::ProcessChatMessageRequest2(BYTE code)
  1067. {
  1068. #ifdef _DEBUG
  1069. printf("void CMainFrame::ProcessChatMessageRequest2(BYTE code) = [%d]毫秒\n", g_ntimeout);
  1070. #endif
  1071. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1072. SendDataDlg dlg;
  1073. dlg.m_bycode = code;
  1074. dlg.DoModal();
  1075. }
  1076. //*********************************************//
  1077. /*
  1078. 函数:ProcessChatMessageRequest2
  1079. 参数:CString sql [IN]
  1080. 返回:无
  1081. 过程:OnConnect() -> ProcessChatMessageRequest()
  1082. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1083. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1084. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1085. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1086. 5.关闭对话框和断开连接;
  1087. */
  1088. //*********************************************//
  1089. void CMainFrame::ProcessChatMessageRequest2(CString sql)
  1090. {
  1091. if ((sql.Find("insert") != -1 || sql.Find("update") != -1 || sql.Find("delete") != -1) && g_branchname != "" && g_bBranchModify == 0)
  1092. {
  1093. AfxMessageBox("当前为分店数据查看状态,不能更改分店数据!", MB_ICONSTOP);
  1094. g_bSendOK = 0;
  1095. return;
  1096. }
  1097. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1098. SendDataDlg dlg;
  1099. dlg.m_strSQL = sql;
  1100. dlg.DoModal();
  1101. }
  1102. //*********************************************//
  1103. /*
  1104. 函数:ProcessChatMessageRequest2
  1105. 参数:BYTE *pData [IN], int length [IN]
  1106. 返回:无
  1107. 过程:OnConnect() -> ProcessChatMessageRequest()
  1108. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1109. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1110. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1111. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1112. 5.关闭对话框和断开连接;
  1113. */
  1114. //*********************************************//
  1115. void CMainFrame::ProcessChatMessageRequest2(BYTE *pData, int length)
  1116. {
  1117. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1118. SendDataDlg dlg;
  1119. dlg.m_pData = pData;
  1120. dlg.m_nlength = length;
  1121. dlg.DoModal(); // DoModal未执行完时,就被其他函数销毁,导致局部函数dlg无效;
  1122. }
  1123. /************************************************************************/
  1124. /*
  1125. 函数:ProcessChatMessageRequest
  1126. 描述:对服务发送数据;
  1127. 参数:void *szDataBuf[IN], int nDataLen[IN]
  1128. 返回:发送成功与否;
  1129. */
  1130. /************************************************************************/
  1131. BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)
  1132. {
  1133. #ifdef _DEBUG
  1134. if (g_nSendCode == 18)
  1135. {
  1136. INT nSendLen = nDataLen + sizeof(TCHAT_MESSAGE_STRU) + sizeof(TMessageHeader);
  1137. if ( nSendLen == 0)
  1138. {
  1139. printf("dfdfdfdfd\n");
  1140. }
  1141. }
  1142. #endif
  1143. // 1.获取当前与服务器连接的id;
  1144. DWORD dwFromUserID = GetConnectionID();
  1145. // 2.设置通信类型为MSG_CHATMESSAGE_REQ;
  1146. WORD wMessageId = 0;
  1147. if (g_conntype == 0 && !g_bConnLYFZ)
  1148. wMessageId = (MSG_CHATMESSAGE_REQ + 0X3FFF);
  1149. else
  1150. wMessageId = MSG_CHATMESSAGE_REQ;
  1151. // 3.计算出欲发送的数据的长度 dwDataLen;
  1152. DWORD dwDataLen = sizeof(TCHAT_MESSAGE_STRU) + nDataLen;
  1153. BYTE *pSendData = new BYTE[dwDataLen];
  1154. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU*)pSendData;
  1155. memset(pChatMessage, 0x00, dwDataLen);
  1156. // 3.1.g_nYearpos==-1,表示连接是当前主数据库,其他值表示历史数据库;
  1157. if (g_nYearpos == -1)
  1158. g_sendhead.length[99] = g_nYearpos;
  1159. else
  1160. g_sendhead.length[99] = g_nYearpos * 32142953 + 10966236;
  1161. g_sendhead.length[98] = 987123768;
  1162. memcpy(pSendData, &g_sendhead, sizeof(g_sendhead));
  1163. #ifdef ENTERPRISE_VERSION
  1164. if (g_bBranchModify == 0)
  1165. #if defined(VC60) || defined(VC70)
  1166. strcpy(pChatMessage->szFromUserName, g_branchname);
  1167. #else
  1168. strcpy_s(pChatMessage->szFromUserName, 30, g_branchname);
  1169. #endif
  1170. #endif
  1171. // 4.填充发送的数据结构;
  1172. pChatMessage->tCommonMsg.dwConnectionID = GetConnectionID();
  1173. pChatMessage->tCommonMsg.wMessageId = wMessageId;
  1174. pChatMessage->dwFromUserID = dwFromUserID;
  1175. pChatMessage->dwToUserID = g_nSendCode;//▲▲g_nSendCode在服务端同为dwToUserID;
  1176. pChatMessage->wMessageLen = nDataLen;
  1177. memcpy(pChatMessage->byFileContent, szDataBuf, nDataLen);
  1178. // 5.填充数据头;
  1179. TMessageHeader tHeader = { 0 };
  1180. tHeader.wMessageId = wMessageId;
  1181. tHeader.dwDataLen = dwDataLen;
  1182. // 6.发送数据;
  1183. BOOL bRet = 0;
  1184. //unsigned long ulSendLen = CClientTunnel::GetInstance()->net_Send(&tHeader, (void *)pChatMessage, dwDataLen);
  1185. unsigned long ulSendLen = m_tClientTunnel.net_Send(&tHeader, (void *)pChatMessage, dwDataLen);
  1186. if (ulSendLen != SOCKET_ERROR)
  1187. {
  1188. bRet = 1;
  1189. }
  1190. // 7.发送完毕,释放内存;
  1191. delete[] pSendData;
  1192. return bRet;
  1193. }
  1194. /************************************************************************/
  1195. /*
  1196. 函数:ProcessChatMessageResponse
  1197. 描述:接收服务返回的数据;
  1198. 参数:void *pResponse[IN]
  1199. 返回:无;
  1200. 调用关系:
  1201. 1.由 void CMainFrame::ProcessNetEvent(...)调用
  1202. */
  1203. /************************************************************************/
  1204. void CMainFrame::ProcessChatMessageResponse(void *pResponse)
  1205. {
  1206. // 1.数据空,直接返回;
  1207. if (NULL == pResponse)
  1208. return;
  1209. // 2.数据解析过程;
  1210. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pResponse;
  1211. int nMessageLen = pChatMessage->wMessageLen;
  1212. int nMessageLen2 = pChatMessage->dwToUserID; // 在服务器中被处理了,一般使dwToUserID=wMessageLen;
  1213. // Jeff.dwFromUserID==8888表示的内容是更新客户端skin界面数据,只有两处dwToUserID==211和dwToUserID==21;
  1214. // Jeff.其余的大多数都是 dwFromUserID = wMessageLen = dwToUserID 三者相等;
  1215. if (nMessageLen == nMessageLen2 && pChatMessage->dwFromUserID != 8888)
  1216. {
  1217. // 2.1.清除全局变量g_pData数据,用于保存接收的实际数据;
  1218. if (g_pData)
  1219. delete[]g_pData;
  1220. g_pData = NULL;
  1221. g_pData = new BYTE[nMessageLen];
  1222. memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
  1223. memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
  1224. g_nLeng = nMessageLen;
  1225. if (nMessageLen <= sizeof(DWORD))
  1226. {
  1227. memcpy(&g_ncount, pChatMessage->byFileContent, sizeof(DWORD));
  1228. }
  1229. KillTimer(2);
  1230. if (g_hSendWnd)
  1231. {
  1232. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);//关闭发送对话框;
  1233. }
  1234. }
  1235. else if (nMessageLen == nMessageLen2 && pChatMessage->dwFromUserID == 8888)
  1236. {
  1237. if (g_pData2)
  1238. delete[]g_pData2;
  1239. g_pData2 = NULL;
  1240. g_pData2 = new BYTE[nMessageLen2];
  1241. memcpy(g_pData2, pChatMessage->byFileContent, nMessageLen2);
  1242. g_nLeng2 = nMessageLen2;
  1243. KillTimer(2);
  1244. if (g_hSendWnd)
  1245. {
  1246. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1247. }
  1248. }
  1249. else if (nMessageLen2 == 42 )
  1250. {
  1251. #ifdef _DEBUG
  1252. printf("返回:SendCode = 42\n");
  1253. #endif
  1254. if (g_pData)
  1255. delete[]g_pData;
  1256. g_pData = NULL;
  1257. g_pData = new BYTE[nMessageLen];
  1258. memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
  1259. memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
  1260. g_nLeng = nMessageLen;
  1261. g_bSendOK = TRUE;
  1262. KillTimer(2);
  1263. if (g_hSendWnd)
  1264. {
  1265. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);//关闭发送对话框;
  1266. }
  1267. }
  1268. else if ( nMessageLen2 == 43)
  1269. {
  1270. #ifdef _DEBUG
  1271. printf("返回:SendCode = 43\n");
  1272. #endif
  1273. if (g_pData)
  1274. delete[]g_pData;
  1275. g_pData = NULL;
  1276. KillTimer(2);
  1277. if (g_hSendWnd)
  1278. {
  1279. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1280. }
  1281. return;
  1282. }
  1283. else // 登陆返回;
  1284. {
  1285. #ifdef _DEBUG
  1286. printf("登陆返回\n");
  1287. #endif
  1288. if (g_bConnLYFZ)
  1289. {
  1290. if (g_pData)
  1291. delete[]g_pData;
  1292. g_pData = NULL;
  1293. g_pData = new BYTE[nMessageLen];
  1294. memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
  1295. memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
  1296. g_nLeng = nMessageLen;
  1297. if (nMessageLen <= sizeof(DWORD))
  1298. {
  1299. memcpy(&g_ncount, pChatMessage->byFileContent, sizeof(DWORD));
  1300. }
  1301. KillTimer(2);
  1302. if (g_hSendWnd)
  1303. {
  1304. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1305. }
  1306. return;
  1307. }
  1308. if (g_conntype) // Jeff.g_conntype == 1,表示连接公司服务器的返回,用于集团版解析*.ly.com的IP地址;
  1309. {
  1310. // KillTimer(2);
  1311. char *szChatMessage = new char[nMessageLen + 1];
  1312. memset(szChatMessage, 0x00, nMessageLen + 1);
  1313. memcpy(szChatMessage, pChatMessage->byFileContent, nMessageLen);
  1314. g_server = szChatMessage;
  1315. delete[]szChatMessage;
  1316. CStdioFile fp;
  1317. CString path = g_mainpath + "\\ip.txt";
  1318. ::DeleteFile(path); // 删除ip.txt;
  1319. fp.Open(path, CFile::modeCreate | CFile::modeWrite);
  1320. fp.WriteString(g_server);
  1321. fp.Close();
  1322. g_conntype = 0;
  1323. // g_serverip=g_server;
  1324. return;
  1325. }
  1326. if (g_pData2 == NULL)
  1327. {
  1328. g_pData2 = new BYTE[nMessageLen2];
  1329. g_nLeng2 = 0;
  1330. }
  1331. memcpy(g_pData2 + g_nLeng2, pChatMessage->byFileContent, nMessageLen);
  1332. g_nLeng2 += nMessageLen;
  1333. if (g_nLeng2 == nMessageLen2)//已收完
  1334. {
  1335. KillTimer(2);
  1336. if (g_hSendWnd)
  1337. {
  1338. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1339. }
  1340. }
  1341. else
  1342. {
  1343. KillTimer(2);
  1344. SetTimer(2, g_ntimeout, NULL);
  1345. }
  1346. }
  1347. }
  1348. #if USE_SHARE_FLORD
  1349. /************************************************************************/
  1350. /*
  1351. Date: 2015-04-11
  1352. Author: Jeff
  1353. 函数:GetSharePathInfo
  1354. 描述:获取共享目录表的所有信息;
  1355. 参数:
  1356. 返回:成功返回TRUE;
  1357. 注意:获取的表记录存储在全局变量g_aryOfSharePathInfo中;
  1358. 调用约定:在登陆软件时调用,且必须连接的服务器是本店的;
  1359. */
  1360. /************************************************************************/
  1361. BOOL CMainFrame::GetSharePathInfo()
  1362. {
  1363. // 1.连接的数据库必须是本局域网的服务器;
  1364. if ( g_bAllBranch || !g_branchname.IsEmpty() || !g_branchip.IsEmpty() )
  1365. {
  1366. // 非当前局域网服务器;
  1367. return FALSE;
  1368. }
  1369. // 2.获取当前连接的分店域名是否与g_domain一致;
  1370. g_sendhead.bsql = 0;
  1371. g_sendhead.code[0] = 29;
  1372. g_sendhead.tabcount = 1;
  1373. g_pMainWnd->ProcessChatMessageRequest2(23);
  1374. if ( !g_bSendOK )
  1375. {
  1376. // 连接服务器失败;
  1377. return FALSE;
  1378. }
  1379. CArray<CStringArray,CStringArray> strArray;
  1380. DataToArray(&strArray);
  1381. CString strCurBranchDomain = _T("");
  1382. if ( strArray.GetSize() )
  1383. {
  1384. strCurBranchDomain = strArray.ElementAt(0).ElementAt(0);
  1385. if ( strCurBranchDomain.Find(_T(".ly.com")) == -1)
  1386. {
  1387. // 当前获取的域名有错;
  1388. return FALSE;
  1389. }
  1390. }
  1391. if ( g_domain.CompareNoCase(strCurBranchDomain) != 0)
  1392. {
  1393. // 当前连接的分店域名与局域网服务器域名不一致;
  1394. return FALSE;
  1395. }
  1396. // 3.获取可用的共享信息;//select * from NetShareInfo where enable = 1;
  1397. CString strFilter = _T("");
  1398. strFilter.Format(_T("enable = 1"));
  1399. int g_nYearposTemp=g_nYearpos;
  1400. g_nYearpos=-1;
  1401. g_bSendOK = 0;
  1402. g_sendhead.bsql = 0;
  1403. g_sendhead.code[0] = 236;
  1404. g_sendhead.tabcount = 1;
  1405. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  1406. g_nYearpos = g_nYearposTemp;
  1407. if ( !g_bSendOK )
  1408. {
  1409. // 获取共享信息失败;
  1410. return FALSE;
  1411. }
  1412. g_aryOfSharePathInfo.RemoveAll();
  1413. DataToArray(&g_aryOfSharePathInfo);
  1414. return g_aryOfSharePathInfo.GetSize() ? TRUE : FALSE;
  1415. }
  1416. #endif
  1417. BOOL CMainFrame::OnConnectBranch()
  1418. {
  1419. if (g_branchip == "")
  1420. {
  1421. return 0;
  1422. }
  1423. if ( 0 == GetSysIniInfo(g_szModulePath, g_branchname + _T(".ini")) )
  1424. {
  1425. #ifdef _DEBUG
  1426. WriteTextLog("分店:%s, ip:%s, 端口号:%d", g_branchname, g_branchip, g_dwCSPort);
  1427. #endif
  1428. if ( g_szHostComputerIP[0] != '\0') // 如果分店配置文件不填ip,则使用公司记录的ip;
  1429. g_branchip = g_szHostComputerIP;
  1430. MyGetIPByName2(g_branchip);
  1431. }
  1432. g_conntype = 0;
  1433. CString strServerAddress = g_branchip;
  1434. char *szServerAddress = strServerAddress.GetBuffer(0);
  1435. strServerAddress.ReleaseBuffer();
  1436. /*for Client, IP and Port can be 0,
  1437. and for Server, IP is LocalIP, and Port is Listening Port*/
  1438. //int nResult = CClientTunnel::GetInstance()->net_OpenSocket(
  1439. int nResult = m_tClientTunnel.net_OpenSocket(
  1440. Transport_Client,
  1441. 0,
  1442. HandleClientNetEvent,
  1443. this);
  1444. if (TRANSPORT_OK != nResult)
  1445. {
  1446. // AfxMessageBox("网络初始化失败!");
  1447. return 0;
  1448. }
  1449. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1450. DWORD wPort = g_dwCSPort;
  1451. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1452. if (TRANSPORT_OK != nResult)
  1453. {
  1454. m_tClientTunnel.net_CloseSocket();
  1455. return OnConnectBranch2();
  1456. }
  1457. return ProcessLoginRequest();
  1458. }
  1459. BOOL CMainFrame::OnConnectBranch2()
  1460. {
  1461. if (g_branchip2 == "")
  1462. {
  1463. return 0;
  1464. }
  1465. g_conntype = 0;
  1466. CString strServerAddress = g_branchip2;
  1467. char *szServerAddress = strServerAddress.GetBuffer(0);
  1468. strServerAddress.ReleaseBuffer();
  1469. /*for Client, IP and Port can be 0,
  1470. and for Server, IP is LocalIP, and Port is Listening Port*/
  1471. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1472. 0,
  1473. HandleClientNetEvent,
  1474. this);
  1475. if (TRANSPORT_OK != nResult)
  1476. {
  1477. // AfxMessageBox("网络初始化失败!");
  1478. return 0;
  1479. }
  1480. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1481. DWORD wPort = SERVER_PORT; // 5678
  1482. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1483. if (TRANSPORT_OK != nResult)
  1484. {
  1485. m_tClientTunnel.net_CloseSocket();
  1486. return 0;
  1487. }
  1488. return ProcessLoginRequest();
  1489. }
  1490. BOOL CMainFrame::OnConnectIP()
  1491. {
  1492. CString strServerAddress = g_server;
  1493. char *szServerAddress = strServerAddress.GetBuffer(0);
  1494. strServerAddress.ReleaseBuffer();
  1495. /*for Client, IP and Port can be 0,
  1496. and for Server, IP is LocalIP, and Port is Listening Port*/
  1497. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1498. 0,
  1499. HandleClientNetEvent,
  1500. this);
  1501. if (TRANSPORT_OK != nResult)
  1502. {
  1503. // AfxMessageBox("网络初始化失败!");
  1504. return 0;
  1505. }
  1506. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1507. DWORD wPort = SERVER_PORT; // 5678
  1508. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1509. if (TRANSPORT_OK != nResult)
  1510. {
  1511. m_tClientTunnel.net_CloseSocket();
  1512. return 0;
  1513. }
  1514. return ProcessLoginRequest();
  1515. }
  1516. //ip.txt
  1517. BOOL CMainFrame::OnConnectLYFZ()
  1518. {
  1519. #ifdef _DEBUG
  1520. CString strBranchIP = "192.168.1.66";
  1521. #else
  1522. CString strBranchIP = "lijiafz.vicp.net";
  1523. #endif
  1524. MyGetIPByName2(strBranchIP);
  1525. if (strBranchIP == "")
  1526. {
  1527. return 0;
  1528. }
  1529. g_conntype = 0; // Jeff.Delete at 2014.10.18
  1530. //g_conntype = 1;
  1531. CString strServerAddress = strBranchIP;
  1532. char *szServerAddress = strServerAddress.GetBuffer(0);
  1533. strServerAddress.ReleaseBuffer();
  1534. /*for Client, IP and Port can be 0,
  1535. and for Server, IP is LocalIP, and Port is Listening Port*/
  1536. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1537. 0,
  1538. HandleClientNetEvent,
  1539. this);
  1540. if (TRANSPORT_OK != nResult)
  1541. {
  1542. return 0;
  1543. }
  1544. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1545. DWORD wPort = GetPort();
  1546. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1547. if (TRANSPORT_OK != nResult)
  1548. {
  1549. m_tClientTunnel.net_CloseSocket();
  1550. #ifdef _DEBUG
  1551. printf("连接远程服务器[失败]地址:%s, 端口=%d\n\n",strBranchIP,wPort);
  1552. #endif
  1553. return 0;
  1554. }
  1555. #ifdef _DEBUG
  1556. printf("连接远程服务器[成功]地址:%s, 端口=%d\n\n",strBranchIP,wPort);
  1557. #endif
  1558. return ProcessLoginRequest();
  1559. }
  1560. BOOL CMainFrame::OnConnect()
  1561. {
  1562. // 1.Jeff 断开(如果有在在未关的连接)之前的连接;
  1563. OnDisconnect();
  1564. // 2.根据需要连接指定的服务器;
  1565. if (g_bBranchModify)
  1566. {
  1567. // Jeff.g_bBranchModify在g_bGenBranchData=1时,在welcome::OnTimer里被设置为1;
  1568. return OnConnectBranch();// 连接集团版分店;
  1569. }
  1570. if (g_bConnLYFZ)
  1571. {
  1572. return OnConnectLYFZ();// 连接公司服务端程序;
  1573. }
  1574. g_conntype = 0;
  1575. CString strServerAddress = g_server;
  1576. // 3.如果dbconfig.dat里保存的是*.ly.com的信息,就要读取ip.txt里的IP地址;
  1577. if (g_serverbak.Find(".ly.com") != -1)
  1578. {
  1579. strServerAddress = g_serverbak;
  1580. CStdioFile fp;
  1581. CString path = g_mainpath + "\\ip.txt";
  1582. if (::PathFileExists(path))
  1583. {
  1584. fp.Open(path, CFile::modeRead);
  1585. fp.ReadString(g_server);
  1586. fp.Close();
  1587. if (OnConnectIP())
  1588. {
  1589. // g_serverip=g_server;
  1590. return 1;
  1591. }
  1592. g_server = strServerAddress;
  1593. OnDisconnect();//MessageBox("ip失败");
  1594. }
  1595. g_conntype = 1; // Jeff.连接公司服务器,用于获取集团版*.ly.com的解析IP结果;
  1596. strServerAddress = "lijiafz.vicp.net";
  1597. MyGetIPByName2(strServerAddress);
  1598. if (strServerAddress.IsEmpty())
  1599. {
  1600. return 0;//OnConnect2();
  1601. }
  1602. }
  1603. else if (g_ntimeout == 29000)//非远程 30000
  1604. {
  1605. strServerAddress = g_serverarray.ElementAt(g_conpos);
  1606. }
  1607. // 4.如果没有IP.txt或dbconfig.dat里的不是ly.com信息,而是一般的计算机名称;
  1608. char *szServerAddress = strServerAddress.GetBuffer(0);
  1609. strServerAddress.ReleaseBuffer();
  1610. // AfxMessageBox("连接:"+strServerAddress);
  1611. /*for Client, IP and Port can be 0,
  1612. and for Server, IP is LocalIP, and Port is Listening Port*/
  1613. // 5.创建通信对象连接;
  1614. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1615. 0,
  1616. HandleClientNetEvent,
  1617. this);
  1618. if (TRANSPORT_OK != nResult)
  1619. {
  1620. return 0;
  1621. }
  1622. GetSysIniInfo();
  1623. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1624. DWORD wPort = g_dwCSPort;
  1625. if (g_conntype) wPort = GetPort();
  1626. // 6.连接公司服务器或影楼服务器;
  1627. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1628. if (TRANSPORT_OK != nResult)
  1629. {
  1630. m_tClientTunnel.net_CloseSocket();
  1631. if (g_conntype)// Jeff.连接公司服务器,用于获取集团版*.ly.com的解析IP结果;
  1632. {
  1633. return 0;//OnConnect2();
  1634. }
  1635. if (g_serverarray.GetSize() > 1)
  1636. {
  1637. if (g_conpos < (g_serverarray.GetSize() - 1))
  1638. {
  1639. g_conpos++;
  1640. return OnConnect();
  1641. }
  1642. else
  1643. {
  1644. g_conpos = 0;
  1645. return 0;
  1646. }
  1647. }
  1648. return 0;
  1649. }
  1650. return ProcessLoginRequest();
  1651. }
  1652. BOOL CMainFrame::OnConnect2()
  1653. {
  1654. g_conntype = 2;
  1655. CString server = "http://www.lyfz.net/download/ip.txt";
  1656. char buf[MAX_PATH];
  1657. ::GetTempPath(sizeof(buf), buf);
  1658. CString m_strTempDir = buf;
  1659. DWORD m_dwHttpRequestFlags = HSR_DOWNLOAD | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
  1660. INTERNET_PORT m_dwPort;
  1661. DWORD dwType;
  1662. CInternetSession m_cis;
  1663. CHttpConnection *m_pHttp;
  1664. CString m_strServer;
  1665. CString m_strIniPath;
  1666. AfxParseURL(server, dwType, m_strServer, m_strIniPath, m_dwPort);
  1667. if (dwType != AFX_INET_SERVICE_HTTP)
  1668. {
  1669. return 0;//OnConnect3();
  1670. }
  1671. m_cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5);
  1672. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1673. try
  1674. {
  1675. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1676. }
  1677. catch (CInternetException* pEx)
  1678. {
  1679. return 0;//OnConnect3();
  1680. }
  1681. CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_GET,
  1682. m_strIniPath, NULL, 1, NULL, NULL, m_dwHttpRequestFlags);
  1683. try
  1684. {
  1685. pFile->SendRequest();
  1686. }
  1687. catch (CInternetException* pEx)
  1688. {
  1689. pFile->Close();
  1690. return 0;//OnConnect3();
  1691. }
  1692. if (pFile)
  1693. {
  1694. CStdioFile csf;
  1695. csf.Open(m_strTempDir + "\\ip.txt", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
  1696. char buf[2048];
  1697. int n;
  1698. while ((n = pFile->Read(buf, 2048)) > 0)
  1699. csf.Write(buf, n);
  1700. csf.Close();
  1701. pFile->Close();
  1702. }
  1703. CString strServerAddress;
  1704. CStdioFile fp;
  1705. fp.Open(m_strTempDir + "\\ip.txt", CFile::modeRead);
  1706. fp.ReadString(strServerAddress);
  1707. fp.Close();
  1708. char *szServerAddress = strServerAddress.GetBuffer(0);
  1709. strServerAddress.ReleaseBuffer();
  1710. /*for Client, IP and Port can be 0,
  1711. and for Server, IP is LocalIP, and Port is Listening Port*/
  1712. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1713. 0,
  1714. HandleClientNetEvent,
  1715. this);
  1716. if (TRANSPORT_OK != nResult)
  1717. {
  1718. return 0;
  1719. }
  1720. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1721. DWORD wPort = SERVER_PORT; // 5678
  1722. if (g_conntype)wPort = GetPort();
  1723. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1724. if (TRANSPORT_OK != nResult)
  1725. {
  1726. m_tClientTunnel.net_CloseSocket();
  1727. return 0;//OnConnect3();
  1728. }
  1729. return ProcessLoginRequest();
  1730. }
  1731. BOOL CMainFrame::OnConnect3()
  1732. {
  1733. g_conntype = 3;
  1734. CString server = "http://photo.bjlyfz.com/download/ip.txt";
  1735. char buf[MAX_PATH];
  1736. ::GetTempPath(sizeof(buf), buf);
  1737. CString m_strTempDir = buf;
  1738. DWORD m_dwHttpRequestFlags = HSR_DOWNLOAD | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
  1739. INTERNET_PORT m_dwPort;
  1740. DWORD dwType;
  1741. CInternetSession m_cis;
  1742. CHttpConnection *m_pHttp;
  1743. CString m_strServer;
  1744. CString m_strIniPath;
  1745. AfxParseURL(server, dwType, m_strServer, m_strIniPath, m_dwPort);
  1746. if (dwType != AFX_INET_SERVICE_HTTP)
  1747. {
  1748. return FALSE;
  1749. }
  1750. m_cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5);
  1751. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1752. try
  1753. {
  1754. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1755. }
  1756. catch (CInternetException* pEx)
  1757. {
  1758. return false;
  1759. }
  1760. CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_GET,
  1761. m_strIniPath, NULL, 1, NULL, NULL, m_dwHttpRequestFlags);
  1762. try
  1763. {
  1764. pFile->SendRequest();
  1765. }
  1766. catch (CInternetException* pEx)
  1767. {
  1768. pFile->Close();
  1769. return false;
  1770. }
  1771. if (pFile)
  1772. {
  1773. CStdioFile csf;
  1774. csf.Open(m_strTempDir + "\\ip.txt", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
  1775. char buf[2048];
  1776. int n;
  1777. while ((n = pFile->Read(buf, 2048)) > 0)
  1778. csf.Write(buf, n);
  1779. csf.Close();
  1780. pFile->Close();
  1781. }
  1782. CString strServerAddress;
  1783. CStdioFile fp;
  1784. fp.Open(m_strTempDir + "\\ip.txt", CFile::modeRead);
  1785. fp.ReadString(strServerAddress);
  1786. fp.Close();
  1787. char *szServerAddress = strServerAddress.GetBuffer(0);
  1788. strServerAddress.ReleaseBuffer();
  1789. /*for Client, IP and Port can be 0,
  1790. and for Server, IP is LocalIP, and Port is Listening Port*/
  1791. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1792. 0,
  1793. HandleClientNetEvent,
  1794. this);
  1795. if (TRANSPORT_OK != nResult)
  1796. {
  1797. return 0;
  1798. }
  1799. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1800. DWORD wPort = SERVER_PORT; // 5678
  1801. if (g_conntype)wPort = GetPort();
  1802. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1803. if (TRANSPORT_OK != nResult)
  1804. {
  1805. m_tClientTunnel.net_CloseSocket();
  1806. return 0;
  1807. }
  1808. return ProcessLoginRequest();
  1809. }
  1810. void CMainFrame::ProcessNetEvent(int nEventType, void *pRecvMsg, DWORD dwDataLen)
  1811. {
  1812. #ifdef _DEBUG
  1813. printf("ProcessNetEvent\n\n");
  1814. #endif
  1815. if (Transport_ReadEv == nEventType)
  1816. {
  1817. if (NULL == pRecvMsg) return;
  1818. TMessageHeader* pHeader = (TMessageHeader *)pRecvMsg;
  1819. char *pDataBuf = (char *)pRecvMsg + MESSAGE_HEADER_LEN;
  1820. WORD dwMessageID = pHeader->wMessageId;
  1821. switch (dwMessageID)
  1822. {
  1823. case MSG_LOGIN_RESP:
  1824. case (MSG_LOGIN_RESP + 0X2FFF) :
  1825. {
  1826. LOGIN_RESULT_STRU tLoginResult = { 0 };
  1827. memcpy(&tLoginResult, pDataBuf, sizeof(LOGIN_RESULT_STRU));
  1828. ProcessLoginResponse(&tLoginResult);
  1829. break;
  1830. }
  1831. case MSG_USERINFO_RESP:
  1832. {
  1833. break;
  1834. }
  1835. case MSG_LOGOUT_RESP:
  1836. {
  1837. break;
  1838. }
  1839. case MSG_CHATMESSAGE_RESP:
  1840. case (MSG_CHATMESSAGE_RESP + 0X4FFF) :
  1841. {
  1842. static int i = 0;
  1843. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pDataBuf;
  1844. ProcessChatMessageResponse((void *)pChatMessage);
  1845. break;
  1846. }
  1847. default:
  1848. {
  1849. break;
  1850. }
  1851. }
  1852. }
  1853. else if (Transport_CloseEv == nEventType)
  1854. {
  1855. OnDisconnect();
  1856. }
  1857. }
  1858. //extern BOOL g_bNeedCoon;
  1859. extern BOOL EncryptFile2(BYTE *buffer, DWORD leng, PCHAR szPassword);
  1860. void CMainFrame::OnTimer(UINT nIDEvent)
  1861. {
  1862. // TODO: Add your message handler code here and/or call default
  1863. if (1 == nIDEvent)
  1864. {
  1865. KillTimer(nIDEvent);
  1866. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status", 0);//status:此机用选片菜单项
  1867. // checked==1:此机用选片菜单项
  1868. // g_bStaffAchievementShow==1:此机用于员工业绩查看
  1869. if (checked && g_bStaffAchievementShow == 0) // .此机用选片菜单项;
  1870. {
  1871. KillTimer(3);
  1872. #ifdef NEW_SKIN
  1873. Welcome weldlg;
  1874. weldlg.DoModal();
  1875. #endif
  1876. ChoosePhotoSkin dlg;
  1877. dlg.SetLiaPath("1.lia");
  1878. if (dlg.DoModal() != IDOK)
  1879. {
  1880. PostMessage(WM_QUIT);
  1881. return;
  1882. }
  1883. if (dlg.m_exitcode == 3)
  1884. {
  1885. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  1886. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  1887. }
  1888. else
  1889. {
  1890. ShowWindow(SW_SHOW);
  1891. #ifdef NEW_SKIN
  1892. if (m_pMainFrimDlg2 == NULL)
  1893. {
  1894. m_pMainFrimDlg2 = new MainFrimDlg2;
  1895. m_pMainFrimDlg2->SetLiaPath("10.lia");
  1896. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  1897. }
  1898. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1899. #endif
  1900. }
  1901. }
  1902. else if (g_bStaffAchievementShow == 0) // .非选片、非查看员工业绩;
  1903. {
  1904. #ifdef NEW_SKIN
  1905. g_bNoConnDlg = 1;
  1906. Welcome weldlg;
  1907. weldlg.DoModal();
  1908. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1909. ShowWindow(SW_SHOW);
  1910. g_bNoConnDlg = 0;
  1911. if (g_bNoLoginLia) // Jeff.OnCreate里判断skin文件有5.lia, g_bNoLoginLia = 0, 无 g_bNoLoginLia = 1;
  1912. {
  1913. Login dlg;
  1914. dlg.SetLiaPath("5.lia");
  1915. dlg.DoModal();
  1916. }
  1917. else
  1918. {
  1919. Login3 dlg;
  1920. dlg.SetLiaPath("5.lia"); // Login3的父类为MyDlg,在BOOL MyDlg::OnInitDialog()里调用了纯虚函数Init();
  1921. dlg.DoModal();
  1922. // 数据库完整性提醒;
  1923. if ( 1 == atoi(g_cominfoarray.ElementAt(0).ElementAt(159)) )
  1924. {
  1925. MessageBox(_T("贵店数据库可能已损坏,请尽快联系售后人员进行确认或维护,联系电话:0752-2398865 或 4006-067-068!"), _T("重要提示:"), MB_OK | MB_TOPMOST /*| MB_SETFOREGROUND*/ | MB_ICONWARNING);
  1926. if ( !g_bRunOnCorruptdb )
  1927. exit(0);
  1928. }
  1929. }
  1930. if (g_user.bLongin && g_pMainWnd2)
  1931. {
  1932. g_pMainWnd2->ShowBar(TRUE,TRUE);
  1933. InsideMsg();
  1934. }
  1935. #else
  1936. ShowWindow(SW_SHOW);
  1937. if (g_bNoLoginLia)
  1938. {
  1939. Login dlg;
  1940. dlg.SetLiaPath ("5.lia");
  1941. dlg.DoModal();
  1942. }
  1943. else
  1944. {
  1945. Login3 dlg;
  1946. dlg.SetLiaPath ("5.lia");
  1947. dlg.DoModal();
  1948. }
  1949. #endif
  1950. }
  1951. if (g_hmouse == NULL)
  1952. {
  1953. g_hmouse = SetWindowsHookEx(WH_MOUSE, MouseProc, 0, ::GetCurrentThreadId());
  1954. }
  1955. }
  1956. else if (2 == nIDEvent) //29秒后,若连接和发送未完成,将关闭连接和发送框;
  1957. {
  1958. KillTimer(2);
  1959. if (g_hConnectWnd)
  1960. ::PostMessage(g_hConnectWnd, WM_CLOSE, 0, 0);
  1961. if (g_hSendWnd)
  1962. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1963. if (g_bStaffAchievementShow == 0 && g_bConnLYFZ == 0)
  1964. {
  1965. if (g_bGenBranchData == 0)
  1966. {
  1967. if (g_branchip != "")
  1968. AfxMessageBox("连接分店:" + g_branchname + "失败!", MB_ICONINFORMATION);
  1969. else
  1970. AfxMessageBox("连接服务器失败!", MB_ICONINFORMATION);
  1971. }
  1972. OnDisconnect();
  1973. }
  1974. #ifdef _DEBUG
  1975. printf("SetTimer(2)\n");
  1976. #endif
  1977. g_bSendOK = 0;
  1978. g_bNeedCoon = 1;
  1979. }
  1980. else if (3 == nIDEvent)
  1981. {
  1982. KillTimer(3);
  1983. #ifdef NEW_SKIN
  1984. Welcome weldlg;
  1985. weldlg.DoModal();
  1986. #endif
  1987. ShowWindow(SW_SHOW);
  1988. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1989. g_sendhead.bsql = 0;
  1990. g_sendhead.code[0] = 24;
  1991. g_sendhead.code[1] = 1;
  1992. g_sendhead.tabcount = 2;
  1993. g_pMainWnd->ProcessChatMessageRequest2(1);
  1994. if (g_bSendOK == 0)
  1995. {
  1996. return;
  1997. }
  1998. CArray<CStringArray, CStringArray>patharray;
  1999. CArray<CStringArray, CStringArray>userarray;
  2000. DataToArray(&g_cominfoarray, &g_hisyeararray);
  2001. g_userarray.SetSize(userarray.GetSize(), 1);
  2002. int count = 0;
  2003. for (int ii = 0; ii < userarray.GetSize(); ii++)
  2004. {
  2005. if (userarray.ElementAt(ii).ElementAt(10) == "在职")
  2006. g_userarray.ElementAt(count++).Copy(userarray.ElementAt(ii));
  2007. }
  2008. g_userarray.SetSize(count, 1);
  2009. StaffAchievementShowAll dlg;
  2010. g_pMainWnd->GetOcx();
  2011. dlg.DoModal();
  2012. }
  2013. else if (5 == nIDEvent)
  2014. {
  2015. if (g_bInSkin)
  2016. {
  2017. OutputDebugString("使用皮肤\n");
  2018. return;
  2019. }
  2020. if (g_nAutoShowStaffAchievement == 1){
  2021. OutputDebugString("用于选片\n");
  2022. return;
  2023. }
  2024. if (g_bAllBranch){
  2025. OutputDebugString("多店汇总当中\n");
  2026. return;
  2027. }
  2028. if (g_user.bLongin)
  2029. {
  2030. // m_Mdi.CloseAll();
  2031. g_pMainWnd->OnCommandMenu(IDM_Logout);
  2032. }
  2033. /* g_nAutoShowStaffAchievement=1;
  2034. KillTimer(5);
  2035. StaffAchievementShowAll dlg;
  2036. g_pMainWnd->GetOcx();
  2037. dlg.DoModal ();*/
  2038. }
  2039. else if (6 == nIDEvent)
  2040. {
  2041. static BOOL bDouble = 0;
  2042. bDouble = !bDouble;
  2043. if (bDouble)
  2044. g_pMainWnd->OnCommandMenu(IDM_TAKEAWAYBOOK);
  2045. else
  2046. g_pMainWnd->OnCommandMenu(IDM_CLIENTMONEY);
  2047. }
  2048. else if (7 == nIDEvent)
  2049. {
  2050. KillTimer(7);
  2051. g_bAntiTheft = FALSE;
  2052. if (g_bInSkin)return;
  2053. if (g_nAutoShowStaffAchievement == 1)return;
  2054. if (g_bAllBranch)return;
  2055. #ifdef _DEBUG
  2056. printf("42开始请求服务器信息\n");
  2057. #endif
  2058. g_nSendCode = 42;
  2059. g_bSendOK = FALSE;
  2060. g_pMainWnd->ProcessChatMessageRequest2(1);
  2061. g_nSendCode = 0;
  2062. char *pResult = NULL;
  2063. if ( g_bSendOK )
  2064. {
  2065. cJSON *pJson = cJSON_Parse((char*)g_pData);
  2066. #ifdef _DEBUG
  2067. OutputDebugString("\n");
  2068. OutputDebugString((char*)g_pData);
  2069. OutputDebugString("\n");
  2070. #endif
  2071. cJSON_AddStringToObject(pJson, "软件版本", g_STStudioInfo.strStudioVer);
  2072. cJSON_AddStringToObject(pJson, "影楼名称", g_STStudioInfo.strStudioName);
  2073. cJSON_AddStringToObject(pJson, "影楼电话", g_STStudioInfo.strStudioPhone);
  2074. cJSON_AddStringToObject(pJson, "影楼地址", g_STStudioInfo.strStudioAddress);
  2075. cJSON_AddStringToObject(pJson, "影楼网址", g_STStudioInfo.strStudioWebSite);
  2076. cJSON_AddStringToObject(pJson, "影楼老板", g_STStudioInfo.strStudioManager);
  2077. cJSON_AddStringToObject(pJson, "影楼域名", g_domain);
  2078. cJSON_AddNumberToObject(pJson, "订单数量", g_STStudioInfo.dwStudioOrderCount);
  2079. cJSON_AddNumberToObject(pJson, "历史订单数量", g_STStudioInfo.dwStudioHistoryOrderCount);
  2080. pResult = cJSON_Print(pJson);
  2081. if ( pResult)
  2082. {
  2083. #ifdef _DEBUG
  2084. WriteTextLog(pResult);
  2085. #endif
  2086. cJSON_Delete(pJson);
  2087. // 指示连接的服务器为lijiafz.vicp.net;
  2088. g_bConnLYFZ = 1;
  2089. // 断开当前连接;
  2090. OnDisconnect();
  2091. g_bSendOK = FALSE;
  2092. g_nSendCode = 18;
  2093. int nEncryptlen = strlen(pResult);
  2094. #ifdef _DEBUG
  2095. printf("18:%d,%s\n\n",nEncryptlen, pResult);
  2096. #endif
  2097. EncryptFile2((BYTE*)pResult, nEncryptlen, "888666333");
  2098. g_pMainWnd->ProcessChatMessageRequest2((BYTE*)pResult, nEncryptlen);
  2099. g_nSendCode = 0;
  2100. delete[]pResult;
  2101. g_bSendLYFZ = 0;
  2102. g_bConnLYFZ = 0;
  2103. OnDisconnect();
  2104. #ifdef _DEBUG
  2105. printf("发送后台%s\n,断开当前连接,开始连接本地服务器\n", g_bSendOK ? "发送成功" : "发送失败");
  2106. #endif
  2107. if (g_bSendOK)
  2108. {
  2109. #ifdef _DEBUG
  2110. printf("43开始请求服务器信息\n");
  2111. #endif
  2112. g_nSendCode = 43;
  2113. g_pMainWnd->ProcessChatMessageRequest2(g_pData, g_nLeng);
  2114. g_nSendCode = 0;
  2115. g_bAntiTheft = FALSE;
  2116. }
  2117. }
  2118. }
  2119. }
  2120. }
  2121. void CMainFrame::OnOutbarNotify(CString strMsg)
  2122. {
  2123. if (g_user.bLongin == 0)
  2124. {
  2125. if (g_bNoLoginLia)
  2126. {
  2127. Login dlg;
  2128. dlg.SetLiaPath("5.lia");
  2129. dlg.DoModal();
  2130. }
  2131. else
  2132. {
  2133. Login3 dlg;
  2134. dlg.SetLiaPath("5.lia");
  2135. dlg.DoModal();
  2136. }
  2137. return;
  2138. if (g_user.bLongin == 0)return;
  2139. }
  2140. else
  2141. {
  2142. InsideMsg();
  2143. }
  2144. ResetTimer();
  2145. if (strMsg == "开单")
  2146. {
  2147. if (IsHasRights(0) == 0)return;
  2148. Booking2 dlg;
  2149. dlg.DoModal();
  2150. return;
  2151. }
  2152. else if (strMsg == "拍照")
  2153. {
  2154. if (IsHasRights(1) == 0)return;
  2155. UINT nID = 1;
  2156. LPSTR pName;
  2157. pName = (LPSTR)(LPCSTR)"拍照";
  2158. OPEN_MENU(TakeFrom);
  2159. return;
  2160. }
  2161. else if (strMsg == "修片")
  2162. {
  2163. if (IsHasRights(1) == 0)return;
  2164. UINT nID = 1;
  2165. LPSTR pName;
  2166. pName = (LPSTR)(LPCSTR)"修片";
  2167. OPEN_MENU(BeautifySkinFrom);
  2168. return;
  2169. }
  2170. else if (strMsg == "选片")
  2171. {
  2172. if (IsHasRights(2) == 0)return;
  2173. UINT nID = 1;
  2174. LPSTR pName;
  2175. pName = (LPSTR)(LPCSTR)"选片";
  2176. OPEN_MENU(ChoosePhotoForm);
  2177. return;
  2178. }
  2179. else if (strMsg == "精修")
  2180. {
  2181. if (IsHasRights(2) == 0)return;
  2182. UINT nID = 1;
  2183. LPSTR pName;
  2184. pName = (LPSTR)(LPCSTR)"精修";
  2185. OPEN_MENU(BeautifySkinFrom2);
  2186. return;
  2187. }
  2188. else if (strMsg == "设计")
  2189. {
  2190. if (IsHasRights(2) == 0)return;
  2191. UINT nID = 1;
  2192. LPSTR pName;
  2193. pName = (LPSTR)(LPCSTR)"设计";
  2194. OPEN_MENU(DesignFrom);
  2195. return;
  2196. }
  2197. else if (strMsg == "数码安排")
  2198. {
  2199. UINT nID = 1;
  2200. LPSTR pName;
  2201. pName = (LPSTR)(LPCSTR)"数码安排";
  2202. OPEN_MENU(DigitalWork);
  2203. return;
  2204. }
  2205. else if (strMsg == "刻盘")
  2206. {
  2207. UINT nID = 1;
  2208. LPSTR pName;
  2209. pName = (LPSTR)(LPCSTR)"刻盘";
  2210. OPEN_MENU(BurnCD);
  2211. return;
  2212. }
  2213. else if (strMsg == "相片冲印")
  2214. {
  2215. UINT nID = 1;
  2216. LPSTR pName;
  2217. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  2218. OPEN_MENU(PhotoPrintFrom);
  2219. return;
  2220. }
  2221. else if (strMsg == "发片/取件")
  2222. {
  2223. if (IsHasRights(3) == 0)return;
  2224. UINT nID = 1;
  2225. LPSTR pName;
  2226. pName = (LPSTR)(LPCSTR)"发片/取件";
  2227. OPEN_MENU(outsourcing);
  2228. return;
  2229. }
  2230. else if (strMsg == "满意度")
  2231. {
  2232. UINT nID = 1;
  2233. LPSTR pName;
  2234. pName = (LPSTR)(LPCSTR)"满意度";
  2235. OPEN_MENU(Satisfaction);
  2236. return;
  2237. }
  2238. else if (strMsg == "满意度汇总")
  2239. {
  2240. UINT nID = 1;
  2241. LPSTR pName;
  2242. pName = (LPSTR)(LPCSTR)"满意度汇总";
  2243. OPEN_MENU(SatisfactionReportForm);
  2244. return;
  2245. }
  2246. #if JEFF_DELETE_ON // 2014.11.14-PM 16:20
  2247. else if (strMsg == "回复统计")
  2248. {
  2249. UINT nID = 1;
  2250. LPSTR pName;
  2251. pName = (LPSTR)(LPCSTR)"回复统计";
  2252. OPEN_MENU(MsgReg2);
  2253. return;
  2254. }
  2255. #endif
  2256. /* else if(strMsg=="取件")
  2257. {
  2258. if(IsHasRights(3)==0)return;
  2259. UINT nID=1;
  2260. LPSTR pName ;
  2261. pName = (LPSTR)(LPCSTR)"取件";
  2262. OPEN_MENU(TakeAwayFrom);
  2263. return;
  2264. }*/
  2265. else if (strMsg == "其它收入")
  2266. {
  2267. if (IsHasRightsnew(16) == 0)return;
  2268. // if(IsHasRightsnew(48)==0)return;
  2269. UINT nID = 1;
  2270. LPSTR pName;
  2271. pName = (LPSTR)(LPCSTR)"其它收入";
  2272. OPEN_MENU(IncomeInput);
  2273. return;
  2274. }
  2275. else if (strMsg == "散客消费")
  2276. {
  2277. if (IsHasRightsnew(16) == 0)return;
  2278. UINT nID = 1;
  2279. LPSTR pName;
  2280. pName = (LPSTR)(LPCSTR)"散客消费";
  2281. OPEN_MENU(IncomeInput2);
  2282. return;
  2283. }
  2284. else if (strMsg == "员工奖罚")
  2285. {
  2286. if (IsHasRightsnew(16) == 0)return;
  2287. UINT nID = 1;
  2288. LPSTR pName;
  2289. pName = (LPSTR)(LPCSTR)"员工奖罚";
  2290. OPEN_MENU(IncomeInput3);
  2291. return;
  2292. }
  2293. else if (strMsg == "员工奖惩")
  2294. {
  2295. if (IsHasRightsnew(16) == 0)return;
  2296. UINT nID = 1;
  2297. LPSTR pName;
  2298. pName = (LPSTR)(LPCSTR)"员工奖惩";
  2299. OPEN_MENU(IncomeInput4);
  2300. return;
  2301. }
  2302. else if (strMsg == "订单收款")
  2303. {
  2304. if (IsHasRights(17) == 0)return;
  2305. UINT nID = 1;
  2306. LPSTR pName;
  2307. pName = (LPSTR)(LPCSTR)"订单收款";
  2308. OPEN_MENU(FinanceForm);
  2309. return;
  2310. }
  2311. else if (strMsg == "日财务表")
  2312. {
  2313. if (IsHasRightsnew(22) == 0)return;
  2314. UINT nID = 2;
  2315. LPSTR pName;
  2316. pName = (LPSTR)(LPCSTR)"日财务表";
  2317. OPEN_MENU(DailyForm);
  2318. return;
  2319. }
  2320. else if (strMsg == "提成比例")
  2321. {
  2322. #ifndef ENTERPRISE_VERSION
  2323. #ifndef CHILD_VERSION
  2324. #ifdef BASIC_VERSION
  2325. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2326. {
  2327. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2328. exit(0);return;
  2329. }
  2330. #else
  2331. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2332. {
  2333. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2334. exit(0);return;
  2335. }
  2336. #endif
  2337. #else
  2338. #ifdef BASIC_VERSION
  2339. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2340. {
  2341. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2342. exit(0);return;
  2343. }
  2344. #else
  2345. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2346. {
  2347. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2348. exit(0); return;
  2349. }
  2350. #endif
  2351. #endif
  2352. #else
  2353. #ifndef CHILD_VERSION
  2354. #ifdef BASIC_VERSION
  2355. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2356. {
  2357. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2358. exit(0); return;
  2359. }
  2360. #else
  2361. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2362. {
  2363. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2364. exit(0); return;
  2365. }
  2366. #endif
  2367. #else
  2368. #ifdef BASIC_VERSION
  2369. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2370. {
  2371. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2372. exit(0);return;
  2373. }
  2374. #else
  2375. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2376. {
  2377. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2378. exit(0); return;
  2379. }
  2380. #endif
  2381. #endif
  2382. #endif
  2383. UINT nID = 2;
  2384. LPSTR pName;
  2385. pName = (LPSTR)(LPCSTR)"提成比例";
  2386. OPEN_MENU(SalarySet2);
  2387. return;
  2388. }
  2389. //else if(strMsg=="员工工作")
  2390. else if (strMsg == "计件提成")
  2391. {
  2392. UINT nID = 2;
  2393. LPSTR pName;
  2394. //pName = (LPSTR)(LPCSTR)"员工工作";
  2395. pName = (LPSTR)(LPCSTR)"计件提成";
  2396. OPEN_MENU(SalarySet3);
  2397. return;
  2398. }
  2399. else if (strMsg == "工资管理")
  2400. {
  2401. #ifndef ENTERPRISE_VERSION
  2402. #ifndef CHILD_VERSION
  2403. #ifdef BASIC_VERSION
  2404. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2405. {
  2406. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2407. exit(0);return;
  2408. }
  2409. #else
  2410. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2411. {
  2412. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2413. exit(0);return;
  2414. }
  2415. #endif
  2416. #else
  2417. #ifdef BASIC_VERSION
  2418. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2419. {
  2420. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2421. exit(0);return;
  2422. }
  2423. #else
  2424. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2425. {
  2426. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2427. exit(0); return;
  2428. }
  2429. #endif
  2430. #endif
  2431. #else
  2432. #ifndef CHILD_VERSION
  2433. #ifdef BASIC_VERSION
  2434. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2435. {
  2436. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2437. exit(0); return;
  2438. }
  2439. #else
  2440. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2441. {
  2442. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2443. exit(0); return;
  2444. }
  2445. #endif
  2446. #else
  2447. #ifdef BASIC_VERSION
  2448. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2449. {
  2450. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2451. exit(0);return;
  2452. }
  2453. #else
  2454. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2455. {
  2456. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2457. exit(0); return;
  2458. }
  2459. #endif
  2460. #endif
  2461. #endif
  2462. UINT nID = 2;
  2463. LPSTR pName;
  2464. pName = (LPSTR)(LPCSTR)"工资管理";
  2465. OPEN_MENU(MySalary);
  2466. return;
  2467. }
  2468. else if (strMsg == "客人付款")
  2469. {
  2470. UINT nID = 2;
  2471. LPSTR pName;
  2472. pName = (LPSTR)(LPCSTR)"客人付款";
  2473. OPEN_MENU(ClientMoney);
  2474. return;
  2475. }
  2476. else if (strMsg == "工资报表")
  2477. {
  2478. #ifndef ENTERPRISE_VERSION
  2479. #ifndef CHILD_VERSION
  2480. #ifdef BASIC_VERSION
  2481. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2482. {
  2483. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2484. exit(0);return;
  2485. }
  2486. #else
  2487. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2488. {
  2489. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2490. exit(0);return;
  2491. }
  2492. #endif
  2493. #else
  2494. #ifdef BASIC_VERSION
  2495. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2496. {
  2497. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2498. exit(0);return;
  2499. }
  2500. #else
  2501. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2502. {
  2503. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2504. exit(0); return;
  2505. }
  2506. #endif
  2507. #endif
  2508. #else
  2509. #ifndef CHILD_VERSION
  2510. #ifdef BASIC_VERSION
  2511. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2512. {
  2513. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2514. exit(0); return;
  2515. }
  2516. #else
  2517. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2518. {
  2519. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2520. exit(0); return;
  2521. }
  2522. #endif
  2523. #else
  2524. #ifdef BASIC_VERSION
  2525. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  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) != "7")
  2532. {
  2533. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2534. exit(0); return;
  2535. }
  2536. #endif
  2537. #endif
  2538. #endif
  2539. if (IsHasRightsnew(25) == 0)return;
  2540. UINT nID = 2;
  2541. LPSTR pName;
  2542. pName = (LPSTR)(LPCSTR)"工资报表";
  2543. g_ncount = 100;
  2544. OPEN_MENU(MySalary);
  2545. return;
  2546. }
  2547. else if (strMsg == "员工业绩")
  2548. {
  2549. #ifndef ENTERPRISE_VERSION
  2550. #ifndef CHILD_VERSION
  2551. #ifdef BASIC_VERSION
  2552. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2553. {
  2554. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2555. exit(0);return;
  2556. }
  2557. #else
  2558. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2559. {
  2560. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2561. exit(0);return;
  2562. }
  2563. #endif
  2564. #else
  2565. #ifdef BASIC_VERSION
  2566. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2567. {
  2568. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2569. exit(0);return;
  2570. }
  2571. #else
  2572. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2573. {
  2574. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2575. exit(0); return;
  2576. }
  2577. #endif
  2578. #endif
  2579. #else
  2580. #ifndef CHILD_VERSION
  2581. #ifdef BASIC_VERSION
  2582. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2583. {
  2584. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2585. exit(0); return;
  2586. }
  2587. #else
  2588. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2589. {
  2590. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2591. exit(0); return;
  2592. }
  2593. #endif
  2594. #else
  2595. #ifdef BASIC_VERSION
  2596. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2597. {
  2598. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2599. exit(0);return;
  2600. }
  2601. #else
  2602. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2603. {
  2604. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2605. exit(0); return;
  2606. }
  2607. #endif
  2608. #endif
  2609. #endif
  2610. if (IsHasRightsnew(33) == 0)return;
  2611. UINT nID = 2;
  2612. LPSTR pName;
  2613. pName = (LPSTR)(LPCSTR)"员工业绩";
  2614. OPEN_MENU(StaffAchievement);
  2615. return;
  2616. }
  2617. else if (strMsg == "订单客户")
  2618. {
  2619. UINT nID = 2;
  2620. LPSTR pName;
  2621. pName = (LPSTR)(LPCSTR)"订单客户";
  2622. g_dx += 10000;
  2623. OPEN_MENU(CClientForm);
  2624. if (g_dx >= 10000)g_dx -= 10000;
  2625. return;
  2626. }
  2627. else if (strMsg == "意向客户")
  2628. {
  2629. UINT nID = 2;
  2630. LPSTR pName;
  2631. pName = (LPSTR)(LPCSTR)"意向客户";
  2632. OPEN_MENU(Client2Form);
  2633. return;
  2634. }
  2635. else if (strMsg == "老客户")
  2636. {
  2637. UINT nID = 2;
  2638. LPSTR pName;
  2639. pName = (LPSTR)(LPCSTR)"老客户";
  2640. OPEN_MENU(OldClient);
  2641. return;
  2642. }
  2643. else if (strMsg == "客户来电")
  2644. {
  2645. UINT nID = 2;
  2646. LPSTR pName;
  2647. pName = (LPSTR)(LPCSTR)"客户来电";
  2648. OPEN_MENU(PhoneRecord);
  2649. return;
  2650. }
  2651. else if (strMsg == "拨出电话")
  2652. {
  2653. UINT nID = 2;
  2654. LPSTR pName;
  2655. pName = (LPSTR)(LPCSTR)"拨出电话";
  2656. OPEN_MENU(PhoneRecordOut);
  2657. return;
  2658. }
  2659. else if (strMsg == "未接来电")
  2660. {
  2661. UINT nID = 2;
  2662. LPSTR pName;
  2663. pName = (LPSTR)(LPCSTR)"未接来电";
  2664. OPEN_MENU(MissCall);
  2665. return;
  2666. }
  2667. else if (strMsg == "客户流失")
  2668. {
  2669. UINT nID = 2;
  2670. LPSTR pName;
  2671. pName = (LPSTR)(LPCSTR)"客户流失";
  2672. OPEN_MENU(ClientReasonChart);
  2673. return;
  2674. }
  2675. else if (strMsg == "客户来源")
  2676. {
  2677. UINT nID = 2;
  2678. LPSTR pName;
  2679. pName = (LPSTR)(LPCSTR)"客户来源";
  2680. OPEN_MENU(ClientFromChart);
  2681. return;
  2682. }
  2683. else if (strMsg == "月财务表")
  2684. {
  2685. if (IsHasRightsnew(23) == 0)return;
  2686. UINT nID = 2;
  2687. LPSTR pName;
  2688. pName = (LPSTR)(LPCSTR)"月财务表";
  2689. OPEN_MENU(MonthForm);
  2690. return;
  2691. }
  2692. else if (strMsg == "支出报表")
  2693. {
  2694. if (IsHasRightsnew(23) == 0)return;
  2695. UINT nID = 2;
  2696. LPSTR pName;
  2697. pName = (LPSTR)(LPCSTR)"支出报表";
  2698. OPEN_MENU(MonthForm2);
  2699. return;
  2700. }
  2701. else if (strMsg == "年财务表")
  2702. {
  2703. if (IsHasRightsnew(24) == 0)return;
  2704. UINT nID = 2;
  2705. LPSTR pName;
  2706. pName = (LPSTR)(LPCSTR)"年财务表";
  2707. OPEN_MENU(YearForm);
  2708. return;
  2709. }
  2710. else if (strMsg == "年财务图表")
  2711. {
  2712. if (IsHasRightsnew(24) == 0)return;
  2713. GetOcx();
  2714. UINT nID = 2;
  2715. LPSTR pName;
  2716. pName = (LPSTR)(LPCSTR)"年财务图表";
  2717. OPEN_MENU(YearForm2);
  2718. return;
  2719. }
  2720. else if (strMsg == "订单图表")
  2721. {
  2722. GetOcx();
  2723. UINT nID = 2;
  2724. LPSTR pName;
  2725. pName = (LPSTR)(LPCSTR)"订单图表";
  2726. OPEN_MENU(DinDanForm);
  2727. return;
  2728. }
  2729. #ifdef ENTERPRISE_VERSION
  2730. else if (strMsg == "订单报表")
  2731. {
  2732. GetOcx();
  2733. UINT nID = 2;
  2734. LPSTR pName;
  2735. pName = (LPSTR)(LPCSTR)"订单报表2";
  2736. OPEN_MENU(DinDanFromBranch);
  2737. return;
  2738. }
  2739. else if (strMsg == "财务图表")
  2740. {
  2741. GetOcx();
  2742. UINT nID = 2;
  2743. LPSTR pName;
  2744. pName = (LPSTR)(LPCSTR)"财务图表";
  2745. OPEN_MENU(YearFormBranch);
  2746. return;
  2747. }
  2748. else if (strMsg == "订单图表")
  2749. {
  2750. GetOcx();
  2751. UINT nID = 2;
  2752. LPSTR pName;
  2753. pName = (LPSTR)(LPCSTR)"订单图表";
  2754. OPEN_MENU(YearFormBranch2);
  2755. return;
  2756. }
  2757. else if (strMsg == "摄控安排")
  2758. {
  2759. UINT nID = 2;
  2760. LPSTR pName;
  2761. pName = (LPSTR)(LPCSTR)"摄控安排";
  2762. g_bookingtype = 0;
  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 = 1;
  2772. OPEN_MENU(TodayForm);
  2773. return;
  2774. }
  2775. else if (strMsg == "看样预约")
  2776. {
  2777. UINT nID = 2;
  2778. LPSTR pName;
  2779. pName = (LPSTR)(LPCSTR)"看样预约";
  2780. g_bookingtype = 2;
  2781. OPEN_MENU(TodayForm);
  2782. return;
  2783. }
  2784. else if (strMsg == "取件预约")
  2785. {
  2786. UINT nID = 2;
  2787. LPSTR pName;
  2788. pName = (LPSTR)(LPCSTR)"取件预约";
  2789. g_bookingtype = 3;
  2790. OPEN_MENU(TodayForm);
  2791. return;
  2792. }
  2793. else if (strMsg == "婚庆安排")
  2794. {
  2795. UINT nID = 2;
  2796. LPSTR pName;
  2797. pName = (LPSTR)(LPCSTR)"婚庆安排";
  2798. g_bookingtype = 4;
  2799. OPEN_MENU(TodayForm);
  2800. return;
  2801. }
  2802. #endif
  2803. else if (strMsg == "员工资料")
  2804. {
  2805. UINT nID = 2;
  2806. LPSTR pName;
  2807. pName = (LPSTR)(LPCSTR)"员工资料";
  2808. if (g_bAllBranch)
  2809. OPEN_MENU(EmployeeForm2);
  2810. else
  2811. OPEN_MENU(EmployeeForm);
  2812. return;
  2813. }
  2814. else if (strMsg == "客户区域")
  2815. {
  2816. // if(IsHasRightsnew(48)==0)return;
  2817. GetOcx();
  2818. UINT nID = 2;
  2819. LPSTR pName;
  2820. pName = (LPSTR)(LPCSTR)"客户区域";
  2821. OPEN_MENU(AreaClient);
  2822. return;
  2823. }
  2824. else if (strMsg == "客户报表")
  2825. {
  2826. UINT nID = 3;
  2827. LPSTR pName;
  2828. pName = (LPSTR)(LPCSTR)"客户报表";
  2829. OPEN_MENU(CClientForm);
  2830. return;
  2831. }
  2832. else if (strMsg == "现金支出")
  2833. {
  2834. if (IsHasRightsnew(16) == 0)return;
  2835. UINT nID = 3;
  2836. LPSTR pName;
  2837. pName = (LPSTR)(LPCSTR)"现金支出";
  2838. OPEN_MENU(PayOutInput);
  2839. return;
  2840. }
  2841. else if (strMsg == "短信群发")
  2842. {
  2843. UINT nID = 3;
  2844. LPSTR pName;
  2845. pName = (LPSTR)(LPCSTR)"短信群发";
  2846. OPEN_MENU(SendMsg);
  2847. return;
  2848. }
  2849. else if (strMsg == "短信发送")
  2850. {
  2851. UINT nID = 3;
  2852. LPSTR pName;
  2853. pName = (LPSTR)(LPCSTR)"客户报表";
  2854. OPEN_MENU(CClientForm);
  2855. return;
  2856. }
  2857. else if (strMsg == "流程短信")
  2858. {
  2859. UINT nID = 3;
  2860. LPSTR pName;
  2861. pName = (LPSTR)(LPCSTR)"流程短信";
  2862. OPEN_MENU(WorkMsg);
  2863. return;
  2864. }
  2865. else if (strMsg == "员工短信")
  2866. {
  2867. UINT nID = 3;
  2868. LPSTR pName;
  2869. pName = (LPSTR)(LPCSTR)"员工短信";
  2870. OPEN_MENU(EmployeeMsg);
  2871. return;
  2872. }
  2873. else if (strMsg == "发送记录")
  2874. {
  2875. UINT nID = 3;
  2876. LPSTR pName;
  2877. pName = (LPSTR)(LPCSTR)"发送记录";
  2878. OPEN_MENU(MsgReg);
  2879. return;
  2880. }
  2881. else if (strMsg == "短信设置")
  2882. {
  2883. if (IsHasRightsnew(49) == 0)return;
  2884. MsgSet dlg;
  2885. dlg.DoModal();
  2886. return;
  2887. }
  2888. else if (strMsg == "金卡会员")
  2889. {
  2890. #ifndef ENTERPRISE_VERSION
  2891. #ifndef CHILD_VERSION
  2892. #ifdef BASIC_VERSION
  2893. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2894. {
  2895. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2896. exit(0);return;
  2897. }
  2898. #else
  2899. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2900. {
  2901. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2902. exit(0);return;
  2903. }
  2904. #endif
  2905. #else
  2906. #ifdef BASIC_VERSION
  2907. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2908. {
  2909. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2910. exit(0);return;
  2911. }
  2912. #else
  2913. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2914. {
  2915. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2916. exit(0); return;
  2917. }
  2918. #endif
  2919. #endif
  2920. #else
  2921. #ifndef CHILD_VERSION
  2922. #ifdef BASIC_VERSION
  2923. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2924. {
  2925. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2926. exit(0); return;
  2927. }
  2928. #else
  2929. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2930. {
  2931. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2932. exit(0); return;
  2933. }
  2934. #endif
  2935. #else
  2936. #ifdef BASIC_VERSION
  2937. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2938. {
  2939. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2940. exit(0);return;
  2941. }
  2942. #else
  2943. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2944. {
  2945. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2946. exit(0); return;
  2947. }
  2948. #endif
  2949. #endif
  2950. #endif
  2951. UINT nID = 3;
  2952. LPSTR pName;
  2953. pName = (LPSTR)(LPCSTR)"金卡会员";
  2954. OPEN_MENU(ShowMember);
  2955. return;
  2956. }
  2957. else if (strMsg == "现金子卡")
  2958. {
  2959. UINT nID = 3;
  2960. LPSTR pName;
  2961. pName = (LPSTR)(LPCSTR)"现金子卡";
  2962. OPEN_MENU(ShowMember2);
  2963. return;
  2964. }
  2965. else if (strMsg == "蓝钻会员")
  2966. {
  2967. #ifndef ENTERPRISE_VERSION
  2968. #ifndef CHILD_VERSION
  2969. #ifdef BASIC_VERSION
  2970. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2971. {
  2972. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2973. exit(0);return;
  2974. }
  2975. #else
  2976. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2977. {
  2978. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2979. exit(0);return;
  2980. }
  2981. #endif
  2982. #else
  2983. #ifdef BASIC_VERSION
  2984. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2985. {
  2986. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2987. exit(0);return;
  2988. }
  2989. #else
  2990. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2991. {
  2992. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2993. exit(0); return;
  2994. }
  2995. #endif
  2996. #endif
  2997. #else
  2998. #ifndef CHILD_VERSION
  2999. #ifdef BASIC_VERSION
  3000. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3001. {
  3002. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3003. exit(0); return;
  3004. }
  3005. #else
  3006. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3007. {
  3008. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3009. exit(0); return;
  3010. }
  3011. #endif
  3012. #else
  3013. #ifdef BASIC_VERSION
  3014. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3015. {
  3016. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3017. exit(0);return;
  3018. }
  3019. #else
  3020. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3021. {
  3022. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3023. exit(0); return;
  3024. }
  3025. #endif
  3026. #endif
  3027. #endif
  3028. UINT nID = 3;
  3029. LPSTR pName;
  3030. pName = (LPSTR)(LPCSTR)"蓝钻会员";
  3031. OPEN_MENU(ShowMemberBlue);
  3032. return;
  3033. }
  3034. else if (strMsg == "转介绍积分")
  3035. {
  3036. #ifndef ENTERPRISE_VERSION
  3037. #ifndef CHILD_VERSION
  3038. #ifdef BASIC_VERSION
  3039. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3040. {
  3041. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3042. exit(0);return;
  3043. }
  3044. #else
  3045. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3046. {
  3047. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3048. exit(0);return;
  3049. }
  3050. #endif
  3051. #else
  3052. #ifdef BASIC_VERSION
  3053. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3054. {
  3055. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3056. exit(0);return;
  3057. }
  3058. #else
  3059. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3060. {
  3061. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3062. exit(0); return;
  3063. }
  3064. #endif
  3065. #endif
  3066. #else
  3067. #ifndef CHILD_VERSION
  3068. #ifdef BASIC_VERSION
  3069. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3070. {
  3071. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3072. exit(0); return;
  3073. }
  3074. #else
  3075. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3076. {
  3077. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3078. exit(0); return;
  3079. }
  3080. #endif
  3081. #else
  3082. #ifdef BASIC_VERSION
  3083. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3084. {
  3085. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3086. exit(0);return;
  3087. }
  3088. #else
  3089. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3090. {
  3091. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3092. exit(0); return;
  3093. }
  3094. #endif
  3095. #endif
  3096. #endif
  3097. UINT nID = 3;
  3098. LPSTR pName;
  3099. pName = (LPSTR)(LPCSTR)"转介绍积分";
  3100. OPEN_MENU(Card2Reg);
  3101. return;
  3102. }
  3103. /* else if(strMsg=="转介绍图表")
  3104. {
  3105. #ifndef ENTERPRISE_VERSION
  3106. #ifndef CHILD_VERSION
  3107. #ifdef BASIC_VERSION
  3108. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="0")
  3109. {
  3110. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3111. exit(0);return;
  3112. }
  3113. #else
  3114. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3115. {
  3116. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3117. exit(0);return;
  3118. }
  3119. #endif
  3120. #else
  3121. #ifdef BASIC_VERSION
  3122. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3123. {
  3124. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3125. exit(0);return;
  3126. }
  3127. #else
  3128. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  3129. {
  3130. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3131. exit(0);return;
  3132. }
  3133. #endif
  3134. #endif
  3135. #else
  3136. #ifndef CHILD_VERSION
  3137. #ifdef BASIC_VERSION
  3138. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3139. {
  3140. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3141. exit(0);return;
  3142. }
  3143. #else
  3144. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="5")
  3145. {
  3146. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3147. exit(0);return;
  3148. }
  3149. #endif
  3150. #else
  3151. #ifdef BASIC_VERSION
  3152. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="6")
  3153. {
  3154. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3155. exit(0);return;
  3156. }
  3157. #else
  3158. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="7")
  3159. {
  3160. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3161. exit(0);return;
  3162. }
  3163. #endif
  3164. #endif
  3165. #endif
  3166. UINT nID=3;
  3167. LPSTR pName ;
  3168. pName = (LPSTR)(LPCSTR)"转介绍图表";
  3169. OPEN_MENU(Card2RegChart);
  3170. return;
  3171. }*/
  3172. else if (strMsg == "金卡图表")
  3173. {
  3174. UINT nID = 3;
  3175. LPSTR pName;
  3176. pName = (LPSTR)(LPCSTR)"金卡图表";
  3177. OPEN_MENU(MemberChart);
  3178. return;
  3179. }
  3180. else if (strMsg == "积分短信")
  3181. {
  3182. UINT nID = 3;
  3183. LPSTR pName;
  3184. pName = (LPSTR)(LPCSTR)"积分短信";
  3185. OPEN_MENU(ShowMemberMsg);
  3186. return;
  3187. }
  3188. else if (strMsg == "转介绍返现")
  3189. {
  3190. #ifndef ENTERPRISE_VERSION
  3191. #ifndef CHILD_VERSION
  3192. #ifdef BASIC_VERSION
  3193. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3194. {
  3195. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3196. exit(0);return;
  3197. }
  3198. #else
  3199. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3200. {
  3201. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3202. exit(0);return;
  3203. }
  3204. #endif
  3205. #else
  3206. #ifdef BASIC_VERSION
  3207. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3208. {
  3209. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3210. exit(0);return;
  3211. }
  3212. #else
  3213. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3214. {
  3215. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3216. exit(0); return;
  3217. }
  3218. #endif
  3219. #endif
  3220. #else
  3221. #ifndef CHILD_VERSION
  3222. #ifdef BASIC_VERSION
  3223. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3224. {
  3225. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3226. exit(0); return;
  3227. }
  3228. #else
  3229. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3230. {
  3231. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3232. exit(0); return;
  3233. }
  3234. #endif
  3235. #else
  3236. #ifdef BASIC_VERSION
  3237. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3238. {
  3239. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3240. exit(0);return;
  3241. }
  3242. #else
  3243. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3244. {
  3245. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3246. exit(0); return;
  3247. }
  3248. #endif
  3249. #endif
  3250. #endif
  3251. UINT nID = 3;
  3252. LPSTR pName;
  3253. pName = (LPSTR)(LPCSTR)"转介绍返现";
  3254. OPEN_MENU(Card2RegBlue);
  3255. return;
  3256. }
  3257. else if (strMsg == "转介绍图表")
  3258. {
  3259. #ifndef ENTERPRISE_VERSION
  3260. #ifndef CHILD_VERSION
  3261. #ifdef BASIC_VERSION
  3262. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3263. {
  3264. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3265. exit(0);return;
  3266. }
  3267. #else
  3268. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3269. {
  3270. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3271. exit(0);return;
  3272. }
  3273. #endif
  3274. #else
  3275. #ifdef BASIC_VERSION
  3276. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3277. {
  3278. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3279. exit(0);return;
  3280. }
  3281. #else
  3282. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3283. {
  3284. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3285. exit(0); return;
  3286. }
  3287. #endif
  3288. #endif
  3289. #else
  3290. #ifndef CHILD_VERSION
  3291. #ifdef BASIC_VERSION
  3292. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3293. {
  3294. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3295. exit(0); return;
  3296. }
  3297. #else
  3298. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3299. {
  3300. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3301. exit(0); return;
  3302. }
  3303. #endif
  3304. #else
  3305. #ifdef BASIC_VERSION
  3306. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3307. {
  3308. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3309. exit(0);return;
  3310. }
  3311. #else
  3312. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3313. {
  3314. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3315. exit(0); return;
  3316. }
  3317. #endif
  3318. #endif
  3319. #endif
  3320. UINT nID = 3;
  3321. LPSTR pName;
  3322. pName = (LPSTR)(LPCSTR)"转介绍图表";
  3323. OPEN_MENU(Card2RegChartBlue);
  3324. return;
  3325. }
  3326. else if (strMsg == "积分设置")
  3327. {
  3328. if (IsHasRightsnew(49) == 0)return;
  3329. MemberSet dlg;
  3330. dlg.DoModal();
  3331. return;
  3332. }
  3333. else if (strMsg == "礼服录入")
  3334. {
  3335. if (IsHasRightsnew(39) == 0)return;
  3336. UINT nID = 3;
  3337. LPSTR pName;
  3338. pName = (LPSTR)(LPCSTR)"礼服录入";
  3339. OPEN_MENU(DressManage);
  3340. return;
  3341. }
  3342. else if (strMsg == "礼服查看")
  3343. {
  3344. #ifndef ENTERPRISE_VERSION
  3345. #ifndef CHILD_VERSION
  3346. #ifdef BASIC_VERSION
  3347. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3348. {
  3349. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3350. exit(0);return;
  3351. }
  3352. #else
  3353. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3354. {
  3355. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3356. exit(0);return;
  3357. }
  3358. #endif
  3359. #else
  3360. #ifdef BASIC_VERSION
  3361. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3362. {
  3363. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3364. exit(0);return;
  3365. }
  3366. #else
  3367. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3368. {
  3369. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3370. exit(0); return;
  3371. }
  3372. #endif
  3373. #endif
  3374. #else
  3375. #ifndef CHILD_VERSION
  3376. #ifdef BASIC_VERSION
  3377. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3378. {
  3379. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3380. exit(0); return;
  3381. }
  3382. #else
  3383. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3384. {
  3385. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3386. exit(0); return;
  3387. }
  3388. #endif
  3389. #else
  3390. #ifdef BASIC_VERSION
  3391. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3392. {
  3393. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3394. exit(0);return;
  3395. }
  3396. #else
  3397. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3398. {
  3399. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3400. exit(0); return;
  3401. }
  3402. #endif
  3403. #endif
  3404. #endif
  3405. if (IsHasRightsnew(40) == 0)return;
  3406. UINT nID = 3;
  3407. LPSTR pName;
  3408. pName = (LPSTR)(LPCSTR)"礼服查看";
  3409. OPEN_MENU(ShowDress);
  3410. return;
  3411. }
  3412. else if (strMsg == "撞期预警")
  3413. {
  3414. UINT nID = 3;
  3415. LPSTR pName;
  3416. pName = (LPSTR)(LPCSTR)"撞期预警";
  3417. OPEN_MENU(DressEarlyWarning);
  3418. return;
  3419. }
  3420. else if (strMsg == "礼服出租")
  3421. {
  3422. UINT nID = 3;
  3423. LPSTR pName;
  3424. pName = (LPSTR)(LPCSTR)"礼服出租";
  3425. OPEN_MENU(ShowHireReg);
  3426. return;
  3427. }
  3428. else if (strMsg == "礼服图片")
  3429. {
  3430. ShowPic dlg;
  3431. dlg.m_mode = 4;
  3432. //dlg.m_path = g_path5 + "\\";
  3433. dlg.m_id = g_path5 + "\\";
  3434. dlg.DoModal();
  3435. return;
  3436. }
  3437. else if (strMsg == "商品类别设置")
  3438. {
  3439. if (IsHasRightsnew(29) == 0)return;
  3440. SPLBDlg dlg;
  3441. dlg.DoModal();
  3442. return;
  3443. }
  3444. else if (strMsg == "商品名称设置")
  3445. {
  3446. if (IsHasRightsnew(29) == 0)return;
  3447. UINT nID = 3;
  3448. LPSTR pName;
  3449. pName = (LPSTR)(LPCSTR)"商品设置";
  3450. OPEN_MENU(ShangPin);
  3451. return;
  3452. }
  3453. else if (strMsg == "固定资产管理")
  3454. {
  3455. UINT nID = 3;
  3456. LPSTR pName;
  3457. pName = (LPSTR)(LPCSTR)"固定资产管理";
  3458. OPEN_MENU(FixedAssets);
  3459. return;
  3460. }
  3461. else if (strMsg == "入库单")
  3462. {
  3463. if (IsHasRightsnew(44) == 0)return;
  3464. InputGoods dlg;
  3465. dlg.DoModal();
  3466. return;
  3467. }
  3468. else if (strMsg == "出库单")
  3469. {
  3470. #ifndef ENTERPRISE_VERSION
  3471. #ifndef CHILD_VERSION
  3472. #ifdef BASIC_VERSION
  3473. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3474. {
  3475. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3476. exit(0);return;
  3477. }
  3478. #else
  3479. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3480. {
  3481. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3482. exit(0);return;
  3483. }
  3484. #endif
  3485. #else
  3486. #ifdef BASIC_VERSION
  3487. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3488. {
  3489. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3490. exit(0);return;
  3491. }
  3492. #else
  3493. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3494. {
  3495. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3496. exit(0); return;
  3497. }
  3498. #endif
  3499. #endif
  3500. #else
  3501. #ifndef CHILD_VERSION
  3502. #ifdef BASIC_VERSION
  3503. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3504. {
  3505. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3506. exit(0); return;
  3507. }
  3508. #else
  3509. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3510. {
  3511. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3512. exit(0); return;
  3513. }
  3514. #endif
  3515. #else
  3516. #ifdef BASIC_VERSION
  3517. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3518. {
  3519. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3520. exit(0);return;
  3521. }
  3522. #else
  3523. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3524. {
  3525. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3526. exit(0); return;
  3527. }
  3528. #endif
  3529. #endif
  3530. #endif
  3531. if (IsHasRightsnew(45) == 0)return;
  3532. InputGoods dlg;
  3533. dlg.m_mode = 1;
  3534. dlg.DoModal();
  3535. return;
  3536. }
  3537. else if (strMsg == "库存查询")
  3538. {
  3539. #ifndef ENTERPRISE_VERSION
  3540. #ifndef CHILD_VERSION
  3541. #ifdef BASIC_VERSION
  3542. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3543. {
  3544. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3545. exit(0);return;
  3546. }
  3547. #else
  3548. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3549. {
  3550. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3551. exit(0);return;
  3552. }
  3553. #endif
  3554. #else
  3555. #ifdef BASIC_VERSION
  3556. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3557. {
  3558. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3559. exit(0);return;
  3560. }
  3561. #else
  3562. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3563. {
  3564. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3565. exit(0); return;
  3566. }
  3567. #endif
  3568. #endif
  3569. #else
  3570. #ifndef CHILD_VERSION
  3571. #ifdef BASIC_VERSION
  3572. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3573. {
  3574. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3575. exit(0); return;
  3576. }
  3577. #else
  3578. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3579. {
  3580. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3581. exit(0); return;
  3582. }
  3583. #endif
  3584. #else
  3585. #ifdef BASIC_VERSION
  3586. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3587. {
  3588. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3589. exit(0);return;
  3590. }
  3591. #else
  3592. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3593. {
  3594. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3595. exit(0); return;
  3596. }
  3597. #endif
  3598. #endif
  3599. #endif
  3600. UINT nID = 3;
  3601. LPSTR pName;
  3602. pName = (LPSTR)(LPCSTR)"库存查询";
  3603. OPEN_MENU(ShowGoods);
  3604. return;
  3605. }
  3606. else if (strMsg == "商品图表")
  3607. {
  3608. UINT nID = 3;
  3609. LPSTR pName;
  3610. pName = (LPSTR)(LPCSTR)"商品图表";
  3611. OPEN_MENU(StoreInfoChart);
  3612. return;
  3613. }
  3614. else if (strMsg == "成本核算")
  3615. {
  3616. UINT nID = 3;
  3617. LPSTR pName;
  3618. pName = (LPSTR)(LPCSTR)"成本核算";
  3619. OPEN_MENU(CostCal);
  3620. return;
  3621. }
  3622. else if (strMsg == "考勤记录")
  3623. {
  3624. UINT nID = 3;
  3625. LPSTR pName;
  3626. pName = (LPSTR)(LPCSTR)"考勤记录";
  3627. OPEN_MENU(LoginReg);
  3628. return;
  3629. }
  3630. else if (strMsg == "月统计")
  3631. {
  3632. UINT nID = 3;
  3633. LPSTR pName;
  3634. pName = (LPSTR)(LPCSTR)"月统计";
  3635. OPEN_MENU(LoginReg2);
  3636. return;
  3637. }
  3638. else if (strMsg == "时间设置")
  3639. {
  3640. if (IsHasRightsnew(21) == 0)return;
  3641. SetLoginTime dlg;
  3642. dlg.DoModal();
  3643. return;
  3644. }
  3645. else if (strMsg == "排班设置")
  3646. {
  3647. if (IsHasRightsnew(21) == 0)return;
  3648. SetLoginBan dlg;
  3649. dlg.DoModal();
  3650. return;
  3651. }
  3652. else if (strMsg == "意向查询")
  3653. {
  3654. UINT nID = 3;
  3655. LPSTR pName;
  3656. pName = (LPSTR)(LPCSTR)"意向查询";
  3657. OPEN_MENU(HospitalClient);
  3658. return;
  3659. }
  3660. else if (strMsg == "今日提醒")
  3661. {
  3662. UINT nID = 3;
  3663. LPSTR pName;
  3664. pName = (LPSTR)(LPCSTR)"今日提醒";
  3665. OPEN_MENU(HospitalClientAlarm);
  3666. return;
  3667. }
  3668. else if (strMsg == "跟踪短信")
  3669. {
  3670. UINT nID = 3;
  3671. LPSTR pName;
  3672. pName = (LPSTR)(LPCSTR)"跟踪短信";
  3673. OPEN_MENU(HospitalClientMsg);
  3674. return;
  3675. }
  3676. else if (strMsg == "意向单录入")
  3677. {
  3678. AddHospitalClient dlg;
  3679. dlg.DoModal();
  3680. return;
  3681. }
  3682. else if (strMsg == "资料设置")
  3683. {
  3684. HospitalInfoSet dlg;
  3685. dlg.DoModal();
  3686. return;
  3687. }
  3688. else if ( strMsg == _T("公众号设置"))
  3689. {
  3690. if (IsHasRightsnew(62) == 0)return;
  3691. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3692. {
  3693. lyfzLibrary::g_PtrShowWeiXinDialog(g_rc, g_bkcol);
  3694. lyfzLibrary::FreeWeiXinLibaray();
  3695. }
  3696. return;
  3697. }
  3698. else if ( strMsg == _T("模板消息设置"))
  3699. {
  3700. if (IsHasRightsnew(63) == 0)return;
  3701. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3702. {
  3703. lyfzLibrary::g_PtrShowWXMsgconfigDialog(g_rc, g_bkcol);
  3704. lyfzLibrary::FreeWeiXinLibaray();
  3705. }
  3706. return;
  3707. }
  3708. else if ( strMsg == _T("推送记录") )
  3709. {
  3710. if (IsHasRightsnew(64) == 0)return;
  3711. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3712. {
  3713. lyfzLibrary::g_PtrShowWXMsgRcordDialog(g_rc, g_bkcol);
  3714. lyfzLibrary::FreeWeiXinLibaray();
  3715. }
  3716. return;
  3717. }
  3718. AfxMessageBox(strMsg + ",开发中...");
  3719. }
  3720. // Jeff.当版本号不一致时,调用AutoUpdate.exe来升级YLGL.exe
  3721. void CMainFrame::AutoUpdate()
  3722. {
  3723. if (g_bBranchModify)
  3724. {
  3725. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3726. return;
  3727. }
  3728. else if (g_branchname != "")
  3729. {
  3730. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3731. return;
  3732. }
  3733. g_ntimeout = 30000;
  3734. if (!::PathFileExists(g_mainpath + "\\AutoUpdate.exe"))
  3735. {
  3736. g_sendhead.bsql = 0;
  3737. g_sendhead.code[0] = 99;
  3738. g_sendhead.tabcount = 1;
  3739. g_pMainWnd->ProcessChatMessageRequest2(99);
  3740. if (g_bSendOK == 0)
  3741. goto failed;
  3742. CFile fp;
  3743. fp.Open(g_mainpath + "\\AutoUpdate.exe", CFile::modeWrite | CFile::modeCreate);
  3744. fp.Write(g_pData, g_nLeng);
  3745. fp.Close();
  3746. }
  3747. {
  3748. ::DeleteFile(g_mainpath + "\\YLGL2.exe"); // 删除ylgl.exe;
  3749. g_sendhead.bsql = 0;
  3750. g_sendhead.code[0] = 98;
  3751. g_sendhead.tabcount = 1;
  3752. g_pMainWnd->ProcessChatMessageRequest2(99); if (g_bSendOK == 0)goto failed;
  3753. CFile fp;
  3754. fp.Open(g_mainpath + "\\YLGL2.exe", CFile::modeWrite | CFile::modeCreate);
  3755. fp.Write(g_pData, g_nLeng);
  3756. fp.Close();
  3757. }
  3758. AfxMessageBox("自动升级成功!", MB_ICONINFORMATION);
  3759. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\AutoUpdate.exe"), "12345", NULL, SW_SHOWNORMAL);
  3760. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3761. exit(0);
  3762. return;
  3763. failed:
  3764. AfxMessageBox("自动升级失败!", MB_ICONINFORMATION);
  3765. if (g_ntimeout == 30000)//非远程
  3766. {
  3767. AfxMessageBox("提醒:升级过程中需要传输较多的数据,如果网速慢可能导致远程升级失败!\r\n\
  3768. 可拷贝店内客户端用QQ传过来覆盖除dbconfig.dat的文件即可。", MB_ICONINFORMATION);
  3769. }
  3770. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3771. }
  3772. void CMainFrame::Onchoosephotoskin() //Jeff:此机用于选片菜单项;不在使用2014.06.16
  3773. {
  3774. if (g_user.bLongin == 0)
  3775. {
  3776. if (g_bNoLoginLia)
  3777. {
  3778. Login dlg;
  3779. dlg.SetLiaPath("5.lia");
  3780. dlg.DoModal();
  3781. }
  3782. else
  3783. {
  3784. Login3 dlg;
  3785. dlg.SetLiaPath("5.lia");
  3786. dlg.DoModal();
  3787. }
  3788. if (g_user.bLongin == 0)return;
  3789. }
  3790. // TODO: Add your command handler code here
  3791. CMenu *pMenu = GetMenu();
  3792. CMenu* submenu = pMenu->GetSubMenu(1);
  3793. UINT status = submenu->GetMenuState(IDM_choosephotoskin, MF_BYCOMMAND);
  3794. if (status&MF_CHECKED)
  3795. {
  3796. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_UNCHECKED);
  3797. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status", 0);
  3798. }
  3799. else
  3800. {
  3801. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  3802. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status", 1);
  3803. }
  3804. }
  3805. /*BOOL g_bInSkin = 0;*/
  3806. BOOL CMainFrame::IsCtrlDown()
  3807. {
  3808. short state = GetKeyState(VK_LCONTROL);
  3809. BYTE sta = (BYTE)(state >> 8);
  3810. state = GetKeyState(VK_RCONTROL);
  3811. BYTE sta2 = (BYTE)(state >> 8);
  3812. if (sta || sta2)
  3813. return 1;
  3814. else
  3815. return 0;
  3816. }//IsShiftDown
  3817. BOOL CMainFrame::IsShiftDown()
  3818. {
  3819. short state = GetKeyState(VK_LSHIFT);
  3820. BYTE sta = (BYTE)(state >> 8);
  3821. state = GetKeyState(VK_RSHIFT);
  3822. BYTE sta2 = (BYTE)(state >> 8);
  3823. if (sta || sta2)
  3824. return 1;
  3825. else
  3826. return 0;
  3827. }
  3828. BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
  3829. {
  3830. // TODO: Add your specialized code here and/or call the base class IDM_Logout
  3831. if (pMsg->message == WM_KEYDOWN)
  3832. {
  3833. switch (pMsg->wParam)
  3834. {
  3835. case VK_F12:
  3836. g_pMainWnd->OnCommandMenu(IDM_Logout);
  3837. return 1;
  3838. case VK_F1:
  3839. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  3840. return 1;
  3841. case VK_F2: // 此机用于选片和选设计;
  3842. {
  3843. if (g_pMainWnd->m_bCheckF2F3 && (IsShiftDown() == 0 || IsCtrlDown() == 0))return 1;
  3844. m_Mdi.MainClose();
  3845. if (g_user.bLongin)
  3846. {
  3847. SearchClient dlg;
  3848. dlg.SetLiaPath("2.lia");
  3849. if (dlg.DoModal() != IDOK)
  3850. {
  3851. if (dlg.m_bLogout)
  3852. {
  3853. g_user.bLongin = 0;
  3854. g_user.name.Empty();
  3855. g_user.rights.Empty();
  3856. g_user.account.Empty();
  3857. goto ll;
  3858. }
  3859. PostMessage(WM_QUIT);
  3860. return 1;
  3861. }
  3862. if (dlg.m_exitcode == 3)
  3863. {
  3864. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3865. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3866. }
  3867. else
  3868. {
  3869. ShowWindow(SW_SHOW);
  3870. #ifdef NEW_SKIN
  3871. if (m_pMainFrimDlg2 == NULL)
  3872. {
  3873. m_pMainFrimDlg2 = new MainFrimDlg2;
  3874. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3875. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3876. }
  3877. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3878. g_bInSkin = 0;
  3879. #endif
  3880. }
  3881. }
  3882. else
  3883. {
  3884. ll:
  3885. ChoosePhotoSkin dlg;
  3886. dlg.SetLiaPath("1.lia");
  3887. if (dlg.DoModal() != IDOK)
  3888. {
  3889. PostMessage(WM_QUIT);
  3890. return 1;
  3891. }
  3892. if (dlg.m_exitcode == 3)
  3893. {
  3894. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3895. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3896. }
  3897. else
  3898. {
  3899. ShowWindow(SW_SHOW);
  3900. #ifdef NEW_SKIN
  3901. if (m_pMainFrimDlg2 == NULL)
  3902. {
  3903. m_pMainFrimDlg2 = new MainFrimDlg2;
  3904. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3905. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3906. }
  3907. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3908. g_bInSkin = 0;
  3909. #endif
  3910. }
  3911. }
  3912. }
  3913. return 1;
  3914. case VK_F3: // 此机用于选片和选设计;
  3915. {
  3916. if (g_pMainWnd->m_bCheckF2F3 && (g_pMainWnd->IsShiftDown() == 0 || g_pMainWnd->IsCtrlDown() == 0))return 1;
  3917. m_Mdi.MainClose();
  3918. if (g_user.bLongin)
  3919. {
  3920. SearchClient dlg;
  3921. dlg.m_mode = 1;
  3922. dlg.SetLiaPath("2.lia");
  3923. if (dlg.DoModal() != IDOK)
  3924. {
  3925. if (dlg.m_bLogout)
  3926. {
  3927. g_user.bLongin = 0;
  3928. g_user.name.Empty();
  3929. g_user.rights.Empty();
  3930. g_user.account.Empty();
  3931. goto mm;
  3932. }
  3933. PostMessage(WM_QUIT);
  3934. return 1;
  3935. }
  3936. if (dlg.m_exitcode == 2)
  3937. {
  3938. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3939. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3940. }
  3941. else
  3942. {
  3943. ShowWindow(SW_SHOW);
  3944. #ifdef NEW_SKIN
  3945. if (m_pMainFrimDlg2 == NULL)
  3946. {
  3947. m_pMainFrimDlg2 = new MainFrimDlg2;
  3948. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3949. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3950. }
  3951. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3952. g_bInSkin = 0;
  3953. #endif
  3954. }
  3955. }
  3956. else
  3957. {
  3958. mm:
  3959. ChoosePhotoSkin dlg;
  3960. dlg.m_mode = 1;
  3961. dlg.SetLiaPath("1.lia");
  3962. if (dlg.DoModal() != IDOK)
  3963. {
  3964. PostMessage(WM_QUIT);
  3965. return 1;
  3966. }
  3967. if (dlg.m_exitcode == 2)
  3968. {
  3969. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3970. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3971. }
  3972. else
  3973. {
  3974. ShowWindow(SW_SHOW);
  3975. #ifdef NEW_SKIN
  3976. if (m_pMainFrimDlg2 == NULL)
  3977. {
  3978. m_pMainFrimDlg2 = new MainFrimDlg2;
  3979. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3980. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3981. }
  3982. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3983. g_bInSkin = 0;
  3984. #endif
  3985. }
  3986. }
  3987. }
  3988. return 1;
  3989. //#if 0 // 2015-05-30 禁用F11功能;
  3990. // case VK_F11:
  3991. // if (g_bInSkin)return 1;
  3992. // if (g_user.bLongin)
  3993. // {
  3994. // SqlDlg dlg;
  3995. // dlg.DoModal();
  3996. // }
  3997. // break;
  3998. //#endif
  3999. }
  4000. }
  4001. return CMDIFrameWnd::PreTranslateMessage(pMsg);
  4002. }
  4003. void CMainFrame::GetSkin()
  4004. {
  4005. return;
  4006. #ifdef MNLS_VERSION
  4007. if (::PathFileExists(g_mainpath + "\\skin\\4.lia"))
  4008. {
  4009. CFile fp;
  4010. fp.Open(g_mainpath + "\\skin\\4.lia", CFile::modeRead);
  4011. DWORD leng=fp.GetLength ();
  4012. fp.Close ();
  4013. if(leng!=194987)
  4014. ::DeleteFile (g_mainpath+"\\skin\\4.lia"); // 删除4.lia
  4015. }
  4016. if(!::PathFileExists (g_mainpath+"\\skin\\4.lia"))
  4017. {
  4018. ::CreateDirectory (g_mainpath+"\\skin", NULL);
  4019. g_sendhead.bsql=0;
  4020. g_sendhead.code[0]=100;
  4021. g_sendhead.tabcount=1;
  4022. g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return;
  4023. CFile fp;
  4024. fp.Open (g_mainpath+"\\skin\\4.lia", CFile::modeWrite|CFile::modeCreate);
  4025. fp.Write (g_pData, g_nLeng);
  4026. fp.Close ();
  4027. }
  4028. #endif
  4029. }
  4030. void AutoDraw(CPrintRX &m_Print, CRect &StrRect, CString &str, float fscale)
  4031. {
  4032. CString tempbz =_T(""), temp = _T("");
  4033. BOOL bRun = 0;
  4034. CSize size;
  4035. int fontsize = 12;
  4036. int i = 0;
  4037. ll: tempbz = str;
  4038. i = 0;
  4039. m_Print.SetFontFace(fontsize, 1, "宋体");
  4040. while (1)
  4041. {
  4042. if (!tempbz.IsEmpty())
  4043. {
  4044. temp = tempbz;
  4045. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4046. int right = 0;
  4047. CRect temprc = StrRect;
  4048. temprc.top += i*(fontsize*fscale); i++;
  4049. temprc.bottom = temprc.top + fontsize;
  4050. if (temprc.bottom > StrRect.bottom)break;
  4051. while (size.cx > temprc.Width())
  4052. {
  4053. right++;
  4054. temp = tempbz.Left(tempbz.GetLength() - (right));
  4055. if (GIsHalfHZ(temp))
  4056. {
  4057. right++;
  4058. temp.Delete(temp.GetLength() - 1);
  4059. }
  4060. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4061. }
  4062. // 判断最后的字符是否还含有半个汉字;
  4063. if ( GIsHalfHZ(temp) )
  4064. {
  4065. right++;
  4066. temp.Delete(temp.GetLength() -1);
  4067. temp = tempbz.Left(tempbz.GetLength() - (right));
  4068. }
  4069. if (temp.Find("\r\n") != -1)
  4070. {
  4071. temp = temp.Left(temp.Find("\r\n"));//i++;
  4072. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength() - 2);
  4073. }
  4074. else
  4075. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  4076. if (bRun)
  4077. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, temprc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4078. }
  4079. else
  4080. break;
  4081. }
  4082. if (tempbz.IsEmpty() == 0)
  4083. {
  4084. fontsize--;
  4085. goto ll;
  4086. }
  4087. if (bRun == 0)
  4088. {
  4089. bRun = 1;
  4090. goto ll;
  4091. }
  4092. }
  4093. void CMainFrame::PrintDinDan3(CString strOrderNumber)
  4094. {
  4095. // TODO: Add your control notification handler code here
  4096. CPrintRX m_Print;
  4097. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  4098. {
  4099. m_Print.InitToPrint(NULL, 1);
  4100. }
  4101. else
  4102. {
  4103. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  4104. if (name.IsEmpty())
  4105. m_Print.InitToPrint(NULL, 1);
  4106. else
  4107. {
  4108. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  4109. if (nret == -1)
  4110. {
  4111. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  4112. }
  4113. }
  4114. }
  4115. m_Print.StartPrint();
  4116. m_Print.StartPage();
  4117. LoadRect load;
  4118. load.SetLiaPath("11.lia");
  4119. load.SetMargins(0, 0);
  4120. if (!load.Load())return;
  4121. LoadRect load2;
  4122. load2.SetLiaPath("12.lia");
  4123. load2.SetMargins(0, 0);
  4124. if (!load2.Load())return;
  4125. LoadRect load3;
  4126. load3.SetLiaPath("13.lia");
  4127. load3.SetMargins(-6, 520);
  4128. if (!load3.Load())return;
  4129. int i;
  4130. //////////////////////////////////////////////////////////////
  4131. CStringArray txarray;
  4132. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "'";
  4133. g_sendhead.code[0] = 11;
  4134. g_sendhead.code[1] = 52;
  4135. g_sendhead.code[2] = 50;
  4136. g_sendhead.code[3] = 150;
  4137. g_sendhead.tabcount = 4;
  4138. g_sendhead.bsql = 0;
  4139. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  4140. CArray<CStringArray, CStringArray>sparray;
  4141. CArray<CStringArray, CStringArray>clientarray;
  4142. CArray<CStringArray, CStringArray>jdarray;
  4143. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray);
  4144. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  4145. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  4146. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  4147. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  4148. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  4149. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  4150. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  4151. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  4152. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  4153. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  4154. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  4155. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  4156. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  4157. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  4158. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  4159. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  4160. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  4161. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  4162. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  4163. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  4164. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  4165. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  4166. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  4167. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  4168. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  4169. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  4170. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  4171. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  4172. CString m_bz = "其它要求: " + g_List1array.ElementAt(0).ElementAt(38);
  4173. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  4174. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  4175. if (IsHasRights2new(31) == 0)
  4176. {
  4177. m_phone1 = "***";
  4178. m_phone2 = "***";
  4179. }
  4180. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  4181. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  4182. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  4183. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  4184. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  4185. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  4186. CString m_addr = m_addr1 + ";";
  4187. m_addr.TrimLeft(";");
  4188. m_addr += m_addr2;
  4189. CString m_qq = m_qq1 + ";";
  4190. m_qq.TrimLeft(";");
  4191. m_qq += m_qq2;
  4192. CString m_jd;
  4193. for (i = 0; i < jdarray.GetSize(); i++)
  4194. {
  4195. m_jd += jdarray.ElementAt(i).ElementAt(1);
  4196. m_jd += ";";
  4197. }
  4198. m_jd.TrimRight(";");
  4199. m_money1.Format("%f", atof(m_taoxijiage));
  4200. m_money2.Format("%f", atof(m_payed1));
  4201. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  4202. ConvertToPrice(m_money1);
  4203. ConvertToPrice(m_money2);
  4204. ConvertToPrice(m_money3);
  4205. ////////////////////////////////////////////////////////////////
  4206. int rcpos = -1;
  4207. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  4208. m_Print.SetFontFace(17, 1, "宋体");
  4209. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4210. StrRect.top -= 0;
  4211. StrRect.bottom -= 10;
  4212. StrRect.left -= 140;
  4213. StrRect.right = StrRect.left + 48;
  4214. m_Print.SetFontFace(15, 1, "宋体");
  4215. m_Print.SetColor(0xffffff);
  4216. m_Print.DrawRect(StrRect, 0);
  4217. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4218. StrRect.left = StrRect.right;
  4219. StrRect.right = StrRect.left + 48;
  4220. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  4221. m_Print.SetColor(0, RGB(255, 0, 0));
  4222. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4223. m_Print.SetColor(0);
  4224. m_Print.SetFontFace(12, 1, "宋体");
  4225. StrRect.left -= 48;
  4226. int hei = StrRect.Height();
  4227. StrRect.top = StrRect.bottom + 2;
  4228. StrRect.bottom += hei + 2;
  4229. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4230. StrRect.top = StrRect.bottom - 2;
  4231. StrRect.bottom += hei - 5;
  4232. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  4233. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4234. m_Print.SetFontFace(12, 1, "宋体");
  4235. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4236. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4237. m_Print.SetFontFace(11, 1, "宋体");
  4238. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4239. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4240. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4241. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4242. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4243. m_Print.DrawRect2(StrRect, 2);
  4244. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4245. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4246. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4247. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4248. m_Print.DrawRect2(StrRect, 2);
  4249. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4250. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4251. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4252. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4253. m_Print.DrawRect2(StrRect, 2);
  4254. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4255. m_Print.DrawText((LPTSTR)(LPCTSTR)"约单时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4256. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4257. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4258. m_Print.DrawRect2(StrRect, 2);
  4259. ////////////
  4260. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4261. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4262. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4263. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4264. m_Print.DrawRect2(StrRect, 2);
  4265. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4266. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4267. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4268. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4269. m_Print.DrawRect2(StrRect, 2);
  4270. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4271. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4272. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4273. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4274. m_Print.DrawRect2(StrRect, 2);
  4275. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4276. m_Print.DrawText((LPTSTR)(LPCTSTR)"大婚时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4277. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4278. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4279. m_Print.DrawRect2(StrRect, 2);
  4280. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4281. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客地址:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4282. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4283. m_Print.DrawText((LPTSTR)(LPCTSTR)m_addr, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4284. m_Print.DrawRect2(StrRect, 2);
  4285. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4286. m_Print.DrawText((LPTSTR)(LPCTSTR)"QQ/邮箱:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4287. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4288. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4289. m_Print.DrawRect2(StrRect, 2);
  4290. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4291. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系金额:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4292. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4293. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4294. m_Print.DrawRect2(StrRect, 2);
  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_money2, StrRect, 0, 0, FORMAT_LEFT | 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)m_money3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4304. m_Print.DrawRect2(StrRect, 2);
  4305. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4306. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4307. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4308. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4309. m_Print.DrawRect2(StrRect, 2);
  4310. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4311. m_Print.DrawText((LPTSTR)(LPCTSTR)"拍摄景点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4312. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4313. m_Print.DrawText((LPTSTR)(LPCTSTR)m_jd, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4314. m_Print.DrawRect2(StrRect, 2);
  4315. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4316. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内容提供: 男士服装:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4317. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4318. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4319. m_Print.DrawRect2(StrRect, 2);
  4320. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4321. m_Print.DrawText((LPTSTR)(LPCTSTR)"套", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4322. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4323. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4324. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4325. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4326. m_Print.DrawRect2(StrRect, 2);
  4327. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4328. m_Print.DrawText((LPTSTR)(LPCTSTR)"套", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4329. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4330. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内提供拍摄区服装/头饰造型", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4331. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4332. m_Print.DrawText((LPTSTR)(LPCTSTR)"其它:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4333. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4334. m_Print.DrawText((LPTSTR)(LPCTSTR)" ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4335. m_Print.DrawRect2(StrRect, 2);
  4336. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4337. m_Print.DrawText((LPTSTR)(LPCTSTR)"专业数码拍摄:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4338. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4339. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4340. m_Print.DrawRect2(StrRect, 2);
  4341. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4342. m_Print.DrawText((LPTSTR)(LPCTSTR)"张", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4343. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4344. m_Print.DrawText((LPTSTR)(LPCTSTR)"(JPG格式数据)", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4345. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4346. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内赠送:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4347. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4348. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_List1array.ElementAt(0).ElementAt(9)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4349. m_Print.DrawRect2(StrRect, 2);
  4350. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4351. m_Print.DrawText((LPTSTR)(LPCTSTR)"张设计排版精修入册", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4352. //////////////////////load2
  4353. rcpos = -1;
  4354. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4355. m_Print.DrawText((LPTSTR)(LPCTSTR)"原始数据套系内张数JPG格式光盘壹只", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4356. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4357. m_Print.DrawText((LPTSTR)(LPCTSTR)"其它:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4358. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4359. // m_Print.DrawText((LPTSTR)(LPCTSTR)"", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4360. // AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4361. m_Print.DrawRect2(StrRect, 2);
  4362. m_Print.SetFontFace(11, 1, "宋体");
  4363. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4364. m_Print.DrawText((LPTSTR)(LPCTSTR)"客人产品:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4365. int rowcount = sparray.GetSize() / 8;
  4366. int needaddrow = 0;
  4367. while (sparray.GetSize() > rowcount * 8 + needaddrow)
  4368. needaddrow++;
  4369. int pos = 0;
  4370. CString str = "";
  4371. int addcount = 0;
  4372. if (needaddrow > 0)
  4373. addcount = 1;
  4374. else
  4375. addcount = 0;
  4376. needaddrow--;
  4377. str.Empty();
  4378. for (i = 0; i < rowcount + addcount; i++)
  4379. {
  4380. str += sparray.ElementAt(pos).ElementAt(5);
  4381. str += " 数量:";
  4382. str += sparray.ElementAt(pos).ElementAt(3);
  4383. str += ";";
  4384. pos++;
  4385. }
  4386. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4387. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4388. m_Print.DrawRect2(StrRect, 2);
  4389. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4390. if (needaddrow > 0)
  4391. addcount = 1;
  4392. else
  4393. addcount = 0;
  4394. needaddrow--;
  4395. str.Empty();
  4396. for (i = 0; i < rowcount + addcount; i++)
  4397. {
  4398. str += sparray.ElementAt(pos).ElementAt(5);
  4399. str += " 数量:";
  4400. str += sparray.ElementAt(pos).ElementAt(3);
  4401. str += ";";
  4402. pos++;
  4403. }
  4404. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4405. m_Print.DrawRect2(StrRect, 2);
  4406. StrRect = load2.m_rcarray.ElementAt(++rcpos);//7
  4407. if (needaddrow > 0)
  4408. addcount = 1;
  4409. else
  4410. addcount = 0;
  4411. needaddrow--;
  4412. str.Empty();
  4413. for (i = 0; i < rowcount + addcount; i++)
  4414. {
  4415. str += sparray.ElementAt(pos).ElementAt(5);
  4416. str += " 数量:";
  4417. str += sparray.ElementAt(pos).ElementAt(3);
  4418. str += ";";
  4419. pos++;
  4420. }
  4421. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4422. m_Print.DrawRect2(StrRect, 2);
  4423. StrRect = load2.m_rcarray.ElementAt(++rcpos);//8
  4424. if (needaddrow > 0)
  4425. addcount = 1;
  4426. else
  4427. addcount = 0;
  4428. needaddrow--;
  4429. str.Empty();
  4430. for (i = 0; i < rowcount + addcount; i++)
  4431. {
  4432. str += sparray.ElementAt(pos).ElementAt(5);
  4433. str += " 数量:";
  4434. str += sparray.ElementAt(pos).ElementAt(3);
  4435. str += ";";
  4436. pos++;
  4437. }
  4438. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4439. m_Print.DrawRect2(StrRect, 2);
  4440. StrRect = load2.m_rcarray.ElementAt(++rcpos);//9
  4441. if (needaddrow > 0)
  4442. addcount = 1;
  4443. else
  4444. addcount = 0;
  4445. needaddrow--;
  4446. str.Empty();
  4447. for (i = 0; i < rowcount + addcount; i++)
  4448. {
  4449. str += sparray.ElementAt(pos).ElementAt(5);
  4450. str += " 数量:";
  4451. str += sparray.ElementAt(pos).ElementAt(3);
  4452. str += ";";
  4453. pos++;
  4454. }
  4455. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4456. m_Print.DrawRect2(StrRect, 2);
  4457. StrRect = load2.m_rcarray.ElementAt(++rcpos);//10
  4458. if (needaddrow > 0)
  4459. addcount = 1;
  4460. else
  4461. addcount = 0;
  4462. needaddrow--;
  4463. str.Empty();
  4464. for (i = 0; i < rowcount + addcount; i++)
  4465. {
  4466. str += sparray.ElementAt(pos).ElementAt(5);
  4467. str += " 数量:";
  4468. str += sparray.ElementAt(pos).ElementAt(3);
  4469. str += ";";
  4470. pos++;
  4471. }
  4472. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4473. m_Print.DrawRect2(StrRect, 2);
  4474. StrRect = load2.m_rcarray.ElementAt(++rcpos);//11
  4475. if (needaddrow > 0)
  4476. addcount = 1;
  4477. else
  4478. addcount = 0;
  4479. needaddrow--;
  4480. str.Empty();
  4481. for (i = 0; i < rowcount + addcount; i++)
  4482. {
  4483. str += sparray.ElementAt(pos).ElementAt(5);
  4484. str += " 数量:";
  4485. str += sparray.ElementAt(pos).ElementAt(3);
  4486. str += ";";
  4487. pos++;
  4488. }
  4489. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4490. m_Print.DrawRect2(StrRect, 2);
  4491. StrRect = load2.m_rcarray.ElementAt(++rcpos);//12
  4492. if (needaddrow > 0)
  4493. addcount = 1;
  4494. else
  4495. addcount = 0;
  4496. needaddrow--;
  4497. str.Empty();
  4498. for (i = 0; i < rowcount + addcount; i++)
  4499. {
  4500. str += sparray.ElementAt(pos).ElementAt(5);
  4501. str += " 数量:";
  4502. str += sparray.ElementAt(pos).ElementAt(3);
  4503. str += ";";
  4504. pos++;
  4505. }
  4506. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4507. m_Print.DrawRect2(StrRect, 2);
  4508. /* StrRect=load2.m_rcarray .ElementAt (++rcpos);//12
  4509. if(needaddrow>0)
  4510. addcount=1;
  4511. else
  4512. addcount=0;
  4513. needaddrow--;
  4514. str.Empty ();
  4515. for( i=0; i<rowcount+addcount; i++)
  4516. {
  4517. str+=sparray.ElementAt (pos).ElementAt (5);
  4518. str+=" 数量:";
  4519. str+=sparray.ElementAt (pos).ElementAt (3);
  4520. str+=";";
  4521. pos++;
  4522. }
  4523. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4524. m_Print.DrawRect2(StrRect, 2);
  4525. StrRect=load2.m_rcarray .ElementAt (++rcpos);//14
  4526. if(needaddrow>0)
  4527. addcount=1;
  4528. else
  4529. addcount=0;
  4530. needaddrow--;
  4531. str.Empty ();
  4532. for( i=0; i<rowcount+addcount; i++)
  4533. {
  4534. str+=sparray.ElementAt (pos).ElementAt (5);
  4535. str+=" 数量:";
  4536. str+=sparray.ElementAt (pos).ElementAt (3);
  4537. str+=";";
  4538. pos++;
  4539. }
  4540. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4541. m_Print.DrawRect2(StrRect, 2);*/
  4542. CRect sprc[2];
  4543. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4544. // AutoDraw(m_Print, StrRect, m_bz.Left (leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4545. m_Print.DrawRect2(StrRect, 2);
  4546. sprc[0] = StrRect;
  4547. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4548. // AutoDraw(m_Print, StrRect, m_bz.Right (leng-leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4549. m_Print.DrawRect2(StrRect, 2);
  4550. sprc[1] = StrRect;
  4551. //AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4552. {
  4553. CString temp, tempspno, tempbz;
  4554. CSize size;
  4555. BOOL bRun = 0;
  4556. int fontsize = 12;
  4557. ll: tempspno = m_bz;
  4558. m_Print.SetFontFace(fontsize, 1, "宋体");
  4559. for (i = 0; i<2; i++)
  4560. {
  4561. if (!tempspno.IsEmpty())
  4562. {
  4563. temp = tempspno;
  4564. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4565. int right = 0;
  4566. CRect temprc = sprc[i];
  4567. while (size.cx>temprc.Width())
  4568. {
  4569. right++;
  4570. temp = tempspno.Left(tempspno.GetLength() - (right));
  4571. if (GIsHalfHZ(temp))
  4572. {
  4573. right++;
  4574. temp.Delete(temp.GetLength() - 1);
  4575. }
  4576. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4577. }
  4578. if (bRun)
  4579. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4580. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  4581. if (tempspno.IsEmpty())i++;
  4582. }
  4583. }
  4584. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  4585. {
  4586. fontsize--;
  4587. goto ll;
  4588. }
  4589. if (bRun == 0)
  4590. {
  4591. bRun = 1;
  4592. goto ll;
  4593. }
  4594. }
  4595. m_Print.SetFontFace(11, 1, "宋体");
  4596. //////////////////////load3
  4597. rcpos = -1;
  4598. for (i = 0; i < 24; i++)
  4599. {
  4600. StrRect = load3.m_rcarray.ElementAt(i);
  4601. m_Print.DrawRect2(StrRect, 1);
  4602. }
  4603. CStringArray strarray;
  4604. strarray.Add("营业员");
  4605. strarray.Add("前台接待");
  4606. strarray.Add("化妆师");
  4607. strarray.Add("礼服师");
  4608. strarray.Add("摄影师");
  4609. strarray.Add("摄影助理");
  4610. strarray.Add("美工师");
  4611. strarray.Add("设计师");
  4612. for (i = 0; i < 8; i++)
  4613. {
  4614. StrRect = load3.m_rcarray.ElementAt(i);
  4615. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4616. }
  4617. strarray.RemoveAll();
  4618. strarray.Add(m_ren);
  4619. strarray.Add(g_List1array.ElementAt(0).ElementAt(49));
  4620. strarray.Add(m_waiter2);
  4621. strarray.Add(g_List1array.ElementAt(0).ElementAt(51));
  4622. strarray.Add(m_waiter1);
  4623. strarray.Add(g_List1array.ElementAt(0).ElementAt(50));
  4624. strarray.Add("");
  4625. strarray.Add(m_waiter4);
  4626. for (i = 8; i < 16; i++)
  4627. {
  4628. StrRect = load3.m_rcarray.ElementAt(i);
  4629. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 8), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4630. }
  4631. StrRect = load3.m_rcarray.ElementAt(27);
  4632. m_Print.DrawText((LPTSTR)(LPCTSTR)"客户电话: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4633. StrRect = load3.m_rcarray.ElementAt(28);
  4634. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4635. m_Print.SetFontFace(13, 1, "宋体");
  4636. StrRect = load3.m_rcarray.ElementAt(25);
  4637. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4638. StrRect = load3.m_rcarray.ElementAt(26);
  4639. m_Print.DrawRect2(StrRect, 2);
  4640. StrRect = load3.m_rcarray.ElementAt(24);
  4641. str = "\
  4642. 顾客须知\r\n\
  4643. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  4644. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  4645. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  4646. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  4647. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  4648. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  4649. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  4650. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  4651. AutoDraw(m_Print, StrRect, str, 1.8f);
  4652. PrintPreview dlg;
  4653. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4654. dlg.m_pDC = m_Print.GetPDC();
  4655. if (dlg.DoModal() != IDOK)return;
  4656. //结束打印
  4657. m_Print.EndPage();
  4658. m_Print.EndPrint();
  4659. }
  4660. void CMainFrame::PrintDailyForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4661. {
  4662. // TODO: Add your control notification handler code here
  4663. int pages = Listarray->GetSize() / 46;
  4664. if (Listarray->GetSize() % 46)pages++;
  4665. for (int aa = 0; aa < pages; aa++)
  4666. {
  4667. PrintPreview dlg;
  4668. CPrintRX m_Print;
  4669. m_Print.InitToPrint(NULL, 1);
  4670. m_Print.StartPrint();
  4671. m_Print.StartPage();
  4672. CRect mainrc(0, 0, 560, 793);
  4673. float fscale;
  4674. {
  4675. int w, h;
  4676. m_Print.GetWidHei(w, h);
  4677. fscale = (float)w / (float)h;
  4678. }
  4679. mainrc.DeflateRect(25, 40, 10, 0);
  4680. CRect rc, rc2;
  4681. rc = mainrc;
  4682. rc.bottom = rc.top;
  4683. rc.top -= 20;
  4684. m_Print.SetFontFace(16, 1, "黑体");
  4685. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4686. m_Print.SetFontFace(9, 1, "宋体");
  4687. CString str;
  4688. int wid[4] = { 320, 60, 60, 90 };
  4689. int hei = 16;
  4690. if (fscale > 0.71)hei = 15;
  4691. rc = mainrc;
  4692. rc.bottom = rc.top + hei;
  4693. for (int i = 0; i < 47; i++)
  4694. {
  4695. rc2.top = rc.top + i*hei;
  4696. rc2.bottom = rc.bottom + i*hei;
  4697. rc2.left = rc.left;
  4698. rc2.right = rc.left + wid[0];
  4699. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  4700. for (int j = 0; j<4; j++)
  4701. {
  4702. m_Print.DrawRect2(rc2, 1);
  4703. if (Listarray->GetSize()>aa * 46 + i)
  4704. {
  4705. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  4706. rc2.left += 3;
  4707. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4708. rc2.left -= 3;
  4709. }
  4710. rc2.left += wid[j];
  4711. rc2.right = rc2.left + wid[j + 1];
  4712. }
  4713. }
  4714. rc2.top += 2;
  4715. rc2.left += 2; rc2.right = mainrc.right + 4;
  4716. m_Print.SetFontFace(8, 1, "宋体");
  4717. int infopos = info.Find("***");
  4718. if (infopos != -1)
  4719. {
  4720. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Left(infopos), rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4721. CRect rc3 = rc2;
  4722. rc3.top = rc2.bottom - 4;
  4723. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Right(info.GetLength() - infopos - 3), rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4724. }
  4725. else
  4726. m_Print.DrawText((LPTSTR)(LPCTSTR)info, rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4727. str.Format(" 页:%d/%d", aa + 1, pages);
  4728. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4729. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  4730. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4731. dlg.m_pDC = m_Print.GetPDC();
  4732. // dlg.m_mode=1;
  4733. if (aa == 0)
  4734. {
  4735. if (dlg.DoModal() != IDOK)
  4736. return;
  4737. }
  4738. //结束打印
  4739. m_Print.EndPage();
  4740. m_Print.EndPrint();
  4741. }
  4742. }
  4743. void CMainFrame::PrintLoginForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4744. {
  4745. // TODO: Add your control notification handler code here
  4746. int sinlecount = 33 * 6;
  4747. int pages = Listarray->GetSize() / sinlecount;
  4748. if (Listarray->GetSize() % sinlecount)pages++;
  4749. for (int aa = 0; aa < pages; aa++)
  4750. {
  4751. PrintPreview dlg;
  4752. CPrintRX m_Print;
  4753. m_Print.InitToPrint(NULL, 1);
  4754. m_Print.StartPrint();
  4755. m_Print.StartPage();
  4756. CRect mainrc(0, 0, 560, 793);
  4757. float fscale;
  4758. {
  4759. int w, h;
  4760. m_Print.GetWidHei(w, h);
  4761. fscale = (float)w / (float)h;
  4762. }
  4763. mainrc.DeflateRect(25, 40, 10, 0);
  4764. CString str;
  4765. CRect rc, rc2;
  4766. rc = mainrc;
  4767. rc.bottom = rc.top;
  4768. rc.top -= 20;
  4769. rc.left -= 20;
  4770. m_Print.SetFontFace(12, 1, "黑体");
  4771. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4772. m_Print.SetFontFace(6, 1, "宋体");
  4773. str.Format(" 页:%d/%d", aa + 1, pages);
  4774. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4775. rc.right = mainrc.right + 20;
  4776. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4777. int wid[2] = { 50, 110 };
  4778. int hei = 11;
  4779. rc = mainrc;
  4780. rc.bottom = rc.top + hei;
  4781. rc.top += 10;
  4782. rc.bottom += 10;
  4783. int dtx = rc.Width() / 3 + 18;
  4784. int dty = 380;
  4785. for (int j = 0; j < 6; j++)
  4786. {
  4787. if (Listarray->GetSize() < aa*sinlecount + 33 * (j + 1))continue;
  4788. for (int i = 0; i < 33; i++)
  4789. {
  4790. rc2.top = rc.top + i*hei;
  4791. rc2.bottom = rc.bottom + i*hei;
  4792. rc2.left = rc.left;
  4793. rc2.right = rc.left + wid[0];
  4794. if (i == 0)
  4795. {
  4796. // rc2.left +=wid[1];
  4797. rc2.right += wid[1];
  4798. }
  4799. if (j == 1 || j == 4)
  4800. {
  4801. rc2.left += dtx;
  4802. rc2.right += dtx;
  4803. }
  4804. if (j == 2 || j == 5)
  4805. {
  4806. rc2.left += dtx * 2;
  4807. rc2.right += dtx * 2;
  4808. }
  4809. if (j == 3 || j == 4 || j == 5)
  4810. {
  4811. rc2.top += dty;
  4812. rc2.bottom += dty;
  4813. }
  4814. m_Print.DrawRect2(rc2, 1);
  4815. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4816. {
  4817. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(0);
  4818. rc2.left += 3;
  4819. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4820. rc2.left -= 3;
  4821. }
  4822. if (i == 0)continue;
  4823. rc2.left = rc2.right;
  4824. rc2.right += wid[1];
  4825. m_Print.DrawRect2(rc2, 1);
  4826. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4827. {
  4828. if (Listarray->ElementAt(aa*sinlecount + 33 * j + i).GetSize() > 1)
  4829. {
  4830. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(1);
  4831. rc2.left += 3;
  4832. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4833. rc2.left -= 3;
  4834. }
  4835. }
  4836. /* if(Listarray->GetSize ()>aa*46+i)
  4837. {
  4838. str=Listarray->ElementAt (aa*46+i).ElementAt (j);
  4839. rc2.left +=3;
  4840. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4841. rc2.left -=3;
  4842. }
  4843. rc2.left +=wid[j];
  4844. rc2.right =rc2.left+wid[j+1];*/
  4845. }
  4846. }
  4847. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4848. dlg.m_pDC = m_Print.GetPDC();
  4849. if (aa == 0)
  4850. {
  4851. if (dlg.DoModal() != IDOK)
  4852. return;
  4853. }
  4854. //结束打印
  4855. m_Print.EndPage();
  4856. m_Print.EndPrint();
  4857. }
  4858. }
  4859. void CMainFrame::PrintTakeForm(CArray<CStringArray, CStringArray>*Listarray)
  4860. {
  4861. CString title;
  4862. CString info;
  4863. // TODO: Add your control notification handler code here
  4864. int sinlecount = 4;
  4865. int pages = Listarray->GetSize() / sinlecount;
  4866. if (Listarray->GetSize() % sinlecount)pages++;
  4867. for (int aa = 0; aa < pages; aa++)
  4868. {
  4869. PrintPreview dlg;
  4870. CPrintRX m_Print;
  4871. m_Print.InitToPrint(NULL, 1);
  4872. m_Print.StartPrint();
  4873. m_Print.StartPage();
  4874. CRect mainrc(0, 0, 560, 793);
  4875. float fscale;
  4876. {
  4877. int w, h;
  4878. m_Print.GetWidHei(w, h);
  4879. fscale = (float)w / (float)h;
  4880. }
  4881. mainrc.DeflateRect(25, 40, 10, 0);
  4882. CString str;
  4883. CRect rc, rc2;
  4884. rc = mainrc;
  4885. rc.bottom = rc.top;
  4886. rc.top -= 20;
  4887. rc.left -= 20;
  4888. m_Print.SetFontFace(6, 1, "宋体");
  4889. str.Format(" 页:%d/%d", aa + 1, pages);
  4890. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4891. rc.right = mainrc.right + 10;
  4892. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4893. m_Print.SetFontFace(12, 1, "宋体");
  4894. int wid[2] = { 70, 190 };
  4895. int hei = 22;
  4896. rc = mainrc;
  4897. rc.bottom = rc.top + hei;
  4898. rc.top += 10;
  4899. rc.bottom += 10;
  4900. int dtx = rc.Width() / 2 + 18;
  4901. int dty = 380;
  4902. int arraysize = Listarray->ElementAt(0).GetSize();
  4903. for (int j = 0; j < 4; j++)
  4904. {
  4905. if (Listarray->GetSize() <= aa*sinlecount + j)continue;
  4906. for (int i = 0; i < arraysize; i++)
  4907. {
  4908. rc2.top = rc.top + i / 2 * hei;
  4909. rc2.bottom = rc.bottom + i / 2 * hei;
  4910. rc2.left = rc.left;
  4911. rc2.right = rc.left + wid[0];
  4912. if (i % 2)
  4913. {
  4914. rc2.left = rc2.right;
  4915. rc2.right += wid[1];
  4916. }
  4917. if (j == 1 || j == 3)
  4918. {
  4919. rc2.left += dtx;
  4920. rc2.right += dtx;
  4921. }
  4922. if (j == 2 || j == 3)
  4923. {
  4924. rc2.top += dty;
  4925. rc2.bottom += dty;
  4926. }
  4927. if (i == arraysize - 1 || i == arraysize - 2)
  4928. {
  4929. rc2.bottom += hei * 2;
  4930. }
  4931. m_Print.DrawRect2(rc2, 1);
  4932. {
  4933. str = Listarray->ElementAt(aa*sinlecount + j).ElementAt(i);
  4934. if (i == arraysize - 1)
  4935. {
  4936. CRect rc3 = rc2;
  4937. rc3.left += 3;
  4938. rc3.top += 3;
  4939. AutoDraw(m_Print, rc3, str, 1.4f);
  4940. }
  4941. else if (i == arraysize - 2)
  4942. {
  4943. CRect rc3 = rc2;
  4944. rc3.left += 3;
  4945. rc3.top += 3;
  4946. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4947. }
  4948. else
  4949. {
  4950. rc2.left += 3;
  4951. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4952. rc2.left -= 3;
  4953. }
  4954. }
  4955. }
  4956. }
  4957. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4958. dlg.m_pDC = m_Print.GetPDC();
  4959. if (aa == 0)
  4960. {
  4961. if (dlg.DoModal() != IDOK)
  4962. return;
  4963. }
  4964. //结束打印
  4965. m_Print.EndPage();
  4966. m_Print.EndPrint();
  4967. }
  4968. }
  4969. void CMainFrame::PrintThumbNail(CStringArray *array, CString client, BOOL bDir, CString m_size)
  4970. {
  4971. // TODO: Add your control notification handler code here
  4972. CStringArray titlearray;
  4973. CStringArray namearray;
  4974. CStringArray noarray;
  4975. CArray<CRect, CRect>rcarray;
  4976. CArray<CRect, CRect>widtharray;
  4977. if (m_size != "")
  4978. {
  4979. int pos = m_size.Find(";");
  4980. while (pos != -1)
  4981. {
  4982. CString size = m_size.Left(pos);
  4983. int pos2 = size.Find(":");
  4984. if (pos2 != -1)
  4985. {
  4986. CString str;
  4987. CRect rc;
  4988. str = size.Left(pos2);
  4989. noarray.Add(str);
  4990. str = size.Right(size.GetLength() - pos2 - 1);
  4991. pos2 = str.Find(",");
  4992. namearray.Add(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4993. pos2 = str.Find(",");
  4994. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4995. pos2 = str.Find(",");
  4996. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4997. widtharray.Add(rc);
  4998. pos2 = str.Find(",");
  4999. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  5000. pos2 = str.Find(",");
  5001. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  5002. pos2 = str.Find(",");
  5003. rc.right = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  5004. rc.bottom = atoi(str);
  5005. rcarray.Add(rc);
  5006. }
  5007. m_size = m_size.Right(m_size.GetLength() - pos - 1);
  5008. pos = m_size.Find(";");
  5009. }
  5010. }
  5011. PrintPreview dlg;
  5012. CPrintRX m_Print;
  5013. m_Print.InitToPrint(NULL, 1);
  5014. m_Print.StartPrint();
  5015. m_Print.StartPage();
  5016. CRect mainrc(0, 0, 560, 793);
  5017. mainrc.DeflateRect(25, 50, 10, 0);
  5018. m_Print.SetFontFace(10, 1, "宋体");
  5019. CRect rc, rc2;
  5020. rc = mainrc;
  5021. rc.bottom = rc.top;
  5022. rc.top -= 20;
  5023. m_Print.DrawText((LPTSTR)(LPCTSTR)client, rc, 0, 0, FORMAT_LEFT | FORMAT_UP);
  5024. rc.bottom -= 5;
  5025. m_Print.DrawRect2(rc, 2);
  5026. if (array->GetSize() > 130)m_Print.SetFontFace(8, 1, "宋体");
  5027. if (bDir)m_Print.SetFontFace(6, 1, "宋体");
  5028. ////////////////////////////////////////////////////////////////
  5029. int imgcount = array->GetSize();
  5030. int dtx = 5;
  5031. int dty = 15;
  5032. int cx, cy;
  5033. int countx = 5;
  5034. int county = 1;
  5035. while (1)
  5036. {
  5037. if (countx*county >= imgcount)
  5038. {
  5039. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  5040. cy = cx * 4 / 3;
  5041. break;
  5042. }
  5043. else
  5044. {
  5045. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  5046. cy = cx * 4 / 3;
  5047. if (cy*(county + 1) + dty*county < mainrc.Height())//Y方向可以增加一个
  5048. {
  5049. county++;
  5050. }
  5051. else//Y方向不能加,X方向加
  5052. {
  5053. countx++;
  5054. county = 1;
  5055. }
  5056. }
  5057. }
  5058. int imgpos = 0;
  5059. CString stemp;
  5060. CPen pen(PS_SOLID, 1, RGB(255, 0, 0));
  5061. CPen *oldpen = m_Print.m_DC.SelectObject(&pen);
  5062. CPen *oldpen2 = m_Print.m_memdc.SelectObject(&pen);
  5063. for (int i = 0; i < county; i++)
  5064. {
  5065. for (int j = 0; j < countx; j++)
  5066. {
  5067. rc = mainrc;
  5068. rc.top += i*(cy + dty);
  5069. rc.left += j*(cx + dtx);
  5070. rc.right = rc.left + cx;
  5071. rc.bottom = rc.top + cy;
  5072. Image *pImg = NULL;
  5073. if (imgpos >= array->GetSize())break;
  5074. CString str = array->ElementAt(imgpos);
  5075. CString spath = str.Left(str.ReverseFind('\\') + 1);
  5076. spath += "m";
  5077. spath += str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5078. if (PathFileExists(spath))
  5079. ::LoadImageFromBuf(&pImg, spath);
  5080. else
  5081. {
  5082. ::LoadImageFromBuf(&pImg, str);
  5083. if (pImg == NULL)continue;
  5084. int orientation = GetOrientation(pImg);
  5085. if (orientation == 8)
  5086. pImg->RotateFlip(Rotate270FlipNone);
  5087. else if (orientation == 6)
  5088. pImg->RotateFlip(Rotate90FlipNone);
  5089. }
  5090. if (pImg == NULL)continue;
  5091. rc2 = rc;
  5092. RectFitDes(pImg->GetWidth(), pImg->GetHeight(), rc);
  5093. imgpos++;
  5094. m_Print.DrawImage(pImg, rc);
  5095. int imgwidth = pImg->GetWidth();
  5096. delete pImg;
  5097. rc2.top = rc2.bottom + 3;
  5098. rc2.bottom += 10;
  5099. if (bDir == 0)
  5100. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5101. else
  5102. {
  5103. stemp = str.Left(str.ReverseFind('\\'));
  5104. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5105. if (stemp.ReverseFind('\\') != -1)
  5106. {
  5107. stemp = stemp.Right(stemp.GetLength() - stemp.ReverseFind('\\') - 1);
  5108. str = stemp + "\\" + str;
  5109. }
  5110. }
  5111. if (str.Find(".") != -1)
  5112. str = str.Left(str.Find("."));
  5113. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5114. if (noarray.GetSize())
  5115. {
  5116. rc2 = rc;
  5117. for (int aa = 0; aa < noarray.GetSize(); aa++)
  5118. {
  5119. float scale = (float)rc2.Width() / (float)imgwidth;
  5120. if (noarray.ElementAt(aa) == str)
  5121. {
  5122. int nIndex = aa;
  5123. CRect rc = rcarray.ElementAt(nIndex);
  5124. int wid = widtharray.ElementAt(nIndex).left;
  5125. int hei = widtharray.ElementAt(nIndex).top;
  5126. scale *= (float)imgwidth / (float)wid;
  5127. rc.left *= scale;
  5128. rc.right *= scale;
  5129. rc.top *= scale;
  5130. rc.bottom *= scale;
  5131. rc.left += rc2.left;
  5132. rc.right += rc2.left;
  5133. rc.top += rc2.top;
  5134. rc.bottom += rc2.top;
  5135. if (rc.left < rc2.left)rc.left = rc2.left;
  5136. if (rc.right > rc2.right)rc.right = rc2.right;
  5137. if (rc.top < rc2.top)rc.top = rc2.top;
  5138. if (rc.bottom > rc2.bottom)rc.bottom = rc2.bottom;
  5139. m_Print.DrawRect2(rc, 1);
  5140. }
  5141. }
  5142. }
  5143. }
  5144. }
  5145. m_Print.m_DC.SelectObject(oldpen);
  5146. m_Print.m_memdc.SelectObject(oldpen2);
  5147. /* CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  5148. StrRect.top -=15;StrRect.bottom -=15;
  5149. Image *pImg=NULL;
  5150. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  5151. m_Print.DrawImage(pImg, StrRect);
  5152. delete pImg;
  5153. m_Print.SetFontFace(10, 1, "宋体");
  5154. StrRect=load.m_rcarray .ElementAt (20);
  5155. StrRect.right=load.m_rcarray .ElementAt (23).right;
  5156. StrRect.top -=18;StrRect.bottom -=18;
  5157. CString str="地址:"+g_cominfoarray.ElementAt (0).ElementAt (12);
  5158. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5159. */
  5160. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  5161. dlg.m_pDC = m_Print.GetPDC();
  5162. if (dlg.DoModal() != IDOK)
  5163. return;
  5164. //结束打印
  5165. m_Print.EndPage();
  5166. m_Print.EndPrint();
  5167. }
  5168. // remark by Jeff
  5169. // 函数:PrintDinDan
  5170. // 参数:
  5171. // strOrderNumber:订单单号;(Order number)
  5172. // 返回:void
  5173. // 注意:#
  5174. void CMainFrame::PrintDinDan(CString strOrderNumber)//打印订单报表;
  5175. {
  5176. int printcot = 1;
  5177. for (int aa = 0; aa < printcot; aa++)
  5178. {
  5179. PrintPreview dlg;
  5180. CPrintRX m_Print;
  5181. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  5182. {
  5183. m_Print.InitToPrint(NULL, 1);
  5184. }
  5185. else
  5186. {
  5187. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  5188. if (name.IsEmpty())
  5189. m_Print.InitToPrint(NULL, 1);
  5190. else
  5191. {
  5192. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  5193. if (nret == -1 && aa == 0)
  5194. {
  5195. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  5196. }
  5197. }
  5198. }
  5199. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 0)
  5200. {
  5201. #ifdef ZHIAI_VERSION
  5202. PrintDinDan3(strOrderNumber);
  5203. return;
  5204. #endif
  5205. #ifdef SZBLCT_VERSION
  5206. PrintDinDan4(strOrderNumber);
  5207. return;
  5208. #endif
  5209. m_Print.StartPrint();
  5210. m_Print.StartPage();
  5211. LoadRect load;
  5212. load.SetLiaPath("6.lia");
  5213. load.SetMargins(-14, 15);
  5214. if (!load.Load())return;
  5215. LoadRect load2;
  5216. load2.SetLiaPath("7.lia");
  5217. load2.SetMargins(-14, 216 + 15);
  5218. if (!load2.Load())return;
  5219. LoadRect load3;
  5220. load3.SetLiaPath("8.lia");
  5221. load3.SetMargins(-14, 705 + 15);
  5222. if (!load3.Load())return;
  5223. int i;
  5224. //////////////////////////////////////////////////////////////
  5225. CStringArray txarray;
  5226. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  5227. g_sendhead.code[0] = 11;
  5228. g_sendhead.code[1] = 52;
  5229. g_sendhead.code[2] = 50;
  5230. g_sendhead.code[3] = 150;
  5231. g_sendhead.code[4] = 77;
  5232. g_sendhead.code[5] = 4;
  5233. g_sendhead.tabcount = 6;
  5234. g_sendhead.bsql = 0;
  5235. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5236. CArray<CStringArray, CStringArray>sparray;
  5237. CArray<CStringArray, CStringArray>clientarray;
  5238. CArray<CStringArray, CStringArray>phonearray;
  5239. CArray<CStringArray, CStringArray>fgarray;
  5240. CArray<CStringArray, CStringArray>danweiarray;
  5241. CArray<CStringArray, CStringArray>jdarray;
  5242. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5243. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5244. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5245. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5246. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5247. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5248. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5249. CString m_taoxiname;
  5250. if (m_zs.Find("\\") != -1)
  5251. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  5252. else
  5253. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  5254. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5255. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5256. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5257. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5258. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5259. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5260. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5261. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5262. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5263. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5264. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5265. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5266. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5267. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5268. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5269. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5270. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5271. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5272. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5273. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5274. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5275. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5276. if (jdarray.GetSize())
  5277. {
  5278. if (m_bz.IsEmpty() == 0)
  5279. m_bz = "\r\n" + m_bz;
  5280. m_bz += "景点:";
  5281. }
  5282. #ifdef DDF_VERSION
  5283. m_bz += "219店:219路馨园小区对面\r\n";
  5284. m_bz += "金色店:万科金色家园小区东门南走20米荣光社区一楼\r\n";
  5285. m_bz += "万泰店:万泰锦绣华城小区正门\r\n";
  5286. #else
  5287. for (i = 0; i < jdarray.GetSize(); i++)
  5288. {
  5289. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5290. }
  5291. m_bz.TrimRight(";");
  5292. #endif
  5293. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5294. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5295. if (IsHasRights2new(31) == 0)
  5296. {
  5297. m_phone1 = "***";
  5298. m_phone2 = "***";
  5299. }
  5300. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5301. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5302. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  5303. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  5304. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  5305. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  5306. filter = "name='" + m_ren + "'";
  5307. g_sendhead.code[0] = 5;
  5308. g_sendhead.tabcount = 1;
  5309. g_sendhead.bsql = 0;
  5310. int g_nYearposTemp = g_nYearpos;
  5311. g_nYearpos = -1;
  5312. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5313. g_nYearpos = g_nYearposTemp;
  5314. if (g_bSendOK == 0)return;
  5315. DataToArray(&phonearray);
  5316. m_money1.Format("%f", atof(m_taoxijiage));
  5317. m_money2.Format("%f", atof(m_payed1));
  5318. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5319. ConvertToPrice(m_money1);
  5320. ConvertToPrice(m_money2);
  5321. ConvertToPrice(m_money3);
  5322. ////////////////////////////////////////////////////////////////
  5323. int rcpos = -1;
  5324. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  5325. StrRect.top -= 15; StrRect.bottom -= 15;
  5326. Image *pImg = NULL;
  5327. #ifdef MNLS_VERSION
  5328. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  5329. #else
  5330. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  5331. #endif
  5332. m_Print.DrawImage(pImg, StrRect);
  5333. delete pImg;
  5334. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5335. {
  5336. Image *pImg = NULL;
  5337. g_nSendCode = 31;
  5338. int g_nYearposTemp = g_nYearpos;
  5339. g_nYearpos = -1;
  5340. g_pMainWnd->ProcessChatMessageRequest2(1);
  5341. g_nYearpos = g_nYearposTemp;
  5342. g_nSendCode = 0;
  5343. if (g_bSendOK == 0)return;
  5344. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5345. if (pImg)
  5346. {
  5347. StrRect.left = 30;
  5348. StrRect.top = 12;
  5349. StrRect.right = StrRect.left + 60;
  5350. StrRect.bottom = StrRect.top + 60;
  5351. m_Print.DrawImage(pImg, StrRect);
  5352. delete pImg; pImg = NULL;
  5353. }
  5354. }
  5355. m_Print.SetFontFace(11, 1, "宋体");
  5356. StrRect = load.m_rcarray.ElementAt(20);
  5357. StrRect.right = load.m_rcarray.ElementAt(23).right;
  5358. StrRect.top -= 18; StrRect.bottom -= 18;
  5359. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  5360. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5361. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  5362. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5363. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5364. StrRect.top -= 15; StrRect.bottom -= 15;
  5365. #ifdef MNLS_VERSION
  5366. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5367. #endif
  5368. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5369. StrRect.top -= 15; StrRect.bottom -= 15;
  5370. #ifdef MNLS_VERSION
  5371. m_Print.DrawRect(StrRect);
  5372. #endif
  5373. m_Print.SetFontFace(7, 1, "黑体");
  5374. m_Print.SetColor(0xffffff);
  5375. #ifdef MNLS_VERSION
  5376. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5377. #endif
  5378. m_Print.SetColor(0);
  5379. m_Print.SetFontFace(15, 1, "宋体");
  5380. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5381. StrRect.top -= 15; StrRect.bottom -= 15;
  5382. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同预约订单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5383. CStringArray strarray;
  5384. strarray.Add("NO: " + strOrderNumber);
  5385. CString date;
  5386. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  5387. strarray.Add(date);
  5388. strarray.Add("喜爱");
  5389. strarray.Add("格调");
  5390. if (fgarray.GetSize() == 12)
  5391. {
  5392. for (int i = 0; i < 12; i++)
  5393. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  5394. }
  5395. else
  5396. {
  5397. strarray.Add("复古典雅");
  5398. strarray.Add("温文尔雅");
  5399. strarray.Add("豪华艳丽");
  5400. strarray.Add("传统大方");
  5401. strarray.Add("新潮个性");
  5402. strarray.Add("浪漫奔放");
  5403. strarray.Add("简单素雅");
  5404. strarray.Add("活泼俏丽");
  5405. strarray.Add("妩媚温馨");
  5406. strarray.Add("温柔贤惠");
  5407. strarray.Add("成熟感性");
  5408. strarray.Add("清纯可爱");
  5409. }
  5410. strarray.Add("姓名");
  5411. // strarray.Add("职业");
  5412. strarray.Add("");
  5413. strarray.Add("地址");
  5414. strarray.Add("电话");
  5415. #ifdef CHILD_VERSION
  5416. strarray.Add("家长");
  5417. strarray.Add("宝宝");
  5418. #else
  5419. strarray.Add("先生");
  5420. strarray.Add("女士");
  5421. #endif
  5422. m_Print.SetFontFace(11, 1, "宋体");
  5423. for (i = 0; i < strarray.GetSize(); i++)
  5424. {
  5425. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5426. if (i < 2)
  5427. {
  5428. StrRect.top -= 15; StrRect.bottom -= 15;
  5429. }
  5430. if (i>15)
  5431. m_Print.DrawRect2(StrRect, 1);
  5432. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5433. }
  5434. for (i = 29; i <= 40; i++)
  5435. {
  5436. if (m_style.GetLength() <= (i - 29))continue;
  5437. if (m_style.GetAt(i - 29) != '1')continue;
  5438. StrRect = load.m_rcarray.ElementAt(i - 1);
  5439. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5440. }
  5441. for (i = 27; i <= 48; i++)
  5442. {
  5443. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5444. m_Print.DrawRect2(StrRect, 1);
  5445. }
  5446. #ifdef CHILD_VERSION
  5447. StrRect = load.m_rcarray.ElementAt(45);
  5448. StrRect.right = StrRect.left + 62;
  5449. m_Print.DrawRect2(StrRect, 1);
  5450. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5451. StrRect.left = StrRect.right;
  5452. StrRect.right = StrRect.left + 62;
  5453. m_Print.DrawRect2(StrRect, 1);
  5454. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5455. StrRect.left = StrRect.right;
  5456. StrRect.right = StrRect.left + 62;
  5457. m_Print.DrawRect2(StrRect, 1);
  5458. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5459. StrRect.left = StrRect.right;
  5460. StrRect.right = StrRect.left + 62;
  5461. m_Print.DrawRect2(StrRect, 1);
  5462. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5463. #endif
  5464. /////////////////////////
  5465. strarray.RemoveAll();
  5466. CString temp;
  5467. temp.Format("拍摄多款选 %d 款,其中影", atoi(m_outside) + atoi(m_outside2));
  5468. strarray.Add(temp);
  5469. temp.Format("棚景 %d 款,景点 %d 款.", atoi(m_outside2), atoi(m_outside));
  5470. strarray.Add(temp);
  5471. strarray.Add("化妆");
  5472. strarray.Add("造型");
  5473. #ifdef CHILD_VERSION
  5474. strarray.Add("");
  5475. #else
  5476. strarray.Add("婚纱");
  5477. #endif
  5478. strarray.Add("服饰");
  5479. strarray.Add("配");
  5480. strarray.Add("置");
  5481. strarray.Add("其");
  5482. strarray.Add("它");
  5483. strarray.Add("套系名称");
  5484. strarray.Add("镜款");
  5485. strarray.Add("套系总价");
  5486. strarray.Add("主摄影师");
  5487. strarray.Add("拍摄日期");
  5488. strarray.Add("定金");
  5489. #ifdef CHILD_VERSION
  5490. strarray.Add("主引导师");
  5491. #else
  5492. strarray.Add("主化妆师");
  5493. #endif
  5494. strarray.Add("看样日期");
  5495. strarray.Add("欠款余额");
  5496. strarray.Add("总监");
  5497. strarray.Add("取件日期");
  5498. rcpos = -1;
  5499. for (i = 0; i < strarray.GetSize(); i++)
  5500. {
  5501. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5502. if (i>9)
  5503. m_Print.DrawRect2(StrRect, 1);
  5504. #ifdef CHILD_VERSION
  5505. if (i == 5)
  5506. StrRect.top -= StrRect.Height();
  5507. #endif
  5508. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5509. }
  5510. for (i = 22; i <= 41; i++)
  5511. {
  5512. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5513. m_Print.DrawRect2(StrRect, 1);
  5514. }
  5515. /////////////////////////////
  5516. strarray.RemoveAll();
  5517. #ifdef CHILD_VERSION
  5518. strarray.Add("顾客方 家长:");
  5519. strarray.Add("宝宝:");
  5520. #else
  5521. strarray.Add("顾客方 先生:");
  5522. strarray.Add("女士:");
  5523. #endif
  5524. strarray.Add("电话:");
  5525. strarray.Add("影楼方 店长:");
  5526. strarray.Add("接单人:");
  5527. strarray.Add("电话:");
  5528. rcpos = -1;
  5529. for (i = 0; i < strarray.GetSize(); i++)
  5530. {
  5531. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5532. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5533. }
  5534. for (i = 7; i <= 12; i++)
  5535. {
  5536. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5537. // if(i!=10)
  5538. m_Print.DrawRect2(StrRect, 2);
  5539. }
  5540. //////////////////////////////////////
  5541. //开始打数据
  5542. strarray.RemoveAll();
  5543. strarray.Add(m_name1);
  5544. strarray.Add(m_name2);
  5545. /// strarray.Add (m_occupation1);
  5546. // strarray.Add (m_occupation2);
  5547. strarray.Add("");
  5548. strarray.Add("");
  5549. strarray.Add(m_addr1);
  5550. #ifdef CHILD_VERSION
  5551. strarray.Add("");
  5552. #else
  5553. strarray.Add(m_addr2);
  5554. #endif
  5555. strarray.Add(m_phone1);
  5556. strarray.Add(m_phone2);
  5557. for (i = 41; i <= 48; i++)
  5558. {
  5559. StrRect = load.m_rcarray.ElementAt(i - 1);
  5560. StrRect.left += 4;
  5561. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5562. }
  5563. ///////////////////////////////
  5564. strarray.RemoveAll();
  5565. strarray.Add(m_money1);
  5566. strarray.Add(m_waiter1);
  5567. strarray.Add(m_time2);
  5568. strarray.Add(m_money2);
  5569. strarray.Add(m_waiter2);
  5570. strarray.Add(m_time4);
  5571. strarray.Add(m_money3);
  5572. strarray.Add("");
  5573. strarray.Add(m_time5);
  5574. for (i = 32; i <= 40; i++)
  5575. {
  5576. StrRect = load2.m_rcarray.ElementAt(i - 1);
  5577. StrRect.left += 4;
  5578. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5579. }
  5580. ///////////////////////////////
  5581. strarray.RemoveAll();
  5582. strarray.Add(m_name1);
  5583. strarray.Add(m_name2);
  5584. CString phone;
  5585. if (m_phone1.IsEmpty() == 0)
  5586. phone = m_phone1 + ",";
  5587. phone += m_phone2;
  5588. phone.TrimRight(",");
  5589. strarray.Add(phone);
  5590. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  5591. strarray.Add(m_ren);
  5592. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  5593. for (i = 7; i <= 12; i++)
  5594. {
  5595. StrRect = load3.m_rcarray.ElementAt(i - 1);
  5596. StrRect.left += 4;
  5597. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5598. }
  5599. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  5600. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5601. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  5602. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5603. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  5604. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5605. //////////////////////////////
  5606. //开始画文字
  5607. StrRect = load2.m_rcarray.ElementAt(30);
  5608. StrRect.left += 3;
  5609. StrRect.top += 3;
  5610. StrRect.right -= 2;
  5611. StrRect.bottom -= 2;
  5612. AutoDraw(m_Print, StrRect, m_bz, 1.4f);
  5613. StrRect = load2.m_rcarray.ElementAt(29);
  5614. StrRect.left += 3;
  5615. StrRect.top += 3;
  5616. StrRect.right -= 2;
  5617. StrRect.bottom -= 2;
  5618. str = "";
  5619. for (i = 0; i < sparray.GetSize(); i++)
  5620. {
  5621. str += sparray.ElementAt(i).ElementAt(5);
  5622. str += " 数量:";
  5623. str += sparray.ElementAt(i).ElementAt(3);
  5624. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5625. str += "\r\n";
  5626. }
  5627. str.TrimRight("\r\n");
  5628. AutoDraw(m_Print, StrRect, str, 1.4);
  5629. StrRect = load2.m_rcarray.ElementAt(40);
  5630. StrRect.top += 8;
  5631. m_Print.SetFontFace(12, 1, "黑体");
  5632. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5633. StrRect.left += 3;
  5634. StrRect.top += 30;
  5635. StrRect.right -= 2;
  5636. StrRect.bottom -= 2;
  5637. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5638. if (str.IsEmpty())
  5639. {
  5640. str = "\
  5641. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5642. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5643. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5644. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5645. 持良好的心境.\r\n\
  5646. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5647. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5648. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5649. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5650. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5651. 勿进影室, 以免影响拍摄.\r\n\
  5652. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5653. 师或店长沟通.\r\n\
  5654. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5655. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5656. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5657. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5658. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5659. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5660. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5661. 还.";
  5662. }
  5663. AutoDraw(m_Print, StrRect, str, 1.8);
  5664. }
  5665. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 1)
  5666. {//AfxMessageBox("yyy");
  5667. m_Print.StartPrint();
  5668. m_Print.StartPage();
  5669. LoadRect load;
  5670. load.SetLiaPath("6-2.lia");
  5671. load.SetMargins(0, 0);
  5672. if (!load.Load())return;
  5673. int i;
  5674. //////////////////////////////////////////////////////////////
  5675. CStringArray txarray;
  5676. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  5677. g_sendhead.code[0] = 11;
  5678. g_sendhead.code[1] = 52;
  5679. g_sendhead.code[2] = 50;
  5680. g_sendhead.code[3] = 150;
  5681. g_sendhead.code[4] = 77;
  5682. g_sendhead.code[5] = 4;
  5683. g_sendhead.tabcount = 6;
  5684. g_sendhead.bsql = 0;
  5685. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5686. CArray<CStringArray, CStringArray>sparray;
  5687. CArray<CStringArray, CStringArray>clientarray;
  5688. CArray<CStringArray, CStringArray>phonearray;
  5689. CArray<CStringArray, CStringArray>fgarray;
  5690. CArray<CStringArray, CStringArray>danweiarray;
  5691. CArray<CStringArray, CStringArray>jdarray;
  5692. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5693. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5694. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5695. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5696. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5697. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5698. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  5699. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5700. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5701. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5702. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5703. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5704. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5705. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5706. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5707. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5708. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5709. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5710. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5711. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5712. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5713. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5714. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5715. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5716. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5717. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5718. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5719. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5720. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5721. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5722. if (jdarray.GetSize())
  5723. {
  5724. if (m_bz.IsEmpty() == 0)
  5725. m_bz = "\r\n" + m_bz;
  5726. m_bz += "景点:";
  5727. }
  5728. for (i = 0; i < jdarray.GetSize(); i++)
  5729. {
  5730. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5731. }
  5732. m_bz.TrimRight(";");
  5733. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5734. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5735. if (IsHasRights2new(31) == 0)
  5736. {
  5737. m_phone1 = "***";
  5738. m_phone2 = "***";
  5739. }
  5740. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5741. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5742. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  5743. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  5744. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  5745. CString str;
  5746. filter = "name='" + m_ren + "'";
  5747. g_sendhead.code[0] = 5;
  5748. g_sendhead.tabcount = 1;
  5749. g_sendhead.bsql = 0;
  5750. int g_nYearposTemp = g_nYearpos;
  5751. g_nYearpos = -1;
  5752. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5753. g_nYearpos = g_nYearposTemp;
  5754. if (g_bSendOK == 0)return;
  5755. DataToArray(&phonearray);
  5756. m_money1.Format("%f", atof(m_taoxijiage));
  5757. m_money2.Format("%f", atof(m_payed1));
  5758. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5759. ConvertToPrice(m_money1);
  5760. ConvertToPrice(m_money2);
  5761. ConvertToPrice(m_money3);
  5762. ////////////////////////////////////////////////////////////////
  5763. int rcpos = -1;
  5764. CRect StrRect = load.m_rcarray.ElementAt(0);
  5765. m_Print.SetFontFace(25, 1, "黑体");
  5766. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "预约单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5767. m_Print.SetFontFace(11, 1, "宋体");
  5768. StrRect = load.m_rcarray.ElementAt(1);
  5769. if (m_time1.GetLength() == 10)
  5770. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  5771. else
  5772. str = "开单日期:";
  5773. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5774. StrRect = load.m_rcarray.ElementAt(2);
  5775. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + strOrderNumber), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5776. CStringArray strarray;
  5777. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5778. {
  5779. Image *pImg = NULL;
  5780. g_nSendCode = 31;
  5781. int g_nYearposTemp = g_nYearpos;
  5782. g_nYearpos = -1;
  5783. g_pMainWnd->ProcessChatMessageRequest2(1);
  5784. g_nYearpos = g_nYearposTemp;
  5785. g_nSendCode = 0;
  5786. if (g_bSendOK == 0)return;
  5787. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5788. if (pImg)
  5789. {
  5790. StrRect.left = 47;
  5791. StrRect.top = 12;
  5792. StrRect.right = StrRect.left + 60;
  5793. StrRect.bottom = StrRect.top + 60;
  5794. m_Print.DrawImage(pImg, StrRect);
  5795. delete pImg; pImg = NULL;
  5796. }
  5797. }
  5798. #ifdef CHILD_VERSION
  5799. strarray.Add("家长姓名");
  5800. strarray.Add("宝宝姓名");
  5801. #else
  5802. strarray.Add("先生姓名");
  5803. strarray.Add("女士姓名");
  5804. #endif
  5805. strarray.Add("服装套数");
  5806. // strarray.Add ("拍摄张数");
  5807. #ifdef CHILD_VERSION
  5808. strarray.Add("出生日期");
  5809. #else
  5810. strarray.Add("结婚日期");
  5811. #endif
  5812. strarray.Add("拍摄日期");
  5813. strarray.Add("联系电话");
  5814. strarray.Add("联系电话");
  5815. strarray.Add("造型套数");
  5816. if (m_zs.Find("\\") != -1)
  5817. strarray.Add("入底\\入册");
  5818. else
  5819. strarray.Add("入底张数");
  5820. strarray.Add("选片日期");
  5821. strarray.Add("QQ/邮箱");
  5822. strarray.Add("套系总额");
  5823. strarray.Add("定金");
  5824. strarray.Add("余款金额");
  5825. strarray.Add("取件日期");
  5826. strarray.Add(m_name1);
  5827. strarray.Add(m_name2);
  5828. strarray.Add(m_clothescount);
  5829. // str.Format("%d", atoi(m_zs)*3);
  5830. // strarray.Add (str);
  5831. #ifdef CHILD_VERSION
  5832. strarray.Add(m_birthday1);
  5833. #else
  5834. strarray.Add(m_time3);
  5835. #endif
  5836. strarray.Add(m_time2);
  5837. strarray.Add(m_phone1);
  5838. strarray.Add(m_phone2);
  5839. strarray.Add(m_clothescount2);
  5840. strarray.Add(m_zs);
  5841. strarray.Add(m_time4);
  5842. strarray.Add(m_qq1);
  5843. strarray.Add(m_money1);
  5844. strarray.Add(m_money2);
  5845. strarray.Add(m_money3);
  5846. strarray.Add(m_time5);
  5847. for (i = 4; i <= 33; i++)
  5848. {
  5849. StrRect = load.m_rcarray.ElementAt(i - 1);
  5850. m_Print.DrawRect2(StrRect, 1);
  5851. if (strarray.GetSize() > (i - 4))
  5852. {
  5853. if (i <= 18)
  5854. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5855. else
  5856. {
  5857. StrRect.left += 4;
  5858. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5859. }
  5860. }
  5861. }
  5862. int dt = 413;
  5863. StrRect = load.m_rcarray.ElementAt(36); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5864. m_Print.DrawText((LPTSTR)(LPCTSTR)"门市签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5865. StrRect = load.m_rcarray.ElementAt(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5866. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5867. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5868. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5869. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  5870. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5871. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  5872. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5873. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  5874. m_Print.DrawText((LPTSTR)(LPCTSTR)("网址:" + g_cominfoarray.ElementAt(0).ElementAt(13)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5875. //////////////////////////////
  5876. //开始画文字
  5877. StrRect = load.m_rcarray.ElementAt(7);
  5878. int hei = StrRect.Height();
  5879. StrRect.top += hei;
  5880. StrRect.bottom += hei;
  5881. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5882. StrRect.top += dt;
  5883. StrRect.bottom += dt;
  5884. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5885. StrRect = load.m_rcarray.ElementAt(17);
  5886. StrRect.top += hei;
  5887. StrRect.bottom += hei;
  5888. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5889. StrRect = load.m_rcarray.ElementAt(33);
  5890. StrRect.bottom = StrRect.top + 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 = "";
  5897. for (i = 0; i < sparray.GetSize(); i++)
  5898. {
  5899. str += sparray.ElementAt(i).ElementAt(5);
  5900. str += " 数量:";
  5901. str += sparray.ElementAt(i).ElementAt(3);
  5902. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5903. str += "\r\n";
  5904. }
  5905. str.TrimRight("\r\n");
  5906. AutoDraw(m_Print, StrRect, str, 1.4);
  5907. StrRect = load.m_rcarray.ElementAt(33);
  5908. StrRect.top += dt;
  5909. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5910. StrRect.top += hei;
  5911. StrRect.left += 3;
  5912. StrRect.top += 3;
  5913. StrRect.right -= 2;
  5914. StrRect.bottom -= 2;
  5915. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  5916. StrRect = load.m_rcarray.ElementAt(34);
  5917. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5918. StrRect.top += hei;
  5919. StrRect.left += 3;
  5920. StrRect.top += 3;
  5921. StrRect.right -= 2;
  5922. StrRect.bottom -= 2;
  5923. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5924. if (str.IsEmpty())
  5925. {
  5926. str = "\
  5927. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5928. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5929. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5930. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5931. 持良好的心境.\r\n\
  5932. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5933. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5934. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5935. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5936. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5937. 勿进影室, 以免影响拍摄.\r\n\
  5938. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5939. 师或店长沟通.\r\n\
  5940. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5941. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5942. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5943. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5944. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5945. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5946. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5947. 还.";
  5948. }
  5949. AutoDraw(m_Print, StrRect, str, 1.8);
  5950. StrRect = load.m_rcarray.ElementAt(35);
  5951. StrRect.bottom += 100;
  5952. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  5953. 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∨";
  5954. // AutoDraw(m_Print, StrRect, str, 1.4);
  5955. }
  5956. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 2)
  5957. {
  5958. PrintDinDan5(strOrderNumber);
  5959. return;
  5960. }
  5961. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  5962. {
  5963. PrintDinDan6(strOrderNumber);
  5964. return;
  5965. }
  5966. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  5967. dlg.m_pDC = m_Print.GetPDC();
  5968. dlg.m_mode = 1;
  5969. if (aa == 0)
  5970. {
  5971. if (dlg.DoModal() != IDOK)
  5972. return;
  5973. printcot = dlg.m_num;
  5974. }
  5975. //结束打印
  5976. m_Print.EndPage();
  5977. m_Print.EndPrint();
  5978. }
  5979. }
  5980. void CovertDate2(CString date, CString &date2)
  5981. {
  5982. try
  5983. {
  5984. if (date == "2013-04-09")
  5985. {
  5986. date2 = "2013-02-29";
  5987. return;
  5988. }
  5989. ///////////////////////////////////
  5990. date2 = date;
  5991. GongToLong(date2);
  5992. ////////////////////////////////////
  5993. return;
  5994. CCalendarConvert m_CalendarConvert;
  5995. SYSTEMTIME src = { 0 };
  5996. SYSTEMTIME dst = { 0 };
  5997. COleDateTime m_timeLunar(atoi(date.Mid(0, 4)), atoi(date.Mid(5, 2)), atoi(date.Mid(8, 2)), 0, 0, 0);
  5998. COleDateTime m_timeGregorian;
  5999. m_timeLunar.GetAsSystemTime(src);
  6000. BOOL bEmbolism = 0;
  6001. if (m_CalendarConvert.Gregorian2Lunar(&src, &dst, &bEmbolism))
  6002. {
  6003. m_timeGregorian = m_CalendarConvert.ConvertSysTime2OleDateTime(&dst);
  6004. date2.Format("%04d-%02d-%02d", m_timeGregorian.GetYear(), m_timeGregorian.GetMonth(), m_timeGregorian.GetDay());
  6005. if (m_timeGregorian.GetYear() == -1)date2 = "2000-13-32";
  6006. }
  6007. else
  6008. {
  6009. date2.Empty();
  6010. }
  6011. }
  6012. catch (...)
  6013. {
  6014. }
  6015. }
  6016. void CMainFrame::PrintDinDan5(CString m_id)
  6017. {
  6018. int printcot = 1;
  6019. for (int aa = 0; aa < printcot; aa++)
  6020. {
  6021. PrintPreview dlg;
  6022. CPrintRX m_Print;
  6023. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6024. {
  6025. m_Print.InitToPrint(NULL, 1);
  6026. }
  6027. else
  6028. {
  6029. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  6030. if (name.IsEmpty())
  6031. m_Print.InitToPrint(NULL, 1);
  6032. else
  6033. {
  6034. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6035. if (nret == -1 && aa == 0)
  6036. {
  6037. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6038. }
  6039. }
  6040. }
  6041. {
  6042. m_Print.StartPrint();
  6043. m_Print.StartPage();
  6044. LoadRect load;
  6045. load.SetLiaPath("19.lia");
  6046. load.SetMargins(0, -20);
  6047. if (!load.Load())return;
  6048. int i;
  6049. //////////////////////////////////////////////////////////////
  6050. CStringArray txarray;
  6051. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  6052. g_sendhead.code[0] = 11;
  6053. g_sendhead.code[1] = 52;
  6054. g_sendhead.code[2] = 50;
  6055. g_sendhead.code[3] = 150;
  6056. g_sendhead.code[4] = 77;
  6057. g_sendhead.code[5] = 4;
  6058. g_sendhead.tabcount = 6;
  6059. g_sendhead.bsql = 0;
  6060. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  6061. CArray<CStringArray, CStringArray>sparray;
  6062. CArray<CStringArray, CStringArray>clientarray;
  6063. CArray<CStringArray, CStringArray>phonearray;
  6064. CArray<CStringArray, CStringArray>fgarray;
  6065. CArray<CStringArray, CStringArray>danweiarray;
  6066. CArray<CStringArray, CStringArray>jdarray;
  6067. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  6068. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  6069. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  6070. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  6071. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  6072. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  6073. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  6074. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  6075. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  6076. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  6077. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  6078. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  6079. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  6080. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  6081. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  6082. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  6083. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  6084. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  6085. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  6086. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  6087. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  6088. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  6089. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  6090. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  6091. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  6092. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  6093. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  6094. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  6095. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(36);
  6096. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  6097. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6098. CString m_txtype = g_List1array.ElementAt(0).ElementAt(52);
  6099. CString m_memberno = g_List1array.ElementAt(0).ElementAt(47);
  6100. CString str;
  6101. if (jdarray.GetSize())
  6102. {
  6103. if (m_bz.IsEmpty() == 0)
  6104. m_bz = "\r\n" + m_bz;
  6105. m_bz += "景点:";
  6106. }
  6107. for (i = 0; i < jdarray.GetSize(); i++)
  6108. {
  6109. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  6110. }
  6111. m_bz.TrimRight(";");
  6112. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  6113. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  6114. if (IsHasRights2new(31) == 0)
  6115. {
  6116. m_phone1 = "***";
  6117. m_phone2 = "***";
  6118. }
  6119. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  6120. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  6121. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  6122. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  6123. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  6124. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  6125. BOOL check1 = atoi(clientarray.ElementAt(0).ElementAt(15));
  6126. filter = "name='" + m_ren + "'";
  6127. g_sendhead.code[0] = 5;
  6128. g_sendhead.tabcount = 1;
  6129. g_sendhead.bsql = 0;
  6130. int g_nYearposTemp = g_nYearpos;
  6131. g_nYearpos = -1;
  6132. g_pMainWnd->ProcessChatMessageRequest2(filter);
  6133. g_nYearpos = g_nYearposTemp;
  6134. if (g_bSendOK == 0)return;
  6135. DataToArray(&phonearray);
  6136. m_money1.Format("%f", atof(m_taoxijiage));
  6137. m_money2.Format("%f", atof(m_payed1));
  6138. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  6139. ConvertToPrice(m_money1);
  6140. ConvertToPrice(m_money2);
  6141. ConvertToPrice(m_money3);
  6142. ////////////////////////////////////////////////////////////////
  6143. int rcpos = -1;
  6144. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6145. //Image *pImg=NULL;
  6146. // ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  6147. // m_Print.DrawImage(pImg, StrRect);
  6148. // delete pImg;
  6149. m_Print.SetFontFace(20, 1, "宋体");
  6150. StrRect = load.m_rcarray.ElementAt(1);
  6151. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "定单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6152. m_Print.SetFontFace(12, 1, "宋体");
  6153. StrRect = load.m_rcarray.ElementAt(2);
  6154. m_Print.DrawText((LPTSTR)(LPCTSTR)("NO." + m_id), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6155. StrRect = load.m_rcarray.ElementAt(3);
  6156. str.Format("%s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  6157. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6158. StrRect = load.m_rcarray.ElementAt(4);
  6159. m_Print.DrawText((LPTSTR)(LPCTSTR)("联系人:" + m_name1), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6160. CStringArray strarray;
  6161. strarray.Add("姓名");
  6162. strarray.Add("性别");
  6163. strarray.Add("年龄");
  6164. strarray.Add("出生年月");
  6165. strarray.Add("套系价格");
  6166. strarray.Add("定金");
  6167. strarray.Add("欠款");
  6168. strarray.Add("拍摄类型");
  6169. strarray.Add("会员卡号");
  6170. strarray.Add("定单人");
  6171. strarray.Add("入底\\入册");
  6172. strarray.Add("联系电话");
  6173. for (i = 6; i <= 17; i++)
  6174. {
  6175. StrRect = load.m_rcarray.ElementAt(i - 1);
  6176. m_Print.DrawRect2(StrRect, 1);
  6177. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 6), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6178. }
  6179. strarray.RemoveAll();
  6180. strarray.Add(m_name2);
  6181. strarray.Add(m_sex);
  6182. if (m_birthday.GetLength() != 10)
  6183. strarray.Add("");
  6184. else
  6185. {
  6186. int year = 0;
  6187. if (check1)
  6188. {
  6189. CString date2;
  6190. CovertDate2(g_date, date2);
  6191. year = atoi(date2.Left(4)) - atoi(m_birthday.Left(4));
  6192. if (date2.Right(5) >= m_birthday.Right(5))
  6193. year++;
  6194. }
  6195. else
  6196. {
  6197. year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  6198. if (g_date.Right(5) >= m_birthday.Right(5))
  6199. year++;
  6200. }
  6201. str.Format("%d", year);
  6202. strarray.Add(str);
  6203. }
  6204. strarray.Add(m_birthday);
  6205. strarray.Add(m_money1);
  6206. strarray.Add(m_money2);
  6207. strarray.Add(m_money3);
  6208. strarray.Add(m_txtype);
  6209. strarray.Add(m_memberno);
  6210. strarray.Add(m_ren);
  6211. strarray.Add(m_zs);
  6212. if (!m_phone1.IsEmpty())
  6213. strarray.Add(m_phone1);
  6214. else
  6215. strarray.Add(m_phone2);
  6216. for (i = 18; i <= 29; i++)
  6217. {
  6218. StrRect = load.m_rcarray.ElementAt(i - 1);
  6219. m_Print.DrawRect2(StrRect, 1);
  6220. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6221. }
  6222. strarray.RemoveAll();
  6223. strarray.Add("摄影师");
  6224. strarray.Add("拍照时间");
  6225. strarray.Add("选片人");
  6226. strarray.Add("选片时间");
  6227. strarray.Add("引导师");
  6228. strarray.Add("设计师");
  6229. strarray.Add("取件时间");
  6230. strarray.Add("顾客签字");
  6231. for (i = 34; i <= 41; i++)
  6232. {
  6233. StrRect = load.m_rcarray.ElementAt(i - 1);
  6234. m_Print.DrawRect2(StrRect, 1);
  6235. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 34), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6236. }
  6237. strarray.RemoveAll();
  6238. strarray.Add(m_waiter1);
  6239. strarray.Add(m_time2);
  6240. strarray.Add(m_waiter3);
  6241. strarray.Add(m_time4);
  6242. strarray.Add(m_waiter2);
  6243. strarray.Add(m_waiter4);
  6244. strarray.Add(m_time5);
  6245. strarray.Add("");
  6246. for (i = 42; i <= 49; i++)
  6247. {
  6248. StrRect = load.m_rcarray.ElementAt(i - 1);
  6249. m_Print.DrawRect2(StrRect, 1);
  6250. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6251. }
  6252. m_Print.SetFontFace(15, 1, "宋体");
  6253. StrRect = load.m_rcarray.ElementAt(29);
  6254. m_Print.DrawRect2(StrRect, 1);
  6255. StrRect.top += 45;
  6256. m_Print.DrawText((LPTSTR)(LPCTSTR)"拍", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6257. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6258. m_Print.DrawText((LPTSTR)(LPCTSTR)"内", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6259. m_Print.DrawText((LPTSTR)(LPCTSTR)"容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  6260. StrRect = load.m_rcarray.ElementAt(30);
  6261. m_Print.DrawRect2(StrRect, 1);
  6262. StrRect.top += 45;
  6263. m_Print.DrawText((LPTSTR)(LPCTSTR)"友", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6264. m_Print.DrawText((LPTSTR)(LPCTSTR)"情", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6265. m_Print.DrawText((LPTSTR)(LPCTSTR)"提", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6266. m_Print.DrawText((LPTSTR)(LPCTSTR)"示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  6267. m_Print.SetFontFace(10, 1, "宋体");
  6268. StrRect = load.m_rcarray.ElementAt(37); StrRect.top = StrRect.bottom + 2;
  6269. str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  6270. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  6271. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  6272. StrRect = load.m_rcarray.ElementAt(48); StrRect.top = StrRect.bottom + 2; StrRect.left -= 200;
  6273. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  6274. //开始画文字
  6275. StrRect = load.m_rcarray.ElementAt(31);
  6276. StrRect.left += 3;
  6277. StrRect.top += 3;
  6278. StrRect.right -= 2;
  6279. StrRect.bottom -= 2;
  6280. str = "";
  6281. for (i = 0; i < sparray.GetSize(); i++)
  6282. {
  6283. str += sparray.ElementAt(i).ElementAt(5);
  6284. str += " 数量:";
  6285. str += sparray.ElementAt(i).ElementAt(3);
  6286. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6287. str += "\r\n";
  6288. }
  6289. str.TrimRight("\r\n");
  6290. m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6291. m_bz.TrimLeft();
  6292. if (m_bz != "")
  6293. {
  6294. str += "\r\n"; str += "\r\n";
  6295. str += "备注:" + m_bz;
  6296. }
  6297. AutoDraw(m_Print, StrRect, str, 1.4);
  6298. StrRect = load.m_rcarray.ElementAt(32); m_Print.DrawRect2(StrRect, 1);
  6299. StrRect.left += 3;
  6300. StrRect.top += 3;
  6301. StrRect.right -= 2;
  6302. StrRect.bottom -= 2;
  6303. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6304. if (str.IsEmpty())
  6305. {
  6306. str = "\
  6307. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6308. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6309. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6310. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6311. 持良好的心境.\r\n\
  6312. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6313. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6314. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6315. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6316. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6317. 勿进影室, 以免影响拍摄.\r\n\
  6318. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6319. 师或店长沟通.\r\n\
  6320. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6321. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6322. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6323. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6324. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6325. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6326. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6327. 还.";
  6328. }
  6329. AutoDraw(m_Print, StrRect, str, 1.8);
  6330. }
  6331. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6332. dlg.m_pDC = m_Print.GetPDC();
  6333. dlg.m_mode = 1;
  6334. if (aa == 0)
  6335. {
  6336. if (dlg.DoModal() != IDOK)
  6337. return;
  6338. printcot = dlg.m_num;
  6339. }
  6340. //结束打印
  6341. m_Print.EndPage();
  6342. m_Print.EndPrint();
  6343. }
  6344. }
  6345. void CMainFrame::PrintDinDan4(CString m_id)
  6346. {
  6347. // TODO: Add your control notification handler code here
  6348. CPrintRX m_Print;
  6349. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6350. {
  6351. m_Print.InitToPrint(NULL, 1);
  6352. }
  6353. else
  6354. {
  6355. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  6356. if (name.IsEmpty())
  6357. m_Print.InitToPrint(NULL, 1);
  6358. else
  6359. {
  6360. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6361. if (nret == -1)
  6362. {
  6363. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6364. }
  6365. }
  6366. }
  6367. m_Print.StartPrint();
  6368. m_Print.StartPage();
  6369. LoadRect load;
  6370. load.SetLiaPath("6-2.lia");
  6371. load.SetMargins(0, 0);
  6372. if (!load.Load())return;
  6373. int i;
  6374. //////////////////////////////////////////////////////////////
  6375. CStringArray txarray;
  6376. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  6377. g_sendhead.code[0] = 11;
  6378. g_sendhead.code[1] = 52;
  6379. g_sendhead.code[2] = 50;
  6380. g_sendhead.code[3] = 150;
  6381. g_sendhead.code[4] = 77;
  6382. g_sendhead.code[5] = 4;
  6383. g_sendhead.tabcount = 6;
  6384. g_sendhead.bsql = 0;
  6385. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  6386. CArray<CStringArray, CStringArray>sparray;
  6387. CArray<CStringArray, CStringArray>clientarray;
  6388. CArray<CStringArray, CStringArray>phonearray;
  6389. CArray<CStringArray, CStringArray>fgarray;
  6390. CArray<CStringArray, CStringArray>danweiarray;
  6391. CArray<CStringArray, CStringArray>jdarray;
  6392. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  6393. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  6394. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  6395. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  6396. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  6397. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  6398. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  6399. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  6400. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  6401. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  6402. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  6403. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  6404. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  6405. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  6406. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  6407. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  6408. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  6409. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  6410. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  6411. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  6412. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  6413. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  6414. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  6415. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  6416. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  6417. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  6418. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  6419. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  6420. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  6421. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6422. if (jdarray.GetSize())
  6423. {
  6424. if (m_bz.IsEmpty() == 0)
  6425. m_bz = "\r\n" + m_bz;
  6426. m_bz += "景点:";
  6427. }
  6428. for (i = 0; i < jdarray.GetSize(); i++)
  6429. {
  6430. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  6431. }
  6432. m_bz.TrimRight(";");
  6433. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  6434. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  6435. if (IsHasRights2new(31) == 0)
  6436. {
  6437. m_phone1 = "***";
  6438. m_phone2 = "***";
  6439. }
  6440. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  6441. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  6442. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  6443. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  6444. CString str;
  6445. filter = "name='" + m_ren + "'";
  6446. g_sendhead.code[0] = 5;
  6447. g_sendhead.tabcount = 1;
  6448. g_sendhead.bsql = 0;
  6449. int g_nYearposTemp = g_nYearpos;
  6450. g_nYearpos = -1;
  6451. g_pMainWnd->ProcessChatMessageRequest2(filter);
  6452. g_nYearpos = g_nYearposTemp;
  6453. if (g_bSendOK == 0)return;
  6454. DataToArray(&phonearray);
  6455. m_money1.Format("%f", atof(m_taoxijiage));
  6456. m_money2.Format("%f", atof(m_payed1));
  6457. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  6458. ConvertToPrice(m_money1);
  6459. ConvertToPrice(m_money2);
  6460. ConvertToPrice(m_money3);
  6461. ////////////////////////////////////////////////////////////////
  6462. int rcpos = -1;
  6463. CRect StrRect = load.m_rcarray.ElementAt(0);
  6464. m_Print.SetFontFace(25, 1, "黑体");
  6465. m_Print.DrawText((LPTSTR)(LPCTSTR)"巴黎春天婚纱摄影预约单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6466. m_Print.SetFontFace(11, 1, "宋体");
  6467. StrRect = load.m_rcarray.ElementAt(1);
  6468. if (m_time1.GetLength() == 10)
  6469. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  6470. else
  6471. str = "开单日期:";
  6472. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6473. StrRect = load.m_rcarray.ElementAt(2);
  6474. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + m_id), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6475. CStringArray strarray;
  6476. strarray.Add("先生姓名");
  6477. strarray.Add("女士姓名");
  6478. strarray.Add("服装套数");
  6479. strarray.Add("拍摄张数");
  6480. strarray.Add("拍摄日期");
  6481. strarray.Add("联系电话");
  6482. strarray.Add("联系电话");
  6483. strarray.Add("造型套数");
  6484. strarray.Add("入册张数");
  6485. strarray.Add("选片日期");
  6486. strarray.Add("QQ/邮箱");
  6487. strarray.Add("套系总额");
  6488. strarray.Add("定金");
  6489. strarray.Add("余款金额");
  6490. strarray.Add("取件日期");
  6491. strarray.Add(m_name1);
  6492. strarray.Add(m_name2);
  6493. strarray.Add(m_clothescount);
  6494. str.Format("%d", atoi(m_zs) * 3);
  6495. strarray.Add(str);
  6496. strarray.Add(m_time2);
  6497. strarray.Add(m_phone1);
  6498. strarray.Add(m_phone2);
  6499. strarray.Add(m_clothescount2);
  6500. strarray.Add(m_zs);
  6501. strarray.Add(m_time4);
  6502. strarray.Add(m_qq1);
  6503. strarray.Add(m_money1);
  6504. strarray.Add(m_money2);
  6505. strarray.Add(m_money3);
  6506. strarray.Add(m_time5);
  6507. for (i = 4; i <= 33; i++)
  6508. {
  6509. StrRect = load.m_rcarray.ElementAt(i - 1);
  6510. m_Print.DrawRect2(StrRect, 1);
  6511. if (strarray.GetSize() > (i - 4))
  6512. {
  6513. if (i <= 18)
  6514. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6515. else
  6516. {
  6517. StrRect.left += 4;
  6518. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6519. }
  6520. }
  6521. }
  6522. int dt = 413;
  6523. StrRect = load.m_rcarray.ElementAt(36); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6524. m_Print.DrawText((LPTSTR)(LPCTSTR)"门市签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6525. StrRect = load.m_rcarray.ElementAt(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6526. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6527. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6528. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6529. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  6530. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址:深圳市红岭中路中深国际大厦首层,二十二层", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6531. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  6532. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:0755-61308198 61308199 25860696 25860697", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6533. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  6534. m_Print.DrawText((LPTSTR)(LPCTSTR)"网址:www.paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6535. StrRect = load.m_rcarray.ElementAt(43); StrRect.top += dt; StrRect.bottom += dt;
  6536. m_Print.DrawText((LPTSTR)(LPCTSTR)"邮箱:blct@paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6537. //////////////////////////////
  6538. //开始画文字
  6539. StrRect = load.m_rcarray.ElementAt(7);
  6540. int hei = StrRect.Height();
  6541. StrRect.top += hei;
  6542. StrRect.bottom += hei;
  6543. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6544. StrRect.top += dt;
  6545. StrRect.bottom += dt;
  6546. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6547. StrRect = load.m_rcarray.ElementAt(17);
  6548. StrRect.top += hei;
  6549. StrRect.bottom += hei;
  6550. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6551. StrRect = load.m_rcarray.ElementAt(33);
  6552. StrRect.bottom = StrRect.top + 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 = "";
  6559. for (i = 0; i < sparray.GetSize(); i++)
  6560. {
  6561. str += sparray.ElementAt(i).ElementAt(5);
  6562. str += " 数量:";
  6563. str += sparray.ElementAt(i).ElementAt(3);
  6564. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6565. str += "\r\n";
  6566. }
  6567. str.TrimRight("\r\n");
  6568. AutoDraw(m_Print, StrRect, str, 1.4);
  6569. StrRect = load.m_rcarray.ElementAt(33);
  6570. StrRect.top += dt;
  6571. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6572. StrRect.top += hei;
  6573. StrRect.left += 3;
  6574. StrRect.top += 3;
  6575. StrRect.right -= 2;
  6576. StrRect.bottom -= 2;
  6577. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  6578. StrRect = load.m_rcarray.ElementAt(34);
  6579. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6580. StrRect.top += hei;
  6581. StrRect.left += 3;
  6582. StrRect.top += 3;
  6583. StrRect.right -= 2;
  6584. StrRect.bottom -= 2;
  6585. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6586. if (str.IsEmpty())
  6587. {
  6588. str = "\
  6589. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6590. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6591. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6592. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6593. 持良好的心境.\r\n\
  6594. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6595. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6596. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6597. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6598. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6599. 勿进影室, 以免影响拍摄.\r\n\
  6600. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6601. 师或店长沟通.\r\n\
  6602. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6603. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6604. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6605. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6606. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6607. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6608. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6609. 还.";
  6610. }
  6611. AutoDraw(m_Print, StrRect, str, 1.8);
  6612. StrRect = load.m_rcarray.ElementAt(35);
  6613. StrRect.bottom += 100;
  6614. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  6615. 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∨";
  6616. AutoDraw(m_Print, StrRect, str, 1.4);
  6617. PrintPreview dlg;
  6618. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6619. dlg.m_pDC = m_Print.GetPDC();
  6620. if (dlg.DoModal() != IDOK)return;
  6621. //结束打印
  6622. m_Print.EndPage();
  6623. m_Print.EndPrint();
  6624. }
  6625. int CalHeight_01(CRect &rc, CStringArray *saContent, CPrintRX *Print, int FORMAT)
  6626. {
  6627. CSize size;
  6628. int nMaxheight = 0;
  6629. CString strTemp;
  6630. CString strContent;
  6631. int nSize = saContent->GetSize();
  6632. int nRow = 0; // 行数;
  6633. for (int i = 0; i < nSize; i++)
  6634. {
  6635. strTemp = "";
  6636. strContent = saContent->ElementAt(i);
  6637. while (FALSE == strContent.IsEmpty())
  6638. {
  6639. strContent = strContent.Mid(strTemp.GetLength());
  6640. if (strContent.IsEmpty())
  6641. break;
  6642. Print->GetStrSize((LPTSTR)(LPCTSTR)strContent, size);
  6643. if (size.cx <= rc.Width())
  6644. {
  6645. CRect rc2 = rc;
  6646. rc2.top += nRow*(size.cy + 1);
  6647. rc2.bottom = rc2.top + (size.cy + 1);
  6648. Print->DrawText((LPTSTR)(LPCTSTR)strContent, rc2, 0, 0, FORMAT | FORMAT_UP);
  6649. nMaxheight = max(nMaxheight, rc2.bottom);
  6650. nRow++;
  6651. break;
  6652. }
  6653. int right = 0;
  6654. while (size.cx > rc.Width())
  6655. {
  6656. right++;
  6657. strTemp = strContent.Left(strContent.GetLength() - (right));
  6658. if (GIsHalfHZ(strTemp))
  6659. {
  6660. right++;
  6661. strTemp.Delete(strTemp.GetLength() - 1);
  6662. }
  6663. Print->GetStrSize((LPTSTR)(LPCTSTR)strTemp, size);
  6664. }
  6665. CRect rc2 = rc;
  6666. rc2.top += nRow*(size.cy + 1);
  6667. rc2.bottom = rc2.top + (size.cy + 1);
  6668. Print->DrawText((LPTSTR)(LPCTSTR)strTemp, rc2, 0, 0, FORMAT | FORMAT_UP); //printf("Jeff:str=%s\n\n",str);// Jeff Printf;
  6669. nRow++;
  6670. nMaxheight = max(nMaxheight, rc2.bottom);
  6671. }
  6672. }
  6673. return (nMaxheight == 0) ? (rc.bottom + 1) : (nMaxheight + 1);
  6674. }
  6675. /************************************************************************/
  6676. /*
  6677. 多字节字符编码下的CaleHeight函数;
  6678. 函数:CaleHeight
  6679. 描述:计算出一行高度可变,宽度特定的表格(CArray<CRect,CRect>),在输入指定内容时(CStringArray),表格高度变化最大的值。
  6680. 参数:
  6681. aRowRect: 一行表格,CArray::GetSize()表示表格列数;
  6682. aRowStr: 与表格对应的一行字符,CStringArray::GetSize()大小与CArray::GetSize()一致。
  6683. pPrinter: 打印机实例指针;
  6684. nFormat: 字符串的显示格式。
  6685. 返回:返回最大的表格高度;
  6686. 注意:只能多字节下使用,因为函数GIsHalfHZ。
  6687. */
  6688. /************************************************************************/
  6689. INT CalcHeight( IN CArray<CRect, CRect> &aRowRect, IN CStringArray &aRowStr, IN CPrintRX *pPrinter, IN CONST INT& nFormat)
  6690. {
  6691. // 参数有效性;
  6692. if( aRowRect.GetSize() != aRowStr.GetSize() )
  6693. {
  6694. OutputDebugString(_T("表格列数与字符列数不等!\n"));
  6695. return -1;
  6696. }
  6697. if( pPrinter == NULL )
  6698. {
  6699. OutputDebugString(_T("打印机句柄指针无效\n"));
  6700. return -1;
  6701. }
  6702. // 表格字串长度;
  6703. CSize size;
  6704. // 当前表格字体高度;
  6705. INT nGridFontHeight = 0;
  6706. // 当前表格区域;
  6707. CRect curGrid;
  6708. // 当前表格字符串;
  6709. CString strGridContent;
  6710. // 最大值高底;
  6711. INT nMaxHeigth = 0;
  6712. // 当前换行数;
  6713. INT nWrapRows = 0;
  6714. // 当前换行字串;
  6715. CString strWrapRow = _T("");
  6716. // 表格列数;
  6717. INT nColumns = aRowRect.GetSize();
  6718. // 临时表格;
  6719. CRect rcGrid;
  6720. // 循环计算每个表格的高度;
  6721. for( INT i = 0; i < nColumns; i++ )
  6722. {
  6723. nWrapRows = 0;
  6724. strWrapRow.Empty();
  6725. curGrid = aRowRect.ElementAt(i);
  6726. strGridContent = aRowStr.ElementAt(i);
  6727. nMaxHeigth = max(nMaxHeigth, curGrid.bottom);
  6728. while( !strGridContent.IsEmpty() )
  6729. {
  6730. strGridContent = strGridContent.Right(strGridContent.GetLength() - strWrapRow.GetLength());
  6731. if ( strGridContent.IsEmpty() )
  6732. {
  6733. OutputDebugString(_T("表格字符已空\n"));
  6734. break;
  6735. }
  6736. pPrinter->GetStrSize((LPTSTR)(LPCTSTR)strGridContent, size);
  6737. nGridFontHeight = size.cy + 1;
  6738. // 字串长度 <= 表格宽度;
  6739. if( size.cx <= curGrid.Width() )
  6740. {
  6741. rcGrid = curGrid;
  6742. rcGrid.top += nWrapRows*nGridFontHeight;
  6743. rcGrid.bottom = rcGrid.top + nGridFontHeight;
  6744. nMaxHeigth = max(nMaxHeigth, rcGrid.bottom);
  6745. pPrinter->DrawText((LPTSTR)(LPCTSTR)strGridContent, rcGrid, 0, 0, nFormat|FORMAT_UP);
  6746. break;
  6747. }
  6748. else
  6749. {// 字串长度 >= 表格宽度;
  6750. INT nRight = 0; // 字串右位置;
  6751. // 从右边开始逐个字符取出,直到左边字串小于表格宽度;
  6752. while( size.cx > curGrid.Width() )
  6753. {
  6754. nRight++;
  6755. strWrapRow = strGridContent.Left(strGridContent.GetLength() - nRight);
  6756. if( GIsHalfHZ(strWrapRow) )
  6757. {// 判断字串最后一个字符是否是汉字;
  6758. nRight++;
  6759. strWrapRow.Delete(strWrapRow.GetLength() - 1);
  6760. }
  6761. pPrinter->GetStrSize((LPTSTR)(LPCTSTR)strWrapRow, size);
  6762. }
  6763. rcGrid = curGrid;
  6764. rcGrid.top += nWrapRows*nGridFontHeight;
  6765. rcGrid.bottom = rcGrid.top + nGridFontHeight;
  6766. nMaxHeigth = max(nMaxHeigth, rcGrid.bottom);
  6767. pPrinter->DrawText((LPTSTR)(LPCTSTR)strWrapRow, rcGrid, 0, 0, nFormat|FORMAT_UP);
  6768. // 换行加+1;
  6769. nWrapRows++;
  6770. }
  6771. }
  6772. }
  6773. return nMaxHeigth + 1;
  6774. }
  6775. void CMainFrame::PrintReceipt(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  6776. {
  6777. //AfxMessageBox("abce");
  6778. int i = 0;
  6779. int printcot = 1;
  6780. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  6781. {
  6782. g_sendhead.bsql = 0;
  6783. g_sendhead.code[0] = 24;
  6784. g_sendhead.tabcount = 1;
  6785. int g_nYearposTemp = g_nYearpos;
  6786. g_nYearpos = -1;
  6787. g_pMainWnd->ProcessChatMessageRequest2(1);
  6788. g_nYearpos = g_nYearposTemp;
  6789. if (0 == g_bSendOK)return;
  6790. DataToArray(&g_cominfoarray);
  6791. CString SerialNo;
  6792. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6793. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  6794. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6795. CString sql;
  6796. sql.Format("update version set [serialno]='%s'", SerialNo);
  6797. g_sendhead.bsql=1;
  6798. g_nYearposTemp=g_nYearpos;
  6799. g_nYearpos=-1;
  6800. g_pMainWnd->ProcessChatMessageRequest2(sql);
  6801. g_nYearpos=g_nYearposTemp;
  6802. #endif
  6803. // 1.创建打印对象
  6804. CPrintRX m_Print;
  6805. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6806. {
  6807. m_Print.InitToPrint(NULL, 1);
  6808. }
  6809. else
  6810. {
  6811. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  6812. if (name.IsEmpty())
  6813. m_Print.InitToPrint(NULL, 1);
  6814. else
  6815. {
  6816. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6817. if (nret == -1 && aa == 0)
  6818. {
  6819. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6820. }
  6821. }
  6822. }
  6823. // 2.开始打印
  6824. m_Print.StartPrint();
  6825. m_Print.StartPage();
  6826. LoadRect load;
  6827. BOOL bSmall = 0;
  6828. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  6829. {
  6830. bSmall = 1;
  6831. load.SetLiaPath("20.lia");
  6832. }
  6833. else
  6834. load.SetLiaPath("10.lia");
  6835. if (bSmall)
  6836. load.SetMargins(0, 0);
  6837. else
  6838. load.SetMargins(10, 0);
  6839. if (!load.Load())return;
  6840. int rcpos = -1;
  6841. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6842. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  6843. {
  6844. Image *pImg = NULL;
  6845. g_nSendCode = 31;
  6846. int g_nYearposTemp = g_nYearpos;
  6847. g_nYearpos = -1;
  6848. g_pMainWnd->ProcessChatMessageRequest2(1);
  6849. g_nYearpos = g_nYearposTemp;
  6850. g_nSendCode = 0;
  6851. if (g_bSendOK == 0)return;
  6852. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  6853. if (pImg)
  6854. {
  6855. StrRect.left = 65;
  6856. if (bSmall) StrRect.left = 55;
  6857. StrRect.top = 10;
  6858. StrRect.right = StrRect.left + 58;
  6859. StrRect.bottom = StrRect.top + 58;
  6860. // 3.打印2维码图像;
  6861. m_Print.DrawImage(pImg, StrRect);
  6862. delete pImg;
  6863. pImg = NULL;
  6864. }
  6865. }
  6866. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  6867. if (bSmall)
  6868. {
  6869. m_Print.SetFontFace(18, 1, "黑体");
  6870. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6871. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6872. m_Print.SetFontFace(9, 1, "宋体");
  6873. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6874. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6875. m_Print.SetFontFace(6, 1, "宋体");
  6876. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6877. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6878. m_Print.SetFontFace(9, 1, "宋体");
  6879. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6880. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6881. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6882. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6883. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6884. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6885. int hei = StrRect.Height();
  6886. StrRect.bottom = StrRect.top;
  6887. StrRect.top -= 8;
  6888. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6889. m_Print.SetFontFace(11, 1, "宋体");
  6890. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6891. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6892. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6893. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6894. m_Print.SetFontFace(8, 1, "宋体");
  6895. for (i = 7; i < 24; i++)
  6896. {
  6897. StrRect = load.m_rcarray.ElementAt(i);
  6898. m_Print.DrawRect2(StrRect, 1);
  6899. }
  6900. for (i = 9; i < 24; i++)
  6901. {
  6902. StrRect = load.m_rcarray.ElementAt(i);
  6903. StrRect.left += 2;
  6904. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6905. }
  6906. m_Print.SetFontFace(6, 1, "宋体");
  6907. for (i = 24; i < 26; i++)
  6908. {
  6909. StrRect = load.m_rcarray.ElementAt(i);
  6910. StrRect.left += 2;
  6911. if (i == 24)
  6912. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6913. else
  6914. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6915. }
  6916. // StrRect=load.m_rcarray .ElementAt (27);
  6917. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  6918. }
  6919. else//大单
  6920. {
  6921. // 1.打印表头(蒙娜丽莎收款单)
  6922. m_Print.SetFontFace(20, 1, "黑体");
  6923. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6924. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6925. m_Print.SetFontFace(11, 1, "宋体");
  6926. // 2.打印订单号(NO.20140608-001)
  6927. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6928. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6929. // 3.打印SerialNo(SerialNo.01062)
  6930. int hei = StrRect.Height();
  6931. StrRect.bottom = StrRect.top;
  6932. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6933. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6934. // 4.打印影楼地址信息、电话;
  6935. m_Print.SetFontFace(8, 1, "宋体");
  6936. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6937. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6938. m_Print.SetFontFace(11, 1, "宋体");
  6939. // 5.打印客户姓名
  6940. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6941. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6942. // 6.打印客户联系电话
  6943. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6944. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6945. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6946. // 7.打印开单日期
  6947. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6948. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6949. // 8.打印列字段:收款项目
  6950. m_Print.SetFontFace(13, 1, "宋体");
  6951. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6952. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6953. //printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6954. // 9.打印列字段:金额
  6955. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6956. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6957. //printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6958. // 10.打印列字段:开单人
  6959. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6960. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6961. //printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6962. // 11.画表格-画3列;
  6963. m_Print.SetFontFace(11, 1, "宋体");
  6964. for (i = 7; i < 10; i++)
  6965. {
  6966. StrRect = load.m_rcarray.ElementAt(i);
  6967. m_Print.DrawRect2(StrRect, 1);
  6968. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6969. }
  6970. // 12.打印详细内容
  6971. int dty = 0;
  6972. int dtytemp = 0;
  6973. // for( i=10; i<14; i+=3)
  6974. for (i = 10; i<22; i += 3) // 循环4次,再画
  6975. {
  6976. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  6977. CArray<CRect, CRect>rcarray;
  6978. CStringArray strarray2;
  6979. StrRect = load.m_rcarray.ElementAt(i);
  6980. StrRect.top += dty;
  6981. StrRect.bottom += dty;
  6982. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  6983. {
  6984. StrRect = load.m_rcarray.ElementAt(i - 1);
  6985. StrRect.top += dty;
  6986. StrRect.bottom += dty;
  6987. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  6988. break;
  6989. }
  6990. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  6991. StrRect.left += 2;
  6992. StrRect.right -= 2;
  6993. StrRect.top += 4;
  6994. rcarray.Add(StrRect);
  6995. strarray2.Add(pArray->ElementAt(i));
  6996. // 指定格子宽度,计算字符串占几行(高度).
  6997. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  6998. dtytemp = bottom - StrRect.bottom;
  6999. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7000. // 重新获取表格大小,并画出表格;
  7001. StrRect = load.m_rcarray.ElementAt(i);
  7002. StrRect.bottom += dtytemp;
  7003. StrRect.top += dty;
  7004. StrRect.bottom += dty;
  7005. m_Print.DrawRect2(StrRect, 1);
  7006. // 获取下一表格大小,并画出表格;
  7007. StrRect = load.m_rcarray.ElementAt(i + 1);
  7008. StrRect.top += dty;
  7009. StrRect.bottom += dty;
  7010. StrRect.bottom += dtytemp;
  7011. m_Print.DrawRect2(StrRect, 1);
  7012. StrRect.left += 2;
  7013. // 打印出金额字段内容
  7014. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7015. //printf("Jeff:%d:%s\n\n",i+1,pArray->ElementAt(i+1));//Jeff Printf;
  7016. StrRect = load.m_rcarray.ElementAt(i + 2);
  7017. StrRect.top += dty;
  7018. StrRect.bottom += dty;
  7019. StrRect.bottom += dtytemp;
  7020. m_Print.DrawRect2(StrRect, 1);
  7021. StrRect.left += 2;
  7022. // 打印开单人字段内容
  7023. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7024. //printf("Jeff:%d:%s\n\n",i+2,pArray->ElementAt(i+2));//Jeff Printf;
  7025. dty += dtytemp;
  7026. }
  7027. //.打印->付款情况 应付 实付 欠款.
  7028. i = 22;
  7029. StrRect = load.m_rcarray.ElementAt(i);
  7030. StrRect.top += dty;
  7031. StrRect.bottom += dty;
  7032. m_Print.DrawRect2(StrRect, 1);
  7033. StrRect.left += 2;
  7034. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7035. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7036. //.打印->合计人民币(大写):.......
  7037. i = 23;
  7038. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  7039. m_Print.DrawRect2(StrRect, 1);
  7040. StrRect.left += 2;
  7041. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7042. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7043. m_Print.SetFontFace(7, 1, "宋体");
  7044. for (i = 24; i < 27; i++)
  7045. {
  7046. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  7047. StrRect.left += 2;
  7048. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7049. }
  7050. StrRect = load.m_rcarray.ElementAt(24); StrRect.top += dty; StrRect.bottom += dty;
  7051. hei = StrRect.Height();
  7052. StrRect.top += hei;
  7053. StrRect.bottom += hei;
  7054. StrRect.right += 100;
  7055. StrRect.left += 2;
  7056. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  7057. AutoDraw(m_Print, StrRect, pArray->ElementAt(27), 1.0);
  7058. }
  7059. PrintPreview dlg;
  7060. dlg.m_mode = 3;
  7061. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  7062. dlg.m_pDC = m_Print.GetPDC();
  7063. if (aa == 0)
  7064. {
  7065. if (dlg.DoModal() != IDOK)
  7066. return;
  7067. printcot = dlg.m_num;
  7068. }
  7069. //结束打印
  7070. m_Print.EndPage();
  7071. m_Print.EndPrint();
  7072. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7073. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7074. CString sql;
  7075. sql.Format("update version set [serialno]='%s'", SerialNo);
  7076. g_sendhead.bsql = 1;
  7077. g_nYearposTemp = g_nYearpos;
  7078. g_nYearpos = -1;
  7079. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7080. g_nYearpos = g_nYearposTemp;
  7081. #endif
  7082. }
  7083. }
  7084. /************************************************************************/
  7085. /*
  7086. 函数:PrintRechargeRecord
  7087. 描述:打印会员卡充值记录;
  7088. 参数:
  7089. pArryRechargeRecod[IN]:要打印的数据;
  7090. 返回:
  7091. 注意:
  7092. 示例:
  7093. */
  7094. /************************************************************************/
  7095. void CMainFrame::PrintRechargeRecord(CStringArray *pArryRechargeRecod)
  7096. {
  7097. }
  7098. void CMainFrame::PrintReceipt_01(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  7099. {
  7100. //AfxMessageBox("abce");
  7101. int i = 0;
  7102. int printcot = 1;
  7103. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  7104. {
  7105. g_sendhead.bsql = 0;
  7106. g_sendhead.code[0] = 24;
  7107. g_sendhead.tabcount = 1;
  7108. int g_nYearposTemp = g_nYearpos;
  7109. g_nYearpos = -1;
  7110. g_pMainWnd->ProcessChatMessageRequest2(1);
  7111. g_nYearpos = g_nYearposTemp;
  7112. if (0 == g_bSendOK)return;
  7113. DataToArray(&g_cominfoarray);
  7114. CString SerialNo;
  7115. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7116. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7117. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7118. CString sql;
  7119. sql.Format("update version set [serialno]='%s'", SerialNo);
  7120. g_sendhead.bsql=1;
  7121. g_nYearposTemp=g_nYearpos;
  7122. g_nYearpos=-1;
  7123. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7124. g_nYearpos=g_nYearposTemp;
  7125. #endif
  7126. // 1.创建打印对象
  7127. CPrintRX m_Print;
  7128. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7129. {
  7130. m_Print.InitToPrint(NULL, 1);
  7131. }
  7132. else
  7133. {
  7134. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  7135. if (name.IsEmpty())
  7136. m_Print.InitToPrint(NULL, 1);
  7137. else
  7138. {
  7139. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  7140. if (nret == -1 && aa == 0)
  7141. {
  7142. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  7143. m_Print.InitToPrint(NULL, 1);
  7144. }
  7145. }
  7146. }
  7147. // 2.开始打印
  7148. m_Print.StartPrint();
  7149. m_Print.StartPage();
  7150. LoadRect load;
  7151. BOOL bSmall = 0;
  7152. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  7153. {
  7154. bSmall = 1;
  7155. load.SetLiaPath("20.lia");
  7156. }
  7157. else
  7158. load.SetLiaPath("10.lia");
  7159. if (bSmall)
  7160. load.SetMargins(0, 0);
  7161. else
  7162. load.SetMargins(10, 0);
  7163. if (!load.Load())return;
  7164. int rcpos = -1;
  7165. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7166. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  7167. {
  7168. Image *pImg = NULL;
  7169. g_nSendCode = 31;
  7170. int g_nYearposTemp = g_nYearpos;
  7171. g_nYearpos = -1;
  7172. g_pMainWnd->ProcessChatMessageRequest2(1);
  7173. g_nYearpos = g_nYearposTemp;
  7174. g_nSendCode = 0;
  7175. if (g_bSendOK == 0)return;
  7176. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7177. if (pImg)
  7178. {
  7179. StrRect.left = 65;
  7180. if (bSmall) StrRect.left = 55;
  7181. StrRect.top = 10;
  7182. StrRect.right = StrRect.left + 58;
  7183. StrRect.bottom = StrRect.top + 58;
  7184. // 3.打印2维码图像;
  7185. m_Print.DrawImage(pImg, StrRect);
  7186. delete pImg;
  7187. pImg = NULL;
  7188. }
  7189. }
  7190. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  7191. if (bSmall)
  7192. {
  7193. m_Print.SetFontFace(18, 1, "黑体");
  7194. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7195. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7196. m_Print.SetFontFace(9, 1, "宋体");
  7197. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7198. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7199. m_Print.SetFontFace(6, 1, "宋体");
  7200. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7201. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7202. m_Print.SetFontFace(9, 1, "宋体");
  7203. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7204. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7205. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7206. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7207. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7208. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7209. int hei = StrRect.Height();
  7210. StrRect.bottom = StrRect.top;
  7211. StrRect.top -= 8;
  7212. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7213. m_Print.SetFontFace(11, 1, "宋体");
  7214. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7215. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7216. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7217. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7218. m_Print.SetFontFace(8, 1, "宋体");
  7219. for ( i = 7; i < 24; i++)
  7220. {
  7221. StrRect = load.m_rcarray.ElementAt(i);
  7222. m_Print.DrawRect2(StrRect, 1);
  7223. }
  7224. for (i = 9; i < 24; i++)
  7225. {
  7226. StrRect = load.m_rcarray.ElementAt(i);
  7227. StrRect.left += 2;
  7228. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7229. }
  7230. m_Print.SetFontFace(6, 1, "宋体");
  7231. for (i = 24; i < 26; i++)
  7232. {
  7233. StrRect = load.m_rcarray.ElementAt(i);
  7234. StrRect.left += 2;
  7235. if (i == 24)
  7236. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7237. else
  7238. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7239. }
  7240. // StrRect=load.m_rcarray .ElementAt (27);
  7241. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  7242. }
  7243. else//大单
  7244. {
  7245. // 1.打印表头(蒙娜丽莎收款单)
  7246. m_Print.SetFontFace(20, 1, "黑体");
  7247. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7248. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7249. m_Print.SetFontFace(11, 1, "宋体");
  7250. // 2.打印订单号(NO.20140608-001)
  7251. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7252. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7253. // 3.打印SerialNo(SerialNo.01062)
  7254. int hei = StrRect.Height();
  7255. StrRect.bottom = StrRect.top;
  7256. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7257. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7258. // 4.打印影楼地址信息、电话;
  7259. m_Print.SetFontFace(8, 1, "宋体");
  7260. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7261. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7262. m_Print.SetFontFace(11, 1, "宋体");
  7263. // 5.打印客户姓名
  7264. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7265. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7266. // 6.打印客户联系电话
  7267. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7268. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7269. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7270. // 7.打印开单日期
  7271. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7272. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7273. #if 0 // Original Edition
  7274. // 8.打印列字段:收款项目
  7275. m_Print.SetFontFace(13, 1, "宋体");
  7276. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7277. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7278. printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7279. // 9.打印列字段:金额
  7280. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7281. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7282. printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7283. // 10.打印列字段:开单人
  7284. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7285. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7286. printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7287. #else
  7288. // 8.打印列字段:收款项目
  7289. m_Print.SetFontFace(13, 1, "宋体");
  7290. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7291. StrRect = CRect(66, 85, 280, 105);
  7292. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7293. //m_Print.DrawText("收款项目",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7294. // 8.1 Jeff add:支付方式
  7295. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7296. StrRect = CRect(280, 85, 350, 105);
  7297. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7298. //m_Print.DrawText("支付方式",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7299. // 9.打印列字段:金额
  7300. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7301. StrRect = CRect(350, 85, 442, 105);
  7302. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7303. //m_Print.DrawText("金额",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7304. // 10.打印列字段:开单人
  7305. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7306. StrRect = CRect(442, 85, 535, 105);
  7307. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7308. //m_Print.DrawText("开单人",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7309. //rcpos += 3;
  7310. #endif
  7311. // 11.画表格-画3列;old
  7312. // 11.draw 4 column
  7313. m_Print.SetFontFace(11, 1, "宋体");
  7314. //for( i=7; i<10; i++)
  7315. //{
  7316. // StrRect=load.m_rcarray.ElementAt(i);
  7317. // m_Print.DrawRect2(StrRect, 1);
  7318. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7319. //}
  7320. m_Print.DrawRect2(CRect(66, 85, 280, 105), 1);
  7321. m_Print.DrawRect2(CRect(280, 85, 350, 105), 1);
  7322. m_Print.DrawRect2(CRect(350, 85, 442, 105), 1);
  7323. m_Print.DrawRect2(CRect(442, 85, 535, 105), 1);
  7324. // 12.打印详细内容
  7325. int dty = 0;
  7326. int dtytemp = 0;
  7327. // for( i=10; i<14; i+=3)
  7328. //for( i=10; i<22; i+=3) // 循环4次,再画
  7329. int j = 0;
  7330. for (i = 10, j = 11; i<22; i += 3, j += 4) // 循环4次,再画
  7331. {
  7332. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  7333. CArray<CRect, CRect>rcarray;
  7334. CStringArray strarray2;
  7335. StrRect = load.m_rcarray.ElementAt(i);
  7336. StrRect.top += dty;
  7337. StrRect.bottom += dty;
  7338. StrRect.right -= 70; // Jeff add
  7339. //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;
  7340. /*
  7341. 4次的CRect
  7342. 66,105,350,125
  7343. 66,126,350,146
  7344. 66,147,350,167
  7345. 66,168,350,188
  7346. */
  7347. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  7348. {
  7349. StrRect = load.m_rcarray.ElementAt(i - 1);
  7350. StrRect.top += dty;
  7351. StrRect.bottom += dty;
  7352. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  7353. break;
  7354. }
  7355. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  7356. StrRect.left += 2;
  7357. StrRect.right -= 2;
  7358. StrRect.top += 4;
  7359. rcarray.Add(StrRect);
  7360. //strarray2.Add(pArray->ElementAt(i+1));
  7361. strarray2.Add(pArray->ElementAt(j));
  7362. //printf("Jeff:%d:%s\n\n",j,pArray->ElementAt(j));//Jeff Printf;
  7363. // 指定格子宽度,计算字符串占几行(高度).
  7364. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  7365. dtytemp = bottom - StrRect.bottom;
  7366. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7367. // 重新获取表格大小,并画出表格;
  7368. /*
  7369. CRect(66,85,280,105),
  7370. CRect(280,85,350,105)
  7371. CRect(350,85,442,105)
  7372. CRect(442,85,535,105)
  7373. CRect(66,105,350,125),
  7374. CRect(66,126,350,146)
  7375. CRect(66,147,350,167)
  7376. CRect(66,168,350,188)
  7377. */
  7378. // 画收款项目框及打印内容;
  7379. StrRect = load.m_rcarray.ElementAt(i);
  7380. //StrRect=CRect(66,85,280,105);
  7381. StrRect.bottom += dtytemp;
  7382. StrRect.top += dty;
  7383. StrRect.bottom += dty;
  7384. //StrRect.left -= 70; // Jeff add
  7385. StrRect.right -= 70; // Jeff add
  7386. //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;
  7387. m_Print.DrawRect2(StrRect, 1);
  7388. // 画支付方式框及打印内容;
  7389. StrRect = load.m_rcarray.ElementAt(i);
  7390. //StrRect=CRect(280,85,350,105);
  7391. StrRect.bottom += dtytemp;
  7392. StrRect.top += dty;
  7393. StrRect.bottom += dty;
  7394. StrRect.left += StrRect.Width() - 70;
  7395. //StrRect.right += 70; // Jeff add
  7396. //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;
  7397. m_Print.DrawRect2(StrRect, 1);
  7398. StrRect.left += 2;
  7399. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7400. //printf("Jeff:%d:%s\n\n",j+1,pArray->ElementAt(j+1));//Jeff Printf;
  7401. // 画金额框及打印内容;
  7402. StrRect = load.m_rcarray.ElementAt(i + 1);
  7403. //StrRect=CRect(350,85,442,105);
  7404. StrRect.top += dty;
  7405. StrRect.bottom += dty;
  7406. StrRect.bottom += dtytemp;
  7407. //StrRect.right -= 70; // Jeff add
  7408. //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;
  7409. m_Print.DrawRect2(StrRect, 1);
  7410. StrRect.left += 2;
  7411. // 打印出金额字段内容
  7412. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7413. //printf("Jeff:%d:%s\n\n",j+2,pArray->ElementAt(j+2));//Jeff Printf;
  7414. // 画开单人框及打印内容;
  7415. StrRect = load.m_rcarray.ElementAt(i + 2);
  7416. //StrRect=CRect(442,85,535,105);
  7417. StrRect.top += dty;
  7418. StrRect.bottom += dty;
  7419. StrRect.bottom += dtytemp;
  7420. //StrRect.right -= 70; // Jeff add
  7421. //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;
  7422. m_Print.DrawRect2(StrRect, 1);
  7423. StrRect.left += 2;
  7424. // 打印开单人字段内容
  7425. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 3), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7426. //printf("Jeff:%d:%s\n\n",j+3,pArray->ElementAt(j+3));//Jeff Printf;
  7427. dty += dtytemp;
  7428. }
  7429. //.打印->付款情况 应付 实付 欠款.
  7430. i = 22;
  7431. j = 27;
  7432. StrRect = load.m_rcarray.ElementAt(i);
  7433. StrRect.top += dty;
  7434. StrRect.bottom += dty;
  7435. m_Print.DrawRect2(StrRect, 1);
  7436. StrRect.left += 2;
  7437. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7438. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7439. //.打印->合计人民币(大写):.......
  7440. i = 23;
  7441. j = 28;
  7442. StrRect = load.m_rcarray.ElementAt(i);
  7443. StrRect.top += dty;
  7444. StrRect.bottom += dty;
  7445. m_Print.DrawRect2(StrRect, 1);
  7446. StrRect.left += 2;
  7447. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7448. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7449. // 打印总金额;
  7450. m_Print.SetFontFace(7, 1, "宋体");
  7451. for (i = 24, j = 29; i < 27; i++, j++)
  7452. {
  7453. StrRect = load.m_rcarray.ElementAt(i);
  7454. StrRect.top += dty;
  7455. StrRect.bottom += dty;
  7456. StrRect.left += 2;
  7457. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7458. }
  7459. StrRect = load.m_rcarray.ElementAt(24);
  7460. StrRect.top += dty;
  7461. StrRect.bottom += dty;
  7462. hei = StrRect.Height();
  7463. StrRect.top += hei;
  7464. StrRect.bottom += hei;
  7465. StrRect.right += 100;
  7466. StrRect.left += 2;
  7467. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  7468. AutoDraw(m_Print, StrRect, pArray->ElementAt(32), 1.0);
  7469. }
  7470. PrintPreview dlg;
  7471. dlg.m_mode = 3;
  7472. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  7473. dlg.m_pDC = m_Print.GetPDC();
  7474. if (aa == 0)
  7475. {
  7476. if (dlg.DoModal() != IDOK)
  7477. {
  7478. return;
  7479. }
  7480. printcot = dlg.m_num;
  7481. }
  7482. //结束打印
  7483. m_Print.EndPage();
  7484. m_Print.EndPrint();
  7485. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7486. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7487. CString sql;
  7488. sql.Format("update version set [serialno]='%s'", SerialNo);
  7489. g_sendhead.bsql = 1;
  7490. g_nYearposTemp = g_nYearpos;
  7491. g_nYearpos = -1;
  7492. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7493. g_nYearpos = g_nYearposTemp;
  7494. #endif
  7495. }
  7496. }
  7497. void CMainFrame::PrintReceipt_02(CStringArray *pArray, CPrintRX *pPrinter, const int &nCount, const BOOL bPrintImmediately) // 打印订单*预约收款、预约补款*
  7498. {
  7499. //AfxMessageBox("abce");
  7500. int printcot = 1;
  7501. // for(int aa=0; aa<printcot; aa++) // Jeff, printcot=1....
  7502. // {
  7503. g_sendhead.bsql = 0;
  7504. g_sendhead.code[0] = 24;
  7505. g_sendhead.tabcount = 1;
  7506. int g_nYearposTemp = g_nYearpos;
  7507. g_nYearpos = -1;
  7508. g_pMainWnd->ProcessChatMessageRequest2(1);
  7509. g_nYearpos = g_nYearposTemp;
  7510. if (0 == g_bSendOK)return;
  7511. DataToArray(&g_cominfoarray);
  7512. CString SerialNo;
  7513. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7514. CPrintRX *tagPrinter = NULL;
  7515. if (pPrinter == NULL)
  7516. {
  7517. // 1.创建打印对象
  7518. tagPrinter = new CPrintRX;
  7519. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7520. {
  7521. tagPrinter->InitToPrint(NULL, 1);
  7522. }
  7523. else
  7524. {
  7525. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  7526. if (name.IsEmpty())
  7527. {
  7528. tagPrinter->InitToPrint(NULL, 1);
  7529. }
  7530. else
  7531. {
  7532. int nret = tagPrinter->InitToPrint((char*)(LPCTSTR)name, 1);
  7533. ///if(nret==-1 && aa==0)
  7534. if (nret == -1)
  7535. {
  7536. if (bPrintImmediately == FALSE)
  7537. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  7538. tagPrinter->InitToPrint(NULL, 1);
  7539. }
  7540. }
  7541. }
  7542. // 2.开始打印
  7543. tagPrinter->StartPrint();
  7544. tagPrinter->StartPage();
  7545. }
  7546. else
  7547. {
  7548. //SerialNo.Format ("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126))+1);
  7549. tagPrinter = pPrinter;
  7550. }
  7551. LoadRect load;
  7552. BOOL bSmall = 0;
  7553. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  7554. {
  7555. bSmall = 1;
  7556. load.SetLiaPath("20.lia");
  7557. }
  7558. else
  7559. load.SetLiaPath("10.lia");
  7560. if (bSmall)
  7561. load.SetMargins(0, 0);
  7562. else
  7563. load.SetMargins(10, 0);
  7564. if (!load.Load())return;
  7565. int rcpos = -1;
  7566. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7567. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  7568. {
  7569. Image *pImg = NULL;
  7570. g_nSendCode = 31;
  7571. int g_nYearposTemp = g_nYearpos;
  7572. g_nYearpos = -1;
  7573. g_pMainWnd->ProcessChatMessageRequest2(1);
  7574. g_nYearpos = g_nYearposTemp;
  7575. g_nSendCode = 0;
  7576. if (g_bSendOK == 0)return;
  7577. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7578. if (pImg)
  7579. {
  7580. StrRect.left = 65;
  7581. if (bSmall) StrRect.left = 55;
  7582. StrRect.top = 10;
  7583. StrRect.right = StrRect.left + 58;
  7584. StrRect.bottom = StrRect.top + 58;
  7585. // 3.打印2维码图像;
  7586. tagPrinter->DrawImage(pImg, StrRect);
  7587. delete pImg;
  7588. pImg = NULL;
  7589. }
  7590. }
  7591. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  7592. if (bSmall)
  7593. {
  7594. tagPrinter->SetFontFace(18, 1, "黑体");
  7595. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7596. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7597. tagPrinter->SetFontFace(9, 1, "宋体");
  7598. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7599. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7600. tagPrinter->SetFontFace(6, 1, "宋体");
  7601. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7602. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7603. tagPrinter->SetFontFace(9, 1, "宋体");
  7604. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7605. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7606. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7607. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7608. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7609. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7610. int hei = StrRect.Height();
  7611. StrRect.bottom = StrRect.top;
  7612. StrRect.top -= 8;
  7613. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7614. tagPrinter->SetFontFace(11, 1, "宋体");
  7615. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7616. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7617. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7618. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7619. tagPrinter->SetFontFace(8, 1, "宋体");
  7620. int i = 0;
  7621. for (i = 7; i < 24; i++)
  7622. {
  7623. StrRect = load.m_rcarray.ElementAt(i);
  7624. tagPrinter->DrawRect2(StrRect, 1);
  7625. }
  7626. for (i = 9; i < 24; i++)
  7627. {
  7628. StrRect = load.m_rcarray.ElementAt(i);
  7629. StrRect.left += 2;
  7630. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7631. }
  7632. tagPrinter->SetFontFace(6, 1, "宋体");
  7633. for (i = 24; i < 26; i++)
  7634. {
  7635. StrRect = load.m_rcarray.ElementAt(i);
  7636. StrRect.left += 2;
  7637. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7638. }
  7639. StrRect = load.m_rcarray.ElementAt(22);
  7640. int nH = StrRect.Height();
  7641. int nW = StrRect.Width();
  7642. int nlen = load.m_rcarray.GetSize();
  7643. int nLeft = StrRect.left;
  7644. int j = 0;
  7645. for (i = 27; i<32; i++)
  7646. {
  7647. CRect rct = StrRect;
  7648. if(i == 31)
  7649. {
  7650. rct.top = rct.top + (nH*(j - 1));
  7651. rct.bottom = rct.top + nH;
  7652. rct.left = rct.left + 200;
  7653. rct.right = rct.left + 200;
  7654. }
  7655. else
  7656. {
  7657. rct.top = rct.top + (nH*j);
  7658. rct.bottom = rct.top + nH;
  7659. rct.left = rct.left + 2;
  7660. rct.right = rct.left + 200;
  7661. }
  7662. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), rct, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7663. j++;
  7664. }
  7665. }
  7666. else//大单
  7667. {
  7668. // 1.打印表头(蒙娜丽莎收款单)
  7669. tagPrinter->SetFontFace(20, 1, "黑体");
  7670. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7671. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7672. tagPrinter->SetFontFace(11, 1, "宋体");
  7673. // 2.打印订单号(NO.20140608-001)
  7674. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7675. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7676. // 3.打印SerialNo(SerialNo.01062)
  7677. int hei = StrRect.Height();
  7678. StrRect.bottom = StrRect.top;
  7679. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7680. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7681. // 4.打印影楼地址信息、电话;
  7682. tagPrinter->SetFontFace(8, 1, "宋体");
  7683. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7684. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7685. tagPrinter->SetFontFace(11, 1, "宋体");
  7686. // 5.打印客户姓名
  7687. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7688. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7689. // 6.打印客户联系电话
  7690. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7691. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7692. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7693. // 7.打印开单日期
  7694. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7695. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7696. #if 0 // Original Edition
  7697. // 8.打印列字段:收款项目
  7698. tagPrinter->SetFontFace(13, 1, "宋体");
  7699. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7700. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7701. printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7702. // 9.打印列字段:金额
  7703. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7704. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7705. printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7706. // 10.打印列字段:开单人
  7707. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7708. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7709. printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7710. #else
  7711. // 8.打印列字段:收款项目
  7712. tagPrinter->SetFontFace(13, 1, "宋体");
  7713. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7714. StrRect = CRect(66, 85, 280, 105);
  7715. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7716. //m_Print.DrawText("收款项目",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7717. // 8.1 Jeff add:支付方式
  7718. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7719. StrRect = CRect(280, 85, 350, 105);
  7720. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7721. //m_Print.DrawText("支付方式",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7722. // 9.打印列字段:金额
  7723. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7724. StrRect = CRect(350, 85, 442, 105);
  7725. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7726. //m_Print.DrawText("金额",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7727. // 10.打印列字段:开单人
  7728. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7729. StrRect = CRect(442, 85, 535, 105);
  7730. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7731. //m_Print.DrawText("开单人",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7732. //rcpos += 3;
  7733. #endif
  7734. // 11.画表格-画3列;old
  7735. // 11.draw 4 column
  7736. tagPrinter->SetFontFace(11, 1, "宋体");
  7737. int i;
  7738. //for( i=7; i<10; i++)
  7739. //{
  7740. // StrRect=load.m_rcarray.ElementAt(i);
  7741. // m_Print.DrawRect2(StrRect, 1);
  7742. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7743. //}
  7744. tagPrinter->DrawRect2(CRect(66, 85, 280, 105), 1);
  7745. tagPrinter->DrawRect2(CRect(280, 85, 350, 105), 1);
  7746. tagPrinter->DrawRect2(CRect(350, 85, 442, 105), 1);
  7747. tagPrinter->DrawRect2(CRect(442, 85, 535, 105), 1);
  7748. // 12.打印详细内容
  7749. int dty = 0;
  7750. int dtytemp = 0;
  7751. // for( i=10; i<14; i+=3)
  7752. //for( i=10; i<22; i+=3) // 循环4次,再画
  7753. int j = 0;
  7754. for (i = 10, j = 11; i<22; i += 3, j += 4) // 循环4次,再画
  7755. {
  7756. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  7757. CArray<CRect, CRect>rcarray;
  7758. CStringArray strarray2;
  7759. StrRect = load.m_rcarray.ElementAt(i);
  7760. StrRect.top += dty;
  7761. StrRect.bottom += dty;
  7762. StrRect.right -= 70; // Jeff add
  7763. //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;
  7764. /*
  7765. 4次的CRect
  7766. 66,105,350,125
  7767. 66,126,350,146
  7768. 66,147,350,167
  7769. 66,168,350,188
  7770. */
  7771. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  7772. {
  7773. StrRect = load.m_rcarray.ElementAt(i - 1);
  7774. StrRect.top += dty;
  7775. StrRect.bottom += dty;
  7776. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  7777. break;
  7778. }
  7779. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  7780. StrRect.left += 2;
  7781. StrRect.right -= 2;
  7782. StrRect.top += 4;
  7783. rcarray.Add(StrRect);
  7784. //strarray2.Add(pArray->ElementAt(i+1));
  7785. strarray2.Add(pArray->ElementAt(j));
  7786. //printf("Jeff:%d:%s\n\n",j,pArray->ElementAt(j));//Jeff Printf;
  7787. // 指定格子宽度,计算字符串占几行(高度).
  7788. INT bottom = CalcHeight(rcarray, strarray2, tagPrinter, FORMAT_LEFT);
  7789. dtytemp = bottom - StrRect.bottom;
  7790. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7791. // 重新获取表格大小,并画出表格;
  7792. /*
  7793. CRect(66,85,280,105),
  7794. CRect(280,85,350,105)
  7795. CRect(350,85,442,105)
  7796. CRect(442,85,535,105)
  7797. CRect(66,105,350,125),
  7798. CRect(66,126,350,146)
  7799. CRect(66,147,350,167)
  7800. CRect(66,168,350,188)
  7801. */
  7802. // 画收款项目框及打印内容;
  7803. StrRect = load.m_rcarray.ElementAt(i);
  7804. //StrRect=CRect(66,85,280,105);
  7805. StrRect.bottom += dtytemp;
  7806. StrRect.top += dty;
  7807. StrRect.bottom += dty;
  7808. //StrRect.left -= 70; // Jeff add
  7809. StrRect.right -= 70; // Jeff add
  7810. //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;
  7811. tagPrinter->DrawRect2(StrRect, 1);
  7812. // 画支付方式框及打印内容;
  7813. StrRect = load.m_rcarray.ElementAt(i);
  7814. //StrRect=CRect(280,85,350,105);
  7815. StrRect.bottom += dtytemp;
  7816. StrRect.top += dty;
  7817. StrRect.bottom += dty;
  7818. StrRect.left += StrRect.Width() - 70;
  7819. //StrRect.right += 70; // Jeff add
  7820. //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;
  7821. tagPrinter->DrawRect2(StrRect, 1);
  7822. StrRect.left += 2;
  7823. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7824. //printf("Jeff:%d:%s\n\n",j+1,pArray->ElementAt(j+1));//Jeff Printf;
  7825. // 画金额框及打印内容;
  7826. StrRect = load.m_rcarray.ElementAt(i + 1);
  7827. //StrRect=CRect(350,85,442,105);
  7828. StrRect.top += dty;
  7829. StrRect.bottom += dty;
  7830. StrRect.bottom += dtytemp;
  7831. //StrRect.right -= 70; // Jeff add
  7832. //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;
  7833. tagPrinter->DrawRect2(StrRect, 1);
  7834. StrRect.left += 2;
  7835. // 打印出金额字段内容
  7836. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7837. //printf("Jeff:%d:%s\n\n",j+2,pArray->ElementAt(j+2));//Jeff Printf;
  7838. // 画开单人框及打印内容;
  7839. StrRect = load.m_rcarray.ElementAt(i + 2);
  7840. //StrRect=CRect(442,85,535,105);
  7841. StrRect.top += dty;
  7842. StrRect.bottom += dty;
  7843. StrRect.bottom += dtytemp;
  7844. //StrRect.right -= 70; // Jeff add
  7845. //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;
  7846. tagPrinter->DrawRect2(StrRect, 1);
  7847. StrRect.left += 2;
  7848. // 打印开单人字段内容
  7849. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 3), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7850. //printf("Jeff:%d:%s\n\n",j+3,pArray->ElementAt(j+3));//Jeff Printf;
  7851. dty += dtytemp;
  7852. }
  7853. //.打印->付款情况 应付 实付 欠款.
  7854. i = 22;
  7855. j = 27;
  7856. StrRect = load.m_rcarray.ElementAt(i);
  7857. StrRect.top += dty;
  7858. StrRect.bottom += dty;
  7859. tagPrinter->DrawRect2(StrRect, 1);
  7860. StrRect.left += 2;
  7861. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7862. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7863. //.打印->合计人民币(大写):.......
  7864. i = 23;
  7865. j = 28;
  7866. StrRect = load.m_rcarray.ElementAt(i);
  7867. StrRect.top += dty;
  7868. StrRect.bottom += dty;
  7869. tagPrinter->DrawRect2(StrRect, 1);
  7870. StrRect.left += 2;
  7871. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7872. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7873. // 打印总金额;
  7874. tagPrinter->SetFontFace(7, 1, "宋体");
  7875. for (i = 24, j = 29; i < 27; i++, j++)
  7876. {
  7877. StrRect = load.m_rcarray.ElementAt(i);
  7878. StrRect.top += dty;
  7879. StrRect.bottom += dty;
  7880. StrRect.left += 2;
  7881. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7882. }
  7883. StrRect = load.m_rcarray.ElementAt(24);
  7884. StrRect.top += dty;
  7885. StrRect.bottom += dty;
  7886. hei = StrRect.Height();
  7887. StrRect.top += hei;
  7888. StrRect.bottom += hei;
  7889. StrRect.right += 100;
  7890. StrRect.left += 2;
  7891. StrRect = load.m_rcarray.ElementAt(27);
  7892. StrRect.top += dty;
  7893. StrRect.bottom += dty;
  7894. AutoDraw(*tagPrinter, StrRect, pArray->ElementAt(32), 1.0);
  7895. }
  7896. if (bPrintImmediately == TRUE)
  7897. {
  7898. printcot = nCount;
  7899. ////结束打印
  7900. tagPrinter->EndPage();
  7901. tagPrinter->EndPrint();
  7902. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7903. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7904. CString sql;
  7905. sql.Format("update version set [serialno]='%s'", SerialNo);
  7906. g_sendhead.bsql = 1;
  7907. g_nYearposTemp = g_nYearpos;
  7908. g_nYearpos = -1;
  7909. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7910. g_nYearpos = g_nYearposTemp;
  7911. #endif
  7912. }
  7913. else
  7914. {
  7915. PrintPreview dlg;
  7916. dlg.m_mode = 3;
  7917. tagPrinter->GetWidHei(dlg.m_w, dlg.m_h);
  7918. dlg.m_pDC = tagPrinter->GetPDC();
  7919. //if(aa==0)
  7920. //{
  7921. if (dlg.DoModal() != IDOK)
  7922. {
  7923. return;
  7924. }
  7925. else
  7926. {
  7927. printcot = dlg.m_num;
  7928. //m_Print.deletePrinter();
  7929. for (int i = 0; i < printcot; i++)
  7930. {
  7931. //tagPrinter->EndPage();
  7932. //tagPrinter->m_DC.AbortDoc(); // 结束清空由StartDoc写入的内容;2014-09-15;
  7933. //tagPrinter->m_DC.EndDoc();
  7934. //Sleep(10000);
  7935. //tagPrinter->StartPrint();
  7936. //tagPrinter->NewPage();
  7937. //PrintReceipt_02(pArray,/*tagPrinter*/NULL,printcot,TRUE);
  7938. PrintReceipt_02(pArray, tagPrinter, printcot, TRUE);
  7939. }
  7940. }
  7941. if (tagPrinter) delete tagPrinter;
  7942. //}
  7943. }
  7944. //}
  7945. }
  7946. void CMainFrame::PrintFlowChart(CString strOrderNumber) // 选片打单;
  7947. {
  7948. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(75)))
  7949. {
  7950. // Jeff 使用风格2打印;
  7951. //PrintFlowChart3_20151116(strOrderNumber);
  7952. PrintFlowChart3(strOrderNumber);
  7953. return;
  7954. }
  7955. #ifdef ZHIAI_VERSION
  7956. PrintFlowChart2(strOrderNumber);
  7957. return;
  7958. #endif
  7959. int i = 0;
  7960. int printcot = 1;
  7961. for (int aa = 0; aa < printcot; aa++)
  7962. {
  7963. CPrintRX m_Print;
  7964. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7965. {
  7966. m_Print.InitToPrint(NULL, 1);
  7967. }
  7968. else
  7969. {
  7970. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  7971. if (name.IsEmpty())
  7972. m_Print.InitToPrint(NULL, 1);
  7973. else
  7974. {
  7975. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  7976. if (nret == -1 && aa == 0)
  7977. {
  7978. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  7979. }
  7980. }
  7981. }
  7982. m_Print.StartPrint();
  7983. m_Print.StartPage();
  7984. // CRect StrRect(0,0,560,818);
  7985. LoadRect load;
  7986. load.SetLiaPath("4.lia");
  7987. load.SetMargins(-14, -14);
  7988. if (!load.Load())return;
  7989. LoadRect load2;
  7990. load2.SetMargins(-14, 472 + 27 - 14);
  7991. load2.SetLiaPath("5.lia");
  7992. if (!load2.Load())return;
  7993. //////////////////////////////////////////////////////////////
  7994. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2'";
  7995. g_sendhead.code[0] = 54;
  7996. g_sendhead.code[1] = 223;
  7997. g_sendhead.tabcount = 2;
  7998. g_sendhead.bsql = 0;
  7999. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  8000. CArray<CStringArray, CStringArray>sparray;
  8001. DataToArray(&g_List1array, &sparray);
  8002. CString spno;
  8003. for ( i = 0; i < sparray.GetSize(); i++)
  8004. {
  8005. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8006. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8007. if (sparray.ElementAt(i).ElementAt(5) == "入册" && sparray.ElementAt(i).ElementAt(5) == "入底" && sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8008. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8009. spno += sparray.ElementAt(i).ElementAt(5);
  8010. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  8011. spno += "; ";
  8012. else
  8013. {
  8014. spno += ":";
  8015. spno += sparray.ElementAt(i).ElementAt(6);
  8016. spno += "; ";
  8017. }
  8018. }
  8019. spno += " 加挑:";
  8020. for (i = 0; i < sparray.GetSize(); i++)
  8021. {
  8022. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8023. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8024. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8025. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8026. spno += sparray.ElementAt(i).ElementAt(5);
  8027. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  8028. spno += "; ";
  8029. else
  8030. {
  8031. spno += ":";
  8032. spno += sparray.ElementAt(i).ElementAt(6);
  8033. spno += "; ";
  8034. }
  8035. }
  8036. if (spno.Right(6) == " 加挑:")
  8037. {
  8038. spno = spno.Left(spno.GetLength() - 6);
  8039. }
  8040. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8041. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8042. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8043. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8044. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8045. if (m_urgent.IsEmpty())m_urgent = "否";
  8046. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8047. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8048. // CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  8049. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8050. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8051. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8052. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8053. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8054. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8055. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8056. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8057. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(17) + g_List1array.ElementAt(0).ElementAt(29);
  8058. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8059. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8060. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8061. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8062. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8063. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8064. CString m_sum3;
  8065. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8066. ::ConvertToPrice(m_sum3);
  8067. if (m_money3.IsEmpty())m_money3 = "0";
  8068. // m_money3=m_money3+"/"+m_sum3;
  8069. CString name;
  8070. if (!m_name1.IsEmpty())
  8071. name = m_name1 + ",";
  8072. name += m_name2;
  8073. name.TrimRight(",");
  8074. CString phone;
  8075. if (!m_phone1.IsEmpty())
  8076. phone = m_phone1 + ",";
  8077. phone += m_phone2; phone.TrimRight(",");
  8078. if (IsHasRights2new(31) == 0)
  8079. phone = "***";
  8080. CStringArray strarray;
  8081. strarray.Add(m_urgent);
  8082. strarray.Add(m_ren);
  8083. strarray.Add(m_waiter3);
  8084. strarray.Add(name);
  8085. strarray.Add(m_time2);
  8086. strarray.Add(m_time4);
  8087. strarray.Add(m_money3);
  8088. strarray.Add(m_sum3);
  8089. strarray.Add(m_takezs);
  8090. strarray.Add(m_taoxizs);
  8091. strarray.Add(m_choosezs);
  8092. strarray.Add(strOrderNumber);
  8093. strarray.Add(phone);
  8094. ////////////////////////////////////////////////////////////////
  8095. int rcpos = -1;
  8096. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8097. Image *pImg = NULL;
  8098. #ifdef MNLS_VERSION
  8099. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  8100. #else
  8101. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  8102. #endif
  8103. m_Print.DrawImage(pImg, StrRect);
  8104. delete pImg;
  8105. m_Print.SetFontFace(11, 1, "宋体");
  8106. StrRect = load2.m_rcarray.ElementAt(7);
  8107. StrRect.top = load2.m_rcarray.ElementAt(15).top - 15;
  8108. StrRect.bottom = load2.m_rcarray.ElementAt(15).bottom - 15;
  8109. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  8110. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8111. StrRect.top += 15;
  8112. StrRect.bottom += 15;
  8113. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  8114. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8115. m_Print.SetFontFace(15, 1, "宋体");
  8116. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8117. #ifdef MNLS_VERSION
  8118. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8119. #endif
  8120. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8121. #ifdef MNLS_VERSION
  8122. m_Print.DrawRect(StrRect);
  8123. #endif
  8124. m_Print.SetFontFace(7, 1, "黑体");
  8125. m_Print.SetColor(0xffffff);
  8126. #ifdef MNLS_VERSION
  8127. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8128. #endif
  8129. m_Print.SetColor(0);
  8130. m_Print.SetFontFace(25, 1, "黑体");
  8131. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8132. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8133. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  8134. {
  8135. Image *pImg = NULL;
  8136. g_nSendCode = 31;
  8137. int g_nYearposTemp = g_nYearpos;
  8138. g_nYearpos = -1;
  8139. g_pMainWnd->ProcessChatMessageRequest2(1);
  8140. g_nYearpos = g_nYearposTemp;
  8141. g_nSendCode = 0;
  8142. if (g_bSendOK == 0)return;
  8143. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8144. if (pImg)
  8145. {
  8146. StrRect.left = 450;
  8147. StrRect.top = 22;
  8148. StrRect.right = StrRect.left + 60;
  8149. StrRect.bottom = StrRect.top + 60;
  8150. m_Print.DrawImage(pImg, StrRect);
  8151. delete pImg; pImg = NULL;
  8152. }
  8153. }
  8154. #ifdef CHILD_VERSION
  8155. CString title[13] = { "是否加急:", "接单门市:", \
  8156. "选样人员:", "客人姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  8157. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:"
  8158. };
  8159. #else
  8160. CString title[13] = { "是否加急:", "接单门市:", \
  8161. "选样人员:", "新郎新娘姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  8162. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:" };
  8163. #endif
  8164. m_Print.SetFontFace(12, 1, "宋体");
  8165. for (i = 0; i < 13; i++)
  8166. {
  8167. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8168. if (i < 3)
  8169. m_Print.DrawRect2(StrRect, 0);
  8170. else
  8171. m_Print.DrawRect2(StrRect, 1);
  8172. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8173. }
  8174. for (i = 18; i <= 37; i++)
  8175. {
  8176. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8177. if (i >= 19 && i <= 21)
  8178. m_Print.DrawRect2(StrRect, 2);
  8179. /* else if(i==26)
  8180. {
  8181. CRect rc=StrRect;
  8182. CRect rc2=rc;
  8183. rc.right -=rc2.Width ()/2;
  8184. m_Print.DrawRect2(rc, 1);
  8185. rc2.left +=rc.Width ();
  8186. m_Print.DrawRect2(rc2, 1);
  8187. }*/
  8188. else
  8189. m_Print.DrawRect2(StrRect, 1);
  8190. if (i == 18)
  8191. {
  8192. StrRect.left += 5;
  8193. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8194. }
  8195. }
  8196. //////////////////////////////////////
  8197. rcpos = -1;
  8198. for (i = 0; i < 8; i++)
  8199. {
  8200. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8201. m_Print.DrawRect2(StrRect, 1);
  8202. }
  8203. #ifdef CHILD_VERSION
  8204. CString title2[4] = { "引导师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  8205. #else
  8206. CString title2[4] = { "化妆师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  8207. #endif
  8208. for (i = 0; i < 4; i++)
  8209. {
  8210. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8211. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8212. }
  8213. for (i = 0; i < 4; i++)
  8214. {
  8215. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8216. m_Print.DrawRect2(StrRect, 2);
  8217. }
  8218. StrRect = load2.m_rcarray.ElementAt(11);
  8219. StrRect.top -= 15;
  8220. StrRect.bottom -= 15;
  8221. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客选片签名:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8222. StrRect = load2.m_rcarray.ElementAt(15);
  8223. StrRect.top -= 15;
  8224. StrRect.bottom -= 15;
  8225. m_Print.DrawRect2(StrRect, 2);
  8226. ///////////////////////////////////////////
  8227. for (i = 19; i <= 31; i++)
  8228. {
  8229. StrRect = load.m_rcarray.ElementAt(i - 1);
  8230. StrRect.left += 4;
  8231. if (i == 31)
  8232. {
  8233. if (m_phone1.IsEmpty() == 0 && m_phone2.IsEmpty() == 0)
  8234. {
  8235. StrRect.top += 2;
  8236. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  8237. StrRect.top += 8;
  8238. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8239. }
  8240. else
  8241. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8242. }
  8243. /* else if((i-19)==7)
  8244. {
  8245. CRect rc=StrRect;
  8246. CRect rc2=rc;
  8247. rc.right -=rc2.Width ()/2;
  8248. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8249. rc2.left +=rc.Width ()+3;
  8250. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8251. }*/
  8252. else
  8253. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8254. }
  8255. strarray.RemoveAll();
  8256. strarray.Add(m_waiter2);
  8257. strarray.Add(m_waiter1);
  8258. strarray.Add(m_waiter4);
  8259. for (i = 13; i <= 15; i++)
  8260. {
  8261. StrRect = load2.m_rcarray.ElementAt(i - 1);
  8262. StrRect.left += 4;
  8263. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8264. }
  8265. ///////////spno
  8266. CRect sprc[14];
  8267. for (i = 0; i < 14; i++)
  8268. {
  8269. if (i < 7)
  8270. {
  8271. if (i == 0)
  8272. {
  8273. StrRect = load.m_rcarray.ElementAt(17); StrRect.left += 94; StrRect.right -= 3;
  8274. }
  8275. else
  8276. {
  8277. StrRect = load.m_rcarray.ElementAt(30 + i); StrRect.left += 4; StrRect.right -= 3;
  8278. }
  8279. }
  8280. else
  8281. {
  8282. StrRect = load2.m_rcarray.ElementAt(i - 7); StrRect.left += 4; StrRect.right -= 3;
  8283. }
  8284. sprc[i] = StrRect;
  8285. }
  8286. CString temp, tempspno, tempbz;
  8287. CSize size;
  8288. BOOL bRun = 0;
  8289. int fontsize = 12;
  8290. ll: tempspno = spno;
  8291. tempbz = m_bz;
  8292. m_Print.SetFontFace(fontsize, 1, "宋体");
  8293. for (i = 0; i<14; i++)
  8294. {
  8295. if (!tempspno.IsEmpty())
  8296. {
  8297. temp = tempspno;
  8298. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8299. int right = 0;
  8300. CRect temprc = sprc[i];
  8301. while (size.cx>temprc.Width())
  8302. {
  8303. right++;
  8304. temp = tempspno.Left(tempspno.GetLength() - (right));
  8305. if (GIsHalfHZ(temp))
  8306. {
  8307. right++;
  8308. temp.Delete(temp.GetLength() - 1);
  8309. }
  8310. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8311. }
  8312. if (bRun)
  8313. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8314. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  8315. if (tempspno.IsEmpty())i++;
  8316. }
  8317. else if (!tempbz.IsEmpty())
  8318. {
  8319. temp = tempbz;
  8320. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8321. int right = 0;
  8322. CRect temprc = sprc[i];
  8323. while (size.cx > temprc.Width())
  8324. {
  8325. right++;
  8326. temp = tempbz.Left(tempbz.GetLength() - (right));
  8327. if (GIsHalfHZ(temp))
  8328. {
  8329. right++;
  8330. temp.Delete(temp.GetLength() - 1);
  8331. }
  8332. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8333. }
  8334. if (bRun)
  8335. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8336. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  8337. }
  8338. }
  8339. if (tempspno.IsEmpty() == 0 || tempbz.IsEmpty() == 0)
  8340. {
  8341. fontsize--;
  8342. goto ll;
  8343. }
  8344. if (bRun == 0)
  8345. {
  8346. bRun = 1;
  8347. goto ll;
  8348. }
  8349. PrintPreview dlg;
  8350. dlg.m_mode = 2;
  8351. dlg.m_name = name;
  8352. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8353. dlg.m_pDC = m_Print.GetPDC();
  8354. if (aa == 0)
  8355. {
  8356. if (dlg.DoModal() != IDOK)
  8357. return;
  8358. printcot = dlg.m_num;
  8359. }
  8360. //结束打印
  8361. m_Print.EndPage();
  8362. m_Print.EndPrint();
  8363. }
  8364. }
  8365. void CMainFrame::PrintFlowChart3LKAY(CString strOrderNumber)
  8366. {
  8367. int i = 0;
  8368. int printcot = 1;
  8369. for (int aa = 0; aa < printcot; aa++)
  8370. {
  8371. CPrintRX m_Print;
  8372. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  8373. {
  8374. m_Print.InitToPrint(NULL, 1);
  8375. }
  8376. else
  8377. {
  8378. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  8379. if (name.IsEmpty())
  8380. m_Print.InitToPrint(NULL, 1);
  8381. else
  8382. {
  8383. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8384. if (nret == -1 && aa == 0)
  8385. {
  8386. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8387. }
  8388. }
  8389. }
  8390. m_Print.StartPrint();
  8391. m_Print.StartPage();
  8392. LoadRect load;
  8393. load.SetLiaPath("18.lia");
  8394. load.SetMargins(10, 0);
  8395. if (!load.Load())return;
  8396. CString str;
  8397. int rcpos = -1;
  8398. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8399. m_Print.SetFontFace(25, 1, "宋体");
  8400. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8401. m_Print.SetFontFace(15, 1, "宋体");
  8402. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8403. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8404. m_Print.SetFontFace(9, 1, "宋体");
  8405. //////////////////////////////////////////////////////////////
  8406. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8407. g_sendhead.code[0] = 54;
  8408. g_sendhead.code[1] = 223;
  8409. g_sendhead.code[2] = 52;
  8410. g_sendhead.tabcount = 3;
  8411. g_sendhead.bsql = 0;
  8412. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  8413. CArray<CStringArray, CStringArray>sparray;
  8414. CArray<CStringArray, CStringArray>clientarray;
  8415. DataToArray(&g_List1array, &sparray, &clientarray);
  8416. CString spno;
  8417. CStringArray sparray2;
  8418. for ( i = 0; i < sparray.GetSize(); i++)
  8419. {
  8420. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8421. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8422. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8423. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8424. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8425. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8426. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8427. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8428. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8429. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8430. }
  8431. for (i = 0; i < sparray.GetSize(); i++)
  8432. {
  8433. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8434. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8435. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8436. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8437. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8438. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8439. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8440. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8441. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8442. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8443. }
  8444. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8445. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8446. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8447. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8448. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8449. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8450. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8451. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8452. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8453. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8454. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8455. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8456. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8457. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8458. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8459. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8460. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8461. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8462. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8463. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8464. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8465. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8466. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8467. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8468. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8469. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8470. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8471. CString m_sum3;
  8472. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8473. ::ConvertToPrice(m_sum3);
  8474. if (m_money3.IsEmpty())m_money3 = "0";
  8475. int dty = 0;
  8476. CString name;
  8477. if (!m_name1.IsEmpty())
  8478. name = m_name1 + ",";
  8479. name += m_name2;
  8480. name.TrimRight(",");
  8481. CString phone;
  8482. if (!m_phone1.IsEmpty())
  8483. phone = m_phone1 + ",";
  8484. phone += m_phone2; phone.TrimRight(",");
  8485. if (IsHasRights2new(31) == 0)
  8486. phone = "***";
  8487. CStringArray strarray;
  8488. #ifdef CHILD_VERSION
  8489. if (m_birthday.IsEmpty())
  8490. strarray.Add("姓名/性别");
  8491. else
  8492. strarray.Add("姓名/性别/年龄");
  8493. #else
  8494. strarray.Add("客人姓名");
  8495. #endif
  8496. strarray.Add("电话");
  8497. strarray.Add("单号");
  8498. strarray.Add("套系");
  8499. strarray.Add("选样");
  8500. strarray.Add("余款/加挑");
  8501. strarray.Add("选片/日期");
  8502. #ifdef CHILD_VERSION
  8503. if (m_birthday.IsEmpty())
  8504. strarray.Add(name + "/" + m_sex);
  8505. else
  8506. {
  8507. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8508. m_birthday.Format("%d", year + 1);
  8509. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8510. }
  8511. #else
  8512. strarray.Add(name);
  8513. #endif
  8514. strarray.Add(phone);
  8515. strarray.Add(strOrderNumber);
  8516. strarray.Add(m_taoxiname);
  8517. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8518. strarray.Add(str);
  8519. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8520. strarray.Add(str);
  8521. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8522. for (i = 3; i <= 16; i++)
  8523. {
  8524. StrRect = load.m_rcarray.ElementAt(i - 1);
  8525. if (i < 10)
  8526. {
  8527. m_Print.DrawRect2(StrRect, 1);
  8528. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8529. }
  8530. }
  8531. StrRect = load.m_rcarray.ElementAt(29);
  8532. m_Print.DrawRect2(StrRect, 1);
  8533. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8534. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  8535. {
  8536. Image *pImg = NULL;
  8537. g_nSendCode = 31;
  8538. int g_nYearposTemp = g_nYearpos;
  8539. g_nYearpos = -1;
  8540. g_pMainWnd->ProcessChatMessageRequest2(1);
  8541. g_nYearpos = g_nYearposTemp;
  8542. g_nSendCode = 0;
  8543. if (g_bSendOK == 0)return;
  8544. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8545. if (pImg)
  8546. {
  8547. StrRect.left = 485;
  8548. StrRect.top = 12;
  8549. StrRect.right = StrRect.left + 60;
  8550. StrRect.bottom = StrRect.top + 60;
  8551. m_Print.DrawImage(pImg, StrRect);
  8552. delete pImg; pImg = NULL;
  8553. }
  8554. }
  8555. CArray<CRect, CRect>rcarray;
  8556. CStringArray strarray2;
  8557. for (i = 10; i <= 16; i++)
  8558. {
  8559. StrRect = load.m_rcarray.ElementAt(i - 1);
  8560. StrRect.left += 2;
  8561. StrRect.right -= 2;
  8562. StrRect.top += 2;
  8563. rcarray.Add(StrRect);
  8564. strarray2.Add(strarray.ElementAt(7 + i - 10));
  8565. }
  8566. if (1)
  8567. {
  8568. StrRect = load.m_rcarray.ElementAt(30);
  8569. StrRect.left += 2;
  8570. StrRect.right -= 2;
  8571. StrRect.top += 2;
  8572. rcarray.Add(StrRect);
  8573. strarray2.Add(m_time6 + "/" + m_time5);
  8574. }
  8575. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8576. for (i = 10; i <= 16; i++)
  8577. {
  8578. StrRect = load.m_rcarray.ElementAt(i - 1);
  8579. if (i == 10)
  8580. {
  8581. dty += bottom - StrRect.bottom;
  8582. }
  8583. StrRect.bottom = bottom;
  8584. m_Print.DrawRect2(StrRect, 1);
  8585. }
  8586. if (1)
  8587. {
  8588. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  8589. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  8590. // m_Print.DrawText((LPTSTR)(LPCTSTR)(m_time6+"/"+m_time5), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER );
  8591. }
  8592. m_Print.SetFontFace(15, 1, "宋体");
  8593. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  8594. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8595. m_Print.SetFontFace(9, 1, "宋体");
  8596. strarray.RemoveAll();
  8597. strarray.Add("产品名称");
  8598. strarray.Add("数量");
  8599. strarray.Add("P数");
  8600. strarray.Add("张数");
  8601. strarray.Add("照片编号");
  8602. CArray<CRect, CRect>rc2array;
  8603. int wid = 25;
  8604. for (i = 18; i <= 22; i++)
  8605. {
  8606. StrRect = load.m_rcarray.ElementAt(i - 1);
  8607. if (i == 19)
  8608. {
  8609. StrRect.right = StrRect.left + wid;
  8610. }
  8611. if (i == 20)
  8612. {
  8613. StrRect = load.m_rcarray.ElementAt(i - 2);
  8614. StrRect.left += wid; StrRect.right = StrRect.left;
  8615. StrRect.right += wid;
  8616. }
  8617. if (i == 21)
  8618. {
  8619. StrRect = load.m_rcarray.ElementAt(i - 3);
  8620. StrRect.left += wid * 2; StrRect.right = StrRect.left;
  8621. StrRect.right += wid;
  8622. wid = StrRect.right;
  8623. }
  8624. if (i == 22)
  8625. {
  8626. StrRect = load.m_rcarray.ElementAt(i - 3);
  8627. StrRect.left = wid;
  8628. }
  8629. StrRect.top += dty; StrRect.bottom += dty;
  8630. m_Print.DrawRect2(StrRect, 1);
  8631. StrRect.left += 2;
  8632. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8633. StrRect.left -= 2;
  8634. StrRect.top = StrRect.bottom;
  8635. StrRect.bottom += 18;
  8636. rc2array.Add(StrRect);
  8637. }
  8638. int curypos = 0;
  8639. for (i = 0; i < sparray2.GetSize(); i += 5)
  8640. {
  8641. rcarray.RemoveAll();
  8642. strarray2.RemoveAll();
  8643. int j = 0;
  8644. for ( j = 0; j < 5; j++)
  8645. {
  8646. StrRect = rc2array.ElementAt(j);
  8647. StrRect.left += 2;
  8648. StrRect.right -= 2;
  8649. StrRect.top += 2;
  8650. rcarray.Add(StrRect);
  8651. strarray2.Add(sparray2.ElementAt(i + j));
  8652. }
  8653. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8654. rcarray.RemoveAll();
  8655. for (j = 0; j < 5; j++)
  8656. {
  8657. StrRect = rc2array.ElementAt(j);
  8658. if (j == 0)
  8659. {
  8660. dty += bottom - StrRect.bottom;
  8661. }
  8662. StrRect.bottom = bottom;
  8663. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8664. StrRect.top = StrRect.bottom;
  8665. StrRect.bottom += 18;
  8666. rcarray.Add(StrRect);
  8667. }
  8668. rc2array.RemoveAll();
  8669. rc2array.Copy(rcarray);
  8670. }
  8671. m_Print.SetFontFace(15, 1, "宋体");
  8672. StrRect = load.m_rcarray.ElementAt(20);
  8673. dty = curypos - StrRect.bottom + 35;
  8674. StrRect.top += dty; StrRect.bottom += dty;
  8675. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8676. m_Print.SetFontFace(9, 1, "宋体");
  8677. rcarray.RemoveAll();
  8678. strarray2.RemoveAll();
  8679. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8680. StrRect.left += 2;
  8681. StrRect.right -= 2;
  8682. StrRect.top += 2;
  8683. rcarray.Add(StrRect);
  8684. strarray2.Add(m_bz);
  8685. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8686. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8687. dty += bottom - StrRect.bottom;
  8688. StrRect.bottom = bottom;
  8689. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8690. m_Print.SetFontFace(10, 1, "宋体");
  8691. StrRect = load.m_rcarray.ElementAt(22);
  8692. dty = curypos - StrRect.bottom + 25;
  8693. StrRect.top += dty; StrRect.bottom += dty;
  8694. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  8695. if (m_edit9.IsEmpty())
  8696. {
  8697. m_edit9 = "\
  8698. 经确认后的照片均排入制作流程,\r\n\
  8699. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  8700. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  8701. }
  8702. CString info1, info2, info3;
  8703. int newlinepos = m_edit9.Find("\r\n");
  8704. if (newlinepos != -1)
  8705. {
  8706. info1 = m_edit9.Left(newlinepos);
  8707. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8708. }
  8709. newlinepos = m_edit9.Find("\r\n");
  8710. if (newlinepos != -1)
  8711. {
  8712. info2 = m_edit9.Left(newlinepos);
  8713. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8714. info3 = m_edit9;
  8715. }
  8716. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8717. StrRect = load.m_rcarray.ElementAt(23);
  8718. StrRect.top += dty; StrRect.bottom += dty;
  8719. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8720. StrRect = load.m_rcarray.ElementAt(24);
  8721. StrRect.top += dty; StrRect.bottom += dty;
  8722. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8723. StrRect.top += 15;
  8724. StrRect.bottom += 15;
  8725. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8726. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  8727. StrRect = load.m_rcarray.ElementAt(25);
  8728. StrRect.top += dty - dy;
  8729. StrRect.bottom += dty - dy;
  8730. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8731. StrRect = load.m_rcarray.ElementAt(26);
  8732. StrRect.top += dty - dy;
  8733. StrRect.bottom += dty - dy;
  8734. m_Print.DrawRect2(StrRect, 2);
  8735. StrRect = load.m_rcarray.ElementAt(25);
  8736. StrRect.top += dty + 15 - dy;
  8737. StrRect.bottom += dty + 15 - dy;
  8738. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8739. StrRect = load.m_rcarray.ElementAt(26);
  8740. StrRect.top += dty + 15 - dy;
  8741. StrRect.bottom += dty + 15 - dy;
  8742. m_Print.DrawRect2(StrRect, 2);
  8743. StrRect = load.m_rcarray.ElementAt(25);
  8744. StrRect.top += dty + 15 * 2 - dy;
  8745. StrRect.bottom += dty + 15 * 2 - dy;
  8746. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8747. StrRect = load.m_rcarray.ElementAt(26);
  8748. StrRect.top += dty + 15 * 2 - dy;
  8749. StrRect.bottom += dty + 15 * 2 - dy;
  8750. m_Print.DrawRect2(StrRect, 2);
  8751. PrintPreview dlg; dlg.m_mode = 2;
  8752. dlg.m_name = name;
  8753. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8754. dlg.m_pDC = m_Print.GetPDC();
  8755. if (aa == 0)
  8756. {
  8757. if (dlg.DoModal() != IDOK)
  8758. return;
  8759. printcot = dlg.m_num;
  8760. }
  8761. //结束打印
  8762. m_Print.EndPage();
  8763. m_Print.EndPrint();
  8764. }
  8765. }
  8766. void CMainFrame::PrintFlowChart3(CString strOrderNumber) // 选片打单 风格2;
  8767. {
  8768. #ifdef LKAY_VERSION
  8769. PrintFlowChart3LKAY(strOrderNumber);
  8770. return;
  8771. #endif
  8772. int i = 0;
  8773. int j = 0;
  8774. int printcot = 1;
  8775. for (int aa = 0; aa < printcot; aa++)
  8776. {
  8777. BOOL bSecondPage = 0;
  8778. int nPrintedPos = 0;
  8779. for (int bb = 0; bb < 2; bb++)
  8780. {
  8781. if (bb && bSecondPage == 0)break;
  8782. CPrintRX m_Print;
  8783. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58))) // 58-[version].[setcheck1] ==1,使用默认打印机;
  8784. {
  8785. m_Print.InitToPrint(NULL, 1);
  8786. }
  8787. else // 否则使用指定的打印机;
  8788. {
  8789. CString name = g_cominfoarray.ElementAt(0).ElementAt(64); // 64-[version].[printer2] 制作单打印机;
  8790. if (name.IsEmpty())
  8791. m_Print.InitToPrint(NULL, 1);
  8792. else
  8793. {
  8794. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8795. if (nret == -1 && aa == 0)
  8796. {
  8797. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8798. }
  8799. }
  8800. }
  8801. m_Print.StartPrint();
  8802. m_Print.StartPage();
  8803. LoadRect load;
  8804. load.SetLiaPath("18.lia");
  8805. load.SetMargins(10, 0);
  8806. if (!load.Load())return;
  8807. CString str;
  8808. int rcpos = -1;
  8809. // ■■■■■■从18.lia获取到第一个区域大小 - 1.显示店名;
  8810. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8811. if ((bb == 0 && bSecondPage == 0))
  8812. {
  8813. m_Print.SetFontFace(25, 1, "宋体");
  8814. // 10-[version].[info1] 店名;
  8815. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8816. m_Print.SetFontFace(15, 1, "宋体");
  8817. // ■■■■■■从18.lia获取第二个区域大小 - 2.显示"基本资料";
  8818. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8819. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8820. m_Print.SetFontFace(9, 1, "宋体");
  8821. }
  8822. //////////////////////////////////////////////////////////////
  8823. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8824. g_sendhead.code[0] = 54; // dindan;
  8825. g_sendhead.code[1] = 223; // dindanspview2; shangpin+dindansp;
  8826. g_sendhead.code[2] = 52; // client;
  8827. g_sendhead.tabcount = 3;
  8828. g_sendhead.bsql = 0;
  8829. g_pMainWnd->ProcessChatMessageRequest2(filter);
  8830. if (g_bSendOK == 0)return;
  8831. CArray<CStringArray, CStringArray>sparray;
  8832. CArray<CStringArray, CStringArray>clientarray;
  8833. DataToArray(&g_List1array, &sparray, &clientarray);
  8834. CString spno;
  8835. CStringArray sparray2;
  8836. for ( i = 0; i < sparray.GetSize(); i++)
  8837. {
  8838. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8839. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8840. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8841. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8842. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8843. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8844. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8845. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8846. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8847. }
  8848. for (i = 0; i < sparray.GetSize(); i++)
  8849. {
  8850. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8851. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8852. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8853. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8854. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8855. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8856. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8857. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8858. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8859. }
  8860. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8861. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8862. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8863. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8864. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8865. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8866. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8867. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8868. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8869. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8870. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8871. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8872. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8873. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8874. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8875. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8876. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8877. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8878. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  8879. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8880. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8881. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8882. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8883. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8884. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8885. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8886. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8887. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8888. CString m_sum3;
  8889. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8890. ::ConvertToPrice(m_sum3);
  8891. if (m_money3.IsEmpty())m_money3 = "0";
  8892. int dty = 0;
  8893. CString name;
  8894. if (!m_name1.IsEmpty())
  8895. name = m_name1 + ",";
  8896. name += m_name2;
  8897. name.TrimRight(",");
  8898. CString phone;
  8899. if (!m_phone1.IsEmpty())
  8900. phone = m_phone1 + ",";
  8901. phone += m_phone2; phone.TrimRight(",");
  8902. if (IsHasRights2new(31) == 0)
  8903. phone = "***";
  8904. CStringArray strarray;
  8905. CArray<CRect, CRect>rcarray;
  8906. CStringArray strarray2; CArray<CRect, CRect>rc2array;
  8907. int bottom;
  8908. if ((bb == 0 && bSecondPage == 0))
  8909. {
  8910. #ifdef CHILD_VERSION
  8911. if (m_birthday.IsEmpty())
  8912. strarray.Add("姓名/性别");
  8913. else
  8914. strarray.Add("姓名/性别/年龄");
  8915. #else
  8916. strarray.Add("客人姓名"); // 第3.1区域 -3.显示客人姓名;
  8917. #endif
  8918. strarray.Add("电话");
  8919. strarray.Add("单号");
  8920. strarray.Add("套系");
  8921. strarray.Add("选样");
  8922. strarray.Add("余款/加挑");
  8923. strarray.Add("选片/日期");
  8924. #ifdef CHILD_VERSION
  8925. if (m_birthday.IsEmpty())
  8926. strarray.Add(name + "/" + m_sex);
  8927. else
  8928. {
  8929. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8930. m_birthday.Format("%d", year + 1);
  8931. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8932. }
  8933. #else
  8934. strarray.Add(name); // 第4.1区域 -3.显示客人姓名;
  8935. #endif
  8936. strarray.Add(phone);
  8937. strarray.Add(strOrderNumber);
  8938. strarray.Add(m_taoxiname);
  8939. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8940. strarray.Add(str);
  8941. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8942. strarray.Add(str);
  8943. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8944. for (i = 3; i <= 16; i++)
  8945. {
  8946. // ■■■■■■从18.lia中获取第3~16的区域大小;
  8947. StrRect = load.m_rcarray.ElementAt(i - 1);
  8948. if (i < 10)
  8949. {
  8950. m_Print.DrawRect2(StrRect, 1);
  8951. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8952. }
  8953. }
  8954. // ■■■■■■从18.lia中获取第30的区域大小;
  8955. StrRect = load.m_rcarray.ElementAt(29);
  8956. m_Print.DrawRect2(StrRect, 1);
  8957. BOOL bPrintDate = 1;
  8958. #ifdef DDF_VERSION
  8959. // bPrintDate=0;
  8960. #else
  8961. if (m_time5 == "" && m_time6 == "")
  8962. bPrintDate = 0;
  8963. #endif
  8964. if (bPrintDate)
  8965. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8966. else
  8967. {
  8968. #ifdef CHILD_VERSION
  8969. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/引导", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8970. #else
  8971. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/化妆", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8972. #endif
  8973. }
  8974. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138))) // [version].[reverse3]
  8975. {
  8976. Image *pImg = NULL;
  8977. g_nSendCode = 31;
  8978. int g_nYearposTemp = g_nYearpos;
  8979. g_nYearpos = -1;
  8980. g_pMainWnd->ProcessChatMessageRequest2(1);
  8981. g_nYearpos = g_nYearposTemp;
  8982. g_nSendCode = 0;
  8983. if (g_bSendOK == 0)return;
  8984. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8985. // Jeff二维码的区域不是从18.lia里获取的,是固定在右上角指定区域;
  8986. if (pImg)
  8987. {
  8988. StrRect.left = 485;
  8989. StrRect.top = 12;
  8990. StrRect.right = StrRect.left + 60;
  8991. StrRect.bottom = StrRect.top + 60;
  8992. m_Print.DrawImage(pImg, StrRect);
  8993. delete pImg; pImg = NULL;
  8994. }
  8995. }
  8996. // CArray<CRect,CRect>rcarray;
  8997. // CStringArray strarray2;
  8998. // ■■■■■■从18.lia中获取第10的区域大小;
  8999. for (i = 10; i <= 16; i++)
  9000. {
  9001. StrRect = load.m_rcarray.ElementAt(i - 1);
  9002. StrRect.left += 2;
  9003. StrRect.right -= 2;
  9004. StrRect.top += 2;
  9005. rcarray.Add(StrRect);
  9006. strarray2.Add(strarray.ElementAt(7 + i - 10));
  9007. }
  9008. if (1)
  9009. {
  9010. // ■■■■■■从18.lia中获取第31的区域大小;
  9011. StrRect = load.m_rcarray.ElementAt(30);
  9012. StrRect.left += 2;
  9013. StrRect.right -= 2;
  9014. StrRect.top += 2;
  9015. rcarray.Add(StrRect);
  9016. if (bPrintDate)
  9017. strarray2.Add(m_time6 + "/" + m_time5);
  9018. else
  9019. {
  9020. strarray2.Add(m_waiter1 + "/" + m_waiter2);
  9021. }
  9022. }
  9023. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  9024. for (i = 10; i <= 16; i++)
  9025. {
  9026. StrRect = load.m_rcarray.ElementAt(i - 1);
  9027. if (i == 10)
  9028. {
  9029. dty += bottom - StrRect.bottom;
  9030. }
  9031. StrRect.bottom = bottom;
  9032. m_Print.DrawRect2(StrRect, 1);
  9033. }
  9034. if (1)
  9035. {
  9036. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  9037. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  9038. }
  9039. m_Print.SetFontFace(15, 1, "宋体");
  9040. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  9041. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9042. }
  9043. int curypos = 0;
  9044. int oldpos = 0;
  9045. if (bb == 1)
  9046. {
  9047. dty = -100;
  9048. oldpos = nPrintedPos;
  9049. if (oldpos == 0)oldpos = 10000;
  9050. }
  9051. m_Print.SetFontFace(9, 1, "宋体");
  9052. strarray.RemoveAll();
  9053. if ((oldpos != 10000 && oldpos < sparray2.GetSize()) || bb == 0)
  9054. {
  9055. strarray.Add("产品名称");
  9056. strarray.Add("数量");
  9057. strarray.Add("照片编号");
  9058. for (i = 18; i <= 20; i++)
  9059. {
  9060. StrRect = load.m_rcarray.ElementAt(i - 1);
  9061. StrRect.top += dty;
  9062. StrRect.bottom += dty;
  9063. m_Print.DrawRect2(StrRect, 1);
  9064. StrRect.left += 2;
  9065. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9066. StrRect.left -= 2;
  9067. StrRect.top = StrRect.bottom;
  9068. StrRect.bottom += 18;
  9069. rc2array.Add(StrRect);
  9070. }
  9071. }
  9072. for (i = oldpos; i < sparray2.GetSize(); i += 3)
  9073. {
  9074. rcarray.RemoveAll();
  9075. strarray2.RemoveAll();
  9076. for ( j = 0; j < 3; j++)
  9077. {
  9078. StrRect = rc2array.ElementAt(j);
  9079. StrRect.left += 2;
  9080. StrRect.right -= 2;
  9081. StrRect.top += 2;
  9082. rcarray.Add(StrRect);
  9083. #if JEFF_TEST_ON
  9084. if (2 == j)
  9085. {
  9086. CString strImg = sparray2.ElementAt(i + 2);
  9087. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  9088. if (nImgCount != 0)
  9089. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  9090. else if (!strImg.IsEmpty())
  9091. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  9092. strarray2.Add(strImg);
  9093. }
  9094. else
  9095. strarray2.Add(sparray2.ElementAt(i + j));
  9096. #else
  9097. strarray2.Add(sparray2.ElementAt(i + j));
  9098. #endif
  9099. }
  9100. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9101. rcarray.RemoveAll();
  9102. for (j = 0; j < 3; j++)
  9103. {
  9104. StrRect = rc2array.ElementAt(j);
  9105. if (j == 0)
  9106. {
  9107. dty += bottom - StrRect.bottom;
  9108. }
  9109. StrRect.bottom = bottom;
  9110. m_Print.DrawRect2(StrRect, 1);
  9111. curypos = StrRect.bottom;
  9112. StrRect.top = StrRect.bottom;
  9113. StrRect.bottom += 18;
  9114. rcarray.Add(StrRect);
  9115. }
  9116. rc2array.RemoveAll();
  9117. rc2array.Copy(rcarray);
  9118. if (bottom > 750)
  9119. {
  9120. bSecondPage = 1;
  9121. nPrintedPos = i + 3;
  9122. break;
  9123. }
  9124. }
  9125. if ((bb == 0 && bSecondPage == 0) || (bb == 1 && bSecondPage == 1))
  9126. {
  9127. m_Print.SetFontFace(15, 1, "宋体");
  9128. StrRect = load.m_rcarray.ElementAt(20);
  9129. dty = curypos - StrRect.bottom + 35;
  9130. StrRect.top += dty;
  9131. StrRect.bottom += dty;
  9132. if (StrRect.bottom > 700 && bb == 0)
  9133. {
  9134. bSecondPage = 1;
  9135. }
  9136. else
  9137. {
  9138. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9139. m_Print.SetFontFace(9, 1, "宋体");
  9140. rcarray.RemoveAll();
  9141. strarray2.RemoveAll();
  9142. StrRect = load.m_rcarray.ElementAt(21);
  9143. StrRect.top += dty;
  9144. StrRect.bottom += dty;
  9145. StrRect.left += 2;
  9146. StrRect.right -= 2;
  9147. StrRect.top += 2;
  9148. rcarray.Add(StrRect);
  9149. #if JEFF_TEST_ON
  9150. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9151. strarray2.RemoveAll();
  9152. CString strFind = "要求:";
  9153. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  9154. do
  9155. {
  9156. int nIndex = strbz3.Find(strFind, 1);
  9157. if (nIndex != -1)
  9158. {
  9159. CString strbz = strbz3.Left(nIndex);
  9160. strbz3 = strbz3.Mid(nIndex);
  9161. strarray2.Add(strbz);
  9162. }
  9163. else
  9164. {
  9165. strarray2.Add(strbz3);
  9166. strbz3 = "";
  9167. }
  9168. } while (strbz3.Find(strFind) != -1);
  9169. strarray2.Add(g_List1array.ElementAt(0).ElementAt(29));
  9170. strarray2.Add(g_List1array.ElementAt(0).ElementAt(23));
  9171. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  9172. #else
  9173. strarray2.Add(m_bz);
  9174. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9175. #endif
  9176. StrRect = load.m_rcarray.ElementAt(21);
  9177. StrRect.top += dty;
  9178. StrRect.bottom += dty;
  9179. dty += bottom - StrRect.bottom;
  9180. StrRect.bottom = bottom;
  9181. m_Print.DrawRect2(StrRect, 1);
  9182. curypos = StrRect.bottom;
  9183. m_Print.SetFontFace(10, 1, "宋体");
  9184. StrRect = load.m_rcarray.ElementAt(22);
  9185. dty = curypos - StrRect.bottom + 25;
  9186. StrRect.top += dty;
  9187. StrRect.bottom += dty;
  9188. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  9189. if (m_edit9.IsEmpty())
  9190. {
  9191. m_edit9 = "\
  9192. 经确认后的照片均排入制作流程,\r\n\
  9193. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9194. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9195. }
  9196. CString info1, info2, info3;
  9197. int newlinepos = m_edit9.Find("\r\n");
  9198. if (newlinepos != -1)
  9199. {
  9200. info1 = m_edit9.Left(newlinepos);
  9201. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9202. }
  9203. newlinepos = m_edit9.Find("\r\n");
  9204. if (newlinepos != -1)
  9205. {
  9206. info2 = m_edit9.Left(newlinepos);
  9207. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9208. info3 = m_edit9;
  9209. }
  9210. #ifdef QCH_VERSION
  9211. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9212. StrRect = load.m_rcarray.ElementAt(23);
  9213. StrRect.top += dty; StrRect.bottom += dty;
  9214. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9215. StrRect=load.m_rcarray .ElementAt (24);
  9216. StrRect.top +=dty;StrRect.bottom +=dty;
  9217. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9218. StrRect.top +=15;
  9219. StrRect.bottom +=15;
  9220. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9221. #else
  9222. if (1)
  9223. {
  9224. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9225. StrRect = load.m_rcarray.ElementAt(23);
  9226. StrRect.top += dty; StrRect.bottom += dty;
  9227. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9228. StrRect = load.m_rcarray.ElementAt(24);
  9229. StrRect.top += dty; StrRect.bottom += dty;
  9230. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9231. }
  9232. else
  9233. {
  9234. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9235. StrRect = load.m_rcarray.ElementAt(23);
  9236. StrRect.top += dty; StrRect.bottom += dty;
  9237. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9238. StrRect = load.m_rcarray.ElementAt(24);
  9239. StrRect.top += dty; StrRect.bottom += dty;
  9240. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9241. }
  9242. StrRect.top += 15;
  9243. StrRect.bottom += 15;
  9244. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9245. #endif
  9246. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  9247. StrRect = load.m_rcarray.ElementAt(25);
  9248. StrRect.top += dty - dy;
  9249. StrRect.bottom += dty - dy;
  9250. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9251. StrRect = load.m_rcarray.ElementAt(26);
  9252. StrRect.top += dty - dy;
  9253. StrRect.bottom += dty - dy;
  9254. m_Print.DrawRect2(StrRect, 2);
  9255. StrRect = load.m_rcarray.ElementAt(25);
  9256. StrRect.top += dty + 15 - dy;
  9257. StrRect.bottom += dty + 15 - dy;
  9258. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9259. StrRect = load.m_rcarray.ElementAt(26);
  9260. StrRect.top += dty + 15 - dy;
  9261. StrRect.bottom += dty + 15 - dy;
  9262. m_Print.DrawRect2(StrRect, 2);
  9263. StrRect = load.m_rcarray.ElementAt(25);
  9264. StrRect.top += dty + 15 * 2 - dy;
  9265. StrRect.bottom += dty + 15 * 2 - dy;
  9266. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9267. StrRect = load.m_rcarray.ElementAt(26);
  9268. StrRect.top += dty + 15 * 2 - dy;
  9269. StrRect.bottom += dty + 15 * 2 - dy;
  9270. m_Print.DrawRect2(StrRect, 2);
  9271. }
  9272. }
  9273. PrintPreview dlg; dlg.m_mode = 2;
  9274. dlg.m_name = name;
  9275. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  9276. dlg.m_pDC = m_Print.GetPDC();
  9277. if (aa == 0)
  9278. {
  9279. if (dlg.DoModal() != IDOK)
  9280. return;
  9281. printcot = dlg.m_num;
  9282. }
  9283. //结束打印
  9284. m_Print.EndPage();
  9285. m_Print.EndPrint();
  9286. }
  9287. }
  9288. }
  9289. void CMainFrame::PrintFlowChart3_20151116(CString strOrderNumber) // 选片打单 风格2;
  9290. {
  9291. #ifdef LKAY_VERSION
  9292. PrintFlowChart3LKAY(strOrderNumber);
  9293. return;
  9294. #endif
  9295. int i = 0;
  9296. int j = 0;
  9297. int printcot = 1;
  9298. for (int aa = 0; aa < printcot; aa++)
  9299. {
  9300. BOOL bSecondPage = 0;
  9301. int nPrintedPos = 0;
  9302. for (int bb = 0; bb < 3; bb++)
  9303. {
  9304. if (bb && bSecondPage == 0)break;
  9305. CPrintRX m_Print;
  9306. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58))) // 58-[version].[setcheck1] ==1,使用默认打印机;
  9307. {
  9308. m_Print.InitToPrint(NULL, 1);
  9309. }
  9310. else // 否则使用指定的打印机;
  9311. {
  9312. CString name = g_cominfoarray.ElementAt(0).ElementAt(64); // 64-[version].[printer2] 制作单打印机;
  9313. if (name.IsEmpty())
  9314. m_Print.InitToPrint(NULL, 1);
  9315. else
  9316. {
  9317. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9318. if (nret == -1 && aa == 0)
  9319. {
  9320. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9321. }
  9322. }
  9323. }
  9324. m_Print.StartPrint();
  9325. m_Print.StartPage();
  9326. LoadRect load;
  9327. load.SetLiaPath("18.lia");
  9328. load.SetMargins(10, 0);
  9329. if (!load.Load())return;
  9330. CString str;
  9331. int rcpos = -1;
  9332. // ■■■■■■从18.lia获取到第一个区域大小 - 1.显示店名;
  9333. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  9334. if ((bb == 0 && bSecondPage == 0))
  9335. {
  9336. m_Print.SetFontFace(25, 1, "宋体");
  9337. // 10-[version].[info1] 店名;
  9338. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9339. m_Print.SetFontFace(15, 1, "宋体");
  9340. // ■■■■■■从18.lia获取第二个区域大小 - 2.显示"基本资料";
  9341. StrRect = load.m_rcarray.ElementAt(++rcpos);
  9342. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9343. m_Print.SetFontFace(9, 1, "宋体");
  9344. }
  9345. //////////////////////////////////////////////////////////////////////////
  9346. // 获取打印所需要的数据,并布局好;
  9347. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  9348. g_sendhead.code[0] = 54; // dindan;
  9349. g_sendhead.code[1] = 223; // dindanspview2; shangpin+dindansp;
  9350. g_sendhead.code[2] = 52; // client;
  9351. g_sendhead.tabcount = 3;
  9352. g_sendhead.bsql = 0;
  9353. g_pMainWnd->ProcessChatMessageRequest2(filter);
  9354. if (g_bSendOK == 0)return;
  9355. CArray<CStringArray, CStringArray>sparray;
  9356. CArray<CStringArray, CStringArray>clientarray;
  9357. DataToArray(&g_List1array, &sparray, &clientarray);
  9358. CString spno;
  9359. CStringArray sparray2;
  9360. for ( i = 0; i < sparray.GetSize(); i++)
  9361. {
  9362. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  9363. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  9364. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  9365. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9366. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  9367. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9368. sparray2.Add(sparray.ElementAt(i).ElementAt(5)); // 商品名称;
  9369. sparray2.Add(sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  9370. sparray2.Add(sparray.ElementAt(i).ElementAt(6)); // 选中的相片串;
  9371. sparray2.Add(sparray.ElementAt(i).ElementAt(10)); // 商品备注;
  9372. }
  9373. for (i = 0; i < sparray.GetSize(); i++)
  9374. {
  9375. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  9376. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  9377. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  9378. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9379. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  9380. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9381. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+"); // 商品名称;
  9382. sparray2.Add(sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  9383. sparray2.Add(sparray.ElementAt(i).ElementAt(6)); // 选中的相片串;
  9384. sparray2.Add(sparray.ElementAt(i).ElementAt(10)); // 商品备注;
  9385. }
  9386. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  9387. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  9388. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  9389. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  9390. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  9391. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  9392. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  9393. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  9394. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  9395. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  9396. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  9397. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  9398. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  9399. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  9400. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  9401. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  9402. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  9403. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  9404. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9405. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  9406. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  9407. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  9408. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  9409. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  9410. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  9411. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  9412. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  9413. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  9414. CString m_sum3;
  9415. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  9416. ::ConvertToPrice(m_sum3);
  9417. if (m_money3.IsEmpty())m_money3 = "0";
  9418. int dty = 0;
  9419. CString name;
  9420. if (!m_name1.IsEmpty())
  9421. name = m_name1 + ",";
  9422. name += m_name2;
  9423. name.TrimRight(",");
  9424. CString phone;
  9425. if (!m_phone1.IsEmpty())
  9426. phone = m_phone1 + ",";
  9427. phone += m_phone2; phone.TrimRight(",");
  9428. if (IsHasRights2new(31) == 0)
  9429. phone = "***";
  9430. CStringArray strarray;
  9431. CArray<CRect, CRect>rcarray;
  9432. CStringArray strarray2; CArray<CRect, CRect>rc2array;
  9433. int bottom;
  9434. //////////////////////////////////////////////////////////////////////////
  9435. // 开始画打印DC;
  9436. if ((bb == 0 && bSecondPage == 0))
  9437. {
  9438. #ifdef CHILD_VERSION
  9439. if (m_birthday.IsEmpty())
  9440. strarray.Add("姓名/性别");
  9441. else
  9442. strarray.Add("姓名/性别/年龄");
  9443. #else
  9444. strarray.Add("客人姓名"); // 第3.1区域 -3.显示客人姓名;
  9445. #endif
  9446. strarray.Add("电话");
  9447. strarray.Add("单号");
  9448. strarray.Add("套系");
  9449. strarray.Add("选样");
  9450. strarray.Add("余款/加挑");
  9451. strarray.Add("选片/日期");
  9452. #ifdef CHILD_VERSION
  9453. if (m_birthday.IsEmpty())
  9454. strarray.Add(name + "/" + m_sex);
  9455. else
  9456. {
  9457. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  9458. m_birthday.Format("%d", year + 1);
  9459. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  9460. }
  9461. #else
  9462. strarray.Add(name); // 第4.1区域 -3.显示客人姓名;
  9463. #endif
  9464. strarray.Add(phone);
  9465. strarray.Add(strOrderNumber);
  9466. strarray.Add(m_taoxiname);
  9467. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9468. strarray.Add(str);
  9469. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  9470. strarray.Add(str);
  9471. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  9472. for (i = 3; i <= 16; i++)
  9473. {
  9474. // ■■■■■■从18.lia中获取第3~16的区域大小;
  9475. StrRect = load.m_rcarray.ElementAt(i - 1);
  9476. if (i < 10)
  9477. {
  9478. m_Print.DrawRect2(StrRect, 1);
  9479. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9480. }
  9481. }
  9482. // ■■■■■■从18.lia中获取第30的区域大小;
  9483. StrRect = load.m_rcarray.ElementAt(29);
  9484. m_Print.DrawRect2(StrRect, 1);
  9485. BOOL bPrintDate = 1;
  9486. #ifdef DDF_VERSION
  9487. // bPrintDate=0;
  9488. #else
  9489. if (m_time5 == "" && m_time6 == "")
  9490. bPrintDate = 0;
  9491. #endif
  9492. if (bPrintDate)
  9493. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9494. else
  9495. {
  9496. #ifdef CHILD_VERSION
  9497. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/引导", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9498. #else
  9499. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/化妆", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9500. #endif
  9501. }
  9502. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138))) // [version].[reverse3]
  9503. {
  9504. Image *pImg = NULL;
  9505. g_nSendCode = 31;
  9506. int g_nYearposTemp = g_nYearpos;
  9507. g_nYearpos = -1;
  9508. g_pMainWnd->ProcessChatMessageRequest2(1);
  9509. g_nYearpos = g_nYearposTemp;
  9510. g_nSendCode = 0;
  9511. if (g_bSendOK == 0)return;
  9512. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  9513. // Jeff二维码的区域不是从18.lia里获取的,是固定在右上角指定区域;
  9514. if (pImg)
  9515. {
  9516. StrRect.left = 485;
  9517. StrRect.top = 12;
  9518. StrRect.right = StrRect.left + 60;
  9519. StrRect.bottom = StrRect.top + 60;
  9520. m_Print.DrawImage(pImg, StrRect);
  9521. delete pImg; pImg = NULL;
  9522. }
  9523. }
  9524. // CArray<CRect,CRect>rcarray;
  9525. // CStringArray strarray2;
  9526. // ■■■■■■从18.lia中获取第10的区域大小;
  9527. for (i = 10; i <= 16; i++)
  9528. {
  9529. StrRect = load.m_rcarray.ElementAt(i - 1);
  9530. StrRect.left += 2;
  9531. StrRect.right -= 2;
  9532. StrRect.top += 2;
  9533. rcarray.Add(StrRect);
  9534. strarray2.Add(strarray.ElementAt(7 + i - 10));
  9535. }
  9536. if (1)
  9537. {
  9538. // ■■■■■■从18.lia中获取第31的区域大小;
  9539. StrRect = load.m_rcarray.ElementAt(30);
  9540. StrRect.left += 2;
  9541. StrRect.right -= 2;
  9542. StrRect.top += 2;
  9543. rcarray.Add(StrRect);
  9544. if (bPrintDate)
  9545. strarray2.Add(m_time6 + "/" + m_time5);
  9546. else
  9547. {
  9548. strarray2.Add(m_waiter1 + "/" + m_waiter2);
  9549. }
  9550. }
  9551. int bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  9552. for (i = 10; i <= 16; i++)
  9553. {
  9554. StrRect = load.m_rcarray.ElementAt(i - 1);
  9555. if (i == 10)
  9556. {
  9557. dty += bottom - StrRect.bottom;
  9558. }
  9559. StrRect.bottom = bottom;
  9560. m_Print.DrawRect2(StrRect, 1);
  9561. }
  9562. if (1)
  9563. {
  9564. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  9565. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  9566. }
  9567. m_Print.SetFontFace(15, 1, "宋体");
  9568. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  9569. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9570. }
  9571. int curypos = 0;
  9572. int oldpos = 0;
  9573. if (bb == 1)
  9574. {
  9575. dty = -100;
  9576. oldpos = nPrintedPos;
  9577. if (oldpos == 0)oldpos = 10000;
  9578. }
  9579. m_Print.SetFontFace(9, 1, "宋体");
  9580. strarray.RemoveAll();
  9581. if ((oldpos != 10000 && oldpos < sparray2.GetSize()) || bb == 0)
  9582. {
  9583. strarray.Add("产品名称");
  9584. strarray.Add("数量");
  9585. strarray.Add("照片编号");
  9586. strarray.Add(_T("备注"));
  9587. CRect mycr[4] = {
  9588. CRect(39,172,130,189), // 产品名称;
  9589. CRect(130,172,157,189), // 产品数量;
  9590. CRect(157,172,407,189), // 相片;
  9591. CRect(407,172,546,189) // 备注;
  9592. };
  9593. for (i = 0; i <= 3; i++)
  9594. {
  9595. StrRect = mycr[i];
  9596. StrRect.top += dty;
  9597. StrRect.bottom += dty;
  9598. m_Print.DrawRect2(StrRect, 1);
  9599. StrRect.left += 2;
  9600. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9601. StrRect.left -= 2;
  9602. StrRect.top = StrRect.bottom;
  9603. StrRect.bottom += 18;
  9604. rc2array.Add(StrRect);
  9605. }
  9606. }
  9607. for (i = oldpos; i < sparray2.GetSize(); i += 4)
  9608. {
  9609. rcarray.RemoveAll();
  9610. strarray2.RemoveAll();
  9611. for ( j = 0; j < 4; j++)
  9612. {
  9613. StrRect = rc2array.ElementAt(j);
  9614. StrRect.left += 2;
  9615. StrRect.right -= 2;
  9616. StrRect.top += 2;
  9617. rcarray.Add(StrRect);
  9618. #if JEFF_TEST_ON
  9619. if (2 == j)
  9620. {
  9621. CString strImg = sparray2.ElementAt(i + 2);
  9622. //int nImgCount = strImg.Replace(",", ",");
  9623. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  9624. if (nImgCount != 0)
  9625. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  9626. else if (!strImg.IsEmpty())
  9627. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  9628. strarray2.Add(strImg);
  9629. }
  9630. else
  9631. strarray2.Add(sparray2.ElementAt(i + j));
  9632. #else
  9633. strarray2.Add(sparray2.ElementAt(i + j));
  9634. #endif
  9635. }
  9636. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9637. rcarray.RemoveAll();
  9638. for (j = 0; j < 4; j++)
  9639. {
  9640. StrRect = rc2array.ElementAt(j);
  9641. if (j == 0)
  9642. {
  9643. dty += bottom - StrRect.bottom;
  9644. }
  9645. StrRect.bottom = bottom;
  9646. m_Print.DrawRect2(StrRect, 1);
  9647. curypos = StrRect.bottom;
  9648. StrRect.top = StrRect.bottom;
  9649. StrRect.bottom += 18;
  9650. rcarray.Add(StrRect);
  9651. }
  9652. rc2array.RemoveAll();
  9653. rc2array.Copy(rcarray);
  9654. if (bottom > 750)
  9655. {
  9656. bSecondPage = 1;
  9657. nPrintedPos = i + 3;
  9658. break;
  9659. }
  9660. }
  9661. if ((bb == 0 && bSecondPage == 0) || (bb == 1 && bSecondPage == 1))
  9662. {
  9663. m_Print.SetFontFace(15, 1, "宋体");
  9664. StrRect = load.m_rcarray.ElementAt(20);
  9665. dty = curypos - StrRect.bottom + 35;
  9666. StrRect.top += dty;
  9667. StrRect.bottom += dty;
  9668. if (StrRect.bottom > 700 && bb == 0)
  9669. {
  9670. bSecondPage = 1;
  9671. }
  9672. else
  9673. {
  9674. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9675. m_Print.SetFontFace(9, 1, "宋体");
  9676. rcarray.RemoveAll();
  9677. strarray2.RemoveAll();
  9678. StrRect = load.m_rcarray.ElementAt(21);
  9679. StrRect.top += dty;
  9680. StrRect.bottom += dty;
  9681. StrRect.left += 2;
  9682. StrRect.right -= 2;
  9683. StrRect.top += 2;
  9684. rcarray.Add(StrRect);
  9685. #if JEFF_TEST_ON
  9686. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9687. strarray2.RemoveAll();
  9688. CString strFind = "要求:";
  9689. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  9690. do
  9691. {
  9692. int nIndex = strbz3.Find(strFind, 1);
  9693. if (nIndex != -1)
  9694. {
  9695. CString strbz = strbz3.Left(nIndex);
  9696. strbz3 = strbz3.Mid(nIndex);
  9697. strarray2.Add(strbz);
  9698. }
  9699. else
  9700. {
  9701. strarray2.Add(strbz3);
  9702. strbz3 = "";
  9703. }
  9704. } while (strbz3.Find(strFind) != -1);
  9705. strarray2.Add(g_List1array.ElementAt(0).ElementAt(29));
  9706. strarray2.Add(g_List1array.ElementAt(0).ElementAt(23));
  9707. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  9708. #else
  9709. strarray2.Add(m_bz);
  9710. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9711. #endif
  9712. StrRect = load.m_rcarray.ElementAt(21);
  9713. StrRect.top += dty;
  9714. StrRect.bottom += dty;
  9715. dty += bottom - StrRect.bottom;
  9716. StrRect.bottom = bottom;
  9717. m_Print.DrawRect2(StrRect, 1);
  9718. curypos = StrRect.bottom;
  9719. m_Print.SetFontFace(10, 1, "宋体");
  9720. StrRect = load.m_rcarray.ElementAt(22);
  9721. dty = curypos - StrRect.bottom + 25;
  9722. StrRect.top += dty;
  9723. StrRect.bottom += dty;
  9724. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  9725. if (m_edit9.IsEmpty())
  9726. {
  9727. m_edit9 = "\
  9728. 经确认后的照片均排入制作流程,\r\n\
  9729. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9730. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9731. }
  9732. CString info1, info2, info3;
  9733. int newlinepos = m_edit9.Find("\r\n");
  9734. if (newlinepos != -1)
  9735. {
  9736. info1 = m_edit9.Left(newlinepos);
  9737. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9738. }
  9739. newlinepos = m_edit9.Find("\r\n");
  9740. if (newlinepos != -1)
  9741. {
  9742. info2 = m_edit9.Left(newlinepos);
  9743. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9744. info3 = m_edit9;
  9745. }
  9746. #ifdef QCH_VERSION
  9747. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9748. StrRect = load.m_rcarray.ElementAt(23);
  9749. StrRect.top += dty; StrRect.bottom += dty;
  9750. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9751. StrRect=load.m_rcarray .ElementAt (24);
  9752. StrRect.top +=dty;StrRect.bottom +=dty;
  9753. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9754. StrRect.top +=15;
  9755. StrRect.bottom +=15;
  9756. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9757. #else
  9758. if (1)
  9759. {
  9760. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9761. StrRect = load.m_rcarray.ElementAt(23);
  9762. StrRect.top += dty; StrRect.bottom += dty;
  9763. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9764. StrRect = load.m_rcarray.ElementAt(24);
  9765. StrRect.top += dty; StrRect.bottom += dty;
  9766. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9767. }
  9768. else
  9769. {
  9770. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9771. StrRect = load.m_rcarray.ElementAt(23);
  9772. StrRect.top += dty; StrRect.bottom += dty;
  9773. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9774. StrRect = load.m_rcarray.ElementAt(24);
  9775. StrRect.top += dty; StrRect.bottom += dty;
  9776. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9777. }
  9778. StrRect.top += 15;
  9779. StrRect.bottom += 15;
  9780. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9781. #endif
  9782. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  9783. StrRect = load.m_rcarray.ElementAt(25);
  9784. StrRect.top += dty - dy;
  9785. StrRect.bottom += dty - dy;
  9786. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9787. StrRect = load.m_rcarray.ElementAt(26);
  9788. StrRect.top += dty - dy;
  9789. StrRect.bottom += dty - dy;
  9790. m_Print.DrawRect2(StrRect, 2);
  9791. StrRect = load.m_rcarray.ElementAt(25);
  9792. StrRect.top += dty + 15 - dy;
  9793. StrRect.bottom += dty + 15 - dy;
  9794. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9795. StrRect = load.m_rcarray.ElementAt(26);
  9796. StrRect.top += dty + 15 - dy;
  9797. StrRect.bottom += dty + 15 - dy;
  9798. m_Print.DrawRect2(StrRect, 2);
  9799. StrRect = load.m_rcarray.ElementAt(25);
  9800. StrRect.top += dty + 15 * 2 - dy;
  9801. StrRect.bottom += dty + 15 * 2 - dy;
  9802. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9803. StrRect = load.m_rcarray.ElementAt(26);
  9804. StrRect.top += dty + 15 * 2 - dy;
  9805. StrRect.bottom += dty + 15 * 2 - dy;
  9806. m_Print.DrawRect2(StrRect, 2);
  9807. }
  9808. }
  9809. PrintPreview dlg; dlg.m_mode = 2;
  9810. dlg.m_name = name;
  9811. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  9812. dlg.m_pDC = m_Print.GetPDC();
  9813. if (aa == 0)
  9814. {
  9815. if (dlg.DoModal() != IDOK)
  9816. return;
  9817. printcot = dlg.m_num;
  9818. }
  9819. //结束打印
  9820. m_Print.EndPage();
  9821. m_Print.EndPrint();
  9822. }
  9823. }
  9824. }
  9825. //void CMainFrame::PrintFlowChart4(CString m_id) // 选设计打单函数;
  9826. void CMainFrame::PrintFlowChart4(CString strOrderNumber) // 选设计打单函数,使用18.lia文件;
  9827. {
  9828. int i = 0;
  9829. int j = 0;
  9830. int printcot = 1;
  9831. for (int aa = 0; aa < printcot; aa++)
  9832. {
  9833. CPrintRX m_Print;
  9834. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  9835. {
  9836. m_Print.InitToPrint(NULL, 1);
  9837. }
  9838. else
  9839. {
  9840. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  9841. if (name.IsEmpty())
  9842. m_Print.InitToPrint(NULL, 1);
  9843. else
  9844. {
  9845. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9846. if (nret == -1 && aa == 0)
  9847. {
  9848. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9849. }
  9850. }
  9851. }
  9852. m_Print.StartPrint();
  9853. m_Print.StartPage();
  9854. LoadRect load;
  9855. load.SetLiaPath("18.lia");
  9856. load.SetMargins(10, 0);
  9857. if (!load.Load())return;
  9858. CString str;
  9859. int rcpos = -1;
  9860. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  9861. m_Print.SetFontFace(25, 1, "宋体");
  9862. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9863. m_Print.SetFontFace(15, 1, "宋体");
  9864. StrRect = load.m_rcarray.ElementAt(++rcpos);
  9865. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9866. m_Print.SetFontFace(9, 1, "宋体");
  9867. //////////////////////////////////////////////////////////////
  9868. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  9869. g_sendhead.code[0] = 54;
  9870. g_sendhead.code[1] = 223;
  9871. g_sendhead.code[2] = 52;
  9872. g_sendhead.tabcount = 3;
  9873. g_sendhead.bsql = 0;
  9874. g_pMainWnd->ProcessChatMessageRequest2(filter);
  9875. if (g_bSendOK == 0)return;
  9876. CArray<CStringArray, CStringArray>sparray;
  9877. CArray<CStringArray, CStringArray>clientarray;
  9878. DataToArray(&g_List1array, &sparray, &clientarray);
  9879. CString spno;
  9880. CStringArray sparray2;
  9881. for ( i = 0; i < sparray.GetSize(); i++)
  9882. {
  9883. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  9884. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(8).IsEmpty())continue;
  9885. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9886. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9887. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  9888. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9889. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9890. }
  9891. for (i = 0; i < sparray.GetSize(); i++)
  9892. {
  9893. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  9894. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  9895. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  9896. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9897. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9898. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  9899. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9900. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9901. }
  9902. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  9903. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  9904. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  9905. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  9906. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  9907. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  9908. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  9909. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  9910. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  9911. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  9912. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  9913. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  9914. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  9915. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  9916. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  9917. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  9918. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  9919. CString m_bz = g_List1array.ElementAt(0).ElementAt(17);
  9920. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(25);
  9921. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  9922. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  9923. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  9924. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  9925. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  9926. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  9927. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  9928. CString m_waiter8 = g_List1array.ElementAt(0).ElementAt(27);
  9929. CString m_replace = g_List1array.ElementAt(0).ElementAt(28);
  9930. if (!m_replace.IsEmpty())
  9931. {
  9932. m_replace = "设计替换照片:" + m_replace;
  9933. m_replace.Replace("$", ";");
  9934. m_replace.TrimLeft(";");
  9935. m_bz += ";";
  9936. m_bz += m_replace;
  9937. }
  9938. CString m_sum3;
  9939. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  9940. ::ConvertToPrice(m_sum3);
  9941. if (m_money3.IsEmpty())m_money3 = "0";
  9942. int dty = 0;
  9943. CString name;
  9944. if (!m_name1.IsEmpty())
  9945. name = m_name1 + ",";
  9946. name += m_name2;
  9947. name.TrimRight(",");
  9948. CString phone;
  9949. if (!m_phone1.IsEmpty())
  9950. phone = m_phone1 + ",";
  9951. phone += m_phone2; phone.TrimRight(",");
  9952. if (IsHasRights2new(31) == 0)
  9953. phone = "***";
  9954. CStringArray strarray;
  9955. #ifdef CHILD_VERSION
  9956. if (m_birthday.IsEmpty())
  9957. strarray.Add("姓名/性别");
  9958. else
  9959. strarray.Add("姓名/性别/年龄");
  9960. #else
  9961. strarray.Add("客人姓名");
  9962. #endif
  9963. strarray.Add("电话");
  9964. strarray.Add("单号");
  9965. strarray.Add("套系");
  9966. strarray.Add("");
  9967. strarray.Add("余款/加挑");
  9968. strarray.Add("看设计/日期");
  9969. #ifdef CHILD_VERSION
  9970. if (m_birthday.IsEmpty())
  9971. strarray.Add(name + "/" + m_sex);
  9972. else
  9973. {
  9974. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  9975. m_birthday.Format("%d", year + 1);
  9976. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  9977. }
  9978. #else
  9979. strarray.Add(name);
  9980. #endif
  9981. strarray.Add(phone);
  9982. strarray.Add(strOrderNumber);
  9983. strarray.Add(m_taoxiname);
  9984. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9985. strarray.Add("");
  9986. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  9987. strarray.Add(str);
  9988. strarray.Add(m_waiter8 + "/" + m_time6);
  9989. //////////////////////////////////////////////
  9990. if (1)
  9991. {
  9992. StrRect = load.m_rcarray.ElementAt(6);
  9993. int addwid = StrRect.Width() / 6;
  9994. for (i = 3; i <= 6; i++)
  9995. {
  9996. StrRect = load.m_rcarray.ElementAt(i - 1);
  9997. StrRect.left += (i - 3)*addwid;
  9998. StrRect.right += (i - 2)*addwid;
  9999. load.m_rcarray.SetAt(i - 1, StrRect);
  10000. }
  10001. StrRect.left = StrRect.right = -1;
  10002. load.m_rcarray.SetAt(6, StrRect);
  10003. for (i = 10; i <= 13; i++)
  10004. {
  10005. StrRect = load.m_rcarray.ElementAt(i - 1);
  10006. StrRect.left += (i - 10)*addwid;
  10007. StrRect.right += (i - 9)*addwid;
  10008. load.m_rcarray.SetAt(i - 1, StrRect);
  10009. }
  10010. StrRect.left = StrRect.right = -1;
  10011. load.m_rcarray.SetAt(13, StrRect);
  10012. StrRect = load.m_rcarray.ElementAt(7);
  10013. int rcwid = StrRect.Width();
  10014. StrRect.left = load.m_rcarray.ElementAt(5).right;
  10015. StrRect.right = StrRect.left + rcwid + addwid;
  10016. load.m_rcarray.SetAt(7, StrRect);
  10017. StrRect = load.m_rcarray.ElementAt(8);
  10018. StrRect.left = load.m_rcarray.ElementAt(7).right;
  10019. StrRect.right = load.m_rcarray.ElementAt(29).left;
  10020. load.m_rcarray.SetAt(8, StrRect);
  10021. StrRect = load.m_rcarray.ElementAt(14);
  10022. rcwid = StrRect.Width();
  10023. StrRect.left = load.m_rcarray.ElementAt(12).right;
  10024. StrRect.right = StrRect.left + rcwid + addwid;
  10025. load.m_rcarray.SetAt(14, StrRect);
  10026. StrRect = load.m_rcarray.ElementAt(15);
  10027. StrRect.left = load.m_rcarray.ElementAt(14).right;
  10028. StrRect.right = load.m_rcarray.ElementAt(29).left;
  10029. load.m_rcarray.SetAt(15, StrRect);
  10030. }
  10031. ////////////////////////////////////////////////
  10032. for (i = 3; i <= 16; i++)
  10033. {
  10034. StrRect = load.m_rcarray.ElementAt(i - 1);
  10035. if (i < 10)
  10036. {
  10037. m_Print.DrawRect2(StrRect, 1);
  10038. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10039. }
  10040. }
  10041. StrRect = load.m_rcarray.ElementAt(29);
  10042. m_Print.DrawRect2(StrRect, 1);
  10043. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10044. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  10045. {
  10046. Image *pImg = NULL;
  10047. g_nSendCode = 31;
  10048. int g_nYearposTemp = g_nYearpos;
  10049. g_nYearpos = -1;
  10050. g_pMainWnd->ProcessChatMessageRequest2(1);
  10051. g_nYearpos = g_nYearposTemp;
  10052. g_nSendCode = 0;
  10053. if (g_bSendOK == 0)return;
  10054. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  10055. if (pImg)
  10056. {
  10057. StrRect.left = 485;
  10058. StrRect.top = 12;
  10059. StrRect.right = StrRect.left + 60;
  10060. StrRect.bottom = StrRect.top + 60;
  10061. m_Print.DrawImage(pImg, StrRect);
  10062. delete pImg; pImg = NULL;
  10063. }
  10064. }
  10065. CArray<CRect, CRect>rcarray;
  10066. CStringArray strarray2;
  10067. for (i = 10; i <= 16; i++)
  10068. {
  10069. StrRect = load.m_rcarray.ElementAt(i - 1);
  10070. StrRect.left += 2;
  10071. StrRect.right -= 2;
  10072. StrRect.top += 2;
  10073. rcarray.Add(StrRect);
  10074. strarray2.Add(strarray.ElementAt(7 + i - 10));
  10075. }
  10076. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  10077. for (i = 10; i <= 16; i++)
  10078. {
  10079. StrRect = load.m_rcarray.ElementAt(i - 1);
  10080. if (i == 10)
  10081. {
  10082. dty += bottom - StrRect.bottom;
  10083. }
  10084. StrRect.bottom = bottom;
  10085. m_Print.DrawRect2(StrRect, 1);
  10086. }
  10087. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  10088. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  10089. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time5, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  10090. m_Print.SetFontFace(15, 1, "宋体");
  10091. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  10092. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10093. m_Print.SetFontFace(9, 1, "宋体");
  10094. strarray.RemoveAll();
  10095. strarray.Add("产品名称");
  10096. strarray.Add("数量");
  10097. strarray.Add("照片编号");
  10098. CArray<CRect, CRect>rc2array;
  10099. for (i = 18; i <= 20; i++)
  10100. {
  10101. StrRect = load.m_rcarray.ElementAt(i - 1); StrRect.top += dty; StrRect.bottom += dty;
  10102. m_Print.DrawRect2(StrRect, 1);
  10103. StrRect.left += 2;
  10104. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10105. StrRect.left -= 2;
  10106. StrRect.top = StrRect.bottom;
  10107. StrRect.bottom += 18;
  10108. rc2array.Add(StrRect);
  10109. }
  10110. int curypos = 0;
  10111. for (i = 0; i < sparray2.GetSize(); i += 3)
  10112. {
  10113. rcarray.RemoveAll();
  10114. strarray2.RemoveAll();
  10115. for ( j = 0; j < 3; j++)
  10116. {
  10117. StrRect = rc2array.ElementAt(j);
  10118. StrRect.left += 2;
  10119. StrRect.right -= 2;
  10120. StrRect.top += 2;
  10121. rcarray.Add(StrRect);
  10122. #if JEFF_TEST_ON
  10123. if (2 == j)
  10124. {
  10125. CString strImg = sparray2.ElementAt(i + 2);
  10126. //int nImgCount = strImg.Replace(",", ",");
  10127. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  10128. if (nImgCount != 0)
  10129. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  10130. else if (!strImg.IsEmpty())
  10131. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  10132. strarray2.Add(strImg);
  10133. }
  10134. else
  10135. strarray2.Add(sparray2.ElementAt(i + j));
  10136. #else
  10137. strarray2.Add(sparray2.ElementAt(i + j));
  10138. #endif
  10139. }
  10140. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  10141. rcarray.RemoveAll();
  10142. for (j = 0; j < 3; j++)
  10143. {
  10144. StrRect = rc2array.ElementAt(j);
  10145. if (j == 0)
  10146. {
  10147. dty += bottom - StrRect.bottom;
  10148. }
  10149. StrRect.bottom = bottom;
  10150. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  10151. StrRect.top = StrRect.bottom;
  10152. StrRect.bottom += 18;
  10153. rcarray.Add(StrRect);
  10154. }
  10155. rc2array.RemoveAll();
  10156. rc2array.Copy(rcarray);
  10157. }
  10158. m_Print.SetFontFace(15, 1, "宋体");
  10159. StrRect = load.m_rcarray.ElementAt(20);
  10160. dty = curypos - StrRect.bottom + 35;
  10161. StrRect.top += dty; StrRect.bottom += dty;
  10162. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10163. m_Print.SetFontFace(9, 1, "宋体");
  10164. rcarray.RemoveAll();
  10165. strarray2.RemoveAll();
  10166. StrRect = load.m_rcarray.ElementAt(21);
  10167. StrRect.top += dty;
  10168. StrRect.bottom += dty;
  10169. StrRect.left += 2;
  10170. StrRect.right -= 2;
  10171. StrRect.top += 2;
  10172. rcarray.Add(StrRect);
  10173. #if JEFF_TEST_ON
  10174. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  10175. strarray2.RemoveAll();
  10176. CString strFind = "要求:";
  10177. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  10178. do
  10179. {
  10180. int nIndex = strbz3.Find(strFind, 1);
  10181. if (nIndex != -1)
  10182. {
  10183. CString strbz = strbz3.Left(nIndex);
  10184. strbz3 = strbz3.Mid(nIndex);
  10185. strarray2.Add(strbz);
  10186. }
  10187. else
  10188. {
  10189. strarray2.Add(strbz3);
  10190. strbz3 = "";
  10191. }
  10192. } while (strbz3.Find(strFind) != -1);
  10193. strarray2.Add(g_List1array.ElementAt(0).ElementAt(25));
  10194. if (!m_replace.IsEmpty())
  10195. {
  10196. m_replace = "设计替换照片:" + m_replace;
  10197. m_replace.Replace("$", ";");
  10198. m_replace.TrimLeft(";");
  10199. }
  10200. strarray2.Add(m_replace);
  10201. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  10202. #else
  10203. strarray2.Add(m_bz);
  10204. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  10205. #endif
  10206. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  10207. dty += bottom - StrRect.bottom;
  10208. StrRect.bottom = bottom;
  10209. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  10210. m_Print.SetFontFace(10, 1, "宋体");
  10211. StrRect = load.m_rcarray.ElementAt(22);
  10212. dty = curypos - StrRect.bottom + 25;
  10213. StrRect.top += dty; StrRect.bottom += dty;
  10214. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  10215. if (m_edit9.IsEmpty())
  10216. {
  10217. m_edit9 = "\
  10218. 经确认后的照片均排入制作流程,\r\n\
  10219. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  10220. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  10221. }
  10222. CString info1, info2, info3;
  10223. int newlinepos = m_edit9.Find("\r\n");
  10224. if (newlinepos != -1)
  10225. {
  10226. info1 = m_edit9.Left(newlinepos);
  10227. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  10228. }
  10229. newlinepos = m_edit9.Find("\r\n");
  10230. if (newlinepos != -1)
  10231. {
  10232. info2 = m_edit9.Left(newlinepos);
  10233. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  10234. info3 = m_edit9;
  10235. }
  10236. if (1)
  10237. {
  10238. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10239. StrRect = load.m_rcarray.ElementAt(23);
  10240. StrRect.top += dty; StrRect.bottom += dty;
  10241. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10242. StrRect = load.m_rcarray.ElementAt(24);
  10243. StrRect.top += dty; StrRect.bottom += dty;
  10244. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10245. }
  10246. else
  10247. {
  10248. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10249. StrRect = load.m_rcarray.ElementAt(23);
  10250. StrRect.top += dty; StrRect.bottom += dty;
  10251. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10252. StrRect = load.m_rcarray.ElementAt(24);
  10253. StrRect.top += dty; StrRect.bottom += dty;
  10254. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10255. }
  10256. StrRect = load.m_rcarray.ElementAt(25);
  10257. StrRect.top += dty; StrRect.bottom += dty;
  10258. m_Print.DrawText((LPTSTR)(LPCTSTR)"贵宾签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10259. StrRect = load.m_rcarray.ElementAt(26);
  10260. StrRect.top += dty; StrRect.bottom += dty;
  10261. m_Print.DrawRect2(StrRect, 2);
  10262. m_Print.SetFontFace(9, 1, "宋体");
  10263. StrRect = load.m_rcarray.ElementAt(27);
  10264. StrRect.top += dty; StrRect.bottom += dty;
  10265. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10266. StrRect = load.m_rcarray.ElementAt(28);
  10267. StrRect.top += dty; StrRect.bottom += dty;
  10268. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10269. PrintPreview dlg;//dlg.m_mode=2;
  10270. dlg.m_name = name;
  10271. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  10272. dlg.m_pDC = m_Print.GetPDC();
  10273. if (aa == 0)
  10274. {
  10275. if (dlg.DoModal() != IDOK)
  10276. return;
  10277. printcot = dlg.m_num;
  10278. }
  10279. //结束打印
  10280. m_Print.EndPage();
  10281. m_Print.EndPrint();
  10282. }
  10283. }
  10284. /*
  10285. void CMainFrame::PrintFlowChart(CString m_id)
  10286. {
  10287. CPrintRX m_Print;
  10288. m_Print.InitToPrint(NULL, 1);
  10289. m_Print.StartPrint();
  10290. m_Print.StartPage();
  10291. // CRect StrRect(0,0,560,818);
  10292. LoadRect load;
  10293. load.SetLiaPath ("4.lia");
  10294. load.SetMargins(-14,-14);
  10295. if(!load.Load ())return;
  10296. LoadRect load2;
  10297. load2.SetMargins(-14,472+27-14);
  10298. load2.SetLiaPath ("5.lia");
  10299. if(!load2.Load ())return;
  10300. //////////////////////////////////////////////////////////////
  10301. CString filter="id='"+m_id+"';id='"+m_id+"'";
  10302. g_sendhead.code[0]=54;
  10303. g_sendhead.code[1]=50;
  10304. g_sendhead.tabcount=2;
  10305. g_sendhead.bsql=0;
  10306. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  10307. CArray<CStringArray, CStringArray>sparray;
  10308. DataToArray(&g_List1array,&sparray);
  10309. CString spno;
  10310. for(int i=0; i<sparray.GetSize (); i++)
  10311. {
  10312. if(sparray.ElementAt (i).ElementAt (4)=="4" && sparray.ElementAt (i).ElementAt (5)!="入册")continue;
  10313. if(sparray.ElementAt (i).ElementAt (5)=="入册"&&sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  10314. spno+=sparray.ElementAt (i).ElementAt (5);
  10315. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  10316. spno+=";";
  10317. else
  10318. {
  10319. spno+=":";
  10320. spno+=sparray.ElementAt (i).ElementAt (6);
  10321. spno+=";";
  10322. }
  10323. }
  10324. spno+=" 加挑:";
  10325. for( i=0; i<sparray.GetSize (); i++)
  10326. {
  10327. if(sparray.ElementAt (i).ElementAt (4)!="4")continue;
  10328. if(sparray.ElementAt (i).ElementAt (5)=="入册")continue;
  10329. spno+=sparray.ElementAt (i).ElementAt (5);
  10330. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  10331. spno+=";";
  10332. else
  10333. {
  10334. spno+=":";
  10335. spno+=sparray.ElementAt (i).ElementAt (6);
  10336. spno+=";";
  10337. }
  10338. }
  10339. if(spno.Right (6)==" 加挑:")
  10340. {
  10341. spno=spno.Left (spno.GetLength ()-6);
  10342. }
  10343. CString m_name1 = g_List1array.ElementAt (0).ElementAt (1);
  10344. CString m_name2 = g_List1array.ElementAt (0).ElementAt (2);
  10345. CString m_phone1=g_List1array.ElementAt (0).ElementAt (3);
  10346. CString m_phone2=g_List1array.ElementAt (0).ElementAt (4);
  10347. CString m_urgent=g_List1array.ElementAt (0).ElementAt (5);
  10348. if(m_urgent.IsEmpty ())m_urgent="否";
  10349. CString m_time2 = g_List1array.ElementAt (0).ElementAt (6);
  10350. CString m_time4 = g_List1array.ElementAt (0).ElementAt (7);
  10351. CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  10352. CString m_takezs = g_List1array.ElementAt (0).ElementAt (9);
  10353. CString m_taoxizs = g_List1array.ElementAt (0).ElementAt (10);
  10354. CString m_choosezs = g_List1array.ElementAt (0).ElementAt (11);
  10355. CString m_ren = g_List1array.ElementAt (0).ElementAt (12);
  10356. CString m_waiter3 = g_List1array.ElementAt (0).ElementAt (13);
  10357. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (14);
  10358. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (15);
  10359. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (16);
  10360. CString m_bz = "客人要求: "+g_List1array.ElementAt (0).ElementAt (17);
  10361. CString m_money3 = g_List1array.ElementAt (0).ElementAt (18);
  10362. CString m_money1 = g_List1array.ElementAt (0).ElementAt (19);
  10363. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (20);
  10364. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (21);
  10365. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (22);
  10366. CString m_sum3;
  10367. m_sum3.Format ("%0.2f", atof(m_taoxijiage)+atof(m_payed4)-(atof(m_payed5)+atof(m_money1)));
  10368. ::ConvertToPrice (m_sum3);
  10369. if(m_money3.IsEmpty ())m_money3="0";
  10370. // m_money3=m_money3+"/"+m_sum3;
  10371. CString name;
  10372. if(!m_name1.IsEmpty ())
  10373. name=m_name1+",";
  10374. name+=m_name2;
  10375. name.TrimRight (",");
  10376. CString phone;
  10377. if(!m_phone1.IsEmpty ())
  10378. phone=m_phone1+",";
  10379. phone+=m_phone2;phone.TrimRight (",");
  10380. CStringArray strarray;
  10381. strarray.Add (m_urgent);
  10382. strarray.Add (m_ren);
  10383. strarray.Add (m_waiter3);
  10384. strarray.Add (name);
  10385. strarray.Add (m_time2);
  10386. strarray.Add (m_time4);
  10387. strarray.Add (m_time5);
  10388. strarray.Add (m_money3);
  10389. strarray.Add (m_takezs);
  10390. strarray.Add (m_taoxizs);
  10391. strarray.Add (m_choosezs);
  10392. strarray.Add (m_id);
  10393. strarray.Add (phone);
  10394. ////////////////////////////////////////////////////////////////
  10395. int rcpos=-1;
  10396. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  10397. Image *pImg=NULL;
  10398. #ifdef MNLS_VERSION
  10399. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG") );
  10400. #else
  10401. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  10402. #endif
  10403. m_Print.DrawImage(pImg, StrRect);
  10404. delete pImg;
  10405. m_Print.SetFontFace(15, 1, "宋体");
  10406. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10407. #ifdef MNLS_VERSION
  10408. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10409. #endif
  10410. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10411. #ifdef MNLS_VERSION
  10412. m_Print.DrawRect(StrRect);
  10413. #endif
  10414. m_Print.SetFontFace(7, 1, "黑体");
  10415. m_Print.SetColor(0xffffff);
  10416. #ifdef MNLS_VERSION
  10417. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10418. #endif
  10419. m_Print.SetColor(0);
  10420. m_Print.SetFontFace(25, 1, "黑体");
  10421. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10422. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10423. CString title[13]={"是否加急:","接单门市:","选样人员:","新郎新娘姓名:","拍照日期:","选片日期:","取件日期:","加挑/余款:","拍摄总张数:","应挑选张数:","额外加挑张数:","票号:","客户联系电话:"};
  10424. m_Print.SetFontFace(12, 1, "宋体");
  10425. for( i=0; i<13; i++)
  10426. {
  10427. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10428. if(i<3)
  10429. m_Print.DrawRect2(StrRect, 0);
  10430. else
  10431. m_Print.DrawRect2(StrRect, 1);
  10432. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10433. }
  10434. for( i=18; i<=37; i++)
  10435. {
  10436. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10437. if(i>=19&&i<=21)
  10438. m_Print.DrawRect2(StrRect, 2);
  10439. else if(i==26)
  10440. {
  10441. CRect rc=StrRect;
  10442. CRect rc2=rc;
  10443. rc.right -=rc2.Width ()/2;
  10444. m_Print.DrawRect2(rc, 1);
  10445. rc2.left +=rc.Width ();
  10446. m_Print.DrawRect2(rc2, 1);
  10447. }
  10448. else
  10449. m_Print.DrawRect2(StrRect, 1);
  10450. if(i==18)
  10451. {
  10452. StrRect.left +=5;
  10453. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10454. }
  10455. }
  10456. //////////////////////////////////////
  10457. rcpos=-1;
  10458. for( i=0; i<8; i++)
  10459. {
  10460. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10461. m_Print.DrawRect2(StrRect, 1);
  10462. }
  10463. CString title2[4]={"化妆师:","摄影师:","数码设计师:","顾客签名:"};
  10464. for( i=0; i<4; i++)
  10465. {
  10466. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10467. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10468. }
  10469. for( i=0; i<4; i++)
  10470. {
  10471. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10472. m_Print.DrawRect2(StrRect, 2);
  10473. }
  10474. ///////////////////////////////////////////
  10475. for( i=19; i<=31; i++)
  10476. {
  10477. StrRect=load.m_rcarray .ElementAt (i-1);
  10478. StrRect.left +=4;
  10479. if(i==31)
  10480. {
  10481. if(m_phone1.IsEmpty ()==0 && m_phone2.IsEmpty ()==0)
  10482. {
  10483. StrRect.top +=2;
  10484. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  10485. StrRect.top +=8;
  10486. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10487. }
  10488. else
  10489. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10490. }
  10491. else if((i-19)==7)
  10492. {
  10493. CRect rc=StrRect;
  10494. CRect rc2=rc;
  10495. rc.right -=rc2.Width ()/2;
  10496. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10497. rc2.left +=rc.Width ()+3;
  10498. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10499. }
  10500. else
  10501. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10502. }
  10503. strarray.RemoveAll ();
  10504. strarray.Add (m_waiter2);
  10505. strarray.Add (m_waiter1);
  10506. strarray.Add (m_waiter4);
  10507. for( i=13; i<=15; i++)
  10508. {
  10509. StrRect=load2.m_rcarray .ElementAt (i-1);
  10510. StrRect.left +=4;
  10511. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10512. }
  10513. ///////////spno
  10514. CRect sprc[14];
  10515. for(i=0; i<14; i++)
  10516. {
  10517. if(i<7)
  10518. {
  10519. if(i==0)
  10520. {
  10521. StrRect=load.m_rcarray .ElementAt (17);StrRect.left +=94;StrRect.right -=3;
  10522. }
  10523. else
  10524. {
  10525. StrRect=load.m_rcarray .ElementAt (30+i);StrRect.left +=4;StrRect.right -=3;
  10526. }
  10527. }
  10528. else
  10529. {
  10530. StrRect=load2.m_rcarray .ElementAt (i-7);StrRect.left +=4;StrRect.right -=3;
  10531. }
  10532. sprc[i]=StrRect;
  10533. // m_Print.DrawText((LPTSTR)(LPCTSTR)"xxx", sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10534. }
  10535. CString temp,tempspno,tempbz;
  10536. CSize size;
  10537. BOOL bRun=0;
  10538. int fontsize=12;
  10539. ll: tempspno=spno;
  10540. tempbz=m_bz;
  10541. m_Print.SetFontFace(fontsize, 1, "宋体");
  10542. for( i=0; i<14; i++)
  10543. {
  10544. if(!tempspno.IsEmpty ())
  10545. {
  10546. temp=tempspno;
  10547. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10548. int right=0;
  10549. CRect temprc=sprc[i];
  10550. while(size.cx>temprc.Width ())
  10551. {
  10552. right++;
  10553. temp=tempspno.Left (tempspno.GetLength ()-(right));
  10554. if(GIsHalfHZ(temp))
  10555. {
  10556. right++;
  10557. temp.Delete (temp.GetLength ()-1);
  10558. }
  10559. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10560. }
  10561. if(bRun)
  10562. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10563. tempspno=tempspno.Right (tempspno.GetLength ()-temp.GetLength ());
  10564. if(tempspno.IsEmpty ())i++;
  10565. }
  10566. else if(!tempbz.IsEmpty ())
  10567. {
  10568. temp=tempbz;
  10569. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10570. int right=0;
  10571. CRect temprc=sprc[i];
  10572. while(size.cx>temprc.Width ())
  10573. {
  10574. right++;
  10575. temp=tempbz.Left (tempbz.GetLength ()-(right));
  10576. if(GIsHalfHZ(temp))
  10577. {
  10578. right++;
  10579. temp.Delete (temp.GetLength ()-1);
  10580. }
  10581. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10582. }
  10583. if(bRun)
  10584. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10585. tempbz=tempbz.Right (tempbz.GetLength ()-temp.GetLength ());
  10586. }
  10587. }
  10588. if(tempspno.IsEmpty ()==0 || tempbz.IsEmpty ()==0)
  10589. {
  10590. fontsize--;
  10591. goto ll;
  10592. }
  10593. if(bRun==0)
  10594. {
  10595. bRun=1;
  10596. goto ll;
  10597. }
  10598. PrintPreview dlg;
  10599. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  10600. dlg.m_pDC =m_Print.GetPDC() ;
  10601. if(dlg.DoModal ()!=IDOK)return;
  10602. //结束打印
  10603. m_Print.EndPage();
  10604. m_Print.EndPrint();
  10605. }
  10606. void CMainFrame::SetSelFolder(int pos)
  10607. {
  10608. m_wndToolBar2.SetSelFolder(pos);
  10609. }*/
  10610. void CMainFrame::ToPhotoPrint()
  10611. {
  10612. UINT nID = 1;
  10613. LPSTR pName;
  10614. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  10615. OPEN_MENU(PhotoPrintFrom);
  10616. }
  10617. void CMainFrame::GetOcx()
  10618. {
  10619. char path[MAX_PATH];
  10620. ::GetSystemDirectory(path, MAX_PATH);
  10621. CString syspath = path;
  10622. try
  10623. {
  10624. if (!::PathFileExists(syspath + "\\MSCHRT20.OCX"))
  10625. {
  10626. g_sendhead.bsql = 0;
  10627. g_sendhead.code[0] = 103;
  10628. g_sendhead.tabcount = 1;
  10629. g_pMainWnd->ProcessChatMessageRequest2(1); if (g_bSendOK == 0)return;
  10630. CFile fp;
  10631. if (fp.Open(syspath + "\\MSCHRT20.OCX", CFile::modeWrite | CFile::modeCreate))
  10632. {
  10633. fp.Write(g_pData, g_nLeng);
  10634. fp.Close();
  10635. ::Sleep(1000);
  10636. }
  10637. }
  10638. CString temp;
  10639. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10640. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10641. }
  10642. catch (...)
  10643. {
  10644. }
  10645. try
  10646. {
  10647. CString temp;
  10648. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10649. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10650. }
  10651. catch (...)
  10652. {
  10653. }
  10654. }
  10655. void CMainFrame::OnServer()
  10656. {
  10657. // TODO: Add your command handler code here
  10658. DBConfig dlg;
  10659. dlg.DoModal();
  10660. }
  10661. void CMainFrame::OnPath()
  10662. {
  10663. // TODO: Add your command handler code here
  10664. if (g_user.bLongin == 0)
  10665. {
  10666. if (g_bNoLoginLia)
  10667. {
  10668. Login dlg;
  10669. dlg.SetLiaPath("5.lia");
  10670. dlg.DoModal();
  10671. }
  10672. else
  10673. {
  10674. Login3 dlg;
  10675. dlg.SetLiaPath("5.lia");
  10676. dlg.DoModal();
  10677. }
  10678. if (g_user.bLongin == 0)return;
  10679. }
  10680. if (IsHasRightsnew(49) == 0)return;
  10681. SetPathDlg2 dlg;
  10682. dlg.DoModal();
  10683. }
  10684. void CMainFrame::OnShowhis()
  10685. {
  10686. // TODO: Add your command handler code here
  10687. if (g_user.bLongin == 0)
  10688. {
  10689. if (g_bNoLoginLia)
  10690. {
  10691. Login dlg;
  10692. dlg.SetLiaPath("5.lia");
  10693. dlg.DoModal();
  10694. }
  10695. else
  10696. {
  10697. Login3 dlg;
  10698. dlg.SetLiaPath("5.lia");
  10699. dlg.DoModal();
  10700. }
  10701. if (g_user.bLongin == 0)return;
  10702. }
  10703. if (IsHasRightsnew(52) == 0)return;
  10704. CMenu *pMenu = GetMenu();
  10705. CMenu* submenu = pMenu->GetSubMenu(2);
  10706. UINT status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10707. if (status&MF_CHECKED)
  10708. {
  10709. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_UNCHECKED);
  10710. g_bShowOK = 1;
  10711. }
  10712. else
  10713. {
  10714. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  10715. g_bShowOK = 0;
  10716. } m_Mdi.CloseAll();
  10717. }
  10718. void CMainFrame::AddHistoryMenu(CArray<CStringArray, CStringArray>*hisyeararray) // 添加历史数据库菜单;
  10719. {
  10720. #ifdef NEW_SKIN
  10721. CMenu* m_menuXP = GetMenu();
  10722. CMenu* submenu = m_menuXP->GetSubMenu(2);
  10723. // 删除原有菜单;
  10724. int i = 0;
  10725. for ( i = 0; i < 100; i++)
  10726. {
  10727. submenu->DeleteMenu(1000 + i, MF_BYCOMMAND);
  10728. }
  10729. // 重创菜单,从资源ID1000开始;
  10730. for (i = 0; i < hisyeararray->GetSize(); i++)
  10731. {
  10732. submenu->AppendMenu(MF_STRING, 1000 + i, "查看历史数据:" + hisyeararray->ElementAt(i).ElementAt(0)); // 第一项菜单项;
  10733. }
  10734. g_nYearpos = -1;
  10735. #else
  10736. HMENU hMenu = ::GetMenu(m_hWnd);
  10737. m_menuXP.Attach(hMenu);
  10738. BCMenu* submenu = (BCMenu*)m_menuXP.GetSubMenu(2);
  10739. for (int i = 0; i < 100; i++)
  10740. {
  10741. submenu->DeleteMenu (1000+i, MF_BYCOMMAND);
  10742. }
  10743. for( i=0; i<hisyeararray->GetSize (); i++)
  10744. {
  10745. submenu->AppendMenu(MF_STRING, 1000+i, "查看历史数据:"+hisyeararray->ElementAt (i).ElementAt (0)); // 第一项菜单项
  10746. }
  10747. m_menuXP.Detach ();
  10748. g_nYearpos = -1;
  10749. #endif
  10750. }
  10751. /************************************************************************/
  10752. /*
  10753. Jeff
  10754. 函数:AddBranchMenu()
  10755. 参数:CArray<CStringArray, CStringArray> *branchArray
  10756. 返回:void
  10757. 注意:
  10758. 调用关系:
  10759. */
  10760. /************************************************************************/
  10761. void CMainFrame::AddBranchMenu(CArray<CStringArray, CStringArray>*branchArray)
  10762. {
  10763. //WriteTextLog("AddBranchMenu,添加集团版菜单");
  10764. #ifdef ENTERPRISE_VERSION
  10765. CMenu *m_menuXP = GetMenu();
  10766. CMenu* submenu = m_menuXP->GetSubMenu(0);
  10767. int i = 0;
  10768. for ( i = 0; i < 100; i++)
  10769. {
  10770. submenu->DeleteMenu(2000 + i, MF_BYCOMMAND);
  10771. }
  10772. g_menubranchname.RemoveAll();
  10773. CString name;
  10774. int a = 0;
  10775. #if 0 // Jeff.add for test
  10776. CString strCount;
  10777. strCount.Format("历史数据库个数=%d", branchArray->GetSize());
  10778. WriteTextLog(strCount);
  10779. #endif
  10780. for (i = 0; i < branchArray->GetSize() - 1; i++)
  10781. {
  10782. //WriteTextLog("111");
  10783. //WriteTextLog(hisyeararray->ElementAt(i).ElementAt(0));
  10784. //WriteTextLog(name);
  10785. if (name == "")
  10786. {
  10787. name = branchArray->ElementAt(i).ElementAt(0);
  10788. #ifndef SQLSERVER_VERSION
  10789. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10790. a++;
  10791. #endif
  10792. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10793. a++;
  10794. g_menubranchname.Add(name);
  10795. continue;
  10796. }
  10797. else if (branchArray->ElementAt(i).ElementAt(0).Find(name) != -1 && ((branchArray->ElementAt(i).ElementAt(0).GetLength() - name.GetLength()) == 4))
  10798. {
  10799. continue;
  10800. }
  10801. name = branchArray->ElementAt(i).ElementAt(0);
  10802. #ifndef SQLSERVER_VERSION
  10803. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10804. a++;
  10805. #endif
  10806. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10807. g_menubranchname.Add(name);
  10808. a++;
  10809. //WriteTextLog("222");
  10810. }
  10811. if ((branchArray->GetSize() - 1) > 0)
  10812. {
  10813. if (branchArray->ElementAt(0).ElementAt(3) == "总店")
  10814. submenu->AppendMenu(MF_STRING, 2000 + a, "多店数据汇总");
  10815. }
  10816. #endif
  10817. }
  10818. // Jeff:如果选择了历史数据库,则开单的数据会录入到该历史数据库中,而非当前数据库;
  10819. // g_nYearpos==-1,表示当前主数据库,其他>=0的值表示历史数据库在g_historydb中的索引值;
  10820. void CMainFrame::OnHistory(UINT nID) // 选择历史数据库菜单响应;
  10821. {
  10822. CMenu* pMenu = GetMenu();
  10823. CMenu* submenu = pMenu->GetSubMenu(2);
  10824. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10825. if (g_user.bLongin == 0)
  10826. {
  10827. if (g_bNoLoginLia)
  10828. {
  10829. Login dlg;
  10830. dlg.SetLiaPath("5.lia");
  10831. dlg.DoModal();
  10832. }
  10833. else
  10834. {
  10835. Login3 dlg;
  10836. dlg.SetLiaPath("5.lia");
  10837. dlg.DoModal();
  10838. }
  10839. if (g_user.bLongin == 0)return;
  10840. }
  10841. if (IsHasRightsnew(52) == 0)return;
  10842. m_Mdi.CloseAll();
  10843. for (int i = 0; i < 100; i++)
  10844. {
  10845. submenu->CheckMenuItem(1000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10846. }
  10847. if (status&MF_CHECKED)
  10848. {
  10849. g_nYearpos = -1;
  10850. status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10851. if (status&MF_CHECKED)
  10852. g_bShowOK = 0;
  10853. else
  10854. g_bShowOK = 1;
  10855. }
  10856. else
  10857. {
  10858. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10859. g_nYearpos = nID - 1000;
  10860. g_bShowOK = 1;
  10861. }
  10862. }
  10863. void CMainFrame::OnBranchData(UINT nID)
  10864. {
  10865. #ifdef ENTERPRISE_VERSION
  10866. #ifdef SQLSERVER_VERSION
  10867. OnBranchData2(nID);
  10868. return;
  10869. #endif
  10870. #endif
  10871. }
  10872. void CMainFrame::OnBranchData2(UINT nID)
  10873. {
  10874. #ifdef ENTERPRISE_VERSION
  10875. g_bAllBranch = 0;
  10876. m_Mdi.CloseAll();
  10877. OnDisconnect();
  10878. CMenu *pMenu = GetMenu();
  10879. CMenu* submenu = pMenu->GetSubMenu(0);
  10880. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10881. for (int i = 0; i < 100; i++)
  10882. {
  10883. submenu->CheckMenuItem(2000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10884. }
  10885. if (status&MF_CHECKED)
  10886. {
  10887. g_branchname.Empty();
  10888. g_branchip.Empty();
  10889. g_bBranchModify = 0;
  10890. g_user.bLongin = 0;
  10891. if (g_bNoLoginLia)
  10892. {
  10893. Login dlg;
  10894. dlg.SetLiaPath("5.lia");
  10895. dlg.DoModal();
  10896. }
  10897. else
  10898. {
  10899. Login3 dlg;
  10900. dlg.SetLiaPath("5.lia");
  10901. dlg.DoModal();
  10902. }
  10903. g_pMainWnd2->RefreshOutlookBar();
  10904. g_pMainWnd2->DrawLogin();
  10905. g_path1 = g_path1bak;
  10906. g_path2 = g_path2bak;
  10907. g_path3 = g_path3bak;
  10908. g_path4 = g_path4bak;
  10909. g_path5 = g_path5bak;
  10910. g_path6 = g_path6bak;
  10911. g_path7 = g_path7bak;
  10912. g_pMainWnd2->EnableBtns(1);
  10913. }
  10914. else
  10915. {
  10916. BOOL bNeedCheckRights = 1;
  10917. if (g_user.bLongin && g_branchname == "")//无需登陆本店判断其访问分店权限
  10918. {
  10919. bNeedCheckRights = 0;
  10920. }
  10921. #ifndef SQLSERVER_VERSION
  10922. if ((g_menubranchname.GetSize() * 2) == nID - 2000)//多店数据汇总
  10923. #else
  10924. if ((g_menubranchname.GetSize()) == nID - 2000)//多店数据汇总
  10925. #endif
  10926. {
  10927. g_branchname.Empty();
  10928. g_branchip.Empty();
  10929. g_bBranchModify = 0;
  10930. if (bNeedCheckRights)
  10931. {
  10932. g_user.bLongin = 0;
  10933. if (g_user.bLongin == 0)
  10934. {
  10935. if (g_bNoLoginLia)
  10936. {
  10937. Login dlg;
  10938. dlg.SetLiaPath("5.lia");
  10939. dlg.DoModal();
  10940. }
  10941. else
  10942. {
  10943. Login3 dlg;
  10944. dlg.SetLiaPath("5.lia");
  10945. dlg.DoModal();
  10946. }
  10947. if (g_user.bLongin == 0)return;
  10948. }
  10949. }
  10950. if (IsHasRightsnew(28) == 0)
  10951. {
  10952. return;
  10953. }
  10954. g_bAllBranch = 1; g_pMainWnd2->ShowBar(0);
  10955. g_pMainWnd2->RefreshOutlookBar2();
  10956. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10957. g_branchname.Empty();
  10958. g_branchip.Empty();
  10959. g_bBranchModify = 0;
  10960. g_pMainWnd2->DrawLogin();
  10961. g_pMainWnd2->EnableBtns(0);
  10962. g_path1 = g_path1bak;
  10963. g_path2 = g_path2bak;
  10964. g_path3 = g_path3bak;
  10965. g_path4 = g_path4bak;
  10966. g_path5 = g_path5bak;
  10967. g_path6 = g_path6bak;
  10968. g_path7 = g_path7bak;
  10969. }
  10970. else
  10971. {
  10972. if (bNeedCheckRights)
  10973. {
  10974. g_branchname.Empty();
  10975. g_branchip.Empty();
  10976. g_bBranchModify = 0;
  10977. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_UNCHECKED);
  10978. g_user.bLongin = 0;
  10979. if (g_pMainWnd2)
  10980. {
  10981. g_pMainWnd2->DrawLogin();
  10982. g_pMainWnd2->ShowBar(0);
  10983. }
  10984. if (g_bNoLoginLia)
  10985. {
  10986. Login dlg;
  10987. dlg.SetLiaPath("5.lia");
  10988. dlg.DoModal();
  10989. }
  10990. else
  10991. {
  10992. Login3 dlg;
  10993. dlg.SetLiaPath("5.lia");
  10994. dlg.DoModal();
  10995. }
  10996. if (g_user.bLongin == 0)return;
  10997. }
  10998. if (IsHasRightsnew(28) == 0)
  10999. {
  11000. return;
  11001. }
  11002. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  11003. #ifndef SQLSERVER_VERSION
  11004. if (nID % 2 == 0)
  11005. g_branchname = g_menubranchname.ElementAt((nID - 2000) / 2);
  11006. else
  11007. g_branchname = g_menubranchname.ElementAt((nID - 2001) / 2);
  11008. #else
  11009. g_branchname = g_menubranchname.ElementAt(nID - 2000);
  11010. #endif
  11011. //printf("选择分店:%s\n", g_branchname);
  11012. g_branchip.Empty();
  11013. CString domainname = "";
  11014. for (int i = 0; i < g_brancharray.GetSize(); i++)
  11015. {
  11016. /*
  11017. for(int j=0; j<g_brancharray.GetSize(); j++)
  11018. printf("%s\n", g_brancharray.ElementAt(i).ElementAt(j));
  11019. */
  11020. if (g_branchname == g_brancharray.ElementAt(i).ElementAt(0))
  11021. {
  11022. g_branchip = g_brancharray.ElementAt(i).ElementAt(1);
  11023. g_branchip2 = g_brancharray.ElementAt(i).ElementAt(4);
  11024. domainname = g_brancharray.ElementAt(i).ElementAt(2);
  11025. }
  11026. }
  11027. g_path1 = g_path1bak;
  11028. g_path2 = g_path2bak;
  11029. g_path3 = g_path3bak;
  11030. g_path4 = g_path4bak;
  11031. g_path5 = g_path5bak;
  11032. g_path6 = g_path6bak;
  11033. g_path7 = g_path7bak;
  11034. if (domainname.IsEmpty())
  11035. {
  11036. g_path1 = g_path2 = g_path3 = g_path4 = g_path5 = g_path6 = g_path7 = "xxx";
  11037. }
  11038. else
  11039. {
  11040. g_path1 += "\\" + domainname;
  11041. g_path2 += "\\" + domainname;
  11042. g_path3 += "\\" + domainname;
  11043. g_path4 += "\\" + domainname;
  11044. g_path5 += "\\" + domainname;
  11045. g_path6 += "\\" + domainname;
  11046. g_path7 += "\\" + domainname;
  11047. }
  11048. g_bBranchModify = 1;
  11049. /* CArray<CStringArray, CStringArray>yeararray;
  11050. for( i=0; i<g_brancharray.GetSize (); i++)
  11051. {
  11052. if(g_brancharray.ElementAt (i).ElementAt (0).Find (g_branchname)!=-1 && g_branchname!=g_brancharray.ElementAt (i).ElementAt (0))
  11053. {
  11054. int size=yeararray.GetSize ();
  11055. yeararray.SetSize(size+1,1);
  11056. CString str=g_brancharray.ElementAt (i).ElementAt (0);
  11057. str.Delete (0, g_branchname.GetLength ());
  11058. yeararray.ElementAt (size).Add (str);
  11059. }
  11060. }
  11061. AddHistoryMenu(&yeararray);*/
  11062. if (g_bBranchModify)OnDisconnect();
  11063. if (1)
  11064. {
  11065. g_user.bLongin = 0;
  11066. g_user.name.Empty();
  11067. g_user.rights.Empty();
  11068. g_user.account.Empty();
  11069. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  11070. g_pMainWnd2->RefreshOutlookBar();
  11071. m_Mdi.CloseAll();
  11072. if (g_pMainWnd2)
  11073. {
  11074. g_pMainWnd2->DrawLogin();
  11075. g_pMainWnd2->ShowBar(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. if (g_pMainWnd2)g_pMainWnd2->ShowBar(1);
  11091. }
  11092. g_pMainWnd2->DrawLogin();
  11093. g_pMainWnd2->EnableBtns(1);
  11094. }
  11095. g_nYearpos = -1;
  11096. }
  11097. #endif
  11098. }
  11099. void CMainFrame::OnStaffAchievementShow() //Jeff:此机只用于员工看业绩;
  11100. {
  11101. // TODO: Add your command handler code here
  11102. if (g_user.bLongin == 0) // 是否登陆系统;
  11103. {
  11104. if (g_bNoLoginLia)
  11105. {
  11106. Login dlg;
  11107. dlg.SetLiaPath("5.lia");
  11108. dlg.DoModal();
  11109. }
  11110. else
  11111. {
  11112. Login3 dlg;
  11113. dlg.SetLiaPath("5.lia");
  11114. dlg.DoModal();
  11115. }
  11116. if (g_user.bLongin == 0)return;
  11117. }
  11118. if (IsHasRightsnew(49) == 0)return;// 是否有权限进行设置;
  11119. CMenu *pMenu = GetMenu();
  11120. CMenu* submenu = pMenu->GetSubMenu(1);
  11121. UINT status = submenu->GetMenuState(IDM_StaffAchievementShow, MF_BYCOMMAND);
  11122. if (status&MF_CHECKED)
  11123. {
  11124. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_UNCHECKED);
  11125. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status2", 0);
  11126. g_bStaffAchievementShow = 0;
  11127. TCHAR szKey[MAX_PATH];
  11128. TCHAR szDir[MAX_PATH];
  11129. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  11130. HKEY hKey = 0;
  11131. DWORD disp = 0;
  11132. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  11133. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  11134. if (lResult == ERROR_SUCCESS)
  11135. {
  11136. RegDeleteValue(hKey, "YLGLMAINAUTORUN");
  11137. RegDeleteKey(hKey, "YLGLMAINAUTORUN");
  11138. RegCloseKey(hKey);
  11139. }
  11140. }
  11141. else
  11142. {
  11143. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  11144. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status2", 1);
  11145. g_bStaffAchievementShow = 1;
  11146. TCHAR szKey[MAX_PATH];
  11147. TCHAR szDir[MAX_PATH];
  11148. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  11149. HKEY hKey = 0;
  11150. DWORD disp = 0;
  11151. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  11152. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  11153. if (lResult == ERROR_SUCCESS)
  11154. {
  11155. lResult = RegSetValueEx(hKey, "YLGLMAINAUTORUN", 0, REG_SZ, (const unsigned char*)szDir, lstrlen(szDir));
  11156. RegCloseKey(hKey);
  11157. }
  11158. StaffAchievementSet dlg;
  11159. dlg.DoModal();
  11160. }
  11161. }
  11162. void CMainFrame::PrintDinDan2(CString m_id)
  11163. {
  11164. #ifdef MODERN_VERSION
  11165. SelContent seldlg;
  11166. if (seldlg.DoModal() != IDOK)return;
  11167. CPrintRX m_Print;
  11168. m_Print.InitToPrint(NULL, 1);
  11169. m_Print.StartPrint();
  11170. m_Print.StartPage();
  11171. // CRect StrRect(0,0,560,818);
  11172. LoadRect load;
  11173. LoadRect load2;
  11174. LoadRect load3;
  11175. load.SetLiaPath ("9.lia");
  11176. load.SetMargins(-14,0);
  11177. if(!load.Load ())return;
  11178. int i;
  11179. //////////////////////////////////////////////////////////////
  11180. CStringArray txarray;
  11181. CString filter="id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"'";
  11182. g_sendhead.code[0]=11;
  11183. g_sendhead.code[1]=52;
  11184. g_sendhead.code[2]=50;
  11185. g_sendhead.code[3]=38;
  11186. g_sendhead.code[4]=27;
  11187. g_sendhead.tabcount=5;
  11188. g_sendhead.bsql=0;
  11189. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  11190. CArray<CStringArray, CStringArray>sparray;
  11191. CArray<CStringArray, CStringArray>clientarray;
  11192. CArray<CStringArray, CStringArray>phonearray;
  11193. CArray<CStringArray, CStringArray>bukuan2array;
  11194. CArray<CStringArray, CStringArray>bukuanarray;
  11195. DataToArray(&g_List1array, &clientarray, &sparray, &bukuan2array, &bukuanarray);
  11196. CTime tm=CTime::GetCurrentTime ();
  11197. CString str;
  11198. CString m_money1 = g_List1array.ElementAt (0).ElementAt (1);
  11199. CString m_money2 = g_List1array.ElementAt (0).ElementAt (2);
  11200. CString m_money3 = g_List1array.ElementAt (0).ElementAt (3);
  11201. CString m_name1 = g_List1array.ElementAt (0).ElementAt (4);
  11202. CString m_name2 = g_List1array.ElementAt (0).ElementAt (5);
  11203. CString m_taoxiname= g_List1array.ElementAt (0).ElementAt (7);
  11204. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (8);
  11205. CString m_zs = g_List1array.ElementAt (0).ElementAt (9);
  11206. CString m_time1 = g_List1array.ElementAt (0).ElementAt (10);
  11207. CString m_time2 = g_List1array.ElementAt (0).ElementAt (11);
  11208. CString m_time3 = g_List1array.ElementAt (0).ElementAt (12);
  11209. CString m_ren = g_List1array.ElementAt (0).ElementAt (14);
  11210. CString m_discount = g_List1array.ElementAt (0).ElementAt (15);
  11211. CString m_payed1 = g_List1array.ElementAt (0).ElementAt (16);
  11212. CString m_payed2 = g_List1array.ElementAt (0).ElementAt (17);
  11213. CString m_payed3 = g_List1array.ElementAt (0).ElementAt (18);
  11214. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (19);
  11215. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (20);
  11216. CString m_time4 = g_List1array.ElementAt (0).ElementAt (21);
  11217. CString m_time5 = g_List1array.ElementAt (0).ElementAt (22);
  11218. CString m_clothescount = g_List1array.ElementAt (0).ElementAt (26);
  11219. CString m_clothescount2 = g_List1array.ElementAt (0).ElementAt (27);
  11220. CString m_outside = g_List1array.ElementAt (0).ElementAt (28);
  11221. CString m_outside2 = g_List1array.ElementAt (0).ElementAt (29);
  11222. CString m_style = g_List1array.ElementAt (0).ElementAt (30);
  11223. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (34);
  11224. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (35);
  11225. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (37);
  11226. CString m_bz = g_List1array.ElementAt (0).ElementAt (38);
  11227. CString m_phone1=clientarray.ElementAt (0).ElementAt (3);
  11228. CString m_phone2=clientarray.ElementAt (0).ElementAt (4);
  11229. CString m_addr1=clientarray.ElementAt (0).ElementAt (7);
  11230. CString m_addr2=clientarray.ElementAt (0).ElementAt (8);
  11231. CString m_occupation1=clientarray.ElementAt (0).ElementAt (9);
  11232. CString m_occupation2=clientarray.ElementAt (0).ElementAt (10);
  11233. filter="name='"+m_ren+"'";
  11234. g_sendhead.code[0]=5;
  11235. g_sendhead.tabcount=1;
  11236. g_sendhead.bsql=0;
  11237. int g_nYearposTemp=g_nYearpos;
  11238. g_nYearpos=-1;
  11239. g_pMainWnd->ProcessChatMessageRequest2(filter);
  11240. g_nYearpos=g_nYearposTemp;
  11241. if(g_bSendOK==0)return;
  11242. DataToArray(&phonearray);
  11243. m_money2.Format ("%f", atof(m_payed5)+atof(m_money1));
  11244. m_money1.Format ("%f", atof(m_taoxijiage)+atof(m_payed4));
  11245. m_money3.Format ("%f", atof(m_money1)-atof(m_money2));
  11246. ConvertToPrice(m_money1);
  11247. ConvertToPrice(m_money2);
  11248. ConvertToPrice(m_money3);
  11249. ////////////////////////////////////////////////////////////////
  11250. int rcpos=-1;
  11251. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  11252. Image *pImg=NULL;
  11253. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo2.jpg");
  11254. if(seldlg.m_bFrame)
  11255. m_Print.DrawImage(pImg, StrRect);
  11256. delete pImg;
  11257. m_Print.SetFontFace(16, 1, "黑体");
  11258. StrRect=load.m_rcarray .ElementAt (++rcpos);
  11259. if(seldlg.m_bFrame)
  11260. ///////////////////////////////不用改
  11261. m_Print.DrawText((LPTSTR)(LPCTSTR)"摩登新娘工作流程单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11262. m_Print.SetFontFace(10, 1, "宋体");
  11263. for( i=3; i<=6; i++)
  11264. {
  11265. StrRect=load.m_rcarray .ElementAt (i-1);
  11266. if(seldlg.m_bFrame)
  11267. m_Print.DrawRect2(StrRect, 1);
  11268. }
  11269. CStringArray strarray;
  11270. if(seldlg.m_bBooking==0)
  11271. {
  11272. m_name1.Empty ();
  11273. m_name2.Empty ();
  11274. m_phone1.Empty ();
  11275. m_phone2.Empty ();
  11276. m_addr1.Empty ();
  11277. m_addr2.Empty ();
  11278. m_taoxiname.Empty ();
  11279. m_taoxijiage.Empty ();
  11280. }
  11281. if(seldlg.m_bFrame )
  11282. {
  11283. strarray.Add("新郎:"+m_name1);
  11284. strarray.Add("H");
  11285. strarray.Add("O");
  11286. strarray.Add("手机:"+m_phone1);
  11287. strarray.Add("新娘:"+m_name2);
  11288. strarray.Add("H");
  11289. strarray.Add("O");
  11290. strarray.Add("手机:"+m_phone2);
  11291. }
  11292. else
  11293. {
  11294. strarray.Add(" "+m_name1);
  11295. strarray.Add("");
  11296. strarray.Add("");
  11297. strarray.Add(" "+m_phone1);
  11298. strarray.Add(" "+m_name2);
  11299. strarray.Add("");
  11300. strarray.Add("");
  11301. strarray.Add(" "+m_phone2);
  11302. }
  11303. for( i=7; i<=14; i++)
  11304. {
  11305. StrRect=load.m_rcarray .ElementAt (i-1);
  11306. StrRect.left +=2;
  11307. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11308. }
  11309. StrRect=load.m_rcarray .ElementAt (3);
  11310. StrRect.left +=2;
  11311. if(seldlg.m_bFrame)
  11312. str="地址:"+m_addr1;
  11313. else
  11314. str=" "+m_addr1;
  11315. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11316. StrRect=load.m_rcarray .ElementAt (5);
  11317. StrRect.left +=2;
  11318. if(seldlg.m_bFrame)
  11319. str="地址:"+m_addr2;
  11320. else
  11321. str=" "+m_addr2;
  11322. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11323. //////////////////////////////////////////////////////
  11324. StrRect=load.m_rcarray .ElementAt (14);
  11325. str="预\r\n约";
  11326. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11327. StrRect.top +=46;
  11328. StrRect.left +=2;
  11329. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11330. m_Print.SetFontFace(10, 1, "宋体");
  11331. StrRect=load.m_rcarray .ElementAt (15);
  11332. if(seldlg.m_bFrame)
  11333. str="套系名称:"+m_taoxiname;
  11334. else
  11335. str=" "+m_taoxiname;
  11336. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11337. StrRect.left +=4;
  11338. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11339. StrRect=load.m_rcarray .ElementAt (16);
  11340. if(seldlg.m_bFrame)
  11341. str="单价:"+m_taoxijiage;
  11342. else
  11343. str=" "+m_taoxijiage;
  11344. StrRect.left +=2;
  11345. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11346. StrRect=load.m_rcarray .ElementAt (21);
  11347. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11348. str="新人签名:";
  11349. StrRect.left +=2;
  11350. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11351. StrRect=load.m_rcarray .ElementAt (22);
  11352. if(seldlg.m_bBooking==0)
  11353. {
  11354. if(seldlg.m_bFrame)
  11355. str="未付款:";
  11356. else
  11357. str=" ";
  11358. }
  11359. else
  11360. {
  11361. if(seldlg.m_bFrame)
  11362. str="未付款:"+m_money3;
  11363. else
  11364. str=" "+m_money3;
  11365. }
  11366. StrRect.left +=2;
  11367. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11368. StrRect=load.m_rcarray .ElementAt (23);
  11369. str="结婚秘书:";
  11370. StrRect.left +=2;
  11371. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11372. StrRect=load.m_rcarray .ElementAt (24);
  11373. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11374. StrRect.left +=3;
  11375. StrRect.top +=3;
  11376. StrRect.right -=2;
  11377. StrRect.bottom -=2;
  11378. int realpos=0;str="";
  11379. for(i=0; i<sparray.GetSize (); i++)
  11380. {
  11381. if(atoi(sparray.ElementAt (i).ElementAt (4))!=1)continue;
  11382. str+=sparray.ElementAt (i).ElementAt (5);
  11383. str+=" 数量:";
  11384. str+=sparray.ElementAt (i).ElementAt (3);
  11385. if(realpos%2)
  11386. str+="\r\n";
  11387. else
  11388. str+=" ";
  11389. realpos++;
  11390. }
  11391. str.TrimRight ("\r\n");
  11392. str.TrimRight (" ");
  11393. if(seldlg.m_bBooking)AutoDraw(m_Print, StrRect, str, 1.4);
  11394. ///////////////////////////////////////////////////////////
  11395. StrRect=load.m_rcarray .ElementAt (14);
  11396. StrRect.top +=1*122;
  11397. StrRect.bottom +=1*122;
  11398. str="拍\r\n照";
  11399. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11400. StrRect.top +=46;
  11401. StrRect.left +=2;
  11402. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11403. m_Print.SetFontFace(10, 1, "宋体");
  11404. StrRect=load.m_rcarray .ElementAt (15);
  11405. StrRect.top +=1*122;
  11406. StrRect.bottom +=1*122;
  11407. str="拍照内容: 白 晚 特 便";
  11408. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11409. StrRect.left +=4;
  11410. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11411. StrRect=load.m_rcarray .ElementAt (21);
  11412. StrRect.top +=1*122;
  11413. StrRect.bottom +=1*122;
  11414. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11415. str=" 新人签名:";
  11416. StrRect.left +=2;
  11417. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11418. StrRect=load.m_rcarray .ElementAt (22);
  11419. StrRect.top +=1*122;
  11420. StrRect.bottom +=1*122;
  11421. if(seldlg.m_bTake)
  11422. {
  11423. if(seldlg.m_bFrame)
  11424. str="未付款:"+m_money3;
  11425. else
  11426. str=" "+m_money3;
  11427. }
  11428. else
  11429. {
  11430. if(seldlg.m_bFrame)
  11431. str="未付款:";
  11432. else
  11433. str=" ";
  11434. }
  11435. StrRect.left +=2;
  11436. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11437. StrRect=load.m_rcarray .ElementAt (23);
  11438. StrRect.top +=1*122;
  11439. StrRect.bottom +=1*122;
  11440. str="结婚秘书:";
  11441. StrRect.left +=2;
  11442. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11443. StrRect=load.m_rcarray .ElementAt (24);
  11444. StrRect.top +=1*122;
  11445. StrRect.bottom +=1*122;
  11446. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11447. StrRect.left +=3;
  11448. StrRect.top +=3;
  11449. StrRect.right -=2;
  11450. StrRect.bottom -=2;
  11451. if(seldlg.m_bTake)
  11452. {
  11453. str="";
  11454. for(i=0; i<bukuan2array.GetSize (); i++)
  11455. {
  11456. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=1)continue;
  11457. str+="加挑: ";
  11458. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11459. str+="\r\n";
  11460. }
  11461. str.TrimRight ("\r\n");
  11462. str.TrimRight (" ");
  11463. AutoDraw(m_Print, StrRect, str, 1.4);
  11464. }
  11465. ///////////////////////////////////////////////////////////
  11466. StrRect=load.m_rcarray .ElementAt (14);
  11467. StrRect.top +=2*122;
  11468. StrRect.bottom +=2*122;
  11469. str="选\r\n样";
  11470. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11471. StrRect.top +=46;
  11472. StrRect.left +=2;
  11473. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11474. m_Print.SetFontFace(10, 1, "宋体");
  11475. StrRect=load.m_rcarray .ElementAt (15);
  11476. StrRect.top +=2*122;
  11477. StrRect.bottom +=2*122;
  11478. str="选片内容:";
  11479. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11480. StrRect.left +=4;
  11481. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11482. StrRect=load.m_rcarray .ElementAt (21);
  11483. StrRect.top +=2*122;
  11484. StrRect.bottom +=2*122;
  11485. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11486. str=" 新人签名:";
  11487. StrRect.left +=2;
  11488. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11489. StrRect=load.m_rcarray .ElementAt (22);
  11490. StrRect.top +=2*122;
  11491. StrRect.bottom +=2*122;
  11492. if(seldlg.m_bChoose)
  11493. {
  11494. if(seldlg.m_bFrame)
  11495. str="未付款:"+m_money3;
  11496. else
  11497. str=" "+m_money3;
  11498. }
  11499. else
  11500. {
  11501. if(seldlg.m_bFrame)
  11502. str="未付款:";
  11503. else
  11504. str=" ";
  11505. }
  11506. StrRect.left +=2;
  11507. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11508. StrRect=load.m_rcarray .ElementAt (23);
  11509. StrRect.top +=2*122;
  11510. StrRect.bottom +=2*122;
  11511. str="结婚秘书:";
  11512. StrRect.left +=2;
  11513. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11514. StrRect=load.m_rcarray .ElementAt (24);
  11515. StrRect.top +=2*122;
  11516. StrRect.bottom +=2*122;
  11517. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11518. if(seldlg.m_bChoose)
  11519. {
  11520. StrRect.left +=3;
  11521. StrRect.top +=3;
  11522. StrRect.right -=2;
  11523. StrRect.bottom -=2;
  11524. str="";
  11525. for(i=0; i<bukuan2array.GetSize (); i++)
  11526. {
  11527. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=2)continue;
  11528. str+="加挑: ";
  11529. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11530. str+="\r\n";
  11531. }
  11532. str.TrimRight ("\r\n");
  11533. str.TrimRight (" ");
  11534. AutoDraw(m_Print, StrRect, str, 1.4);
  11535. }
  11536. ///////////////////////////////////////////////////////////
  11537. StrRect=load.m_rcarray .ElementAt (14);
  11538. StrRect.top +=3*122;
  11539. StrRect.bottom +=3*122;
  11540. str="结\r\n婚";
  11541. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11542. StrRect.top +=46;
  11543. StrRect.left +=2;
  11544. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11545. m_Print.SetFontFace(10, 1, "宋体");
  11546. StrRect=load.m_rcarray .ElementAt (15);
  11547. StrRect.top +=3*122;
  11548. StrRect.bottom +=3*122;
  11549. str="结婚内容: 区 白 晚 押金:";
  11550. if(seldlg.m_bFrame) m_Print.DrawRect2(StrRect, 1);
  11551. StrRect.left +=4;
  11552. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11553. StrRect=load.m_rcarray .ElementAt (21);
  11554. StrRect.top +=3*122;
  11555. StrRect.bottom +=3*122;
  11556. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11557. str=" 新人签名:";
  11558. StrRect.left +=2;
  11559. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11560. StrRect=load.m_rcarray .ElementAt (22);
  11561. StrRect.top +=3*122;
  11562. StrRect.bottom +=3*122;
  11563. if(seldlg.m_bBooking)
  11564. {
  11565. if(seldlg.m_bFrame)
  11566. str="未付款:"+m_money3;
  11567. else
  11568. str=" "+m_money3;
  11569. }
  11570. else
  11571. {
  11572. if(seldlg.m_bFrame)
  11573. str="未付款:";
  11574. else
  11575. str=" ";
  11576. }
  11577. StrRect.left +=2;
  11578. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11579. StrRect=load.m_rcarray .ElementAt (23);
  11580. StrRect.top +=3*122;
  11581. StrRect.bottom +=3*122;
  11582. str="结婚秘书:";
  11583. StrRect.left +=2;
  11584. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11585. StrRect=load.m_rcarray .ElementAt (24);
  11586. StrRect.top +=3*122;
  11587. StrRect.bottom +=3*122;
  11588. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11589. if(seldlg.m_bBooking)
  11590. {
  11591. StrRect.left +=3;
  11592. StrRect.top +=3;
  11593. StrRect.right -=2;
  11594. StrRect.bottom -=2;
  11595. realpos=0;str="";
  11596. for(i=0; i<sparray.GetSize (); i++)
  11597. {
  11598. if(atoi(sparray.ElementAt (i).ElementAt (4))!=2)continue;
  11599. str+=sparray.ElementAt (i).ElementAt (5);
  11600. str+=" 数量:";
  11601. str+=sparray.ElementAt (i).ElementAt (3);
  11602. if(realpos%2)
  11603. str+="\r\n";
  11604. else
  11605. str+=" ";
  11606. realpos++;
  11607. }
  11608. str.TrimRight ("\r\n");
  11609. str.TrimRight (" ");
  11610. AutoDraw(m_Print, StrRect, str, 1.4);
  11611. }
  11612. ///////////////////////////////////////
  11613. strarray.RemoveAll ();
  11614. if(seldlg.m_bFrame)
  11615. {
  11616. strarray.Add ("项目");
  11617. strarray.Add ("万");
  11618. strarray.Add ("千");
  11619. strarray.Add ("百");
  11620. strarray.Add ("十");
  11621. strarray.Add ("个");
  11622. strarray.Add ("收 银");
  11623. }
  11624. else
  11625. {
  11626. strarray.Add ("");
  11627. strarray.Add ("");
  11628. strarray.Add ("");
  11629. strarray.Add ("");
  11630. strarray.Add ("");
  11631. strarray.Add ("");
  11632. strarray.Add ("");
  11633. }
  11634. CStringArray strarray2;
  11635. float ftotal=0;
  11636. int realcount=0;
  11637. if(seldlg.m_bBooking)
  11638. {
  11639. for(i=0; i<bukuanarray.GetSize (); i++)
  11640. {
  11641. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=3 && atoi(bukuanarray.ElementAt (i).ElementAt (6))!=4)continue;
  11642. realcount++;
  11643. if(realcount>6)break;
  11644. str=bukuanarray.ElementAt (i).ElementAt (1);
  11645. ftotal+=atof(str);
  11646. strarray2.Add (GetW(str));
  11647. strarray2.Add (GetK(str));
  11648. strarray2.Add (GetB(str));
  11649. strarray2.Add (GetS(str));
  11650. strarray2.Add (GetG(str));
  11651. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11652. }
  11653. }
  11654. while(strarray2.GetSize ()<36)
  11655. strarray2.Add ("");
  11656. str.Format ("%f", ftotal);
  11657. strarray2.Add (GetW(str));
  11658. strarray2.Add (GetK(str));
  11659. strarray2.Add (GetB(str));
  11660. strarray2.Add (GetS(str));
  11661. strarray2.Add (GetG(str));
  11662. strarray2.Add ("");
  11663. //拍照
  11664. ftotal=0;
  11665. realcount=0;
  11666. if(seldlg.m_bTake)
  11667. {
  11668. for(i=0; i<bukuanarray.GetSize (); i++)
  11669. {
  11670. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=1)continue;
  11671. realcount++;
  11672. if(realcount>6)break;
  11673. str=bukuanarray.ElementAt (i).ElementAt (1);
  11674. ftotal+=atof(str);
  11675. strarray2.Add (GetW(str));
  11676. strarray2.Add (GetK(str));
  11677. strarray2.Add (GetB(str));
  11678. strarray2.Add (GetS(str));
  11679. strarray2.Add (GetG(str));
  11680. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11681. }
  11682. }
  11683. while(strarray2.GetSize ()<42+36)
  11684. strarray2.Add ("");
  11685. str.Format ("%f", ftotal);
  11686. strarray2.Add (GetW(str));
  11687. strarray2.Add (GetK(str));
  11688. strarray2.Add (GetB(str));
  11689. strarray2.Add (GetS(str));
  11690. strarray2.Add (GetG(str));
  11691. strarray2.Add ("");
  11692. //选片
  11693. ftotal=0;
  11694. realcount=0;
  11695. if(seldlg.m_bChoose)
  11696. {
  11697. for(i=0; i<bukuanarray.GetSize (); i++)
  11698. {
  11699. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=2)continue;
  11700. realcount++;
  11701. if(realcount>6)break;
  11702. str=bukuanarray.ElementAt (i).ElementAt (1);
  11703. ftotal+=atof(str);
  11704. strarray2.Add (GetW(str));
  11705. strarray2.Add (GetK(str));
  11706. strarray2.Add (GetB(str));
  11707. strarray2.Add (GetS(str));
  11708. strarray2.Add (GetG(str));
  11709. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11710. }
  11711. }
  11712. while(strarray2.GetSize ()<42*2+36)
  11713. strarray2.Add ("");
  11714. str.Format ("%f", ftotal);
  11715. strarray2.Add (GetW(str));
  11716. strarray2.Add (GetK(str));
  11717. strarray2.Add (GetB(str));
  11718. strarray2.Add (GetS(str));
  11719. strarray2.Add (GetG(str));
  11720. strarray2.Add ("");
  11721. /////////////////////////////
  11722. CRect temprc;
  11723. for(int n=0; n<4; n++)
  11724. {
  11725. StrRect=load.m_rcarray .ElementAt (17);
  11726. StrRect.top +=n*122;
  11727. StrRect.bottom +=n*122;
  11728. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11729. StrRect=load.m_rcarray .ElementAt (18);
  11730. if(n)
  11731. {
  11732. StrRect.left +=36;
  11733. StrRect.right +=36;
  11734. }
  11735. StrRect.top +=n*122;
  11736. StrRect.bottom +=n*122;
  11737. if(seldlg.m_bFrame)
  11738. str.Format("%d年", tm.GetYear ());
  11739. else
  11740. str.Format("%d ", tm.GetYear ());
  11741. 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))
  11742. {
  11743. if(seldlg.m_bFrame)
  11744. str=" 年";
  11745. else
  11746. str=" ";
  11747. }
  11748. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11749. StrRect=load.m_rcarray .ElementAt (19);
  11750. if(n)
  11751. {
  11752. StrRect.left +=38;
  11753. StrRect.right +=38;
  11754. }
  11755. StrRect.top +=n*122;
  11756. StrRect.bottom +=n*122;
  11757. if(seldlg.m_bFrame)
  11758. str.Format("%02d月", tm.GetMonth ());
  11759. else
  11760. str.Format("%02d ", tm.GetMonth ());
  11761. 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))
  11762. {
  11763. if(seldlg.m_bFrame)
  11764. str=" 月";
  11765. else
  11766. str=" ";
  11767. }
  11768. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11769. StrRect=load.m_rcarray .ElementAt (20);
  11770. if(n)
  11771. {
  11772. StrRect.left +=36;
  11773. StrRect.right +=36;
  11774. }
  11775. StrRect.top +=n*122;
  11776. StrRect.bottom +=n*122;
  11777. if(seldlg.m_bFrame)
  11778. str.Format("%02d日", tm.GetDay ());
  11779. else
  11780. str.Format("%02d ", tm.GetDay ());
  11781. 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))
  11782. {
  11783. if(seldlg.m_bFrame)
  11784. str=" 日";
  11785. else
  11786. str=" ";
  11787. }
  11788. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11789. for(i=26; i<=32; i++)
  11790. {
  11791. StrRect=load.m_rcarray .ElementAt (i-1);
  11792. StrRect.bottom -=14;
  11793. for(int j=0; j<8; j++)
  11794. {
  11795. StrRect.top=StrRect.bottom;
  11796. if(j>2)
  11797. {
  11798. StrRect.bottom =StrRect.top+14;
  11799. }
  11800. else
  11801. {
  11802. StrRect.bottom =StrRect.top+13;
  11803. }
  11804. temprc=StrRect;
  11805. StrRect.top +=n*122;
  11806. StrRect.bottom +=n*122;
  11807. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11808. if(i==26 && j==4 && seldlg.m_bFrame)
  11809. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11810. else if(i==26 && j==5 && seldlg.m_bFrame)
  11811. m_Print.DrawText((LPTSTR)(LPCTSTR)"付款", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11812. else if(i==26 && j==7 && seldlg.m_bFrame)
  11813. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11814. else if(j==0)
  11815. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-26), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11816. else if(j && i>26 && n<3)
  11817. {
  11818. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray2.ElementAt ((j-1)*6+(i-27)+n*42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11819. }
  11820. StrRect=temprc;
  11821. }
  11822. }
  11823. }
  11824. if(seldlg.m_bFrame)
  11825. {
  11826. StrRect=load.m_rcarray .ElementAt (32);
  11827. str="注\r\n意\r\n事\r\n项";
  11828. StrRect.top +=367;
  11829. StrRect.bottom +=367;
  11830. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11831. StrRect.top +=17;
  11832. StrRect.left +=2;
  11833. AutoDraw(m_Print, StrRect, str, 1.4);
  11834. StrRect=load.m_rcarray .ElementAt (33);
  11835. str="1: 本预约单自预定日期起一年内有效.定金在拍照套系金额中扣出.预定金一概不退\r\n\
  11836. 2: 多拍照片只供筛选.恕不奉送.版权所有.不得私自拷贝\r\n\
  11837. 3: 拍照款请于拍照时一次付清\r\n\
  11838. 4: 新娘装AM8:00前钟点费另计.婚纱礼服出租押金500-2000元\r\n\
  11839. 5: 本公司设有豪华VIP礼服区.及皇家御用礼服展区.但需另外加价.详情请咨本店人员\r\n\
  11840. 6: 安瓶, 美甲一次性化妆用具等均属增值服务部分,则需另外加价,详情咨询本店工作人员\r\n\
  11841. 7: 本电脑机械故障导致文件资料丢失.本公司只提供补拍服务\r\n\
  11842. 8: 每次前来请务必携带本单交给工作人员.本单是您在摩登新娘拍照的凭证.办理有关手续凭本单办理盖\r\n\
  11843. 章后方可生效";
  11844. StrRect.top +=367;
  11845. StrRect.bottom +=367;
  11846. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11847. StrRect.top +=4;
  11848. StrRect.left +=2;
  11849. AutoDraw(m_Print, StrRect, str, 1.0);
  11850. StrRect=load.m_rcarray .ElementAt (34);
  11851. 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)";
  11852. AutoDraw(m_Print, StrRect, str, 1.0);
  11853. m_Print.SetFontFace(13, 1, "宋体");
  11854. StrRect=load.m_rcarray .ElementAt (35);
  11855. str="地 址: 汉口 . 解放大道 . 头道街东部购物公园C栋二,三层";
  11856. StrRect.top +=367;
  11857. StrRect.bottom +=367;
  11858. StrRect.left +=2;
  11859. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11860. StrRect=load.m_rcarray .ElementAt (36);
  11861. str="喜讯热线: 027-81888799 81888599 81888699";
  11862. StrRect.top +=367;
  11863. StrRect.bottom +=367;
  11864. StrRect.left +=2;
  11865. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11866. }
  11867. PrintPreview dlg;
  11868. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  11869. dlg.m_pDC =m_Print.GetPDC() ;
  11870. if(dlg.DoModal ()!=IDOK)return;
  11871. //结束打印
  11872. m_Print.EndPage();
  11873. m_Print.EndPrint();
  11874. #endif
  11875. }
  11876. extern CString GetHMoney(CString str);
  11877. void CMainFrame::PrintReceipt3(CString strOrderNumber, CStringArray *pArray, float money)
  11878. {
  11879. int printcot = 1;
  11880. for (int aa = 0; aa < printcot; aa++)
  11881. {
  11882. g_sendhead.bsql = 0;
  11883. g_sendhead.code[0] = 24;
  11884. g_sendhead.tabcount = 1;
  11885. int g_nYearposTemp = g_nYearpos;
  11886. g_nYearpos = -1;
  11887. g_pMainWnd->ProcessChatMessageRequest2(1);
  11888. g_nYearpos = g_nYearposTemp;
  11889. if (0 == g_bSendOK)return;
  11890. DataToArray(&g_cominfoarray);
  11891. CString SerialNo;
  11892. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  11893. CPrintRX m_Print;
  11894. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  11895. {
  11896. m_Print.InitToPrint(NULL, 1);
  11897. }
  11898. else
  11899. {
  11900. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  11901. if (name.IsEmpty())
  11902. m_Print.InitToPrint(NULL, 1);
  11903. else
  11904. {
  11905. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  11906. if (nret == -1 && aa == 0)
  11907. {
  11908. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  11909. }
  11910. }
  11911. }
  11912. m_Print.StartPrint();
  11913. m_Print.StartPage();
  11914. LoadRect load;
  11915. load.SetLiaPath("15.lia");
  11916. load.SetMargins(0, 0);
  11917. if (!load.Load())return;
  11918. int i;
  11919. //////////////////////////////////////////////////////////////
  11920. CStringArray txarray;
  11921. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  11922. g_sendhead.code[0] = 11;
  11923. g_sendhead.code[1] = 52;
  11924. g_sendhead.tabcount = 2;
  11925. g_sendhead.bsql = 0;
  11926. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  11927. CArray<CStringArray, CStringArray>sparray;
  11928. CArray<CStringArray, CStringArray>clientarray;
  11929. DataToArray(&g_List1array, &clientarray);
  11930. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  11931. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  11932. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  11933. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  11934. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  11935. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  11936. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  11937. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  11938. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  11939. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  11940. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  11941. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  11942. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  11943. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  11944. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  11945. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  11946. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  11947. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  11948. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  11949. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  11950. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  11951. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  11952. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  11953. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  11954. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  11955. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  11956. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  11957. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  11958. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  11959. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  11960. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  11961. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  11962. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  11963. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  11964. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  11965. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  11966. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  11967. CString m_addr = m_addr1 + ";";
  11968. m_addr.TrimLeft(";");
  11969. m_addr += m_addr2;
  11970. CString m_qq = m_qq1 + ";";
  11971. m_qq.TrimLeft(";");
  11972. m_qq += m_qq2;
  11973. m_money1.Format("%f", atof(m_taoxijiage));
  11974. m_money2.Format("%f", atof(m_payed1));
  11975. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  11976. ConvertToPrice(m_money1);
  11977. ConvertToPrice(m_money2);
  11978. ConvertToPrice(m_money3);
  11979. ////////////////////////////////////////////////////////////////
  11980. int rcpos = -1;
  11981. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  11982. m_Print.SetFontFace(17, 1, "宋体");
  11983. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11984. StrRect.top -= 0;
  11985. StrRect.bottom -= 10;
  11986. StrRect.left -= 140;
  11987. StrRect.right = StrRect.left + 48;
  11988. m_Print.SetFontFace(15, 1, "宋体");
  11989. m_Print.SetColor(0xffffff);
  11990. m_Print.DrawRect(StrRect, 0);
  11991. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11992. StrRect.left = StrRect.right;
  11993. StrRect.right = StrRect.left + 48;
  11994. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  11995. m_Print.SetColor(0, RGB(255, 0, 0));
  11996. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11997. m_Print.SetColor(0);
  11998. m_Print.SetFontFace(12, 1, "宋体");
  11999. StrRect.left -= 48;
  12000. int hei = StrRect.Height();
  12001. StrRect.top = StrRect.bottom + 2;
  12002. StrRect.bottom += hei + 2;
  12003. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12004. StrRect.top = StrRect.bottom - 2;
  12005. StrRect.bottom += hei - 5;
  12006. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12007. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12008. m_Print.SetFontFace(12, 1, "宋体");
  12009. m_Print.DrawText((LPTSTR)(LPCTSTR)"收款单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12010. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12011. m_Print.SetFontFace(9, 1, "宋体");
  12012. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12013. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12014. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12015. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12016. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12017. m_Print.DrawRect2(StrRect, 2);
  12018. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12019. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12020. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12021. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12022. m_Print.DrawRect2(StrRect, 2);
  12023. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12024. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12025. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12026. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12027. m_Print.DrawRect2(StrRect, 2);
  12028. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12029. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约地点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12030. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12031. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12032. m_Print.DrawRect2(StrRect, 2);
  12033. ////////////
  12034. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12035. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12036. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12037. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12038. m_Print.DrawRect2(StrRect, 2);
  12039. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12040. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12041. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12042. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12043. m_Print.DrawRect2(StrRect, 2);
  12044. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12045. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12046. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12047. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12048. m_Print.DrawRect2(StrRect, 2);
  12049. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12050. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12051. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12052. m_Print.DrawText((LPTSTR)(LPCTSTR)g_date, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12053. m_Print.DrawRect2(StrRect, 2);
  12054. for (i = 19; i < 49; i++)
  12055. {
  12056. if (i >= 44)
  12057. {
  12058. StrRect = load.m_rcarray.ElementAt(i - 5);
  12059. int hei = StrRect.Height();
  12060. StrRect.top += hei;
  12061. StrRect.bottom += hei;
  12062. }
  12063. else
  12064. StrRect = load.m_rcarray.ElementAt(i);
  12065. m_Print.DrawRect2(StrRect, 1);
  12066. }
  12067. float fmoney = 0;
  12068. for (i = 19; i < 49; i++)
  12069. {
  12070. if (i >= 44)
  12071. {
  12072. StrRect = load.m_rcarray.ElementAt(i - 5);
  12073. int hei = StrRect.Height();
  12074. StrRect.top += hei;
  12075. StrRect.bottom += hei;
  12076. }
  12077. else
  12078. StrRect = load.m_rcarray.ElementAt(i);
  12079. StrRect.left += 2;
  12080. /* if((i-19)%5==2)
  12081. {
  12082. fmoney+=atof(pArray->ElementAt (i-19));
  12083. }*/
  12084. m_Print.DrawText((LPTSTR)(LPCTSTR)(pArray->ElementAt(i - 19)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12085. }
  12086. m_money2.Format("%f", money);
  12087. ConvertToPrice(m_money2);
  12088. StrRect = load.m_rcarray.ElementAt(44);
  12089. CString str;
  12090. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 实收¥: %s 元 收银员: %s", \
  12091. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  12092. m_money2, g_user.name);
  12093. m_Print.DrawRect2(StrRect, 1);
  12094. StrRect.left += 3;
  12095. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12096. StrRect = load.m_rcarray.ElementAt(46);
  12097. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12098. StrRect = load.m_rcarray.ElementAt(47);
  12099. m_Print.DrawRect2(StrRect, 2);
  12100. StrRect = load.m_rcarray.ElementAt(48);
  12101. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12102. StrRect = load.m_rcarray.ElementAt(45);
  12103. str = "\
  12104. 顾客须知\r\n\
  12105. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  12106. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  12107. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  12108. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  12109. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  12110. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  12111. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  12112. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12113. AutoDraw(m_Print, StrRect, str, 1.8);
  12114. PrintPreview dlg;
  12115. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12116. dlg.m_pDC = m_Print.GetPDC();
  12117. if (aa == 0)
  12118. {
  12119. if (dlg.DoModal() != IDOK)
  12120. return;
  12121. printcot = dlg.m_num;
  12122. }
  12123. //结束打印
  12124. m_Print.EndPage();
  12125. m_Print.EndPrint();
  12126. }
  12127. }
  12128. void CMainFrame::PrintReceipt2(CString strOrderNumber)
  12129. {
  12130. int printcot = 1;
  12131. for (int aa = 0; aa < printcot; aa++)
  12132. {
  12133. g_sendhead.bsql = 0;
  12134. g_sendhead.code[0] = 24;
  12135. g_sendhead.tabcount = 1;
  12136. int g_nYearposTemp = g_nYearpos;
  12137. g_nYearpos = -1;
  12138. g_pMainWnd->ProcessChatMessageRequest2(1);
  12139. g_nYearpos = g_nYearposTemp;
  12140. if (0 == g_bSendOK)return;
  12141. DataToArray(&g_cominfoarray);
  12142. CString SerialNo;
  12143. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  12144. CPrintRX m_Print;
  12145. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12146. {
  12147. m_Print.InitToPrint(NULL, 1);
  12148. }
  12149. else
  12150. {
  12151. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  12152. if (name.IsEmpty())
  12153. m_Print.InitToPrint(NULL, 1);
  12154. else
  12155. {
  12156. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12157. if (nret == -1 && aa == 0)
  12158. {
  12159. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12160. }
  12161. }
  12162. }
  12163. m_Print.StartPrint();
  12164. m_Print.StartPage();
  12165. LoadRect load;
  12166. load.SetLiaPath("14.lia");
  12167. load.SetMargins(0, 0);
  12168. if (!load.Load())return;
  12169. int i;
  12170. //////////////////////////////////////////////////////////////
  12171. CStringArray txarray;
  12172. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  12173. g_sendhead.code[0] = 11;
  12174. g_sendhead.code[1] = 52;
  12175. g_sendhead.code[2] = 93;
  12176. g_sendhead.tabcount = 3;
  12177. g_sendhead.bsql = 0;
  12178. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12179. CArray<CStringArray, CStringArray>sparray;
  12180. CArray<CStringArray, CStringArray>clientarray;
  12181. CArray<CStringArray, CStringArray>moneyarray;
  12182. DataToArray(&g_List1array, &clientarray, &moneyarray);
  12183. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12184. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12185. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12186. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12187. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12188. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  12189. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12190. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12191. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12192. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12193. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12194. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12195. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12196. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12197. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12198. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12199. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12200. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12201. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12202. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12203. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12204. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12205. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12206. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12207. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12208. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12209. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12210. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12211. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  12212. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12213. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12214. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  12215. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  12216. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  12217. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  12218. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  12219. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  12220. CString m_addr = m_addr1 + ";";
  12221. m_addr.TrimLeft(";");
  12222. m_addr += m_addr2;
  12223. CString m_qq = m_qq1 + ";";
  12224. m_qq.TrimLeft(";");
  12225. m_qq += m_qq2;
  12226. m_money1.Format("%f", atof(m_taoxijiage));
  12227. m_money2 = "0";
  12228. for (i = 0; i < moneyarray.GetSize(); i++)
  12229. {
  12230. if (moneyarray.ElementAt(i).ElementAt(5) == "预约收款")
  12231. m_money2 = moneyarray.ElementAt(i).ElementAt(1);
  12232. }
  12233. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  12234. ConvertToPrice(m_money1);
  12235. ConvertToPrice(m_money2);
  12236. ConvertToPrice(m_money3);
  12237. ////////////////////////////////////////////////////////////////
  12238. int rcpos = -1;
  12239. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12240. m_Print.SetFontFace(17, 1, "宋体");
  12241. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12242. StrRect.top -= 0;
  12243. StrRect.bottom -= 10;
  12244. StrRect.left -= 140;
  12245. StrRect.right = StrRect.left + 48;
  12246. m_Print.SetFontFace(15, 1, "宋体");
  12247. m_Print.SetColor(0xffffff);
  12248. m_Print.DrawRect(StrRect, 0);
  12249. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12250. StrRect.left = StrRect.right;
  12251. StrRect.right = StrRect.left + 48;
  12252. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12253. m_Print.SetColor(0, RGB(255, 0, 0));
  12254. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12255. m_Print.SetColor(0);
  12256. m_Print.SetFontFace(12, 1, "宋体");
  12257. StrRect.left -= 48;
  12258. int hei = StrRect.Height();
  12259. StrRect.top = StrRect.bottom + 2;
  12260. StrRect.bottom += hei + 2;
  12261. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12262. StrRect.top = StrRect.bottom - 2;
  12263. StrRect.bottom += hei - 5;
  12264. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12265. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12266. m_Print.SetFontFace(12, 1, "宋体");
  12267. m_Print.DrawText((LPTSTR)(LPCTSTR)"定金单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12268. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12269. m_Print.SetFontFace(9, 1, "宋体");
  12270. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12271. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12272. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12273. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12274. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12275. m_Print.DrawRect2(StrRect, 2);
  12276. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12277. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12278. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12279. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12280. m_Print.DrawRect2(StrRect, 2);
  12281. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12282. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12283. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12284. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12285. m_Print.DrawRect2(StrRect, 2);
  12286. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12287. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约地点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12288. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12289. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12290. m_Print.DrawRect2(StrRect, 2);
  12291. ////////////
  12292. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12293. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12294. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12295. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12296. m_Print.DrawRect2(StrRect, 2);
  12297. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12298. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12299. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12300. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12301. m_Print.DrawRect2(StrRect, 2);
  12302. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12303. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12304. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12305. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12306. m_Print.DrawRect2(StrRect, 2);
  12307. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12308. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12309. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12310. m_Print.DrawText((LPTSTR)(LPCTSTR)g_date, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12311. m_Print.DrawRect2(StrRect, 2);
  12312. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12313. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客地址:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12314. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12315. m_Print.DrawText((LPTSTR)(LPCTSTR)m_addr, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12316. m_Print.DrawRect2(StrRect, 2);
  12317. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12318. m_Print.DrawText((LPTSTR)(LPCTSTR)"大婚时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12319. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12320. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12321. m_Print.DrawRect2(StrRect, 2);
  12322. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12323. m_Print.DrawText((LPTSTR)(LPCTSTR)"QQ/MSN:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12324. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12325. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12326. m_Print.DrawRect2(StrRect, 2);
  12327. CStringArray strarray;
  12328. strarray.Add("套系名称");
  12329. strarray.Add("总 额");
  12330. strarray.Add("定 金");
  12331. strarray.Add("余 款");
  12332. strarray.Add("摄影日期");
  12333. strarray.Add(m_taoxiname);
  12334. strarray.Add(m_money1);
  12335. strarray.Add(m_money2);
  12336. strarray.Add(m_money3);
  12337. strarray.Add(m_time2);
  12338. for (i = 25; i < 37; i++)
  12339. {
  12340. StrRect = load.m_rcarray.ElementAt(i);
  12341. m_Print.DrawRect2(StrRect, 1);
  12342. }
  12343. for (i = 25; i < 35; i++)
  12344. {
  12345. StrRect = load.m_rcarray.ElementAt(i);
  12346. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 25), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12347. }
  12348. StrRect = load.m_rcarray.ElementAt(35);
  12349. StrRect.left += 5;
  12350. StrRect.top += 5;
  12351. m_Print.DrawText((LPTSTR)(LPCTSTR)" 备 注:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  12352. StrRect = load.m_rcarray.ElementAt(36);
  12353. CString str;
  12354. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 ¥: %s 元 收银员: %s", \
  12355. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  12356. m_money2, g_user.name);
  12357. StrRect.left += 3;
  12358. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12359. StrRect = load.m_rcarray.ElementAt(38);
  12360. m_Print.DrawText((LPTSTR)(LPCTSTR)"营业员:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12361. StrRect = load.m_rcarray.ElementAt(39);
  12362. m_Print.DrawText((LPTSTR)(LPCTSTR)m_ren, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12363. m_Print.DrawRect2(StrRect, 2);
  12364. StrRect = load.m_rcarray.ElementAt(40);
  12365. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12366. StrRect = load.m_rcarray.ElementAt(41);
  12367. m_Print.DrawRect2(StrRect, 2);
  12368. StrRect = load.m_rcarray.ElementAt(42);
  12369. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12370. StrRect = load.m_rcarray.ElementAt(37);
  12371. str = "\
  12372. 顾客须知\r\n\
  12373. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  12374. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  12375. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  12376. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  12377. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  12378. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  12379. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  12380. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12381. AutoDraw(m_Print, StrRect, str, 1.8);
  12382. PrintPreview dlg;
  12383. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12384. dlg.m_pDC = m_Print.GetPDC();
  12385. if (aa == 0)
  12386. {
  12387. if (dlg.DoModal() != IDOK)
  12388. return;
  12389. printcot = dlg.m_num;
  12390. }
  12391. //结束打印
  12392. m_Print.EndPage();
  12393. m_Print.EndPrint();
  12394. }
  12395. }
  12396. void CMainFrame::OnAutodelphoto()
  12397. {
  12398. // TODO: Add your command handler code here
  12399. if (g_user.bLongin == 0)
  12400. {
  12401. if (g_bNoLoginLia)
  12402. {
  12403. Login dlg;
  12404. dlg.SetLiaPath("5.lia");
  12405. dlg.DoModal();
  12406. }
  12407. else
  12408. {
  12409. Login3 dlg;
  12410. dlg.SetLiaPath("5.lia");
  12411. dlg.DoModal();
  12412. }
  12413. if (g_user.bLongin == 0)return;
  12414. }
  12415. if (IsHasRightsnew(49) == 0)return;
  12416. DelPhotoSet dlg;
  12417. dlg.DoModal();
  12418. }
  12419. void CMainFrame::Onphotomanage() // 客照管理中心;
  12420. {
  12421. if (g_user.bLongin == 0)
  12422. {
  12423. if (g_bNoLoginLia)
  12424. {
  12425. Login dlg;
  12426. dlg.SetLiaPath("5.lia");
  12427. dlg.DoModal();
  12428. }
  12429. else
  12430. {
  12431. Login3 dlg;
  12432. dlg.SetLiaPath("5.lia");
  12433. dlg.DoModal();
  12434. }
  12435. if (g_user.bLongin == 0)return;
  12436. }
  12437. if (IsHasRightsnew(49) == 0)return;
  12438. ShowPic3 dlg;
  12439. dlg.DoModal();
  12440. }
  12441. void CMainFrame::OnCompanyinfo()
  12442. {
  12443. // TODO: Add your command handler code here
  12444. if (g_user.bLongin == 0)
  12445. {
  12446. if (g_bNoLoginLia)
  12447. {
  12448. Login dlg;
  12449. dlg.SetLiaPath("5.lia");
  12450. dlg.DoModal();
  12451. }
  12452. else
  12453. {
  12454. Login3 dlg;
  12455. dlg.SetLiaPath("5.lia");
  12456. dlg.DoModal();
  12457. }
  12458. if (g_user.bLongin == 0)return;
  12459. }
  12460. if (IsHasRightsnew(49) == 0)return;
  12461. CompanyInfo dlg;
  12462. dlg.DoModal();
  12463. }
  12464. void CMainFrame::OnTaoxifg()
  12465. {
  12466. // TODO: Add your command handler code here
  12467. if (g_user.bLongin == 0)
  12468. {
  12469. if (g_bNoLoginLia)
  12470. {
  12471. Login dlg;
  12472. dlg.SetLiaPath("5.lia");
  12473. dlg.DoModal();
  12474. }
  12475. else
  12476. {
  12477. Login3 dlg;
  12478. dlg.SetLiaPath("5.lia");
  12479. dlg.DoModal();
  12480. }
  12481. if (g_user.bLongin == 0)return;
  12482. }
  12483. if (IsHasRightsnew(49) == 0)return;
  12484. TXFG dlg;
  12485. dlg.DoModal();
  12486. }
  12487. void CMainFrame::OnHelpfile()
  12488. {
  12489. // TODO: Add your command handler code here
  12490. // ShellExecute(NULL, _T("open"), _T(g_mainpath+"\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  12491. // if(::PathFileExists (g_mainpath+"\\zx.dll"))
  12492. // ShellExecute(NULL, _T("open"), _T("www.zcsmkj.com"), "", NULL, SW_SHOWNORMAL);
  12493. // else
  12494. ShellExecute(NULL, _T("open"), _T("www.lyfz.net"), "", NULL, SW_SHOWNORMAL);
  12495. }
  12496. void CMainFrame::OnPhotobak()
  12497. {
  12498. // TODO: Add your command handler code here
  12499. if (g_user.bLongin == 0)
  12500. {
  12501. if (g_bNoLoginLia)
  12502. {
  12503. Login dlg;
  12504. dlg.SetLiaPath("5.lia");
  12505. dlg.DoModal();
  12506. }
  12507. else
  12508. {
  12509. Login3 dlg;
  12510. dlg.SetLiaPath("5.lia");
  12511. dlg.DoModal();
  12512. }
  12513. if (g_user.bLongin == 0)return;
  12514. }
  12515. if (IsHasRightsnew(49) == 0)return;
  12516. PhotoBak dlg;
  12517. dlg.DoModal();
  12518. }
  12519. //客户报表
  12520. void CMainFrame::OnClose2()
  12521. { // TODO: Add your message handler code here and/or call default
  12522. if (AfxMessageBox("是否退出系统?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  12523. if(g_user.bLongin)
  12524. WriteLog("退出系统!", "退出系统!");
  12525. g_bShowBar = 0;
  12526. if (m_Mdi.MainClose())
  12527. CMDIFrameWnd::OnClose();
  12528. }
  12529. //
  12530. void CMainFrame::ResetTimer()
  12531. {
  12532. }
  12533. void CMainFrame::LinkClick(CString str, int nParent)
  12534. {
  12535. g_pMainWnd2->m_bar.LinkClick(str);
  12536. }
  12537. void CMainFrame::PrintFlowChart2(CString m_id)
  12538. {
  12539. CPrintRX m_Print;
  12540. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12541. {
  12542. m_Print.InitToPrint(NULL, 1);
  12543. }
  12544. else
  12545. {
  12546. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  12547. if (name.IsEmpty())
  12548. m_Print.InitToPrint(NULL, 1);
  12549. else
  12550. {
  12551. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12552. if (nret == -1)
  12553. {
  12554. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12555. }
  12556. }
  12557. }
  12558. m_Print.StartPrint();
  12559. m_Print.StartPage();
  12560. LoadRect load;
  12561. load.SetLiaPath("16.lia");
  12562. load.SetMargins(0, 0);
  12563. if (!load.Load())return;
  12564. LoadRect load2;
  12565. load2.SetLiaPath("17.lia");
  12566. load2.SetMargins(0, 660);
  12567. if (!load2.Load())return;
  12568. int i;
  12569. //////////////////////////////////////////////////////////////
  12570. CStringArray txarray;
  12571. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and kind<>'2'";
  12572. g_sendhead.code[0] = 11;
  12573. g_sendhead.code[1] = 52;
  12574. g_sendhead.code[2] = 223;
  12575. g_sendhead.tabcount = 3;
  12576. g_sendhead.bsql = 0;
  12577. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12578. CArray<CStringArray, CStringArray>sparray;
  12579. CArray<CStringArray, CStringArray>clientarray;
  12580. DataToArray(&g_List1array, &clientarray, &sparray);
  12581. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12582. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12583. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12584. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12585. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12586. CString m_photocount = g_List1array.ElementAt(0).ElementAt(9);
  12587. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12588. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12589. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12590. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12591. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12592. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12593. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12594. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12595. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12596. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12597. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12598. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12599. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12600. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12601. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12602. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12603. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12604. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12605. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12606. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12607. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12608. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12609. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(39) + g_List1array.ElementAt(0).ElementAt(75);
  12610. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12611. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12612. CString spno;
  12613. for (i = 0; i < sparray.GetSize(); i++)
  12614. {
  12615. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  12616. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  12617. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  12618. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12619. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12620. spno += sparray.ElementAt(i).ElementAt(5);
  12621. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12622. spno += "; ";
  12623. else
  12624. {
  12625. spno += ":";
  12626. spno += sparray.ElementAt(i).ElementAt(6);
  12627. spno += "; ";
  12628. }
  12629. }
  12630. spno += " 加挑:";
  12631. for (i = 0; i < sparray.GetSize(); i++)
  12632. {
  12633. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  12634. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  12635. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  12636. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12637. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12638. spno += sparray.ElementAt(i).ElementAt(5);
  12639. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12640. spno += "; ";
  12641. else
  12642. {
  12643. spno += ":";
  12644. spno += sparray.ElementAt(i).ElementAt(6);
  12645. spno += "; ";
  12646. }
  12647. }
  12648. if (spno.Right(6) == " 加挑:")
  12649. {
  12650. spno = spno.Left(spno.GetLength() - 6);
  12651. }
  12652. ////////////////////////////////////////////////////////////////
  12653. int rcpos = -1;
  12654. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12655. m_Print.SetFontFace(17, 1, "宋体");
  12656. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12657. StrRect.top -= 0;
  12658. StrRect.bottom -= 10;
  12659. StrRect.left -= 140;
  12660. StrRect.right = StrRect.left + 48;
  12661. m_Print.SetFontFace(15, 1, "宋体");
  12662. m_Print.SetColor(0xffffff);
  12663. m_Print.DrawRect(StrRect, 0);
  12664. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12665. StrRect.left = StrRect.right;
  12666. StrRect.right = StrRect.left + 48;
  12667. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12668. m_Print.SetColor(0, RGB(255, 0, 0));
  12669. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12670. m_Print.SetColor(0);
  12671. m_Print.SetFontFace(12, 1, "宋体");
  12672. StrRect.left -= 48;
  12673. int hei = StrRect.Height();
  12674. StrRect.top = StrRect.bottom + 2;
  12675. StrRect.bottom += hei + 2;
  12676. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12677. StrRect.top = StrRect.bottom - 2;
  12678. StrRect.bottom += hei - 5;
  12679. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12680. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12681. m_Print.SetFontFace(12, 1, "宋体");
  12682. m_Print.DrawText((LPTSTR)(LPCTSTR)"加做取件单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12683. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12684. m_Print.SetFontFace(11, 1, "宋体");
  12685. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + m_id), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12686. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12687. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12688. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12689. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12690. m_Print.DrawRect2(StrRect, 2);
  12691. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12692. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12693. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12694. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12695. m_Print.DrawRect2(StrRect, 2);
  12696. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12697. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12698. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12699. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time4, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12700. m_Print.DrawRect2(StrRect, 2);
  12701. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12702. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12703. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12704. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time5, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12705. m_Print.DrawRect2(StrRect, 2);
  12706. ////////////
  12707. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12708. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12709. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12710. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12711. m_Print.DrawRect2(StrRect, 2);
  12712. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12713. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12714. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12715. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12716. m_Print.DrawRect2(StrRect, 2);
  12717. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12718. m_Print.DrawText((LPTSTR)(LPCTSTR)"赠送张数:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12719. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12720. m_Print.DrawText((LPTSTR)(LPCTSTR)m_photocount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12721. m_Print.DrawRect2(StrRect, 2);
  12722. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12723. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12724. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12725. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12726. m_Print.DrawRect2(StrRect, 2);
  12727. ////////////
  12728. ///////////spno
  12729. CRect sprc[22];
  12730. StrRect = load.m_rcarray.ElementAt(19);
  12731. StrRect.left += 4; StrRect.right -= 3;
  12732. hei = StrRect.Height();
  12733. for (i = 0; i < 22; i++)
  12734. {
  12735. sprc[i] = StrRect;
  12736. m_Print.DrawRect2(StrRect, 1);
  12737. if (i == 0)
  12738. {
  12739. StrRect.left += 5;
  12740. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12741. StrRect.left -= 5;
  12742. }
  12743. StrRect.top = StrRect.bottom;
  12744. StrRect.bottom = StrRect.top + hei;
  12745. sprc[i].left += 4; sprc[i].right -= 3;
  12746. }
  12747. StrRect.bottom = StrRect.top + 60;
  12748. m_Print.DrawRect2(StrRect, 1);
  12749. StrRect.left += 3; StrRect.top += 3;
  12750. StrRect.right -= 3; StrRect.bottom -= 3;
  12751. AutoDraw(m_Print, StrRect, m_bz, 1.8);
  12752. CString temp, tempspno, tempbz;
  12753. CSize size;
  12754. BOOL bRun = 0;
  12755. int fontsize = 12;
  12756. ll: tempspno = spno;
  12757. m_Print.SetFontFace(fontsize, 1, "宋体");
  12758. for (i = 1; i<22; i++)
  12759. {
  12760. if (!tempspno.IsEmpty())
  12761. {
  12762. temp = tempspno;
  12763. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12764. int right = 0;
  12765. CRect temprc = sprc[i];
  12766. while (size.cx>temprc.Width())
  12767. {
  12768. right++;
  12769. temp = tempspno.Left(tempspno.GetLength() - (right));
  12770. if (GIsHalfHZ(temp))
  12771. {
  12772. right++;
  12773. temp.Delete(temp.GetLength() - 1);
  12774. }
  12775. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12776. }
  12777. if (bRun)
  12778. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12779. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  12780. if (tempspno.IsEmpty())i++;
  12781. }
  12782. }
  12783. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  12784. {
  12785. fontsize--;
  12786. goto ll;
  12787. }
  12788. if (bRun == 0)
  12789. {
  12790. bRun = 1;
  12791. goto ll;
  12792. }
  12793. m_Print.SetFontFace(12, 1, "宋体");
  12794. StrRect = load2.m_rcarray.ElementAt(1);
  12795. m_Print.DrawText((LPTSTR)(LPCTSTR)"喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12796. StrRect = load2.m_rcarray.ElementAt(2);
  12797. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12798. StrRect = load2.m_rcarray.ElementAt(3);
  12799. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12800. StrRect = load2.m_rcarray.ElementAt(4);
  12801. m_Print.DrawRect2(StrRect, 2);
  12802. StrRect = load2.m_rcarray.ElementAt(0);
  12803. CString str = "\
  12804. 爱心提示:如对制作有任何要求请清楚列出,所有制作内容一经确认将按要求制作。\r\n\
  12805. 选样文件从拍摄日期计算将保留二个月;套相成品按取件日期保留三个月,逾期不做保留。\r\n\
  12806. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12807. AutoDraw(m_Print, StrRect, str, 1.8);
  12808. PrintPreview dlg; dlg.m_mode = 2;
  12809. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12810. dlg.m_pDC = m_Print.GetPDC();
  12811. if (dlg.DoModal() != IDOK)return;
  12812. //结束打印
  12813. m_Print.EndPage();
  12814. m_Print.EndPrint();
  12815. }
  12816. //分店
  12817. CString CMainFrame::GetDanWei(CString name, CArray<CStringArray, CStringArray>*array)
  12818. {
  12819. for (int i = 0; i < array->GetSize(); i++)
  12820. {
  12821. if (name == array->ElementAt(i).ElementAt(1))
  12822. return array->ElementAt(i).ElementAt(2);
  12823. }
  12824. return "";
  12825. }
  12826. //g_sendhead
  12827. int CMainFrame::GetPort()
  12828. {
  12829. static int aaa = -1;
  12830. if (aaa == -1)
  12831. {
  12832. aaa = CTime::GetCurrentTime().GetSecond() % 7;
  12833. }
  12834. aaa++;
  12835. if (aaa >= 7)aaa = 0;
  12836. return 8387 + aaa;
  12837. }
  12838. void CMainFrame::OnShowBakState()
  12839. {
  12840. // TODO: Add your command handler code here
  12841. g_sendhead.bsql = 0;
  12842. g_sendhead.code[0] = 171;
  12843. g_sendhead.tabcount = 1;
  12844. g_pMainWnd->ProcessChatMessageRequest2(1);
  12845. if (g_bSendOK == 0)
  12846. {
  12847. return;
  12848. }
  12849. CArray<CStringArray, CStringArray>g_bakstatearray;
  12850. DataToArray(&g_bakstatearray);
  12851. while (g_bakstatearray.GetSize() > 7)
  12852. {
  12853. g_bakstatearray.RemoveAt(0);
  12854. }
  12855. int photocount = 0;
  12856. int infocount = 0;
  12857. for (int i = 0; i < g_bakstatearray.GetSize(); i++)
  12858. {
  12859. if (g_bakstatearray.ElementAt(i).ElementAt(1) != "1")photocount++;
  12860. if (g_bakstatearray.ElementAt(i).ElementAt(2) != "1")infocount++;
  12861. }
  12862. ShowBakState dlg;
  12863. dlg.m_pArray = &g_bakstatearray;
  12864. dlg.DoModal();
  12865. }
  12866. void CMainFrame::PrintReceipt2(CStringArray *pArray)
  12867. {
  12868. int i = 0;
  12869. int printcot = 1;
  12870. for (int aa = 0; aa < printcot; aa++)
  12871. {
  12872. g_sendhead.bsql = 0;
  12873. g_sendhead.code[0] = 24;
  12874. g_sendhead.tabcount = 1;
  12875. int g_nYearposTemp = g_nYearpos;
  12876. g_nYearpos = -1;
  12877. g_pMainWnd->ProcessChatMessageRequest2(1);
  12878. g_nYearpos = g_nYearposTemp;
  12879. if (0 == g_bSendOK)return;
  12880. DataToArray(&g_cominfoarray);
  12881. CString SerialNo;
  12882. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  12883. CPrintRX m_Print;
  12884. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12885. {
  12886. m_Print.InitToPrint(NULL, 1);
  12887. }
  12888. else
  12889. {
  12890. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  12891. if (name.IsEmpty())
  12892. m_Print.InitToPrint(NULL, 1);
  12893. else
  12894. {
  12895. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12896. if (nret == -1 && aa == 0)
  12897. {
  12898. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12899. }
  12900. }
  12901. }
  12902. m_Print.StartPrint();
  12903. m_Print.StartPage();
  12904. LoadRect load;
  12905. BOOL bSmall = 0;
  12906. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  12907. {
  12908. bSmall = 1;
  12909. load.SetLiaPath("20.lia");
  12910. }
  12911. else
  12912. load.SetLiaPath("10.lia");
  12913. if (bSmall)
  12914. load.SetMargins(-10, 0);
  12915. else
  12916. load.SetMargins(10, 0);
  12917. if (!load.Load())return;
  12918. int rcpos = -1;
  12919. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12920. Image *pImg = NULL;
  12921. #ifdef MNLS_VERSION
  12922. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  12923. #else
  12924. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  12925. #endif
  12926. // m_Print.DrawImage(pImg, StrRect);
  12927. delete pImg;
  12928. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  12929. {
  12930. Image *pImg = NULL;
  12931. g_nSendCode = 31;
  12932. int g_nYearposTemp = g_nYearpos;
  12933. g_nYearpos = -1;
  12934. g_pMainWnd->ProcessChatMessageRequest2(1);
  12935. g_nYearpos = g_nYearposTemp;
  12936. g_nSendCode = 0;
  12937. if (g_bSendOK == 0)return;
  12938. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  12939. if (pImg)
  12940. {
  12941. StrRect.left = 65;
  12942. if (bSmall)StrRect.left = 55;
  12943. StrRect.top = 10;
  12944. StrRect.right = StrRect.left + 58;
  12945. StrRect.bottom = StrRect.top + 58;
  12946. m_Print.DrawImage(pImg, StrRect);
  12947. delete pImg; pImg = NULL;
  12948. }
  12949. }
  12950. if (bSmall)
  12951. {
  12952. m_Print.SetFontFace(18, 1, "黑体");
  12953. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12954. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12955. m_Print.SetFontFace(9, 1, "宋体");
  12956. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12957. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12958. m_Print.SetFontFace(6, 1, "宋体");
  12959. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12960. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12961. m_Print.SetFontFace(9, 1, "宋体");
  12962. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12963. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12964. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12965. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12966. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12967. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12968. int hei = StrRect.Height();
  12969. StrRect.bottom = StrRect.top;
  12970. StrRect.top -= 8;
  12971. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  12972. m_Print.SetFontFace(10, 1, "宋体");
  12973. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12974. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12975. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12976. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12977. m_Print.SetFontFace(9, 1, "宋体");
  12978. for ( i = 7; i < 24; i++)
  12979. {
  12980. StrRect = load.m_rcarray.ElementAt(i);
  12981. m_Print.DrawRect2(StrRect, 1);
  12982. }
  12983. for (i = 9; i < 24; i++)
  12984. {
  12985. StrRect = load.m_rcarray.ElementAt(i);
  12986. StrRect.left += 2;
  12987. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12988. }
  12989. m_Print.SetFontFace(6, 1, "宋体");
  12990. for (i = 24; i < 26; i++)
  12991. {
  12992. StrRect = load.m_rcarray.ElementAt(i);
  12993. StrRect.left += 2;
  12994. if (i == 24)
  12995. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12996. else
  12997. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12998. }
  12999. }
  13000. else//大单
  13001. {
  13002. m_Print.SetFontFace(20, 1, "黑体");
  13003. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13004. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13005. m_Print.SetFontFace(11, 1, "宋体");
  13006. // StrRect=load.m_rcarray .ElementAt (++rcpos);
  13007. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13008. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15;
  13009. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13010. int hei = StrRect.Height();
  13011. StrRect.bottom = StrRect.top;
  13012. StrRect.top -= 10;
  13013. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  13014. m_Print.SetFontFace(8, 1, "宋体");
  13015. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13016. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13017. m_Print.SetFontFace(11, 1, "宋体");
  13018. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13019. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13020. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13021. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13022. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13023. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13024. m_Print.SetFontFace(13, 1, "宋体");
  13025. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13026. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13027. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13028. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13029. m_Print.SetFontFace(11, 1, "宋体");
  13030. for ( i = 7; i < 24; i++)
  13031. {
  13032. StrRect = load.m_rcarray.ElementAt(i);
  13033. m_Print.DrawRect2(StrRect, 1);
  13034. }
  13035. for (i = 9; i < 24; i++)
  13036. {
  13037. StrRect = load.m_rcarray.ElementAt(i);
  13038. StrRect.left += 2;
  13039. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13040. }
  13041. m_Print.SetFontFace(8, 1, "宋体");
  13042. for (i = 24; i < 27; i++)
  13043. {
  13044. StrRect = load.m_rcarray.ElementAt(i);
  13045. StrRect.left += 2;
  13046. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13047. }
  13048. }
  13049. PrintPreview dlg;
  13050. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13051. dlg.m_pDC = m_Print.GetPDC();
  13052. if (aa == 0)
  13053. {
  13054. if (dlg.DoModal() != IDOK)
  13055. return;
  13056. printcot = dlg.m_num;
  13057. }
  13058. //结束打印
  13059. m_Print.EndPage();
  13060. m_Print.EndPrint();
  13061. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  13062. CString sql;
  13063. sql.Format("update version set [serialno2]='%s'", SerialNo);
  13064. g_sendhead.bsql = 1;
  13065. g_nYearposTemp = g_nYearpos;
  13066. g_nYearpos = -1;
  13067. g_pMainWnd->ProcessChatMessageRequest2(sql);
  13068. g_nYearpos = g_nYearposTemp;
  13069. }
  13070. }
  13071. //出生年月
  13072. //第一联
  13073. void CMainFrame::OnLog()
  13074. {
  13075. // TODO: Add your command handler code here OnShowBakState
  13076. if (IsHasRightsnew(49) == 0)return;
  13077. ShowLOg dlg;
  13078. dlg.DoModal();
  13079. }
  13080. // www.lyfz.net 8888
  13081. void CMainFrame::PrintDinDan6(CString m_id)
  13082. {
  13083. // TODO: Add your control notification handler code here 预约订单
  13084. int printcot = 1;
  13085. for (int aa = 0; aa < printcot; aa++)
  13086. {
  13087. PrintPreview dlg;
  13088. CPrintRX m_Print;
  13089. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13090. {
  13091. m_Print.InitToPrint(NULL, 1);
  13092. }
  13093. else
  13094. {
  13095. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  13096. if (name.IsEmpty())
  13097. m_Print.InitToPrint(NULL, 1);
  13098. else
  13099. {
  13100. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13101. if (nret == -1 && aa == 0)
  13102. {
  13103. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  13104. }
  13105. }
  13106. }
  13107. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  13108. {
  13109. m_Print.StartPrint();
  13110. m_Print.StartPage();
  13111. LoadRect load;
  13112. load.SetLiaPath("6.lia");
  13113. load.SetMargins(-14, 15);
  13114. if (!load.Load())return;
  13115. LoadRect load2;
  13116. load2.SetLiaPath("7.lia");
  13117. load2.SetMargins(-14, 216 + 15);
  13118. if (!load2.Load())return;
  13119. LoadRect load3;
  13120. load3.SetLiaPath("8.lia");
  13121. load3.SetMargins(-14, 705 + 15);
  13122. if (!load3.Load())return;
  13123. int i;
  13124. //////////////////////////////////////////////////////////////
  13125. CStringArray txarray;
  13126. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  13127. g_sendhead.code[0] = 11;
  13128. g_sendhead.code[1] = 52;
  13129. g_sendhead.code[2] = 50;
  13130. g_sendhead.code[3] = 150;
  13131. g_sendhead.code[4] = 77;
  13132. g_sendhead.code[5] = 4;
  13133. g_sendhead.tabcount = 6;
  13134. g_sendhead.bsql = 0;
  13135. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  13136. CArray<CStringArray, CStringArray>sparray;
  13137. CArray<CStringArray, CStringArray>clientarray;
  13138. CArray<CStringArray, CStringArray>phonearray;
  13139. CArray<CStringArray, CStringArray>fgarray;
  13140. CArray<CStringArray, CStringArray>danweiarray;
  13141. CArray<CStringArray, CStringArray>jdarray;
  13142. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  13143. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  13144. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  13145. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  13146. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  13147. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  13148. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  13149. CString m_taoxiname;
  13150. if (m_zs.Find("\\") != -1)
  13151. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  13152. else
  13153. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  13154. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  13155. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  13156. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  13157. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  13158. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  13159. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  13160. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  13161. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  13162. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  13163. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  13164. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  13165. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  13166. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  13167. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  13168. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  13169. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  13170. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  13171. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  13172. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  13173. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  13174. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  13175. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  13176. if (jdarray.GetSize())
  13177. {
  13178. if (m_bz.IsEmpty() == 0)
  13179. m_bz = "\r\n" + m_bz;
  13180. m_bz += "景点:";
  13181. }
  13182. for (i = 0; i < jdarray.GetSize(); i++)
  13183. {
  13184. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  13185. }
  13186. m_bz.TrimRight(";");
  13187. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  13188. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13189. if (IsHasRights2new(31) == 0)
  13190. {
  13191. m_phone1 = "***";
  13192. m_phone2 = "***";
  13193. }
  13194. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  13195. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13196. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  13197. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  13198. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  13199. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  13200. filter = "name='" + m_ren + "'";
  13201. g_sendhead.code[0] = 5;
  13202. g_sendhead.tabcount = 1;
  13203. g_sendhead.bsql = 0;
  13204. int g_nYearposTemp = g_nYearpos;
  13205. g_nYearpos = -1;
  13206. g_pMainWnd->ProcessChatMessageRequest2(filter);
  13207. g_nYearpos = g_nYearposTemp;
  13208. if (g_bSendOK == 0)return;
  13209. DataToArray(&phonearray);
  13210. m_money1.Format("%f", atof(m_taoxijiage));
  13211. m_money2.Format("%f", atof(m_payed1));
  13212. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  13213. ConvertToPrice(m_money1);
  13214. ConvertToPrice(m_money2);
  13215. ConvertToPrice(m_money3);
  13216. ////////////////////////////////////////////////////////////////
  13217. int rcpos = -1;
  13218. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13219. StrRect.top -= 15; StrRect.bottom -= 15;
  13220. Image *pImg = NULL;
  13221. #ifdef MNLS_VERSION
  13222. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  13223. #else
  13224. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  13225. #endif
  13226. m_Print.DrawImage(pImg, StrRect);
  13227. delete pImg;
  13228. m_Print.SetFontFace(11, 1, "宋体");
  13229. StrRect = load.m_rcarray.ElementAt(20);
  13230. StrRect.right = load.m_rcarray.ElementAt(23).right;
  13231. StrRect.top -= 18; StrRect.bottom -= 18;
  13232. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  13233. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13234. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  13235. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13236. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13237. StrRect.top -= 15; StrRect.bottom -= 15;
  13238. #ifdef MNLS_VERSION
  13239. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13240. #endif
  13241. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13242. StrRect.top -= 15; StrRect.bottom -= 15;
  13243. #ifdef MNLS_VERSION
  13244. m_Print.DrawRect(StrRect);
  13245. #endif
  13246. m_Print.SetFontFace(7, 1, "黑体");
  13247. m_Print.SetColor(0xffffff);
  13248. #ifdef MNLS_VERSION
  13249. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13250. #endif
  13251. m_Print.SetColor(0);
  13252. m_Print.SetFontFace(15, 1, "宋体");
  13253. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13254. StrRect.top -= 15; StrRect.bottom -= 15;
  13255. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同拍摄单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13256. CStringArray strarray;
  13257. strarray.Add("NO: " + m_id);
  13258. CString date;
  13259. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  13260. strarray.Add(date);
  13261. strarray.Add("喜爱");
  13262. strarray.Add("格调");
  13263. if (fgarray.GetSize() == 12)
  13264. {
  13265. for (int i = 0; i < 12; i++)
  13266. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  13267. }
  13268. else
  13269. {
  13270. strarray.Add("复古典雅");
  13271. strarray.Add("温文尔雅");
  13272. strarray.Add("豪华艳丽");
  13273. strarray.Add("传统大方");
  13274. strarray.Add("新潮个性");
  13275. strarray.Add("浪漫奔放");
  13276. strarray.Add("简单素雅");
  13277. strarray.Add("活泼俏丽");
  13278. strarray.Add("妩媚温馨");
  13279. strarray.Add("温柔贤惠");
  13280. strarray.Add("成熟感性");
  13281. strarray.Add("清纯可爱");
  13282. }
  13283. strarray.Add("姓名");
  13284. // strarray.Add("职业");
  13285. strarray.Add("");
  13286. strarray.Add("地址");
  13287. strarray.Add("电话");
  13288. #ifdef CHILD_VERSION
  13289. strarray.Add("家长");
  13290. strarray.Add("宝宝");
  13291. #else
  13292. strarray.Add("先生");
  13293. strarray.Add("女士");
  13294. #endif
  13295. m_Print.SetFontFace(11, 1, "宋体");
  13296. for (i = 0; i < strarray.GetSize(); i++)
  13297. {
  13298. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13299. if (i < 2)
  13300. {
  13301. StrRect.top -= 15; StrRect.bottom -= 15;
  13302. }
  13303. if (i>15)
  13304. m_Print.DrawRect2(StrRect, 1);
  13305. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13306. }
  13307. for (i = 29; i <= 40; i++)
  13308. {
  13309. if (m_style.GetLength() <= (i - 29))continue;
  13310. if (m_style.GetAt(i - 29) != '1')continue;
  13311. StrRect = load.m_rcarray.ElementAt(i - 1);
  13312. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13313. }
  13314. for (i = 27; i <= 48; i++)
  13315. {
  13316. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13317. m_Print.DrawRect2(StrRect, 1);
  13318. }
  13319. #ifdef CHILD_VERSION
  13320. StrRect = load.m_rcarray.ElementAt(45);
  13321. StrRect.right = StrRect.left + 62;
  13322. m_Print.DrawRect2(StrRect, 1);
  13323. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13324. StrRect.left = StrRect.right;
  13325. StrRect.right = StrRect.left + 62;
  13326. m_Print.DrawRect2(StrRect, 1);
  13327. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13328. StrRect.left = StrRect.right;
  13329. StrRect.right = StrRect.left + 62;
  13330. m_Print.DrawRect2(StrRect, 1);
  13331. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13332. StrRect.left = StrRect.right;
  13333. StrRect.right = StrRect.left + 62;
  13334. m_Print.DrawRect2(StrRect, 1);
  13335. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13336. #endif
  13337. /////////////////////////
  13338. strarray.RemoveAll();
  13339. CString temp;
  13340. temp.Format("拍摄 选 %d 款,其中", atoi(m_outside) + atoi(m_outside2));
  13341. strarray.Add(temp);
  13342. temp.Format("内景 %d 款,外景 %d 款.", atoi(m_outside2), atoi(m_outside));
  13343. strarray.Add(temp);
  13344. strarray.Add("化妆");
  13345. strarray.Add("造型");
  13346. #ifdef CHILD_VERSION
  13347. strarray.Add("");
  13348. #else
  13349. strarray.Add("婚纱");
  13350. #endif
  13351. strarray.Add("服饰");
  13352. strarray.Add("配");
  13353. strarray.Add("置");
  13354. strarray.Add("其");
  13355. strarray.Add("它");
  13356. strarray.Add("套系名称");
  13357. strarray.Add("镜款");
  13358. strarray.Add("套系总价");
  13359. strarray.Add("主摄影师");
  13360. strarray.Add("拍摄日期");
  13361. strarray.Add("定金");
  13362. #ifdef CHILD_VERSION
  13363. strarray.Add("主引导师");
  13364. #else
  13365. strarray.Add("主化妆师");
  13366. #endif
  13367. strarray.Add("看样日期");
  13368. strarray.Add("补 余 款");
  13369. strarray.Add("总监");
  13370. strarray.Add("取件日期");
  13371. rcpos = -1;
  13372. for (i = 0; i < strarray.GetSize(); i++)
  13373. {
  13374. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13375. if (i>9)
  13376. m_Print.DrawRect2(StrRect, 1);
  13377. #ifdef CHILD_VERSION
  13378. if (i == 5)
  13379. StrRect.top -= StrRect.Height();
  13380. #endif
  13381. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13382. }
  13383. for (i = 22; i <= 41; i++)
  13384. {
  13385. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13386. m_Print.DrawRect2(StrRect, 1);
  13387. }
  13388. /////////////////////////////
  13389. strarray.RemoveAll();
  13390. #ifdef CHILD_VERSION
  13391. strarray.Add("顾客方 家长:");
  13392. strarray.Add("宝宝:");
  13393. #else
  13394. strarray.Add("顾客方 先生:");
  13395. strarray.Add("女士:");
  13396. #endif
  13397. strarray.Add("电话:");
  13398. strarray.Add("影楼方 店长:");
  13399. strarray.Add("接单人:");
  13400. strarray.Add("电话:");
  13401. rcpos = -1;
  13402. for (i = 0; i < strarray.GetSize(); i++)
  13403. {
  13404. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13405. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13406. }
  13407. for (i = 7; i <= 12; i++)
  13408. {
  13409. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13410. // if(i!=10)
  13411. m_Print.DrawRect2(StrRect, 2);
  13412. }
  13413. //////////////////////////////////////
  13414. //开始打数据
  13415. strarray.RemoveAll();
  13416. strarray.Add(m_name1);
  13417. strarray.Add(m_name2);
  13418. strarray.Add("");
  13419. strarray.Add("");
  13420. strarray.Add(m_addr1);
  13421. #ifdef CHILD_VERSION
  13422. strarray.Add("");
  13423. #else
  13424. strarray.Add(m_addr2);
  13425. #endif
  13426. strarray.Add(m_phone1);
  13427. strarray.Add(m_phone2);
  13428. for (i = 41; i <= 48; i++)
  13429. {
  13430. StrRect = load.m_rcarray.ElementAt(i - 1);
  13431. StrRect.left += 4;
  13432. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13433. }
  13434. ///////////////////////////////
  13435. strarray.RemoveAll();
  13436. strarray.Add(m_money1);
  13437. strarray.Add(m_waiter1);
  13438. strarray.Add(m_time2);
  13439. strarray.Add(m_money2);
  13440. strarray.Add(m_waiter2);
  13441. strarray.Add(m_time4);
  13442. strarray.Add(m_money3);
  13443. strarray.Add("");
  13444. strarray.Add(m_time5);
  13445. for (i = 32; i <= 40; i++)
  13446. {
  13447. StrRect = load2.m_rcarray.ElementAt(i - 1);
  13448. StrRect.left += 4;
  13449. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13450. }
  13451. ///////////////////////////////
  13452. strarray.RemoveAll();
  13453. strarray.Add("");//m_name1);
  13454. strarray.Add("");//m_name2);
  13455. CString phone;
  13456. if (m_phone1.IsEmpty() == 0)
  13457. phone = m_phone1 + ",";
  13458. phone += m_phone2;
  13459. phone.TrimRight(",");
  13460. strarray.Add("");//phone);
  13461. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  13462. strarray.Add(m_ren);
  13463. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13464. for (i = 7; i <= 12; i++)
  13465. {
  13466. StrRect = load3.m_rcarray.ElementAt(i - 1);
  13467. StrRect.left += 4;
  13468. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13469. }
  13470. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  13471. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13472. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  13473. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13474. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  13475. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13476. //////////////////////////////
  13477. //开始画文字
  13478. StrRect = load2.m_rcarray.ElementAt(30);
  13479. StrRect.left += 3;
  13480. StrRect.top += 3;
  13481. StrRect.right -= 2;
  13482. StrRect.bottom -= 2;
  13483. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  13484. StrRect = load2.m_rcarray.ElementAt(29);
  13485. StrRect.left += 3;
  13486. StrRect.top += 3;
  13487. StrRect.right -= 2;
  13488. StrRect.bottom -= 2;
  13489. str = "";
  13490. for (i = 0; i < sparray.GetSize(); i++)
  13491. {
  13492. str += sparray.ElementAt(i).ElementAt(5);
  13493. str += " 数量:";
  13494. str += sparray.ElementAt(i).ElementAt(3);
  13495. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  13496. str += "\r\n";
  13497. }
  13498. str.TrimRight("\r\n");
  13499. AutoDraw(m_Print, StrRect, str, 1.4);
  13500. StrRect = load2.m_rcarray.ElementAt(40);
  13501. StrRect.top += 8;
  13502. m_Print.SetFontFace(12, 1, "黑体");
  13503. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  13504. StrRect.left += 3;
  13505. StrRect.top += 30;
  13506. StrRect.right -= 2;
  13507. StrRect.bottom -= 2;
  13508. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  13509. if (str.IsEmpty())
  13510. {
  13511. str = "\
  13512. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  13513. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  13514. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  13515. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  13516. 持良好的心境.\r\n\
  13517. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  13518. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  13519. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  13520. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  13521. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  13522. 勿进影室, 以免影响拍摄.\r\n\
  13523. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  13524. 师或店长沟通.\r\n\
  13525. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  13526. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  13527. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  13528. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  13529. 9. 本合同余额欠款须在拍照前付清.\r\n\
  13530. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  13531. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  13532. 还.";
  13533. }
  13534. AutoDraw(m_Print, StrRect, str, 1.8);
  13535. }
  13536. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13537. dlg.m_pDC = m_Print.GetPDC();
  13538. dlg.m_mode = 1;
  13539. if (aa == 0)
  13540. {
  13541. if (dlg.DoModal() != IDOK)
  13542. return;
  13543. printcot = dlg.m_num;
  13544. }
  13545. //结束打印
  13546. m_Print.EndPage();
  13547. m_Print.EndPrint();
  13548. }
  13549. }
  13550. void CMainFrame::InsideMsg()
  13551. {
  13552. ///内部消息
  13553. CString str;
  13554. g_sendhead.bsql = 0;
  13555. g_sendhead.code[0] = 126;
  13556. g_sendhead.tabcount = 1;
  13557. g_bNoConnDlg = 1;
  13558. g_pMainWnd->ProcessChatMessageRequest2(1); g_bNoConnDlg = 0;
  13559. if (g_bSendOK == 0)return;
  13560. CArray<CStringArray, CStringArray>m_List1array;
  13561. DataToArray(&g_List1array);//, &m_List1array);
  13562. int i = 0;
  13563. m_List1array.SetSize(g_List1array.GetSize());
  13564. for ( i = 0; i < g_List1array.GetSize(); i++)
  13565. {
  13566. m_List1array.ElementAt(i).Copy(g_List1array.ElementAt(i));
  13567. }
  13568. str = "," + g_user.name + ",";
  13569. for (i = g_List1array.GetSize() - 1; i >= 0; i--)
  13570. {
  13571. CString receivers2 = g_List1array.ElementAt(i).ElementAt(4);
  13572. receivers2.TrimLeft(",");
  13573. receivers2.TrimRight(",");
  13574. receivers2 = "," + receivers2 + ",";
  13575. CString receivers = g_List1array.ElementAt(i).ElementAt(3);
  13576. receivers.TrimLeft(",");
  13577. receivers.TrimRight(",");
  13578. receivers = "," + receivers + ",";
  13579. if (receivers.Find(str) == -1)
  13580. g_List1array.RemoveAt(i);
  13581. else if (receivers2.Find(str) != -1)
  13582. g_List1array.RemoveAt(i);
  13583. }
  13584. if (g_List1array.GetSize())
  13585. {
  13586. ShowMsg dlg;
  13587. dlg.DoModal();
  13588. }
  13589. for (i = m_List1array.GetSize() - 1; i >= 0; i--)
  13590. {
  13591. CString receivers2 = m_List1array.ElementAt(i).ElementAt(4);
  13592. receivers2.TrimLeft(",");
  13593. receivers2.TrimRight(",");
  13594. receivers2 = "," + receivers2 + ",";
  13595. CString receivers = m_List1array.ElementAt(i).ElementAt(3);
  13596. if (receivers != "")
  13597. m_List1array.RemoveAt(i);
  13598. else if (receivers2.Find(str) != -1)
  13599. m_List1array.RemoveAt(i);
  13600. }
  13601. if (m_List1array.GetSize())
  13602. {
  13603. SendInsideMsg2 dlg;
  13604. dlg.m_bShow = 1;
  13605. dlg.m_pArray = &m_List1array;
  13606. dlg.DoModal();
  13607. }
  13608. }
  13609. //定金
  13610. /************************************************************************/
  13611. /*
  13612. 函数:PrintHireDress
  13613. 描述:打印礼服出租单;
  13614. 参数:
  13615. strOrderNumber 礼服订单号;
  13616. 注意:
  13617. */
  13618. /************************************************************************/
  13619. void CMainFrame::PrintHireDress(CString strOrderNumber) // 打印礼服出租单;
  13620. {
  13621. int printcot = 1;
  13622. for (int aa = 0; aa < printcot; aa++)
  13623. {
  13624. CPrintRX m_Print;
  13625. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13626. {
  13627. m_Print.InitToPrint(NULL, 1);
  13628. }
  13629. else
  13630. {
  13631. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13632. if (name.IsEmpty())
  13633. m_Print.InitToPrint(NULL, 1);
  13634. else
  13635. {
  13636. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13637. if (nret == -1 && aa == 0)
  13638. {
  13639. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  13640. }
  13641. }
  13642. }
  13643. m_Print.StartPrint();
  13644. m_Print.StartPage();
  13645. LoadRect load;
  13646. load.SetLiaPath("21.lia");
  13647. load.SetMargins(0, 0);
  13648. if (!load.Load())
  13649. {
  13650. return;
  13651. }
  13652. int i;
  13653. //////////////////////////////////////////////////////////////
  13654. //CString filter="id='"+strOrderNumber+"';id='"+strOrderNumber+"';id='"+strOrderNumber+"'";
  13655. CString strFilter;
  13656. strFilter.Format("id='%s';id='%s';id='%s'", strOrderNumber, strOrderNumber, strOrderNumber);
  13657. g_sendhead.bsql = 0;
  13658. g_sendhead.code[0] = 73;
  13659. g_sendhead.code[1] = 74;
  13660. g_sendhead.code[2] = 52;
  13661. g_sendhead.tabcount = 3;
  13662. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  13663. if (g_bSendOK == 0)
  13664. {
  13665. return;
  13666. }
  13667. CArray<CStringArray, CStringArray>dresshirearray;
  13668. CArray<CStringArray, CStringArray>dresshiredataarray;
  13669. CArray<CStringArray, CStringArray>clientarray;
  13670. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13671. if (dresshirearray.GetSize() == 0)
  13672. {
  13673. return;
  13674. }
  13675. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10);
  13676. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7);
  13677. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8);
  13678. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6);
  13679. if (clientarray.GetSize() == 0)
  13680. {
  13681. return;
  13682. }
  13683. //AfxMessageBox("打印礼服出租单-()");
  13684. CString m_name2 = clientarray.ElementAt(0).ElementAt(2);
  13685. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13686. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13687. CString m_time3 = clientarray.ElementAt(0).ElementAt(20);
  13688. //#if JEFF_TEST
  13689. // if ( dresshiredataarray.GetSize() == 0 )
  13690. // {
  13691. // AfxMessageBox("没衣服");
  13692. // }
  13693. //#endif
  13694. CString sItem;
  13695. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13696. {
  13697. sItem += "编号:";
  13698. sItem += dresshiredataarray.ElementAt(i).ElementAt(1);
  13699. sItem += " ";
  13700. sItem += " 名称:";
  13701. sItem += dresshiredataarray.ElementAt(i).ElementAt(2);
  13702. sItem += " 数量:";
  13703. sItem += dresshiredataarray.ElementAt(i).ElementAt(3) + "\r\n";
  13704. }
  13705. sItem += "金额:";
  13706. sItem += dresshirearray.ElementAt(0).ElementAt(1);
  13707. sItem += " ";
  13708. sItem += " 押金:";
  13709. sItem += dresshirearray.ElementAt(0).ElementAt(2) + "\r\n";
  13710. ////////////////////////////////////////////////////////////////
  13711. int rcpos = -1;
  13712. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13713. m_Print.SetFontFace(17, 1, "宋体");
  13714. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13715. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13716. m_Print.SetFontFace(10, 1, "宋体");
  13717. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13718. CStringArray strarray;
  13719. strarray.Add("客户姓名");
  13720. strarray.Add("客户电话");
  13721. strarray.Add("预定日期");
  13722. strarray.Add("结婚日期");
  13723. strarray.Add("取件日期");
  13724. strarray.Add("归还日期");
  13725. strarray.Add("本店地址");
  13726. strarray.Add("电 话");
  13727. strarray.Add("客户地址");
  13728. strarray.Add("客户签名");
  13729. for (i = 2; i < 12; i++)
  13730. {
  13731. StrRect = load.m_rcarray.ElementAt(i);
  13732. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13733. }
  13734. strarray.RemoveAll();
  13735. strarray.Add(m_name2);
  13736. strarray.Add(m_phone2);
  13737. strarray.Add(m_inputdate);
  13738. strarray.Add(m_time3);
  13739. strarray.Add(m_date1);
  13740. strarray.Add(m_date2);
  13741. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13742. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13743. strarray.Add(m_addr2);
  13744. strarray.Add("");
  13745. for (i = 12; i < 22; i++)
  13746. {
  13747. StrRect = load.m_rcarray.ElementAt(i);
  13748. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13749. m_Print.DrawRect2(StrRect, 2);
  13750. }
  13751. for (i = 25; i < 30; i++)
  13752. {
  13753. StrRect = load.m_rcarray.ElementAt(i);
  13754. m_Print.DrawRect2(StrRect, 1);
  13755. }
  13756. StrRect = load.m_rcarray.ElementAt(22);
  13757. StrRect.top += 7;
  13758. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13759. StrRect = load.m_rcarray.ElementAt(23);
  13760. StrRect.top += 7;
  13761. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13762. StrRect = load.m_rcarray.ElementAt(24);
  13763. StrRect.top += 7;
  13764. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13765. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13766. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13767. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13768. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13769. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13770. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13771. if (str.IsEmpty())
  13772. {
  13773. str = "\
  13774. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13775. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13776. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13777. 4. 如有破损酌情赔偿.";
  13778. }
  13779. AutoDraw(m_Print, StrRect, str, 1.5);
  13780. PrintPreview dlg;
  13781. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13782. dlg.m_pDC = m_Print.GetPDC();
  13783. if (aa == 0)
  13784. {
  13785. if (dlg.DoModal() != IDOK)
  13786. return;
  13787. printcot = dlg.m_num;
  13788. }
  13789. //结束打印
  13790. m_Print.EndPage();
  13791. m_Print.EndPrint();
  13792. }
  13793. }
  13794. void CMainFrame::PrintHireDress_01(CString strOrderNumber) // 打印礼服出租单,无法改变结构,需要修改21.lia才能改变打印的布局;
  13795. {
  13796. int printcot = 1;
  13797. for (int aa = 0; aa < printcot; aa++)
  13798. {
  13799. CPrintRX m_Print;
  13800. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13801. {
  13802. m_Print.InitToPrint(NULL, 1);
  13803. }
  13804. else
  13805. {
  13806. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13807. if (name.IsEmpty())
  13808. m_Print.InitToPrint(NULL, 1);
  13809. else
  13810. {
  13811. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13812. if (nret == -1 && aa == 0)
  13813. {
  13814. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  13815. m_Print.InitToPrint(NULL, 1);
  13816. }
  13817. }
  13818. }
  13819. m_Print.StartPrint();
  13820. m_Print.StartPage();
  13821. LoadRect load;
  13822. load.SetLiaPath("21.lia");
  13823. load.SetMargins(0, 0);
  13824. if (!load.Load())return;
  13825. int i;
  13826. //////////////////////////////////////////////////////////////
  13827. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  13828. g_sendhead.bsql = 0;
  13829. g_sendhead.code[0] = 73; // dresshire表;
  13830. g_sendhead.code[1] = 74; // dresshiredata表;
  13831. g_sendhead.code[2] = 52; // client表;
  13832. g_sendhead.tabcount = 3;
  13833. g_pMainWnd->ProcessChatMessageRequest2(filter);
  13834. if (g_bSendOK == 0)
  13835. {
  13836. return;
  13837. }
  13838. CArray<CStringArray, CStringArray>dresshirearray;
  13839. CArray<CStringArray, CStringArray>dresshiredataarray;
  13840. CArray<CStringArray, CStringArray>clientarray;
  13841. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13842. if (dresshirearray.GetSize() == 0)return;
  13843. // dresshire;
  13844. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10); // 备注;
  13845. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7); // 取衣日期;
  13846. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8); // 还衣日期;
  13847. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6); // 记录日期;
  13848. CString strPrice = dresshirearray.ElementAt(0).ElementAt(1); // 金额;
  13849. CString strDeposit = dresshirearray.ElementAt(0).ElementAt(2); // 押金;
  13850. // client表;
  13851. if (clientarray.GetSize() == 0)return;
  13852. CString m_name2 = clientarray.ElementAt(0).ElementAt(2); // 女宾姓名;
  13853. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4); // 女宾手机;
  13854. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8); // 女宾地址;
  13855. CString m_time3 = clientarray.ElementAt(0).ElementAt(20); // 婚期;
  13856. // dresshiredata表;
  13857. CString sItem;
  13858. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13859. {
  13860. sItem += dresshiredataarray.ElementAt(i).ElementAt(1); // 礼服编号;
  13861. sItem += " ";
  13862. sItem += dresshiredataarray.ElementAt(i).ElementAt(2); // 礼服名称;
  13863. sItem += " 数量:";
  13864. sItem += dresshiredataarray.ElementAt(i).ElementAt(3) + "\r\n"; // 礼服数量;
  13865. }
  13866. sItem += " 金额:";
  13867. sItem += dresshirearray.ElementAt(0).ElementAt(1); // 出租金额;
  13868. sItem += " 押金:";
  13869. sItem += dresshirearray.ElementAt(0).ElementAt(2) + "\r\n"; // 押金;
  13870. ////////////////////////////////////////////////////////////////
  13871. int rcpos = -1;
  13872. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13873. m_Print.SetFontFace(17, 1, "宋体");
  13874. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13875. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13876. m_Print.SetFontFace(10, 1, "宋体");
  13877. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13878. CStringArray strarray;
  13879. strarray.Add("客户姓名"); // 1.
  13880. strarray.Add("客户电话");
  13881. strarray.Add("预定日期");
  13882. strarray.Add("结婚日期");
  13883. strarray.Add("取件日期"); // 5.
  13884. strarray.Add("归还日期");
  13885. strarray.Add("本店地址");
  13886. strarray.Add("电 话");
  13887. strarray.Add("客户地址");
  13888. strarray.Add("客户签名"); // 10.
  13889. //strarray.Add("金额");
  13890. //strarray.Add("押金");
  13891. for( i=2; i<12; i++)
  13892. //for (i = 2; i < 14; i++)
  13893. {
  13894. StrRect = load.m_rcarray.ElementAt(i);
  13895. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13896. }
  13897. strarray.RemoveAll();
  13898. strarray.Add(m_name2);
  13899. strarray.Add(m_phone2);
  13900. strarray.Add(m_inputdate);
  13901. strarray.Add(m_time3);
  13902. strarray.Add(m_date1);
  13903. strarray.Add(m_date2);
  13904. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13905. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13906. strarray.Add(m_addr2);
  13907. strarray.Add("");
  13908. strarray.Add(strPrice); // 金额;
  13909. strarray.Add(strDeposit); // 押金;
  13910. for( i=12; i<22; i++)
  13911. //for (i = 14; i < 24; i++)
  13912. {
  13913. StrRect = load.m_rcarray.ElementAt(i);
  13914. //m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i-12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13915. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 14), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13916. m_Print.DrawRect2(StrRect, 2);
  13917. }
  13918. for (i = 25; i < 30; i++)
  13919. {
  13920. StrRect = load.m_rcarray.ElementAt(i);
  13921. m_Print.DrawRect2(StrRect, 1);
  13922. }
  13923. StrRect = load.m_rcarray.ElementAt(22);
  13924. StrRect.top += 7;
  13925. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13926. StrRect = load.m_rcarray.ElementAt(23);
  13927. StrRect.top += 7;
  13928. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13929. StrRect = load.m_rcarray.ElementAt(24);
  13930. StrRect.top += 7;
  13931. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13932. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13933. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13934. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13935. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13936. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13937. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13938. if (str.IsEmpty())
  13939. {
  13940. str = "\
  13941. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13942. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13943. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13944. 4. 如有破损酌情赔偿.";
  13945. }
  13946. AutoDraw(m_Print, StrRect, str, 1.5);
  13947. PrintPreview dlg;
  13948. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13949. dlg.m_pDC = m_Print.GetPDC();
  13950. if (aa == 0)
  13951. {
  13952. if (dlg.DoModal() != IDOK)
  13953. return;
  13954. printcot = dlg.m_num;
  13955. }
  13956. //结束打印
  13957. m_Print.EndPage();
  13958. m_Print.EndPrint();
  13959. }
  13960. }
  13961. void CMainFrame::PrintTakeForm2(CArray<CStringArray, CStringArray>*Listarray)
  13962. {
  13963. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "选片客人明细表";
  13964. int pages = Listarray->GetSize() / 46;
  13965. if (Listarray->GetSize() % 46)pages++;
  13966. for (int aa = 0; aa < pages; aa++)
  13967. {
  13968. PrintPreview dlg;
  13969. CPrintRX m_Print;
  13970. m_Print.InitToPrint(NULL, 1);
  13971. m_Print.StartPrint();
  13972. m_Print.StartPage();
  13973. CRect mainrc(0, 0, 560, 793);
  13974. float fscale;
  13975. {
  13976. int w, h;
  13977. m_Print.GetWidHei(w, h);
  13978. fscale = (float)w / (float)h;
  13979. }
  13980. mainrc.DeflateRect(25, 40, 10, 0);
  13981. CRect rc, rc2;
  13982. rc = mainrc;
  13983. rc.bottom = rc.top;
  13984. rc.top -= 20;
  13985. m_Print.SetFontFace(16, 1, "黑体");
  13986. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13987. m_Print.SetFontFace(9, 1, "宋体");
  13988. CString str;
  13989. int wid[5] = { 200, 110, 70, 85, 62 };
  13990. int hei = 16;
  13991. if (fscale > 0.71)hei = 15;
  13992. rc = mainrc;
  13993. rc.bottom = rc.top + hei;
  13994. for (int i = 0; i < 47; i++)
  13995. {
  13996. rc2.top = rc.top + i*hei;
  13997. rc2.bottom = rc.bottom + i*hei;
  13998. rc2.left = rc.left;
  13999. rc2.right = rc.left + wid[0];
  14000. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14001. for (int j = 0; j<5; j++)
  14002. {
  14003. m_Print.DrawRect2(rc2, 1);
  14004. if (Listarray->GetSize()>aa * 46 + i)
  14005. {
  14006. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14007. rc2.left += 3;
  14008. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14009. rc2.left -= 3;
  14010. }
  14011. rc2.left += wid[j];
  14012. rc2.right = rc2.left + wid[j + 1];
  14013. }
  14014. }
  14015. rc2.top += 2;
  14016. rc2.left += 2; rc2.right = mainrc.right + 4;
  14017. m_Print.SetFontFace(8, 1, "宋体");
  14018. str.Format(" 页:%d/%d", aa + 1, pages);
  14019. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14020. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14021. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14022. dlg.m_pDC = m_Print.GetPDC();
  14023. // dlg.m_mode=1;
  14024. if (aa == 0)
  14025. {
  14026. if (dlg.DoModal() != IDOK)
  14027. return;
  14028. }
  14029. //结束打印
  14030. m_Print.EndPage();
  14031. m_Print.EndPrint();
  14032. }
  14033. }
  14034. void CMainFrame::PrintTakeForm3(CArray<CStringArray, CStringArray>*Listarray)
  14035. {
  14036. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "看设计客人明细表";
  14037. int pages = Listarray->GetSize() / 46;
  14038. if (Listarray->GetSize() % 46)pages++;
  14039. for (int aa = 0; aa < pages; aa++)
  14040. {
  14041. PrintPreview dlg;
  14042. CPrintRX m_Print;
  14043. m_Print.InitToPrint(NULL, 1);
  14044. m_Print.StartPrint();
  14045. m_Print.StartPage();
  14046. CRect mainrc(0, 0, 560, 793);
  14047. float fscale;
  14048. {
  14049. int w, h;
  14050. m_Print.GetWidHei(w, h);
  14051. fscale = (float)w / (float)h;
  14052. }
  14053. mainrc.DeflateRect(25, 40, 10, 0);
  14054. CRect rc, rc2;
  14055. rc = mainrc;
  14056. rc.bottom = rc.top;
  14057. rc.top -= 20;
  14058. m_Print.SetFontFace(16, 1, "黑体");
  14059. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14060. m_Print.SetFontFace(9, 1, "宋体");
  14061. CString str;
  14062. int wid[5] = { 200, 110, 70, 85, 62 };
  14063. int hei = 16;
  14064. if (fscale > 0.71)hei = 15;
  14065. rc = mainrc;
  14066. rc.bottom = rc.top + hei;
  14067. for (int i = 0; i < 47; i++)
  14068. {
  14069. rc2.top = rc.top + i*hei;
  14070. rc2.bottom = rc.bottom + i*hei;
  14071. rc2.left = rc.left;
  14072. rc2.right = rc.left + wid[0];
  14073. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14074. for (int j = 0; j<5; j++)
  14075. {
  14076. m_Print.DrawRect2(rc2, 1);
  14077. if (Listarray->GetSize()>aa * 46 + i)
  14078. {
  14079. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14080. rc2.left += 3;
  14081. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14082. rc2.left -= 3;
  14083. }
  14084. rc2.left += wid[j];
  14085. rc2.right = rc2.left + wid[j + 1];
  14086. }
  14087. }
  14088. rc2.top += 2;
  14089. rc2.left += 2; rc2.right = mainrc.right + 4;
  14090. m_Print.SetFontFace(8, 1, "宋体");
  14091. str.Format(" 页:%d/%d", aa + 1, pages);
  14092. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14093. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14094. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14095. dlg.m_pDC = m_Print.GetPDC();
  14096. // dlg.m_mode=1;
  14097. if (aa == 0)
  14098. {
  14099. if (dlg.DoModal() != IDOK)
  14100. return;
  14101. }
  14102. //结束打印
  14103. m_Print.EndPage();
  14104. m_Print.EndPrint();
  14105. }
  14106. }
  14107. void CMainFrame::PrintTakeForm4(CArray<CStringArray, CStringArray>*Listarray)
  14108. {
  14109. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "取件客人明细表";
  14110. int pages = Listarray->GetSize() / 46;
  14111. if (Listarray->GetSize() % 46)pages++;
  14112. for (int aa = 0; aa < pages; aa++)
  14113. {
  14114. PrintPreview dlg;
  14115. CPrintRX m_Print;
  14116. m_Print.InitToPrint(NULL, 1);
  14117. m_Print.StartPrint();
  14118. m_Print.StartPage();
  14119. CRect mainrc(0, 0, 560, 793);
  14120. float fscale;
  14121. {
  14122. int w, h;
  14123. m_Print.GetWidHei(w, h);
  14124. fscale = (float)w / (float)h;
  14125. }
  14126. mainrc.DeflateRect(25, 40, 10, 0);
  14127. CRect rc, rc2;
  14128. rc = mainrc;
  14129. rc.bottom = rc.top;
  14130. rc.top -= 20;
  14131. m_Print.SetFontFace(16, 1, "黑体");
  14132. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14133. m_Print.SetFontFace(9, 1, "宋体");
  14134. CString str;
  14135. int wid[5] = { 200, 110, 70, 85, 62 };
  14136. int hei = 16;
  14137. if (fscale > 0.71)hei = 15;
  14138. rc = mainrc;
  14139. rc.bottom = rc.top + hei;
  14140. for (int i = 0; i < 47; i++)
  14141. {
  14142. rc2.top = rc.top + i*hei;
  14143. rc2.bottom = rc.bottom + i*hei;
  14144. rc2.left = rc.left;
  14145. rc2.right = rc.left + wid[0];
  14146. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14147. for (int j = 0; j<5; j++)
  14148. {
  14149. m_Print.DrawRect2(rc2, 1);
  14150. if (Listarray->GetSize()>aa * 46 + i)
  14151. {
  14152. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14153. rc2.left += 3;
  14154. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14155. rc2.left -= 3;
  14156. }
  14157. rc2.left += wid[j];
  14158. rc2.right = rc2.left + wid[j + 1];
  14159. }
  14160. }
  14161. rc2.top += 2;
  14162. rc2.left += 2; rc2.right = mainrc.right + 4;
  14163. m_Print.SetFontFace(8, 1, "宋体");
  14164. str.Format(" 页:%d/%d", aa + 1, pages);
  14165. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14166. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14167. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14168. dlg.m_pDC = m_Print.GetPDC();
  14169. // dlg.m_mode=1;
  14170. if (aa == 0)
  14171. {
  14172. if (dlg.DoModal() != IDOK)
  14173. return;
  14174. }
  14175. //结束打印
  14176. m_Print.EndPage();
  14177. m_Print.EndPrint();
  14178. }
  14179. }
  14180. void CMainFrame::PrintTakeForm5(CArray<CStringArray, CStringArray>*Listarray)
  14181. {
  14182. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "婚庆客人明细表";
  14183. int pages = Listarray->GetSize() / 46;
  14184. if (Listarray->GetSize() % 46)pages++;
  14185. for (int aa = 0; aa < pages; aa++)
  14186. {
  14187. PrintPreview dlg;
  14188. CPrintRX m_Print;
  14189. m_Print.InitToPrint(NULL, 1);
  14190. m_Print.StartPrint();
  14191. m_Print.StartPage();
  14192. CRect mainrc(0, 0, 560, 793);
  14193. float fscale;
  14194. {
  14195. int w, h;
  14196. m_Print.GetWidHei(w, h);
  14197. fscale = (float)w / (float)h;
  14198. }
  14199. mainrc.DeflateRect(25, 40, 10, 0);
  14200. CRect rc, rc2;
  14201. rc = mainrc;
  14202. rc.bottom = rc.top;
  14203. rc.top -= 20;
  14204. m_Print.SetFontFace(16, 1, "黑体");
  14205. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14206. m_Print.SetFontFace(8, 1, "宋体");
  14207. CString str;
  14208. int wid[7] = { 165, 90, 90, 45, 45, 60, 35 };
  14209. int hei = 16;
  14210. if (fscale > 0.71)hei = 15;
  14211. rc = mainrc;
  14212. rc.bottom = rc.top + hei;
  14213. for (int i = 0; i < 47; i++)
  14214. {
  14215. rc2.top = rc.top + i*hei;
  14216. rc2.bottom = rc.bottom + i*hei;
  14217. rc2.left = rc.left;
  14218. rc2.right = rc.left + wid[0];
  14219. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14220. for (int j = 0; j<7; j++)
  14221. {
  14222. m_Print.DrawRect2(rc2, 1);
  14223. if (Listarray->GetSize()>aa * 46 + i)
  14224. {
  14225. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14226. rc2.left += 3;
  14227. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14228. rc2.left -= 3;
  14229. }
  14230. rc2.left += wid[j];
  14231. rc2.right = rc2.left + wid[j + 1];
  14232. }
  14233. }
  14234. rc2.top += 2;
  14235. rc2.left += 2; rc2.right = mainrc.right + 4;
  14236. m_Print.SetFontFace(8, 1, "宋体");
  14237. str.Format(" 页:%d/%d", aa + 1, pages);
  14238. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14239. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14240. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14241. dlg.m_pDC = m_Print.GetPDC();
  14242. // dlg.m_mode=1;
  14243. if (aa == 0)
  14244. {
  14245. if (dlg.DoModal() != IDOK)
  14246. return;
  14247. }
  14248. //结束打印
  14249. m_Print.EndPage();
  14250. m_Print.EndPrint();
  14251. }
  14252. }
  14253. void CMainFrame::PrintTakeForm1(CArray<CStringArray, CStringArray>*Listarray)
  14254. {
  14255. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "拍照客人明细表";
  14256. int pages = Listarray->GetSize() / 46;
  14257. if (Listarray->GetSize() % 46)pages++;
  14258. for (int aa = 0; aa < pages; aa++)
  14259. {
  14260. PrintPreview dlg;
  14261. CPrintRX m_Print;
  14262. m_Print.InitToPrint(NULL, 1);
  14263. m_Print.StartPrint();
  14264. m_Print.StartPage();
  14265. CRect mainrc(0, 0, 560, 793);
  14266. float fscale;
  14267. {
  14268. int w, h;
  14269. m_Print.GetWidHei(w, h);
  14270. fscale = (float)w / (float)h;
  14271. }
  14272. mainrc.DeflateRect(25, 40, 10, 0);
  14273. CRect rc, rc2;
  14274. rc = mainrc;
  14275. rc.bottom = rc.top;
  14276. rc.top -= 20;
  14277. m_Print.SetFontFace(16, 1, "黑体");
  14278. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14279. m_Print.SetFontFace(8, 1, "宋体");
  14280. CString str;
  14281. int wid[7] = { 165, 60, 90, 60, 60, 60, 35 };
  14282. int hei = 16;
  14283. if (fscale > 0.71)hei = 15;
  14284. rc = mainrc;
  14285. rc.bottom = rc.top + hei;
  14286. for (int i = 0; i < 47; i++)
  14287. {
  14288. rc2.top = rc.top + i*hei;
  14289. rc2.bottom = rc.bottom + i*hei;
  14290. rc2.left = rc.left;
  14291. rc2.right = rc.left + wid[0];
  14292. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14293. for (int j = 0; j<7; j++)
  14294. {
  14295. m_Print.DrawRect2(rc2, 1);
  14296. if (Listarray->GetSize()>aa * 46 + i)
  14297. {
  14298. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14299. rc2.left += 3;
  14300. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14301. rc2.left -= 3;
  14302. }
  14303. rc2.left += wid[j];
  14304. rc2.right = rc2.left + wid[j + 1];
  14305. }
  14306. }
  14307. rc2.top += 2;
  14308. rc2.left += 2; rc2.right = mainrc.right + 4;
  14309. m_Print.SetFontFace(8, 1, "宋体");
  14310. str.Format(" 页:%d/%d", aa + 1, pages);
  14311. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14312. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14313. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14314. dlg.m_pDC = m_Print.GetPDC();
  14315. // dlg.m_mode=1;
  14316. if (aa == 0)
  14317. {
  14318. if (dlg.DoModal() != IDOK)
  14319. return;
  14320. }
  14321. //结束打印
  14322. m_Print.EndPage();
  14323. m_Print.EndPrint();
  14324. }
  14325. }
  14326. void CMainFrame::ShowMonthForm2()
  14327. {
  14328. }
  14329. // dlg;