MainFrm.cpp 457 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622
  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. //WriteTextLog("分店配置存在:%s, ip:%s, 端口号:%d", g_branchname, g_branchip, g_dwCSPort);
  1426. if ( g_szHostComputerIP[0] != '\0') // 如果分店配置文件不填ip,则使用公司记录的ip;
  1427. g_branchip = g_szHostComputerIP;
  1428. MyGetIPByName2(g_branchip);
  1429. }
  1430. else
  1431. {
  1432. // 调用过一次GetSysIniInfo, g_dwCSPort会被清空;
  1433. GetSysIniInfo();
  1434. }
  1435. g_conntype = 0;
  1436. CString strServerAddress = g_branchip;
  1437. char *szServerAddress = strServerAddress.GetBuffer(0);
  1438. strServerAddress.ReleaseBuffer();
  1439. /*for Client, IP and Port can be 0,
  1440. and for Server, IP is LocalIP, and Port is Listening Port*/
  1441. //int nResult = CClientTunnel::GetInstance()->net_OpenSocket(
  1442. int nResult = m_tClientTunnel.net_OpenSocket(
  1443. Transport_Client,
  1444. 0,
  1445. HandleClientNetEvent,
  1446. this);
  1447. if (TRANSPORT_OK != nResult)
  1448. {
  1449. // AfxMessageBox("网络初始化失败!");
  1450. return 0;
  1451. }
  1452. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1453. DWORD wPort = g_dwCSPort;
  1454. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1455. if (TRANSPORT_OK != nResult)
  1456. {
  1457. m_tClientTunnel.net_CloseSocket();
  1458. return OnConnectBranch2();
  1459. }
  1460. return ProcessLoginRequest();
  1461. }
  1462. BOOL CMainFrame::OnConnectBranch2()
  1463. {
  1464. if (g_branchip2 == "")
  1465. {
  1466. return 0;
  1467. }
  1468. g_conntype = 0;
  1469. CString strServerAddress = g_branchip2;
  1470. char *szServerAddress = strServerAddress.GetBuffer(0);
  1471. strServerAddress.ReleaseBuffer();
  1472. /*for Client, IP and Port can be 0,
  1473. and for Server, IP is LocalIP, and Port is Listening Port*/
  1474. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1475. 0,
  1476. HandleClientNetEvent,
  1477. this);
  1478. if (TRANSPORT_OK != nResult)
  1479. {
  1480. // AfxMessageBox("网络初始化失败!");
  1481. return 0;
  1482. }
  1483. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1484. DWORD wPort = SERVER_PORT; // 5678
  1485. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1486. if (TRANSPORT_OK != nResult)
  1487. {
  1488. m_tClientTunnel.net_CloseSocket();
  1489. return 0;
  1490. }
  1491. return ProcessLoginRequest();
  1492. }
  1493. BOOL CMainFrame::OnConnectIP()
  1494. {
  1495. CString strServerAddress = g_server;
  1496. char *szServerAddress = strServerAddress.GetBuffer(0);
  1497. strServerAddress.ReleaseBuffer();
  1498. /*for Client, IP and Port can be 0,
  1499. and for Server, IP is LocalIP, and Port is Listening Port*/
  1500. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1501. 0,
  1502. HandleClientNetEvent,
  1503. this);
  1504. if (TRANSPORT_OK != nResult)
  1505. {
  1506. // AfxMessageBox("网络初始化失败!");
  1507. return 0;
  1508. }
  1509. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1510. DWORD wPort = SERVER_PORT; // 5678
  1511. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1512. if (TRANSPORT_OK != nResult)
  1513. {
  1514. m_tClientTunnel.net_CloseSocket();
  1515. return 0;
  1516. }
  1517. return ProcessLoginRequest();
  1518. }
  1519. //ip.txt
  1520. BOOL CMainFrame::OnConnectLYFZ()
  1521. {
  1522. #ifdef _DEBUG
  1523. CString strBranchIP = "192.168.1.66";
  1524. #else
  1525. CString strBranchIP = "lijiafz.vicp.net";
  1526. #endif
  1527. MyGetIPByName2(strBranchIP);
  1528. if (strBranchIP == "")
  1529. {
  1530. return 0;
  1531. }
  1532. g_conntype = 0; // Jeff.Delete at 2014.10.18
  1533. //g_conntype = 1;
  1534. CString strServerAddress = strBranchIP;
  1535. char *szServerAddress = strServerAddress.GetBuffer(0);
  1536. strServerAddress.ReleaseBuffer();
  1537. /*for Client, IP and Port can be 0,
  1538. and for Server, IP is LocalIP, and Port is Listening Port*/
  1539. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1540. 0,
  1541. HandleClientNetEvent,
  1542. this);
  1543. if (TRANSPORT_OK != nResult)
  1544. {
  1545. return 0;
  1546. }
  1547. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1548. DWORD wPort = GetPort();
  1549. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1550. if (TRANSPORT_OK != nResult)
  1551. {
  1552. m_tClientTunnel.net_CloseSocket();
  1553. #ifdef _DEBUG
  1554. printf("连接远程服务器[失败]地址:%s, 端口=%d\n\n",strBranchIP,wPort);
  1555. #endif
  1556. return 0;
  1557. }
  1558. #ifdef _DEBUG
  1559. printf("连接远程服务器[成功]地址:%s, 端口=%d\n\n",strBranchIP,wPort);
  1560. #endif
  1561. return ProcessLoginRequest();
  1562. }
  1563. BOOL CMainFrame::OnConnect()
  1564. {
  1565. // 1.Jeff 断开(如果有在在未关的连接)之前的连接;
  1566. OnDisconnect();
  1567. // 2.根据需要连接指定的服务器;
  1568. if (g_bBranchModify)
  1569. {
  1570. // Jeff.g_bBranchModify在g_bGenBranchData=1时,在welcome::OnTimer里被设置为1;
  1571. return OnConnectBranch();// 连接集团版分店;
  1572. }
  1573. if (g_bConnLYFZ)
  1574. {
  1575. return OnConnectLYFZ();// 连接公司服务端程序;
  1576. }
  1577. g_conntype = 0;
  1578. CString strServerAddress = g_server;
  1579. // 3.如果dbconfig.dat里保存的是*.ly.com的信息,就要读取ip.txt里的IP地址;
  1580. if (g_serverbak.Find(".ly.com") != -1)
  1581. {
  1582. strServerAddress = g_serverbak;
  1583. CStdioFile fp;
  1584. CString path = g_mainpath + "\\ip.txt";
  1585. if (::PathFileExists(path))
  1586. {
  1587. fp.Open(path, CFile::modeRead);
  1588. fp.ReadString(g_server);
  1589. fp.Close();
  1590. if (OnConnectIP())
  1591. {
  1592. // g_serverip=g_server;
  1593. return 1;
  1594. }
  1595. g_server = strServerAddress;
  1596. OnDisconnect();//MessageBox("ip失败");
  1597. }
  1598. g_conntype = 1; // Jeff.连接公司服务器,用于获取集团版*.ly.com的解析IP结果;
  1599. strServerAddress = "lijiafz.vicp.net";
  1600. MyGetIPByName2(strServerAddress);
  1601. if (strServerAddress.IsEmpty())
  1602. {
  1603. return 0;//OnConnect2();
  1604. }
  1605. }
  1606. else if (g_ntimeout == 29000)//非远程 30000
  1607. {
  1608. strServerAddress = g_serverarray.ElementAt(g_conpos);
  1609. }
  1610. // 4.如果没有IP.txt或dbconfig.dat里的不是ly.com信息,而是一般的计算机名称;
  1611. char *szServerAddress = strServerAddress.GetBuffer(0);
  1612. strServerAddress.ReleaseBuffer();
  1613. // AfxMessageBox("连接:"+strServerAddress);
  1614. /*for Client, IP and Port can be 0,
  1615. and for Server, IP is LocalIP, and Port is Listening Port*/
  1616. // 5.创建通信对象连接;
  1617. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1618. 0,
  1619. HandleClientNetEvent,
  1620. this);
  1621. if (TRANSPORT_OK != nResult)
  1622. {
  1623. return 0;
  1624. }
  1625. GetSysIniInfo();
  1626. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1627. DWORD wPort = g_dwCSPort;
  1628. if (g_conntype) wPort = GetPort();
  1629. // 6.连接公司服务器或影楼服务器;
  1630. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1631. if (TRANSPORT_OK != nResult)
  1632. {
  1633. m_tClientTunnel.net_CloseSocket();
  1634. if (g_conntype)// Jeff.连接公司服务器,用于获取集团版*.ly.com的解析IP结果;
  1635. {
  1636. return 0;//OnConnect2();
  1637. }
  1638. if (g_serverarray.GetSize() > 1)
  1639. {
  1640. if (g_conpos < (g_serverarray.GetSize() - 1))
  1641. {
  1642. g_conpos++;
  1643. return OnConnect();
  1644. }
  1645. else
  1646. {
  1647. g_conpos = 0;
  1648. return 0;
  1649. }
  1650. }
  1651. return 0;
  1652. }
  1653. return ProcessLoginRequest();
  1654. }
  1655. BOOL CMainFrame::OnConnect2()
  1656. {
  1657. g_conntype = 2;
  1658. CString server = "http://www.lyfz.net/download/ip.txt";
  1659. char buf[MAX_PATH];
  1660. ::GetTempPath(sizeof(buf), buf);
  1661. CString m_strTempDir = buf;
  1662. DWORD m_dwHttpRequestFlags = HSR_DOWNLOAD | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
  1663. INTERNET_PORT m_dwPort;
  1664. DWORD dwType;
  1665. CInternetSession m_cis;
  1666. CHttpConnection *m_pHttp;
  1667. CString m_strServer;
  1668. CString m_strIniPath;
  1669. AfxParseURL(server, dwType, m_strServer, m_strIniPath, m_dwPort);
  1670. if (dwType != AFX_INET_SERVICE_HTTP)
  1671. {
  1672. return 0;//OnConnect3();
  1673. }
  1674. m_cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5);
  1675. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1676. try
  1677. {
  1678. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1679. }
  1680. catch (CInternetException* pEx)
  1681. {
  1682. return 0;//OnConnect3();
  1683. }
  1684. CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_GET,
  1685. m_strIniPath, NULL, 1, NULL, NULL, m_dwHttpRequestFlags);
  1686. try
  1687. {
  1688. pFile->SendRequest();
  1689. }
  1690. catch (CInternetException* pEx)
  1691. {
  1692. pFile->Close();
  1693. return 0;//OnConnect3();
  1694. }
  1695. if (pFile)
  1696. {
  1697. CStdioFile csf;
  1698. csf.Open(m_strTempDir + "\\ip.txt", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
  1699. char buf[2048];
  1700. int n;
  1701. while ((n = pFile->Read(buf, 2048)) > 0)
  1702. csf.Write(buf, n);
  1703. csf.Close();
  1704. pFile->Close();
  1705. }
  1706. CString strServerAddress;
  1707. CStdioFile fp;
  1708. fp.Open(m_strTempDir + "\\ip.txt", CFile::modeRead);
  1709. fp.ReadString(strServerAddress);
  1710. fp.Close();
  1711. char *szServerAddress = strServerAddress.GetBuffer(0);
  1712. strServerAddress.ReleaseBuffer();
  1713. /*for Client, IP and Port can be 0,
  1714. and for Server, IP is LocalIP, and Port is Listening Port*/
  1715. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1716. 0,
  1717. HandleClientNetEvent,
  1718. this);
  1719. if (TRANSPORT_OK != nResult)
  1720. {
  1721. return 0;
  1722. }
  1723. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1724. DWORD wPort = SERVER_PORT; // 5678
  1725. if (g_conntype)wPort = GetPort();
  1726. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1727. if (TRANSPORT_OK != nResult)
  1728. {
  1729. m_tClientTunnel.net_CloseSocket();
  1730. return 0;//OnConnect3();
  1731. }
  1732. return ProcessLoginRequest();
  1733. }
  1734. BOOL CMainFrame::OnConnect3()
  1735. {
  1736. g_conntype = 3;
  1737. CString server = "http://photo.bjlyfz.com/download/ip.txt";
  1738. char buf[MAX_PATH];
  1739. ::GetTempPath(sizeof(buf), buf);
  1740. CString m_strTempDir = buf;
  1741. DWORD m_dwHttpRequestFlags = HSR_DOWNLOAD | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
  1742. INTERNET_PORT m_dwPort;
  1743. DWORD dwType;
  1744. CInternetSession m_cis;
  1745. CHttpConnection *m_pHttp;
  1746. CString m_strServer;
  1747. CString m_strIniPath;
  1748. AfxParseURL(server, dwType, m_strServer, m_strIniPath, m_dwPort);
  1749. if (dwType != AFX_INET_SERVICE_HTTP)
  1750. {
  1751. return FALSE;
  1752. }
  1753. m_cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5);
  1754. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1755. try
  1756. {
  1757. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1758. }
  1759. catch (CInternetException* pEx)
  1760. {
  1761. return false;
  1762. }
  1763. CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_GET,
  1764. m_strIniPath, NULL, 1, NULL, NULL, m_dwHttpRequestFlags);
  1765. try
  1766. {
  1767. pFile->SendRequest();
  1768. }
  1769. catch (CInternetException* pEx)
  1770. {
  1771. pFile->Close();
  1772. return false;
  1773. }
  1774. if (pFile)
  1775. {
  1776. CStdioFile csf;
  1777. csf.Open(m_strTempDir + "\\ip.txt", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
  1778. char buf[2048];
  1779. int n;
  1780. while ((n = pFile->Read(buf, 2048)) > 0)
  1781. csf.Write(buf, n);
  1782. csf.Close();
  1783. pFile->Close();
  1784. }
  1785. CString strServerAddress;
  1786. CStdioFile fp;
  1787. fp.Open(m_strTempDir + "\\ip.txt", CFile::modeRead);
  1788. fp.ReadString(strServerAddress);
  1789. fp.Close();
  1790. char *szServerAddress = strServerAddress.GetBuffer(0);
  1791. strServerAddress.ReleaseBuffer();
  1792. /*for Client, IP and Port can be 0,
  1793. and for Server, IP is LocalIP, and Port is Listening Port*/
  1794. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1795. 0,
  1796. HandleClientNetEvent,
  1797. this);
  1798. if (TRANSPORT_OK != nResult)
  1799. {
  1800. return 0;
  1801. }
  1802. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1803. DWORD wPort = SERVER_PORT; // 5678
  1804. if (g_conntype)wPort = GetPort();
  1805. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1806. if (TRANSPORT_OK != nResult)
  1807. {
  1808. m_tClientTunnel.net_CloseSocket();
  1809. return 0;
  1810. }
  1811. return ProcessLoginRequest();
  1812. }
  1813. void CMainFrame::ProcessNetEvent(int nEventType, void *pRecvMsg, DWORD dwDataLen)
  1814. {
  1815. #ifdef _DEBUG
  1816. printf("ProcessNetEvent\n\n");
  1817. #endif
  1818. if (Transport_ReadEv == nEventType)
  1819. {
  1820. if (NULL == pRecvMsg) return;
  1821. TMessageHeader* pHeader = (TMessageHeader *)pRecvMsg;
  1822. char *pDataBuf = (char *)pRecvMsg + MESSAGE_HEADER_LEN;
  1823. WORD dwMessageID = pHeader->wMessageId;
  1824. switch (dwMessageID)
  1825. {
  1826. case MSG_LOGIN_RESP:
  1827. case (MSG_LOGIN_RESP + 0X2FFF) :
  1828. {
  1829. LOGIN_RESULT_STRU tLoginResult = { 0 };
  1830. memcpy(&tLoginResult, pDataBuf, sizeof(LOGIN_RESULT_STRU));
  1831. ProcessLoginResponse(&tLoginResult);
  1832. break;
  1833. }
  1834. case MSG_USERINFO_RESP:
  1835. {
  1836. break;
  1837. }
  1838. case MSG_LOGOUT_RESP:
  1839. {
  1840. break;
  1841. }
  1842. case MSG_CHATMESSAGE_RESP:
  1843. case (MSG_CHATMESSAGE_RESP + 0X4FFF) :
  1844. {
  1845. static int i = 0;
  1846. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pDataBuf;
  1847. ProcessChatMessageResponse((void *)pChatMessage);
  1848. break;
  1849. }
  1850. default:
  1851. {
  1852. break;
  1853. }
  1854. }
  1855. }
  1856. else if (Transport_CloseEv == nEventType)
  1857. {
  1858. OnDisconnect();
  1859. }
  1860. }
  1861. //extern BOOL g_bNeedCoon;
  1862. extern BOOL EncryptFile2(BYTE *buffer, DWORD leng, PCHAR szPassword);
  1863. void CMainFrame::OnTimer(UINT nIDEvent)
  1864. {
  1865. // TODO: Add your message handler code here and/or call default
  1866. if (1 == nIDEvent)
  1867. {
  1868. KillTimer(nIDEvent);
  1869. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status", 0);//status:此机用选片菜单项
  1870. // checked==1:此机用选片菜单项
  1871. // g_bStaffAchievementShow==1:此机用于员工业绩查看
  1872. if (checked && g_bStaffAchievementShow == 0) // .此机用选片菜单项;
  1873. {
  1874. KillTimer(3);
  1875. #ifdef NEW_SKIN
  1876. Welcome weldlg;
  1877. weldlg.DoModal();
  1878. #endif
  1879. ChoosePhotoSkin dlg;
  1880. dlg.SetLiaPath("1.lia");
  1881. if (dlg.DoModal() != IDOK)
  1882. {
  1883. PostMessage(WM_QUIT);
  1884. return;
  1885. }
  1886. if (dlg.m_exitcode == 3)
  1887. {
  1888. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  1889. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  1890. }
  1891. else
  1892. {
  1893. ShowWindow(SW_SHOW);
  1894. #ifdef NEW_SKIN
  1895. if (m_pMainFrimDlg2 == NULL)
  1896. {
  1897. m_pMainFrimDlg2 = new MainFrimDlg2;
  1898. m_pMainFrimDlg2->SetLiaPath("10.lia");
  1899. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  1900. }
  1901. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1902. #endif
  1903. }
  1904. }
  1905. else if (g_bStaffAchievementShow == 0) // .非选片、非查看员工业绩;
  1906. {
  1907. #ifdef NEW_SKIN
  1908. g_bNoConnDlg = 1;
  1909. Welcome weldlg;
  1910. weldlg.DoModal();
  1911. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1912. ShowWindow(SW_SHOW);
  1913. g_bNoConnDlg = 0;
  1914. if (g_bNoLoginLia) // Jeff.OnCreate里判断skin文件有5.lia, g_bNoLoginLia = 0, 无 g_bNoLoginLia = 1;
  1915. {
  1916. Login dlg;
  1917. dlg.SetLiaPath("5.lia");
  1918. dlg.DoModal();
  1919. }
  1920. else
  1921. {
  1922. Login3 dlg;
  1923. dlg.SetLiaPath("5.lia"); // Login3的父类为MyDlg,在BOOL MyDlg::OnInitDialog()里调用了纯虚函数Init();
  1924. dlg.DoModal();
  1925. // 数据库完整性提醒;
  1926. if ( 1 == atoi(g_cominfoarray.ElementAt(0).ElementAt(159)) )
  1927. {
  1928. MessageBox(_T("贵店数据库可能已损坏,请尽快联系售后人员进行确认或维护,联系电话:0752-2398865 或 4006-067-068!"), _T("重要提示:"), MB_OK | MB_TOPMOST /*| MB_SETFOREGROUND*/ | MB_ICONWARNING);
  1929. if ( !g_bRunOnCorruptdb )
  1930. exit(0);
  1931. }
  1932. }
  1933. if (g_user.bLongin && g_pMainWnd2)
  1934. {
  1935. g_pMainWnd2->ShowBar(TRUE,TRUE);
  1936. InsideMsg();
  1937. }
  1938. #else
  1939. ShowWindow(SW_SHOW);
  1940. if (g_bNoLoginLia)
  1941. {
  1942. Login dlg;
  1943. dlg.SetLiaPath ("5.lia");
  1944. dlg.DoModal();
  1945. }
  1946. else
  1947. {
  1948. Login3 dlg;
  1949. dlg.SetLiaPath ("5.lia");
  1950. dlg.DoModal();
  1951. }
  1952. #endif
  1953. }
  1954. if (g_hmouse == NULL)
  1955. {
  1956. g_hmouse = SetWindowsHookEx(WH_MOUSE, MouseProc, 0, ::GetCurrentThreadId());
  1957. }
  1958. }
  1959. else if (2 == nIDEvent) //29秒后,若连接和发送未完成,将关闭连接和发送框;
  1960. {
  1961. KillTimer(2);
  1962. if (g_hConnectWnd)
  1963. ::PostMessage(g_hConnectWnd, WM_CLOSE, 0, 0);
  1964. if (g_hSendWnd)
  1965. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1966. if (g_bStaffAchievementShow == 0 && g_bConnLYFZ == 0)
  1967. {
  1968. if (g_bGenBranchData == 0)
  1969. {
  1970. if (g_branchip != "")
  1971. AfxMessageBox("连接分店:" + g_branchname + "失败!", MB_ICONINFORMATION);
  1972. else
  1973. AfxMessageBox("连接服务器失败!", MB_ICONINFORMATION);
  1974. }
  1975. OnDisconnect();
  1976. }
  1977. #ifdef _DEBUG
  1978. printf("SetTimer(2)\n");
  1979. #endif
  1980. g_bSendOK = 0;
  1981. g_bNeedCoon = 1;
  1982. }
  1983. else if (3 == nIDEvent)
  1984. {
  1985. KillTimer(3);
  1986. #ifdef NEW_SKIN
  1987. Welcome weldlg;
  1988. weldlg.DoModal();
  1989. #endif
  1990. ShowWindow(SW_SHOW);
  1991. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1992. g_sendhead.bsql = 0;
  1993. g_sendhead.code[0] = 24;
  1994. g_sendhead.code[1] = 1;
  1995. g_sendhead.tabcount = 2;
  1996. g_pMainWnd->ProcessChatMessageRequest2(1);
  1997. if (g_bSendOK == 0)
  1998. {
  1999. return;
  2000. }
  2001. CArray<CStringArray, CStringArray>patharray;
  2002. CArray<CStringArray, CStringArray>userarray;
  2003. DataToArray(&g_cominfoarray, &g_hisyeararray);
  2004. g_userarray.SetSize(userarray.GetSize(), 1);
  2005. int count = 0;
  2006. for (int ii = 0; ii < userarray.GetSize(); ii++)
  2007. {
  2008. if (userarray.ElementAt(ii).ElementAt(10) == "在职")
  2009. g_userarray.ElementAt(count++).Copy(userarray.ElementAt(ii));
  2010. }
  2011. g_userarray.SetSize(count, 1);
  2012. StaffAchievementShowAll dlg;
  2013. g_pMainWnd->GetOcx();
  2014. dlg.DoModal();
  2015. }
  2016. else if (5 == nIDEvent)
  2017. {
  2018. if (g_bInSkin)
  2019. {
  2020. OutputDebugString("使用皮肤\n");
  2021. return;
  2022. }
  2023. if (g_nAutoShowStaffAchievement == 1){
  2024. OutputDebugString("用于选片\n");
  2025. return;
  2026. }
  2027. if (g_bAllBranch){
  2028. OutputDebugString("多店汇总当中\n");
  2029. return;
  2030. }
  2031. if (g_user.bLongin)
  2032. {
  2033. // m_Mdi.CloseAll();
  2034. g_pMainWnd->OnCommandMenu(IDM_Logout);
  2035. }
  2036. /* g_nAutoShowStaffAchievement=1;
  2037. KillTimer(5);
  2038. StaffAchievementShowAll dlg;
  2039. g_pMainWnd->GetOcx();
  2040. dlg.DoModal ();*/
  2041. }
  2042. else if (6 == nIDEvent)
  2043. {
  2044. static BOOL bDouble = 0;
  2045. bDouble = !bDouble;
  2046. if (bDouble)
  2047. g_pMainWnd->OnCommandMenu(IDM_TAKEAWAYBOOK);
  2048. else
  2049. g_pMainWnd->OnCommandMenu(IDM_CLIENTMONEY);
  2050. }
  2051. else if (7 == nIDEvent)
  2052. {
  2053. KillTimer(7);
  2054. g_bAntiTheft = FALSE;
  2055. if (g_bInSkin)return;
  2056. if (g_nAutoShowStaffAchievement == 1)return;
  2057. if (g_bAllBranch)return;
  2058. #ifdef _DEBUG
  2059. printf("42开始请求服务器信息\n");
  2060. #endif
  2061. g_nSendCode = 42;
  2062. g_bSendOK = FALSE;
  2063. g_pMainWnd->ProcessChatMessageRequest2(1);
  2064. g_nSendCode = 0;
  2065. char *pResult = NULL;
  2066. if ( g_bSendOK )
  2067. {
  2068. cJSON *pJson = cJSON_Parse((char*)g_pData);
  2069. #ifdef _DEBUG
  2070. OutputDebugString("\n");
  2071. OutputDebugString((char*)g_pData);
  2072. OutputDebugString("\n");
  2073. #endif
  2074. cJSON_AddStringToObject(pJson, "软件版本", g_STStudioInfo.strStudioVer);
  2075. cJSON_AddStringToObject(pJson, "影楼名称", g_STStudioInfo.strStudioName);
  2076. cJSON_AddStringToObject(pJson, "影楼电话", g_STStudioInfo.strStudioPhone);
  2077. cJSON_AddStringToObject(pJson, "影楼地址", g_STStudioInfo.strStudioAddress);
  2078. cJSON_AddStringToObject(pJson, "影楼网址", g_STStudioInfo.strStudioWebSite);
  2079. cJSON_AddStringToObject(pJson, "影楼老板", g_STStudioInfo.strStudioManager);
  2080. cJSON_AddStringToObject(pJson, "影楼域名", g_domain);
  2081. cJSON_AddNumberToObject(pJson, "订单数量", g_STStudioInfo.dwStudioOrderCount);
  2082. cJSON_AddNumberToObject(pJson, "历史订单数量", g_STStudioInfo.dwStudioHistoryOrderCount);
  2083. pResult = cJSON_Print(pJson);
  2084. if ( pResult)
  2085. {
  2086. #ifdef _DEBUG
  2087. WriteTextLog(pResult);
  2088. #endif
  2089. cJSON_Delete(pJson);
  2090. // 指示连接的服务器为lijiafz.vicp.net;
  2091. g_bConnLYFZ = 1;
  2092. // 断开当前连接;
  2093. OnDisconnect();
  2094. g_bSendOK = FALSE;
  2095. g_nSendCode = 18;
  2096. int nEncryptlen = strlen(pResult);
  2097. #ifdef _DEBUG
  2098. printf("18:%d,%s\n\n",nEncryptlen, pResult);
  2099. #endif
  2100. EncryptFile2((BYTE*)pResult, nEncryptlen, "888666333");
  2101. g_pMainWnd->ProcessChatMessageRequest2((BYTE*)pResult, nEncryptlen);
  2102. g_nSendCode = 0;
  2103. delete[]pResult;
  2104. g_bSendLYFZ = 0;
  2105. g_bConnLYFZ = 0;
  2106. OnDisconnect();
  2107. #ifdef _DEBUG
  2108. printf("发送后台%s\n,断开当前连接,开始连接本地服务器\n", g_bSendOK ? "发送成功" : "发送失败");
  2109. #endif
  2110. if (g_bSendOK)
  2111. {
  2112. #ifdef _DEBUG
  2113. printf("43开始请求服务器信息\n");
  2114. #endif
  2115. g_nSendCode = 43;
  2116. g_pMainWnd->ProcessChatMessageRequest2(g_pData, g_nLeng);
  2117. g_nSendCode = 0;
  2118. g_bAntiTheft = FALSE;
  2119. }
  2120. }
  2121. }
  2122. }
  2123. }
  2124. void CMainFrame::OnOutbarNotify(CString strMsg)
  2125. {
  2126. if (g_user.bLongin == 0)
  2127. {
  2128. if (g_bNoLoginLia)
  2129. {
  2130. Login dlg;
  2131. dlg.SetLiaPath("5.lia");
  2132. dlg.DoModal();
  2133. }
  2134. else
  2135. {
  2136. Login3 dlg;
  2137. dlg.SetLiaPath("5.lia");
  2138. dlg.DoModal();
  2139. }
  2140. return;
  2141. if (g_user.bLongin == 0)return;
  2142. }
  2143. else
  2144. {
  2145. InsideMsg();
  2146. }
  2147. ResetTimer();
  2148. if (strMsg == "开单")
  2149. {
  2150. if (IsHasRights(0) == 0)return;
  2151. Booking2 dlg;
  2152. dlg.DoModal();
  2153. return;
  2154. }
  2155. else if (strMsg == "拍照")
  2156. {
  2157. if (IsHasRights(1) == 0)return;
  2158. UINT nID = 1;
  2159. LPSTR pName;
  2160. pName = (LPSTR)(LPCSTR)"拍照";
  2161. OPEN_MENU(TakeFrom);
  2162. return;
  2163. }
  2164. else if (strMsg == "修片")
  2165. {
  2166. if (IsHasRights(1) == 0)return;
  2167. UINT nID = 1;
  2168. LPSTR pName;
  2169. pName = (LPSTR)(LPCSTR)"修片";
  2170. OPEN_MENU(BeautifySkinFrom);
  2171. return;
  2172. }
  2173. else if (strMsg == "选片")
  2174. {
  2175. if (IsHasRights(2) == 0)return;
  2176. UINT nID = 1;
  2177. LPSTR pName;
  2178. pName = (LPSTR)(LPCSTR)"选片";
  2179. OPEN_MENU(ChoosePhotoForm);
  2180. return;
  2181. }
  2182. else if (strMsg == "精修")
  2183. {
  2184. if (IsHasRights(2) == 0)return;
  2185. UINT nID = 1;
  2186. LPSTR pName;
  2187. pName = (LPSTR)(LPCSTR)"精修";
  2188. OPEN_MENU(BeautifySkinFrom2);
  2189. return;
  2190. }
  2191. else if (strMsg == "设计")
  2192. {
  2193. if (IsHasRights(2) == 0)return;
  2194. UINT nID = 1;
  2195. LPSTR pName;
  2196. pName = (LPSTR)(LPCSTR)"设计";
  2197. OPEN_MENU(DesignFrom);
  2198. return;
  2199. }
  2200. else if (strMsg == "数码安排")
  2201. {
  2202. UINT nID = 1;
  2203. LPSTR pName;
  2204. pName = (LPSTR)(LPCSTR)"数码安排";
  2205. OPEN_MENU(DigitalWork);
  2206. return;
  2207. }
  2208. else if (strMsg == "刻盘")
  2209. {
  2210. UINT nID = 1;
  2211. LPSTR pName;
  2212. pName = (LPSTR)(LPCSTR)"刻盘";
  2213. OPEN_MENU(BurnCD);
  2214. return;
  2215. }
  2216. else if (strMsg == "相片冲印")
  2217. {
  2218. UINT nID = 1;
  2219. LPSTR pName;
  2220. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  2221. OPEN_MENU(PhotoPrintFrom);
  2222. return;
  2223. }
  2224. else if (strMsg == "发片/取件")
  2225. {
  2226. if (IsHasRights(3) == 0)return;
  2227. UINT nID = 1;
  2228. LPSTR pName;
  2229. pName = (LPSTR)(LPCSTR)"发片/取件";
  2230. OPEN_MENU(outsourcing);
  2231. return;
  2232. }
  2233. else if (strMsg == "满意度")
  2234. {
  2235. UINT nID = 1;
  2236. LPSTR pName;
  2237. pName = (LPSTR)(LPCSTR)"满意度";
  2238. OPEN_MENU(Satisfaction);
  2239. return;
  2240. }
  2241. else if (strMsg == "满意度汇总")
  2242. {
  2243. UINT nID = 1;
  2244. LPSTR pName;
  2245. pName = (LPSTR)(LPCSTR)"满意度汇总";
  2246. OPEN_MENU(SatisfactionReportForm);
  2247. return;
  2248. }
  2249. #if JEFF_DELETE_ON // 2014.11.14-PM 16:20
  2250. else if (strMsg == "回复统计")
  2251. {
  2252. UINT nID = 1;
  2253. LPSTR pName;
  2254. pName = (LPSTR)(LPCSTR)"回复统计";
  2255. OPEN_MENU(MsgReg2);
  2256. return;
  2257. }
  2258. #endif
  2259. /* else if(strMsg=="取件")
  2260. {
  2261. if(IsHasRights(3)==0)return;
  2262. UINT nID=1;
  2263. LPSTR pName ;
  2264. pName = (LPSTR)(LPCSTR)"取件";
  2265. OPEN_MENU(TakeAwayFrom);
  2266. return;
  2267. }*/
  2268. else if (strMsg == "其它收入")
  2269. {
  2270. if (IsHasRightsnew(16) == 0)return;
  2271. // if(IsHasRightsnew(48)==0)return;
  2272. UINT nID = 1;
  2273. LPSTR pName;
  2274. pName = (LPSTR)(LPCSTR)"其它收入";
  2275. OPEN_MENU(IncomeInput);
  2276. return;
  2277. }
  2278. else if (strMsg == "散客消费")
  2279. {
  2280. if (IsHasRightsnew(16) == 0)return;
  2281. UINT nID = 1;
  2282. LPSTR pName;
  2283. pName = (LPSTR)(LPCSTR)"散客消费";
  2284. OPEN_MENU(IncomeInput2);
  2285. return;
  2286. }
  2287. else if (strMsg == "员工奖罚")
  2288. {
  2289. if (IsHasRightsnew(16) == 0)return;
  2290. UINT nID = 1;
  2291. LPSTR pName;
  2292. pName = (LPSTR)(LPCSTR)"员工奖罚";
  2293. OPEN_MENU(IncomeInput3);
  2294. return;
  2295. }
  2296. else if (strMsg == "员工奖惩")
  2297. {
  2298. if (IsHasRightsnew(16) == 0)return;
  2299. UINT nID = 1;
  2300. LPSTR pName;
  2301. pName = (LPSTR)(LPCSTR)"员工奖惩";
  2302. OPEN_MENU(IncomeInput4);
  2303. return;
  2304. }
  2305. else if (strMsg == "订单收款")
  2306. {
  2307. if (IsHasRights(17) == 0)return;
  2308. UINT nID = 1;
  2309. LPSTR pName;
  2310. pName = (LPSTR)(LPCSTR)"订单收款";
  2311. OPEN_MENU(FinanceForm);
  2312. return;
  2313. }
  2314. else if (strMsg == "日财务表")
  2315. {
  2316. if (IsHasRightsnew(22) == 0)return;
  2317. UINT nID = 2;
  2318. LPSTR pName;
  2319. pName = (LPSTR)(LPCSTR)"日财务表";
  2320. OPEN_MENU(DailyForm);
  2321. return;
  2322. }
  2323. else if (strMsg == "提成比例")
  2324. {
  2325. #ifndef ENTERPRISE_VERSION
  2326. #ifndef CHILD_VERSION
  2327. #ifdef BASIC_VERSION
  2328. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2329. {
  2330. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2331. exit(0);return;
  2332. }
  2333. #else
  2334. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2335. {
  2336. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2337. exit(0);return;
  2338. }
  2339. #endif
  2340. #else
  2341. #ifdef BASIC_VERSION
  2342. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2343. {
  2344. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2345. exit(0);return;
  2346. }
  2347. #else
  2348. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2349. {
  2350. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2351. exit(0); return;
  2352. }
  2353. #endif
  2354. #endif
  2355. #else
  2356. #ifndef CHILD_VERSION
  2357. #ifdef BASIC_VERSION
  2358. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2359. {
  2360. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2361. exit(0); return;
  2362. }
  2363. #else
  2364. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2365. {
  2366. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2367. exit(0); return;
  2368. }
  2369. #endif
  2370. #else
  2371. #ifdef BASIC_VERSION
  2372. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2373. {
  2374. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2375. exit(0);return;
  2376. }
  2377. #else
  2378. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2379. {
  2380. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2381. exit(0); return;
  2382. }
  2383. #endif
  2384. #endif
  2385. #endif
  2386. UINT nID = 2;
  2387. LPSTR pName;
  2388. pName = (LPSTR)(LPCSTR)"提成比例";
  2389. OPEN_MENU(SalarySet2);
  2390. return;
  2391. }
  2392. //else if(strMsg=="员工工作")
  2393. else if (strMsg == "计件提成")
  2394. {
  2395. UINT nID = 2;
  2396. LPSTR pName;
  2397. //pName = (LPSTR)(LPCSTR)"员工工作";
  2398. pName = (LPSTR)(LPCSTR)"计件提成";
  2399. OPEN_MENU(SalarySet3);
  2400. return;
  2401. }
  2402. else if (strMsg == "工资管理")
  2403. {
  2404. #ifndef ENTERPRISE_VERSION
  2405. #ifndef CHILD_VERSION
  2406. #ifdef BASIC_VERSION
  2407. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2408. {
  2409. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2410. exit(0);return;
  2411. }
  2412. #else
  2413. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2414. {
  2415. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2416. exit(0);return;
  2417. }
  2418. #endif
  2419. #else
  2420. #ifdef BASIC_VERSION
  2421. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2422. {
  2423. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2424. exit(0);return;
  2425. }
  2426. #else
  2427. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2428. {
  2429. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2430. exit(0); return;
  2431. }
  2432. #endif
  2433. #endif
  2434. #else
  2435. #ifndef CHILD_VERSION
  2436. #ifdef BASIC_VERSION
  2437. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2438. {
  2439. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2440. exit(0); return;
  2441. }
  2442. #else
  2443. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2444. {
  2445. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2446. exit(0); return;
  2447. }
  2448. #endif
  2449. #else
  2450. #ifdef BASIC_VERSION
  2451. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2452. {
  2453. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2454. exit(0);return;
  2455. }
  2456. #else
  2457. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2458. {
  2459. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2460. exit(0); return;
  2461. }
  2462. #endif
  2463. #endif
  2464. #endif
  2465. UINT nID = 2;
  2466. LPSTR pName;
  2467. pName = (LPSTR)(LPCSTR)"工资管理";
  2468. OPEN_MENU(MySalary);
  2469. return;
  2470. }
  2471. else if (strMsg == "客人付款")
  2472. {
  2473. UINT nID = 2;
  2474. LPSTR pName;
  2475. pName = (LPSTR)(LPCSTR)"客人付款";
  2476. OPEN_MENU(ClientMoney);
  2477. return;
  2478. }
  2479. else if (strMsg == "工资报表")
  2480. {
  2481. #ifndef ENTERPRISE_VERSION
  2482. #ifndef CHILD_VERSION
  2483. #ifdef BASIC_VERSION
  2484. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2485. {
  2486. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2487. exit(0);return;
  2488. }
  2489. #else
  2490. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2491. {
  2492. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2493. exit(0);return;
  2494. }
  2495. #endif
  2496. #else
  2497. #ifdef BASIC_VERSION
  2498. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2499. {
  2500. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2501. exit(0);return;
  2502. }
  2503. #else
  2504. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2505. {
  2506. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2507. exit(0); return;
  2508. }
  2509. #endif
  2510. #endif
  2511. #else
  2512. #ifndef CHILD_VERSION
  2513. #ifdef BASIC_VERSION
  2514. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2515. {
  2516. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2517. exit(0); return;
  2518. }
  2519. #else
  2520. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2521. {
  2522. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2523. exit(0); return;
  2524. }
  2525. #endif
  2526. #else
  2527. #ifdef BASIC_VERSION
  2528. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2529. {
  2530. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2531. exit(0);return;
  2532. }
  2533. #else
  2534. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2535. {
  2536. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2537. exit(0); return;
  2538. }
  2539. #endif
  2540. #endif
  2541. #endif
  2542. if (IsHasRightsnew(25) == 0)return;
  2543. UINT nID = 2;
  2544. LPSTR pName;
  2545. pName = (LPSTR)(LPCSTR)"工资报表";
  2546. g_ncount = 100;
  2547. OPEN_MENU(MySalary);
  2548. return;
  2549. }
  2550. else if (strMsg == "员工业绩")
  2551. {
  2552. #ifndef ENTERPRISE_VERSION
  2553. #ifndef CHILD_VERSION
  2554. #ifdef BASIC_VERSION
  2555. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2556. {
  2557. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2558. exit(0);return;
  2559. }
  2560. #else
  2561. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2562. {
  2563. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2564. exit(0);return;
  2565. }
  2566. #endif
  2567. #else
  2568. #ifdef BASIC_VERSION
  2569. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2570. {
  2571. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2572. exit(0);return;
  2573. }
  2574. #else
  2575. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2576. {
  2577. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2578. exit(0); return;
  2579. }
  2580. #endif
  2581. #endif
  2582. #else
  2583. #ifndef CHILD_VERSION
  2584. #ifdef BASIC_VERSION
  2585. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2586. {
  2587. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2588. exit(0); return;
  2589. }
  2590. #else
  2591. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2592. {
  2593. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2594. exit(0); return;
  2595. }
  2596. #endif
  2597. #else
  2598. #ifdef BASIC_VERSION
  2599. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2600. {
  2601. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2602. exit(0);return;
  2603. }
  2604. #else
  2605. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2606. {
  2607. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2608. exit(0); return;
  2609. }
  2610. #endif
  2611. #endif
  2612. #endif
  2613. if (IsHasRightsnew(33) == 0)return;
  2614. UINT nID = 2;
  2615. LPSTR pName;
  2616. pName = (LPSTR)(LPCSTR)"员工业绩";
  2617. OPEN_MENU(StaffAchievement);
  2618. return;
  2619. }
  2620. else if (strMsg == "订单客户")
  2621. {
  2622. UINT nID = 2;
  2623. LPSTR pName;
  2624. pName = (LPSTR)(LPCSTR)"订单客户";
  2625. g_dx += 10000;
  2626. OPEN_MENU(CClientForm);
  2627. if (g_dx >= 10000)g_dx -= 10000;
  2628. return;
  2629. }
  2630. else if (strMsg == "意向客户")
  2631. {
  2632. UINT nID = 2;
  2633. LPSTR pName;
  2634. pName = (LPSTR)(LPCSTR)"意向客户";
  2635. OPEN_MENU(Client2Form);
  2636. return;
  2637. }
  2638. else if (strMsg == "老客户")
  2639. {
  2640. UINT nID = 2;
  2641. LPSTR pName;
  2642. pName = (LPSTR)(LPCSTR)"老客户";
  2643. OPEN_MENU(OldClient);
  2644. return;
  2645. }
  2646. else if (strMsg == "客户来电")
  2647. {
  2648. UINT nID = 2;
  2649. LPSTR pName;
  2650. pName = (LPSTR)(LPCSTR)"客户来电";
  2651. OPEN_MENU(PhoneRecord);
  2652. return;
  2653. }
  2654. else if (strMsg == "拨出电话")
  2655. {
  2656. UINT nID = 2;
  2657. LPSTR pName;
  2658. pName = (LPSTR)(LPCSTR)"拨出电话";
  2659. OPEN_MENU(PhoneRecordOut);
  2660. return;
  2661. }
  2662. else if (strMsg == "未接来电")
  2663. {
  2664. UINT nID = 2;
  2665. LPSTR pName;
  2666. pName = (LPSTR)(LPCSTR)"未接来电";
  2667. OPEN_MENU(MissCall);
  2668. return;
  2669. }
  2670. else if (strMsg == "客户流失")
  2671. {
  2672. UINT nID = 2;
  2673. LPSTR pName;
  2674. pName = (LPSTR)(LPCSTR)"客户流失";
  2675. OPEN_MENU(ClientReasonChart);
  2676. return;
  2677. }
  2678. else if (strMsg == "客户来源")
  2679. {
  2680. UINT nID = 2;
  2681. LPSTR pName;
  2682. pName = (LPSTR)(LPCSTR)"客户来源";
  2683. OPEN_MENU(ClientFromChart);
  2684. return;
  2685. }
  2686. else if (strMsg == "月财务表")
  2687. {
  2688. if (IsHasRightsnew(23) == 0)return;
  2689. UINT nID = 2;
  2690. LPSTR pName;
  2691. pName = (LPSTR)(LPCSTR)"月财务表";
  2692. OPEN_MENU(MonthForm);
  2693. return;
  2694. }
  2695. else if (strMsg == "支出报表")
  2696. {
  2697. if (IsHasRightsnew(23) == 0)return;
  2698. UINT nID = 2;
  2699. LPSTR pName;
  2700. pName = (LPSTR)(LPCSTR)"支出报表";
  2701. OPEN_MENU(MonthForm2);
  2702. return;
  2703. }
  2704. else if (strMsg == "年财务表")
  2705. {
  2706. if (IsHasRightsnew(24) == 0)return;
  2707. UINT nID = 2;
  2708. LPSTR pName;
  2709. pName = (LPSTR)(LPCSTR)"年财务表";
  2710. OPEN_MENU(YearForm);
  2711. return;
  2712. }
  2713. else if (strMsg == "年财务图表")
  2714. {
  2715. if (IsHasRightsnew(24) == 0)return;
  2716. GetOcx();
  2717. UINT nID = 2;
  2718. LPSTR pName;
  2719. pName = (LPSTR)(LPCSTR)"年财务图表";
  2720. OPEN_MENU(YearForm2);
  2721. return;
  2722. }
  2723. else if (strMsg == "订单图表")
  2724. {
  2725. GetOcx();
  2726. UINT nID = 2;
  2727. LPSTR pName;
  2728. pName = (LPSTR)(LPCSTR)"订单图表";
  2729. OPEN_MENU(DinDanForm);
  2730. return;
  2731. }
  2732. #ifdef ENTERPRISE_VERSION
  2733. else if (strMsg == "订单报表")
  2734. {
  2735. GetOcx();
  2736. UINT nID = 2;
  2737. LPSTR pName;
  2738. pName = (LPSTR)(LPCSTR)"订单报表2";
  2739. OPEN_MENU(DinDanFromBranch);
  2740. return;
  2741. }
  2742. else if (strMsg == "财务图表")
  2743. {
  2744. GetOcx();
  2745. UINT nID = 2;
  2746. LPSTR pName;
  2747. pName = (LPSTR)(LPCSTR)"财务图表";
  2748. OPEN_MENU(YearFormBranch);
  2749. return;
  2750. }
  2751. else if (strMsg == "订单图表")
  2752. {
  2753. GetOcx();
  2754. UINT nID = 2;
  2755. LPSTR pName;
  2756. pName = (LPSTR)(LPCSTR)"订单图表";
  2757. OPEN_MENU(YearFormBranch2);
  2758. return;
  2759. }
  2760. else if (strMsg == "摄控安排")
  2761. {
  2762. UINT nID = 2;
  2763. LPSTR pName;
  2764. pName = (LPSTR)(LPCSTR)"摄控安排";
  2765. g_bookingtype = 0;
  2766. OPEN_MENU(TodayForm);
  2767. return;
  2768. }
  2769. else if (strMsg == "选片预约")
  2770. {
  2771. UINT nID = 2;
  2772. LPSTR pName;
  2773. pName = (LPSTR)(LPCSTR)"选片预约";
  2774. g_bookingtype = 1;
  2775. OPEN_MENU(TodayForm);
  2776. return;
  2777. }
  2778. else if (strMsg == "看样预约")
  2779. {
  2780. UINT nID = 2;
  2781. LPSTR pName;
  2782. pName = (LPSTR)(LPCSTR)"看样预约";
  2783. g_bookingtype = 2;
  2784. OPEN_MENU(TodayForm);
  2785. return;
  2786. }
  2787. else if (strMsg == "取件预约")
  2788. {
  2789. UINT nID = 2;
  2790. LPSTR pName;
  2791. pName = (LPSTR)(LPCSTR)"取件预约";
  2792. g_bookingtype = 3;
  2793. OPEN_MENU(TodayForm);
  2794. return;
  2795. }
  2796. else if (strMsg == "婚庆安排")
  2797. {
  2798. UINT nID = 2;
  2799. LPSTR pName;
  2800. pName = (LPSTR)(LPCSTR)"婚庆安排";
  2801. g_bookingtype = 4;
  2802. OPEN_MENU(TodayForm);
  2803. return;
  2804. }
  2805. #endif
  2806. else if (strMsg == "员工资料")
  2807. {
  2808. UINT nID = 2;
  2809. LPSTR pName;
  2810. pName = (LPSTR)(LPCSTR)"员工资料";
  2811. if (g_bAllBranch)
  2812. OPEN_MENU(EmployeeForm2);
  2813. else
  2814. OPEN_MENU(EmployeeForm);
  2815. return;
  2816. }
  2817. else if (strMsg == "客户区域")
  2818. {
  2819. // if(IsHasRightsnew(48)==0)return;
  2820. GetOcx();
  2821. UINT nID = 2;
  2822. LPSTR pName;
  2823. pName = (LPSTR)(LPCSTR)"客户区域";
  2824. OPEN_MENU(AreaClient);
  2825. return;
  2826. }
  2827. else if (strMsg == "客户报表")
  2828. {
  2829. UINT nID = 3;
  2830. LPSTR pName;
  2831. pName = (LPSTR)(LPCSTR)"客户报表";
  2832. OPEN_MENU(CClientForm);
  2833. return;
  2834. }
  2835. else if (strMsg == "现金支出")
  2836. {
  2837. if (IsHasRightsnew(16) == 0)return;
  2838. UINT nID = 3;
  2839. LPSTR pName;
  2840. pName = (LPSTR)(LPCSTR)"现金支出";
  2841. OPEN_MENU(PayOutInput);
  2842. return;
  2843. }
  2844. else if (strMsg == "短信群发")
  2845. {
  2846. UINT nID = 3;
  2847. LPSTR pName;
  2848. pName = (LPSTR)(LPCSTR)"短信群发";
  2849. OPEN_MENU(SendMsg);
  2850. return;
  2851. }
  2852. else if (strMsg == "短信发送")
  2853. {
  2854. UINT nID = 3;
  2855. LPSTR pName;
  2856. pName = (LPSTR)(LPCSTR)"客户报表";
  2857. OPEN_MENU(CClientForm);
  2858. return;
  2859. }
  2860. else if (strMsg == "流程短信")
  2861. {
  2862. UINT nID = 3;
  2863. LPSTR pName;
  2864. pName = (LPSTR)(LPCSTR)"流程短信";
  2865. OPEN_MENU(WorkMsg);
  2866. return;
  2867. }
  2868. else if (strMsg == "员工短信")
  2869. {
  2870. UINT nID = 3;
  2871. LPSTR pName;
  2872. pName = (LPSTR)(LPCSTR)"员工短信";
  2873. OPEN_MENU(EmployeeMsg);
  2874. return;
  2875. }
  2876. else if (strMsg == "发送记录")
  2877. {
  2878. UINT nID = 3;
  2879. LPSTR pName;
  2880. pName = (LPSTR)(LPCSTR)"发送记录";
  2881. OPEN_MENU(MsgReg);
  2882. return;
  2883. }
  2884. else if (strMsg == "短信设置")
  2885. {
  2886. if (IsHasRightsnew(49) == 0)return;
  2887. MsgSet dlg;
  2888. dlg.DoModal();
  2889. return;
  2890. }
  2891. else if (strMsg == "金卡会员")
  2892. {
  2893. #ifndef ENTERPRISE_VERSION
  2894. #ifndef CHILD_VERSION
  2895. #ifdef BASIC_VERSION
  2896. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2897. {
  2898. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2899. exit(0);return;
  2900. }
  2901. #else
  2902. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2903. {
  2904. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2905. exit(0);return;
  2906. }
  2907. #endif
  2908. #else
  2909. #ifdef BASIC_VERSION
  2910. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2911. {
  2912. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2913. exit(0);return;
  2914. }
  2915. #else
  2916. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2917. {
  2918. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2919. exit(0); return;
  2920. }
  2921. #endif
  2922. #endif
  2923. #else
  2924. #ifndef CHILD_VERSION
  2925. #ifdef BASIC_VERSION
  2926. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2927. {
  2928. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2929. exit(0); return;
  2930. }
  2931. #else
  2932. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2933. {
  2934. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2935. exit(0); return;
  2936. }
  2937. #endif
  2938. #else
  2939. #ifdef BASIC_VERSION
  2940. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2941. {
  2942. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2943. exit(0);return;
  2944. }
  2945. #else
  2946. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2947. {
  2948. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2949. exit(0); return;
  2950. }
  2951. #endif
  2952. #endif
  2953. #endif
  2954. UINT nID = 3;
  2955. LPSTR pName;
  2956. pName = (LPSTR)(LPCSTR)"金卡会员";
  2957. OPEN_MENU(ShowMember);
  2958. return;
  2959. }
  2960. else if (strMsg == "现金子卡")
  2961. {
  2962. UINT nID = 3;
  2963. LPSTR pName;
  2964. pName = (LPSTR)(LPCSTR)"现金子卡";
  2965. OPEN_MENU(ShowMember2);
  2966. return;
  2967. }
  2968. else if (strMsg == "蓝钻会员")
  2969. {
  2970. #ifndef ENTERPRISE_VERSION
  2971. #ifndef CHILD_VERSION
  2972. #ifdef BASIC_VERSION
  2973. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2974. {
  2975. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2976. exit(0);return;
  2977. }
  2978. #else
  2979. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2980. {
  2981. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2982. exit(0);return;
  2983. }
  2984. #endif
  2985. #else
  2986. #ifdef BASIC_VERSION
  2987. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2988. {
  2989. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2990. exit(0);return;
  2991. }
  2992. #else
  2993. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2994. {
  2995. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2996. exit(0); return;
  2997. }
  2998. #endif
  2999. #endif
  3000. #else
  3001. #ifndef CHILD_VERSION
  3002. #ifdef BASIC_VERSION
  3003. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3004. {
  3005. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3006. exit(0); return;
  3007. }
  3008. #else
  3009. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3010. {
  3011. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3012. exit(0); return;
  3013. }
  3014. #endif
  3015. #else
  3016. #ifdef BASIC_VERSION
  3017. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3018. {
  3019. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3020. exit(0);return;
  3021. }
  3022. #else
  3023. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3024. {
  3025. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3026. exit(0); return;
  3027. }
  3028. #endif
  3029. #endif
  3030. #endif
  3031. UINT nID = 3;
  3032. LPSTR pName;
  3033. pName = (LPSTR)(LPCSTR)"蓝钻会员";
  3034. OPEN_MENU(ShowMemberBlue);
  3035. return;
  3036. }
  3037. else if (strMsg == "转介绍积分")
  3038. {
  3039. #ifndef ENTERPRISE_VERSION
  3040. #ifndef CHILD_VERSION
  3041. #ifdef BASIC_VERSION
  3042. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3043. {
  3044. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3045. exit(0);return;
  3046. }
  3047. #else
  3048. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3049. {
  3050. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3051. exit(0);return;
  3052. }
  3053. #endif
  3054. #else
  3055. #ifdef BASIC_VERSION
  3056. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3057. {
  3058. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3059. exit(0);return;
  3060. }
  3061. #else
  3062. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3063. {
  3064. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3065. exit(0); return;
  3066. }
  3067. #endif
  3068. #endif
  3069. #else
  3070. #ifndef CHILD_VERSION
  3071. #ifdef BASIC_VERSION
  3072. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3073. {
  3074. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3075. exit(0); return;
  3076. }
  3077. #else
  3078. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3079. {
  3080. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3081. exit(0); return;
  3082. }
  3083. #endif
  3084. #else
  3085. #ifdef BASIC_VERSION
  3086. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3087. {
  3088. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3089. exit(0);return;
  3090. }
  3091. #else
  3092. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3093. {
  3094. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3095. exit(0); return;
  3096. }
  3097. #endif
  3098. #endif
  3099. #endif
  3100. UINT nID = 3;
  3101. LPSTR pName;
  3102. pName = (LPSTR)(LPCSTR)"转介绍积分";
  3103. OPEN_MENU(Card2Reg);
  3104. return;
  3105. }
  3106. /* else if(strMsg=="转介绍图表")
  3107. {
  3108. #ifndef ENTERPRISE_VERSION
  3109. #ifndef CHILD_VERSION
  3110. #ifdef BASIC_VERSION
  3111. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="0")
  3112. {
  3113. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3114. exit(0);return;
  3115. }
  3116. #else
  3117. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3118. {
  3119. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3120. exit(0);return;
  3121. }
  3122. #endif
  3123. #else
  3124. #ifdef BASIC_VERSION
  3125. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3126. {
  3127. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3128. exit(0);return;
  3129. }
  3130. #else
  3131. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  3132. {
  3133. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3134. exit(0);return;
  3135. }
  3136. #endif
  3137. #endif
  3138. #else
  3139. #ifndef CHILD_VERSION
  3140. #ifdef BASIC_VERSION
  3141. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3142. {
  3143. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3144. exit(0);return;
  3145. }
  3146. #else
  3147. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="5")
  3148. {
  3149. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3150. exit(0);return;
  3151. }
  3152. #endif
  3153. #else
  3154. #ifdef BASIC_VERSION
  3155. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="6")
  3156. {
  3157. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3158. exit(0);return;
  3159. }
  3160. #else
  3161. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="7")
  3162. {
  3163. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3164. exit(0);return;
  3165. }
  3166. #endif
  3167. #endif
  3168. #endif
  3169. UINT nID=3;
  3170. LPSTR pName ;
  3171. pName = (LPSTR)(LPCSTR)"转介绍图表";
  3172. OPEN_MENU(Card2RegChart);
  3173. return;
  3174. }*/
  3175. else if (strMsg == "金卡图表")
  3176. {
  3177. UINT nID = 3;
  3178. LPSTR pName;
  3179. pName = (LPSTR)(LPCSTR)"金卡图表";
  3180. OPEN_MENU(MemberChart);
  3181. return;
  3182. }
  3183. else if (strMsg == "积分短信")
  3184. {
  3185. UINT nID = 3;
  3186. LPSTR pName;
  3187. pName = (LPSTR)(LPCSTR)"积分短信";
  3188. OPEN_MENU(ShowMemberMsg);
  3189. return;
  3190. }
  3191. else if (strMsg == "转介绍返现")
  3192. {
  3193. #ifndef ENTERPRISE_VERSION
  3194. #ifndef CHILD_VERSION
  3195. #ifdef BASIC_VERSION
  3196. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3197. {
  3198. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3199. exit(0);return;
  3200. }
  3201. #else
  3202. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3203. {
  3204. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3205. exit(0);return;
  3206. }
  3207. #endif
  3208. #else
  3209. #ifdef BASIC_VERSION
  3210. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3211. {
  3212. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3213. exit(0);return;
  3214. }
  3215. #else
  3216. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3217. {
  3218. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3219. exit(0); return;
  3220. }
  3221. #endif
  3222. #endif
  3223. #else
  3224. #ifndef CHILD_VERSION
  3225. #ifdef BASIC_VERSION
  3226. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3227. {
  3228. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3229. exit(0); return;
  3230. }
  3231. #else
  3232. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3233. {
  3234. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3235. exit(0); return;
  3236. }
  3237. #endif
  3238. #else
  3239. #ifdef BASIC_VERSION
  3240. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3241. {
  3242. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3243. exit(0);return;
  3244. }
  3245. #else
  3246. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3247. {
  3248. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3249. exit(0); return;
  3250. }
  3251. #endif
  3252. #endif
  3253. #endif
  3254. UINT nID = 3;
  3255. LPSTR pName;
  3256. pName = (LPSTR)(LPCSTR)"转介绍返现";
  3257. OPEN_MENU(Card2RegBlue);
  3258. return;
  3259. }
  3260. else if (strMsg == "转介绍图表")
  3261. {
  3262. #ifndef ENTERPRISE_VERSION
  3263. #ifndef CHILD_VERSION
  3264. #ifdef BASIC_VERSION
  3265. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3266. {
  3267. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3268. exit(0);return;
  3269. }
  3270. #else
  3271. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3272. {
  3273. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3274. exit(0);return;
  3275. }
  3276. #endif
  3277. #else
  3278. #ifdef BASIC_VERSION
  3279. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3280. {
  3281. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3282. exit(0);return;
  3283. }
  3284. #else
  3285. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3286. {
  3287. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3288. exit(0); return;
  3289. }
  3290. #endif
  3291. #endif
  3292. #else
  3293. #ifndef CHILD_VERSION
  3294. #ifdef BASIC_VERSION
  3295. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3296. {
  3297. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3298. exit(0); return;
  3299. }
  3300. #else
  3301. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3302. {
  3303. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3304. exit(0); return;
  3305. }
  3306. #endif
  3307. #else
  3308. #ifdef BASIC_VERSION
  3309. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3310. {
  3311. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3312. exit(0);return;
  3313. }
  3314. #else
  3315. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3316. {
  3317. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3318. exit(0); return;
  3319. }
  3320. #endif
  3321. #endif
  3322. #endif
  3323. UINT nID = 3;
  3324. LPSTR pName;
  3325. pName = (LPSTR)(LPCSTR)"转介绍图表";
  3326. OPEN_MENU(Card2RegChartBlue);
  3327. return;
  3328. }
  3329. else if (strMsg == "积分设置")
  3330. {
  3331. if (IsHasRightsnew(49) == 0)return;
  3332. MemberSet dlg;
  3333. dlg.DoModal();
  3334. return;
  3335. }
  3336. else if (strMsg == "礼服录入")
  3337. {
  3338. if (IsHasRightsnew(39) == 0)return;
  3339. UINT nID = 3;
  3340. LPSTR pName;
  3341. pName = (LPSTR)(LPCSTR)"礼服录入";
  3342. OPEN_MENU(DressManage);
  3343. return;
  3344. }
  3345. else if (strMsg == "礼服查看")
  3346. {
  3347. #ifndef ENTERPRISE_VERSION
  3348. #ifndef CHILD_VERSION
  3349. #ifdef BASIC_VERSION
  3350. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3351. {
  3352. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3353. exit(0);return;
  3354. }
  3355. #else
  3356. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3357. {
  3358. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3359. exit(0);return;
  3360. }
  3361. #endif
  3362. #else
  3363. #ifdef BASIC_VERSION
  3364. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3365. {
  3366. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3367. exit(0);return;
  3368. }
  3369. #else
  3370. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3371. {
  3372. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3373. exit(0); return;
  3374. }
  3375. #endif
  3376. #endif
  3377. #else
  3378. #ifndef CHILD_VERSION
  3379. #ifdef BASIC_VERSION
  3380. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3381. {
  3382. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3383. exit(0); return;
  3384. }
  3385. #else
  3386. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3387. {
  3388. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3389. exit(0); return;
  3390. }
  3391. #endif
  3392. #else
  3393. #ifdef BASIC_VERSION
  3394. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3395. {
  3396. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3397. exit(0);return;
  3398. }
  3399. #else
  3400. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3401. {
  3402. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3403. exit(0); return;
  3404. }
  3405. #endif
  3406. #endif
  3407. #endif
  3408. if (IsHasRightsnew(40) == 0)return;
  3409. UINT nID = 3;
  3410. LPSTR pName;
  3411. pName = (LPSTR)(LPCSTR)"礼服查看";
  3412. OPEN_MENU(ShowDress);
  3413. return;
  3414. }
  3415. else if (strMsg == "撞期预警")
  3416. {
  3417. UINT nID = 3;
  3418. LPSTR pName;
  3419. pName = (LPSTR)(LPCSTR)"撞期预警";
  3420. OPEN_MENU(DressEarlyWarning);
  3421. return;
  3422. }
  3423. else if (strMsg == "礼服出租")
  3424. {
  3425. UINT nID = 3;
  3426. LPSTR pName;
  3427. pName = (LPSTR)(LPCSTR)"礼服出租";
  3428. OPEN_MENU(ShowHireReg);
  3429. return;
  3430. }
  3431. else if (strMsg == "礼服图片")
  3432. {
  3433. ShowPic dlg;
  3434. dlg.m_mode = 4;
  3435. //dlg.m_path = g_path5 + "\\";
  3436. dlg.m_id = g_path5 + "\\";
  3437. dlg.DoModal();
  3438. return;
  3439. }
  3440. else if (strMsg == "商品类别设置")
  3441. {
  3442. if (IsHasRightsnew(29) == 0)return;
  3443. SPLBDlg dlg;
  3444. dlg.DoModal();
  3445. return;
  3446. }
  3447. else if (strMsg == "商品名称设置")
  3448. {
  3449. if (IsHasRightsnew(29) == 0)return;
  3450. UINT nID = 3;
  3451. LPSTR pName;
  3452. pName = (LPSTR)(LPCSTR)"商品设置";
  3453. OPEN_MENU(ShangPin);
  3454. return;
  3455. }
  3456. else if (strMsg == "固定资产管理")
  3457. {
  3458. UINT nID = 3;
  3459. LPSTR pName;
  3460. pName = (LPSTR)(LPCSTR)"固定资产管理";
  3461. OPEN_MENU(FixedAssets);
  3462. return;
  3463. }
  3464. else if (strMsg == "入库单")
  3465. {
  3466. if (IsHasRightsnew(44) == 0)return;
  3467. InputGoods dlg;
  3468. dlg.DoModal();
  3469. return;
  3470. }
  3471. else if (strMsg == "出库单")
  3472. {
  3473. #ifndef ENTERPRISE_VERSION
  3474. #ifndef CHILD_VERSION
  3475. #ifdef BASIC_VERSION
  3476. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3477. {
  3478. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3479. exit(0);return;
  3480. }
  3481. #else
  3482. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3483. {
  3484. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3485. exit(0);return;
  3486. }
  3487. #endif
  3488. #else
  3489. #ifdef BASIC_VERSION
  3490. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3491. {
  3492. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3493. exit(0);return;
  3494. }
  3495. #else
  3496. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3497. {
  3498. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3499. exit(0); return;
  3500. }
  3501. #endif
  3502. #endif
  3503. #else
  3504. #ifndef CHILD_VERSION
  3505. #ifdef BASIC_VERSION
  3506. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3507. {
  3508. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3509. exit(0); return;
  3510. }
  3511. #else
  3512. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3513. {
  3514. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3515. exit(0); return;
  3516. }
  3517. #endif
  3518. #else
  3519. #ifdef BASIC_VERSION
  3520. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3521. {
  3522. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3523. exit(0);return;
  3524. }
  3525. #else
  3526. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3527. {
  3528. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3529. exit(0); return;
  3530. }
  3531. #endif
  3532. #endif
  3533. #endif
  3534. if (IsHasRightsnew(45) == 0)return;
  3535. InputGoods dlg;
  3536. dlg.m_mode = 1;
  3537. dlg.DoModal();
  3538. return;
  3539. }
  3540. else if (strMsg == "库存查询")
  3541. {
  3542. #ifndef ENTERPRISE_VERSION
  3543. #ifndef CHILD_VERSION
  3544. #ifdef BASIC_VERSION
  3545. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3546. {
  3547. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3548. exit(0);return;
  3549. }
  3550. #else
  3551. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3552. {
  3553. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3554. exit(0);return;
  3555. }
  3556. #endif
  3557. #else
  3558. #ifdef BASIC_VERSION
  3559. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3560. {
  3561. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3562. exit(0);return;
  3563. }
  3564. #else
  3565. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3566. {
  3567. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3568. exit(0); return;
  3569. }
  3570. #endif
  3571. #endif
  3572. #else
  3573. #ifndef CHILD_VERSION
  3574. #ifdef BASIC_VERSION
  3575. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3576. {
  3577. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3578. exit(0); return;
  3579. }
  3580. #else
  3581. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3582. {
  3583. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3584. exit(0); return;
  3585. }
  3586. #endif
  3587. #else
  3588. #ifdef BASIC_VERSION
  3589. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3590. {
  3591. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3592. exit(0);return;
  3593. }
  3594. #else
  3595. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3596. {
  3597. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3598. exit(0); return;
  3599. }
  3600. #endif
  3601. #endif
  3602. #endif
  3603. UINT nID = 3;
  3604. LPSTR pName;
  3605. pName = (LPSTR)(LPCSTR)"库存查询";
  3606. OPEN_MENU(ShowGoods);
  3607. return;
  3608. }
  3609. else if (strMsg == "商品图表")
  3610. {
  3611. UINT nID = 3;
  3612. LPSTR pName;
  3613. pName = (LPSTR)(LPCSTR)"商品图表";
  3614. OPEN_MENU(StoreInfoChart);
  3615. return;
  3616. }
  3617. else if (strMsg == "成本核算")
  3618. {
  3619. UINT nID = 3;
  3620. LPSTR pName;
  3621. pName = (LPSTR)(LPCSTR)"成本核算";
  3622. OPEN_MENU(CostCal);
  3623. return;
  3624. }
  3625. else if (strMsg == "考勤记录")
  3626. {
  3627. UINT nID = 3;
  3628. LPSTR pName;
  3629. pName = (LPSTR)(LPCSTR)"考勤记录";
  3630. OPEN_MENU(LoginReg);
  3631. return;
  3632. }
  3633. else if (strMsg == "月统计")
  3634. {
  3635. UINT nID = 3;
  3636. LPSTR pName;
  3637. pName = (LPSTR)(LPCSTR)"月统计";
  3638. OPEN_MENU(LoginReg2);
  3639. return;
  3640. }
  3641. else if (strMsg == "时间设置")
  3642. {
  3643. if (IsHasRightsnew(21) == 0)return;
  3644. SetLoginTime dlg;
  3645. dlg.DoModal();
  3646. return;
  3647. }
  3648. else if (strMsg == "排班设置")
  3649. {
  3650. if (IsHasRightsnew(21) == 0)return;
  3651. SetLoginBan dlg;
  3652. dlg.DoModal();
  3653. return;
  3654. }
  3655. else if (strMsg == "意向查询")
  3656. {
  3657. UINT nID = 3;
  3658. LPSTR pName;
  3659. pName = (LPSTR)(LPCSTR)"意向查询";
  3660. OPEN_MENU(HospitalClient);
  3661. return;
  3662. }
  3663. else if (strMsg == "今日提醒")
  3664. {
  3665. UINT nID = 3;
  3666. LPSTR pName;
  3667. pName = (LPSTR)(LPCSTR)"今日提醒";
  3668. OPEN_MENU(HospitalClientAlarm);
  3669. return;
  3670. }
  3671. else if (strMsg == "跟踪短信")
  3672. {
  3673. UINT nID = 3;
  3674. LPSTR pName;
  3675. pName = (LPSTR)(LPCSTR)"跟踪短信";
  3676. OPEN_MENU(HospitalClientMsg);
  3677. return;
  3678. }
  3679. else if (strMsg == "意向单录入")
  3680. {
  3681. AddHospitalClient dlg;
  3682. dlg.DoModal();
  3683. return;
  3684. }
  3685. else if (strMsg == "资料设置")
  3686. {
  3687. HospitalInfoSet dlg;
  3688. dlg.DoModal();
  3689. return;
  3690. }
  3691. else if ( strMsg == _T("公众号设置"))
  3692. {
  3693. if (IsHasRightsnew(62) == 0)return;
  3694. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3695. {
  3696. lyfzLibrary::g_PtrShowWeiXinDialog(g_rc, g_bkcol);
  3697. lyfzLibrary::FreeWeiXinLibaray();
  3698. }
  3699. return;
  3700. }
  3701. else if ( strMsg == _T("模板消息设置"))
  3702. {
  3703. if (IsHasRightsnew(63) == 0)return;
  3704. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3705. {
  3706. lyfzLibrary::g_PtrShowWXMsgconfigDialog(g_rc, g_bkcol);
  3707. lyfzLibrary::FreeWeiXinLibaray();
  3708. }
  3709. return;
  3710. }
  3711. else if ( strMsg == _T("推送记录") )
  3712. {
  3713. if (IsHasRightsnew(64) == 0)return;
  3714. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3715. {
  3716. lyfzLibrary::g_PtrShowWXMsgRcordDialog(g_rc, g_bkcol);
  3717. lyfzLibrary::FreeWeiXinLibaray();
  3718. }
  3719. return;
  3720. }
  3721. AfxMessageBox(strMsg + ",开发中...");
  3722. }
  3723. // Jeff.当版本号不一致时,调用AutoUpdate.exe来升级YLGL.exe
  3724. void CMainFrame::AutoUpdate()
  3725. {
  3726. if (g_bBranchModify)
  3727. {
  3728. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3729. return;
  3730. }
  3731. else if (g_branchname != "")
  3732. {
  3733. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3734. return;
  3735. }
  3736. g_ntimeout = 30000;
  3737. if (!::PathFileExists(g_mainpath + "\\AutoUpdate.exe"))
  3738. {
  3739. g_sendhead.bsql = 0;
  3740. g_sendhead.code[0] = 99;
  3741. g_sendhead.tabcount = 1;
  3742. g_pMainWnd->ProcessChatMessageRequest2(99);
  3743. if (g_bSendOK == 0)
  3744. goto failed;
  3745. CFile fp;
  3746. fp.Open(g_mainpath + "\\AutoUpdate.exe", CFile::modeWrite | CFile::modeCreate);
  3747. fp.Write(g_pData, g_nLeng);
  3748. fp.Close();
  3749. }
  3750. {
  3751. ::DeleteFile(g_mainpath + "\\YLGL2.exe"); // 删除ylgl.exe;
  3752. g_sendhead.bsql = 0;
  3753. g_sendhead.code[0] = 98;
  3754. g_sendhead.tabcount = 1;
  3755. g_pMainWnd->ProcessChatMessageRequest2(99); if (g_bSendOK == 0)goto failed;
  3756. CFile fp;
  3757. fp.Open(g_mainpath + "\\YLGL2.exe", CFile::modeWrite | CFile::modeCreate);
  3758. fp.Write(g_pData, g_nLeng);
  3759. fp.Close();
  3760. }
  3761. AfxMessageBox("自动升级成功!", MB_ICONINFORMATION);
  3762. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\AutoUpdate.exe"), "12345", NULL, SW_SHOWNORMAL);
  3763. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3764. exit(0);
  3765. return;
  3766. failed:
  3767. AfxMessageBox("自动升级失败!", MB_ICONINFORMATION);
  3768. if (g_ntimeout == 30000)//非远程
  3769. {
  3770. AfxMessageBox("提醒:升级过程中需要传输较多的数据,如果网速慢可能导致远程升级失败!\r\n\
  3771. 可拷贝店内客户端用QQ传过来覆盖除dbconfig.dat的文件即可。", MB_ICONINFORMATION);
  3772. }
  3773. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3774. }
  3775. void CMainFrame::Onchoosephotoskin() //Jeff:此机用于选片菜单项;不在使用2014.06.16
  3776. {
  3777. if (g_user.bLongin == 0)
  3778. {
  3779. if (g_bNoLoginLia)
  3780. {
  3781. Login dlg;
  3782. dlg.SetLiaPath("5.lia");
  3783. dlg.DoModal();
  3784. }
  3785. else
  3786. {
  3787. Login3 dlg;
  3788. dlg.SetLiaPath("5.lia");
  3789. dlg.DoModal();
  3790. }
  3791. if (g_user.bLongin == 0)return;
  3792. }
  3793. // TODO: Add your command handler code here
  3794. CMenu *pMenu = GetMenu();
  3795. CMenu* submenu = pMenu->GetSubMenu(1);
  3796. UINT status = submenu->GetMenuState(IDM_choosephotoskin, MF_BYCOMMAND);
  3797. if (status&MF_CHECKED)
  3798. {
  3799. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_UNCHECKED);
  3800. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status", 0);
  3801. }
  3802. else
  3803. {
  3804. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  3805. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status", 1);
  3806. }
  3807. }
  3808. /*BOOL g_bInSkin = 0;*/
  3809. BOOL CMainFrame::IsCtrlDown()
  3810. {
  3811. short state = GetKeyState(VK_LCONTROL);
  3812. BYTE sta = (BYTE)(state >> 8);
  3813. state = GetKeyState(VK_RCONTROL);
  3814. BYTE sta2 = (BYTE)(state >> 8);
  3815. if (sta || sta2)
  3816. return 1;
  3817. else
  3818. return 0;
  3819. }//IsShiftDown
  3820. BOOL CMainFrame::IsShiftDown()
  3821. {
  3822. short state = GetKeyState(VK_LSHIFT);
  3823. BYTE sta = (BYTE)(state >> 8);
  3824. state = GetKeyState(VK_RSHIFT);
  3825. BYTE sta2 = (BYTE)(state >> 8);
  3826. if (sta || sta2)
  3827. return 1;
  3828. else
  3829. return 0;
  3830. }
  3831. BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
  3832. {
  3833. // TODO: Add your specialized code here and/or call the base class IDM_Logout
  3834. if (pMsg->message == WM_KEYDOWN)
  3835. {
  3836. switch (pMsg->wParam)
  3837. {
  3838. case VK_F12:
  3839. g_pMainWnd->OnCommandMenu(IDM_Logout);
  3840. return 1;
  3841. case VK_F1:
  3842. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  3843. return 1;
  3844. case VK_F2: // 此机用于选片和选设计;
  3845. {
  3846. if (g_pMainWnd->m_bCheckF2F3 && (IsShiftDown() == 0 || IsCtrlDown() == 0))return 1;
  3847. m_Mdi.MainClose();
  3848. if (g_user.bLongin)
  3849. {
  3850. SearchClient dlg;
  3851. dlg.SetLiaPath("2.lia");
  3852. if (dlg.DoModal() != IDOK)
  3853. {
  3854. if (dlg.m_bLogout)
  3855. {
  3856. g_user.bLongin = 0;
  3857. g_user.name.Empty();
  3858. g_user.rights.Empty();
  3859. g_user.account.Empty();
  3860. goto ll;
  3861. }
  3862. PostMessage(WM_QUIT);
  3863. return 1;
  3864. }
  3865. if (dlg.m_exitcode == 3)
  3866. {
  3867. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3868. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3869. }
  3870. else
  3871. {
  3872. ShowWindow(SW_SHOW);
  3873. #ifdef NEW_SKIN
  3874. if (m_pMainFrimDlg2 == NULL)
  3875. {
  3876. m_pMainFrimDlg2 = new MainFrimDlg2;
  3877. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3878. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3879. }
  3880. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3881. g_bInSkin = 0;
  3882. #endif
  3883. }
  3884. }
  3885. else
  3886. {
  3887. ll:
  3888. ChoosePhotoSkin dlg;
  3889. dlg.SetLiaPath("1.lia");
  3890. if (dlg.DoModal() != IDOK)
  3891. {
  3892. PostMessage(WM_QUIT);
  3893. return 1;
  3894. }
  3895. if (dlg.m_exitcode == 3)
  3896. {
  3897. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3898. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3899. }
  3900. else
  3901. {
  3902. ShowWindow(SW_SHOW);
  3903. #ifdef NEW_SKIN
  3904. if (m_pMainFrimDlg2 == NULL)
  3905. {
  3906. m_pMainFrimDlg2 = new MainFrimDlg2;
  3907. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3908. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3909. }
  3910. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3911. g_bInSkin = 0;
  3912. #endif
  3913. }
  3914. }
  3915. }
  3916. return 1;
  3917. case VK_F3: // 此机用于选片和选设计;
  3918. {
  3919. if (g_pMainWnd->m_bCheckF2F3 && (g_pMainWnd->IsShiftDown() == 0 || g_pMainWnd->IsCtrlDown() == 0))return 1;
  3920. m_Mdi.MainClose();
  3921. if (g_user.bLongin)
  3922. {
  3923. SearchClient dlg;
  3924. dlg.m_mode = 1;
  3925. dlg.SetLiaPath("2.lia");
  3926. if (dlg.DoModal() != IDOK)
  3927. {
  3928. if (dlg.m_bLogout)
  3929. {
  3930. g_user.bLongin = 0;
  3931. g_user.name.Empty();
  3932. g_user.rights.Empty();
  3933. g_user.account.Empty();
  3934. goto mm;
  3935. }
  3936. PostMessage(WM_QUIT);
  3937. return 1;
  3938. }
  3939. if (dlg.m_exitcode == 2)
  3940. {
  3941. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3942. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3943. }
  3944. else
  3945. {
  3946. ShowWindow(SW_SHOW);
  3947. #ifdef NEW_SKIN
  3948. if (m_pMainFrimDlg2 == NULL)
  3949. {
  3950. m_pMainFrimDlg2 = new MainFrimDlg2;
  3951. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3952. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3953. }
  3954. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3955. g_bInSkin = 0;
  3956. #endif
  3957. }
  3958. }
  3959. else
  3960. {
  3961. mm:
  3962. ChoosePhotoSkin dlg;
  3963. dlg.m_mode = 1;
  3964. dlg.SetLiaPath("1.lia");
  3965. if (dlg.DoModal() != IDOK)
  3966. {
  3967. PostMessage(WM_QUIT);
  3968. return 1;
  3969. }
  3970. if (dlg.m_exitcode == 2)
  3971. {
  3972. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3973. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3974. }
  3975. else
  3976. {
  3977. ShowWindow(SW_SHOW);
  3978. #ifdef NEW_SKIN
  3979. if (m_pMainFrimDlg2 == NULL)
  3980. {
  3981. m_pMainFrimDlg2 = new MainFrimDlg2;
  3982. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3983. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3984. }
  3985. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3986. g_bInSkin = 0;
  3987. #endif
  3988. }
  3989. }
  3990. }
  3991. return 1;
  3992. //#if 0 // 2015-05-30 禁用F11功能;
  3993. // case VK_F11:
  3994. // if (g_bInSkin)return 1;
  3995. // if (g_user.bLongin)
  3996. // {
  3997. // SqlDlg dlg;
  3998. // dlg.DoModal();
  3999. // }
  4000. // break;
  4001. //#endif
  4002. }
  4003. }
  4004. return CMDIFrameWnd::PreTranslateMessage(pMsg);
  4005. }
  4006. void CMainFrame::GetSkin()
  4007. {
  4008. return;
  4009. #ifdef MNLS_VERSION
  4010. if (::PathFileExists(g_mainpath + "\\skin\\4.lia"))
  4011. {
  4012. CFile fp;
  4013. fp.Open(g_mainpath + "\\skin\\4.lia", CFile::modeRead);
  4014. DWORD leng=fp.GetLength ();
  4015. fp.Close ();
  4016. if(leng!=194987)
  4017. ::DeleteFile (g_mainpath+"\\skin\\4.lia"); // 删除4.lia
  4018. }
  4019. if(!::PathFileExists (g_mainpath+"\\skin\\4.lia"))
  4020. {
  4021. ::CreateDirectory (g_mainpath+"\\skin", NULL);
  4022. g_sendhead.bsql=0;
  4023. g_sendhead.code[0]=100;
  4024. g_sendhead.tabcount=1;
  4025. g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return;
  4026. CFile fp;
  4027. fp.Open (g_mainpath+"\\skin\\4.lia", CFile::modeWrite|CFile::modeCreate);
  4028. fp.Write (g_pData, g_nLeng);
  4029. fp.Close ();
  4030. }
  4031. #endif
  4032. }
  4033. void AutoDraw(CPrintRX &m_Print, CRect &StrRect, CString &str, float fscale)
  4034. {
  4035. CString tempbz =_T(""), temp = _T("");
  4036. BOOL bRun = 0;
  4037. CSize size;
  4038. int fontsize = 12;
  4039. int i = 0;
  4040. ll: tempbz = str;
  4041. i = 0;
  4042. m_Print.SetFontFace(fontsize, 1, "宋体");
  4043. while (1)
  4044. {
  4045. if (!tempbz.IsEmpty())
  4046. {
  4047. temp = tempbz;
  4048. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4049. int right = 0;
  4050. CRect temprc = StrRect;
  4051. temprc.top += i*(fontsize*fscale); i++;
  4052. temprc.bottom = temprc.top + fontsize;
  4053. if (temprc.bottom > StrRect.bottom)break;
  4054. while (size.cx > temprc.Width())
  4055. {
  4056. right++;
  4057. temp = tempbz.Left(tempbz.GetLength() - (right));
  4058. if (GIsHalfHZ(temp))
  4059. {
  4060. right++;
  4061. temp.Delete(temp.GetLength() - 1);
  4062. }
  4063. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4064. }
  4065. // 判断最后的字符是否还含有半个汉字;
  4066. if ( GIsHalfHZ(temp) )
  4067. {
  4068. right++;
  4069. temp.Delete(temp.GetLength() -1);
  4070. temp = tempbz.Left(tempbz.GetLength() - (right));
  4071. }
  4072. if (temp.Find("\r\n") != -1)
  4073. {
  4074. temp = temp.Left(temp.Find("\r\n"));//i++;
  4075. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength() - 2);
  4076. }
  4077. else
  4078. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  4079. if (bRun)
  4080. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, temprc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4081. }
  4082. else
  4083. break;
  4084. }
  4085. if (tempbz.IsEmpty() == 0)
  4086. {
  4087. fontsize--;
  4088. goto ll;
  4089. }
  4090. if (bRun == 0)
  4091. {
  4092. bRun = 1;
  4093. goto ll;
  4094. }
  4095. }
  4096. void CMainFrame::PrintDinDan3(CString strOrderNumber)
  4097. {
  4098. // TODO: Add your control notification handler code here
  4099. CPrintRX m_Print;
  4100. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  4101. {
  4102. m_Print.InitToPrint(NULL, 1);
  4103. }
  4104. else
  4105. {
  4106. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  4107. if (name.IsEmpty())
  4108. m_Print.InitToPrint(NULL, 1);
  4109. else
  4110. {
  4111. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  4112. if (nret == -1)
  4113. {
  4114. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  4115. }
  4116. }
  4117. }
  4118. m_Print.StartPrint();
  4119. m_Print.StartPage();
  4120. LoadRect load;
  4121. load.SetLiaPath("11.lia");
  4122. load.SetMargins(0, 0);
  4123. if (!load.Load())return;
  4124. LoadRect load2;
  4125. load2.SetLiaPath("12.lia");
  4126. load2.SetMargins(0, 0);
  4127. if (!load2.Load())return;
  4128. LoadRect load3;
  4129. load3.SetLiaPath("13.lia");
  4130. load3.SetMargins(-6, 520);
  4131. if (!load3.Load())return;
  4132. int i;
  4133. //////////////////////////////////////////////////////////////
  4134. CStringArray txarray;
  4135. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "'";
  4136. g_sendhead.code[0] = 11;
  4137. g_sendhead.code[1] = 52;
  4138. g_sendhead.code[2] = 50;
  4139. g_sendhead.code[3] = 150;
  4140. g_sendhead.tabcount = 4;
  4141. g_sendhead.bsql = 0;
  4142. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  4143. CArray<CStringArray, CStringArray>sparray;
  4144. CArray<CStringArray, CStringArray>clientarray;
  4145. CArray<CStringArray, CStringArray>jdarray;
  4146. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray);
  4147. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  4148. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  4149. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  4150. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  4151. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  4152. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  4153. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  4154. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  4155. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  4156. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  4157. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  4158. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  4159. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  4160. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  4161. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  4162. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  4163. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  4164. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  4165. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  4166. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  4167. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  4168. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  4169. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  4170. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  4171. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  4172. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  4173. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  4174. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  4175. CString m_bz = "其它要求: " + g_List1array.ElementAt(0).ElementAt(38);
  4176. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  4177. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  4178. if (IsHasRights2new(31) == 0)
  4179. {
  4180. m_phone1 = "***";
  4181. m_phone2 = "***";
  4182. }
  4183. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  4184. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  4185. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  4186. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  4187. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  4188. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  4189. CString m_addr = m_addr1 + ";";
  4190. m_addr.TrimLeft(";");
  4191. m_addr += m_addr2;
  4192. CString m_qq = m_qq1 + ";";
  4193. m_qq.TrimLeft(";");
  4194. m_qq += m_qq2;
  4195. CString m_jd;
  4196. for (i = 0; i < jdarray.GetSize(); i++)
  4197. {
  4198. m_jd += jdarray.ElementAt(i).ElementAt(1);
  4199. m_jd += ";";
  4200. }
  4201. m_jd.TrimRight(";");
  4202. m_money1.Format("%f", atof(m_taoxijiage));
  4203. m_money2.Format("%f", atof(m_payed1));
  4204. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  4205. ConvertToPrice(m_money1);
  4206. ConvertToPrice(m_money2);
  4207. ConvertToPrice(m_money3);
  4208. ////////////////////////////////////////////////////////////////
  4209. int rcpos = -1;
  4210. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  4211. m_Print.SetFontFace(17, 1, "宋体");
  4212. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4213. StrRect.top -= 0;
  4214. StrRect.bottom -= 10;
  4215. StrRect.left -= 140;
  4216. StrRect.right = StrRect.left + 48;
  4217. m_Print.SetFontFace(15, 1, "宋体");
  4218. m_Print.SetColor(0xffffff);
  4219. m_Print.DrawRect(StrRect, 0);
  4220. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4221. StrRect.left = StrRect.right;
  4222. StrRect.right = StrRect.left + 48;
  4223. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  4224. m_Print.SetColor(0, RGB(255, 0, 0));
  4225. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4226. m_Print.SetColor(0);
  4227. m_Print.SetFontFace(12, 1, "宋体");
  4228. StrRect.left -= 48;
  4229. int hei = StrRect.Height();
  4230. StrRect.top = StrRect.bottom + 2;
  4231. StrRect.bottom += hei + 2;
  4232. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4233. StrRect.top = StrRect.bottom - 2;
  4234. StrRect.bottom += hei - 5;
  4235. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  4236. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4237. m_Print.SetFontFace(12, 1, "宋体");
  4238. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4239. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4240. m_Print.SetFontFace(11, 1, "宋体");
  4241. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4242. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4243. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4244. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4245. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4246. m_Print.DrawRect2(StrRect, 2);
  4247. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4248. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4249. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4250. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4251. m_Print.DrawRect2(StrRect, 2);
  4252. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4253. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4254. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4255. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4256. m_Print.DrawRect2(StrRect, 2);
  4257. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4258. m_Print.DrawText((LPTSTR)(LPCTSTR)"约单时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4259. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4260. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4261. m_Print.DrawRect2(StrRect, 2);
  4262. ////////////
  4263. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4264. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4265. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4266. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4267. m_Print.DrawRect2(StrRect, 2);
  4268. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4269. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4270. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4271. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4272. m_Print.DrawRect2(StrRect, 2);
  4273. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4274. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4275. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4276. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4277. m_Print.DrawRect2(StrRect, 2);
  4278. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4279. m_Print.DrawText((LPTSTR)(LPCTSTR)"大婚时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4280. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4281. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4282. m_Print.DrawRect2(StrRect, 2);
  4283. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4284. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客地址:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4285. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4286. m_Print.DrawText((LPTSTR)(LPCTSTR)m_addr, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4287. m_Print.DrawRect2(StrRect, 2);
  4288. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4289. m_Print.DrawText((LPTSTR)(LPCTSTR)"QQ/邮箱:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4290. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4291. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4292. m_Print.DrawRect2(StrRect, 2);
  4293. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4294. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系金额:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4295. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4296. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4297. m_Print.DrawRect2(StrRect, 2);
  4298. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4299. m_Print.DrawText((LPTSTR)(LPCTSTR)"定金:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4300. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4301. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4302. m_Print.DrawRect2(StrRect, 2);
  4303. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4304. m_Print.DrawText((LPTSTR)(LPCTSTR)"余额:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4305. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4306. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4307. m_Print.DrawRect2(StrRect, 2);
  4308. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4309. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4310. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4311. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4312. m_Print.DrawRect2(StrRect, 2);
  4313. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4314. m_Print.DrawText((LPTSTR)(LPCTSTR)"拍摄景点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4315. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4316. m_Print.DrawText((LPTSTR)(LPCTSTR)m_jd, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4317. m_Print.DrawRect2(StrRect, 2);
  4318. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4319. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内容提供: 男士服装:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4320. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4321. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4322. m_Print.DrawRect2(StrRect, 2);
  4323. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4324. m_Print.DrawText((LPTSTR)(LPCTSTR)"套", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4325. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4326. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4327. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4328. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4329. m_Print.DrawRect2(StrRect, 2);
  4330. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4331. m_Print.DrawText((LPTSTR)(LPCTSTR)"套", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4332. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4333. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内提供拍摄区服装/头饰造型", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4334. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4335. m_Print.DrawText((LPTSTR)(LPCTSTR)"其它:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4336. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4337. m_Print.DrawText((LPTSTR)(LPCTSTR)" ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4338. m_Print.DrawRect2(StrRect, 2);
  4339. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4340. m_Print.DrawText((LPTSTR)(LPCTSTR)"专业数码拍摄:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4341. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4342. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4343. m_Print.DrawRect2(StrRect, 2);
  4344. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4345. m_Print.DrawText((LPTSTR)(LPCTSTR)"张", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4346. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4347. m_Print.DrawText((LPTSTR)(LPCTSTR)"(JPG格式数据)", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4348. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4349. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内赠送:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4350. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4351. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_List1array.ElementAt(0).ElementAt(9)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4352. m_Print.DrawRect2(StrRect, 2);
  4353. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4354. m_Print.DrawText((LPTSTR)(LPCTSTR)"张设计排版精修入册", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4355. //////////////////////load2
  4356. rcpos = -1;
  4357. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4358. m_Print.DrawText((LPTSTR)(LPCTSTR)"原始数据套系内张数JPG格式光盘壹只", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4359. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4360. m_Print.DrawText((LPTSTR)(LPCTSTR)"其它:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4361. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4362. // m_Print.DrawText((LPTSTR)(LPCTSTR)"", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4363. // AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4364. m_Print.DrawRect2(StrRect, 2);
  4365. m_Print.SetFontFace(11, 1, "宋体");
  4366. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4367. m_Print.DrawText((LPTSTR)(LPCTSTR)"客人产品:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4368. int rowcount = sparray.GetSize() / 8;
  4369. int needaddrow = 0;
  4370. while (sparray.GetSize() > rowcount * 8 + needaddrow)
  4371. needaddrow++;
  4372. int pos = 0;
  4373. CString str = "";
  4374. int addcount = 0;
  4375. if (needaddrow > 0)
  4376. addcount = 1;
  4377. else
  4378. addcount = 0;
  4379. needaddrow--;
  4380. str.Empty();
  4381. for (i = 0; i < rowcount + addcount; i++)
  4382. {
  4383. str += sparray.ElementAt(pos).ElementAt(5);
  4384. str += " 数量:";
  4385. str += sparray.ElementAt(pos).ElementAt(3);
  4386. str += ";";
  4387. pos++;
  4388. }
  4389. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4390. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4391. m_Print.DrawRect2(StrRect, 2);
  4392. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4393. if (needaddrow > 0)
  4394. addcount = 1;
  4395. else
  4396. addcount = 0;
  4397. needaddrow--;
  4398. str.Empty();
  4399. for (i = 0; i < rowcount + addcount; i++)
  4400. {
  4401. str += sparray.ElementAt(pos).ElementAt(5);
  4402. str += " 数量:";
  4403. str += sparray.ElementAt(pos).ElementAt(3);
  4404. str += ";";
  4405. pos++;
  4406. }
  4407. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4408. m_Print.DrawRect2(StrRect, 2);
  4409. StrRect = load2.m_rcarray.ElementAt(++rcpos);//7
  4410. if (needaddrow > 0)
  4411. addcount = 1;
  4412. else
  4413. addcount = 0;
  4414. needaddrow--;
  4415. str.Empty();
  4416. for (i = 0; i < rowcount + addcount; i++)
  4417. {
  4418. str += sparray.ElementAt(pos).ElementAt(5);
  4419. str += " 数量:";
  4420. str += sparray.ElementAt(pos).ElementAt(3);
  4421. str += ";";
  4422. pos++;
  4423. }
  4424. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4425. m_Print.DrawRect2(StrRect, 2);
  4426. StrRect = load2.m_rcarray.ElementAt(++rcpos);//8
  4427. if (needaddrow > 0)
  4428. addcount = 1;
  4429. else
  4430. addcount = 0;
  4431. needaddrow--;
  4432. str.Empty();
  4433. for (i = 0; i < rowcount + addcount; i++)
  4434. {
  4435. str += sparray.ElementAt(pos).ElementAt(5);
  4436. str += " 数量:";
  4437. str += sparray.ElementAt(pos).ElementAt(3);
  4438. str += ";";
  4439. pos++;
  4440. }
  4441. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4442. m_Print.DrawRect2(StrRect, 2);
  4443. StrRect = load2.m_rcarray.ElementAt(++rcpos);//9
  4444. if (needaddrow > 0)
  4445. addcount = 1;
  4446. else
  4447. addcount = 0;
  4448. needaddrow--;
  4449. str.Empty();
  4450. for (i = 0; i < rowcount + addcount; i++)
  4451. {
  4452. str += sparray.ElementAt(pos).ElementAt(5);
  4453. str += " 数量:";
  4454. str += sparray.ElementAt(pos).ElementAt(3);
  4455. str += ";";
  4456. pos++;
  4457. }
  4458. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4459. m_Print.DrawRect2(StrRect, 2);
  4460. StrRect = load2.m_rcarray.ElementAt(++rcpos);//10
  4461. if (needaddrow > 0)
  4462. addcount = 1;
  4463. else
  4464. addcount = 0;
  4465. needaddrow--;
  4466. str.Empty();
  4467. for (i = 0; i < rowcount + addcount; i++)
  4468. {
  4469. str += sparray.ElementAt(pos).ElementAt(5);
  4470. str += " 数量:";
  4471. str += sparray.ElementAt(pos).ElementAt(3);
  4472. str += ";";
  4473. pos++;
  4474. }
  4475. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4476. m_Print.DrawRect2(StrRect, 2);
  4477. StrRect = load2.m_rcarray.ElementAt(++rcpos);//11
  4478. if (needaddrow > 0)
  4479. addcount = 1;
  4480. else
  4481. addcount = 0;
  4482. needaddrow--;
  4483. str.Empty();
  4484. for (i = 0; i < rowcount + addcount; i++)
  4485. {
  4486. str += sparray.ElementAt(pos).ElementAt(5);
  4487. str += " 数量:";
  4488. str += sparray.ElementAt(pos).ElementAt(3);
  4489. str += ";";
  4490. pos++;
  4491. }
  4492. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4493. m_Print.DrawRect2(StrRect, 2);
  4494. StrRect = load2.m_rcarray.ElementAt(++rcpos);//12
  4495. if (needaddrow > 0)
  4496. addcount = 1;
  4497. else
  4498. addcount = 0;
  4499. needaddrow--;
  4500. str.Empty();
  4501. for (i = 0; i < rowcount + addcount; i++)
  4502. {
  4503. str += sparray.ElementAt(pos).ElementAt(5);
  4504. str += " 数量:";
  4505. str += sparray.ElementAt(pos).ElementAt(3);
  4506. str += ";";
  4507. pos++;
  4508. }
  4509. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4510. m_Print.DrawRect2(StrRect, 2);
  4511. /* StrRect=load2.m_rcarray .ElementAt (++rcpos);//12
  4512. if(needaddrow>0)
  4513. addcount=1;
  4514. else
  4515. addcount=0;
  4516. needaddrow--;
  4517. str.Empty ();
  4518. for( i=0; i<rowcount+addcount; i++)
  4519. {
  4520. str+=sparray.ElementAt (pos).ElementAt (5);
  4521. str+=" 数量:";
  4522. str+=sparray.ElementAt (pos).ElementAt (3);
  4523. str+=";";
  4524. pos++;
  4525. }
  4526. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4527. m_Print.DrawRect2(StrRect, 2);
  4528. StrRect=load2.m_rcarray .ElementAt (++rcpos);//14
  4529. if(needaddrow>0)
  4530. addcount=1;
  4531. else
  4532. addcount=0;
  4533. needaddrow--;
  4534. str.Empty ();
  4535. for( i=0; i<rowcount+addcount; i++)
  4536. {
  4537. str+=sparray.ElementAt (pos).ElementAt (5);
  4538. str+=" 数量:";
  4539. str+=sparray.ElementAt (pos).ElementAt (3);
  4540. str+=";";
  4541. pos++;
  4542. }
  4543. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4544. m_Print.DrawRect2(StrRect, 2);*/
  4545. CRect sprc[2];
  4546. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4547. // AutoDraw(m_Print, StrRect, m_bz.Left (leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4548. m_Print.DrawRect2(StrRect, 2);
  4549. sprc[0] = StrRect;
  4550. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4551. // AutoDraw(m_Print, StrRect, m_bz.Right (leng-leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4552. m_Print.DrawRect2(StrRect, 2);
  4553. sprc[1] = StrRect;
  4554. //AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4555. {
  4556. CString temp, tempspno, tempbz;
  4557. CSize size;
  4558. BOOL bRun = 0;
  4559. int fontsize = 12;
  4560. ll: tempspno = m_bz;
  4561. m_Print.SetFontFace(fontsize, 1, "宋体");
  4562. for (i = 0; i<2; i++)
  4563. {
  4564. if (!tempspno.IsEmpty())
  4565. {
  4566. temp = tempspno;
  4567. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4568. int right = 0;
  4569. CRect temprc = sprc[i];
  4570. while (size.cx>temprc.Width())
  4571. {
  4572. right++;
  4573. temp = tempspno.Left(tempspno.GetLength() - (right));
  4574. if (GIsHalfHZ(temp))
  4575. {
  4576. right++;
  4577. temp.Delete(temp.GetLength() - 1);
  4578. }
  4579. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4580. }
  4581. if (bRun)
  4582. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4583. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  4584. if (tempspno.IsEmpty())i++;
  4585. }
  4586. }
  4587. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  4588. {
  4589. fontsize--;
  4590. goto ll;
  4591. }
  4592. if (bRun == 0)
  4593. {
  4594. bRun = 1;
  4595. goto ll;
  4596. }
  4597. }
  4598. m_Print.SetFontFace(11, 1, "宋体");
  4599. //////////////////////load3
  4600. rcpos = -1;
  4601. for (i = 0; i < 24; i++)
  4602. {
  4603. StrRect = load3.m_rcarray.ElementAt(i);
  4604. m_Print.DrawRect2(StrRect, 1);
  4605. }
  4606. CStringArray strarray;
  4607. strarray.Add("营业员");
  4608. strarray.Add("前台接待");
  4609. strarray.Add("化妆师");
  4610. strarray.Add("礼服师");
  4611. strarray.Add("摄影师");
  4612. strarray.Add("摄影助理");
  4613. strarray.Add("美工师");
  4614. strarray.Add("设计师");
  4615. for (i = 0; i < 8; i++)
  4616. {
  4617. StrRect = load3.m_rcarray.ElementAt(i);
  4618. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4619. }
  4620. strarray.RemoveAll();
  4621. strarray.Add(m_ren);
  4622. strarray.Add(g_List1array.ElementAt(0).ElementAt(49));
  4623. strarray.Add(m_waiter2);
  4624. strarray.Add(g_List1array.ElementAt(0).ElementAt(51));
  4625. strarray.Add(m_waiter1);
  4626. strarray.Add(g_List1array.ElementAt(0).ElementAt(50));
  4627. strarray.Add("");
  4628. strarray.Add(m_waiter4);
  4629. for (i = 8; i < 16; i++)
  4630. {
  4631. StrRect = load3.m_rcarray.ElementAt(i);
  4632. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 8), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4633. }
  4634. StrRect = load3.m_rcarray.ElementAt(27);
  4635. m_Print.DrawText((LPTSTR)(LPCTSTR)"客户电话: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4636. StrRect = load3.m_rcarray.ElementAt(28);
  4637. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4638. m_Print.SetFontFace(13, 1, "宋体");
  4639. StrRect = load3.m_rcarray.ElementAt(25);
  4640. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4641. StrRect = load3.m_rcarray.ElementAt(26);
  4642. m_Print.DrawRect2(StrRect, 2);
  4643. StrRect = load3.m_rcarray.ElementAt(24);
  4644. str = "\
  4645. 顾客须知\r\n\
  4646. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  4647. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  4648. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  4649. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  4650. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  4651. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  4652. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  4653. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  4654. AutoDraw(m_Print, StrRect, str, 1.8f);
  4655. PrintPreview dlg;
  4656. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4657. dlg.m_pDC = m_Print.GetPDC();
  4658. if (dlg.DoModal() != IDOK)return;
  4659. //结束打印
  4660. m_Print.EndPage();
  4661. m_Print.EndPrint();
  4662. }
  4663. void CMainFrame::PrintDailyForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4664. {
  4665. // TODO: Add your control notification handler code here
  4666. int pages = Listarray->GetSize() / 46;
  4667. if (Listarray->GetSize() % 46)pages++;
  4668. for (int aa = 0; aa < pages; aa++)
  4669. {
  4670. PrintPreview dlg;
  4671. CPrintRX m_Print;
  4672. m_Print.InitToPrint(NULL, 1);
  4673. m_Print.StartPrint();
  4674. m_Print.StartPage();
  4675. CRect mainrc(0, 0, 560, 793);
  4676. float fscale;
  4677. {
  4678. int w, h;
  4679. m_Print.GetWidHei(w, h);
  4680. fscale = (float)w / (float)h;
  4681. }
  4682. mainrc.DeflateRect(25, 40, 10, 0);
  4683. CRect rc, rc2;
  4684. rc = mainrc;
  4685. rc.bottom = rc.top;
  4686. rc.top -= 20;
  4687. m_Print.SetFontFace(16, 1, "黑体");
  4688. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4689. m_Print.SetFontFace(9, 1, "宋体");
  4690. CString str;
  4691. int wid[4] = { 320, 60, 60, 90 };
  4692. int hei = 16;
  4693. if (fscale > 0.71)hei = 15;
  4694. rc = mainrc;
  4695. rc.bottom = rc.top + hei;
  4696. for (int i = 0; i < 47; i++)
  4697. {
  4698. rc2.top = rc.top + i*hei;
  4699. rc2.bottom = rc.bottom + i*hei;
  4700. rc2.left = rc.left;
  4701. rc2.right = rc.left + wid[0];
  4702. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  4703. for (int j = 0; j<4; j++)
  4704. {
  4705. m_Print.DrawRect2(rc2, 1);
  4706. if (Listarray->GetSize()>aa * 46 + i)
  4707. {
  4708. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  4709. rc2.left += 3;
  4710. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4711. rc2.left -= 3;
  4712. }
  4713. rc2.left += wid[j];
  4714. rc2.right = rc2.left + wid[j + 1];
  4715. }
  4716. }
  4717. rc2.top += 2;
  4718. rc2.left += 2; rc2.right = mainrc.right + 4;
  4719. m_Print.SetFontFace(8, 1, "宋体");
  4720. int infopos = info.Find("***");
  4721. if (infopos != -1)
  4722. {
  4723. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Left(infopos), rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4724. CRect rc3 = rc2;
  4725. rc3.top = rc2.bottom - 4;
  4726. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Right(info.GetLength() - infopos - 3), rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4727. }
  4728. else
  4729. m_Print.DrawText((LPTSTR)(LPCTSTR)info, rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4730. str.Format(" 页:%d/%d", aa + 1, pages);
  4731. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4732. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  4733. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4734. dlg.m_pDC = m_Print.GetPDC();
  4735. // dlg.m_mode=1;
  4736. if (aa == 0)
  4737. {
  4738. if (dlg.DoModal() != IDOK)
  4739. return;
  4740. }
  4741. //结束打印
  4742. m_Print.EndPage();
  4743. m_Print.EndPrint();
  4744. }
  4745. }
  4746. void CMainFrame::PrintLoginForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4747. {
  4748. // TODO: Add your control notification handler code here
  4749. int sinlecount = 33 * 6;
  4750. int pages = Listarray->GetSize() / sinlecount;
  4751. if (Listarray->GetSize() % sinlecount)pages++;
  4752. for (int aa = 0; aa < pages; aa++)
  4753. {
  4754. PrintPreview dlg;
  4755. CPrintRX m_Print;
  4756. m_Print.InitToPrint(NULL, 1);
  4757. m_Print.StartPrint();
  4758. m_Print.StartPage();
  4759. CRect mainrc(0, 0, 560, 793);
  4760. float fscale;
  4761. {
  4762. int w, h;
  4763. m_Print.GetWidHei(w, h);
  4764. fscale = (float)w / (float)h;
  4765. }
  4766. mainrc.DeflateRect(25, 40, 10, 0);
  4767. CString str;
  4768. CRect rc, rc2;
  4769. rc = mainrc;
  4770. rc.bottom = rc.top;
  4771. rc.top -= 20;
  4772. rc.left -= 20;
  4773. m_Print.SetFontFace(12, 1, "黑体");
  4774. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4775. m_Print.SetFontFace(6, 1, "宋体");
  4776. str.Format(" 页:%d/%d", aa + 1, pages);
  4777. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4778. rc.right = mainrc.right + 20;
  4779. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4780. int wid[2] = { 50, 110 };
  4781. int hei = 11;
  4782. rc = mainrc;
  4783. rc.bottom = rc.top + hei;
  4784. rc.top += 10;
  4785. rc.bottom += 10;
  4786. int dtx = rc.Width() / 3 + 18;
  4787. int dty = 380;
  4788. for (int j = 0; j < 6; j++)
  4789. {
  4790. if (Listarray->GetSize() < aa*sinlecount + 33 * (j + 1))continue;
  4791. for (int i = 0; i < 33; i++)
  4792. {
  4793. rc2.top = rc.top + i*hei;
  4794. rc2.bottom = rc.bottom + i*hei;
  4795. rc2.left = rc.left;
  4796. rc2.right = rc.left + wid[0];
  4797. if (i == 0)
  4798. {
  4799. // rc2.left +=wid[1];
  4800. rc2.right += wid[1];
  4801. }
  4802. if (j == 1 || j == 4)
  4803. {
  4804. rc2.left += dtx;
  4805. rc2.right += dtx;
  4806. }
  4807. if (j == 2 || j == 5)
  4808. {
  4809. rc2.left += dtx * 2;
  4810. rc2.right += dtx * 2;
  4811. }
  4812. if (j == 3 || j == 4 || j == 5)
  4813. {
  4814. rc2.top += dty;
  4815. rc2.bottom += dty;
  4816. }
  4817. m_Print.DrawRect2(rc2, 1);
  4818. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4819. {
  4820. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(0);
  4821. rc2.left += 3;
  4822. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4823. rc2.left -= 3;
  4824. }
  4825. if (i == 0)continue;
  4826. rc2.left = rc2.right;
  4827. rc2.right += wid[1];
  4828. m_Print.DrawRect2(rc2, 1);
  4829. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4830. {
  4831. if (Listarray->ElementAt(aa*sinlecount + 33 * j + i).GetSize() > 1)
  4832. {
  4833. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(1);
  4834. rc2.left += 3;
  4835. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4836. rc2.left -= 3;
  4837. }
  4838. }
  4839. /* if(Listarray->GetSize ()>aa*46+i)
  4840. {
  4841. str=Listarray->ElementAt (aa*46+i).ElementAt (j);
  4842. rc2.left +=3;
  4843. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4844. rc2.left -=3;
  4845. }
  4846. rc2.left +=wid[j];
  4847. rc2.right =rc2.left+wid[j+1];*/
  4848. }
  4849. }
  4850. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4851. dlg.m_pDC = m_Print.GetPDC();
  4852. if (aa == 0)
  4853. {
  4854. if (dlg.DoModal() != IDOK)
  4855. return;
  4856. }
  4857. //结束打印
  4858. m_Print.EndPage();
  4859. m_Print.EndPrint();
  4860. }
  4861. }
  4862. void CMainFrame::PrintTakeForm(CArray<CStringArray, CStringArray>*Listarray)
  4863. {
  4864. CString title;
  4865. CString info;
  4866. // TODO: Add your control notification handler code here
  4867. int sinlecount = 4;
  4868. int pages = Listarray->GetSize() / sinlecount;
  4869. if (Listarray->GetSize() % sinlecount)pages++;
  4870. for (int aa = 0; aa < pages; aa++)
  4871. {
  4872. PrintPreview dlg;
  4873. CPrintRX m_Print;
  4874. m_Print.InitToPrint(NULL, 1);
  4875. m_Print.StartPrint();
  4876. m_Print.StartPage();
  4877. CRect mainrc(0, 0, 560, 793);
  4878. float fscale;
  4879. {
  4880. int w, h;
  4881. m_Print.GetWidHei(w, h);
  4882. fscale = (float)w / (float)h;
  4883. }
  4884. mainrc.DeflateRect(25, 40, 10, 0);
  4885. CString str;
  4886. CRect rc, rc2;
  4887. rc = mainrc;
  4888. rc.bottom = rc.top;
  4889. rc.top -= 20;
  4890. rc.left -= 20;
  4891. m_Print.SetFontFace(6, 1, "宋体");
  4892. str.Format(" 页:%d/%d", aa + 1, pages);
  4893. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4894. rc.right = mainrc.right + 10;
  4895. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4896. m_Print.SetFontFace(12, 1, "宋体");
  4897. int wid[2] = { 70, 190 };
  4898. int hei = 22;
  4899. rc = mainrc;
  4900. rc.bottom = rc.top + hei;
  4901. rc.top += 10;
  4902. rc.bottom += 10;
  4903. int dtx = rc.Width() / 2 + 18;
  4904. int dty = 380;
  4905. int arraysize = Listarray->ElementAt(0).GetSize();
  4906. for (int j = 0; j < 4; j++)
  4907. {
  4908. if (Listarray->GetSize() <= aa*sinlecount + j)continue;
  4909. for (int i = 0; i < arraysize; i++)
  4910. {
  4911. rc2.top = rc.top + i / 2 * hei;
  4912. rc2.bottom = rc.bottom + i / 2 * hei;
  4913. rc2.left = rc.left;
  4914. rc2.right = rc.left + wid[0];
  4915. if (i % 2)
  4916. {
  4917. rc2.left = rc2.right;
  4918. rc2.right += wid[1];
  4919. }
  4920. if (j == 1 || j == 3)
  4921. {
  4922. rc2.left += dtx;
  4923. rc2.right += dtx;
  4924. }
  4925. if (j == 2 || j == 3)
  4926. {
  4927. rc2.top += dty;
  4928. rc2.bottom += dty;
  4929. }
  4930. if (i == arraysize - 1 || i == arraysize - 2)
  4931. {
  4932. rc2.bottom += hei * 2;
  4933. }
  4934. m_Print.DrawRect2(rc2, 1);
  4935. {
  4936. str = Listarray->ElementAt(aa*sinlecount + j).ElementAt(i);
  4937. if (i == arraysize - 1)
  4938. {
  4939. CRect rc3 = rc2;
  4940. rc3.left += 3;
  4941. rc3.top += 3;
  4942. AutoDraw(m_Print, rc3, str, 1.4f);
  4943. }
  4944. else if (i == arraysize - 2)
  4945. {
  4946. CRect rc3 = rc2;
  4947. rc3.left += 3;
  4948. rc3.top += 3;
  4949. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4950. }
  4951. else
  4952. {
  4953. rc2.left += 3;
  4954. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4955. rc2.left -= 3;
  4956. }
  4957. }
  4958. }
  4959. }
  4960. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4961. dlg.m_pDC = m_Print.GetPDC();
  4962. if (aa == 0)
  4963. {
  4964. if (dlg.DoModal() != IDOK)
  4965. return;
  4966. }
  4967. //结束打印
  4968. m_Print.EndPage();
  4969. m_Print.EndPrint();
  4970. }
  4971. }
  4972. void CMainFrame::PrintThumbNail(CStringArray *array, CString client, BOOL bDir, CString m_size)
  4973. {
  4974. // TODO: Add your control notification handler code here
  4975. CStringArray titlearray;
  4976. CStringArray namearray;
  4977. CStringArray noarray;
  4978. CArray<CRect, CRect>rcarray;
  4979. CArray<CRect, CRect>widtharray;
  4980. if (m_size != "")
  4981. {
  4982. int pos = m_size.Find(";");
  4983. while (pos != -1)
  4984. {
  4985. CString size = m_size.Left(pos);
  4986. int pos2 = size.Find(":");
  4987. if (pos2 != -1)
  4988. {
  4989. CString str;
  4990. CRect rc;
  4991. str = size.Left(pos2);
  4992. noarray.Add(str);
  4993. str = size.Right(size.GetLength() - pos2 - 1);
  4994. pos2 = str.Find(",");
  4995. namearray.Add(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4996. pos2 = str.Find(",");
  4997. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4998. pos2 = str.Find(",");
  4999. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  5000. widtharray.Add(rc);
  5001. pos2 = str.Find(",");
  5002. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  5003. pos2 = str.Find(",");
  5004. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  5005. pos2 = str.Find(",");
  5006. rc.right = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  5007. rc.bottom = atoi(str);
  5008. rcarray.Add(rc);
  5009. }
  5010. m_size = m_size.Right(m_size.GetLength() - pos - 1);
  5011. pos = m_size.Find(";");
  5012. }
  5013. }
  5014. PrintPreview dlg;
  5015. CPrintRX m_Print;
  5016. m_Print.InitToPrint(NULL, 1);
  5017. m_Print.StartPrint();
  5018. m_Print.StartPage();
  5019. CRect mainrc(0, 0, 560, 793);
  5020. mainrc.DeflateRect(25, 50, 10, 0);
  5021. m_Print.SetFontFace(10, 1, "宋体");
  5022. CRect rc, rc2;
  5023. rc = mainrc;
  5024. rc.bottom = rc.top;
  5025. rc.top -= 20;
  5026. m_Print.DrawText((LPTSTR)(LPCTSTR)client, rc, 0, 0, FORMAT_LEFT | FORMAT_UP);
  5027. rc.bottom -= 5;
  5028. m_Print.DrawRect2(rc, 2);
  5029. if (array->GetSize() > 130)m_Print.SetFontFace(8, 1, "宋体");
  5030. if (bDir)m_Print.SetFontFace(6, 1, "宋体");
  5031. ////////////////////////////////////////////////////////////////
  5032. int imgcount = array->GetSize();
  5033. int dtx = 5;
  5034. int dty = 15;
  5035. int cx, cy;
  5036. int countx = 5;
  5037. int county = 1;
  5038. while (1)
  5039. {
  5040. if (countx*county >= imgcount)
  5041. {
  5042. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  5043. cy = cx * 4 / 3;
  5044. break;
  5045. }
  5046. else
  5047. {
  5048. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  5049. cy = cx * 4 / 3;
  5050. if (cy*(county + 1) + dty*county < mainrc.Height())//Y方向可以增加一个
  5051. {
  5052. county++;
  5053. }
  5054. else//Y方向不能加,X方向加
  5055. {
  5056. countx++;
  5057. county = 1;
  5058. }
  5059. }
  5060. }
  5061. int imgpos = 0;
  5062. CString stemp;
  5063. CPen pen(PS_SOLID, 1, RGB(255, 0, 0));
  5064. CPen *oldpen = m_Print.m_DC.SelectObject(&pen);
  5065. CPen *oldpen2 = m_Print.m_memdc.SelectObject(&pen);
  5066. for (int i = 0; i < county; i++)
  5067. {
  5068. for (int j = 0; j < countx; j++)
  5069. {
  5070. rc = mainrc;
  5071. rc.top += i*(cy + dty);
  5072. rc.left += j*(cx + dtx);
  5073. rc.right = rc.left + cx;
  5074. rc.bottom = rc.top + cy;
  5075. Image *pImg = NULL;
  5076. if (imgpos >= array->GetSize())break;
  5077. CString str = array->ElementAt(imgpos);
  5078. CString spath = str.Left(str.ReverseFind('\\') + 1);
  5079. spath += "m";
  5080. spath += str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5081. if (PathFileExists(spath))
  5082. ::LoadImageFromBuf(&pImg, spath);
  5083. else
  5084. {
  5085. ::LoadImageFromBuf(&pImg, str);
  5086. if (pImg == NULL)continue;
  5087. int orientation = GetOrientation(pImg);
  5088. if (orientation == 8)
  5089. pImg->RotateFlip(Rotate270FlipNone);
  5090. else if (orientation == 6)
  5091. pImg->RotateFlip(Rotate90FlipNone);
  5092. }
  5093. if (pImg == NULL)continue;
  5094. rc2 = rc;
  5095. RectFitDes(pImg->GetWidth(), pImg->GetHeight(), rc);
  5096. imgpos++;
  5097. m_Print.DrawImage(pImg, rc);
  5098. int imgwidth = pImg->GetWidth();
  5099. delete pImg;
  5100. rc2.top = rc2.bottom + 3;
  5101. rc2.bottom += 10;
  5102. if (bDir == 0)
  5103. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5104. else
  5105. {
  5106. stemp = str.Left(str.ReverseFind('\\'));
  5107. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5108. if (stemp.ReverseFind('\\') != -1)
  5109. {
  5110. stemp = stemp.Right(stemp.GetLength() - stemp.ReverseFind('\\') - 1);
  5111. str = stemp + "\\" + str;
  5112. }
  5113. }
  5114. if (str.Find(".") != -1)
  5115. str = str.Left(str.Find("."));
  5116. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5117. if (noarray.GetSize())
  5118. {
  5119. rc2 = rc;
  5120. for (int aa = 0; aa < noarray.GetSize(); aa++)
  5121. {
  5122. float scale = (float)rc2.Width() / (float)imgwidth;
  5123. if (noarray.ElementAt(aa) == str)
  5124. {
  5125. int nIndex = aa;
  5126. CRect rc = rcarray.ElementAt(nIndex);
  5127. int wid = widtharray.ElementAt(nIndex).left;
  5128. int hei = widtharray.ElementAt(nIndex).top;
  5129. scale *= (float)imgwidth / (float)wid;
  5130. rc.left *= scale;
  5131. rc.right *= scale;
  5132. rc.top *= scale;
  5133. rc.bottom *= scale;
  5134. rc.left += rc2.left;
  5135. rc.right += rc2.left;
  5136. rc.top += rc2.top;
  5137. rc.bottom += rc2.top;
  5138. if (rc.left < rc2.left)rc.left = rc2.left;
  5139. if (rc.right > rc2.right)rc.right = rc2.right;
  5140. if (rc.top < rc2.top)rc.top = rc2.top;
  5141. if (rc.bottom > rc2.bottom)rc.bottom = rc2.bottom;
  5142. m_Print.DrawRect2(rc, 1);
  5143. }
  5144. }
  5145. }
  5146. }
  5147. }
  5148. m_Print.m_DC.SelectObject(oldpen);
  5149. m_Print.m_memdc.SelectObject(oldpen2);
  5150. /* CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  5151. StrRect.top -=15;StrRect.bottom -=15;
  5152. Image *pImg=NULL;
  5153. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  5154. m_Print.DrawImage(pImg, StrRect);
  5155. delete pImg;
  5156. m_Print.SetFontFace(10, 1, "宋体");
  5157. StrRect=load.m_rcarray .ElementAt (20);
  5158. StrRect.right=load.m_rcarray .ElementAt (23).right;
  5159. StrRect.top -=18;StrRect.bottom -=18;
  5160. CString str="地址:"+g_cominfoarray.ElementAt (0).ElementAt (12);
  5161. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5162. */
  5163. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  5164. dlg.m_pDC = m_Print.GetPDC();
  5165. if (dlg.DoModal() != IDOK)
  5166. return;
  5167. //结束打印
  5168. m_Print.EndPage();
  5169. m_Print.EndPrint();
  5170. }
  5171. // remark by Jeff
  5172. // 函数:PrintDinDan
  5173. // 参数:
  5174. // strOrderNumber:订单单号;(Order number)
  5175. // 返回:void
  5176. // 注意:#
  5177. void CMainFrame::PrintDinDan(CString strOrderNumber)//打印订单报表;
  5178. {
  5179. int printcot = 1;
  5180. for (int aa = 0; aa < printcot; aa++)
  5181. {
  5182. PrintPreview dlg;
  5183. CPrintRX m_Print;
  5184. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  5185. {
  5186. m_Print.InitToPrint(NULL, 1);
  5187. }
  5188. else
  5189. {
  5190. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  5191. if (name.IsEmpty())
  5192. m_Print.InitToPrint(NULL, 1);
  5193. else
  5194. {
  5195. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  5196. if (nret == -1 && aa == 0)
  5197. {
  5198. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  5199. }
  5200. }
  5201. }
  5202. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 0)
  5203. {
  5204. #ifdef ZHIAI_VERSION
  5205. PrintDinDan3(strOrderNumber);
  5206. return;
  5207. #endif
  5208. #ifdef SZBLCT_VERSION
  5209. PrintDinDan4(strOrderNumber);
  5210. return;
  5211. #endif
  5212. m_Print.StartPrint();
  5213. m_Print.StartPage();
  5214. LoadRect load;
  5215. load.SetLiaPath("6.lia");
  5216. load.SetMargins(-14, 15);
  5217. if (!load.Load())return;
  5218. LoadRect load2;
  5219. load2.SetLiaPath("7.lia");
  5220. load2.SetMargins(-14, 216 + 15);
  5221. if (!load2.Load())return;
  5222. LoadRect load3;
  5223. load3.SetLiaPath("8.lia");
  5224. load3.SetMargins(-14, 705 + 15);
  5225. if (!load3.Load())return;
  5226. int i;
  5227. //////////////////////////////////////////////////////////////
  5228. CStringArray txarray;
  5229. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  5230. g_sendhead.code[0] = 11;
  5231. g_sendhead.code[1] = 52;
  5232. g_sendhead.code[2] = 50;
  5233. g_sendhead.code[3] = 150;
  5234. g_sendhead.code[4] = 77;
  5235. g_sendhead.code[5] = 4;
  5236. g_sendhead.tabcount = 6;
  5237. g_sendhead.bsql = 0;
  5238. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5239. CArray<CStringArray, CStringArray>sparray;
  5240. CArray<CStringArray, CStringArray>clientarray;
  5241. CArray<CStringArray, CStringArray>phonearray;
  5242. CArray<CStringArray, CStringArray>fgarray;
  5243. CArray<CStringArray, CStringArray>danweiarray;
  5244. CArray<CStringArray, CStringArray>jdarray;
  5245. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5246. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5247. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5248. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5249. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5250. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5251. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5252. CString m_taoxiname;
  5253. if (m_zs.Find("\\") != -1)
  5254. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  5255. else
  5256. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  5257. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5258. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5259. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5260. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5261. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5262. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5263. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5264. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5265. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5266. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5267. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5268. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5269. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5270. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5271. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5272. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5273. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5274. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5275. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5276. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5277. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5278. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5279. if (jdarray.GetSize())
  5280. {
  5281. if (m_bz.IsEmpty() == 0)
  5282. m_bz = "\r\n" + m_bz;
  5283. m_bz += "景点:";
  5284. }
  5285. #ifdef DDF_VERSION
  5286. m_bz += "219店:219路馨园小区对面\r\n";
  5287. m_bz += "金色店:万科金色家园小区东门南走20米荣光社区一楼\r\n";
  5288. m_bz += "万泰店:万泰锦绣华城小区正门\r\n";
  5289. #else
  5290. for (i = 0; i < jdarray.GetSize(); i++)
  5291. {
  5292. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5293. }
  5294. m_bz.TrimRight(";");
  5295. #endif
  5296. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5297. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5298. if (IsHasRights2new(31) == 0)
  5299. {
  5300. m_phone1 = "***";
  5301. m_phone2 = "***";
  5302. }
  5303. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5304. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5305. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  5306. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  5307. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  5308. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  5309. filter = "name='" + m_ren + "'";
  5310. g_sendhead.code[0] = 5;
  5311. g_sendhead.tabcount = 1;
  5312. g_sendhead.bsql = 0;
  5313. int g_nYearposTemp = g_nYearpos;
  5314. g_nYearpos = -1;
  5315. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5316. g_nYearpos = g_nYearposTemp;
  5317. if (g_bSendOK == 0)return;
  5318. DataToArray(&phonearray);
  5319. m_money1.Format("%f", atof(m_taoxijiage));
  5320. m_money2.Format("%f", atof(m_payed1));
  5321. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5322. ConvertToPrice(m_money1);
  5323. ConvertToPrice(m_money2);
  5324. ConvertToPrice(m_money3);
  5325. ////////////////////////////////////////////////////////////////
  5326. int rcpos = -1;
  5327. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  5328. StrRect.top -= 15; StrRect.bottom -= 15;
  5329. Image *pImg = NULL;
  5330. #ifdef MNLS_VERSION
  5331. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  5332. #else
  5333. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  5334. #endif
  5335. m_Print.DrawImage(pImg, StrRect);
  5336. delete pImg;
  5337. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5338. {
  5339. Image *pImg = NULL;
  5340. g_nSendCode = 31;
  5341. int g_nYearposTemp = g_nYearpos;
  5342. g_nYearpos = -1;
  5343. g_pMainWnd->ProcessChatMessageRequest2(1);
  5344. g_nYearpos = g_nYearposTemp;
  5345. g_nSendCode = 0;
  5346. if (g_bSendOK == 0)return;
  5347. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5348. if (pImg)
  5349. {
  5350. StrRect.left = 30;
  5351. StrRect.top = 12;
  5352. StrRect.right = StrRect.left + 60;
  5353. StrRect.bottom = StrRect.top + 60;
  5354. m_Print.DrawImage(pImg, StrRect);
  5355. delete pImg; pImg = NULL;
  5356. }
  5357. }
  5358. m_Print.SetFontFace(11, 1, "宋体");
  5359. StrRect = load.m_rcarray.ElementAt(20);
  5360. StrRect.right = load.m_rcarray.ElementAt(23).right;
  5361. StrRect.top -= 18; StrRect.bottom -= 18;
  5362. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  5363. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5364. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  5365. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5366. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5367. StrRect.top -= 15; StrRect.bottom -= 15;
  5368. #ifdef MNLS_VERSION
  5369. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5370. #endif
  5371. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5372. StrRect.top -= 15; StrRect.bottom -= 15;
  5373. #ifdef MNLS_VERSION
  5374. m_Print.DrawRect(StrRect);
  5375. #endif
  5376. m_Print.SetFontFace(7, 1, "黑体");
  5377. m_Print.SetColor(0xffffff);
  5378. #ifdef MNLS_VERSION
  5379. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5380. #endif
  5381. m_Print.SetColor(0);
  5382. m_Print.SetFontFace(15, 1, "宋体");
  5383. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5384. StrRect.top -= 15; StrRect.bottom -= 15;
  5385. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同预约订单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5386. CStringArray strarray;
  5387. strarray.Add("NO: " + strOrderNumber);
  5388. CString date;
  5389. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  5390. strarray.Add(date);
  5391. strarray.Add("喜爱");
  5392. strarray.Add("格调");
  5393. if (fgarray.GetSize() == 12)
  5394. {
  5395. for (int i = 0; i < 12; i++)
  5396. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  5397. }
  5398. else
  5399. {
  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. strarray.Add("温柔贤惠");
  5410. strarray.Add("成熟感性");
  5411. strarray.Add("清纯可爱");
  5412. }
  5413. strarray.Add("姓名");
  5414. // strarray.Add("职业");
  5415. strarray.Add("");
  5416. strarray.Add("地址");
  5417. strarray.Add("电话");
  5418. #ifdef CHILD_VERSION
  5419. strarray.Add("家长");
  5420. strarray.Add("宝宝");
  5421. #else
  5422. strarray.Add("先生");
  5423. strarray.Add("女士");
  5424. #endif
  5425. m_Print.SetFontFace(11, 1, "宋体");
  5426. for (i = 0; i < strarray.GetSize(); i++)
  5427. {
  5428. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5429. if (i < 2)
  5430. {
  5431. StrRect.top -= 15; StrRect.bottom -= 15;
  5432. }
  5433. if (i>15)
  5434. m_Print.DrawRect2(StrRect, 1);
  5435. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5436. }
  5437. for (i = 29; i <= 40; i++)
  5438. {
  5439. if (m_style.GetLength() <= (i - 29))continue;
  5440. if (m_style.GetAt(i - 29) != '1')continue;
  5441. StrRect = load.m_rcarray.ElementAt(i - 1);
  5442. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5443. }
  5444. for (i = 27; i <= 48; i++)
  5445. {
  5446. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5447. m_Print.DrawRect2(StrRect, 1);
  5448. }
  5449. #ifdef CHILD_VERSION
  5450. StrRect = load.m_rcarray.ElementAt(45);
  5451. StrRect.right = StrRect.left + 62;
  5452. m_Print.DrawRect2(StrRect, 1);
  5453. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5454. StrRect.left = StrRect.right;
  5455. StrRect.right = StrRect.left + 62;
  5456. m_Print.DrawRect2(StrRect, 1);
  5457. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5458. StrRect.left = StrRect.right;
  5459. StrRect.right = StrRect.left + 62;
  5460. m_Print.DrawRect2(StrRect, 1);
  5461. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5462. StrRect.left = StrRect.right;
  5463. StrRect.right = StrRect.left + 62;
  5464. m_Print.DrawRect2(StrRect, 1);
  5465. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5466. #endif
  5467. /////////////////////////
  5468. strarray.RemoveAll();
  5469. CString temp;
  5470. temp.Format("拍摄多款选 %d 款,其中影", atoi(m_outside) + atoi(m_outside2));
  5471. strarray.Add(temp);
  5472. temp.Format("棚景 %d 款,景点 %d 款.", atoi(m_outside2), atoi(m_outside));
  5473. strarray.Add(temp);
  5474. strarray.Add("化妆");
  5475. strarray.Add("造型");
  5476. #ifdef CHILD_VERSION
  5477. strarray.Add("");
  5478. #else
  5479. strarray.Add("婚纱");
  5480. #endif
  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. strarray.Add("主摄影师");
  5490. strarray.Add("拍摄日期");
  5491. strarray.Add("定金");
  5492. #ifdef CHILD_VERSION
  5493. strarray.Add("主引导师");
  5494. #else
  5495. strarray.Add("主化妆师");
  5496. #endif
  5497. strarray.Add("看样日期");
  5498. strarray.Add("欠款余额");
  5499. strarray.Add("总监");
  5500. strarray.Add("取件日期");
  5501. rcpos = -1;
  5502. for (i = 0; i < strarray.GetSize(); i++)
  5503. {
  5504. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5505. if (i>9)
  5506. m_Print.DrawRect2(StrRect, 1);
  5507. #ifdef CHILD_VERSION
  5508. if (i == 5)
  5509. StrRect.top -= StrRect.Height();
  5510. #endif
  5511. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5512. }
  5513. for (i = 22; i <= 41; i++)
  5514. {
  5515. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5516. m_Print.DrawRect2(StrRect, 1);
  5517. }
  5518. /////////////////////////////
  5519. strarray.RemoveAll();
  5520. #ifdef CHILD_VERSION
  5521. strarray.Add("顾客方 家长:");
  5522. strarray.Add("宝宝:");
  5523. #else
  5524. strarray.Add("顾客方 先生:");
  5525. strarray.Add("女士:");
  5526. #endif
  5527. strarray.Add("电话:");
  5528. strarray.Add("影楼方 店长:");
  5529. strarray.Add("接单人:");
  5530. strarray.Add("电话:");
  5531. rcpos = -1;
  5532. for (i = 0; i < strarray.GetSize(); i++)
  5533. {
  5534. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5535. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5536. }
  5537. for (i = 7; i <= 12; i++)
  5538. {
  5539. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5540. // if(i!=10)
  5541. m_Print.DrawRect2(StrRect, 2);
  5542. }
  5543. //////////////////////////////////////
  5544. //开始打数据
  5545. strarray.RemoveAll();
  5546. strarray.Add(m_name1);
  5547. strarray.Add(m_name2);
  5548. /// strarray.Add (m_occupation1);
  5549. // strarray.Add (m_occupation2);
  5550. strarray.Add("");
  5551. strarray.Add("");
  5552. strarray.Add(m_addr1);
  5553. #ifdef CHILD_VERSION
  5554. strarray.Add("");
  5555. #else
  5556. strarray.Add(m_addr2);
  5557. #endif
  5558. strarray.Add(m_phone1);
  5559. strarray.Add(m_phone2);
  5560. for (i = 41; i <= 48; i++)
  5561. {
  5562. StrRect = load.m_rcarray.ElementAt(i - 1);
  5563. StrRect.left += 4;
  5564. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5565. }
  5566. ///////////////////////////////
  5567. strarray.RemoveAll();
  5568. strarray.Add(m_money1);
  5569. strarray.Add(m_waiter1);
  5570. strarray.Add(m_time2);
  5571. strarray.Add(m_money2);
  5572. strarray.Add(m_waiter2);
  5573. strarray.Add(m_time4);
  5574. strarray.Add(m_money3);
  5575. strarray.Add("");
  5576. strarray.Add(m_time5);
  5577. for (i = 32; i <= 40; i++)
  5578. {
  5579. StrRect = load2.m_rcarray.ElementAt(i - 1);
  5580. StrRect.left += 4;
  5581. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5582. }
  5583. ///////////////////////////////
  5584. strarray.RemoveAll();
  5585. strarray.Add(m_name1);
  5586. strarray.Add(m_name2);
  5587. CString phone;
  5588. if (m_phone1.IsEmpty() == 0)
  5589. phone = m_phone1 + ",";
  5590. phone += m_phone2;
  5591. phone.TrimRight(",");
  5592. strarray.Add(phone);
  5593. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  5594. strarray.Add(m_ren);
  5595. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  5596. for (i = 7; i <= 12; i++)
  5597. {
  5598. StrRect = load3.m_rcarray.ElementAt(i - 1);
  5599. StrRect.left += 4;
  5600. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5601. }
  5602. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  5603. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5604. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  5605. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5606. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  5607. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5608. //////////////////////////////
  5609. //开始画文字
  5610. StrRect = load2.m_rcarray.ElementAt(30);
  5611. StrRect.left += 3;
  5612. StrRect.top += 3;
  5613. StrRect.right -= 2;
  5614. StrRect.bottom -= 2;
  5615. AutoDraw(m_Print, StrRect, m_bz, 1.4f);
  5616. StrRect = load2.m_rcarray.ElementAt(29);
  5617. StrRect.left += 3;
  5618. StrRect.top += 3;
  5619. StrRect.right -= 2;
  5620. StrRect.bottom -= 2;
  5621. str = "";
  5622. for (i = 0; i < sparray.GetSize(); i++)
  5623. {
  5624. str += sparray.ElementAt(i).ElementAt(5);
  5625. str += " 数量:";
  5626. str += sparray.ElementAt(i).ElementAt(3);
  5627. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5628. str += "\r\n";
  5629. }
  5630. str.TrimRight("\r\n");
  5631. AutoDraw(m_Print, StrRect, str, 1.4);
  5632. StrRect = load2.m_rcarray.ElementAt(40);
  5633. StrRect.top += 8;
  5634. m_Print.SetFontFace(12, 1, "黑体");
  5635. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5636. StrRect.left += 3;
  5637. StrRect.top += 30;
  5638. StrRect.right -= 2;
  5639. StrRect.bottom -= 2;
  5640. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5641. if (str.IsEmpty())
  5642. {
  5643. str = "\
  5644. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5645. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5646. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5647. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5648. 持良好的心境.\r\n\
  5649. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5650. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5651. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5652. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5653. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5654. 勿进影室, 以免影响拍摄.\r\n\
  5655. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5656. 师或店长沟通.\r\n\
  5657. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5658. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5659. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5660. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5661. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5662. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5663. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5664. 还.";
  5665. }
  5666. AutoDraw(m_Print, StrRect, str, 1.8);
  5667. }
  5668. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 1)
  5669. {//AfxMessageBox("yyy");
  5670. m_Print.StartPrint();
  5671. m_Print.StartPage();
  5672. LoadRect load;
  5673. load.SetLiaPath("6-2.lia");
  5674. load.SetMargins(0, 0);
  5675. if (!load.Load())return;
  5676. int i;
  5677. //////////////////////////////////////////////////////////////
  5678. CStringArray txarray;
  5679. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  5680. g_sendhead.code[0] = 11;
  5681. g_sendhead.code[1] = 52;
  5682. g_sendhead.code[2] = 50;
  5683. g_sendhead.code[3] = 150;
  5684. g_sendhead.code[4] = 77;
  5685. g_sendhead.code[5] = 4;
  5686. g_sendhead.tabcount = 6;
  5687. g_sendhead.bsql = 0;
  5688. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5689. CArray<CStringArray, CStringArray>sparray;
  5690. CArray<CStringArray, CStringArray>clientarray;
  5691. CArray<CStringArray, CStringArray>phonearray;
  5692. CArray<CStringArray, CStringArray>fgarray;
  5693. CArray<CStringArray, CStringArray>danweiarray;
  5694. CArray<CStringArray, CStringArray>jdarray;
  5695. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5696. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5697. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5698. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5699. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5700. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5701. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  5702. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5703. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5704. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5705. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5706. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5707. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5708. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5709. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5710. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5711. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5712. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5713. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5714. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5715. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5716. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5717. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5718. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5719. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5720. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5721. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5722. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5723. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5724. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5725. if (jdarray.GetSize())
  5726. {
  5727. if (m_bz.IsEmpty() == 0)
  5728. m_bz = "\r\n" + m_bz;
  5729. m_bz += "景点:";
  5730. }
  5731. for (i = 0; i < jdarray.GetSize(); i++)
  5732. {
  5733. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5734. }
  5735. m_bz.TrimRight(";");
  5736. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5737. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5738. if (IsHasRights2new(31) == 0)
  5739. {
  5740. m_phone1 = "***";
  5741. m_phone2 = "***";
  5742. }
  5743. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5744. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5745. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  5746. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  5747. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  5748. CString str;
  5749. filter = "name='" + m_ren + "'";
  5750. g_sendhead.code[0] = 5;
  5751. g_sendhead.tabcount = 1;
  5752. g_sendhead.bsql = 0;
  5753. int g_nYearposTemp = g_nYearpos;
  5754. g_nYearpos = -1;
  5755. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5756. g_nYearpos = g_nYearposTemp;
  5757. if (g_bSendOK == 0)return;
  5758. DataToArray(&phonearray);
  5759. m_money1.Format("%f", atof(m_taoxijiage));
  5760. m_money2.Format("%f", atof(m_payed1));
  5761. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5762. ConvertToPrice(m_money1);
  5763. ConvertToPrice(m_money2);
  5764. ConvertToPrice(m_money3);
  5765. ////////////////////////////////////////////////////////////////
  5766. int rcpos = -1;
  5767. CRect StrRect = load.m_rcarray.ElementAt(0);
  5768. m_Print.SetFontFace(25, 1, "黑体");
  5769. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "预约单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5770. m_Print.SetFontFace(11, 1, "宋体");
  5771. StrRect = load.m_rcarray.ElementAt(1);
  5772. if (m_time1.GetLength() == 10)
  5773. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  5774. else
  5775. str = "开单日期:";
  5776. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5777. StrRect = load.m_rcarray.ElementAt(2);
  5778. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + strOrderNumber), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5779. CStringArray strarray;
  5780. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5781. {
  5782. Image *pImg = NULL;
  5783. g_nSendCode = 31;
  5784. int g_nYearposTemp = g_nYearpos;
  5785. g_nYearpos = -1;
  5786. g_pMainWnd->ProcessChatMessageRequest2(1);
  5787. g_nYearpos = g_nYearposTemp;
  5788. g_nSendCode = 0;
  5789. if (g_bSendOK == 0)return;
  5790. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5791. if (pImg)
  5792. {
  5793. StrRect.left = 47;
  5794. StrRect.top = 12;
  5795. StrRect.right = StrRect.left + 60;
  5796. StrRect.bottom = StrRect.top + 60;
  5797. m_Print.DrawImage(pImg, StrRect);
  5798. delete pImg; pImg = NULL;
  5799. }
  5800. }
  5801. #ifdef CHILD_VERSION
  5802. strarray.Add("家长姓名");
  5803. strarray.Add("宝宝姓名");
  5804. #else
  5805. strarray.Add("先生姓名");
  5806. strarray.Add("女士姓名");
  5807. #endif
  5808. strarray.Add("服装套数");
  5809. // strarray.Add ("拍摄张数");
  5810. #ifdef CHILD_VERSION
  5811. strarray.Add("出生日期");
  5812. #else
  5813. strarray.Add("结婚日期");
  5814. #endif
  5815. strarray.Add("拍摄日期");
  5816. strarray.Add("联系电话");
  5817. strarray.Add("联系电话");
  5818. strarray.Add("造型套数");
  5819. if (m_zs.Find("\\") != -1)
  5820. strarray.Add("入底\\入册");
  5821. else
  5822. strarray.Add("入底张数");
  5823. strarray.Add("选片日期");
  5824. strarray.Add("QQ/邮箱");
  5825. strarray.Add("套系总额");
  5826. strarray.Add("定金");
  5827. strarray.Add("余款金额");
  5828. strarray.Add("取件日期");
  5829. strarray.Add(m_name1);
  5830. strarray.Add(m_name2);
  5831. strarray.Add(m_clothescount);
  5832. // str.Format("%d", atoi(m_zs)*3);
  5833. // strarray.Add (str);
  5834. #ifdef CHILD_VERSION
  5835. strarray.Add(m_birthday1);
  5836. #else
  5837. strarray.Add(m_time3);
  5838. #endif
  5839. strarray.Add(m_time2);
  5840. strarray.Add(m_phone1);
  5841. strarray.Add(m_phone2);
  5842. strarray.Add(m_clothescount2);
  5843. strarray.Add(m_zs);
  5844. strarray.Add(m_time4);
  5845. strarray.Add(m_qq1);
  5846. strarray.Add(m_money1);
  5847. strarray.Add(m_money2);
  5848. strarray.Add(m_money3);
  5849. strarray.Add(m_time5);
  5850. for (i = 4; i <= 33; i++)
  5851. {
  5852. StrRect = load.m_rcarray.ElementAt(i - 1);
  5853. m_Print.DrawRect2(StrRect, 1);
  5854. if (strarray.GetSize() > (i - 4))
  5855. {
  5856. if (i <= 18)
  5857. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5858. else
  5859. {
  5860. StrRect.left += 4;
  5861. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5862. }
  5863. }
  5864. }
  5865. int dt = 413;
  5866. StrRect = load.m_rcarray.ElementAt(36); 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(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5869. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5870. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5871. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5872. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  5873. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5874. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  5875. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5876. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  5877. m_Print.DrawText((LPTSTR)(LPCTSTR)("网址:" + g_cominfoarray.ElementAt(0).ElementAt(13)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5878. //////////////////////////////
  5879. //开始画文字
  5880. StrRect = load.m_rcarray.ElementAt(7);
  5881. int hei = StrRect.Height();
  5882. StrRect.top += hei;
  5883. StrRect.bottom += hei;
  5884. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5885. StrRect.top += dt;
  5886. StrRect.bottom += dt;
  5887. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5888. StrRect = load.m_rcarray.ElementAt(17);
  5889. StrRect.top += hei;
  5890. StrRect.bottom += hei;
  5891. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5892. StrRect = load.m_rcarray.ElementAt(33);
  5893. StrRect.bottom = StrRect.top + dt; m_Print.DrawRect2(StrRect, 1);
  5894. StrRect.top += hei;
  5895. StrRect.left += 3;
  5896. StrRect.top += 3;
  5897. StrRect.right -= 2;
  5898. StrRect.bottom -= 2;
  5899. str = "";
  5900. for (i = 0; i < sparray.GetSize(); i++)
  5901. {
  5902. str += sparray.ElementAt(i).ElementAt(5);
  5903. str += " 数量:";
  5904. str += sparray.ElementAt(i).ElementAt(3);
  5905. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5906. str += "\r\n";
  5907. }
  5908. str.TrimRight("\r\n");
  5909. AutoDraw(m_Print, StrRect, str, 1.4);
  5910. StrRect = load.m_rcarray.ElementAt(33);
  5911. StrRect.top += dt;
  5912. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5913. StrRect.top += hei;
  5914. StrRect.left += 3;
  5915. StrRect.top += 3;
  5916. StrRect.right -= 2;
  5917. StrRect.bottom -= 2;
  5918. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  5919. StrRect = load.m_rcarray.ElementAt(34);
  5920. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5921. StrRect.top += hei;
  5922. StrRect.left += 3;
  5923. StrRect.top += 3;
  5924. StrRect.right -= 2;
  5925. StrRect.bottom -= 2;
  5926. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5927. if (str.IsEmpty())
  5928. {
  5929. str = "\
  5930. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5931. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5932. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5933. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5934. 持良好的心境.\r\n\
  5935. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5936. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5937. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5938. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5939. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5940. 勿进影室, 以免影响拍摄.\r\n\
  5941. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5942. 师或店长沟通.\r\n\
  5943. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5944. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5945. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5946. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5947. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5948. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5949. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5950. 还.";
  5951. }
  5952. AutoDraw(m_Print, StrRect, str, 1.8);
  5953. StrRect = load.m_rcarray.ElementAt(35);
  5954. StrRect.bottom += 100;
  5955. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  5956. 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∨";
  5957. // AutoDraw(m_Print, StrRect, str, 1.4);
  5958. }
  5959. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 2)
  5960. {
  5961. PrintDinDan5(strOrderNumber);
  5962. return;
  5963. }
  5964. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  5965. {
  5966. PrintDinDan6(strOrderNumber);
  5967. return;
  5968. }
  5969. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  5970. dlg.m_pDC = m_Print.GetPDC();
  5971. dlg.m_mode = 1;
  5972. if (aa == 0)
  5973. {
  5974. if (dlg.DoModal() != IDOK)
  5975. return;
  5976. printcot = dlg.m_num;
  5977. }
  5978. //结束打印
  5979. m_Print.EndPage();
  5980. m_Print.EndPrint();
  5981. }
  5982. }
  5983. void CovertDate2(CString date, CString &date2)
  5984. {
  5985. try
  5986. {
  5987. if (date == "2013-04-09")
  5988. {
  5989. date2 = "2013-02-29";
  5990. return;
  5991. }
  5992. ///////////////////////////////////
  5993. date2 = date;
  5994. GongToLong(date2);
  5995. ////////////////////////////////////
  5996. return;
  5997. CCalendarConvert m_CalendarConvert;
  5998. SYSTEMTIME src = { 0 };
  5999. SYSTEMTIME dst = { 0 };
  6000. COleDateTime m_timeLunar(atoi(date.Mid(0, 4)), atoi(date.Mid(5, 2)), atoi(date.Mid(8, 2)), 0, 0, 0);
  6001. COleDateTime m_timeGregorian;
  6002. m_timeLunar.GetAsSystemTime(src);
  6003. BOOL bEmbolism = 0;
  6004. if (m_CalendarConvert.Gregorian2Lunar(&src, &dst, &bEmbolism))
  6005. {
  6006. m_timeGregorian = m_CalendarConvert.ConvertSysTime2OleDateTime(&dst);
  6007. date2.Format("%04d-%02d-%02d", m_timeGregorian.GetYear(), m_timeGregorian.GetMonth(), m_timeGregorian.GetDay());
  6008. if (m_timeGregorian.GetYear() == -1)date2 = "2000-13-32";
  6009. }
  6010. else
  6011. {
  6012. date2.Empty();
  6013. }
  6014. }
  6015. catch (...)
  6016. {
  6017. }
  6018. }
  6019. void CMainFrame::PrintDinDan5(CString m_id)
  6020. {
  6021. int printcot = 1;
  6022. for (int aa = 0; aa < printcot; aa++)
  6023. {
  6024. PrintPreview dlg;
  6025. CPrintRX m_Print;
  6026. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6027. {
  6028. m_Print.InitToPrint(NULL, 1);
  6029. }
  6030. else
  6031. {
  6032. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  6033. if (name.IsEmpty())
  6034. m_Print.InitToPrint(NULL, 1);
  6035. else
  6036. {
  6037. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6038. if (nret == -1 && aa == 0)
  6039. {
  6040. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6041. }
  6042. }
  6043. }
  6044. {
  6045. m_Print.StartPrint();
  6046. m_Print.StartPage();
  6047. LoadRect load;
  6048. load.SetLiaPath("19.lia");
  6049. load.SetMargins(0, -20);
  6050. if (!load.Load())return;
  6051. int i;
  6052. //////////////////////////////////////////////////////////////
  6053. CStringArray txarray;
  6054. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  6055. g_sendhead.code[0] = 11;
  6056. g_sendhead.code[1] = 52;
  6057. g_sendhead.code[2] = 50;
  6058. g_sendhead.code[3] = 150;
  6059. g_sendhead.code[4] = 77;
  6060. g_sendhead.code[5] = 4;
  6061. g_sendhead.tabcount = 6;
  6062. g_sendhead.bsql = 0;
  6063. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  6064. CArray<CStringArray, CStringArray>sparray;
  6065. CArray<CStringArray, CStringArray>clientarray;
  6066. CArray<CStringArray, CStringArray>phonearray;
  6067. CArray<CStringArray, CStringArray>fgarray;
  6068. CArray<CStringArray, CStringArray>danweiarray;
  6069. CArray<CStringArray, CStringArray>jdarray;
  6070. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  6071. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  6072. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  6073. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  6074. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  6075. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  6076. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  6077. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  6078. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  6079. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  6080. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  6081. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  6082. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  6083. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  6084. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  6085. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  6086. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  6087. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  6088. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  6089. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  6090. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  6091. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  6092. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  6093. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  6094. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  6095. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  6096. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  6097. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  6098. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(36);
  6099. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  6100. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6101. CString m_txtype = g_List1array.ElementAt(0).ElementAt(52);
  6102. CString m_memberno = g_List1array.ElementAt(0).ElementAt(47);
  6103. CString str;
  6104. if (jdarray.GetSize())
  6105. {
  6106. if (m_bz.IsEmpty() == 0)
  6107. m_bz = "\r\n" + m_bz;
  6108. m_bz += "景点:";
  6109. }
  6110. for (i = 0; i < jdarray.GetSize(); i++)
  6111. {
  6112. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  6113. }
  6114. m_bz.TrimRight(";");
  6115. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  6116. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  6117. if (IsHasRights2new(31) == 0)
  6118. {
  6119. m_phone1 = "***";
  6120. m_phone2 = "***";
  6121. }
  6122. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  6123. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  6124. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  6125. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  6126. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  6127. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  6128. BOOL check1 = atoi(clientarray.ElementAt(0).ElementAt(15));
  6129. filter = "name='" + m_ren + "'";
  6130. g_sendhead.code[0] = 5;
  6131. g_sendhead.tabcount = 1;
  6132. g_sendhead.bsql = 0;
  6133. int g_nYearposTemp = g_nYearpos;
  6134. g_nYearpos = -1;
  6135. g_pMainWnd->ProcessChatMessageRequest2(filter);
  6136. g_nYearpos = g_nYearposTemp;
  6137. if (g_bSendOK == 0)return;
  6138. DataToArray(&phonearray);
  6139. m_money1.Format("%f", atof(m_taoxijiage));
  6140. m_money2.Format("%f", atof(m_payed1));
  6141. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  6142. ConvertToPrice(m_money1);
  6143. ConvertToPrice(m_money2);
  6144. ConvertToPrice(m_money3);
  6145. ////////////////////////////////////////////////////////////////
  6146. int rcpos = -1;
  6147. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6148. //Image *pImg=NULL;
  6149. // ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  6150. // m_Print.DrawImage(pImg, StrRect);
  6151. // delete pImg;
  6152. m_Print.SetFontFace(20, 1, "宋体");
  6153. StrRect = load.m_rcarray.ElementAt(1);
  6154. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "定单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6155. m_Print.SetFontFace(12, 1, "宋体");
  6156. StrRect = load.m_rcarray.ElementAt(2);
  6157. m_Print.DrawText((LPTSTR)(LPCTSTR)("NO." + m_id), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6158. StrRect = load.m_rcarray.ElementAt(3);
  6159. str.Format("%s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  6160. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6161. StrRect = load.m_rcarray.ElementAt(4);
  6162. m_Print.DrawText((LPTSTR)(LPCTSTR)("联系人:" + m_name1), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6163. CStringArray strarray;
  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. strarray.Add("定单人");
  6174. strarray.Add("入底\\入册");
  6175. strarray.Add("联系电话");
  6176. for (i = 6; i <= 17; i++)
  6177. {
  6178. StrRect = load.m_rcarray.ElementAt(i - 1);
  6179. m_Print.DrawRect2(StrRect, 1);
  6180. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 6), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6181. }
  6182. strarray.RemoveAll();
  6183. strarray.Add(m_name2);
  6184. strarray.Add(m_sex);
  6185. if (m_birthday.GetLength() != 10)
  6186. strarray.Add("");
  6187. else
  6188. {
  6189. int year = 0;
  6190. if (check1)
  6191. {
  6192. CString date2;
  6193. CovertDate2(g_date, date2);
  6194. year = atoi(date2.Left(4)) - atoi(m_birthday.Left(4));
  6195. if (date2.Right(5) >= m_birthday.Right(5))
  6196. year++;
  6197. }
  6198. else
  6199. {
  6200. year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  6201. if (g_date.Right(5) >= m_birthday.Right(5))
  6202. year++;
  6203. }
  6204. str.Format("%d", year);
  6205. strarray.Add(str);
  6206. }
  6207. strarray.Add(m_birthday);
  6208. strarray.Add(m_money1);
  6209. strarray.Add(m_money2);
  6210. strarray.Add(m_money3);
  6211. strarray.Add(m_txtype);
  6212. strarray.Add(m_memberno);
  6213. strarray.Add(m_ren);
  6214. strarray.Add(m_zs);
  6215. if (!m_phone1.IsEmpty())
  6216. strarray.Add(m_phone1);
  6217. else
  6218. strarray.Add(m_phone2);
  6219. for (i = 18; i <= 29; i++)
  6220. {
  6221. StrRect = load.m_rcarray.ElementAt(i - 1);
  6222. m_Print.DrawRect2(StrRect, 1);
  6223. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6224. }
  6225. strarray.RemoveAll();
  6226. strarray.Add("摄影师");
  6227. strarray.Add("拍照时间");
  6228. strarray.Add("选片人");
  6229. strarray.Add("选片时间");
  6230. strarray.Add("引导师");
  6231. strarray.Add("设计师");
  6232. strarray.Add("取件时间");
  6233. strarray.Add("顾客签字");
  6234. for (i = 34; i <= 41; i++)
  6235. {
  6236. StrRect = load.m_rcarray.ElementAt(i - 1);
  6237. m_Print.DrawRect2(StrRect, 1);
  6238. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 34), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6239. }
  6240. strarray.RemoveAll();
  6241. strarray.Add(m_waiter1);
  6242. strarray.Add(m_time2);
  6243. strarray.Add(m_waiter3);
  6244. strarray.Add(m_time4);
  6245. strarray.Add(m_waiter2);
  6246. strarray.Add(m_waiter4);
  6247. strarray.Add(m_time5);
  6248. strarray.Add("");
  6249. for (i = 42; i <= 49; i++)
  6250. {
  6251. StrRect = load.m_rcarray.ElementAt(i - 1);
  6252. m_Print.DrawRect2(StrRect, 1);
  6253. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6254. }
  6255. m_Print.SetFontFace(15, 1, "宋体");
  6256. StrRect = load.m_rcarray.ElementAt(29);
  6257. m_Print.DrawRect2(StrRect, 1);
  6258. StrRect.top += 45;
  6259. m_Print.DrawText((LPTSTR)(LPCTSTR)"拍", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6260. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6261. m_Print.DrawText((LPTSTR)(LPCTSTR)"内", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6262. m_Print.DrawText((LPTSTR)(LPCTSTR)"容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  6263. StrRect = load.m_rcarray.ElementAt(30);
  6264. m_Print.DrawRect2(StrRect, 1);
  6265. StrRect.top += 45;
  6266. m_Print.DrawText((LPTSTR)(LPCTSTR)"友", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6267. m_Print.DrawText((LPTSTR)(LPCTSTR)"情", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6268. m_Print.DrawText((LPTSTR)(LPCTSTR)"提", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6269. m_Print.DrawText((LPTSTR)(LPCTSTR)"示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  6270. m_Print.SetFontFace(10, 1, "宋体");
  6271. StrRect = load.m_rcarray.ElementAt(37); StrRect.top = StrRect.bottom + 2;
  6272. str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  6273. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  6274. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  6275. StrRect = load.m_rcarray.ElementAt(48); StrRect.top = StrRect.bottom + 2; StrRect.left -= 200;
  6276. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  6277. //开始画文字
  6278. StrRect = load.m_rcarray.ElementAt(31);
  6279. StrRect.left += 3;
  6280. StrRect.top += 3;
  6281. StrRect.right -= 2;
  6282. StrRect.bottom -= 2;
  6283. str = "";
  6284. for (i = 0; i < sparray.GetSize(); i++)
  6285. {
  6286. str += sparray.ElementAt(i).ElementAt(5);
  6287. str += " 数量:";
  6288. str += sparray.ElementAt(i).ElementAt(3);
  6289. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6290. str += "\r\n";
  6291. }
  6292. str.TrimRight("\r\n");
  6293. m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6294. m_bz.TrimLeft();
  6295. if (m_bz != "")
  6296. {
  6297. str += "\r\n"; str += "\r\n";
  6298. str += "备注:" + m_bz;
  6299. }
  6300. AutoDraw(m_Print, StrRect, str, 1.4);
  6301. StrRect = load.m_rcarray.ElementAt(32); m_Print.DrawRect2(StrRect, 1);
  6302. StrRect.left += 3;
  6303. StrRect.top += 3;
  6304. StrRect.right -= 2;
  6305. StrRect.bottom -= 2;
  6306. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6307. if (str.IsEmpty())
  6308. {
  6309. str = "\
  6310. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6311. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6312. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6313. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6314. 持良好的心境.\r\n\
  6315. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6316. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6317. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6318. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6319. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6320. 勿进影室, 以免影响拍摄.\r\n\
  6321. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6322. 师或店长沟通.\r\n\
  6323. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6324. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6325. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6326. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6327. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6328. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6329. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6330. 还.";
  6331. }
  6332. AutoDraw(m_Print, StrRect, str, 1.8);
  6333. }
  6334. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6335. dlg.m_pDC = m_Print.GetPDC();
  6336. dlg.m_mode = 1;
  6337. if (aa == 0)
  6338. {
  6339. if (dlg.DoModal() != IDOK)
  6340. return;
  6341. printcot = dlg.m_num;
  6342. }
  6343. //结束打印
  6344. m_Print.EndPage();
  6345. m_Print.EndPrint();
  6346. }
  6347. }
  6348. void CMainFrame::PrintDinDan4(CString m_id)
  6349. {
  6350. // TODO: Add your control notification handler code here
  6351. CPrintRX m_Print;
  6352. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6353. {
  6354. m_Print.InitToPrint(NULL, 1);
  6355. }
  6356. else
  6357. {
  6358. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  6359. if (name.IsEmpty())
  6360. m_Print.InitToPrint(NULL, 1);
  6361. else
  6362. {
  6363. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6364. if (nret == -1)
  6365. {
  6366. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6367. }
  6368. }
  6369. }
  6370. m_Print.StartPrint();
  6371. m_Print.StartPage();
  6372. LoadRect load;
  6373. load.SetLiaPath("6-2.lia");
  6374. load.SetMargins(0, 0);
  6375. if (!load.Load())return;
  6376. int i;
  6377. //////////////////////////////////////////////////////////////
  6378. CStringArray txarray;
  6379. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  6380. g_sendhead.code[0] = 11;
  6381. g_sendhead.code[1] = 52;
  6382. g_sendhead.code[2] = 50;
  6383. g_sendhead.code[3] = 150;
  6384. g_sendhead.code[4] = 77;
  6385. g_sendhead.code[5] = 4;
  6386. g_sendhead.tabcount = 6;
  6387. g_sendhead.bsql = 0;
  6388. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  6389. CArray<CStringArray, CStringArray>sparray;
  6390. CArray<CStringArray, CStringArray>clientarray;
  6391. CArray<CStringArray, CStringArray>phonearray;
  6392. CArray<CStringArray, CStringArray>fgarray;
  6393. CArray<CStringArray, CStringArray>danweiarray;
  6394. CArray<CStringArray, CStringArray>jdarray;
  6395. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  6396. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  6397. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  6398. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  6399. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  6400. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  6401. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  6402. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  6403. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  6404. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  6405. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  6406. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  6407. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  6408. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  6409. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  6410. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  6411. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  6412. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  6413. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  6414. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  6415. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  6416. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  6417. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  6418. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  6419. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  6420. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  6421. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  6422. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  6423. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  6424. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6425. if (jdarray.GetSize())
  6426. {
  6427. if (m_bz.IsEmpty() == 0)
  6428. m_bz = "\r\n" + m_bz;
  6429. m_bz += "景点:";
  6430. }
  6431. for (i = 0; i < jdarray.GetSize(); i++)
  6432. {
  6433. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  6434. }
  6435. m_bz.TrimRight(";");
  6436. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  6437. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  6438. if (IsHasRights2new(31) == 0)
  6439. {
  6440. m_phone1 = "***";
  6441. m_phone2 = "***";
  6442. }
  6443. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  6444. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  6445. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  6446. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  6447. CString str;
  6448. filter = "name='" + m_ren + "'";
  6449. g_sendhead.code[0] = 5;
  6450. g_sendhead.tabcount = 1;
  6451. g_sendhead.bsql = 0;
  6452. int g_nYearposTemp = g_nYearpos;
  6453. g_nYearpos = -1;
  6454. g_pMainWnd->ProcessChatMessageRequest2(filter);
  6455. g_nYearpos = g_nYearposTemp;
  6456. if (g_bSendOK == 0)return;
  6457. DataToArray(&phonearray);
  6458. m_money1.Format("%f", atof(m_taoxijiage));
  6459. m_money2.Format("%f", atof(m_payed1));
  6460. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  6461. ConvertToPrice(m_money1);
  6462. ConvertToPrice(m_money2);
  6463. ConvertToPrice(m_money3);
  6464. ////////////////////////////////////////////////////////////////
  6465. int rcpos = -1;
  6466. CRect StrRect = load.m_rcarray.ElementAt(0);
  6467. m_Print.SetFontFace(25, 1, "黑体");
  6468. m_Print.DrawText((LPTSTR)(LPCTSTR)"巴黎春天婚纱摄影预约单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6469. m_Print.SetFontFace(11, 1, "宋体");
  6470. StrRect = load.m_rcarray.ElementAt(1);
  6471. if (m_time1.GetLength() == 10)
  6472. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  6473. else
  6474. str = "开单日期:";
  6475. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6476. StrRect = load.m_rcarray.ElementAt(2);
  6477. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + m_id), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6478. CStringArray strarray;
  6479. strarray.Add("先生姓名");
  6480. strarray.Add("女士姓名");
  6481. strarray.Add("服装套数");
  6482. strarray.Add("拍摄张数");
  6483. strarray.Add("拍摄日期");
  6484. strarray.Add("联系电话");
  6485. strarray.Add("联系电话");
  6486. strarray.Add("造型套数");
  6487. strarray.Add("入册张数");
  6488. strarray.Add("选片日期");
  6489. strarray.Add("QQ/邮箱");
  6490. strarray.Add("套系总额");
  6491. strarray.Add("定金");
  6492. strarray.Add("余款金额");
  6493. strarray.Add("取件日期");
  6494. strarray.Add(m_name1);
  6495. strarray.Add(m_name2);
  6496. strarray.Add(m_clothescount);
  6497. str.Format("%d", atoi(m_zs) * 3);
  6498. strarray.Add(str);
  6499. strarray.Add(m_time2);
  6500. strarray.Add(m_phone1);
  6501. strarray.Add(m_phone2);
  6502. strarray.Add(m_clothescount2);
  6503. strarray.Add(m_zs);
  6504. strarray.Add(m_time4);
  6505. strarray.Add(m_qq1);
  6506. strarray.Add(m_money1);
  6507. strarray.Add(m_money2);
  6508. strarray.Add(m_money3);
  6509. strarray.Add(m_time5);
  6510. for (i = 4; i <= 33; i++)
  6511. {
  6512. StrRect = load.m_rcarray.ElementAt(i - 1);
  6513. m_Print.DrawRect2(StrRect, 1);
  6514. if (strarray.GetSize() > (i - 4))
  6515. {
  6516. if (i <= 18)
  6517. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6518. else
  6519. {
  6520. StrRect.left += 4;
  6521. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6522. }
  6523. }
  6524. }
  6525. int dt = 413;
  6526. StrRect = load.m_rcarray.ElementAt(36); 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(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6529. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6530. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6531. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6532. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  6533. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址:深圳市红岭中路中深国际大厦首层,二十二层", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6534. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  6535. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:0755-61308198 61308199 25860696 25860697", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6536. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  6537. m_Print.DrawText((LPTSTR)(LPCTSTR)"网址:www.paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6538. StrRect = load.m_rcarray.ElementAt(43); StrRect.top += dt; StrRect.bottom += dt;
  6539. m_Print.DrawText((LPTSTR)(LPCTSTR)"邮箱:blct@paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6540. //////////////////////////////
  6541. //开始画文字
  6542. StrRect = load.m_rcarray.ElementAt(7);
  6543. int hei = StrRect.Height();
  6544. StrRect.top += hei;
  6545. StrRect.bottom += hei;
  6546. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6547. StrRect.top += dt;
  6548. StrRect.bottom += dt;
  6549. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6550. StrRect = load.m_rcarray.ElementAt(17);
  6551. StrRect.top += hei;
  6552. StrRect.bottom += hei;
  6553. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6554. StrRect = load.m_rcarray.ElementAt(33);
  6555. StrRect.bottom = StrRect.top + dt; m_Print.DrawRect2(StrRect, 1);
  6556. StrRect.top += hei;
  6557. StrRect.left += 3;
  6558. StrRect.top += 3;
  6559. StrRect.right -= 2;
  6560. StrRect.bottom -= 2;
  6561. str = "";
  6562. for (i = 0; i < sparray.GetSize(); i++)
  6563. {
  6564. str += sparray.ElementAt(i).ElementAt(5);
  6565. str += " 数量:";
  6566. str += sparray.ElementAt(i).ElementAt(3);
  6567. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6568. str += "\r\n";
  6569. }
  6570. str.TrimRight("\r\n");
  6571. AutoDraw(m_Print, StrRect, str, 1.4);
  6572. StrRect = load.m_rcarray.ElementAt(33);
  6573. StrRect.top += dt;
  6574. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6575. StrRect.top += hei;
  6576. StrRect.left += 3;
  6577. StrRect.top += 3;
  6578. StrRect.right -= 2;
  6579. StrRect.bottom -= 2;
  6580. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  6581. StrRect = load.m_rcarray.ElementAt(34);
  6582. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6583. StrRect.top += hei;
  6584. StrRect.left += 3;
  6585. StrRect.top += 3;
  6586. StrRect.right -= 2;
  6587. StrRect.bottom -= 2;
  6588. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6589. if (str.IsEmpty())
  6590. {
  6591. str = "\
  6592. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6593. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6594. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6595. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6596. 持良好的心境.\r\n\
  6597. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6598. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6599. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6600. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6601. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6602. 勿进影室, 以免影响拍摄.\r\n\
  6603. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6604. 师或店长沟通.\r\n\
  6605. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6606. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6607. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6608. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6609. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6610. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6611. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6612. 还.";
  6613. }
  6614. AutoDraw(m_Print, StrRect, str, 1.8);
  6615. StrRect = load.m_rcarray.ElementAt(35);
  6616. StrRect.bottom += 100;
  6617. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  6618. 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∨";
  6619. AutoDraw(m_Print, StrRect, str, 1.4);
  6620. PrintPreview dlg;
  6621. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6622. dlg.m_pDC = m_Print.GetPDC();
  6623. if (dlg.DoModal() != IDOK)return;
  6624. //结束打印
  6625. m_Print.EndPage();
  6626. m_Print.EndPrint();
  6627. }
  6628. int CalHeight_01(CRect &rc, CStringArray *saContent, CPrintRX *Print, int FORMAT)
  6629. {
  6630. CSize size;
  6631. int nMaxheight = 0;
  6632. CString strTemp;
  6633. CString strContent;
  6634. int nSize = saContent->GetSize();
  6635. int nRow = 0; // 行数;
  6636. for (int i = 0; i < nSize; i++)
  6637. {
  6638. strTemp = "";
  6639. strContent = saContent->ElementAt(i);
  6640. while (FALSE == strContent.IsEmpty())
  6641. {
  6642. strContent = strContent.Mid(strTemp.GetLength());
  6643. if (strContent.IsEmpty())
  6644. break;
  6645. Print->GetStrSize((LPTSTR)(LPCTSTR)strContent, size);
  6646. if (size.cx <= rc.Width())
  6647. {
  6648. CRect rc2 = rc;
  6649. rc2.top += nRow*(size.cy + 1);
  6650. rc2.bottom = rc2.top + (size.cy + 1);
  6651. Print->DrawText((LPTSTR)(LPCTSTR)strContent, rc2, 0, 0, FORMAT | FORMAT_UP);
  6652. nMaxheight = max(nMaxheight, rc2.bottom);
  6653. nRow++;
  6654. break;
  6655. }
  6656. int right = 0;
  6657. while (size.cx > rc.Width())
  6658. {
  6659. right++;
  6660. strTemp = strContent.Left(strContent.GetLength() - (right));
  6661. if (GIsHalfHZ(strTemp))
  6662. {
  6663. right++;
  6664. strTemp.Delete(strTemp.GetLength() - 1);
  6665. }
  6666. Print->GetStrSize((LPTSTR)(LPCTSTR)strTemp, size);
  6667. }
  6668. CRect rc2 = rc;
  6669. rc2.top += nRow*(size.cy + 1);
  6670. rc2.bottom = rc2.top + (size.cy + 1);
  6671. Print->DrawText((LPTSTR)(LPCTSTR)strTemp, rc2, 0, 0, FORMAT | FORMAT_UP); //printf("Jeff:str=%s\n\n",str);// Jeff Printf;
  6672. nRow++;
  6673. nMaxheight = max(nMaxheight, rc2.bottom);
  6674. }
  6675. }
  6676. return (nMaxheight == 0) ? (rc.bottom + 1) : (nMaxheight + 1);
  6677. }
  6678. /************************************************************************/
  6679. /*
  6680. 多字节字符编码下的CaleHeight函数;
  6681. 函数:CaleHeight
  6682. 描述:计算出一行高度可变,宽度特定的表格(CArray<CRect,CRect>),在输入指定内容时(CStringArray),表格高度变化最大的值。
  6683. 参数:
  6684. aRowRect: 一行表格,CArray::GetSize()表示表格列数;
  6685. aRowStr: 与表格对应的一行字符,CStringArray::GetSize()大小与CArray::GetSize()一致。
  6686. pPrinter: 打印机实例指针;
  6687. nFormat: 字符串的显示格式。
  6688. 返回:返回最大的表格高度;
  6689. 注意:只能多字节下使用,因为函数GIsHalfHZ。
  6690. */
  6691. /************************************************************************/
  6692. INT CalcHeight( IN CArray<CRect, CRect> &aRowRect, IN CStringArray &aRowStr, IN CPrintRX *pPrinter, IN CONST INT& nFormat)
  6693. {
  6694. // 参数有效性;
  6695. if( aRowRect.GetSize() != aRowStr.GetSize() )
  6696. {
  6697. OutputDebugString(_T("表格列数与字符列数不等!\n"));
  6698. return -1;
  6699. }
  6700. if( pPrinter == NULL )
  6701. {
  6702. OutputDebugString(_T("打印机句柄指针无效\n"));
  6703. return -1;
  6704. }
  6705. // 表格字串长度;
  6706. CSize size;
  6707. // 当前表格字体高度;
  6708. INT nGridFontHeight = 0;
  6709. // 当前表格区域;
  6710. CRect curGrid;
  6711. // 当前表格字符串;
  6712. CString strGridContent;
  6713. // 最大值高底;
  6714. INT nMaxHeigth = 0;
  6715. // 当前换行数;
  6716. INT nWrapRows = 0;
  6717. // 当前换行字串;
  6718. CString strWrapRow = _T("");
  6719. // 表格列数;
  6720. INT nColumns = aRowRect.GetSize();
  6721. // 临时表格;
  6722. CRect rcGrid;
  6723. // 循环计算每个表格的高度;
  6724. for( INT i = 0; i < nColumns; i++ )
  6725. {
  6726. nWrapRows = 0;
  6727. strWrapRow.Empty();
  6728. curGrid = aRowRect.ElementAt(i);
  6729. strGridContent = aRowStr.ElementAt(i);
  6730. nMaxHeigth = max(nMaxHeigth, curGrid.bottom);
  6731. while( !strGridContent.IsEmpty() )
  6732. {
  6733. strGridContent = strGridContent.Right(strGridContent.GetLength() - strWrapRow.GetLength());
  6734. if ( strGridContent.IsEmpty() )
  6735. {
  6736. OutputDebugString(_T("表格字符已空\n"));
  6737. break;
  6738. }
  6739. pPrinter->GetStrSize((LPTSTR)(LPCTSTR)strGridContent, size);
  6740. nGridFontHeight = size.cy + 1;
  6741. // 字串长度 <= 表格宽度;
  6742. if( size.cx <= curGrid.Width() )
  6743. {
  6744. rcGrid = curGrid;
  6745. rcGrid.top += nWrapRows*nGridFontHeight;
  6746. rcGrid.bottom = rcGrid.top + nGridFontHeight;
  6747. nMaxHeigth = max(nMaxHeigth, rcGrid.bottom);
  6748. pPrinter->DrawText((LPTSTR)(LPCTSTR)strGridContent, rcGrid, 0, 0, nFormat|FORMAT_UP);
  6749. break;
  6750. }
  6751. else
  6752. {// 字串长度 >= 表格宽度;
  6753. INT nRight = 0; // 字串右位置;
  6754. // 从右边开始逐个字符取出,直到左边字串小于表格宽度;
  6755. while( size.cx > curGrid.Width() )
  6756. {
  6757. nRight++;
  6758. strWrapRow = strGridContent.Left(strGridContent.GetLength() - nRight);
  6759. if( GIsHalfHZ(strWrapRow) )
  6760. {// 判断字串最后一个字符是否是汉字;
  6761. nRight++;
  6762. strWrapRow.Delete(strWrapRow.GetLength() - 1);
  6763. }
  6764. pPrinter->GetStrSize((LPTSTR)(LPCTSTR)strWrapRow, size);
  6765. }
  6766. rcGrid = curGrid;
  6767. rcGrid.top += nWrapRows*nGridFontHeight;
  6768. rcGrid.bottom = rcGrid.top + nGridFontHeight;
  6769. nMaxHeigth = max(nMaxHeigth, rcGrid.bottom);
  6770. pPrinter->DrawText((LPTSTR)(LPCTSTR)strWrapRow, rcGrid, 0, 0, nFormat|FORMAT_UP);
  6771. // 换行加+1;
  6772. nWrapRows++;
  6773. }
  6774. }
  6775. }
  6776. return nMaxHeigth + 1;
  6777. }
  6778. void CMainFrame::PrintReceipt(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  6779. {
  6780. //AfxMessageBox("abce");
  6781. int i = 0;
  6782. int printcot = 1;
  6783. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  6784. {
  6785. g_sendhead.bsql = 0;
  6786. g_sendhead.code[0] = 24;
  6787. g_sendhead.tabcount = 1;
  6788. int g_nYearposTemp = g_nYearpos;
  6789. g_nYearpos = -1;
  6790. g_pMainWnd->ProcessChatMessageRequest2(1);
  6791. g_nYearpos = g_nYearposTemp;
  6792. if (0 == g_bSendOK)return;
  6793. DataToArray(&g_cominfoarray);
  6794. CString SerialNo;
  6795. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6796. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  6797. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6798. CString sql;
  6799. sql.Format("update version set [serialno]='%s'", SerialNo);
  6800. g_sendhead.bsql=1;
  6801. g_nYearposTemp=g_nYearpos;
  6802. g_nYearpos=-1;
  6803. g_pMainWnd->ProcessChatMessageRequest2(sql);
  6804. g_nYearpos=g_nYearposTemp;
  6805. #endif
  6806. // 1.创建打印对象
  6807. CPrintRX m_Print;
  6808. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6809. {
  6810. m_Print.InitToPrint(NULL, 1);
  6811. }
  6812. else
  6813. {
  6814. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  6815. if (name.IsEmpty())
  6816. m_Print.InitToPrint(NULL, 1);
  6817. else
  6818. {
  6819. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6820. if (nret == -1 && aa == 0)
  6821. {
  6822. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6823. }
  6824. }
  6825. }
  6826. // 2.开始打印
  6827. m_Print.StartPrint();
  6828. m_Print.StartPage();
  6829. LoadRect load;
  6830. BOOL bSmall = 0;
  6831. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  6832. {
  6833. bSmall = 1;
  6834. load.SetLiaPath("20.lia");
  6835. }
  6836. else
  6837. load.SetLiaPath("10.lia");
  6838. if (bSmall)
  6839. load.SetMargins(0, 0);
  6840. else
  6841. load.SetMargins(10, 0);
  6842. if (!load.Load())return;
  6843. int rcpos = -1;
  6844. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6845. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  6846. {
  6847. Image *pImg = NULL;
  6848. g_nSendCode = 31;
  6849. int g_nYearposTemp = g_nYearpos;
  6850. g_nYearpos = -1;
  6851. g_pMainWnd->ProcessChatMessageRequest2(1);
  6852. g_nYearpos = g_nYearposTemp;
  6853. g_nSendCode = 0;
  6854. if (g_bSendOK == 0)return;
  6855. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  6856. if (pImg)
  6857. {
  6858. StrRect.left = 65;
  6859. if (bSmall) StrRect.left = 55;
  6860. StrRect.top = 10;
  6861. StrRect.right = StrRect.left + 58;
  6862. StrRect.bottom = StrRect.top + 58;
  6863. // 3.打印2维码图像;
  6864. m_Print.DrawImage(pImg, StrRect);
  6865. delete pImg;
  6866. pImg = NULL;
  6867. }
  6868. }
  6869. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  6870. if (bSmall)
  6871. {
  6872. m_Print.SetFontFace(18, 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_HCENTER | FORMAT_VCENTER);
  6875. m_Print.SetFontFace(9, 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_LEFT | FORMAT_VCENTER);
  6878. m_Print.SetFontFace(6, 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_HCENTER | FORMAT_VCENTER);
  6881. m_Print.SetFontFace(9, 1, "宋体");
  6882. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6883. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6884. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6885. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6886. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6887. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6888. int hei = StrRect.Height();
  6889. StrRect.bottom = StrRect.top;
  6890. StrRect.top -= 8;
  6891. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6892. m_Print.SetFontFace(11, 1, "宋体");
  6893. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6894. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6895. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6896. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6897. m_Print.SetFontFace(8, 1, "宋体");
  6898. for (i = 7; i < 24; i++)
  6899. {
  6900. StrRect = load.m_rcarray.ElementAt(i);
  6901. m_Print.DrawRect2(StrRect, 1);
  6902. }
  6903. for (i = 9; i < 24; i++)
  6904. {
  6905. StrRect = load.m_rcarray.ElementAt(i);
  6906. StrRect.left += 2;
  6907. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6908. }
  6909. m_Print.SetFontFace(6, 1, "宋体");
  6910. for (i = 24; i < 26; i++)
  6911. {
  6912. StrRect = load.m_rcarray.ElementAt(i);
  6913. StrRect.left += 2;
  6914. if (i == 24)
  6915. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6916. else
  6917. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6918. }
  6919. // StrRect=load.m_rcarray .ElementAt (27);
  6920. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  6921. }
  6922. else//大单
  6923. {
  6924. // 1.打印表头(蒙娜丽莎收款单)
  6925. m_Print.SetFontFace(20, 1, "黑体");
  6926. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6927. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6928. m_Print.SetFontFace(11, 1, "宋体");
  6929. // 2.打印订单号(NO.20140608-001)
  6930. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6931. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6932. // 3.打印SerialNo(SerialNo.01062)
  6933. int hei = StrRect.Height();
  6934. StrRect.bottom = StrRect.top;
  6935. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6936. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6937. // 4.打印影楼地址信息、电话;
  6938. m_Print.SetFontFace(8, 1, "宋体");
  6939. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6940. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6941. m_Print.SetFontFace(11, 1, "宋体");
  6942. // 5.打印客户姓名
  6943. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6944. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6945. // 6.打印客户联系电话
  6946. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6947. //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_LEFT | FORMAT_VCENTER);
  6949. // 7.打印开单日期
  6950. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6951. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6952. // 8.打印列字段:收款项目
  6953. m_Print.SetFontFace(13, 1, "宋体");
  6954. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6955. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6956. //printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6957. // 9.打印列字段:金额
  6958. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6959. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6960. //printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6961. // 10.打印列字段:开单人
  6962. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6963. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6964. //printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6965. // 11.画表格-画3列;
  6966. m_Print.SetFontFace(11, 1, "宋体");
  6967. for (i = 7; i < 10; i++)
  6968. {
  6969. StrRect = load.m_rcarray.ElementAt(i);
  6970. m_Print.DrawRect2(StrRect, 1);
  6971. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6972. }
  6973. // 12.打印详细内容
  6974. int dty = 0;
  6975. int dtytemp = 0;
  6976. // for( i=10; i<14; i+=3)
  6977. for (i = 10; i<22; i += 3) // 循环4次,再画
  6978. {
  6979. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  6980. CArray<CRect, CRect>rcarray;
  6981. CStringArray strarray2;
  6982. StrRect = load.m_rcarray.ElementAt(i);
  6983. StrRect.top += dty;
  6984. StrRect.bottom += dty;
  6985. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  6986. {
  6987. StrRect = load.m_rcarray.ElementAt(i - 1);
  6988. StrRect.top += dty;
  6989. StrRect.bottom += dty;
  6990. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  6991. break;
  6992. }
  6993. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  6994. StrRect.left += 2;
  6995. StrRect.right -= 2;
  6996. StrRect.top += 4;
  6997. rcarray.Add(StrRect);
  6998. strarray2.Add(pArray->ElementAt(i));
  6999. // 指定格子宽度,计算字符串占几行(高度).
  7000. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  7001. dtytemp = bottom - StrRect.bottom;
  7002. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7003. // 重新获取表格大小,并画出表格;
  7004. StrRect = load.m_rcarray.ElementAt(i);
  7005. StrRect.bottom += dtytemp;
  7006. StrRect.top += dty;
  7007. StrRect.bottom += dty;
  7008. m_Print.DrawRect2(StrRect, 1);
  7009. // 获取下一表格大小,并画出表格;
  7010. StrRect = load.m_rcarray.ElementAt(i + 1);
  7011. StrRect.top += dty;
  7012. StrRect.bottom += dty;
  7013. StrRect.bottom += dtytemp;
  7014. m_Print.DrawRect2(StrRect, 1);
  7015. StrRect.left += 2;
  7016. // 打印出金额字段内容
  7017. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7018. //printf("Jeff:%d:%s\n\n",i+1,pArray->ElementAt(i+1));//Jeff Printf;
  7019. StrRect = load.m_rcarray.ElementAt(i + 2);
  7020. StrRect.top += dty;
  7021. StrRect.bottom += dty;
  7022. StrRect.bottom += dtytemp;
  7023. m_Print.DrawRect2(StrRect, 1);
  7024. StrRect.left += 2;
  7025. // 打印开单人字段内容
  7026. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7027. //printf("Jeff:%d:%s\n\n",i+2,pArray->ElementAt(i+2));//Jeff Printf;
  7028. dty += dtytemp;
  7029. }
  7030. //.打印->付款情况 应付 实付 欠款.
  7031. i = 22;
  7032. StrRect = load.m_rcarray.ElementAt(i);
  7033. StrRect.top += dty;
  7034. StrRect.bottom += dty;
  7035. m_Print.DrawRect2(StrRect, 1);
  7036. StrRect.left += 2;
  7037. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7038. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7039. //.打印->合计人民币(大写):.......
  7040. i = 23;
  7041. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  7042. m_Print.DrawRect2(StrRect, 1);
  7043. StrRect.left += 2;
  7044. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7045. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7046. m_Print.SetFontFace(7, 1, "宋体");
  7047. for (i = 24; i < 27; i++)
  7048. {
  7049. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  7050. StrRect.left += 2;
  7051. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7052. }
  7053. StrRect = load.m_rcarray.ElementAt(24); StrRect.top += dty; StrRect.bottom += dty;
  7054. hei = StrRect.Height();
  7055. StrRect.top += hei;
  7056. StrRect.bottom += hei;
  7057. StrRect.right += 100;
  7058. StrRect.left += 2;
  7059. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  7060. AutoDraw(m_Print, StrRect, pArray->ElementAt(27), 1.0);
  7061. }
  7062. PrintPreview dlg;
  7063. dlg.m_mode = 3;
  7064. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  7065. dlg.m_pDC = m_Print.GetPDC();
  7066. if (aa == 0)
  7067. {
  7068. if (dlg.DoModal() != IDOK)
  7069. return;
  7070. printcot = dlg.m_num;
  7071. }
  7072. //结束打印
  7073. m_Print.EndPage();
  7074. m_Print.EndPrint();
  7075. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7076. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7077. CString sql;
  7078. sql.Format("update version set [serialno]='%s'", SerialNo);
  7079. g_sendhead.bsql = 1;
  7080. g_nYearposTemp = g_nYearpos;
  7081. g_nYearpos = -1;
  7082. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7083. g_nYearpos = g_nYearposTemp;
  7084. #endif
  7085. }
  7086. }
  7087. /************************************************************************/
  7088. /*
  7089. 函数:PrintRechargeRecord
  7090. 描述:打印会员卡充值记录;
  7091. 参数:
  7092. pArryRechargeRecod[IN]:要打印的数据;
  7093. 返回:
  7094. 注意:
  7095. 示例:
  7096. */
  7097. /************************************************************************/
  7098. void CMainFrame::PrintRechargeRecord(CStringArray *pArryRechargeRecod)
  7099. {
  7100. }
  7101. void CMainFrame::PrintReceipt_01(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  7102. {
  7103. //AfxMessageBox("abce");
  7104. int i = 0;
  7105. int printcot = 1;
  7106. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  7107. {
  7108. g_sendhead.bsql = 0;
  7109. g_sendhead.code[0] = 24;
  7110. g_sendhead.tabcount = 1;
  7111. int g_nYearposTemp = g_nYearpos;
  7112. g_nYearpos = -1;
  7113. g_pMainWnd->ProcessChatMessageRequest2(1);
  7114. g_nYearpos = g_nYearposTemp;
  7115. if (0 == g_bSendOK)return;
  7116. DataToArray(&g_cominfoarray);
  7117. CString SerialNo;
  7118. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7119. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7120. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7121. CString sql;
  7122. sql.Format("update version set [serialno]='%s'", SerialNo);
  7123. g_sendhead.bsql=1;
  7124. g_nYearposTemp=g_nYearpos;
  7125. g_nYearpos=-1;
  7126. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7127. g_nYearpos=g_nYearposTemp;
  7128. #endif
  7129. // 1.创建打印对象
  7130. CPrintRX m_Print;
  7131. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7132. {
  7133. m_Print.InitToPrint(NULL, 1);
  7134. }
  7135. else
  7136. {
  7137. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  7138. if (name.IsEmpty())
  7139. m_Print.InitToPrint(NULL, 1);
  7140. else
  7141. {
  7142. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  7143. if (nret == -1 && aa == 0)
  7144. {
  7145. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  7146. m_Print.InitToPrint(NULL, 1);
  7147. }
  7148. }
  7149. }
  7150. // 2.开始打印
  7151. m_Print.StartPrint();
  7152. m_Print.StartPage();
  7153. LoadRect load;
  7154. BOOL bSmall = 0;
  7155. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  7156. {
  7157. bSmall = 1;
  7158. load.SetLiaPath("20.lia");
  7159. }
  7160. else
  7161. load.SetLiaPath("10.lia");
  7162. if (bSmall)
  7163. load.SetMargins(0, 0);
  7164. else
  7165. load.SetMargins(10, 0);
  7166. if (!load.Load())return;
  7167. int rcpos = -1;
  7168. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7169. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  7170. {
  7171. Image *pImg = NULL;
  7172. g_nSendCode = 31;
  7173. int g_nYearposTemp = g_nYearpos;
  7174. g_nYearpos = -1;
  7175. g_pMainWnd->ProcessChatMessageRequest2(1);
  7176. g_nYearpos = g_nYearposTemp;
  7177. g_nSendCode = 0;
  7178. if (g_bSendOK == 0)return;
  7179. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7180. if (pImg)
  7181. {
  7182. StrRect.left = 65;
  7183. if (bSmall) StrRect.left = 55;
  7184. StrRect.top = 10;
  7185. StrRect.right = StrRect.left + 58;
  7186. StrRect.bottom = StrRect.top + 58;
  7187. // 3.打印2维码图像;
  7188. m_Print.DrawImage(pImg, StrRect);
  7189. delete pImg;
  7190. pImg = NULL;
  7191. }
  7192. }
  7193. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  7194. if (bSmall)
  7195. {
  7196. m_Print.SetFontFace(18, 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_HCENTER | FORMAT_VCENTER);
  7199. m_Print.SetFontFace(9, 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_LEFT | FORMAT_VCENTER);
  7202. m_Print.SetFontFace(6, 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_HCENTER | FORMAT_VCENTER);
  7205. m_Print.SetFontFace(9, 1, "宋体");
  7206. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7207. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7208. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7209. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7210. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7211. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7212. int hei = StrRect.Height();
  7213. StrRect.bottom = StrRect.top;
  7214. StrRect.top -= 8;
  7215. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7216. m_Print.SetFontFace(11, 1, "宋体");
  7217. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7218. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7219. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7220. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7221. m_Print.SetFontFace(8, 1, "宋体");
  7222. for ( i = 7; i < 24; i++)
  7223. {
  7224. StrRect = load.m_rcarray.ElementAt(i);
  7225. m_Print.DrawRect2(StrRect, 1);
  7226. }
  7227. for (i = 9; i < 24; i++)
  7228. {
  7229. StrRect = load.m_rcarray.ElementAt(i);
  7230. StrRect.left += 2;
  7231. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7232. }
  7233. m_Print.SetFontFace(6, 1, "宋体");
  7234. for (i = 24; i < 26; i++)
  7235. {
  7236. StrRect = load.m_rcarray.ElementAt(i);
  7237. StrRect.left += 2;
  7238. if (i == 24)
  7239. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7240. else
  7241. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7242. }
  7243. // StrRect=load.m_rcarray .ElementAt (27);
  7244. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  7245. }
  7246. else//大单
  7247. {
  7248. // 1.打印表头(蒙娜丽莎收款单)
  7249. m_Print.SetFontFace(20, 1, "黑体");
  7250. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7251. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7252. m_Print.SetFontFace(11, 1, "宋体");
  7253. // 2.打印订单号(NO.20140608-001)
  7254. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7255. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7256. // 3.打印SerialNo(SerialNo.01062)
  7257. int hei = StrRect.Height();
  7258. StrRect.bottom = StrRect.top;
  7259. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7260. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7261. // 4.打印影楼地址信息、电话;
  7262. m_Print.SetFontFace(8, 1, "宋体");
  7263. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7264. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7265. m_Print.SetFontFace(11, 1, "宋体");
  7266. // 5.打印客户姓名
  7267. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7268. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7269. // 6.打印客户联系电话
  7270. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7271. //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_LEFT | FORMAT_VCENTER);
  7273. // 7.打印开单日期
  7274. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7275. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7276. #if 0 // Original Edition
  7277. // 8.打印列字段:收款项目
  7278. m_Print.SetFontFace(13, 1, "宋体");
  7279. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7280. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7281. printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7282. // 9.打印列字段:金额
  7283. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7284. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7285. printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7286. // 10.打印列字段:开单人
  7287. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7288. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7289. printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7290. #else
  7291. // 8.打印列字段:收款项目
  7292. m_Print.SetFontFace(13, 1, "宋体");
  7293. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7294. StrRect = CRect(66, 85, 280, 105);
  7295. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7296. //m_Print.DrawText("收款项目",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7297. // 8.1 Jeff add:支付方式
  7298. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7299. StrRect = CRect(280, 85, 350, 105);
  7300. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7301. //m_Print.DrawText("支付方式",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7302. // 9.打印列字段:金额
  7303. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7304. StrRect = CRect(350, 85, 442, 105);
  7305. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7306. //m_Print.DrawText("金额",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7307. // 10.打印列字段:开单人
  7308. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7309. StrRect = CRect(442, 85, 535, 105);
  7310. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7311. //m_Print.DrawText("开单人",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7312. //rcpos += 3;
  7313. #endif
  7314. // 11.画表格-画3列;old
  7315. // 11.draw 4 column
  7316. m_Print.SetFontFace(11, 1, "宋体");
  7317. //for( i=7; i<10; i++)
  7318. //{
  7319. // StrRect=load.m_rcarray.ElementAt(i);
  7320. // m_Print.DrawRect2(StrRect, 1);
  7321. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7322. //}
  7323. m_Print.DrawRect2(CRect(66, 85, 280, 105), 1);
  7324. m_Print.DrawRect2(CRect(280, 85, 350, 105), 1);
  7325. m_Print.DrawRect2(CRect(350, 85, 442, 105), 1);
  7326. m_Print.DrawRect2(CRect(442, 85, 535, 105), 1);
  7327. // 12.打印详细内容
  7328. int dty = 0;
  7329. int dtytemp = 0;
  7330. // for( i=10; i<14; i+=3)
  7331. //for( i=10; i<22; i+=3) // 循环4次,再画
  7332. int j = 0;
  7333. for (i = 10, j = 11; i<22; i += 3, j += 4) // 循环4次,再画
  7334. {
  7335. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  7336. CArray<CRect, CRect>rcarray;
  7337. CStringArray strarray2;
  7338. StrRect = load.m_rcarray.ElementAt(i);
  7339. StrRect.top += dty;
  7340. StrRect.bottom += dty;
  7341. StrRect.right -= 70; // Jeff add
  7342. //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;
  7343. /*
  7344. 4次的CRect
  7345. 66,105,350,125
  7346. 66,126,350,146
  7347. 66,147,350,167
  7348. 66,168,350,188
  7349. */
  7350. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  7351. {
  7352. StrRect = load.m_rcarray.ElementAt(i - 1);
  7353. StrRect.top += dty;
  7354. StrRect.bottom += dty;
  7355. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  7356. break;
  7357. }
  7358. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  7359. StrRect.left += 2;
  7360. StrRect.right -= 2;
  7361. StrRect.top += 4;
  7362. rcarray.Add(StrRect);
  7363. //strarray2.Add(pArray->ElementAt(i+1));
  7364. strarray2.Add(pArray->ElementAt(j));
  7365. //printf("Jeff:%d:%s\n\n",j,pArray->ElementAt(j));//Jeff Printf;
  7366. // 指定格子宽度,计算字符串占几行(高度).
  7367. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  7368. dtytemp = bottom - StrRect.bottom;
  7369. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7370. // 重新获取表格大小,并画出表格;
  7371. /*
  7372. CRect(66,85,280,105),
  7373. CRect(280,85,350,105)
  7374. CRect(350,85,442,105)
  7375. CRect(442,85,535,105)
  7376. CRect(66,105,350,125),
  7377. CRect(66,126,350,146)
  7378. CRect(66,147,350,167)
  7379. CRect(66,168,350,188)
  7380. */
  7381. // 画收款项目框及打印内容;
  7382. StrRect = load.m_rcarray.ElementAt(i);
  7383. //StrRect=CRect(66,85,280,105);
  7384. StrRect.bottom += dtytemp;
  7385. StrRect.top += dty;
  7386. StrRect.bottom += dty;
  7387. //StrRect.left -= 70; // Jeff add
  7388. StrRect.right -= 70; // Jeff add
  7389. //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;
  7390. m_Print.DrawRect2(StrRect, 1);
  7391. // 画支付方式框及打印内容;
  7392. StrRect = load.m_rcarray.ElementAt(i);
  7393. //StrRect=CRect(280,85,350,105);
  7394. StrRect.bottom += dtytemp;
  7395. StrRect.top += dty;
  7396. StrRect.bottom += dty;
  7397. StrRect.left += StrRect.Width() - 70;
  7398. //StrRect.right += 70; // Jeff add
  7399. //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;
  7400. m_Print.DrawRect2(StrRect, 1);
  7401. StrRect.left += 2;
  7402. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7403. //printf("Jeff:%d:%s\n\n",j+1,pArray->ElementAt(j+1));//Jeff Printf;
  7404. // 画金额框及打印内容;
  7405. StrRect = load.m_rcarray.ElementAt(i + 1);
  7406. //StrRect=CRect(350,85,442,105);
  7407. StrRect.top += dty;
  7408. StrRect.bottom += dty;
  7409. StrRect.bottom += dtytemp;
  7410. //StrRect.right -= 70; // Jeff add
  7411. //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;
  7412. m_Print.DrawRect2(StrRect, 1);
  7413. StrRect.left += 2;
  7414. // 打印出金额字段内容
  7415. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7416. //printf("Jeff:%d:%s\n\n",j+2,pArray->ElementAt(j+2));//Jeff Printf;
  7417. // 画开单人框及打印内容;
  7418. StrRect = load.m_rcarray.ElementAt(i + 2);
  7419. //StrRect=CRect(442,85,535,105);
  7420. StrRect.top += dty;
  7421. StrRect.bottom += dty;
  7422. StrRect.bottom += dtytemp;
  7423. //StrRect.right -= 70; // Jeff add
  7424. //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;
  7425. m_Print.DrawRect2(StrRect, 1);
  7426. StrRect.left += 2;
  7427. // 打印开单人字段内容
  7428. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 3), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7429. //printf("Jeff:%d:%s\n\n",j+3,pArray->ElementAt(j+3));//Jeff Printf;
  7430. dty += dtytemp;
  7431. }
  7432. //.打印->付款情况 应付 实付 欠款.
  7433. i = 22;
  7434. j = 27;
  7435. StrRect = load.m_rcarray.ElementAt(i);
  7436. StrRect.top += dty;
  7437. StrRect.bottom += dty;
  7438. m_Print.DrawRect2(StrRect, 1);
  7439. StrRect.left += 2;
  7440. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7441. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7442. //.打印->合计人民币(大写):.......
  7443. i = 23;
  7444. j = 28;
  7445. StrRect = load.m_rcarray.ElementAt(i);
  7446. StrRect.top += dty;
  7447. StrRect.bottom += dty;
  7448. m_Print.DrawRect2(StrRect, 1);
  7449. StrRect.left += 2;
  7450. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7451. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7452. // 打印总金额;
  7453. m_Print.SetFontFace(7, 1, "宋体");
  7454. for (i = 24, j = 29; i < 27; i++, j++)
  7455. {
  7456. StrRect = load.m_rcarray.ElementAt(i);
  7457. StrRect.top += dty;
  7458. StrRect.bottom += dty;
  7459. StrRect.left += 2;
  7460. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7461. }
  7462. StrRect = load.m_rcarray.ElementAt(24);
  7463. StrRect.top += dty;
  7464. StrRect.bottom += dty;
  7465. hei = StrRect.Height();
  7466. StrRect.top += hei;
  7467. StrRect.bottom += hei;
  7468. StrRect.right += 100;
  7469. StrRect.left += 2;
  7470. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  7471. AutoDraw(m_Print, StrRect, pArray->ElementAt(32), 1.0);
  7472. }
  7473. PrintPreview dlg;
  7474. dlg.m_mode = 3;
  7475. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  7476. dlg.m_pDC = m_Print.GetPDC();
  7477. if (aa == 0)
  7478. {
  7479. if (dlg.DoModal() != IDOK)
  7480. {
  7481. return;
  7482. }
  7483. printcot = dlg.m_num;
  7484. }
  7485. //结束打印
  7486. m_Print.EndPage();
  7487. m_Print.EndPrint();
  7488. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7489. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7490. CString sql;
  7491. sql.Format("update version set [serialno]='%s'", SerialNo);
  7492. g_sendhead.bsql = 1;
  7493. g_nYearposTemp = g_nYearpos;
  7494. g_nYearpos = -1;
  7495. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7496. g_nYearpos = g_nYearposTemp;
  7497. #endif
  7498. }
  7499. }
  7500. void CMainFrame::PrintReceipt_02(CStringArray *pArray, CPrintRX *pPrinter, const int &nCount, const BOOL bPrintImmediately) // 打印订单*预约收款、预约补款*
  7501. {
  7502. //AfxMessageBox("abce");
  7503. int printcot = 1;
  7504. // for(int aa=0; aa<printcot; aa++) // Jeff, printcot=1....
  7505. // {
  7506. g_sendhead.bsql = 0;
  7507. g_sendhead.code[0] = 24;
  7508. g_sendhead.tabcount = 1;
  7509. int g_nYearposTemp = g_nYearpos;
  7510. g_nYearpos = -1;
  7511. g_pMainWnd->ProcessChatMessageRequest2(1);
  7512. g_nYearpos = g_nYearposTemp;
  7513. if (0 == g_bSendOK)return;
  7514. DataToArray(&g_cominfoarray);
  7515. CString SerialNo;
  7516. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7517. CPrintRX *tagPrinter = NULL;
  7518. if (pPrinter == NULL)
  7519. {
  7520. // 1.创建打印对象
  7521. tagPrinter = new CPrintRX;
  7522. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7523. {
  7524. tagPrinter->InitToPrint(NULL, 1);
  7525. }
  7526. else
  7527. {
  7528. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  7529. if (name.IsEmpty())
  7530. {
  7531. tagPrinter->InitToPrint(NULL, 1);
  7532. }
  7533. else
  7534. {
  7535. int nret = tagPrinter->InitToPrint((char*)(LPCTSTR)name, 1);
  7536. ///if(nret==-1 && aa==0)
  7537. if (nret == -1)
  7538. {
  7539. if (bPrintImmediately == FALSE)
  7540. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  7541. tagPrinter->InitToPrint(NULL, 1);
  7542. }
  7543. }
  7544. }
  7545. // 2.开始打印
  7546. tagPrinter->StartPrint();
  7547. tagPrinter->StartPage();
  7548. }
  7549. else
  7550. {
  7551. //SerialNo.Format ("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126))+1);
  7552. tagPrinter = pPrinter;
  7553. }
  7554. LoadRect load;
  7555. BOOL bSmall = 0;
  7556. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  7557. {
  7558. bSmall = 1;
  7559. load.SetLiaPath("20.lia");
  7560. }
  7561. else
  7562. load.SetLiaPath("10.lia");
  7563. if (bSmall)
  7564. load.SetMargins(0, 0);
  7565. else
  7566. load.SetMargins(10, 0);
  7567. if (!load.Load())return;
  7568. int rcpos = -1;
  7569. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7570. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  7571. {
  7572. Image *pImg = NULL;
  7573. g_nSendCode = 31;
  7574. int g_nYearposTemp = g_nYearpos;
  7575. g_nYearpos = -1;
  7576. g_pMainWnd->ProcessChatMessageRequest2(1);
  7577. g_nYearpos = g_nYearposTemp;
  7578. g_nSendCode = 0;
  7579. if (g_bSendOK == 0)return;
  7580. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7581. if (pImg)
  7582. {
  7583. StrRect.left = 65;
  7584. if (bSmall) StrRect.left = 55;
  7585. StrRect.top = 10;
  7586. StrRect.right = StrRect.left + 58;
  7587. StrRect.bottom = StrRect.top + 58;
  7588. // 3.打印2维码图像;
  7589. tagPrinter->DrawImage(pImg, StrRect);
  7590. delete pImg;
  7591. pImg = NULL;
  7592. }
  7593. }
  7594. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  7595. if (bSmall)
  7596. {
  7597. tagPrinter->SetFontFace(18, 1, "黑体");
  7598. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7599. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7600. tagPrinter->SetFontFace(9, 1, "宋体");
  7601. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7602. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7603. tagPrinter->SetFontFace(6, 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_HCENTER | FORMAT_VCENTER);
  7606. tagPrinter->SetFontFace(9, 1, "宋体");
  7607. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7608. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7609. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7610. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7611. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7612. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7613. int hei = StrRect.Height();
  7614. StrRect.bottom = StrRect.top;
  7615. StrRect.top -= 8;
  7616. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7617. tagPrinter->SetFontFace(11, 1, "宋体");
  7618. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7619. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7620. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7621. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7622. tagPrinter->SetFontFace(8, 1, "宋体");
  7623. int i = 0;
  7624. for (i = 7; i < 24; i++)
  7625. {
  7626. StrRect = load.m_rcarray.ElementAt(i);
  7627. tagPrinter->DrawRect2(StrRect, 1);
  7628. }
  7629. for (i = 9; i < 24; i++)
  7630. {
  7631. StrRect = load.m_rcarray.ElementAt(i);
  7632. StrRect.left += 2;
  7633. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7634. }
  7635. tagPrinter->SetFontFace(6, 1, "宋体");
  7636. for (i = 24; i < 26; i++)
  7637. {
  7638. StrRect = load.m_rcarray.ElementAt(i);
  7639. StrRect.left += 2;
  7640. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7641. }
  7642. StrRect = load.m_rcarray.ElementAt(22);
  7643. int nH = StrRect.Height();
  7644. int nW = StrRect.Width();
  7645. int nlen = load.m_rcarray.GetSize();
  7646. int nLeft = StrRect.left;
  7647. int j = 0;
  7648. for (i = 27; i<32; i++)
  7649. {
  7650. CRect rct = StrRect;
  7651. if(i == 31)
  7652. {
  7653. rct.top = rct.top + (nH*(j - 1));
  7654. rct.bottom = rct.top + nH;
  7655. rct.left = rct.left + 200;
  7656. rct.right = rct.left + 200;
  7657. }
  7658. else
  7659. {
  7660. rct.top = rct.top + (nH*j);
  7661. rct.bottom = rct.top + nH;
  7662. rct.left = rct.left + 2;
  7663. rct.right = rct.left + 200;
  7664. }
  7665. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), rct, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7666. j++;
  7667. }
  7668. }
  7669. else//大单
  7670. {
  7671. // 1.打印表头(蒙娜丽莎收款单)
  7672. tagPrinter->SetFontFace(20, 1, "黑体");
  7673. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7674. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7675. tagPrinter->SetFontFace(11, 1, "宋体");
  7676. // 2.打印订单号(NO.20140608-001)
  7677. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7678. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7679. // 3.打印SerialNo(SerialNo.01062)
  7680. int hei = StrRect.Height();
  7681. StrRect.bottom = StrRect.top;
  7682. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7683. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7684. // 4.打印影楼地址信息、电话;
  7685. tagPrinter->SetFontFace(8, 1, "宋体");
  7686. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7687. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7688. tagPrinter->SetFontFace(11, 1, "宋体");
  7689. // 5.打印客户姓名
  7690. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7691. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7692. // 6.打印客户联系电话
  7693. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7694. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7695. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7696. // 7.打印开单日期
  7697. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7698. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7699. #if 0 // Original Edition
  7700. // 8.打印列字段:收款项目
  7701. tagPrinter->SetFontFace(13, 1, "宋体");
  7702. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7703. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7704. printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7705. // 9.打印列字段:金额
  7706. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7707. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7708. printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7709. // 10.打印列字段:开单人
  7710. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7711. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7712. printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7713. #else
  7714. // 8.打印列字段:收款项目
  7715. tagPrinter->SetFontFace(13, 1, "宋体");
  7716. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7717. StrRect = CRect(66, 85, 280, 105);
  7718. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7719. //m_Print.DrawText("收款项目",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7720. // 8.1 Jeff add:支付方式
  7721. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7722. StrRect = CRect(280, 85, 350, 105);
  7723. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7724. //m_Print.DrawText("支付方式",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7725. // 9.打印列字段:金额
  7726. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7727. StrRect = CRect(350, 85, 442, 105);
  7728. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7729. //m_Print.DrawText("金额",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7730. // 10.打印列字段:开单人
  7731. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7732. StrRect = CRect(442, 85, 535, 105);
  7733. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7734. //m_Print.DrawText("开单人",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7735. //rcpos += 3;
  7736. #endif
  7737. // 11.画表格-画3列;old
  7738. // 11.draw 4 column
  7739. tagPrinter->SetFontFace(11, 1, "宋体");
  7740. int i;
  7741. //for( i=7; i<10; i++)
  7742. //{
  7743. // StrRect=load.m_rcarray.ElementAt(i);
  7744. // m_Print.DrawRect2(StrRect, 1);
  7745. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7746. //}
  7747. tagPrinter->DrawRect2(CRect(66, 85, 280, 105), 1);
  7748. tagPrinter->DrawRect2(CRect(280, 85, 350, 105), 1);
  7749. tagPrinter->DrawRect2(CRect(350, 85, 442, 105), 1);
  7750. tagPrinter->DrawRect2(CRect(442, 85, 535, 105), 1);
  7751. // 12.打印详细内容
  7752. int dty = 0;
  7753. int dtytemp = 0;
  7754. // for( i=10; i<14; i+=3)
  7755. //for( i=10; i<22; i+=3) // 循环4次,再画
  7756. int j = 0;
  7757. for (i = 10, j = 11; i<22; i += 3, j += 4) // 循环4次,再画
  7758. {
  7759. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  7760. CArray<CRect, CRect>rcarray;
  7761. CStringArray strarray2;
  7762. StrRect = load.m_rcarray.ElementAt(i);
  7763. StrRect.top += dty;
  7764. StrRect.bottom += dty;
  7765. StrRect.right -= 70; // Jeff add
  7766. //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;
  7767. /*
  7768. 4次的CRect
  7769. 66,105,350,125
  7770. 66,126,350,146
  7771. 66,147,350,167
  7772. 66,168,350,188
  7773. */
  7774. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  7775. {
  7776. StrRect = load.m_rcarray.ElementAt(i - 1);
  7777. StrRect.top += dty;
  7778. StrRect.bottom += dty;
  7779. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  7780. break;
  7781. }
  7782. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  7783. StrRect.left += 2;
  7784. StrRect.right -= 2;
  7785. StrRect.top += 4;
  7786. rcarray.Add(StrRect);
  7787. //strarray2.Add(pArray->ElementAt(i+1));
  7788. strarray2.Add(pArray->ElementAt(j));
  7789. //printf("Jeff:%d:%s\n\n",j,pArray->ElementAt(j));//Jeff Printf;
  7790. // 指定格子宽度,计算字符串占几行(高度).
  7791. INT bottom = CalcHeight(rcarray, strarray2, tagPrinter, FORMAT_LEFT);
  7792. dtytemp = bottom - StrRect.bottom;
  7793. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7794. // 重新获取表格大小,并画出表格;
  7795. /*
  7796. CRect(66,85,280,105),
  7797. CRect(280,85,350,105)
  7798. CRect(350,85,442,105)
  7799. CRect(442,85,535,105)
  7800. CRect(66,105,350,125),
  7801. CRect(66,126,350,146)
  7802. CRect(66,147,350,167)
  7803. CRect(66,168,350,188)
  7804. */
  7805. // 画收款项目框及打印内容;
  7806. StrRect = load.m_rcarray.ElementAt(i);
  7807. //StrRect=CRect(66,85,280,105);
  7808. StrRect.bottom += dtytemp;
  7809. StrRect.top += dty;
  7810. StrRect.bottom += dty;
  7811. //StrRect.left -= 70; // Jeff add
  7812. StrRect.right -= 70; // Jeff add
  7813. //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;
  7814. tagPrinter->DrawRect2(StrRect, 1);
  7815. // 画支付方式框及打印内容;
  7816. StrRect = load.m_rcarray.ElementAt(i);
  7817. //StrRect=CRect(280,85,350,105);
  7818. StrRect.bottom += dtytemp;
  7819. StrRect.top += dty;
  7820. StrRect.bottom += dty;
  7821. StrRect.left += StrRect.Width() - 70;
  7822. //StrRect.right += 70; // Jeff add
  7823. //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;
  7824. tagPrinter->DrawRect2(StrRect, 1);
  7825. StrRect.left += 2;
  7826. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7827. //printf("Jeff:%d:%s\n\n",j+1,pArray->ElementAt(j+1));//Jeff Printf;
  7828. // 画金额框及打印内容;
  7829. StrRect = load.m_rcarray.ElementAt(i + 1);
  7830. //StrRect=CRect(350,85,442,105);
  7831. StrRect.top += dty;
  7832. StrRect.bottom += dty;
  7833. StrRect.bottom += dtytemp;
  7834. //StrRect.right -= 70; // Jeff add
  7835. //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;
  7836. tagPrinter->DrawRect2(StrRect, 1);
  7837. StrRect.left += 2;
  7838. // 打印出金额字段内容
  7839. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7840. //printf("Jeff:%d:%s\n\n",j+2,pArray->ElementAt(j+2));//Jeff Printf;
  7841. // 画开单人框及打印内容;
  7842. StrRect = load.m_rcarray.ElementAt(i + 2);
  7843. //StrRect=CRect(442,85,535,105);
  7844. StrRect.top += dty;
  7845. StrRect.bottom += dty;
  7846. StrRect.bottom += dtytemp;
  7847. //StrRect.right -= 70; // Jeff add
  7848. //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;
  7849. tagPrinter->DrawRect2(StrRect, 1);
  7850. StrRect.left += 2;
  7851. // 打印开单人字段内容
  7852. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 3), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7853. //printf("Jeff:%d:%s\n\n",j+3,pArray->ElementAt(j+3));//Jeff Printf;
  7854. dty += dtytemp;
  7855. }
  7856. //.打印->付款情况 应付 实付 欠款.
  7857. i = 22;
  7858. j = 27;
  7859. StrRect = load.m_rcarray.ElementAt(i);
  7860. StrRect.top += dty;
  7861. StrRect.bottom += dty;
  7862. tagPrinter->DrawRect2(StrRect, 1);
  7863. StrRect.left += 2;
  7864. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7865. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7866. //.打印->合计人民币(大写):.......
  7867. i = 23;
  7868. j = 28;
  7869. StrRect = load.m_rcarray.ElementAt(i);
  7870. StrRect.top += dty;
  7871. StrRect.bottom += dty;
  7872. tagPrinter->DrawRect2(StrRect, 1);
  7873. StrRect.left += 2;
  7874. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7875. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7876. // 打印总金额;
  7877. tagPrinter->SetFontFace(7, 1, "宋体");
  7878. for (i = 24, j = 29; i < 27; i++, j++)
  7879. {
  7880. StrRect = load.m_rcarray.ElementAt(i);
  7881. StrRect.top += dty;
  7882. StrRect.bottom += dty;
  7883. StrRect.left += 2;
  7884. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7885. }
  7886. StrRect = load.m_rcarray.ElementAt(24);
  7887. StrRect.top += dty;
  7888. StrRect.bottom += dty;
  7889. hei = StrRect.Height();
  7890. StrRect.top += hei;
  7891. StrRect.bottom += hei;
  7892. StrRect.right += 100;
  7893. StrRect.left += 2;
  7894. StrRect = load.m_rcarray.ElementAt(27);
  7895. StrRect.top += dty;
  7896. StrRect.bottom += dty;
  7897. AutoDraw(*tagPrinter, StrRect, pArray->ElementAt(32), 1.0);
  7898. }
  7899. if (bPrintImmediately == TRUE)
  7900. {
  7901. printcot = nCount;
  7902. ////结束打印
  7903. tagPrinter->EndPage();
  7904. tagPrinter->EndPrint();
  7905. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7906. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7907. CString sql;
  7908. sql.Format("update version set [serialno]='%s'", SerialNo);
  7909. g_sendhead.bsql = 1;
  7910. g_nYearposTemp = g_nYearpos;
  7911. g_nYearpos = -1;
  7912. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7913. g_nYearpos = g_nYearposTemp;
  7914. #endif
  7915. }
  7916. else
  7917. {
  7918. PrintPreview dlg;
  7919. dlg.m_mode = 3;
  7920. tagPrinter->GetWidHei(dlg.m_w, dlg.m_h);
  7921. dlg.m_pDC = tagPrinter->GetPDC();
  7922. //if(aa==0)
  7923. //{
  7924. if (dlg.DoModal() != IDOK)
  7925. {
  7926. return;
  7927. }
  7928. else
  7929. {
  7930. printcot = dlg.m_num;
  7931. //m_Print.deletePrinter();
  7932. for (int i = 0; i < printcot; i++)
  7933. {
  7934. //tagPrinter->EndPage();
  7935. //tagPrinter->m_DC.AbortDoc(); // 结束清空由StartDoc写入的内容;2014-09-15;
  7936. //tagPrinter->m_DC.EndDoc();
  7937. //Sleep(10000);
  7938. //tagPrinter->StartPrint();
  7939. //tagPrinter->NewPage();
  7940. //PrintReceipt_02(pArray,/*tagPrinter*/NULL,printcot,TRUE);
  7941. PrintReceipt_02(pArray, tagPrinter, printcot, TRUE);
  7942. }
  7943. }
  7944. if (tagPrinter) delete tagPrinter;
  7945. //}
  7946. }
  7947. //}
  7948. }
  7949. void CMainFrame::PrintFlowChart(CString strOrderNumber) // 选片打单;
  7950. {
  7951. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(75)))
  7952. {
  7953. // Jeff 使用风格2打印;
  7954. //PrintFlowChart3_20151116(strOrderNumber);
  7955. PrintFlowChart3(strOrderNumber);
  7956. return;
  7957. }
  7958. #ifdef ZHIAI_VERSION
  7959. PrintFlowChart2(strOrderNumber);
  7960. return;
  7961. #endif
  7962. int i = 0;
  7963. int printcot = 1;
  7964. for (int aa = 0; aa < printcot; aa++)
  7965. {
  7966. CPrintRX m_Print;
  7967. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7968. {
  7969. m_Print.InitToPrint(NULL, 1);
  7970. }
  7971. else
  7972. {
  7973. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  7974. if (name.IsEmpty())
  7975. m_Print.InitToPrint(NULL, 1);
  7976. else
  7977. {
  7978. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  7979. if (nret == -1 && aa == 0)
  7980. {
  7981. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  7982. }
  7983. }
  7984. }
  7985. m_Print.StartPrint();
  7986. m_Print.StartPage();
  7987. // CRect StrRect(0,0,560,818);
  7988. LoadRect load;
  7989. load.SetLiaPath("4.lia");
  7990. load.SetMargins(-14, -14);
  7991. if (!load.Load())return;
  7992. LoadRect load2;
  7993. load2.SetMargins(-14, 472 + 27 - 14);
  7994. load2.SetLiaPath("5.lia");
  7995. if (!load2.Load())return;
  7996. //////////////////////////////////////////////////////////////
  7997. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2'";
  7998. g_sendhead.code[0] = 54;
  7999. g_sendhead.code[1] = 223;
  8000. g_sendhead.tabcount = 2;
  8001. g_sendhead.bsql = 0;
  8002. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  8003. CArray<CStringArray, CStringArray>sparray;
  8004. DataToArray(&g_List1array, &sparray);
  8005. CString spno;
  8006. for ( i = 0; i < sparray.GetSize(); i++)
  8007. {
  8008. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8009. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8010. if (sparray.ElementAt(i).ElementAt(5) == "入册" && sparray.ElementAt(i).ElementAt(5) == "入底" && sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8011. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8012. spno += sparray.ElementAt(i).ElementAt(5);
  8013. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  8014. spno += "; ";
  8015. else
  8016. {
  8017. spno += ":";
  8018. spno += sparray.ElementAt(i).ElementAt(6);
  8019. spno += "; ";
  8020. }
  8021. }
  8022. spno += " 加挑:";
  8023. for (i = 0; i < sparray.GetSize(); i++)
  8024. {
  8025. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8026. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8027. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8028. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8029. spno += sparray.ElementAt(i).ElementAt(5);
  8030. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  8031. spno += "; ";
  8032. else
  8033. {
  8034. spno += ":";
  8035. spno += sparray.ElementAt(i).ElementAt(6);
  8036. spno += "; ";
  8037. }
  8038. }
  8039. if (spno.Right(6) == " 加挑:")
  8040. {
  8041. spno = spno.Left(spno.GetLength() - 6);
  8042. }
  8043. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8044. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8045. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8046. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8047. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8048. if (m_urgent.IsEmpty())m_urgent = "否";
  8049. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8050. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8051. // CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  8052. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8053. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8054. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8055. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8056. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8057. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8058. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8059. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8060. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(17) + g_List1array.ElementAt(0).ElementAt(29);
  8061. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8062. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8063. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8064. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8065. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8066. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8067. CString m_sum3;
  8068. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8069. ::ConvertToPrice(m_sum3);
  8070. if (m_money3.IsEmpty())m_money3 = "0";
  8071. // m_money3=m_money3+"/"+m_sum3;
  8072. CString name;
  8073. if (!m_name1.IsEmpty())
  8074. name = m_name1 + ",";
  8075. name += m_name2;
  8076. name.TrimRight(",");
  8077. CString phone;
  8078. if (!m_phone1.IsEmpty())
  8079. phone = m_phone1 + ",";
  8080. phone += m_phone2; phone.TrimRight(",");
  8081. if (IsHasRights2new(31) == 0)
  8082. phone = "***";
  8083. CStringArray strarray;
  8084. strarray.Add(m_urgent);
  8085. strarray.Add(m_ren);
  8086. strarray.Add(m_waiter3);
  8087. strarray.Add(name);
  8088. strarray.Add(m_time2);
  8089. strarray.Add(m_time4);
  8090. strarray.Add(m_money3);
  8091. strarray.Add(m_sum3);
  8092. strarray.Add(m_takezs);
  8093. strarray.Add(m_taoxizs);
  8094. strarray.Add(m_choosezs);
  8095. strarray.Add(strOrderNumber);
  8096. strarray.Add(phone);
  8097. ////////////////////////////////////////////////////////////////
  8098. int rcpos = -1;
  8099. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8100. Image *pImg = NULL;
  8101. #ifdef MNLS_VERSION
  8102. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  8103. #else
  8104. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  8105. #endif
  8106. m_Print.DrawImage(pImg, StrRect);
  8107. delete pImg;
  8108. m_Print.SetFontFace(11, 1, "宋体");
  8109. StrRect = load2.m_rcarray.ElementAt(7);
  8110. StrRect.top = load2.m_rcarray.ElementAt(15).top - 15;
  8111. StrRect.bottom = load2.m_rcarray.ElementAt(15).bottom - 15;
  8112. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  8113. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8114. StrRect.top += 15;
  8115. StrRect.bottom += 15;
  8116. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  8117. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8118. m_Print.SetFontFace(15, 1, "宋体");
  8119. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8120. #ifdef MNLS_VERSION
  8121. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8122. #endif
  8123. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8124. #ifdef MNLS_VERSION
  8125. m_Print.DrawRect(StrRect);
  8126. #endif
  8127. m_Print.SetFontFace(7, 1, "黑体");
  8128. m_Print.SetColor(0xffffff);
  8129. #ifdef MNLS_VERSION
  8130. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8131. #endif
  8132. m_Print.SetColor(0);
  8133. m_Print.SetFontFace(25, 1, "黑体");
  8134. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8135. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8136. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  8137. {
  8138. Image *pImg = NULL;
  8139. g_nSendCode = 31;
  8140. int g_nYearposTemp = g_nYearpos;
  8141. g_nYearpos = -1;
  8142. g_pMainWnd->ProcessChatMessageRequest2(1);
  8143. g_nYearpos = g_nYearposTemp;
  8144. g_nSendCode = 0;
  8145. if (g_bSendOK == 0)return;
  8146. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8147. if (pImg)
  8148. {
  8149. StrRect.left = 450;
  8150. StrRect.top = 22;
  8151. StrRect.right = StrRect.left + 60;
  8152. StrRect.bottom = StrRect.top + 60;
  8153. m_Print.DrawImage(pImg, StrRect);
  8154. delete pImg; pImg = NULL;
  8155. }
  8156. }
  8157. #ifdef CHILD_VERSION
  8158. CString title[13] = { "是否加急:", "接单门市:", \
  8159. "选样人员:", "客人姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  8160. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:"
  8161. };
  8162. #else
  8163. CString title[13] = { "是否加急:", "接单门市:", \
  8164. "选样人员:", "新郎新娘姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  8165. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:" };
  8166. #endif
  8167. m_Print.SetFontFace(12, 1, "宋体");
  8168. for (i = 0; i < 13; i++)
  8169. {
  8170. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8171. if (i < 3)
  8172. m_Print.DrawRect2(StrRect, 0);
  8173. else
  8174. m_Print.DrawRect2(StrRect, 1);
  8175. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8176. }
  8177. for (i = 18; i <= 37; i++)
  8178. {
  8179. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8180. if (i >= 19 && i <= 21)
  8181. m_Print.DrawRect2(StrRect, 2);
  8182. /* else if(i==26)
  8183. {
  8184. CRect rc=StrRect;
  8185. CRect rc2=rc;
  8186. rc.right -=rc2.Width ()/2;
  8187. m_Print.DrawRect2(rc, 1);
  8188. rc2.left +=rc.Width ();
  8189. m_Print.DrawRect2(rc2, 1);
  8190. }*/
  8191. else
  8192. m_Print.DrawRect2(StrRect, 1);
  8193. if (i == 18)
  8194. {
  8195. StrRect.left += 5;
  8196. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8197. }
  8198. }
  8199. //////////////////////////////////////
  8200. rcpos = -1;
  8201. for (i = 0; i < 8; i++)
  8202. {
  8203. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8204. m_Print.DrawRect2(StrRect, 1);
  8205. }
  8206. #ifdef CHILD_VERSION
  8207. CString title2[4] = { "引导师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  8208. #else
  8209. CString title2[4] = { "化妆师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  8210. #endif
  8211. for (i = 0; i < 4; i++)
  8212. {
  8213. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8214. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8215. }
  8216. for (i = 0; i < 4; i++)
  8217. {
  8218. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8219. m_Print.DrawRect2(StrRect, 2);
  8220. }
  8221. StrRect = load2.m_rcarray.ElementAt(11);
  8222. StrRect.top -= 15;
  8223. StrRect.bottom -= 15;
  8224. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客选片签名:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8225. StrRect = load2.m_rcarray.ElementAt(15);
  8226. StrRect.top -= 15;
  8227. StrRect.bottom -= 15;
  8228. m_Print.DrawRect2(StrRect, 2);
  8229. ///////////////////////////////////////////
  8230. for (i = 19; i <= 31; i++)
  8231. {
  8232. StrRect = load.m_rcarray.ElementAt(i - 1);
  8233. StrRect.left += 4;
  8234. if (i == 31)
  8235. {
  8236. if (m_phone1.IsEmpty() == 0 && m_phone2.IsEmpty() == 0)
  8237. {
  8238. StrRect.top += 2;
  8239. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  8240. StrRect.top += 8;
  8241. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8242. }
  8243. else
  8244. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8245. }
  8246. /* else if((i-19)==7)
  8247. {
  8248. CRect rc=StrRect;
  8249. CRect rc2=rc;
  8250. rc.right -=rc2.Width ()/2;
  8251. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8252. rc2.left +=rc.Width ()+3;
  8253. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8254. }*/
  8255. else
  8256. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8257. }
  8258. strarray.RemoveAll();
  8259. strarray.Add(m_waiter2);
  8260. strarray.Add(m_waiter1);
  8261. strarray.Add(m_waiter4);
  8262. for (i = 13; i <= 15; i++)
  8263. {
  8264. StrRect = load2.m_rcarray.ElementAt(i - 1);
  8265. StrRect.left += 4;
  8266. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8267. }
  8268. ///////////spno
  8269. CRect sprc[14];
  8270. for (i = 0; i < 14; i++)
  8271. {
  8272. if (i < 7)
  8273. {
  8274. if (i == 0)
  8275. {
  8276. StrRect = load.m_rcarray.ElementAt(17); StrRect.left += 94; StrRect.right -= 3;
  8277. }
  8278. else
  8279. {
  8280. StrRect = load.m_rcarray.ElementAt(30 + i); StrRect.left += 4; StrRect.right -= 3;
  8281. }
  8282. }
  8283. else
  8284. {
  8285. StrRect = load2.m_rcarray.ElementAt(i - 7); StrRect.left += 4; StrRect.right -= 3;
  8286. }
  8287. sprc[i] = StrRect;
  8288. }
  8289. CString temp, tempspno, tempbz;
  8290. CSize size;
  8291. BOOL bRun = 0;
  8292. int fontsize = 12;
  8293. ll: tempspno = spno;
  8294. tempbz = m_bz;
  8295. m_Print.SetFontFace(fontsize, 1, "宋体");
  8296. for (i = 0; i<14; i++)
  8297. {
  8298. if (!tempspno.IsEmpty())
  8299. {
  8300. temp = tempspno;
  8301. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8302. int right = 0;
  8303. CRect temprc = sprc[i];
  8304. while (size.cx>temprc.Width())
  8305. {
  8306. right++;
  8307. temp = tempspno.Left(tempspno.GetLength() - (right));
  8308. if (GIsHalfHZ(temp))
  8309. {
  8310. right++;
  8311. temp.Delete(temp.GetLength() - 1);
  8312. }
  8313. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8314. }
  8315. if (bRun)
  8316. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8317. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  8318. if (tempspno.IsEmpty())i++;
  8319. }
  8320. else if (!tempbz.IsEmpty())
  8321. {
  8322. temp = tempbz;
  8323. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8324. int right = 0;
  8325. CRect temprc = sprc[i];
  8326. while (size.cx > temprc.Width())
  8327. {
  8328. right++;
  8329. temp = tempbz.Left(tempbz.GetLength() - (right));
  8330. if (GIsHalfHZ(temp))
  8331. {
  8332. right++;
  8333. temp.Delete(temp.GetLength() - 1);
  8334. }
  8335. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8336. }
  8337. if (bRun)
  8338. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8339. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  8340. }
  8341. }
  8342. if (tempspno.IsEmpty() == 0 || tempbz.IsEmpty() == 0)
  8343. {
  8344. fontsize--;
  8345. goto ll;
  8346. }
  8347. if (bRun == 0)
  8348. {
  8349. bRun = 1;
  8350. goto ll;
  8351. }
  8352. PrintPreview dlg;
  8353. dlg.m_mode = 2;
  8354. dlg.m_name = name;
  8355. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8356. dlg.m_pDC = m_Print.GetPDC();
  8357. if (aa == 0)
  8358. {
  8359. if (dlg.DoModal() != IDOK)
  8360. return;
  8361. printcot = dlg.m_num;
  8362. }
  8363. //结束打印
  8364. m_Print.EndPage();
  8365. m_Print.EndPrint();
  8366. }
  8367. }
  8368. void CMainFrame::PrintFlowChart3LKAY(CString strOrderNumber)
  8369. {
  8370. int i = 0;
  8371. int printcot = 1;
  8372. for (int aa = 0; aa < printcot; aa++)
  8373. {
  8374. CPrintRX m_Print;
  8375. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  8376. {
  8377. m_Print.InitToPrint(NULL, 1);
  8378. }
  8379. else
  8380. {
  8381. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  8382. if (name.IsEmpty())
  8383. m_Print.InitToPrint(NULL, 1);
  8384. else
  8385. {
  8386. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8387. if (nret == -1 && aa == 0)
  8388. {
  8389. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8390. }
  8391. }
  8392. }
  8393. m_Print.StartPrint();
  8394. m_Print.StartPage();
  8395. LoadRect load;
  8396. load.SetLiaPath("18.lia");
  8397. load.SetMargins(10, 0);
  8398. if (!load.Load())return;
  8399. CString str;
  8400. int rcpos = -1;
  8401. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8402. m_Print.SetFontFace(25, 1, "宋体");
  8403. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8404. m_Print.SetFontFace(15, 1, "宋体");
  8405. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8406. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8407. m_Print.SetFontFace(9, 1, "宋体");
  8408. //////////////////////////////////////////////////////////////
  8409. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8410. g_sendhead.code[0] = 54;
  8411. g_sendhead.code[1] = 223;
  8412. g_sendhead.code[2] = 52;
  8413. g_sendhead.tabcount = 3;
  8414. g_sendhead.bsql = 0;
  8415. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  8416. CArray<CStringArray, CStringArray>sparray;
  8417. CArray<CStringArray, CStringArray>clientarray;
  8418. DataToArray(&g_List1array, &sparray, &clientarray);
  8419. CString spno;
  8420. CStringArray sparray2;
  8421. for ( i = 0; i < sparray.GetSize(); i++)
  8422. {
  8423. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8424. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8425. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8426. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8427. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8428. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8429. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8430. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8431. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8432. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8433. }
  8434. for (i = 0; i < sparray.GetSize(); i++)
  8435. {
  8436. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8437. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8438. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8439. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8440. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8441. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8442. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8443. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8444. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8445. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8446. }
  8447. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8448. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8449. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8450. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8451. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8452. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8453. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8454. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8455. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8456. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8457. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8458. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8459. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8460. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8461. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8462. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8463. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8464. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8465. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8466. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8467. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8468. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8469. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8470. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8471. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8472. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8473. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8474. CString m_sum3;
  8475. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8476. ::ConvertToPrice(m_sum3);
  8477. if (m_money3.IsEmpty())m_money3 = "0";
  8478. int dty = 0;
  8479. CString name;
  8480. if (!m_name1.IsEmpty())
  8481. name = m_name1 + ",";
  8482. name += m_name2;
  8483. name.TrimRight(",");
  8484. CString phone;
  8485. if (!m_phone1.IsEmpty())
  8486. phone = m_phone1 + ",";
  8487. phone += m_phone2; phone.TrimRight(",");
  8488. if (IsHasRights2new(31) == 0)
  8489. phone = "***";
  8490. CStringArray strarray;
  8491. #ifdef CHILD_VERSION
  8492. if (m_birthday.IsEmpty())
  8493. strarray.Add("姓名/性别");
  8494. else
  8495. strarray.Add("姓名/性别/年龄");
  8496. #else
  8497. strarray.Add("客人姓名");
  8498. #endif
  8499. strarray.Add("电话");
  8500. strarray.Add("单号");
  8501. strarray.Add("套系");
  8502. strarray.Add("选样");
  8503. strarray.Add("余款/加挑");
  8504. strarray.Add("选片/日期");
  8505. #ifdef CHILD_VERSION
  8506. if (m_birthday.IsEmpty())
  8507. strarray.Add(name + "/" + m_sex);
  8508. else
  8509. {
  8510. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8511. m_birthday.Format("%d", year + 1);
  8512. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8513. }
  8514. #else
  8515. strarray.Add(name);
  8516. #endif
  8517. strarray.Add(phone);
  8518. strarray.Add(strOrderNumber);
  8519. strarray.Add(m_taoxiname);
  8520. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8521. strarray.Add(str);
  8522. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8523. strarray.Add(str);
  8524. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8525. for (i = 3; i <= 16; i++)
  8526. {
  8527. StrRect = load.m_rcarray.ElementAt(i - 1);
  8528. if (i < 10)
  8529. {
  8530. m_Print.DrawRect2(StrRect, 1);
  8531. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8532. }
  8533. }
  8534. StrRect = load.m_rcarray.ElementAt(29);
  8535. m_Print.DrawRect2(StrRect, 1);
  8536. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8537. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  8538. {
  8539. Image *pImg = NULL;
  8540. g_nSendCode = 31;
  8541. int g_nYearposTemp = g_nYearpos;
  8542. g_nYearpos = -1;
  8543. g_pMainWnd->ProcessChatMessageRequest2(1);
  8544. g_nYearpos = g_nYearposTemp;
  8545. g_nSendCode = 0;
  8546. if (g_bSendOK == 0)return;
  8547. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8548. if (pImg)
  8549. {
  8550. StrRect.left = 485;
  8551. StrRect.top = 12;
  8552. StrRect.right = StrRect.left + 60;
  8553. StrRect.bottom = StrRect.top + 60;
  8554. m_Print.DrawImage(pImg, StrRect);
  8555. delete pImg; pImg = NULL;
  8556. }
  8557. }
  8558. CArray<CRect, CRect>rcarray;
  8559. CStringArray strarray2;
  8560. for (i = 10; i <= 16; i++)
  8561. {
  8562. StrRect = load.m_rcarray.ElementAt(i - 1);
  8563. StrRect.left += 2;
  8564. StrRect.right -= 2;
  8565. StrRect.top += 2;
  8566. rcarray.Add(StrRect);
  8567. strarray2.Add(strarray.ElementAt(7 + i - 10));
  8568. }
  8569. if (1)
  8570. {
  8571. StrRect = load.m_rcarray.ElementAt(30);
  8572. StrRect.left += 2;
  8573. StrRect.right -= 2;
  8574. StrRect.top += 2;
  8575. rcarray.Add(StrRect);
  8576. strarray2.Add(m_time6 + "/" + m_time5);
  8577. }
  8578. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8579. for (i = 10; i <= 16; i++)
  8580. {
  8581. StrRect = load.m_rcarray.ElementAt(i - 1);
  8582. if (i == 10)
  8583. {
  8584. dty += bottom - StrRect.bottom;
  8585. }
  8586. StrRect.bottom = bottom;
  8587. m_Print.DrawRect2(StrRect, 1);
  8588. }
  8589. if (1)
  8590. {
  8591. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  8592. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  8593. // m_Print.DrawText((LPTSTR)(LPCTSTR)(m_time6+"/"+m_time5), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER );
  8594. }
  8595. m_Print.SetFontFace(15, 1, "宋体");
  8596. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  8597. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8598. m_Print.SetFontFace(9, 1, "宋体");
  8599. strarray.RemoveAll();
  8600. strarray.Add("产品名称");
  8601. strarray.Add("数量");
  8602. strarray.Add("P数");
  8603. strarray.Add("张数");
  8604. strarray.Add("照片编号");
  8605. CArray<CRect, CRect>rc2array;
  8606. int wid = 25;
  8607. for (i = 18; i <= 22; i++)
  8608. {
  8609. StrRect = load.m_rcarray.ElementAt(i - 1);
  8610. if (i == 19)
  8611. {
  8612. StrRect.right = StrRect.left + wid;
  8613. }
  8614. if (i == 20)
  8615. {
  8616. StrRect = load.m_rcarray.ElementAt(i - 2);
  8617. StrRect.left += wid; StrRect.right = StrRect.left;
  8618. StrRect.right += wid;
  8619. }
  8620. if (i == 21)
  8621. {
  8622. StrRect = load.m_rcarray.ElementAt(i - 3);
  8623. StrRect.left += wid * 2; StrRect.right = StrRect.left;
  8624. StrRect.right += wid;
  8625. wid = StrRect.right;
  8626. }
  8627. if (i == 22)
  8628. {
  8629. StrRect = load.m_rcarray.ElementAt(i - 3);
  8630. StrRect.left = wid;
  8631. }
  8632. StrRect.top += dty; StrRect.bottom += dty;
  8633. m_Print.DrawRect2(StrRect, 1);
  8634. StrRect.left += 2;
  8635. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8636. StrRect.left -= 2;
  8637. StrRect.top = StrRect.bottom;
  8638. StrRect.bottom += 18;
  8639. rc2array.Add(StrRect);
  8640. }
  8641. int curypos = 0;
  8642. for (i = 0; i < sparray2.GetSize(); i += 5)
  8643. {
  8644. rcarray.RemoveAll();
  8645. strarray2.RemoveAll();
  8646. int j = 0;
  8647. for ( j = 0; j < 5; j++)
  8648. {
  8649. StrRect = rc2array.ElementAt(j);
  8650. StrRect.left += 2;
  8651. StrRect.right -= 2;
  8652. StrRect.top += 2;
  8653. rcarray.Add(StrRect);
  8654. strarray2.Add(sparray2.ElementAt(i + j));
  8655. }
  8656. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8657. rcarray.RemoveAll();
  8658. for (j = 0; j < 5; j++)
  8659. {
  8660. StrRect = rc2array.ElementAt(j);
  8661. if (j == 0)
  8662. {
  8663. dty += bottom - StrRect.bottom;
  8664. }
  8665. StrRect.bottom = bottom;
  8666. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8667. StrRect.top = StrRect.bottom;
  8668. StrRect.bottom += 18;
  8669. rcarray.Add(StrRect);
  8670. }
  8671. rc2array.RemoveAll();
  8672. rc2array.Copy(rcarray);
  8673. }
  8674. m_Print.SetFontFace(15, 1, "宋体");
  8675. StrRect = load.m_rcarray.ElementAt(20);
  8676. dty = curypos - StrRect.bottom + 35;
  8677. StrRect.top += dty; StrRect.bottom += dty;
  8678. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8679. m_Print.SetFontFace(9, 1, "宋体");
  8680. rcarray.RemoveAll();
  8681. strarray2.RemoveAll();
  8682. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8683. StrRect.left += 2;
  8684. StrRect.right -= 2;
  8685. StrRect.top += 2;
  8686. rcarray.Add(StrRect);
  8687. strarray2.Add(m_bz);
  8688. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8689. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8690. dty += bottom - StrRect.bottom;
  8691. StrRect.bottom = bottom;
  8692. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8693. m_Print.SetFontFace(10, 1, "宋体");
  8694. StrRect = load.m_rcarray.ElementAt(22);
  8695. dty = curypos - StrRect.bottom + 25;
  8696. StrRect.top += dty; StrRect.bottom += dty;
  8697. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  8698. if (m_edit9.IsEmpty())
  8699. {
  8700. m_edit9 = "\
  8701. 经确认后的照片均排入制作流程,\r\n\
  8702. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  8703. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  8704. }
  8705. CString info1, info2, info3;
  8706. int newlinepos = m_edit9.Find("\r\n");
  8707. if (newlinepos != -1)
  8708. {
  8709. info1 = m_edit9.Left(newlinepos);
  8710. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8711. }
  8712. newlinepos = m_edit9.Find("\r\n");
  8713. if (newlinepos != -1)
  8714. {
  8715. info2 = m_edit9.Left(newlinepos);
  8716. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8717. info3 = m_edit9;
  8718. }
  8719. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8720. StrRect = load.m_rcarray.ElementAt(23);
  8721. StrRect.top += dty; StrRect.bottom += dty;
  8722. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8723. StrRect = load.m_rcarray.ElementAt(24);
  8724. StrRect.top += dty; StrRect.bottom += dty;
  8725. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8726. StrRect.top += 15;
  8727. StrRect.bottom += 15;
  8728. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8729. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  8730. StrRect = load.m_rcarray.ElementAt(25);
  8731. StrRect.top += dty - dy;
  8732. StrRect.bottom += dty - dy;
  8733. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8734. StrRect = load.m_rcarray.ElementAt(26);
  8735. StrRect.top += dty - dy;
  8736. StrRect.bottom += dty - dy;
  8737. m_Print.DrawRect2(StrRect, 2);
  8738. StrRect = load.m_rcarray.ElementAt(25);
  8739. StrRect.top += dty + 15 - dy;
  8740. StrRect.bottom += dty + 15 - dy;
  8741. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8742. StrRect = load.m_rcarray.ElementAt(26);
  8743. StrRect.top += dty + 15 - dy;
  8744. StrRect.bottom += dty + 15 - dy;
  8745. m_Print.DrawRect2(StrRect, 2);
  8746. StrRect = load.m_rcarray.ElementAt(25);
  8747. StrRect.top += dty + 15 * 2 - dy;
  8748. StrRect.bottom += dty + 15 * 2 - dy;
  8749. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8750. StrRect = load.m_rcarray.ElementAt(26);
  8751. StrRect.top += dty + 15 * 2 - dy;
  8752. StrRect.bottom += dty + 15 * 2 - dy;
  8753. m_Print.DrawRect2(StrRect, 2);
  8754. PrintPreview dlg; dlg.m_mode = 2;
  8755. dlg.m_name = name;
  8756. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8757. dlg.m_pDC = m_Print.GetPDC();
  8758. if (aa == 0)
  8759. {
  8760. if (dlg.DoModal() != IDOK)
  8761. return;
  8762. printcot = dlg.m_num;
  8763. }
  8764. //结束打印
  8765. m_Print.EndPage();
  8766. m_Print.EndPrint();
  8767. }
  8768. }
  8769. void CMainFrame::PrintFlowChart3(CString strOrderNumber) // 选片打单 风格2;
  8770. {
  8771. #ifdef LKAY_VERSION
  8772. PrintFlowChart3LKAY(strOrderNumber);
  8773. return;
  8774. #endif
  8775. int i = 0;
  8776. int j = 0;
  8777. int printcot = 1;
  8778. for (int aa = 0; aa < printcot; aa++)
  8779. {
  8780. BOOL bSecondPage = 0;
  8781. int nPrintedPos = 0;
  8782. for (int bb = 0; bb < 2; bb++)
  8783. {
  8784. if (bb && bSecondPage == 0)break;
  8785. CPrintRX m_Print;
  8786. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58))) // 58-[version].[setcheck1] ==1,使用默认打印机;
  8787. {
  8788. m_Print.InitToPrint(NULL, 1);
  8789. }
  8790. else // 否则使用指定的打印机;
  8791. {
  8792. CString name = g_cominfoarray.ElementAt(0).ElementAt(64); // 64-[version].[printer2] 制作单打印机;
  8793. if (name.IsEmpty())
  8794. m_Print.InitToPrint(NULL, 1);
  8795. else
  8796. {
  8797. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8798. if (nret == -1 && aa == 0)
  8799. {
  8800. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8801. }
  8802. }
  8803. }
  8804. m_Print.StartPrint();
  8805. m_Print.StartPage();
  8806. LoadRect load;
  8807. load.SetLiaPath("18.lia");
  8808. load.SetMargins(10, 0);
  8809. if (!load.Load())return;
  8810. CString str;
  8811. int rcpos = -1;
  8812. // ■■■■■■从18.lia获取到第一个区域大小 - 1.显示店名;
  8813. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8814. if ((bb == 0 && bSecondPage == 0))
  8815. {
  8816. m_Print.SetFontFace(25, 1, "宋体");
  8817. // 10-[version].[info1] 店名;
  8818. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8819. m_Print.SetFontFace(15, 1, "宋体");
  8820. // ■■■■■■从18.lia获取第二个区域大小 - 2.显示"基本资料";
  8821. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8822. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8823. m_Print.SetFontFace(9, 1, "宋体");
  8824. }
  8825. //////////////////////////////////////////////////////////////
  8826. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8827. g_sendhead.code[0] = 54; // dindan;
  8828. g_sendhead.code[1] = 223; // dindanspview2; shangpin+dindansp;
  8829. g_sendhead.code[2] = 52; // client;
  8830. g_sendhead.tabcount = 3;
  8831. g_sendhead.bsql = 0;
  8832. g_pMainWnd->ProcessChatMessageRequest2(filter);
  8833. if (g_bSendOK == 0)return;
  8834. CArray<CStringArray, CStringArray>sparray;
  8835. CArray<CStringArray, CStringArray>clientarray;
  8836. DataToArray(&g_List1array, &sparray, &clientarray);
  8837. CString spno;
  8838. CStringArray sparray2;
  8839. for ( i = 0; i < sparray.GetSize(); i++)
  8840. {
  8841. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8842. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8843. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8844. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8845. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8846. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8847. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8848. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8849. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8850. }
  8851. for (i = 0; i < sparray.GetSize(); i++)
  8852. {
  8853. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8854. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8855. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8856. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8857. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8858. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8859. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8860. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8861. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8862. }
  8863. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8864. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8865. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8866. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8867. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8868. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8869. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8870. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8871. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8872. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8873. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8874. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8875. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8876. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8877. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8878. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8879. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8880. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8881. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  8882. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8883. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8884. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8885. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8886. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8887. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8888. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8889. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8890. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8891. CString m_sum3;
  8892. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8893. ::ConvertToPrice(m_sum3);
  8894. if (m_money3.IsEmpty())m_money3 = "0";
  8895. int dty = 0;
  8896. CString name;
  8897. if (!m_name1.IsEmpty())
  8898. name = m_name1 + ",";
  8899. name += m_name2;
  8900. name.TrimRight(",");
  8901. CString phone;
  8902. if (!m_phone1.IsEmpty())
  8903. phone = m_phone1 + ",";
  8904. phone += m_phone2; phone.TrimRight(",");
  8905. if (IsHasRights2new(31) == 0)
  8906. phone = "***";
  8907. CStringArray strarray;
  8908. CArray<CRect, CRect>rcarray;
  8909. CStringArray strarray2; CArray<CRect, CRect>rc2array;
  8910. int bottom;
  8911. if ((bb == 0 && bSecondPage == 0))
  8912. {
  8913. #ifdef CHILD_VERSION
  8914. if (m_birthday.IsEmpty())
  8915. strarray.Add("姓名/性别");
  8916. else
  8917. strarray.Add("姓名/性别/年龄");
  8918. #else
  8919. strarray.Add("客人姓名"); // 第3.1区域 -3.显示客人姓名;
  8920. #endif
  8921. strarray.Add("电话");
  8922. strarray.Add("单号");
  8923. strarray.Add("套系");
  8924. strarray.Add("选样");
  8925. strarray.Add("余款/加挑");
  8926. strarray.Add("选片/日期");
  8927. #ifdef CHILD_VERSION
  8928. if (m_birthday.IsEmpty())
  8929. strarray.Add(name + "/" + m_sex);
  8930. else
  8931. {
  8932. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8933. m_birthday.Format("%d", year + 1);
  8934. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8935. }
  8936. #else
  8937. strarray.Add(name); // 第4.1区域 -3.显示客人姓名;
  8938. #endif
  8939. strarray.Add(phone);
  8940. strarray.Add(strOrderNumber);
  8941. strarray.Add(m_taoxiname);
  8942. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8943. strarray.Add(str);
  8944. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8945. strarray.Add(str);
  8946. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8947. for (i = 3; i <= 16; i++)
  8948. {
  8949. // ■■■■■■从18.lia中获取第3~16的区域大小;
  8950. StrRect = load.m_rcarray.ElementAt(i - 1);
  8951. if (i < 10)
  8952. {
  8953. m_Print.DrawRect2(StrRect, 1);
  8954. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8955. }
  8956. }
  8957. // ■■■■■■从18.lia中获取第30的区域大小;
  8958. StrRect = load.m_rcarray.ElementAt(29);
  8959. m_Print.DrawRect2(StrRect, 1);
  8960. BOOL bPrintDate = 1;
  8961. #ifdef DDF_VERSION
  8962. // bPrintDate=0;
  8963. #else
  8964. if (m_time5 == "" && m_time6 == "")
  8965. bPrintDate = 0;
  8966. #endif
  8967. if (bPrintDate)
  8968. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8969. else
  8970. {
  8971. #ifdef CHILD_VERSION
  8972. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/引导", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8973. #else
  8974. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/化妆", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8975. #endif
  8976. }
  8977. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138))) // [version].[reverse3]
  8978. {
  8979. Image *pImg = NULL;
  8980. g_nSendCode = 31;
  8981. int g_nYearposTemp = g_nYearpos;
  8982. g_nYearpos = -1;
  8983. g_pMainWnd->ProcessChatMessageRequest2(1);
  8984. g_nYearpos = g_nYearposTemp;
  8985. g_nSendCode = 0;
  8986. if (g_bSendOK == 0)return;
  8987. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8988. // Jeff二维码的区域不是从18.lia里获取的,是固定在右上角指定区域;
  8989. if (pImg)
  8990. {
  8991. StrRect.left = 485;
  8992. StrRect.top = 12;
  8993. StrRect.right = StrRect.left + 60;
  8994. StrRect.bottom = StrRect.top + 60;
  8995. m_Print.DrawImage(pImg, StrRect);
  8996. delete pImg; pImg = NULL;
  8997. }
  8998. }
  8999. // CArray<CRect,CRect>rcarray;
  9000. // CStringArray strarray2;
  9001. // ■■■■■■从18.lia中获取第10的区域大小;
  9002. for (i = 10; i <= 16; i++)
  9003. {
  9004. StrRect = load.m_rcarray.ElementAt(i - 1);
  9005. StrRect.left += 2;
  9006. StrRect.right -= 2;
  9007. StrRect.top += 2;
  9008. rcarray.Add(StrRect);
  9009. strarray2.Add(strarray.ElementAt(7 + i - 10));
  9010. }
  9011. if (1)
  9012. {
  9013. // ■■■■■■从18.lia中获取第31的区域大小;
  9014. StrRect = load.m_rcarray.ElementAt(30);
  9015. StrRect.left += 2;
  9016. StrRect.right -= 2;
  9017. StrRect.top += 2;
  9018. rcarray.Add(StrRect);
  9019. if (bPrintDate)
  9020. strarray2.Add(m_time6 + "/" + m_time5);
  9021. else
  9022. {
  9023. strarray2.Add(m_waiter1 + "/" + m_waiter2);
  9024. }
  9025. }
  9026. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  9027. for (i = 10; i <= 16; i++)
  9028. {
  9029. StrRect = load.m_rcarray.ElementAt(i - 1);
  9030. if (i == 10)
  9031. {
  9032. dty += bottom - StrRect.bottom;
  9033. }
  9034. StrRect.bottom = bottom;
  9035. m_Print.DrawRect2(StrRect, 1);
  9036. }
  9037. if (1)
  9038. {
  9039. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  9040. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  9041. }
  9042. m_Print.SetFontFace(15, 1, "宋体");
  9043. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  9044. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9045. }
  9046. int curypos = 0;
  9047. int oldpos = 0;
  9048. if (bb == 1)
  9049. {
  9050. dty = -100;
  9051. oldpos = nPrintedPos;
  9052. if (oldpos == 0)oldpos = 10000;
  9053. }
  9054. m_Print.SetFontFace(9, 1, "宋体");
  9055. strarray.RemoveAll();
  9056. if ((oldpos != 10000 && oldpos < sparray2.GetSize()) || bb == 0)
  9057. {
  9058. strarray.Add("产品名称");
  9059. strarray.Add("数量");
  9060. strarray.Add("照片编号");
  9061. for (i = 18; i <= 20; i++)
  9062. {
  9063. StrRect = load.m_rcarray.ElementAt(i - 1);
  9064. StrRect.top += dty;
  9065. StrRect.bottom += dty;
  9066. m_Print.DrawRect2(StrRect, 1);
  9067. StrRect.left += 2;
  9068. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9069. StrRect.left -= 2;
  9070. StrRect.top = StrRect.bottom;
  9071. StrRect.bottom += 18;
  9072. rc2array.Add(StrRect);
  9073. }
  9074. }
  9075. for (i = oldpos; i < sparray2.GetSize(); i += 3)
  9076. {
  9077. rcarray.RemoveAll();
  9078. strarray2.RemoveAll();
  9079. for ( j = 0; j < 3; j++)
  9080. {
  9081. StrRect = rc2array.ElementAt(j);
  9082. StrRect.left += 2;
  9083. StrRect.right -= 2;
  9084. StrRect.top += 2;
  9085. rcarray.Add(StrRect);
  9086. #if JEFF_TEST_ON
  9087. if (2 == j)
  9088. {
  9089. CString strImg = sparray2.ElementAt(i + 2);
  9090. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  9091. if (nImgCount != 0)
  9092. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  9093. else if (!strImg.IsEmpty())
  9094. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  9095. strarray2.Add(strImg);
  9096. }
  9097. else
  9098. strarray2.Add(sparray2.ElementAt(i + j));
  9099. #else
  9100. strarray2.Add(sparray2.ElementAt(i + j));
  9101. #endif
  9102. }
  9103. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9104. rcarray.RemoveAll();
  9105. for (j = 0; j < 3; j++)
  9106. {
  9107. StrRect = rc2array.ElementAt(j);
  9108. if (j == 0)
  9109. {
  9110. dty += bottom - StrRect.bottom;
  9111. }
  9112. StrRect.bottom = bottom;
  9113. m_Print.DrawRect2(StrRect, 1);
  9114. curypos = StrRect.bottom;
  9115. StrRect.top = StrRect.bottom;
  9116. StrRect.bottom += 18;
  9117. rcarray.Add(StrRect);
  9118. }
  9119. rc2array.RemoveAll();
  9120. rc2array.Copy(rcarray);
  9121. if (bottom > 750)
  9122. {
  9123. bSecondPage = 1;
  9124. nPrintedPos = i + 3;
  9125. break;
  9126. }
  9127. }
  9128. if ((bb == 0 && bSecondPage == 0) || (bb == 1 && bSecondPage == 1))
  9129. {
  9130. m_Print.SetFontFace(15, 1, "宋体");
  9131. StrRect = load.m_rcarray.ElementAt(20);
  9132. dty = curypos - StrRect.bottom + 35;
  9133. StrRect.top += dty;
  9134. StrRect.bottom += dty;
  9135. if (StrRect.bottom > 700 && bb == 0)
  9136. {
  9137. bSecondPage = 1;
  9138. }
  9139. else
  9140. {
  9141. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9142. m_Print.SetFontFace(9, 1, "宋体");
  9143. rcarray.RemoveAll();
  9144. strarray2.RemoveAll();
  9145. StrRect = load.m_rcarray.ElementAt(21);
  9146. StrRect.top += dty;
  9147. StrRect.bottom += dty;
  9148. StrRect.left += 2;
  9149. StrRect.right -= 2;
  9150. StrRect.top += 2;
  9151. rcarray.Add(StrRect);
  9152. #if JEFF_TEST_ON
  9153. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9154. strarray2.RemoveAll();
  9155. CString strFind = "要求:";
  9156. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  9157. do
  9158. {
  9159. int nIndex = strbz3.Find(strFind, 1);
  9160. if (nIndex != -1)
  9161. {
  9162. CString strbz = strbz3.Left(nIndex);
  9163. strbz3 = strbz3.Mid(nIndex);
  9164. strarray2.Add(strbz);
  9165. }
  9166. else
  9167. {
  9168. strarray2.Add(strbz3);
  9169. strbz3 = "";
  9170. }
  9171. } while (strbz3.Find(strFind) != -1);
  9172. strarray2.Add(g_List1array.ElementAt(0).ElementAt(29));
  9173. strarray2.Add(g_List1array.ElementAt(0).ElementAt(23));
  9174. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  9175. #else
  9176. strarray2.Add(m_bz);
  9177. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9178. #endif
  9179. StrRect = load.m_rcarray.ElementAt(21);
  9180. StrRect.top += dty;
  9181. StrRect.bottom += dty;
  9182. dty += bottom - StrRect.bottom;
  9183. StrRect.bottom = bottom;
  9184. m_Print.DrawRect2(StrRect, 1);
  9185. curypos = StrRect.bottom;
  9186. m_Print.SetFontFace(10, 1, "宋体");
  9187. StrRect = load.m_rcarray.ElementAt(22);
  9188. dty = curypos - StrRect.bottom + 25;
  9189. StrRect.top += dty;
  9190. StrRect.bottom += dty;
  9191. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  9192. if (m_edit9.IsEmpty())
  9193. {
  9194. m_edit9 = "\
  9195. 经确认后的照片均排入制作流程,\r\n\
  9196. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9197. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9198. }
  9199. CString info1, info2, info3;
  9200. int newlinepos = m_edit9.Find("\r\n");
  9201. if (newlinepos != -1)
  9202. {
  9203. info1 = m_edit9.Left(newlinepos);
  9204. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9205. }
  9206. newlinepos = m_edit9.Find("\r\n");
  9207. if (newlinepos != -1)
  9208. {
  9209. info2 = m_edit9.Left(newlinepos);
  9210. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9211. info3 = m_edit9;
  9212. }
  9213. #ifdef QCH_VERSION
  9214. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9215. StrRect = load.m_rcarray.ElementAt(23);
  9216. StrRect.top += dty; StrRect.bottom += dty;
  9217. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9218. StrRect=load.m_rcarray .ElementAt (24);
  9219. StrRect.top +=dty;StrRect.bottom +=dty;
  9220. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9221. StrRect.top +=15;
  9222. StrRect.bottom +=15;
  9223. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9224. #else
  9225. if (1)
  9226. {
  9227. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9228. StrRect = load.m_rcarray.ElementAt(23);
  9229. StrRect.top += dty; StrRect.bottom += dty;
  9230. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9231. StrRect = load.m_rcarray.ElementAt(24);
  9232. StrRect.top += dty; StrRect.bottom += dty;
  9233. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9234. }
  9235. else
  9236. {
  9237. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9238. StrRect = load.m_rcarray.ElementAt(23);
  9239. StrRect.top += dty; StrRect.bottom += dty;
  9240. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9241. StrRect = load.m_rcarray.ElementAt(24);
  9242. StrRect.top += dty; StrRect.bottom += dty;
  9243. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9244. }
  9245. StrRect.top += 15;
  9246. StrRect.bottom += 15;
  9247. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9248. #endif
  9249. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  9250. StrRect = load.m_rcarray.ElementAt(25);
  9251. StrRect.top += dty - dy;
  9252. StrRect.bottom += dty - dy;
  9253. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9254. StrRect = load.m_rcarray.ElementAt(26);
  9255. StrRect.top += dty - dy;
  9256. StrRect.bottom += dty - dy;
  9257. m_Print.DrawRect2(StrRect, 2);
  9258. StrRect = load.m_rcarray.ElementAt(25);
  9259. StrRect.top += dty + 15 - dy;
  9260. StrRect.bottom += dty + 15 - dy;
  9261. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9262. StrRect = load.m_rcarray.ElementAt(26);
  9263. StrRect.top += dty + 15 - dy;
  9264. StrRect.bottom += dty + 15 - dy;
  9265. m_Print.DrawRect2(StrRect, 2);
  9266. StrRect = load.m_rcarray.ElementAt(25);
  9267. StrRect.top += dty + 15 * 2 - dy;
  9268. StrRect.bottom += dty + 15 * 2 - dy;
  9269. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9270. StrRect = load.m_rcarray.ElementAt(26);
  9271. StrRect.top += dty + 15 * 2 - dy;
  9272. StrRect.bottom += dty + 15 * 2 - dy;
  9273. m_Print.DrawRect2(StrRect, 2);
  9274. }
  9275. }
  9276. PrintPreview dlg; dlg.m_mode = 2;
  9277. dlg.m_name = name;
  9278. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  9279. dlg.m_pDC = m_Print.GetPDC();
  9280. if (aa == 0)
  9281. {
  9282. if (dlg.DoModal() != IDOK)
  9283. return;
  9284. printcot = dlg.m_num;
  9285. }
  9286. //结束打印
  9287. m_Print.EndPage();
  9288. m_Print.EndPrint();
  9289. }
  9290. }
  9291. }
  9292. void CMainFrame::PrintFlowChart3_20151116(CString strOrderNumber) // 选片打单 风格2;
  9293. {
  9294. #ifdef LKAY_VERSION
  9295. PrintFlowChart3LKAY(strOrderNumber);
  9296. return;
  9297. #endif
  9298. int i = 0;
  9299. int j = 0;
  9300. int printcot = 1;
  9301. for (int aa = 0; aa < printcot; aa++)
  9302. {
  9303. BOOL bSecondPage = 0;
  9304. int nPrintedPos = 0;
  9305. for (int bb = 0; bb < 3; bb++)
  9306. {
  9307. if (bb && bSecondPage == 0)break;
  9308. CPrintRX m_Print;
  9309. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58))) // 58-[version].[setcheck1] ==1,使用默认打印机;
  9310. {
  9311. m_Print.InitToPrint(NULL, 1);
  9312. }
  9313. else // 否则使用指定的打印机;
  9314. {
  9315. CString name = g_cominfoarray.ElementAt(0).ElementAt(64); // 64-[version].[printer2] 制作单打印机;
  9316. if (name.IsEmpty())
  9317. m_Print.InitToPrint(NULL, 1);
  9318. else
  9319. {
  9320. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9321. if (nret == -1 && aa == 0)
  9322. {
  9323. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9324. }
  9325. }
  9326. }
  9327. m_Print.StartPrint();
  9328. m_Print.StartPage();
  9329. LoadRect load;
  9330. load.SetLiaPath("18.lia");
  9331. load.SetMargins(10, 0);
  9332. if (!load.Load())return;
  9333. CString str;
  9334. int rcpos = -1;
  9335. // ■■■■■■从18.lia获取到第一个区域大小 - 1.显示店名;
  9336. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  9337. if ((bb == 0 && bSecondPage == 0))
  9338. {
  9339. m_Print.SetFontFace(25, 1, "宋体");
  9340. // 10-[version].[info1] 店名;
  9341. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9342. m_Print.SetFontFace(15, 1, "宋体");
  9343. // ■■■■■■从18.lia获取第二个区域大小 - 2.显示"基本资料";
  9344. StrRect = load.m_rcarray.ElementAt(++rcpos);
  9345. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9346. m_Print.SetFontFace(9, 1, "宋体");
  9347. }
  9348. //////////////////////////////////////////////////////////////////////////
  9349. // 获取打印所需要的数据,并布局好;
  9350. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  9351. g_sendhead.code[0] = 54; // dindan;
  9352. g_sendhead.code[1] = 223; // dindanspview2; shangpin+dindansp;
  9353. g_sendhead.code[2] = 52; // client;
  9354. g_sendhead.tabcount = 3;
  9355. g_sendhead.bsql = 0;
  9356. g_pMainWnd->ProcessChatMessageRequest2(filter);
  9357. if (g_bSendOK == 0)return;
  9358. CArray<CStringArray, CStringArray>sparray;
  9359. CArray<CStringArray, CStringArray>clientarray;
  9360. DataToArray(&g_List1array, &sparray, &clientarray);
  9361. CString spno;
  9362. CStringArray sparray2;
  9363. for ( i = 0; i < sparray.GetSize(); i++)
  9364. {
  9365. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  9366. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  9367. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  9368. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9369. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  9370. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9371. sparray2.Add(sparray.ElementAt(i).ElementAt(5)); // 商品名称;
  9372. sparray2.Add(sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  9373. sparray2.Add(sparray.ElementAt(i).ElementAt(6)); // 选中的相片串;
  9374. sparray2.Add(sparray.ElementAt(i).ElementAt(10)); // 商品备注;
  9375. }
  9376. for (i = 0; i < sparray.GetSize(); i++)
  9377. {
  9378. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  9379. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  9380. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  9381. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9382. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  9383. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9384. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+"); // 商品名称;
  9385. sparray2.Add(sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  9386. sparray2.Add(sparray.ElementAt(i).ElementAt(6)); // 选中的相片串;
  9387. sparray2.Add(sparray.ElementAt(i).ElementAt(10)); // 商品备注;
  9388. }
  9389. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  9390. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  9391. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  9392. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  9393. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  9394. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  9395. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  9396. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  9397. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  9398. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  9399. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  9400. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  9401. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  9402. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  9403. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  9404. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  9405. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  9406. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  9407. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9408. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  9409. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  9410. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  9411. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  9412. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  9413. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  9414. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  9415. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  9416. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  9417. CString m_sum3;
  9418. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  9419. ::ConvertToPrice(m_sum3);
  9420. if (m_money3.IsEmpty())m_money3 = "0";
  9421. int dty = 0;
  9422. CString name;
  9423. if (!m_name1.IsEmpty())
  9424. name = m_name1 + ",";
  9425. name += m_name2;
  9426. name.TrimRight(",");
  9427. CString phone;
  9428. if (!m_phone1.IsEmpty())
  9429. phone = m_phone1 + ",";
  9430. phone += m_phone2; phone.TrimRight(",");
  9431. if (IsHasRights2new(31) == 0)
  9432. phone = "***";
  9433. CStringArray strarray;
  9434. CArray<CRect, CRect>rcarray;
  9435. CStringArray strarray2; CArray<CRect, CRect>rc2array;
  9436. int bottom;
  9437. //////////////////////////////////////////////////////////////////////////
  9438. // 开始画打印DC;
  9439. if ((bb == 0 && bSecondPage == 0))
  9440. {
  9441. #ifdef CHILD_VERSION
  9442. if (m_birthday.IsEmpty())
  9443. strarray.Add("姓名/性别");
  9444. else
  9445. strarray.Add("姓名/性别/年龄");
  9446. #else
  9447. strarray.Add("客人姓名"); // 第3.1区域 -3.显示客人姓名;
  9448. #endif
  9449. strarray.Add("电话");
  9450. strarray.Add("单号");
  9451. strarray.Add("套系");
  9452. strarray.Add("选样");
  9453. strarray.Add("余款/加挑");
  9454. strarray.Add("选片/日期");
  9455. #ifdef CHILD_VERSION
  9456. if (m_birthday.IsEmpty())
  9457. strarray.Add(name + "/" + m_sex);
  9458. else
  9459. {
  9460. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  9461. m_birthday.Format("%d", year + 1);
  9462. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  9463. }
  9464. #else
  9465. strarray.Add(name); // 第4.1区域 -3.显示客人姓名;
  9466. #endif
  9467. strarray.Add(phone);
  9468. strarray.Add(strOrderNumber);
  9469. strarray.Add(m_taoxiname);
  9470. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9471. strarray.Add(str);
  9472. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  9473. strarray.Add(str);
  9474. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  9475. for (i = 3; i <= 16; i++)
  9476. {
  9477. // ■■■■■■从18.lia中获取第3~16的区域大小;
  9478. StrRect = load.m_rcarray.ElementAt(i - 1);
  9479. if (i < 10)
  9480. {
  9481. m_Print.DrawRect2(StrRect, 1);
  9482. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9483. }
  9484. }
  9485. // ■■■■■■从18.lia中获取第30的区域大小;
  9486. StrRect = load.m_rcarray.ElementAt(29);
  9487. m_Print.DrawRect2(StrRect, 1);
  9488. BOOL bPrintDate = 1;
  9489. #ifdef DDF_VERSION
  9490. // bPrintDate=0;
  9491. #else
  9492. if (m_time5 == "" && m_time6 == "")
  9493. bPrintDate = 0;
  9494. #endif
  9495. if (bPrintDate)
  9496. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9497. else
  9498. {
  9499. #ifdef CHILD_VERSION
  9500. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/引导", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9501. #else
  9502. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/化妆", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9503. #endif
  9504. }
  9505. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138))) // [version].[reverse3]
  9506. {
  9507. Image *pImg = NULL;
  9508. g_nSendCode = 31;
  9509. int g_nYearposTemp = g_nYearpos;
  9510. g_nYearpos = -1;
  9511. g_pMainWnd->ProcessChatMessageRequest2(1);
  9512. g_nYearpos = g_nYearposTemp;
  9513. g_nSendCode = 0;
  9514. if (g_bSendOK == 0)return;
  9515. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  9516. // Jeff二维码的区域不是从18.lia里获取的,是固定在右上角指定区域;
  9517. if (pImg)
  9518. {
  9519. StrRect.left = 485;
  9520. StrRect.top = 12;
  9521. StrRect.right = StrRect.left + 60;
  9522. StrRect.bottom = StrRect.top + 60;
  9523. m_Print.DrawImage(pImg, StrRect);
  9524. delete pImg; pImg = NULL;
  9525. }
  9526. }
  9527. // CArray<CRect,CRect>rcarray;
  9528. // CStringArray strarray2;
  9529. // ■■■■■■从18.lia中获取第10的区域大小;
  9530. for (i = 10; i <= 16; i++)
  9531. {
  9532. StrRect = load.m_rcarray.ElementAt(i - 1);
  9533. StrRect.left += 2;
  9534. StrRect.right -= 2;
  9535. StrRect.top += 2;
  9536. rcarray.Add(StrRect);
  9537. strarray2.Add(strarray.ElementAt(7 + i - 10));
  9538. }
  9539. if (1)
  9540. {
  9541. // ■■■■■■从18.lia中获取第31的区域大小;
  9542. StrRect = load.m_rcarray.ElementAt(30);
  9543. StrRect.left += 2;
  9544. StrRect.right -= 2;
  9545. StrRect.top += 2;
  9546. rcarray.Add(StrRect);
  9547. if (bPrintDate)
  9548. strarray2.Add(m_time6 + "/" + m_time5);
  9549. else
  9550. {
  9551. strarray2.Add(m_waiter1 + "/" + m_waiter2);
  9552. }
  9553. }
  9554. int bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  9555. for (i = 10; i <= 16; i++)
  9556. {
  9557. StrRect = load.m_rcarray.ElementAt(i - 1);
  9558. if (i == 10)
  9559. {
  9560. dty += bottom - StrRect.bottom;
  9561. }
  9562. StrRect.bottom = bottom;
  9563. m_Print.DrawRect2(StrRect, 1);
  9564. }
  9565. if (1)
  9566. {
  9567. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  9568. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  9569. }
  9570. m_Print.SetFontFace(15, 1, "宋体");
  9571. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  9572. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9573. }
  9574. int curypos = 0;
  9575. int oldpos = 0;
  9576. if (bb == 1)
  9577. {
  9578. dty = -100;
  9579. oldpos = nPrintedPos;
  9580. if (oldpos == 0)oldpos = 10000;
  9581. }
  9582. m_Print.SetFontFace(9, 1, "宋体");
  9583. strarray.RemoveAll();
  9584. if ((oldpos != 10000 && oldpos < sparray2.GetSize()) || bb == 0)
  9585. {
  9586. strarray.Add("产品名称");
  9587. strarray.Add("数量");
  9588. strarray.Add("照片编号");
  9589. strarray.Add(_T("备注"));
  9590. CRect mycr[4] = {
  9591. CRect(39,172,130,189), // 产品名称;
  9592. CRect(130,172,157,189), // 产品数量;
  9593. CRect(157,172,407,189), // 相片;
  9594. CRect(407,172,546,189) // 备注;
  9595. };
  9596. for (i = 0; i <= 3; i++)
  9597. {
  9598. StrRect = mycr[i];
  9599. StrRect.top += dty;
  9600. StrRect.bottom += dty;
  9601. m_Print.DrawRect2(StrRect, 1);
  9602. StrRect.left += 2;
  9603. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9604. StrRect.left -= 2;
  9605. StrRect.top = StrRect.bottom;
  9606. StrRect.bottom += 18;
  9607. rc2array.Add(StrRect);
  9608. }
  9609. }
  9610. for (i = oldpos; i < sparray2.GetSize(); i += 4)
  9611. {
  9612. rcarray.RemoveAll();
  9613. strarray2.RemoveAll();
  9614. for ( j = 0; j < 4; j++)
  9615. {
  9616. StrRect = rc2array.ElementAt(j);
  9617. StrRect.left += 2;
  9618. StrRect.right -= 2;
  9619. StrRect.top += 2;
  9620. rcarray.Add(StrRect);
  9621. #if JEFF_TEST_ON
  9622. if (2 == j)
  9623. {
  9624. CString strImg = sparray2.ElementAt(i + 2);
  9625. //int nImgCount = strImg.Replace(",", ",");
  9626. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  9627. if (nImgCount != 0)
  9628. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  9629. else if (!strImg.IsEmpty())
  9630. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  9631. strarray2.Add(strImg);
  9632. }
  9633. else
  9634. strarray2.Add(sparray2.ElementAt(i + j));
  9635. #else
  9636. strarray2.Add(sparray2.ElementAt(i + j));
  9637. #endif
  9638. }
  9639. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9640. rcarray.RemoveAll();
  9641. for (j = 0; j < 4; j++)
  9642. {
  9643. StrRect = rc2array.ElementAt(j);
  9644. if (j == 0)
  9645. {
  9646. dty += bottom - StrRect.bottom;
  9647. }
  9648. StrRect.bottom = bottom;
  9649. m_Print.DrawRect2(StrRect, 1);
  9650. curypos = StrRect.bottom;
  9651. StrRect.top = StrRect.bottom;
  9652. StrRect.bottom += 18;
  9653. rcarray.Add(StrRect);
  9654. }
  9655. rc2array.RemoveAll();
  9656. rc2array.Copy(rcarray);
  9657. if (bottom > 750)
  9658. {
  9659. bSecondPage = 1;
  9660. nPrintedPos = i + 3;
  9661. break;
  9662. }
  9663. }
  9664. if ((bb == 0 && bSecondPage == 0) || (bb == 1 && bSecondPage == 1))
  9665. {
  9666. m_Print.SetFontFace(15, 1, "宋体");
  9667. StrRect = load.m_rcarray.ElementAt(20);
  9668. dty = curypos - StrRect.bottom + 35;
  9669. StrRect.top += dty;
  9670. StrRect.bottom += dty;
  9671. if (StrRect.bottom > 700 && bb == 0)
  9672. {
  9673. bSecondPage = 1;
  9674. }
  9675. else
  9676. {
  9677. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9678. m_Print.SetFontFace(9, 1, "宋体");
  9679. rcarray.RemoveAll();
  9680. strarray2.RemoveAll();
  9681. StrRect = load.m_rcarray.ElementAt(21);
  9682. StrRect.top += dty;
  9683. StrRect.bottom += dty;
  9684. StrRect.left += 2;
  9685. StrRect.right -= 2;
  9686. StrRect.top += 2;
  9687. rcarray.Add(StrRect);
  9688. #if JEFF_TEST_ON
  9689. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9690. strarray2.RemoveAll();
  9691. CString strFind = "要求:";
  9692. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  9693. do
  9694. {
  9695. int nIndex = strbz3.Find(strFind, 1);
  9696. if (nIndex != -1)
  9697. {
  9698. CString strbz = strbz3.Left(nIndex);
  9699. strbz3 = strbz3.Mid(nIndex);
  9700. strarray2.Add(strbz);
  9701. }
  9702. else
  9703. {
  9704. strarray2.Add(strbz3);
  9705. strbz3 = "";
  9706. }
  9707. } while (strbz3.Find(strFind) != -1);
  9708. strarray2.Add(g_List1array.ElementAt(0).ElementAt(29));
  9709. strarray2.Add(g_List1array.ElementAt(0).ElementAt(23));
  9710. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  9711. #else
  9712. strarray2.Add(m_bz);
  9713. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9714. #endif
  9715. StrRect = load.m_rcarray.ElementAt(21);
  9716. StrRect.top += dty;
  9717. StrRect.bottom += dty;
  9718. dty += bottom - StrRect.bottom;
  9719. StrRect.bottom = bottom;
  9720. m_Print.DrawRect2(StrRect, 1);
  9721. curypos = StrRect.bottom;
  9722. m_Print.SetFontFace(10, 1, "宋体");
  9723. StrRect = load.m_rcarray.ElementAt(22);
  9724. dty = curypos - StrRect.bottom + 25;
  9725. StrRect.top += dty;
  9726. StrRect.bottom += dty;
  9727. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  9728. if (m_edit9.IsEmpty())
  9729. {
  9730. m_edit9 = "\
  9731. 经确认后的照片均排入制作流程,\r\n\
  9732. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9733. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9734. }
  9735. CString info1, info2, info3;
  9736. int newlinepos = m_edit9.Find("\r\n");
  9737. if (newlinepos != -1)
  9738. {
  9739. info1 = m_edit9.Left(newlinepos);
  9740. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9741. }
  9742. newlinepos = m_edit9.Find("\r\n");
  9743. if (newlinepos != -1)
  9744. {
  9745. info2 = m_edit9.Left(newlinepos);
  9746. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9747. info3 = m_edit9;
  9748. }
  9749. #ifdef QCH_VERSION
  9750. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9751. StrRect = load.m_rcarray.ElementAt(23);
  9752. StrRect.top += dty; StrRect.bottom += dty;
  9753. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9754. StrRect=load.m_rcarray .ElementAt (24);
  9755. StrRect.top +=dty;StrRect.bottom +=dty;
  9756. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9757. StrRect.top +=15;
  9758. StrRect.bottom +=15;
  9759. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9760. #else
  9761. if (1)
  9762. {
  9763. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9764. StrRect = load.m_rcarray.ElementAt(23);
  9765. StrRect.top += dty; StrRect.bottom += dty;
  9766. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9767. StrRect = load.m_rcarray.ElementAt(24);
  9768. StrRect.top += dty; StrRect.bottom += dty;
  9769. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9770. }
  9771. else
  9772. {
  9773. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9774. StrRect = load.m_rcarray.ElementAt(23);
  9775. StrRect.top += dty; StrRect.bottom += dty;
  9776. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9777. StrRect = load.m_rcarray.ElementAt(24);
  9778. StrRect.top += dty; StrRect.bottom += dty;
  9779. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9780. }
  9781. StrRect.top += 15;
  9782. StrRect.bottom += 15;
  9783. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9784. #endif
  9785. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  9786. StrRect = load.m_rcarray.ElementAt(25);
  9787. StrRect.top += dty - dy;
  9788. StrRect.bottom += dty - dy;
  9789. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9790. StrRect = load.m_rcarray.ElementAt(26);
  9791. StrRect.top += dty - dy;
  9792. StrRect.bottom += dty - dy;
  9793. m_Print.DrawRect2(StrRect, 2);
  9794. StrRect = load.m_rcarray.ElementAt(25);
  9795. StrRect.top += dty + 15 - dy;
  9796. StrRect.bottom += dty + 15 - dy;
  9797. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9798. StrRect = load.m_rcarray.ElementAt(26);
  9799. StrRect.top += dty + 15 - dy;
  9800. StrRect.bottom += dty + 15 - dy;
  9801. m_Print.DrawRect2(StrRect, 2);
  9802. StrRect = load.m_rcarray.ElementAt(25);
  9803. StrRect.top += dty + 15 * 2 - dy;
  9804. StrRect.bottom += dty + 15 * 2 - dy;
  9805. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9806. StrRect = load.m_rcarray.ElementAt(26);
  9807. StrRect.top += dty + 15 * 2 - dy;
  9808. StrRect.bottom += dty + 15 * 2 - dy;
  9809. m_Print.DrawRect2(StrRect, 2);
  9810. }
  9811. }
  9812. PrintPreview dlg; dlg.m_mode = 2;
  9813. dlg.m_name = name;
  9814. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  9815. dlg.m_pDC = m_Print.GetPDC();
  9816. if (aa == 0)
  9817. {
  9818. if (dlg.DoModal() != IDOK)
  9819. return;
  9820. printcot = dlg.m_num;
  9821. }
  9822. //结束打印
  9823. m_Print.EndPage();
  9824. m_Print.EndPrint();
  9825. }
  9826. }
  9827. }
  9828. //void CMainFrame::PrintFlowChart4(CString m_id) // 选设计打单函数;
  9829. void CMainFrame::PrintFlowChart4(CString strOrderNumber) // 选设计打单函数,使用18.lia文件;
  9830. {
  9831. int i = 0;
  9832. int j = 0;
  9833. int printcot = 1;
  9834. for (int aa = 0; aa < printcot; aa++)
  9835. {
  9836. CPrintRX m_Print;
  9837. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  9838. {
  9839. m_Print.InitToPrint(NULL, 1);
  9840. }
  9841. else
  9842. {
  9843. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  9844. if (name.IsEmpty())
  9845. m_Print.InitToPrint(NULL, 1);
  9846. else
  9847. {
  9848. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9849. if (nret == -1 && aa == 0)
  9850. {
  9851. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9852. }
  9853. }
  9854. }
  9855. m_Print.StartPrint();
  9856. m_Print.StartPage();
  9857. LoadRect load;
  9858. load.SetLiaPath("18.lia");
  9859. load.SetMargins(10, 0);
  9860. if (!load.Load())return;
  9861. CString str;
  9862. int rcpos = -1;
  9863. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  9864. m_Print.SetFontFace(25, 1, "宋体");
  9865. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9866. m_Print.SetFontFace(15, 1, "宋体");
  9867. StrRect = load.m_rcarray.ElementAt(++rcpos);
  9868. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9869. m_Print.SetFontFace(9, 1, "宋体");
  9870. //////////////////////////////////////////////////////////////
  9871. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  9872. g_sendhead.code[0] = 54;
  9873. g_sendhead.code[1] = 223;
  9874. g_sendhead.code[2] = 52;
  9875. g_sendhead.tabcount = 3;
  9876. g_sendhead.bsql = 0;
  9877. g_pMainWnd->ProcessChatMessageRequest2(filter);
  9878. if (g_bSendOK == 0)return;
  9879. CArray<CStringArray, CStringArray>sparray;
  9880. CArray<CStringArray, CStringArray>clientarray;
  9881. DataToArray(&g_List1array, &sparray, &clientarray);
  9882. CString spno;
  9883. CStringArray sparray2;
  9884. for ( i = 0; i < sparray.GetSize(); i++)
  9885. {
  9886. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  9887. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(8).IsEmpty())continue;
  9888. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9889. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9890. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  9891. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9892. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9893. }
  9894. for (i = 0; i < sparray.GetSize(); i++)
  9895. {
  9896. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  9897. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  9898. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  9899. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9900. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9901. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  9902. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9903. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9904. }
  9905. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  9906. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  9907. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  9908. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  9909. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  9910. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  9911. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  9912. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  9913. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  9914. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  9915. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  9916. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  9917. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  9918. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  9919. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  9920. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  9921. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  9922. CString m_bz = g_List1array.ElementAt(0).ElementAt(17);
  9923. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(25);
  9924. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  9925. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  9926. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  9927. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  9928. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  9929. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  9930. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  9931. CString m_waiter8 = g_List1array.ElementAt(0).ElementAt(27);
  9932. CString m_replace = g_List1array.ElementAt(0).ElementAt(28);
  9933. if (!m_replace.IsEmpty())
  9934. {
  9935. m_replace = "设计替换照片:" + m_replace;
  9936. m_replace.Replace("$", ";");
  9937. m_replace.TrimLeft(";");
  9938. m_bz += ";";
  9939. m_bz += m_replace;
  9940. }
  9941. CString m_sum3;
  9942. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  9943. ::ConvertToPrice(m_sum3);
  9944. if (m_money3.IsEmpty())m_money3 = "0";
  9945. int dty = 0;
  9946. CString name;
  9947. if (!m_name1.IsEmpty())
  9948. name = m_name1 + ",";
  9949. name += m_name2;
  9950. name.TrimRight(",");
  9951. CString phone;
  9952. if (!m_phone1.IsEmpty())
  9953. phone = m_phone1 + ",";
  9954. phone += m_phone2; phone.TrimRight(",");
  9955. if (IsHasRights2new(31) == 0)
  9956. phone = "***";
  9957. CStringArray strarray;
  9958. #ifdef CHILD_VERSION
  9959. if (m_birthday.IsEmpty())
  9960. strarray.Add("姓名/性别");
  9961. else
  9962. strarray.Add("姓名/性别/年龄");
  9963. #else
  9964. strarray.Add("客人姓名");
  9965. #endif
  9966. strarray.Add("电话");
  9967. strarray.Add("单号");
  9968. strarray.Add("套系");
  9969. strarray.Add("");
  9970. strarray.Add("余款/加挑");
  9971. strarray.Add("看设计/日期");
  9972. #ifdef CHILD_VERSION
  9973. if (m_birthday.IsEmpty())
  9974. strarray.Add(name + "/" + m_sex);
  9975. else
  9976. {
  9977. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  9978. m_birthday.Format("%d", year + 1);
  9979. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  9980. }
  9981. #else
  9982. strarray.Add(name);
  9983. #endif
  9984. strarray.Add(phone);
  9985. strarray.Add(strOrderNumber);
  9986. strarray.Add(m_taoxiname);
  9987. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9988. strarray.Add("");
  9989. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  9990. strarray.Add(str);
  9991. strarray.Add(m_waiter8 + "/" + m_time6);
  9992. //////////////////////////////////////////////
  9993. if (1)
  9994. {
  9995. StrRect = load.m_rcarray.ElementAt(6);
  9996. int addwid = StrRect.Width() / 6;
  9997. for (i = 3; i <= 6; i++)
  9998. {
  9999. StrRect = load.m_rcarray.ElementAt(i - 1);
  10000. StrRect.left += (i - 3)*addwid;
  10001. StrRect.right += (i - 2)*addwid;
  10002. load.m_rcarray.SetAt(i - 1, StrRect);
  10003. }
  10004. StrRect.left = StrRect.right = -1;
  10005. load.m_rcarray.SetAt(6, StrRect);
  10006. for (i = 10; i <= 13; i++)
  10007. {
  10008. StrRect = load.m_rcarray.ElementAt(i - 1);
  10009. StrRect.left += (i - 10)*addwid;
  10010. StrRect.right += (i - 9)*addwid;
  10011. load.m_rcarray.SetAt(i - 1, StrRect);
  10012. }
  10013. StrRect.left = StrRect.right = -1;
  10014. load.m_rcarray.SetAt(13, StrRect);
  10015. StrRect = load.m_rcarray.ElementAt(7);
  10016. int rcwid = StrRect.Width();
  10017. StrRect.left = load.m_rcarray.ElementAt(5).right;
  10018. StrRect.right = StrRect.left + rcwid + addwid;
  10019. load.m_rcarray.SetAt(7, StrRect);
  10020. StrRect = load.m_rcarray.ElementAt(8);
  10021. StrRect.left = load.m_rcarray.ElementAt(7).right;
  10022. StrRect.right = load.m_rcarray.ElementAt(29).left;
  10023. load.m_rcarray.SetAt(8, StrRect);
  10024. StrRect = load.m_rcarray.ElementAt(14);
  10025. rcwid = StrRect.Width();
  10026. StrRect.left = load.m_rcarray.ElementAt(12).right;
  10027. StrRect.right = StrRect.left + rcwid + addwid;
  10028. load.m_rcarray.SetAt(14, StrRect);
  10029. StrRect = load.m_rcarray.ElementAt(15);
  10030. StrRect.left = load.m_rcarray.ElementAt(14).right;
  10031. StrRect.right = load.m_rcarray.ElementAt(29).left;
  10032. load.m_rcarray.SetAt(15, StrRect);
  10033. }
  10034. ////////////////////////////////////////////////
  10035. for (i = 3; i <= 16; i++)
  10036. {
  10037. StrRect = load.m_rcarray.ElementAt(i - 1);
  10038. if (i < 10)
  10039. {
  10040. m_Print.DrawRect2(StrRect, 1);
  10041. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10042. }
  10043. }
  10044. StrRect = load.m_rcarray.ElementAt(29);
  10045. m_Print.DrawRect2(StrRect, 1);
  10046. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10047. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  10048. {
  10049. Image *pImg = NULL;
  10050. g_nSendCode = 31;
  10051. int g_nYearposTemp = g_nYearpos;
  10052. g_nYearpos = -1;
  10053. g_pMainWnd->ProcessChatMessageRequest2(1);
  10054. g_nYearpos = g_nYearposTemp;
  10055. g_nSendCode = 0;
  10056. if (g_bSendOK == 0)return;
  10057. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  10058. if (pImg)
  10059. {
  10060. StrRect.left = 485;
  10061. StrRect.top = 12;
  10062. StrRect.right = StrRect.left + 60;
  10063. StrRect.bottom = StrRect.top + 60;
  10064. m_Print.DrawImage(pImg, StrRect);
  10065. delete pImg; pImg = NULL;
  10066. }
  10067. }
  10068. CArray<CRect, CRect>rcarray;
  10069. CStringArray strarray2;
  10070. for (i = 10; i <= 16; i++)
  10071. {
  10072. StrRect = load.m_rcarray.ElementAt(i - 1);
  10073. StrRect.left += 2;
  10074. StrRect.right -= 2;
  10075. StrRect.top += 2;
  10076. rcarray.Add(StrRect);
  10077. strarray2.Add(strarray.ElementAt(7 + i - 10));
  10078. }
  10079. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  10080. for (i = 10; i <= 16; i++)
  10081. {
  10082. StrRect = load.m_rcarray.ElementAt(i - 1);
  10083. if (i == 10)
  10084. {
  10085. dty += bottom - StrRect.bottom;
  10086. }
  10087. StrRect.bottom = bottom;
  10088. m_Print.DrawRect2(StrRect, 1);
  10089. }
  10090. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  10091. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  10092. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time5, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  10093. m_Print.SetFontFace(15, 1, "宋体");
  10094. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  10095. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10096. m_Print.SetFontFace(9, 1, "宋体");
  10097. strarray.RemoveAll();
  10098. strarray.Add("产品名称");
  10099. strarray.Add("数量");
  10100. strarray.Add("照片编号");
  10101. CArray<CRect, CRect>rc2array;
  10102. for (i = 18; i <= 20; i++)
  10103. {
  10104. StrRect = load.m_rcarray.ElementAt(i - 1); StrRect.top += dty; StrRect.bottom += dty;
  10105. m_Print.DrawRect2(StrRect, 1);
  10106. StrRect.left += 2;
  10107. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10108. StrRect.left -= 2;
  10109. StrRect.top = StrRect.bottom;
  10110. StrRect.bottom += 18;
  10111. rc2array.Add(StrRect);
  10112. }
  10113. int curypos = 0;
  10114. for (i = 0; i < sparray2.GetSize(); i += 3)
  10115. {
  10116. rcarray.RemoveAll();
  10117. strarray2.RemoveAll();
  10118. for ( j = 0; j < 3; j++)
  10119. {
  10120. StrRect = rc2array.ElementAt(j);
  10121. StrRect.left += 2;
  10122. StrRect.right -= 2;
  10123. StrRect.top += 2;
  10124. rcarray.Add(StrRect);
  10125. #if JEFF_TEST_ON
  10126. if (2 == j)
  10127. {
  10128. CString strImg = sparray2.ElementAt(i + 2);
  10129. //int nImgCount = strImg.Replace(",", ",");
  10130. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  10131. if (nImgCount != 0)
  10132. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  10133. else if (!strImg.IsEmpty())
  10134. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  10135. strarray2.Add(strImg);
  10136. }
  10137. else
  10138. strarray2.Add(sparray2.ElementAt(i + j));
  10139. #else
  10140. strarray2.Add(sparray2.ElementAt(i + j));
  10141. #endif
  10142. }
  10143. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  10144. rcarray.RemoveAll();
  10145. for (j = 0; j < 3; j++)
  10146. {
  10147. StrRect = rc2array.ElementAt(j);
  10148. if (j == 0)
  10149. {
  10150. dty += bottom - StrRect.bottom;
  10151. }
  10152. StrRect.bottom = bottom;
  10153. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  10154. StrRect.top = StrRect.bottom;
  10155. StrRect.bottom += 18;
  10156. rcarray.Add(StrRect);
  10157. }
  10158. rc2array.RemoveAll();
  10159. rc2array.Copy(rcarray);
  10160. }
  10161. m_Print.SetFontFace(15, 1, "宋体");
  10162. StrRect = load.m_rcarray.ElementAt(20);
  10163. dty = curypos - StrRect.bottom + 35;
  10164. StrRect.top += dty; StrRect.bottom += dty;
  10165. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10166. m_Print.SetFontFace(9, 1, "宋体");
  10167. rcarray.RemoveAll();
  10168. strarray2.RemoveAll();
  10169. StrRect = load.m_rcarray.ElementAt(21);
  10170. StrRect.top += dty;
  10171. StrRect.bottom += dty;
  10172. StrRect.left += 2;
  10173. StrRect.right -= 2;
  10174. StrRect.top += 2;
  10175. rcarray.Add(StrRect);
  10176. #if JEFF_TEST_ON
  10177. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  10178. strarray2.RemoveAll();
  10179. CString strFind = "要求:";
  10180. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  10181. do
  10182. {
  10183. int nIndex = strbz3.Find(strFind, 1);
  10184. if (nIndex != -1)
  10185. {
  10186. CString strbz = strbz3.Left(nIndex);
  10187. strbz3 = strbz3.Mid(nIndex);
  10188. strarray2.Add(strbz);
  10189. }
  10190. else
  10191. {
  10192. strarray2.Add(strbz3);
  10193. strbz3 = "";
  10194. }
  10195. } while (strbz3.Find(strFind) != -1);
  10196. strarray2.Add(g_List1array.ElementAt(0).ElementAt(25));
  10197. if (!m_replace.IsEmpty())
  10198. {
  10199. m_replace = "设计替换照片:" + m_replace;
  10200. m_replace.Replace("$", ";");
  10201. m_replace.TrimLeft(";");
  10202. }
  10203. strarray2.Add(m_replace);
  10204. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  10205. #else
  10206. strarray2.Add(m_bz);
  10207. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  10208. #endif
  10209. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  10210. dty += bottom - StrRect.bottom;
  10211. StrRect.bottom = bottom;
  10212. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  10213. m_Print.SetFontFace(10, 1, "宋体");
  10214. StrRect = load.m_rcarray.ElementAt(22);
  10215. dty = curypos - StrRect.bottom + 25;
  10216. StrRect.top += dty; StrRect.bottom += dty;
  10217. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  10218. if (m_edit9.IsEmpty())
  10219. {
  10220. m_edit9 = "\
  10221. 经确认后的照片均排入制作流程,\r\n\
  10222. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  10223. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  10224. }
  10225. CString info1, info2, info3;
  10226. int newlinepos = m_edit9.Find("\r\n");
  10227. if (newlinepos != -1)
  10228. {
  10229. info1 = m_edit9.Left(newlinepos);
  10230. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  10231. }
  10232. newlinepos = m_edit9.Find("\r\n");
  10233. if (newlinepos != -1)
  10234. {
  10235. info2 = m_edit9.Left(newlinepos);
  10236. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  10237. info3 = m_edit9;
  10238. }
  10239. if (1)
  10240. {
  10241. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10242. StrRect = load.m_rcarray.ElementAt(23);
  10243. StrRect.top += dty; StrRect.bottom += dty;
  10244. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10245. StrRect = load.m_rcarray.ElementAt(24);
  10246. StrRect.top += dty; StrRect.bottom += dty;
  10247. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10248. }
  10249. else
  10250. {
  10251. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10252. StrRect = load.m_rcarray.ElementAt(23);
  10253. StrRect.top += dty; StrRect.bottom += dty;
  10254. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10255. StrRect = load.m_rcarray.ElementAt(24);
  10256. StrRect.top += dty; StrRect.bottom += dty;
  10257. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10258. }
  10259. StrRect = load.m_rcarray.ElementAt(25);
  10260. StrRect.top += dty; StrRect.bottom += dty;
  10261. m_Print.DrawText((LPTSTR)(LPCTSTR)"贵宾签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10262. StrRect = load.m_rcarray.ElementAt(26);
  10263. StrRect.top += dty; StrRect.bottom += dty;
  10264. m_Print.DrawRect2(StrRect, 2);
  10265. m_Print.SetFontFace(9, 1, "宋体");
  10266. StrRect = load.m_rcarray.ElementAt(27);
  10267. StrRect.top += dty; StrRect.bottom += dty;
  10268. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10269. StrRect = load.m_rcarray.ElementAt(28);
  10270. StrRect.top += dty; StrRect.bottom += dty;
  10271. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10272. PrintPreview dlg;//dlg.m_mode=2;
  10273. dlg.m_name = name;
  10274. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  10275. dlg.m_pDC = m_Print.GetPDC();
  10276. if (aa == 0)
  10277. {
  10278. if (dlg.DoModal() != IDOK)
  10279. return;
  10280. printcot = dlg.m_num;
  10281. }
  10282. //结束打印
  10283. m_Print.EndPage();
  10284. m_Print.EndPrint();
  10285. }
  10286. }
  10287. /*
  10288. void CMainFrame::PrintFlowChart(CString m_id)
  10289. {
  10290. CPrintRX m_Print;
  10291. m_Print.InitToPrint(NULL, 1);
  10292. m_Print.StartPrint();
  10293. m_Print.StartPage();
  10294. // CRect StrRect(0,0,560,818);
  10295. LoadRect load;
  10296. load.SetLiaPath ("4.lia");
  10297. load.SetMargins(-14,-14);
  10298. if(!load.Load ())return;
  10299. LoadRect load2;
  10300. load2.SetMargins(-14,472+27-14);
  10301. load2.SetLiaPath ("5.lia");
  10302. if(!load2.Load ())return;
  10303. //////////////////////////////////////////////////////////////
  10304. CString filter="id='"+m_id+"';id='"+m_id+"'";
  10305. g_sendhead.code[0]=54;
  10306. g_sendhead.code[1]=50;
  10307. g_sendhead.tabcount=2;
  10308. g_sendhead.bsql=0;
  10309. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  10310. CArray<CStringArray, CStringArray>sparray;
  10311. DataToArray(&g_List1array,&sparray);
  10312. CString spno;
  10313. for(int i=0; i<sparray.GetSize (); i++)
  10314. {
  10315. if(sparray.ElementAt (i).ElementAt (4)=="4" && sparray.ElementAt (i).ElementAt (5)!="入册")continue;
  10316. if(sparray.ElementAt (i).ElementAt (5)=="入册"&&sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  10317. spno+=sparray.ElementAt (i).ElementAt (5);
  10318. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  10319. spno+=";";
  10320. else
  10321. {
  10322. spno+=":";
  10323. spno+=sparray.ElementAt (i).ElementAt (6);
  10324. spno+=";";
  10325. }
  10326. }
  10327. spno+=" 加挑:";
  10328. for( i=0; i<sparray.GetSize (); i++)
  10329. {
  10330. if(sparray.ElementAt (i).ElementAt (4)!="4")continue;
  10331. if(sparray.ElementAt (i).ElementAt (5)=="入册")continue;
  10332. spno+=sparray.ElementAt (i).ElementAt (5);
  10333. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  10334. spno+=";";
  10335. else
  10336. {
  10337. spno+=":";
  10338. spno+=sparray.ElementAt (i).ElementAt (6);
  10339. spno+=";";
  10340. }
  10341. }
  10342. if(spno.Right (6)==" 加挑:")
  10343. {
  10344. spno=spno.Left (spno.GetLength ()-6);
  10345. }
  10346. CString m_name1 = g_List1array.ElementAt (0).ElementAt (1);
  10347. CString m_name2 = g_List1array.ElementAt (0).ElementAt (2);
  10348. CString m_phone1=g_List1array.ElementAt (0).ElementAt (3);
  10349. CString m_phone2=g_List1array.ElementAt (0).ElementAt (4);
  10350. CString m_urgent=g_List1array.ElementAt (0).ElementAt (5);
  10351. if(m_urgent.IsEmpty ())m_urgent="否";
  10352. CString m_time2 = g_List1array.ElementAt (0).ElementAt (6);
  10353. CString m_time4 = g_List1array.ElementAt (0).ElementAt (7);
  10354. CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  10355. CString m_takezs = g_List1array.ElementAt (0).ElementAt (9);
  10356. CString m_taoxizs = g_List1array.ElementAt (0).ElementAt (10);
  10357. CString m_choosezs = g_List1array.ElementAt (0).ElementAt (11);
  10358. CString m_ren = g_List1array.ElementAt (0).ElementAt (12);
  10359. CString m_waiter3 = g_List1array.ElementAt (0).ElementAt (13);
  10360. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (14);
  10361. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (15);
  10362. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (16);
  10363. CString m_bz = "客人要求: "+g_List1array.ElementAt (0).ElementAt (17);
  10364. CString m_money3 = g_List1array.ElementAt (0).ElementAt (18);
  10365. CString m_money1 = g_List1array.ElementAt (0).ElementAt (19);
  10366. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (20);
  10367. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (21);
  10368. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (22);
  10369. CString m_sum3;
  10370. m_sum3.Format ("%0.2f", atof(m_taoxijiage)+atof(m_payed4)-(atof(m_payed5)+atof(m_money1)));
  10371. ::ConvertToPrice (m_sum3);
  10372. if(m_money3.IsEmpty ())m_money3="0";
  10373. // m_money3=m_money3+"/"+m_sum3;
  10374. CString name;
  10375. if(!m_name1.IsEmpty ())
  10376. name=m_name1+",";
  10377. name+=m_name2;
  10378. name.TrimRight (",");
  10379. CString phone;
  10380. if(!m_phone1.IsEmpty ())
  10381. phone=m_phone1+",";
  10382. phone+=m_phone2;phone.TrimRight (",");
  10383. CStringArray strarray;
  10384. strarray.Add (m_urgent);
  10385. strarray.Add (m_ren);
  10386. strarray.Add (m_waiter3);
  10387. strarray.Add (name);
  10388. strarray.Add (m_time2);
  10389. strarray.Add (m_time4);
  10390. strarray.Add (m_time5);
  10391. strarray.Add (m_money3);
  10392. strarray.Add (m_takezs);
  10393. strarray.Add (m_taoxizs);
  10394. strarray.Add (m_choosezs);
  10395. strarray.Add (m_id);
  10396. strarray.Add (phone);
  10397. ////////////////////////////////////////////////////////////////
  10398. int rcpos=-1;
  10399. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  10400. Image *pImg=NULL;
  10401. #ifdef MNLS_VERSION
  10402. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG") );
  10403. #else
  10404. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  10405. #endif
  10406. m_Print.DrawImage(pImg, StrRect);
  10407. delete pImg;
  10408. m_Print.SetFontFace(15, 1, "宋体");
  10409. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10410. #ifdef MNLS_VERSION
  10411. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10412. #endif
  10413. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10414. #ifdef MNLS_VERSION
  10415. m_Print.DrawRect(StrRect);
  10416. #endif
  10417. m_Print.SetFontFace(7, 1, "黑体");
  10418. m_Print.SetColor(0xffffff);
  10419. #ifdef MNLS_VERSION
  10420. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10421. #endif
  10422. m_Print.SetColor(0);
  10423. m_Print.SetFontFace(25, 1, "黑体");
  10424. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10425. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10426. CString title[13]={"是否加急:","接单门市:","选样人员:","新郎新娘姓名:","拍照日期:","选片日期:","取件日期:","加挑/余款:","拍摄总张数:","应挑选张数:","额外加挑张数:","票号:","客户联系电话:"};
  10427. m_Print.SetFontFace(12, 1, "宋体");
  10428. for( i=0; i<13; i++)
  10429. {
  10430. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10431. if(i<3)
  10432. m_Print.DrawRect2(StrRect, 0);
  10433. else
  10434. m_Print.DrawRect2(StrRect, 1);
  10435. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10436. }
  10437. for( i=18; i<=37; i++)
  10438. {
  10439. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10440. if(i>=19&&i<=21)
  10441. m_Print.DrawRect2(StrRect, 2);
  10442. else if(i==26)
  10443. {
  10444. CRect rc=StrRect;
  10445. CRect rc2=rc;
  10446. rc.right -=rc2.Width ()/2;
  10447. m_Print.DrawRect2(rc, 1);
  10448. rc2.left +=rc.Width ();
  10449. m_Print.DrawRect2(rc2, 1);
  10450. }
  10451. else
  10452. m_Print.DrawRect2(StrRect, 1);
  10453. if(i==18)
  10454. {
  10455. StrRect.left +=5;
  10456. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10457. }
  10458. }
  10459. //////////////////////////////////////
  10460. rcpos=-1;
  10461. for( i=0; i<8; i++)
  10462. {
  10463. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10464. m_Print.DrawRect2(StrRect, 1);
  10465. }
  10466. CString title2[4]={"化妆师:","摄影师:","数码设计师:","顾客签名:"};
  10467. for( i=0; i<4; i++)
  10468. {
  10469. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10470. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10471. }
  10472. for( i=0; i<4; i++)
  10473. {
  10474. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10475. m_Print.DrawRect2(StrRect, 2);
  10476. }
  10477. ///////////////////////////////////////////
  10478. for( i=19; i<=31; i++)
  10479. {
  10480. StrRect=load.m_rcarray .ElementAt (i-1);
  10481. StrRect.left +=4;
  10482. if(i==31)
  10483. {
  10484. if(m_phone1.IsEmpty ()==0 && m_phone2.IsEmpty ()==0)
  10485. {
  10486. StrRect.top +=2;
  10487. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  10488. StrRect.top +=8;
  10489. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10490. }
  10491. else
  10492. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10493. }
  10494. else if((i-19)==7)
  10495. {
  10496. CRect rc=StrRect;
  10497. CRect rc2=rc;
  10498. rc.right -=rc2.Width ()/2;
  10499. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10500. rc2.left +=rc.Width ()+3;
  10501. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10502. }
  10503. else
  10504. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10505. }
  10506. strarray.RemoveAll ();
  10507. strarray.Add (m_waiter2);
  10508. strarray.Add (m_waiter1);
  10509. strarray.Add (m_waiter4);
  10510. for( i=13; i<=15; i++)
  10511. {
  10512. StrRect=load2.m_rcarray .ElementAt (i-1);
  10513. StrRect.left +=4;
  10514. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10515. }
  10516. ///////////spno
  10517. CRect sprc[14];
  10518. for(i=0; i<14; i++)
  10519. {
  10520. if(i<7)
  10521. {
  10522. if(i==0)
  10523. {
  10524. StrRect=load.m_rcarray .ElementAt (17);StrRect.left +=94;StrRect.right -=3;
  10525. }
  10526. else
  10527. {
  10528. StrRect=load.m_rcarray .ElementAt (30+i);StrRect.left +=4;StrRect.right -=3;
  10529. }
  10530. }
  10531. else
  10532. {
  10533. StrRect=load2.m_rcarray .ElementAt (i-7);StrRect.left +=4;StrRect.right -=3;
  10534. }
  10535. sprc[i]=StrRect;
  10536. // m_Print.DrawText((LPTSTR)(LPCTSTR)"xxx", sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10537. }
  10538. CString temp,tempspno,tempbz;
  10539. CSize size;
  10540. BOOL bRun=0;
  10541. int fontsize=12;
  10542. ll: tempspno=spno;
  10543. tempbz=m_bz;
  10544. m_Print.SetFontFace(fontsize, 1, "宋体");
  10545. for( i=0; i<14; i++)
  10546. {
  10547. if(!tempspno.IsEmpty ())
  10548. {
  10549. temp=tempspno;
  10550. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10551. int right=0;
  10552. CRect temprc=sprc[i];
  10553. while(size.cx>temprc.Width ())
  10554. {
  10555. right++;
  10556. temp=tempspno.Left (tempspno.GetLength ()-(right));
  10557. if(GIsHalfHZ(temp))
  10558. {
  10559. right++;
  10560. temp.Delete (temp.GetLength ()-1);
  10561. }
  10562. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10563. }
  10564. if(bRun)
  10565. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10566. tempspno=tempspno.Right (tempspno.GetLength ()-temp.GetLength ());
  10567. if(tempspno.IsEmpty ())i++;
  10568. }
  10569. else if(!tempbz.IsEmpty ())
  10570. {
  10571. temp=tempbz;
  10572. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10573. int right=0;
  10574. CRect temprc=sprc[i];
  10575. while(size.cx>temprc.Width ())
  10576. {
  10577. right++;
  10578. temp=tempbz.Left (tempbz.GetLength ()-(right));
  10579. if(GIsHalfHZ(temp))
  10580. {
  10581. right++;
  10582. temp.Delete (temp.GetLength ()-1);
  10583. }
  10584. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10585. }
  10586. if(bRun)
  10587. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10588. tempbz=tempbz.Right (tempbz.GetLength ()-temp.GetLength ());
  10589. }
  10590. }
  10591. if(tempspno.IsEmpty ()==0 || tempbz.IsEmpty ()==0)
  10592. {
  10593. fontsize--;
  10594. goto ll;
  10595. }
  10596. if(bRun==0)
  10597. {
  10598. bRun=1;
  10599. goto ll;
  10600. }
  10601. PrintPreview dlg;
  10602. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  10603. dlg.m_pDC =m_Print.GetPDC() ;
  10604. if(dlg.DoModal ()!=IDOK)return;
  10605. //结束打印
  10606. m_Print.EndPage();
  10607. m_Print.EndPrint();
  10608. }
  10609. void CMainFrame::SetSelFolder(int pos)
  10610. {
  10611. m_wndToolBar2.SetSelFolder(pos);
  10612. }*/
  10613. void CMainFrame::ToPhotoPrint()
  10614. {
  10615. UINT nID = 1;
  10616. LPSTR pName;
  10617. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  10618. OPEN_MENU(PhotoPrintFrom);
  10619. }
  10620. void CMainFrame::GetOcx()
  10621. {
  10622. char path[MAX_PATH];
  10623. ::GetSystemDirectory(path, MAX_PATH);
  10624. CString syspath = path;
  10625. try
  10626. {
  10627. if (!::PathFileExists(syspath + "\\MSCHRT20.OCX"))
  10628. {
  10629. g_sendhead.bsql = 0;
  10630. g_sendhead.code[0] = 103;
  10631. g_sendhead.tabcount = 1;
  10632. g_pMainWnd->ProcessChatMessageRequest2(1); if (g_bSendOK == 0)return;
  10633. CFile fp;
  10634. if (fp.Open(syspath + "\\MSCHRT20.OCX", CFile::modeWrite | CFile::modeCreate))
  10635. {
  10636. fp.Write(g_pData, g_nLeng);
  10637. fp.Close();
  10638. ::Sleep(1000);
  10639. }
  10640. }
  10641. CString temp;
  10642. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10643. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10644. }
  10645. catch (...)
  10646. {
  10647. }
  10648. try
  10649. {
  10650. CString temp;
  10651. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10652. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10653. }
  10654. catch (...)
  10655. {
  10656. }
  10657. }
  10658. void CMainFrame::OnServer()
  10659. {
  10660. // TODO: Add your command handler code here
  10661. DBConfig dlg;
  10662. dlg.DoModal();
  10663. }
  10664. void CMainFrame::OnPath()
  10665. {
  10666. // TODO: Add your command handler code here
  10667. if (g_user.bLongin == 0)
  10668. {
  10669. if (g_bNoLoginLia)
  10670. {
  10671. Login dlg;
  10672. dlg.SetLiaPath("5.lia");
  10673. dlg.DoModal();
  10674. }
  10675. else
  10676. {
  10677. Login3 dlg;
  10678. dlg.SetLiaPath("5.lia");
  10679. dlg.DoModal();
  10680. }
  10681. if (g_user.bLongin == 0)return;
  10682. }
  10683. if (IsHasRightsnew(49) == 0)return;
  10684. SetPathDlg2 dlg;
  10685. dlg.DoModal();
  10686. }
  10687. void CMainFrame::OnShowhis()
  10688. {
  10689. // TODO: Add your command handler code here
  10690. if (g_user.bLongin == 0)
  10691. {
  10692. if (g_bNoLoginLia)
  10693. {
  10694. Login dlg;
  10695. dlg.SetLiaPath("5.lia");
  10696. dlg.DoModal();
  10697. }
  10698. else
  10699. {
  10700. Login3 dlg;
  10701. dlg.SetLiaPath("5.lia");
  10702. dlg.DoModal();
  10703. }
  10704. if (g_user.bLongin == 0)return;
  10705. }
  10706. if (IsHasRightsnew(52) == 0)return;
  10707. CMenu *pMenu = GetMenu();
  10708. CMenu* submenu = pMenu->GetSubMenu(2);
  10709. UINT status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10710. if (status&MF_CHECKED)
  10711. {
  10712. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_UNCHECKED);
  10713. g_bShowOK = 1;
  10714. }
  10715. else
  10716. {
  10717. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  10718. g_bShowOK = 0;
  10719. } m_Mdi.CloseAll();
  10720. }
  10721. void CMainFrame::AddHistoryMenu(CArray<CStringArray, CStringArray>*hisyeararray) // 添加历史数据库菜单;
  10722. {
  10723. #ifdef NEW_SKIN
  10724. CMenu* m_menuXP = GetMenu();
  10725. CMenu* submenu = m_menuXP->GetSubMenu(2);
  10726. // 删除原有菜单;
  10727. int i = 0;
  10728. for ( i = 0; i < 100; i++)
  10729. {
  10730. submenu->DeleteMenu(1000 + i, MF_BYCOMMAND);
  10731. }
  10732. // 重创菜单,从资源ID1000开始;
  10733. for (i = 0; i < hisyeararray->GetSize(); i++)
  10734. {
  10735. submenu->AppendMenu(MF_STRING, 1000 + i, "查看历史数据:" + hisyeararray->ElementAt(i).ElementAt(0)); // 第一项菜单项;
  10736. }
  10737. g_nYearpos = -1;
  10738. #else
  10739. HMENU hMenu = ::GetMenu(m_hWnd);
  10740. m_menuXP.Attach(hMenu);
  10741. BCMenu* submenu = (BCMenu*)m_menuXP.GetSubMenu(2);
  10742. for (int i = 0; i < 100; i++)
  10743. {
  10744. submenu->DeleteMenu (1000+i, MF_BYCOMMAND);
  10745. }
  10746. for( i=0; i<hisyeararray->GetSize (); i++)
  10747. {
  10748. submenu->AppendMenu(MF_STRING, 1000+i, "查看历史数据:"+hisyeararray->ElementAt (i).ElementAt (0)); // 第一项菜单项
  10749. }
  10750. m_menuXP.Detach ();
  10751. g_nYearpos = -1;
  10752. #endif
  10753. }
  10754. /************************************************************************/
  10755. /*
  10756. Jeff
  10757. 函数:AddBranchMenu()
  10758. 参数:CArray<CStringArray, CStringArray> *branchArray
  10759. 返回:void
  10760. 注意:
  10761. 调用关系:
  10762. */
  10763. /************************************************************************/
  10764. void CMainFrame::AddBranchMenu(CArray<CStringArray, CStringArray>*branchArray)
  10765. {
  10766. //WriteTextLog("AddBranchMenu,添加集团版菜单");
  10767. #ifdef ENTERPRISE_VERSION
  10768. CMenu *m_menuXP = GetMenu();
  10769. CMenu* submenu = m_menuXP->GetSubMenu(0);
  10770. int i = 0;
  10771. for ( i = 0; i < 100; i++)
  10772. {
  10773. submenu->DeleteMenu(2000 + i, MF_BYCOMMAND);
  10774. }
  10775. g_menubranchname.RemoveAll();
  10776. CString name;
  10777. int a = 0;
  10778. #if 0 // Jeff.add for test
  10779. CString strCount;
  10780. strCount.Format("历史数据库个数=%d", branchArray->GetSize());
  10781. WriteTextLog(strCount);
  10782. #endif
  10783. for (i = 0; i < branchArray->GetSize() - 1; i++)
  10784. {
  10785. //WriteTextLog("111");
  10786. //WriteTextLog(hisyeararray->ElementAt(i).ElementAt(0));
  10787. //WriteTextLog(name);
  10788. if (name == "")
  10789. {
  10790. name = branchArray->ElementAt(i).ElementAt(0);
  10791. #ifndef SQLSERVER_VERSION
  10792. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10793. a++;
  10794. #endif
  10795. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10796. a++;
  10797. g_menubranchname.Add(name);
  10798. continue;
  10799. }
  10800. else if (branchArray->ElementAt(i).ElementAt(0).Find(name) != -1 && ((branchArray->ElementAt(i).ElementAt(0).GetLength() - name.GetLength()) == 4))
  10801. {
  10802. continue;
  10803. }
  10804. name = branchArray->ElementAt(i).ElementAt(0);
  10805. #ifndef SQLSERVER_VERSION
  10806. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10807. a++;
  10808. #endif
  10809. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10810. g_menubranchname.Add(name);
  10811. a++;
  10812. //WriteTextLog("222");
  10813. }
  10814. if ((branchArray->GetSize() - 1) > 0)
  10815. {
  10816. if (branchArray->ElementAt(0).ElementAt(3) == "总店")
  10817. submenu->AppendMenu(MF_STRING, 2000 + a, "多店数据汇总");
  10818. }
  10819. #endif
  10820. }
  10821. // Jeff:如果选择了历史数据库,则开单的数据会录入到该历史数据库中,而非当前数据库;
  10822. // g_nYearpos==-1,表示当前主数据库,其他>=0的值表示历史数据库在g_historydb中的索引值;
  10823. void CMainFrame::OnHistory(UINT nID) // 选择历史数据库菜单响应;
  10824. {
  10825. CMenu* pMenu = GetMenu();
  10826. CMenu* submenu = pMenu->GetSubMenu(2);
  10827. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10828. if (g_user.bLongin == 0)
  10829. {
  10830. if (g_bNoLoginLia)
  10831. {
  10832. Login dlg;
  10833. dlg.SetLiaPath("5.lia");
  10834. dlg.DoModal();
  10835. }
  10836. else
  10837. {
  10838. Login3 dlg;
  10839. dlg.SetLiaPath("5.lia");
  10840. dlg.DoModal();
  10841. }
  10842. if (g_user.bLongin == 0)return;
  10843. }
  10844. if (IsHasRightsnew(52) == 0)return;
  10845. m_Mdi.CloseAll();
  10846. for (int i = 0; i < 100; i++)
  10847. {
  10848. submenu->CheckMenuItem(1000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10849. }
  10850. if (status&MF_CHECKED)
  10851. {
  10852. g_nYearpos = -1;
  10853. status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10854. if (status&MF_CHECKED)
  10855. g_bShowOK = 0;
  10856. else
  10857. g_bShowOK = 1;
  10858. }
  10859. else
  10860. {
  10861. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10862. g_nYearpos = nID - 1000;
  10863. g_bShowOK = 1;
  10864. }
  10865. }
  10866. void CMainFrame::OnBranchData(UINT nID)
  10867. {
  10868. #ifdef ENTERPRISE_VERSION
  10869. #ifdef SQLSERVER_VERSION
  10870. OnBranchData2(nID);
  10871. return;
  10872. #endif
  10873. #endif
  10874. }
  10875. void CMainFrame::OnBranchData2(UINT nID)
  10876. {
  10877. #ifdef ENTERPRISE_VERSION
  10878. g_bAllBranch = 0;
  10879. m_Mdi.CloseAll();
  10880. OnDisconnect();
  10881. CMenu *pMenu = GetMenu();
  10882. CMenu* submenu = pMenu->GetSubMenu(0);
  10883. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10884. for (int i = 0; i < 100; i++)
  10885. {
  10886. submenu->CheckMenuItem(2000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10887. }
  10888. if (status&MF_CHECKED)
  10889. {
  10890. g_branchname.Empty();
  10891. g_branchip.Empty();
  10892. g_bBranchModify = 0;
  10893. g_user.bLongin = 0;
  10894. if (g_bNoLoginLia)
  10895. {
  10896. Login dlg;
  10897. dlg.SetLiaPath("5.lia");
  10898. dlg.DoModal();
  10899. }
  10900. else
  10901. {
  10902. Login3 dlg;
  10903. dlg.SetLiaPath("5.lia");
  10904. dlg.DoModal();
  10905. }
  10906. g_pMainWnd2->RefreshOutlookBar();
  10907. g_pMainWnd2->DrawLogin();
  10908. g_path1 = g_path1bak;
  10909. g_path2 = g_path2bak;
  10910. g_path3 = g_path3bak;
  10911. g_path4 = g_path4bak;
  10912. g_path5 = g_path5bak;
  10913. g_path6 = g_path6bak;
  10914. g_path7 = g_path7bak;
  10915. g_pMainWnd2->EnableBtns(1);
  10916. }
  10917. else
  10918. {
  10919. BOOL bNeedCheckRights = 1;
  10920. if (g_user.bLongin && g_branchname == "")//无需登陆本店判断其访问分店权限
  10921. {
  10922. bNeedCheckRights = 0;
  10923. }
  10924. #ifndef SQLSERVER_VERSION
  10925. if ((g_menubranchname.GetSize() * 2) == nID - 2000)//多店数据汇总
  10926. #else
  10927. if ((g_menubranchname.GetSize()) == nID - 2000)//多店数据汇总
  10928. #endif
  10929. {
  10930. g_branchname.Empty();
  10931. g_branchip.Empty();
  10932. g_bBranchModify = 0;
  10933. if (bNeedCheckRights)
  10934. {
  10935. g_user.bLongin = 0;
  10936. if (g_user.bLongin == 0)
  10937. {
  10938. if (g_bNoLoginLia)
  10939. {
  10940. Login dlg;
  10941. dlg.SetLiaPath("5.lia");
  10942. dlg.DoModal();
  10943. }
  10944. else
  10945. {
  10946. Login3 dlg;
  10947. dlg.SetLiaPath("5.lia");
  10948. dlg.DoModal();
  10949. }
  10950. if (g_user.bLongin == 0)return;
  10951. }
  10952. }
  10953. if (IsHasRightsnew(28) == 0)
  10954. {
  10955. return;
  10956. }
  10957. g_bAllBranch = 1; g_pMainWnd2->ShowBar(0);
  10958. g_pMainWnd2->RefreshOutlookBar2();
  10959. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10960. g_branchname.Empty();
  10961. g_branchip.Empty();
  10962. g_bBranchModify = 0;
  10963. g_pMainWnd2->DrawLogin();
  10964. g_pMainWnd2->EnableBtns(0);
  10965. g_path1 = g_path1bak;
  10966. g_path2 = g_path2bak;
  10967. g_path3 = g_path3bak;
  10968. g_path4 = g_path4bak;
  10969. g_path5 = g_path5bak;
  10970. g_path6 = g_path6bak;
  10971. g_path7 = g_path7bak;
  10972. }
  10973. else
  10974. {
  10975. if (bNeedCheckRights)
  10976. {
  10977. g_branchname.Empty();
  10978. g_branchip.Empty();
  10979. g_bBranchModify = 0;
  10980. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_UNCHECKED);
  10981. g_user.bLongin = 0;
  10982. if (g_pMainWnd2)
  10983. {
  10984. g_pMainWnd2->DrawLogin();
  10985. g_pMainWnd2->ShowBar(0);
  10986. }
  10987. if (g_bNoLoginLia)
  10988. {
  10989. Login dlg;
  10990. dlg.SetLiaPath("5.lia");
  10991. dlg.DoModal();
  10992. }
  10993. else
  10994. {
  10995. Login3 dlg;
  10996. dlg.SetLiaPath("5.lia");
  10997. dlg.DoModal();
  10998. }
  10999. if (g_user.bLongin == 0)return;
  11000. }
  11001. if (IsHasRightsnew(28) == 0)
  11002. {
  11003. return;
  11004. }
  11005. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  11006. #ifndef SQLSERVER_VERSION
  11007. if (nID % 2 == 0)
  11008. g_branchname = g_menubranchname.ElementAt((nID - 2000) / 2);
  11009. else
  11010. g_branchname = g_menubranchname.ElementAt((nID - 2001) / 2);
  11011. #else
  11012. g_branchname = g_menubranchname.ElementAt(nID - 2000);
  11013. #endif
  11014. //printf("选择分店:%s\n", g_branchname);
  11015. g_branchip.Empty();
  11016. CString domainname = "";
  11017. for (int i = 0; i < g_brancharray.GetSize(); i++)
  11018. {
  11019. /*
  11020. for(int j=0; j<g_brancharray.GetSize(); j++)
  11021. printf("%s\n", g_brancharray.ElementAt(i).ElementAt(j));
  11022. */
  11023. if (g_branchname == g_brancharray.ElementAt(i).ElementAt(0))
  11024. {
  11025. g_branchip = g_brancharray.ElementAt(i).ElementAt(1);
  11026. g_branchip2 = g_brancharray.ElementAt(i).ElementAt(4);
  11027. domainname = g_brancharray.ElementAt(i).ElementAt(2);
  11028. }
  11029. }
  11030. g_path1 = g_path1bak;
  11031. g_path2 = g_path2bak;
  11032. g_path3 = g_path3bak;
  11033. g_path4 = g_path4bak;
  11034. g_path5 = g_path5bak;
  11035. g_path6 = g_path6bak;
  11036. g_path7 = g_path7bak;
  11037. if (domainname.IsEmpty())
  11038. {
  11039. g_path1 = g_path2 = g_path3 = g_path4 = g_path5 = g_path6 = g_path7 = "xxx";
  11040. }
  11041. else
  11042. {
  11043. g_path1 += "\\" + domainname;
  11044. g_path2 += "\\" + domainname;
  11045. g_path3 += "\\" + domainname;
  11046. g_path4 += "\\" + domainname;
  11047. g_path5 += "\\" + domainname;
  11048. g_path6 += "\\" + domainname;
  11049. g_path7 += "\\" + domainname;
  11050. }
  11051. g_bBranchModify = 1;
  11052. /* CArray<CStringArray, CStringArray>yeararray;
  11053. for( i=0; i<g_brancharray.GetSize (); i++)
  11054. {
  11055. if(g_brancharray.ElementAt (i).ElementAt (0).Find (g_branchname)!=-1 && g_branchname!=g_brancharray.ElementAt (i).ElementAt (0))
  11056. {
  11057. int size=yeararray.GetSize ();
  11058. yeararray.SetSize(size+1,1);
  11059. CString str=g_brancharray.ElementAt (i).ElementAt (0);
  11060. str.Delete (0, g_branchname.GetLength ());
  11061. yeararray.ElementAt (size).Add (str);
  11062. }
  11063. }
  11064. AddHistoryMenu(&yeararray);*/
  11065. if (g_bBranchModify)OnDisconnect();
  11066. if (1)
  11067. {
  11068. g_user.bLongin = 0;
  11069. g_user.name.Empty();
  11070. g_user.rights.Empty();
  11071. g_user.account.Empty();
  11072. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  11073. g_pMainWnd2->RefreshOutlookBar();
  11074. m_Mdi.CloseAll();
  11075. if (g_pMainWnd2)
  11076. {
  11077. g_pMainWnd2->DrawLogin();
  11078. g_pMainWnd2->ShowBar(0);
  11079. }
  11080. if (g_bNoLoginLia)
  11081. {
  11082. Login dlg;
  11083. dlg.SetLiaPath("5.lia");
  11084. dlg.DoModal();
  11085. }
  11086. else
  11087. {
  11088. Login3 dlg;
  11089. dlg.SetLiaPath("5.lia");
  11090. dlg.DoModal();
  11091. }
  11092. if (g_user.bLongin == 0)return;
  11093. if (g_pMainWnd2)g_pMainWnd2->ShowBar(1);
  11094. }
  11095. g_pMainWnd2->DrawLogin();
  11096. g_pMainWnd2->EnableBtns(1);
  11097. }
  11098. g_nYearpos = -1;
  11099. }
  11100. #endif
  11101. }
  11102. void CMainFrame::OnStaffAchievementShow() //Jeff:此机只用于员工看业绩;
  11103. {
  11104. // TODO: Add your command handler code here
  11105. if (g_user.bLongin == 0) // 是否登陆系统;
  11106. {
  11107. if (g_bNoLoginLia)
  11108. {
  11109. Login dlg;
  11110. dlg.SetLiaPath("5.lia");
  11111. dlg.DoModal();
  11112. }
  11113. else
  11114. {
  11115. Login3 dlg;
  11116. dlg.SetLiaPath("5.lia");
  11117. dlg.DoModal();
  11118. }
  11119. if (g_user.bLongin == 0)return;
  11120. }
  11121. if (IsHasRightsnew(49) == 0)return;// 是否有权限进行设置;
  11122. CMenu *pMenu = GetMenu();
  11123. CMenu* submenu = pMenu->GetSubMenu(1);
  11124. UINT status = submenu->GetMenuState(IDM_StaffAchievementShow, MF_BYCOMMAND);
  11125. if (status&MF_CHECKED)
  11126. {
  11127. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_UNCHECKED);
  11128. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status2", 0);
  11129. g_bStaffAchievementShow = 0;
  11130. TCHAR szKey[MAX_PATH];
  11131. TCHAR szDir[MAX_PATH];
  11132. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  11133. HKEY hKey = 0;
  11134. DWORD disp = 0;
  11135. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  11136. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  11137. if (lResult == ERROR_SUCCESS)
  11138. {
  11139. RegDeleteValue(hKey, "YLGLMAINAUTORUN");
  11140. RegDeleteKey(hKey, "YLGLMAINAUTORUN");
  11141. RegCloseKey(hKey);
  11142. }
  11143. }
  11144. else
  11145. {
  11146. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  11147. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status2", 1);
  11148. g_bStaffAchievementShow = 1;
  11149. TCHAR szKey[MAX_PATH];
  11150. TCHAR szDir[MAX_PATH];
  11151. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  11152. HKEY hKey = 0;
  11153. DWORD disp = 0;
  11154. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  11155. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  11156. if (lResult == ERROR_SUCCESS)
  11157. {
  11158. lResult = RegSetValueEx(hKey, "YLGLMAINAUTORUN", 0, REG_SZ, (const unsigned char*)szDir, lstrlen(szDir));
  11159. RegCloseKey(hKey);
  11160. }
  11161. StaffAchievementSet dlg;
  11162. dlg.DoModal();
  11163. }
  11164. }
  11165. void CMainFrame::PrintDinDan2(CString m_id)
  11166. {
  11167. #ifdef MODERN_VERSION
  11168. SelContent seldlg;
  11169. if (seldlg.DoModal() != IDOK)return;
  11170. CPrintRX m_Print;
  11171. m_Print.InitToPrint(NULL, 1);
  11172. m_Print.StartPrint();
  11173. m_Print.StartPage();
  11174. // CRect StrRect(0,0,560,818);
  11175. LoadRect load;
  11176. LoadRect load2;
  11177. LoadRect load3;
  11178. load.SetLiaPath ("9.lia");
  11179. load.SetMargins(-14,0);
  11180. if(!load.Load ())return;
  11181. int i;
  11182. //////////////////////////////////////////////////////////////
  11183. CStringArray txarray;
  11184. CString filter="id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"'";
  11185. g_sendhead.code[0]=11;
  11186. g_sendhead.code[1]=52;
  11187. g_sendhead.code[2]=50;
  11188. g_sendhead.code[3]=38;
  11189. g_sendhead.code[4]=27;
  11190. g_sendhead.tabcount=5;
  11191. g_sendhead.bsql=0;
  11192. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  11193. CArray<CStringArray, CStringArray>sparray;
  11194. CArray<CStringArray, CStringArray>clientarray;
  11195. CArray<CStringArray, CStringArray>phonearray;
  11196. CArray<CStringArray, CStringArray>bukuan2array;
  11197. CArray<CStringArray, CStringArray>bukuanarray;
  11198. DataToArray(&g_List1array, &clientarray, &sparray, &bukuan2array, &bukuanarray);
  11199. CTime tm=CTime::GetCurrentTime ();
  11200. CString str;
  11201. CString m_money1 = g_List1array.ElementAt (0).ElementAt (1);
  11202. CString m_money2 = g_List1array.ElementAt (0).ElementAt (2);
  11203. CString m_money3 = g_List1array.ElementAt (0).ElementAt (3);
  11204. CString m_name1 = g_List1array.ElementAt (0).ElementAt (4);
  11205. CString m_name2 = g_List1array.ElementAt (0).ElementAt (5);
  11206. CString m_taoxiname= g_List1array.ElementAt (0).ElementAt (7);
  11207. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (8);
  11208. CString m_zs = g_List1array.ElementAt (0).ElementAt (9);
  11209. CString m_time1 = g_List1array.ElementAt (0).ElementAt (10);
  11210. CString m_time2 = g_List1array.ElementAt (0).ElementAt (11);
  11211. CString m_time3 = g_List1array.ElementAt (0).ElementAt (12);
  11212. CString m_ren = g_List1array.ElementAt (0).ElementAt (14);
  11213. CString m_discount = g_List1array.ElementAt (0).ElementAt (15);
  11214. CString m_payed1 = g_List1array.ElementAt (0).ElementAt (16);
  11215. CString m_payed2 = g_List1array.ElementAt (0).ElementAt (17);
  11216. CString m_payed3 = g_List1array.ElementAt (0).ElementAt (18);
  11217. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (19);
  11218. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (20);
  11219. CString m_time4 = g_List1array.ElementAt (0).ElementAt (21);
  11220. CString m_time5 = g_List1array.ElementAt (0).ElementAt (22);
  11221. CString m_clothescount = g_List1array.ElementAt (0).ElementAt (26);
  11222. CString m_clothescount2 = g_List1array.ElementAt (0).ElementAt (27);
  11223. CString m_outside = g_List1array.ElementAt (0).ElementAt (28);
  11224. CString m_outside2 = g_List1array.ElementAt (0).ElementAt (29);
  11225. CString m_style = g_List1array.ElementAt (0).ElementAt (30);
  11226. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (34);
  11227. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (35);
  11228. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (37);
  11229. CString m_bz = g_List1array.ElementAt (0).ElementAt (38);
  11230. CString m_phone1=clientarray.ElementAt (0).ElementAt (3);
  11231. CString m_phone2=clientarray.ElementAt (0).ElementAt (4);
  11232. CString m_addr1=clientarray.ElementAt (0).ElementAt (7);
  11233. CString m_addr2=clientarray.ElementAt (0).ElementAt (8);
  11234. CString m_occupation1=clientarray.ElementAt (0).ElementAt (9);
  11235. CString m_occupation2=clientarray.ElementAt (0).ElementAt (10);
  11236. filter="name='"+m_ren+"'";
  11237. g_sendhead.code[0]=5;
  11238. g_sendhead.tabcount=1;
  11239. g_sendhead.bsql=0;
  11240. int g_nYearposTemp=g_nYearpos;
  11241. g_nYearpos=-1;
  11242. g_pMainWnd->ProcessChatMessageRequest2(filter);
  11243. g_nYearpos=g_nYearposTemp;
  11244. if(g_bSendOK==0)return;
  11245. DataToArray(&phonearray);
  11246. m_money2.Format ("%f", atof(m_payed5)+atof(m_money1));
  11247. m_money1.Format ("%f", atof(m_taoxijiage)+atof(m_payed4));
  11248. m_money3.Format ("%f", atof(m_money1)-atof(m_money2));
  11249. ConvertToPrice(m_money1);
  11250. ConvertToPrice(m_money2);
  11251. ConvertToPrice(m_money3);
  11252. ////////////////////////////////////////////////////////////////
  11253. int rcpos=-1;
  11254. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  11255. Image *pImg=NULL;
  11256. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo2.jpg");
  11257. if(seldlg.m_bFrame)
  11258. m_Print.DrawImage(pImg, StrRect);
  11259. delete pImg;
  11260. m_Print.SetFontFace(16, 1, "黑体");
  11261. StrRect=load.m_rcarray .ElementAt (++rcpos);
  11262. if(seldlg.m_bFrame)
  11263. ///////////////////////////////不用改
  11264. m_Print.DrawText((LPTSTR)(LPCTSTR)"摩登新娘工作流程单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11265. m_Print.SetFontFace(10, 1, "宋体");
  11266. for( i=3; i<=6; i++)
  11267. {
  11268. StrRect=load.m_rcarray .ElementAt (i-1);
  11269. if(seldlg.m_bFrame)
  11270. m_Print.DrawRect2(StrRect, 1);
  11271. }
  11272. CStringArray strarray;
  11273. if(seldlg.m_bBooking==0)
  11274. {
  11275. m_name1.Empty ();
  11276. m_name2.Empty ();
  11277. m_phone1.Empty ();
  11278. m_phone2.Empty ();
  11279. m_addr1.Empty ();
  11280. m_addr2.Empty ();
  11281. m_taoxiname.Empty ();
  11282. m_taoxijiage.Empty ();
  11283. }
  11284. if(seldlg.m_bFrame )
  11285. {
  11286. strarray.Add("新郎:"+m_name1);
  11287. strarray.Add("H");
  11288. strarray.Add("O");
  11289. strarray.Add("手机:"+m_phone1);
  11290. strarray.Add("新娘:"+m_name2);
  11291. strarray.Add("H");
  11292. strarray.Add("O");
  11293. strarray.Add("手机:"+m_phone2);
  11294. }
  11295. else
  11296. {
  11297. strarray.Add(" "+m_name1);
  11298. strarray.Add("");
  11299. strarray.Add("");
  11300. strarray.Add(" "+m_phone1);
  11301. strarray.Add(" "+m_name2);
  11302. strarray.Add("");
  11303. strarray.Add("");
  11304. strarray.Add(" "+m_phone2);
  11305. }
  11306. for( i=7; i<=14; i++)
  11307. {
  11308. StrRect=load.m_rcarray .ElementAt (i-1);
  11309. StrRect.left +=2;
  11310. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11311. }
  11312. StrRect=load.m_rcarray .ElementAt (3);
  11313. StrRect.left +=2;
  11314. if(seldlg.m_bFrame)
  11315. str="地址:"+m_addr1;
  11316. else
  11317. str=" "+m_addr1;
  11318. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11319. StrRect=load.m_rcarray .ElementAt (5);
  11320. StrRect.left +=2;
  11321. if(seldlg.m_bFrame)
  11322. str="地址:"+m_addr2;
  11323. else
  11324. str=" "+m_addr2;
  11325. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11326. //////////////////////////////////////////////////////
  11327. StrRect=load.m_rcarray .ElementAt (14);
  11328. str="预\r\n约";
  11329. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11330. StrRect.top +=46;
  11331. StrRect.left +=2;
  11332. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11333. m_Print.SetFontFace(10, 1, "宋体");
  11334. StrRect=load.m_rcarray .ElementAt (15);
  11335. if(seldlg.m_bFrame)
  11336. str="套系名称:"+m_taoxiname;
  11337. else
  11338. str=" "+m_taoxiname;
  11339. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11340. StrRect.left +=4;
  11341. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11342. StrRect=load.m_rcarray .ElementAt (16);
  11343. if(seldlg.m_bFrame)
  11344. str="单价:"+m_taoxijiage;
  11345. else
  11346. str=" "+m_taoxijiage;
  11347. StrRect.left +=2;
  11348. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11349. StrRect=load.m_rcarray .ElementAt (21);
  11350. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11351. str="新人签名:";
  11352. StrRect.left +=2;
  11353. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11354. StrRect=load.m_rcarray .ElementAt (22);
  11355. if(seldlg.m_bBooking==0)
  11356. {
  11357. if(seldlg.m_bFrame)
  11358. str="未付款:";
  11359. else
  11360. str=" ";
  11361. }
  11362. else
  11363. {
  11364. if(seldlg.m_bFrame)
  11365. str="未付款:"+m_money3;
  11366. else
  11367. str=" "+m_money3;
  11368. }
  11369. StrRect.left +=2;
  11370. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11371. StrRect=load.m_rcarray .ElementAt (23);
  11372. str="结婚秘书:";
  11373. StrRect.left +=2;
  11374. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11375. StrRect=load.m_rcarray .ElementAt (24);
  11376. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11377. StrRect.left +=3;
  11378. StrRect.top +=3;
  11379. StrRect.right -=2;
  11380. StrRect.bottom -=2;
  11381. int realpos=0;str="";
  11382. for(i=0; i<sparray.GetSize (); i++)
  11383. {
  11384. if(atoi(sparray.ElementAt (i).ElementAt (4))!=1)continue;
  11385. str+=sparray.ElementAt (i).ElementAt (5);
  11386. str+=" 数量:";
  11387. str+=sparray.ElementAt (i).ElementAt (3);
  11388. if(realpos%2)
  11389. str+="\r\n";
  11390. else
  11391. str+=" ";
  11392. realpos++;
  11393. }
  11394. str.TrimRight ("\r\n");
  11395. str.TrimRight (" ");
  11396. if(seldlg.m_bBooking)AutoDraw(m_Print, StrRect, str, 1.4);
  11397. ///////////////////////////////////////////////////////////
  11398. StrRect=load.m_rcarray .ElementAt (14);
  11399. StrRect.top +=1*122;
  11400. StrRect.bottom +=1*122;
  11401. str="拍\r\n照";
  11402. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11403. StrRect.top +=46;
  11404. StrRect.left +=2;
  11405. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11406. m_Print.SetFontFace(10, 1, "宋体");
  11407. StrRect=load.m_rcarray .ElementAt (15);
  11408. StrRect.top +=1*122;
  11409. StrRect.bottom +=1*122;
  11410. str="拍照内容: 白 晚 特 便";
  11411. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11412. StrRect.left +=4;
  11413. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11414. StrRect=load.m_rcarray .ElementAt (21);
  11415. StrRect.top +=1*122;
  11416. StrRect.bottom +=1*122;
  11417. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11418. str=" 新人签名:";
  11419. StrRect.left +=2;
  11420. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11421. StrRect=load.m_rcarray .ElementAt (22);
  11422. StrRect.top +=1*122;
  11423. StrRect.bottom +=1*122;
  11424. if(seldlg.m_bTake)
  11425. {
  11426. if(seldlg.m_bFrame)
  11427. str="未付款:"+m_money3;
  11428. else
  11429. str=" "+m_money3;
  11430. }
  11431. else
  11432. {
  11433. if(seldlg.m_bFrame)
  11434. str="未付款:";
  11435. else
  11436. str=" ";
  11437. }
  11438. StrRect.left +=2;
  11439. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11440. StrRect=load.m_rcarray .ElementAt (23);
  11441. StrRect.top +=1*122;
  11442. StrRect.bottom +=1*122;
  11443. str="结婚秘书:";
  11444. StrRect.left +=2;
  11445. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11446. StrRect=load.m_rcarray .ElementAt (24);
  11447. StrRect.top +=1*122;
  11448. StrRect.bottom +=1*122;
  11449. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11450. StrRect.left +=3;
  11451. StrRect.top +=3;
  11452. StrRect.right -=2;
  11453. StrRect.bottom -=2;
  11454. if(seldlg.m_bTake)
  11455. {
  11456. str="";
  11457. for(i=0; i<bukuan2array.GetSize (); i++)
  11458. {
  11459. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=1)continue;
  11460. str+="加挑: ";
  11461. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11462. str+="\r\n";
  11463. }
  11464. str.TrimRight ("\r\n");
  11465. str.TrimRight (" ");
  11466. AutoDraw(m_Print, StrRect, str, 1.4);
  11467. }
  11468. ///////////////////////////////////////////////////////////
  11469. StrRect=load.m_rcarray .ElementAt (14);
  11470. StrRect.top +=2*122;
  11471. StrRect.bottom +=2*122;
  11472. str="选\r\n样";
  11473. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11474. StrRect.top +=46;
  11475. StrRect.left +=2;
  11476. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11477. m_Print.SetFontFace(10, 1, "宋体");
  11478. StrRect=load.m_rcarray .ElementAt (15);
  11479. StrRect.top +=2*122;
  11480. StrRect.bottom +=2*122;
  11481. str="选片内容:";
  11482. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11483. StrRect.left +=4;
  11484. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11485. StrRect=load.m_rcarray .ElementAt (21);
  11486. StrRect.top +=2*122;
  11487. StrRect.bottom +=2*122;
  11488. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11489. str=" 新人签名:";
  11490. StrRect.left +=2;
  11491. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11492. StrRect=load.m_rcarray .ElementAt (22);
  11493. StrRect.top +=2*122;
  11494. StrRect.bottom +=2*122;
  11495. if(seldlg.m_bChoose)
  11496. {
  11497. if(seldlg.m_bFrame)
  11498. str="未付款:"+m_money3;
  11499. else
  11500. str=" "+m_money3;
  11501. }
  11502. else
  11503. {
  11504. if(seldlg.m_bFrame)
  11505. str="未付款:";
  11506. else
  11507. str=" ";
  11508. }
  11509. StrRect.left +=2;
  11510. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11511. StrRect=load.m_rcarray .ElementAt (23);
  11512. StrRect.top +=2*122;
  11513. StrRect.bottom +=2*122;
  11514. str="结婚秘书:";
  11515. StrRect.left +=2;
  11516. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11517. StrRect=load.m_rcarray .ElementAt (24);
  11518. StrRect.top +=2*122;
  11519. StrRect.bottom +=2*122;
  11520. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11521. if(seldlg.m_bChoose)
  11522. {
  11523. StrRect.left +=3;
  11524. StrRect.top +=3;
  11525. StrRect.right -=2;
  11526. StrRect.bottom -=2;
  11527. str="";
  11528. for(i=0; i<bukuan2array.GetSize (); i++)
  11529. {
  11530. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=2)continue;
  11531. str+="加挑: ";
  11532. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11533. str+="\r\n";
  11534. }
  11535. str.TrimRight ("\r\n");
  11536. str.TrimRight (" ");
  11537. AutoDraw(m_Print, StrRect, str, 1.4);
  11538. }
  11539. ///////////////////////////////////////////////////////////
  11540. StrRect=load.m_rcarray .ElementAt (14);
  11541. StrRect.top +=3*122;
  11542. StrRect.bottom +=3*122;
  11543. str="结\r\n婚";
  11544. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11545. StrRect.top +=46;
  11546. StrRect.left +=2;
  11547. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11548. m_Print.SetFontFace(10, 1, "宋体");
  11549. StrRect=load.m_rcarray .ElementAt (15);
  11550. StrRect.top +=3*122;
  11551. StrRect.bottom +=3*122;
  11552. str="结婚内容: 区 白 晚 押金:";
  11553. if(seldlg.m_bFrame) m_Print.DrawRect2(StrRect, 1);
  11554. StrRect.left +=4;
  11555. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11556. StrRect=load.m_rcarray .ElementAt (21);
  11557. StrRect.top +=3*122;
  11558. StrRect.bottom +=3*122;
  11559. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11560. str=" 新人签名:";
  11561. StrRect.left +=2;
  11562. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11563. StrRect=load.m_rcarray .ElementAt (22);
  11564. StrRect.top +=3*122;
  11565. StrRect.bottom +=3*122;
  11566. if(seldlg.m_bBooking)
  11567. {
  11568. if(seldlg.m_bFrame)
  11569. str="未付款:"+m_money3;
  11570. else
  11571. str=" "+m_money3;
  11572. }
  11573. else
  11574. {
  11575. if(seldlg.m_bFrame)
  11576. str="未付款:";
  11577. else
  11578. str=" ";
  11579. }
  11580. StrRect.left +=2;
  11581. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11582. StrRect=load.m_rcarray .ElementAt (23);
  11583. StrRect.top +=3*122;
  11584. StrRect.bottom +=3*122;
  11585. str="结婚秘书:";
  11586. StrRect.left +=2;
  11587. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11588. StrRect=load.m_rcarray .ElementAt (24);
  11589. StrRect.top +=3*122;
  11590. StrRect.bottom +=3*122;
  11591. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11592. if(seldlg.m_bBooking)
  11593. {
  11594. StrRect.left +=3;
  11595. StrRect.top +=3;
  11596. StrRect.right -=2;
  11597. StrRect.bottom -=2;
  11598. realpos=0;str="";
  11599. for(i=0; i<sparray.GetSize (); i++)
  11600. {
  11601. if(atoi(sparray.ElementAt (i).ElementAt (4))!=2)continue;
  11602. str+=sparray.ElementAt (i).ElementAt (5);
  11603. str+=" 数量:";
  11604. str+=sparray.ElementAt (i).ElementAt (3);
  11605. if(realpos%2)
  11606. str+="\r\n";
  11607. else
  11608. str+=" ";
  11609. realpos++;
  11610. }
  11611. str.TrimRight ("\r\n");
  11612. str.TrimRight (" ");
  11613. AutoDraw(m_Print, StrRect, str, 1.4);
  11614. }
  11615. ///////////////////////////////////////
  11616. strarray.RemoveAll ();
  11617. if(seldlg.m_bFrame)
  11618. {
  11619. strarray.Add ("项目");
  11620. strarray.Add ("万");
  11621. strarray.Add ("千");
  11622. strarray.Add ("百");
  11623. strarray.Add ("十");
  11624. strarray.Add ("个");
  11625. strarray.Add ("收 银");
  11626. }
  11627. else
  11628. {
  11629. strarray.Add ("");
  11630. strarray.Add ("");
  11631. strarray.Add ("");
  11632. strarray.Add ("");
  11633. strarray.Add ("");
  11634. strarray.Add ("");
  11635. strarray.Add ("");
  11636. }
  11637. CStringArray strarray2;
  11638. float ftotal=0;
  11639. int realcount=0;
  11640. if(seldlg.m_bBooking)
  11641. {
  11642. for(i=0; i<bukuanarray.GetSize (); i++)
  11643. {
  11644. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=3 && atoi(bukuanarray.ElementAt (i).ElementAt (6))!=4)continue;
  11645. realcount++;
  11646. if(realcount>6)break;
  11647. str=bukuanarray.ElementAt (i).ElementAt (1);
  11648. ftotal+=atof(str);
  11649. strarray2.Add (GetW(str));
  11650. strarray2.Add (GetK(str));
  11651. strarray2.Add (GetB(str));
  11652. strarray2.Add (GetS(str));
  11653. strarray2.Add (GetG(str));
  11654. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11655. }
  11656. }
  11657. while(strarray2.GetSize ()<36)
  11658. strarray2.Add ("");
  11659. str.Format ("%f", ftotal);
  11660. strarray2.Add (GetW(str));
  11661. strarray2.Add (GetK(str));
  11662. strarray2.Add (GetB(str));
  11663. strarray2.Add (GetS(str));
  11664. strarray2.Add (GetG(str));
  11665. strarray2.Add ("");
  11666. //拍照
  11667. ftotal=0;
  11668. realcount=0;
  11669. if(seldlg.m_bTake)
  11670. {
  11671. for(i=0; i<bukuanarray.GetSize (); i++)
  11672. {
  11673. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=1)continue;
  11674. realcount++;
  11675. if(realcount>6)break;
  11676. str=bukuanarray.ElementAt (i).ElementAt (1);
  11677. ftotal+=atof(str);
  11678. strarray2.Add (GetW(str));
  11679. strarray2.Add (GetK(str));
  11680. strarray2.Add (GetB(str));
  11681. strarray2.Add (GetS(str));
  11682. strarray2.Add (GetG(str));
  11683. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11684. }
  11685. }
  11686. while(strarray2.GetSize ()<42+36)
  11687. strarray2.Add ("");
  11688. str.Format ("%f", ftotal);
  11689. strarray2.Add (GetW(str));
  11690. strarray2.Add (GetK(str));
  11691. strarray2.Add (GetB(str));
  11692. strarray2.Add (GetS(str));
  11693. strarray2.Add (GetG(str));
  11694. strarray2.Add ("");
  11695. //选片
  11696. ftotal=0;
  11697. realcount=0;
  11698. if(seldlg.m_bChoose)
  11699. {
  11700. for(i=0; i<bukuanarray.GetSize (); i++)
  11701. {
  11702. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=2)continue;
  11703. realcount++;
  11704. if(realcount>6)break;
  11705. str=bukuanarray.ElementAt (i).ElementAt (1);
  11706. ftotal+=atof(str);
  11707. strarray2.Add (GetW(str));
  11708. strarray2.Add (GetK(str));
  11709. strarray2.Add (GetB(str));
  11710. strarray2.Add (GetS(str));
  11711. strarray2.Add (GetG(str));
  11712. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11713. }
  11714. }
  11715. while(strarray2.GetSize ()<42*2+36)
  11716. strarray2.Add ("");
  11717. str.Format ("%f", ftotal);
  11718. strarray2.Add (GetW(str));
  11719. strarray2.Add (GetK(str));
  11720. strarray2.Add (GetB(str));
  11721. strarray2.Add (GetS(str));
  11722. strarray2.Add (GetG(str));
  11723. strarray2.Add ("");
  11724. /////////////////////////////
  11725. CRect temprc;
  11726. for(int n=0; n<4; n++)
  11727. {
  11728. StrRect=load.m_rcarray .ElementAt (17);
  11729. StrRect.top +=n*122;
  11730. StrRect.bottom +=n*122;
  11731. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11732. StrRect=load.m_rcarray .ElementAt (18);
  11733. if(n)
  11734. {
  11735. StrRect.left +=36;
  11736. StrRect.right +=36;
  11737. }
  11738. StrRect.top +=n*122;
  11739. StrRect.bottom +=n*122;
  11740. if(seldlg.m_bFrame)
  11741. str.Format("%d年", tm.GetYear ());
  11742. else
  11743. str.Format("%d ", tm.GetYear ());
  11744. 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))
  11745. {
  11746. if(seldlg.m_bFrame)
  11747. str=" 年";
  11748. else
  11749. str=" ";
  11750. }
  11751. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11752. StrRect=load.m_rcarray .ElementAt (19);
  11753. if(n)
  11754. {
  11755. StrRect.left +=38;
  11756. StrRect.right +=38;
  11757. }
  11758. StrRect.top +=n*122;
  11759. StrRect.bottom +=n*122;
  11760. if(seldlg.m_bFrame)
  11761. str.Format("%02d月", tm.GetMonth ());
  11762. else
  11763. str.Format("%02d ", tm.GetMonth ());
  11764. 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))
  11765. {
  11766. if(seldlg.m_bFrame)
  11767. str=" 月";
  11768. else
  11769. str=" ";
  11770. }
  11771. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11772. StrRect=load.m_rcarray .ElementAt (20);
  11773. if(n)
  11774. {
  11775. StrRect.left +=36;
  11776. StrRect.right +=36;
  11777. }
  11778. StrRect.top +=n*122;
  11779. StrRect.bottom +=n*122;
  11780. if(seldlg.m_bFrame)
  11781. str.Format("%02d日", tm.GetDay ());
  11782. else
  11783. str.Format("%02d ", tm.GetDay ());
  11784. 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))
  11785. {
  11786. if(seldlg.m_bFrame)
  11787. str=" 日";
  11788. else
  11789. str=" ";
  11790. }
  11791. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11792. for(i=26; i<=32; i++)
  11793. {
  11794. StrRect=load.m_rcarray .ElementAt (i-1);
  11795. StrRect.bottom -=14;
  11796. for(int j=0; j<8; j++)
  11797. {
  11798. StrRect.top=StrRect.bottom;
  11799. if(j>2)
  11800. {
  11801. StrRect.bottom =StrRect.top+14;
  11802. }
  11803. else
  11804. {
  11805. StrRect.bottom =StrRect.top+13;
  11806. }
  11807. temprc=StrRect;
  11808. StrRect.top +=n*122;
  11809. StrRect.bottom +=n*122;
  11810. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11811. if(i==26 && j==4 && seldlg.m_bFrame)
  11812. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11813. else if(i==26 && j==5 && seldlg.m_bFrame)
  11814. m_Print.DrawText((LPTSTR)(LPCTSTR)"付款", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11815. else if(i==26 && j==7 && seldlg.m_bFrame)
  11816. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11817. else if(j==0)
  11818. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-26), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11819. else if(j && i>26 && n<3)
  11820. {
  11821. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray2.ElementAt ((j-1)*6+(i-27)+n*42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11822. }
  11823. StrRect=temprc;
  11824. }
  11825. }
  11826. }
  11827. if(seldlg.m_bFrame)
  11828. {
  11829. StrRect=load.m_rcarray .ElementAt (32);
  11830. str="注\r\n意\r\n事\r\n项";
  11831. StrRect.top +=367;
  11832. StrRect.bottom +=367;
  11833. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11834. StrRect.top +=17;
  11835. StrRect.left +=2;
  11836. AutoDraw(m_Print, StrRect, str, 1.4);
  11837. StrRect=load.m_rcarray .ElementAt (33);
  11838. str="1: 本预约单自预定日期起一年内有效.定金在拍照套系金额中扣出.预定金一概不退\r\n\
  11839. 2: 多拍照片只供筛选.恕不奉送.版权所有.不得私自拷贝\r\n\
  11840. 3: 拍照款请于拍照时一次付清\r\n\
  11841. 4: 新娘装AM8:00前钟点费另计.婚纱礼服出租押金500-2000元\r\n\
  11842. 5: 本公司设有豪华VIP礼服区.及皇家御用礼服展区.但需另外加价.详情请咨本店人员\r\n\
  11843. 6: 安瓶, 美甲一次性化妆用具等均属增值服务部分,则需另外加价,详情咨询本店工作人员\r\n\
  11844. 7: 本电脑机械故障导致文件资料丢失.本公司只提供补拍服务\r\n\
  11845. 8: 每次前来请务必携带本单交给工作人员.本单是您在摩登新娘拍照的凭证.办理有关手续凭本单办理盖\r\n\
  11846. 章后方可生效";
  11847. StrRect.top +=367;
  11848. StrRect.bottom +=367;
  11849. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11850. StrRect.top +=4;
  11851. StrRect.left +=2;
  11852. AutoDraw(m_Print, StrRect, str, 1.0);
  11853. StrRect=load.m_rcarray .ElementAt (34);
  11854. 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)";
  11855. AutoDraw(m_Print, StrRect, str, 1.0);
  11856. m_Print.SetFontFace(13, 1, "宋体");
  11857. StrRect=load.m_rcarray .ElementAt (35);
  11858. str="地 址: 汉口 . 解放大道 . 头道街东部购物公园C栋二,三层";
  11859. StrRect.top +=367;
  11860. StrRect.bottom +=367;
  11861. StrRect.left +=2;
  11862. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11863. StrRect=load.m_rcarray .ElementAt (36);
  11864. str="喜讯热线: 027-81888799 81888599 81888699";
  11865. StrRect.top +=367;
  11866. StrRect.bottom +=367;
  11867. StrRect.left +=2;
  11868. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11869. }
  11870. PrintPreview dlg;
  11871. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  11872. dlg.m_pDC =m_Print.GetPDC() ;
  11873. if(dlg.DoModal ()!=IDOK)return;
  11874. //结束打印
  11875. m_Print.EndPage();
  11876. m_Print.EndPrint();
  11877. #endif
  11878. }
  11879. extern CString GetHMoney(CString str);
  11880. void CMainFrame::PrintReceipt3(CString strOrderNumber, CStringArray *pArray, float money)
  11881. {
  11882. int printcot = 1;
  11883. for (int aa = 0; aa < printcot; aa++)
  11884. {
  11885. g_sendhead.bsql = 0;
  11886. g_sendhead.code[0] = 24;
  11887. g_sendhead.tabcount = 1;
  11888. int g_nYearposTemp = g_nYearpos;
  11889. g_nYearpos = -1;
  11890. g_pMainWnd->ProcessChatMessageRequest2(1);
  11891. g_nYearpos = g_nYearposTemp;
  11892. if (0 == g_bSendOK)return;
  11893. DataToArray(&g_cominfoarray);
  11894. CString SerialNo;
  11895. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  11896. CPrintRX m_Print;
  11897. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  11898. {
  11899. m_Print.InitToPrint(NULL, 1);
  11900. }
  11901. else
  11902. {
  11903. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  11904. if (name.IsEmpty())
  11905. m_Print.InitToPrint(NULL, 1);
  11906. else
  11907. {
  11908. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  11909. if (nret == -1 && aa == 0)
  11910. {
  11911. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  11912. }
  11913. }
  11914. }
  11915. m_Print.StartPrint();
  11916. m_Print.StartPage();
  11917. LoadRect load;
  11918. load.SetLiaPath("15.lia");
  11919. load.SetMargins(0, 0);
  11920. if (!load.Load())return;
  11921. int i;
  11922. //////////////////////////////////////////////////////////////
  11923. CStringArray txarray;
  11924. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  11925. g_sendhead.code[0] = 11;
  11926. g_sendhead.code[1] = 52;
  11927. g_sendhead.tabcount = 2;
  11928. g_sendhead.bsql = 0;
  11929. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  11930. CArray<CStringArray, CStringArray>sparray;
  11931. CArray<CStringArray, CStringArray>clientarray;
  11932. DataToArray(&g_List1array, &clientarray);
  11933. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  11934. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  11935. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  11936. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  11937. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  11938. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  11939. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  11940. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  11941. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  11942. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  11943. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  11944. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  11945. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  11946. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  11947. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  11948. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  11949. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  11950. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  11951. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  11952. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  11953. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  11954. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  11955. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  11956. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  11957. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  11958. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  11959. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  11960. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  11961. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  11962. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  11963. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  11964. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  11965. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  11966. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  11967. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  11968. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  11969. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  11970. CString m_addr = m_addr1 + ";";
  11971. m_addr.TrimLeft(";");
  11972. m_addr += m_addr2;
  11973. CString m_qq = m_qq1 + ";";
  11974. m_qq.TrimLeft(";");
  11975. m_qq += m_qq2;
  11976. m_money1.Format("%f", atof(m_taoxijiage));
  11977. m_money2.Format("%f", atof(m_payed1));
  11978. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  11979. ConvertToPrice(m_money1);
  11980. ConvertToPrice(m_money2);
  11981. ConvertToPrice(m_money3);
  11982. ////////////////////////////////////////////////////////////////
  11983. int rcpos = -1;
  11984. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  11985. m_Print.SetFontFace(17, 1, "宋体");
  11986. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11987. StrRect.top -= 0;
  11988. StrRect.bottom -= 10;
  11989. StrRect.left -= 140;
  11990. StrRect.right = StrRect.left + 48;
  11991. m_Print.SetFontFace(15, 1, "宋体");
  11992. m_Print.SetColor(0xffffff);
  11993. m_Print.DrawRect(StrRect, 0);
  11994. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11995. StrRect.left = StrRect.right;
  11996. StrRect.right = StrRect.left + 48;
  11997. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  11998. m_Print.SetColor(0, RGB(255, 0, 0));
  11999. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12000. m_Print.SetColor(0);
  12001. m_Print.SetFontFace(12, 1, "宋体");
  12002. StrRect.left -= 48;
  12003. int hei = StrRect.Height();
  12004. StrRect.top = StrRect.bottom + 2;
  12005. StrRect.bottom += hei + 2;
  12006. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12007. StrRect.top = StrRect.bottom - 2;
  12008. StrRect.bottom += hei - 5;
  12009. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12010. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12011. m_Print.SetFontFace(12, 1, "宋体");
  12012. m_Print.DrawText((LPTSTR)(LPCTSTR)"收款单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12013. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12014. m_Print.SetFontFace(9, 1, "宋体");
  12015. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12016. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12017. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12018. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12019. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12020. m_Print.DrawRect2(StrRect, 2);
  12021. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12022. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12023. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12024. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12025. m_Print.DrawRect2(StrRect, 2);
  12026. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12027. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12028. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12029. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12030. m_Print.DrawRect2(StrRect, 2);
  12031. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12032. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约地点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12033. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12034. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12035. m_Print.DrawRect2(StrRect, 2);
  12036. ////////////
  12037. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12038. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12039. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12040. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12041. m_Print.DrawRect2(StrRect, 2);
  12042. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12043. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12044. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12045. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12046. m_Print.DrawRect2(StrRect, 2);
  12047. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12048. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12049. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12050. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12051. m_Print.DrawRect2(StrRect, 2);
  12052. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12053. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12054. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12055. m_Print.DrawText((LPTSTR)(LPCTSTR)g_date, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12056. m_Print.DrawRect2(StrRect, 2);
  12057. for (i = 19; i < 49; i++)
  12058. {
  12059. if (i >= 44)
  12060. {
  12061. StrRect = load.m_rcarray.ElementAt(i - 5);
  12062. int hei = StrRect.Height();
  12063. StrRect.top += hei;
  12064. StrRect.bottom += hei;
  12065. }
  12066. else
  12067. StrRect = load.m_rcarray.ElementAt(i);
  12068. m_Print.DrawRect2(StrRect, 1);
  12069. }
  12070. float fmoney = 0;
  12071. for (i = 19; i < 49; i++)
  12072. {
  12073. if (i >= 44)
  12074. {
  12075. StrRect = load.m_rcarray.ElementAt(i - 5);
  12076. int hei = StrRect.Height();
  12077. StrRect.top += hei;
  12078. StrRect.bottom += hei;
  12079. }
  12080. else
  12081. StrRect = load.m_rcarray.ElementAt(i);
  12082. StrRect.left += 2;
  12083. /* if((i-19)%5==2)
  12084. {
  12085. fmoney+=atof(pArray->ElementAt (i-19));
  12086. }*/
  12087. m_Print.DrawText((LPTSTR)(LPCTSTR)(pArray->ElementAt(i - 19)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12088. }
  12089. m_money2.Format("%f", money);
  12090. ConvertToPrice(m_money2);
  12091. StrRect = load.m_rcarray.ElementAt(44);
  12092. CString str;
  12093. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 实收¥: %s 元 收银员: %s", \
  12094. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  12095. m_money2, g_user.name);
  12096. m_Print.DrawRect2(StrRect, 1);
  12097. StrRect.left += 3;
  12098. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12099. StrRect = load.m_rcarray.ElementAt(46);
  12100. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12101. StrRect = load.m_rcarray.ElementAt(47);
  12102. m_Print.DrawRect2(StrRect, 2);
  12103. StrRect = load.m_rcarray.ElementAt(48);
  12104. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12105. StrRect = load.m_rcarray.ElementAt(45);
  12106. str = "\
  12107. 顾客须知\r\n\
  12108. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  12109. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  12110. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  12111. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  12112. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  12113. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  12114. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  12115. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12116. AutoDraw(m_Print, StrRect, str, 1.8);
  12117. PrintPreview dlg;
  12118. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12119. dlg.m_pDC = m_Print.GetPDC();
  12120. if (aa == 0)
  12121. {
  12122. if (dlg.DoModal() != IDOK)
  12123. return;
  12124. printcot = dlg.m_num;
  12125. }
  12126. //结束打印
  12127. m_Print.EndPage();
  12128. m_Print.EndPrint();
  12129. }
  12130. }
  12131. void CMainFrame::PrintReceipt2(CString strOrderNumber)
  12132. {
  12133. int printcot = 1;
  12134. for (int aa = 0; aa < printcot; aa++)
  12135. {
  12136. g_sendhead.bsql = 0;
  12137. g_sendhead.code[0] = 24;
  12138. g_sendhead.tabcount = 1;
  12139. int g_nYearposTemp = g_nYearpos;
  12140. g_nYearpos = -1;
  12141. g_pMainWnd->ProcessChatMessageRequest2(1);
  12142. g_nYearpos = g_nYearposTemp;
  12143. if (0 == g_bSendOK)return;
  12144. DataToArray(&g_cominfoarray);
  12145. CString SerialNo;
  12146. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  12147. CPrintRX m_Print;
  12148. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12149. {
  12150. m_Print.InitToPrint(NULL, 1);
  12151. }
  12152. else
  12153. {
  12154. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  12155. if (name.IsEmpty())
  12156. m_Print.InitToPrint(NULL, 1);
  12157. else
  12158. {
  12159. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12160. if (nret == -1 && aa == 0)
  12161. {
  12162. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12163. }
  12164. }
  12165. }
  12166. m_Print.StartPrint();
  12167. m_Print.StartPage();
  12168. LoadRect load;
  12169. load.SetLiaPath("14.lia");
  12170. load.SetMargins(0, 0);
  12171. if (!load.Load())return;
  12172. int i;
  12173. //////////////////////////////////////////////////////////////
  12174. CStringArray txarray;
  12175. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  12176. g_sendhead.code[0] = 11;
  12177. g_sendhead.code[1] = 52;
  12178. g_sendhead.code[2] = 93;
  12179. g_sendhead.tabcount = 3;
  12180. g_sendhead.bsql = 0;
  12181. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12182. CArray<CStringArray, CStringArray>sparray;
  12183. CArray<CStringArray, CStringArray>clientarray;
  12184. CArray<CStringArray, CStringArray>moneyarray;
  12185. DataToArray(&g_List1array, &clientarray, &moneyarray);
  12186. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12187. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12188. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12189. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12190. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12191. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  12192. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12193. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12194. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12195. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12196. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12197. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12198. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12199. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12200. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12201. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12202. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12203. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12204. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12205. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12206. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12207. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12208. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12209. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12210. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12211. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12212. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12213. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12214. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  12215. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12216. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12217. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  12218. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  12219. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  12220. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  12221. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  12222. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  12223. CString m_addr = m_addr1 + ";";
  12224. m_addr.TrimLeft(";");
  12225. m_addr += m_addr2;
  12226. CString m_qq = m_qq1 + ";";
  12227. m_qq.TrimLeft(";");
  12228. m_qq += m_qq2;
  12229. m_money1.Format("%f", atof(m_taoxijiage));
  12230. m_money2 = "0";
  12231. for (i = 0; i < moneyarray.GetSize(); i++)
  12232. {
  12233. if (moneyarray.ElementAt(i).ElementAt(5) == "预约收款")
  12234. m_money2 = moneyarray.ElementAt(i).ElementAt(1);
  12235. }
  12236. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  12237. ConvertToPrice(m_money1);
  12238. ConvertToPrice(m_money2);
  12239. ConvertToPrice(m_money3);
  12240. ////////////////////////////////////////////////////////////////
  12241. int rcpos = -1;
  12242. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12243. m_Print.SetFontFace(17, 1, "宋体");
  12244. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12245. StrRect.top -= 0;
  12246. StrRect.bottom -= 10;
  12247. StrRect.left -= 140;
  12248. StrRect.right = StrRect.left + 48;
  12249. m_Print.SetFontFace(15, 1, "宋体");
  12250. m_Print.SetColor(0xffffff);
  12251. m_Print.DrawRect(StrRect, 0);
  12252. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12253. StrRect.left = StrRect.right;
  12254. StrRect.right = StrRect.left + 48;
  12255. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12256. m_Print.SetColor(0, RGB(255, 0, 0));
  12257. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12258. m_Print.SetColor(0);
  12259. m_Print.SetFontFace(12, 1, "宋体");
  12260. StrRect.left -= 48;
  12261. int hei = StrRect.Height();
  12262. StrRect.top = StrRect.bottom + 2;
  12263. StrRect.bottom += hei + 2;
  12264. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12265. StrRect.top = StrRect.bottom - 2;
  12266. StrRect.bottom += hei - 5;
  12267. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12268. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12269. m_Print.SetFontFace(12, 1, "宋体");
  12270. m_Print.DrawText((LPTSTR)(LPCTSTR)"定金单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12271. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12272. m_Print.SetFontFace(9, 1, "宋体");
  12273. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12274. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12275. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12276. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12277. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12278. m_Print.DrawRect2(StrRect, 2);
  12279. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12280. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12281. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12282. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12283. m_Print.DrawRect2(StrRect, 2);
  12284. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12285. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12286. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12287. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12288. m_Print.DrawRect2(StrRect, 2);
  12289. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12290. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约地点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12291. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12292. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12293. m_Print.DrawRect2(StrRect, 2);
  12294. ////////////
  12295. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12296. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12297. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12298. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12299. m_Print.DrawRect2(StrRect, 2);
  12300. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12301. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12302. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12303. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12304. m_Print.DrawRect2(StrRect, 2);
  12305. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12306. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12307. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12308. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12309. m_Print.DrawRect2(StrRect, 2);
  12310. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12311. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12312. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12313. m_Print.DrawText((LPTSTR)(LPCTSTR)g_date, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12314. m_Print.DrawRect2(StrRect, 2);
  12315. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12316. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客地址:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12317. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12318. m_Print.DrawText((LPTSTR)(LPCTSTR)m_addr, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12319. m_Print.DrawRect2(StrRect, 2);
  12320. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12321. m_Print.DrawText((LPTSTR)(LPCTSTR)"大婚时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12322. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12323. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12324. m_Print.DrawRect2(StrRect, 2);
  12325. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12326. m_Print.DrawText((LPTSTR)(LPCTSTR)"QQ/MSN:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12327. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12328. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12329. m_Print.DrawRect2(StrRect, 2);
  12330. CStringArray strarray;
  12331. strarray.Add("套系名称");
  12332. strarray.Add("总 额");
  12333. strarray.Add("定 金");
  12334. strarray.Add("余 款");
  12335. strarray.Add("摄影日期");
  12336. strarray.Add(m_taoxiname);
  12337. strarray.Add(m_money1);
  12338. strarray.Add(m_money2);
  12339. strarray.Add(m_money3);
  12340. strarray.Add(m_time2);
  12341. for (i = 25; i < 37; i++)
  12342. {
  12343. StrRect = load.m_rcarray.ElementAt(i);
  12344. m_Print.DrawRect2(StrRect, 1);
  12345. }
  12346. for (i = 25; i < 35; i++)
  12347. {
  12348. StrRect = load.m_rcarray.ElementAt(i);
  12349. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 25), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12350. }
  12351. StrRect = load.m_rcarray.ElementAt(35);
  12352. StrRect.left += 5;
  12353. StrRect.top += 5;
  12354. m_Print.DrawText((LPTSTR)(LPCTSTR)" 备 注:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  12355. StrRect = load.m_rcarray.ElementAt(36);
  12356. CString str;
  12357. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 ¥: %s 元 收银员: %s", \
  12358. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  12359. m_money2, g_user.name);
  12360. StrRect.left += 3;
  12361. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12362. StrRect = load.m_rcarray.ElementAt(38);
  12363. m_Print.DrawText((LPTSTR)(LPCTSTR)"营业员:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12364. StrRect = load.m_rcarray.ElementAt(39);
  12365. m_Print.DrawText((LPTSTR)(LPCTSTR)m_ren, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12366. m_Print.DrawRect2(StrRect, 2);
  12367. StrRect = load.m_rcarray.ElementAt(40);
  12368. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12369. StrRect = load.m_rcarray.ElementAt(41);
  12370. m_Print.DrawRect2(StrRect, 2);
  12371. StrRect = load.m_rcarray.ElementAt(42);
  12372. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12373. StrRect = load.m_rcarray.ElementAt(37);
  12374. str = "\
  12375. 顾客须知\r\n\
  12376. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  12377. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  12378. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  12379. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  12380. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  12381. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  12382. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  12383. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12384. AutoDraw(m_Print, StrRect, str, 1.8);
  12385. PrintPreview dlg;
  12386. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12387. dlg.m_pDC = m_Print.GetPDC();
  12388. if (aa == 0)
  12389. {
  12390. if (dlg.DoModal() != IDOK)
  12391. return;
  12392. printcot = dlg.m_num;
  12393. }
  12394. //结束打印
  12395. m_Print.EndPage();
  12396. m_Print.EndPrint();
  12397. }
  12398. }
  12399. void CMainFrame::OnAutodelphoto()
  12400. {
  12401. // TODO: Add your command handler code here
  12402. if (g_user.bLongin == 0)
  12403. {
  12404. if (g_bNoLoginLia)
  12405. {
  12406. Login dlg;
  12407. dlg.SetLiaPath("5.lia");
  12408. dlg.DoModal();
  12409. }
  12410. else
  12411. {
  12412. Login3 dlg;
  12413. dlg.SetLiaPath("5.lia");
  12414. dlg.DoModal();
  12415. }
  12416. if (g_user.bLongin == 0)return;
  12417. }
  12418. if (IsHasRightsnew(49) == 0)return;
  12419. DelPhotoSet dlg;
  12420. dlg.DoModal();
  12421. }
  12422. void CMainFrame::Onphotomanage() // 客照管理中心;
  12423. {
  12424. if (g_user.bLongin == 0)
  12425. {
  12426. if (g_bNoLoginLia)
  12427. {
  12428. Login dlg;
  12429. dlg.SetLiaPath("5.lia");
  12430. dlg.DoModal();
  12431. }
  12432. else
  12433. {
  12434. Login3 dlg;
  12435. dlg.SetLiaPath("5.lia");
  12436. dlg.DoModal();
  12437. }
  12438. if (g_user.bLongin == 0)return;
  12439. }
  12440. if (IsHasRightsnew(49) == 0)return;
  12441. ShowPic3 dlg;
  12442. dlg.DoModal();
  12443. }
  12444. void CMainFrame::OnCompanyinfo()
  12445. {
  12446. // TODO: Add your command handler code here
  12447. if (g_user.bLongin == 0)
  12448. {
  12449. if (g_bNoLoginLia)
  12450. {
  12451. Login dlg;
  12452. dlg.SetLiaPath("5.lia");
  12453. dlg.DoModal();
  12454. }
  12455. else
  12456. {
  12457. Login3 dlg;
  12458. dlg.SetLiaPath("5.lia");
  12459. dlg.DoModal();
  12460. }
  12461. if (g_user.bLongin == 0)return;
  12462. }
  12463. if (IsHasRightsnew(49) == 0)return;
  12464. CompanyInfo dlg;
  12465. dlg.DoModal();
  12466. }
  12467. void CMainFrame::OnTaoxifg()
  12468. {
  12469. // TODO: Add your command handler code here
  12470. if (g_user.bLongin == 0)
  12471. {
  12472. if (g_bNoLoginLia)
  12473. {
  12474. Login dlg;
  12475. dlg.SetLiaPath("5.lia");
  12476. dlg.DoModal();
  12477. }
  12478. else
  12479. {
  12480. Login3 dlg;
  12481. dlg.SetLiaPath("5.lia");
  12482. dlg.DoModal();
  12483. }
  12484. if (g_user.bLongin == 0)return;
  12485. }
  12486. if (IsHasRightsnew(49) == 0)return;
  12487. TXFG dlg;
  12488. dlg.DoModal();
  12489. }
  12490. void CMainFrame::OnHelpfile()
  12491. {
  12492. // TODO: Add your command handler code here
  12493. // ShellExecute(NULL, _T("open"), _T(g_mainpath+"\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  12494. // if(::PathFileExists (g_mainpath+"\\zx.dll"))
  12495. // ShellExecute(NULL, _T("open"), _T("www.zcsmkj.com"), "", NULL, SW_SHOWNORMAL);
  12496. // else
  12497. ShellExecute(NULL, _T("open"), _T("www.lyfz.net"), "", NULL, SW_SHOWNORMAL);
  12498. }
  12499. void CMainFrame::OnPhotobak()
  12500. {
  12501. // TODO: Add your command handler code here
  12502. if (g_user.bLongin == 0)
  12503. {
  12504. if (g_bNoLoginLia)
  12505. {
  12506. Login dlg;
  12507. dlg.SetLiaPath("5.lia");
  12508. dlg.DoModal();
  12509. }
  12510. else
  12511. {
  12512. Login3 dlg;
  12513. dlg.SetLiaPath("5.lia");
  12514. dlg.DoModal();
  12515. }
  12516. if (g_user.bLongin == 0)return;
  12517. }
  12518. if (IsHasRightsnew(49) == 0)return;
  12519. PhotoBak dlg;
  12520. dlg.DoModal();
  12521. }
  12522. //客户报表
  12523. void CMainFrame::OnClose2()
  12524. { // TODO: Add your message handler code here and/or call default
  12525. if (AfxMessageBox("是否退出系统?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  12526. if(g_user.bLongin)
  12527. WriteLog("退出系统!", "退出系统!");
  12528. g_bShowBar = 0;
  12529. if (m_Mdi.MainClose())
  12530. CMDIFrameWnd::OnClose();
  12531. }
  12532. //
  12533. void CMainFrame::ResetTimer()
  12534. {
  12535. }
  12536. void CMainFrame::LinkClick(CString str, int nParent)
  12537. {
  12538. g_pMainWnd2->m_bar.LinkClick(str);
  12539. }
  12540. void CMainFrame::PrintFlowChart2(CString m_id)
  12541. {
  12542. CPrintRX m_Print;
  12543. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12544. {
  12545. m_Print.InitToPrint(NULL, 1);
  12546. }
  12547. else
  12548. {
  12549. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  12550. if (name.IsEmpty())
  12551. m_Print.InitToPrint(NULL, 1);
  12552. else
  12553. {
  12554. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12555. if (nret == -1)
  12556. {
  12557. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12558. }
  12559. }
  12560. }
  12561. m_Print.StartPrint();
  12562. m_Print.StartPage();
  12563. LoadRect load;
  12564. load.SetLiaPath("16.lia");
  12565. load.SetMargins(0, 0);
  12566. if (!load.Load())return;
  12567. LoadRect load2;
  12568. load2.SetLiaPath("17.lia");
  12569. load2.SetMargins(0, 660);
  12570. if (!load2.Load())return;
  12571. int i;
  12572. //////////////////////////////////////////////////////////////
  12573. CStringArray txarray;
  12574. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and kind<>'2'";
  12575. g_sendhead.code[0] = 11;
  12576. g_sendhead.code[1] = 52;
  12577. g_sendhead.code[2] = 223;
  12578. g_sendhead.tabcount = 3;
  12579. g_sendhead.bsql = 0;
  12580. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12581. CArray<CStringArray, CStringArray>sparray;
  12582. CArray<CStringArray, CStringArray>clientarray;
  12583. DataToArray(&g_List1array, &clientarray, &sparray);
  12584. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12585. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12586. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12587. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12588. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12589. CString m_photocount = g_List1array.ElementAt(0).ElementAt(9);
  12590. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12591. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12592. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12593. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12594. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12595. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12596. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12597. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12598. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12599. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12600. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12601. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12602. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12603. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12604. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12605. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12606. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12607. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12608. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12609. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12610. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12611. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12612. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(39) + g_List1array.ElementAt(0).ElementAt(75);
  12613. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12614. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12615. CString spno;
  12616. for (i = 0; i < sparray.GetSize(); i++)
  12617. {
  12618. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  12619. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  12620. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  12621. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12622. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12623. spno += sparray.ElementAt(i).ElementAt(5);
  12624. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12625. spno += "; ";
  12626. else
  12627. {
  12628. spno += ":";
  12629. spno += sparray.ElementAt(i).ElementAt(6);
  12630. spno += "; ";
  12631. }
  12632. }
  12633. spno += " 加挑:";
  12634. for (i = 0; i < sparray.GetSize(); i++)
  12635. {
  12636. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  12637. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  12638. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  12639. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12640. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12641. spno += sparray.ElementAt(i).ElementAt(5);
  12642. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12643. spno += "; ";
  12644. else
  12645. {
  12646. spno += ":";
  12647. spno += sparray.ElementAt(i).ElementAt(6);
  12648. spno += "; ";
  12649. }
  12650. }
  12651. if (spno.Right(6) == " 加挑:")
  12652. {
  12653. spno = spno.Left(spno.GetLength() - 6);
  12654. }
  12655. ////////////////////////////////////////////////////////////////
  12656. int rcpos = -1;
  12657. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12658. m_Print.SetFontFace(17, 1, "宋体");
  12659. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12660. StrRect.top -= 0;
  12661. StrRect.bottom -= 10;
  12662. StrRect.left -= 140;
  12663. StrRect.right = StrRect.left + 48;
  12664. m_Print.SetFontFace(15, 1, "宋体");
  12665. m_Print.SetColor(0xffffff);
  12666. m_Print.DrawRect(StrRect, 0);
  12667. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12668. StrRect.left = StrRect.right;
  12669. StrRect.right = StrRect.left + 48;
  12670. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12671. m_Print.SetColor(0, RGB(255, 0, 0));
  12672. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12673. m_Print.SetColor(0);
  12674. m_Print.SetFontFace(12, 1, "宋体");
  12675. StrRect.left -= 48;
  12676. int hei = StrRect.Height();
  12677. StrRect.top = StrRect.bottom + 2;
  12678. StrRect.bottom += hei + 2;
  12679. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12680. StrRect.top = StrRect.bottom - 2;
  12681. StrRect.bottom += hei - 5;
  12682. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12683. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12684. m_Print.SetFontFace(12, 1, "宋体");
  12685. m_Print.DrawText((LPTSTR)(LPCTSTR)"加做取件单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12686. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12687. m_Print.SetFontFace(11, 1, "宋体");
  12688. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + m_id), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12689. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12690. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12691. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12692. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12693. m_Print.DrawRect2(StrRect, 2);
  12694. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12695. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12696. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12697. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12698. m_Print.DrawRect2(StrRect, 2);
  12699. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12700. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12701. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12702. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time4, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12703. m_Print.DrawRect2(StrRect, 2);
  12704. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12705. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12706. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12707. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time5, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12708. m_Print.DrawRect2(StrRect, 2);
  12709. ////////////
  12710. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12711. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12712. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12713. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12714. m_Print.DrawRect2(StrRect, 2);
  12715. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12716. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12717. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12718. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12719. m_Print.DrawRect2(StrRect, 2);
  12720. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12721. m_Print.DrawText((LPTSTR)(LPCTSTR)"赠送张数:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12722. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12723. m_Print.DrawText((LPTSTR)(LPCTSTR)m_photocount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12724. m_Print.DrawRect2(StrRect, 2);
  12725. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12726. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12727. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12728. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12729. m_Print.DrawRect2(StrRect, 2);
  12730. ////////////
  12731. ///////////spno
  12732. CRect sprc[22];
  12733. StrRect = load.m_rcarray.ElementAt(19);
  12734. StrRect.left += 4; StrRect.right -= 3;
  12735. hei = StrRect.Height();
  12736. for (i = 0; i < 22; i++)
  12737. {
  12738. sprc[i] = StrRect;
  12739. m_Print.DrawRect2(StrRect, 1);
  12740. if (i == 0)
  12741. {
  12742. StrRect.left += 5;
  12743. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12744. StrRect.left -= 5;
  12745. }
  12746. StrRect.top = StrRect.bottom;
  12747. StrRect.bottom = StrRect.top + hei;
  12748. sprc[i].left += 4; sprc[i].right -= 3;
  12749. }
  12750. StrRect.bottom = StrRect.top + 60;
  12751. m_Print.DrawRect2(StrRect, 1);
  12752. StrRect.left += 3; StrRect.top += 3;
  12753. StrRect.right -= 3; StrRect.bottom -= 3;
  12754. AutoDraw(m_Print, StrRect, m_bz, 1.8);
  12755. CString temp, tempspno, tempbz;
  12756. CSize size;
  12757. BOOL bRun = 0;
  12758. int fontsize = 12;
  12759. ll: tempspno = spno;
  12760. m_Print.SetFontFace(fontsize, 1, "宋体");
  12761. for (i = 1; i<22; i++)
  12762. {
  12763. if (!tempspno.IsEmpty())
  12764. {
  12765. temp = tempspno;
  12766. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12767. int right = 0;
  12768. CRect temprc = sprc[i];
  12769. while (size.cx>temprc.Width())
  12770. {
  12771. right++;
  12772. temp = tempspno.Left(tempspno.GetLength() - (right));
  12773. if (GIsHalfHZ(temp))
  12774. {
  12775. right++;
  12776. temp.Delete(temp.GetLength() - 1);
  12777. }
  12778. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12779. }
  12780. if (bRun)
  12781. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12782. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  12783. if (tempspno.IsEmpty())i++;
  12784. }
  12785. }
  12786. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  12787. {
  12788. fontsize--;
  12789. goto ll;
  12790. }
  12791. if (bRun == 0)
  12792. {
  12793. bRun = 1;
  12794. goto ll;
  12795. }
  12796. m_Print.SetFontFace(12, 1, "宋体");
  12797. StrRect = load2.m_rcarray.ElementAt(1);
  12798. m_Print.DrawText((LPTSTR)(LPCTSTR)"喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12799. StrRect = load2.m_rcarray.ElementAt(2);
  12800. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12801. StrRect = load2.m_rcarray.ElementAt(3);
  12802. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12803. StrRect = load2.m_rcarray.ElementAt(4);
  12804. m_Print.DrawRect2(StrRect, 2);
  12805. StrRect = load2.m_rcarray.ElementAt(0);
  12806. CString str = "\
  12807. 爱心提示:如对制作有任何要求请清楚列出,所有制作内容一经确认将按要求制作。\r\n\
  12808. 选样文件从拍摄日期计算将保留二个月;套相成品按取件日期保留三个月,逾期不做保留。\r\n\
  12809. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12810. AutoDraw(m_Print, StrRect, str, 1.8);
  12811. PrintPreview dlg; dlg.m_mode = 2;
  12812. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12813. dlg.m_pDC = m_Print.GetPDC();
  12814. if (dlg.DoModal() != IDOK)return;
  12815. //结束打印
  12816. m_Print.EndPage();
  12817. m_Print.EndPrint();
  12818. }
  12819. //分店
  12820. CString CMainFrame::GetDanWei(CString name, CArray<CStringArray, CStringArray>*array)
  12821. {
  12822. for (int i = 0; i < array->GetSize(); i++)
  12823. {
  12824. if (name == array->ElementAt(i).ElementAt(1))
  12825. return array->ElementAt(i).ElementAt(2);
  12826. }
  12827. return "";
  12828. }
  12829. //g_sendhead
  12830. int CMainFrame::GetPort()
  12831. {
  12832. static int aaa = -1;
  12833. if (aaa == -1)
  12834. {
  12835. aaa = CTime::GetCurrentTime().GetSecond() % 7;
  12836. }
  12837. aaa++;
  12838. if (aaa >= 7)aaa = 0;
  12839. return 8387 + aaa;
  12840. }
  12841. void CMainFrame::OnShowBakState()
  12842. {
  12843. // TODO: Add your command handler code here
  12844. g_sendhead.bsql = 0;
  12845. g_sendhead.code[0] = 171;
  12846. g_sendhead.tabcount = 1;
  12847. g_pMainWnd->ProcessChatMessageRequest2(1);
  12848. if (g_bSendOK == 0)
  12849. {
  12850. return;
  12851. }
  12852. CArray<CStringArray, CStringArray>g_bakstatearray;
  12853. DataToArray(&g_bakstatearray);
  12854. while (g_bakstatearray.GetSize() > 7)
  12855. {
  12856. g_bakstatearray.RemoveAt(0);
  12857. }
  12858. int photocount = 0;
  12859. int infocount = 0;
  12860. for (int i = 0; i < g_bakstatearray.GetSize(); i++)
  12861. {
  12862. if (g_bakstatearray.ElementAt(i).ElementAt(1) != "1")photocount++;
  12863. if (g_bakstatearray.ElementAt(i).ElementAt(2) != "1")infocount++;
  12864. }
  12865. ShowBakState dlg;
  12866. dlg.m_pArray = &g_bakstatearray;
  12867. dlg.DoModal();
  12868. }
  12869. void CMainFrame::PrintReceipt2(CStringArray *pArray)
  12870. {
  12871. int i = 0;
  12872. int printcot = 1;
  12873. for (int aa = 0; aa < printcot; aa++)
  12874. {
  12875. g_sendhead.bsql = 0;
  12876. g_sendhead.code[0] = 24;
  12877. g_sendhead.tabcount = 1;
  12878. int g_nYearposTemp = g_nYearpos;
  12879. g_nYearpos = -1;
  12880. g_pMainWnd->ProcessChatMessageRequest2(1);
  12881. g_nYearpos = g_nYearposTemp;
  12882. if (0 == g_bSendOK)return;
  12883. DataToArray(&g_cominfoarray);
  12884. CString SerialNo;
  12885. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  12886. CPrintRX m_Print;
  12887. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12888. {
  12889. m_Print.InitToPrint(NULL, 1);
  12890. }
  12891. else
  12892. {
  12893. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  12894. if (name.IsEmpty())
  12895. m_Print.InitToPrint(NULL, 1);
  12896. else
  12897. {
  12898. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12899. if (nret == -1 && aa == 0)
  12900. {
  12901. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12902. }
  12903. }
  12904. }
  12905. m_Print.StartPrint();
  12906. m_Print.StartPage();
  12907. LoadRect load;
  12908. BOOL bSmall = 0;
  12909. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  12910. {
  12911. bSmall = 1;
  12912. load.SetLiaPath("20.lia");
  12913. }
  12914. else
  12915. load.SetLiaPath("10.lia");
  12916. if (bSmall)
  12917. load.SetMargins(-10, 0);
  12918. else
  12919. load.SetMargins(10, 0);
  12920. if (!load.Load())return;
  12921. int rcpos = -1;
  12922. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12923. Image *pImg = NULL;
  12924. #ifdef MNLS_VERSION
  12925. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  12926. #else
  12927. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  12928. #endif
  12929. // m_Print.DrawImage(pImg, StrRect);
  12930. delete pImg;
  12931. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  12932. {
  12933. Image *pImg = NULL;
  12934. g_nSendCode = 31;
  12935. int g_nYearposTemp = g_nYearpos;
  12936. g_nYearpos = -1;
  12937. g_pMainWnd->ProcessChatMessageRequest2(1);
  12938. g_nYearpos = g_nYearposTemp;
  12939. g_nSendCode = 0;
  12940. if (g_bSendOK == 0)return;
  12941. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  12942. if (pImg)
  12943. {
  12944. StrRect.left = 65;
  12945. if (bSmall)StrRect.left = 55;
  12946. StrRect.top = 10;
  12947. StrRect.right = StrRect.left + 58;
  12948. StrRect.bottom = StrRect.top + 58;
  12949. m_Print.DrawImage(pImg, StrRect);
  12950. delete pImg; pImg = NULL;
  12951. }
  12952. }
  12953. if (bSmall)
  12954. {
  12955. m_Print.SetFontFace(18, 1, "黑体");
  12956. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12957. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12958. m_Print.SetFontFace(9, 1, "宋体");
  12959. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12960. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12961. m_Print.SetFontFace(6, 1, "宋体");
  12962. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12963. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12964. m_Print.SetFontFace(9, 1, "宋体");
  12965. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12966. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12967. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12968. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12969. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12970. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12971. int hei = StrRect.Height();
  12972. StrRect.bottom = StrRect.top;
  12973. StrRect.top -= 8;
  12974. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  12975. m_Print.SetFontFace(10, 1, "宋体");
  12976. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12977. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12978. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12979. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12980. m_Print.SetFontFace(9, 1, "宋体");
  12981. for ( i = 7; i < 24; i++)
  12982. {
  12983. StrRect = load.m_rcarray.ElementAt(i);
  12984. m_Print.DrawRect2(StrRect, 1);
  12985. }
  12986. for (i = 9; i < 24; i++)
  12987. {
  12988. StrRect = load.m_rcarray.ElementAt(i);
  12989. StrRect.left += 2;
  12990. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12991. }
  12992. m_Print.SetFontFace(6, 1, "宋体");
  12993. for (i = 24; i < 26; i++)
  12994. {
  12995. StrRect = load.m_rcarray.ElementAt(i);
  12996. StrRect.left += 2;
  12997. if (i == 24)
  12998. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12999. else
  13000. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13001. }
  13002. }
  13003. else//大单
  13004. {
  13005. m_Print.SetFontFace(20, 1, "黑体");
  13006. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13007. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13008. m_Print.SetFontFace(11, 1, "宋体");
  13009. // StrRect=load.m_rcarray .ElementAt (++rcpos);
  13010. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13011. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15;
  13012. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13013. int hei = StrRect.Height();
  13014. StrRect.bottom = StrRect.top;
  13015. StrRect.top -= 10;
  13016. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  13017. m_Print.SetFontFace(8, 1, "宋体");
  13018. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13019. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13020. m_Print.SetFontFace(11, 1, "宋体");
  13021. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13022. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13023. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13024. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13025. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13026. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13027. m_Print.SetFontFace(13, 1, "宋体");
  13028. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13029. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13030. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13031. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13032. m_Print.SetFontFace(11, 1, "宋体");
  13033. for ( i = 7; i < 24; i++)
  13034. {
  13035. StrRect = load.m_rcarray.ElementAt(i);
  13036. m_Print.DrawRect2(StrRect, 1);
  13037. }
  13038. for (i = 9; i < 24; i++)
  13039. {
  13040. StrRect = load.m_rcarray.ElementAt(i);
  13041. StrRect.left += 2;
  13042. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13043. }
  13044. m_Print.SetFontFace(8, 1, "宋体");
  13045. for (i = 24; i < 27; i++)
  13046. {
  13047. StrRect = load.m_rcarray.ElementAt(i);
  13048. StrRect.left += 2;
  13049. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13050. }
  13051. }
  13052. PrintPreview dlg;
  13053. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13054. dlg.m_pDC = m_Print.GetPDC();
  13055. if (aa == 0)
  13056. {
  13057. if (dlg.DoModal() != IDOK)
  13058. return;
  13059. printcot = dlg.m_num;
  13060. }
  13061. //结束打印
  13062. m_Print.EndPage();
  13063. m_Print.EndPrint();
  13064. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  13065. CString sql;
  13066. sql.Format("update version set [serialno2]='%s'", SerialNo);
  13067. g_sendhead.bsql = 1;
  13068. g_nYearposTemp = g_nYearpos;
  13069. g_nYearpos = -1;
  13070. g_pMainWnd->ProcessChatMessageRequest2(sql);
  13071. g_nYearpos = g_nYearposTemp;
  13072. }
  13073. }
  13074. //出生年月
  13075. //第一联
  13076. void CMainFrame::OnLog()
  13077. {
  13078. // TODO: Add your command handler code here OnShowBakState
  13079. if (IsHasRightsnew(49) == 0)return;
  13080. ShowLOg dlg;
  13081. dlg.DoModal();
  13082. }
  13083. // www.lyfz.net 8888
  13084. void CMainFrame::PrintDinDan6(CString m_id)
  13085. {
  13086. // TODO: Add your control notification handler code here 预约订单
  13087. int printcot = 1;
  13088. for (int aa = 0; aa < printcot; aa++)
  13089. {
  13090. PrintPreview dlg;
  13091. CPrintRX m_Print;
  13092. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13093. {
  13094. m_Print.InitToPrint(NULL, 1);
  13095. }
  13096. else
  13097. {
  13098. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  13099. if (name.IsEmpty())
  13100. m_Print.InitToPrint(NULL, 1);
  13101. else
  13102. {
  13103. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13104. if (nret == -1 && aa == 0)
  13105. {
  13106. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  13107. }
  13108. }
  13109. }
  13110. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  13111. {
  13112. m_Print.StartPrint();
  13113. m_Print.StartPage();
  13114. LoadRect load;
  13115. load.SetLiaPath("6.lia");
  13116. load.SetMargins(-14, 15);
  13117. if (!load.Load())return;
  13118. LoadRect load2;
  13119. load2.SetLiaPath("7.lia");
  13120. load2.SetMargins(-14, 216 + 15);
  13121. if (!load2.Load())return;
  13122. LoadRect load3;
  13123. load3.SetLiaPath("8.lia");
  13124. load3.SetMargins(-14, 705 + 15);
  13125. if (!load3.Load())return;
  13126. int i;
  13127. //////////////////////////////////////////////////////////////
  13128. CStringArray txarray;
  13129. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  13130. g_sendhead.code[0] = 11;
  13131. g_sendhead.code[1] = 52;
  13132. g_sendhead.code[2] = 50;
  13133. g_sendhead.code[3] = 150;
  13134. g_sendhead.code[4] = 77;
  13135. g_sendhead.code[5] = 4;
  13136. g_sendhead.tabcount = 6;
  13137. g_sendhead.bsql = 0;
  13138. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  13139. CArray<CStringArray, CStringArray>sparray;
  13140. CArray<CStringArray, CStringArray>clientarray;
  13141. CArray<CStringArray, CStringArray>phonearray;
  13142. CArray<CStringArray, CStringArray>fgarray;
  13143. CArray<CStringArray, CStringArray>danweiarray;
  13144. CArray<CStringArray, CStringArray>jdarray;
  13145. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  13146. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  13147. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  13148. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  13149. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  13150. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  13151. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  13152. CString m_taoxiname;
  13153. if (m_zs.Find("\\") != -1)
  13154. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  13155. else
  13156. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  13157. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  13158. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  13159. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  13160. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  13161. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  13162. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  13163. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  13164. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  13165. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  13166. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  13167. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  13168. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  13169. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  13170. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  13171. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  13172. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  13173. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  13174. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  13175. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  13176. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  13177. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  13178. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  13179. if (jdarray.GetSize())
  13180. {
  13181. if (m_bz.IsEmpty() == 0)
  13182. m_bz = "\r\n" + m_bz;
  13183. m_bz += "景点:";
  13184. }
  13185. for (i = 0; i < jdarray.GetSize(); i++)
  13186. {
  13187. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  13188. }
  13189. m_bz.TrimRight(";");
  13190. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  13191. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13192. if (IsHasRights2new(31) == 0)
  13193. {
  13194. m_phone1 = "***";
  13195. m_phone2 = "***";
  13196. }
  13197. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  13198. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13199. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  13200. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  13201. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  13202. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  13203. filter = "name='" + m_ren + "'";
  13204. g_sendhead.code[0] = 5;
  13205. g_sendhead.tabcount = 1;
  13206. g_sendhead.bsql = 0;
  13207. int g_nYearposTemp = g_nYearpos;
  13208. g_nYearpos = -1;
  13209. g_pMainWnd->ProcessChatMessageRequest2(filter);
  13210. g_nYearpos = g_nYearposTemp;
  13211. if (g_bSendOK == 0)return;
  13212. DataToArray(&phonearray);
  13213. m_money1.Format("%f", atof(m_taoxijiage));
  13214. m_money2.Format("%f", atof(m_payed1));
  13215. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  13216. ConvertToPrice(m_money1);
  13217. ConvertToPrice(m_money2);
  13218. ConvertToPrice(m_money3);
  13219. ////////////////////////////////////////////////////////////////
  13220. int rcpos = -1;
  13221. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13222. StrRect.top -= 15; StrRect.bottom -= 15;
  13223. Image *pImg = NULL;
  13224. #ifdef MNLS_VERSION
  13225. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  13226. #else
  13227. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  13228. #endif
  13229. m_Print.DrawImage(pImg, StrRect);
  13230. delete pImg;
  13231. m_Print.SetFontFace(11, 1, "宋体");
  13232. StrRect = load.m_rcarray.ElementAt(20);
  13233. StrRect.right = load.m_rcarray.ElementAt(23).right;
  13234. StrRect.top -= 18; StrRect.bottom -= 18;
  13235. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  13236. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13237. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  13238. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13239. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13240. StrRect.top -= 15; StrRect.bottom -= 15;
  13241. #ifdef MNLS_VERSION
  13242. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13243. #endif
  13244. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13245. StrRect.top -= 15; StrRect.bottom -= 15;
  13246. #ifdef MNLS_VERSION
  13247. m_Print.DrawRect(StrRect);
  13248. #endif
  13249. m_Print.SetFontFace(7, 1, "黑体");
  13250. m_Print.SetColor(0xffffff);
  13251. #ifdef MNLS_VERSION
  13252. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13253. #endif
  13254. m_Print.SetColor(0);
  13255. m_Print.SetFontFace(15, 1, "宋体");
  13256. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13257. StrRect.top -= 15; StrRect.bottom -= 15;
  13258. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同拍摄单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13259. CStringArray strarray;
  13260. strarray.Add("NO: " + m_id);
  13261. CString date;
  13262. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  13263. strarray.Add(date);
  13264. strarray.Add("喜爱");
  13265. strarray.Add("格调");
  13266. if (fgarray.GetSize() == 12)
  13267. {
  13268. for (int i = 0; i < 12; i++)
  13269. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  13270. }
  13271. else
  13272. {
  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. strarray.Add("温柔贤惠");
  13283. strarray.Add("成熟感性");
  13284. strarray.Add("清纯可爱");
  13285. }
  13286. strarray.Add("姓名");
  13287. // strarray.Add("职业");
  13288. strarray.Add("");
  13289. strarray.Add("地址");
  13290. strarray.Add("电话");
  13291. #ifdef CHILD_VERSION
  13292. strarray.Add("家长");
  13293. strarray.Add("宝宝");
  13294. #else
  13295. strarray.Add("先生");
  13296. strarray.Add("女士");
  13297. #endif
  13298. m_Print.SetFontFace(11, 1, "宋体");
  13299. for (i = 0; i < strarray.GetSize(); i++)
  13300. {
  13301. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13302. if (i < 2)
  13303. {
  13304. StrRect.top -= 15; StrRect.bottom -= 15;
  13305. }
  13306. if (i>15)
  13307. m_Print.DrawRect2(StrRect, 1);
  13308. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13309. }
  13310. for (i = 29; i <= 40; i++)
  13311. {
  13312. if (m_style.GetLength() <= (i - 29))continue;
  13313. if (m_style.GetAt(i - 29) != '1')continue;
  13314. StrRect = load.m_rcarray.ElementAt(i - 1);
  13315. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13316. }
  13317. for (i = 27; i <= 48; i++)
  13318. {
  13319. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13320. m_Print.DrawRect2(StrRect, 1);
  13321. }
  13322. #ifdef CHILD_VERSION
  13323. StrRect = load.m_rcarray.ElementAt(45);
  13324. StrRect.right = StrRect.left + 62;
  13325. m_Print.DrawRect2(StrRect, 1);
  13326. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13327. StrRect.left = StrRect.right;
  13328. StrRect.right = StrRect.left + 62;
  13329. m_Print.DrawRect2(StrRect, 1);
  13330. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13331. StrRect.left = StrRect.right;
  13332. StrRect.right = StrRect.left + 62;
  13333. m_Print.DrawRect2(StrRect, 1);
  13334. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13335. StrRect.left = StrRect.right;
  13336. StrRect.right = StrRect.left + 62;
  13337. m_Print.DrawRect2(StrRect, 1);
  13338. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13339. #endif
  13340. /////////////////////////
  13341. strarray.RemoveAll();
  13342. CString temp;
  13343. temp.Format("拍摄 选 %d 款,其中", atoi(m_outside) + atoi(m_outside2));
  13344. strarray.Add(temp);
  13345. temp.Format("内景 %d 款,外景 %d 款.", atoi(m_outside2), atoi(m_outside));
  13346. strarray.Add(temp);
  13347. strarray.Add("化妆");
  13348. strarray.Add("造型");
  13349. #ifdef CHILD_VERSION
  13350. strarray.Add("");
  13351. #else
  13352. strarray.Add("婚纱");
  13353. #endif
  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. strarray.Add("主摄影师");
  13363. strarray.Add("拍摄日期");
  13364. strarray.Add("定金");
  13365. #ifdef CHILD_VERSION
  13366. strarray.Add("主引导师");
  13367. #else
  13368. strarray.Add("主化妆师");
  13369. #endif
  13370. strarray.Add("看样日期");
  13371. strarray.Add("补 余 款");
  13372. strarray.Add("总监");
  13373. strarray.Add("取件日期");
  13374. rcpos = -1;
  13375. for (i = 0; i < strarray.GetSize(); i++)
  13376. {
  13377. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13378. if (i>9)
  13379. m_Print.DrawRect2(StrRect, 1);
  13380. #ifdef CHILD_VERSION
  13381. if (i == 5)
  13382. StrRect.top -= StrRect.Height();
  13383. #endif
  13384. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13385. }
  13386. for (i = 22; i <= 41; i++)
  13387. {
  13388. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13389. m_Print.DrawRect2(StrRect, 1);
  13390. }
  13391. /////////////////////////////
  13392. strarray.RemoveAll();
  13393. #ifdef CHILD_VERSION
  13394. strarray.Add("顾客方 家长:");
  13395. strarray.Add("宝宝:");
  13396. #else
  13397. strarray.Add("顾客方 先生:");
  13398. strarray.Add("女士:");
  13399. #endif
  13400. strarray.Add("电话:");
  13401. strarray.Add("影楼方 店长:");
  13402. strarray.Add("接单人:");
  13403. strarray.Add("电话:");
  13404. rcpos = -1;
  13405. for (i = 0; i < strarray.GetSize(); i++)
  13406. {
  13407. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13408. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13409. }
  13410. for (i = 7; i <= 12; i++)
  13411. {
  13412. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13413. // if(i!=10)
  13414. m_Print.DrawRect2(StrRect, 2);
  13415. }
  13416. //////////////////////////////////////
  13417. //开始打数据
  13418. strarray.RemoveAll();
  13419. strarray.Add(m_name1);
  13420. strarray.Add(m_name2);
  13421. strarray.Add("");
  13422. strarray.Add("");
  13423. strarray.Add(m_addr1);
  13424. #ifdef CHILD_VERSION
  13425. strarray.Add("");
  13426. #else
  13427. strarray.Add(m_addr2);
  13428. #endif
  13429. strarray.Add(m_phone1);
  13430. strarray.Add(m_phone2);
  13431. for (i = 41; i <= 48; i++)
  13432. {
  13433. StrRect = load.m_rcarray.ElementAt(i - 1);
  13434. StrRect.left += 4;
  13435. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13436. }
  13437. ///////////////////////////////
  13438. strarray.RemoveAll();
  13439. strarray.Add(m_money1);
  13440. strarray.Add(m_waiter1);
  13441. strarray.Add(m_time2);
  13442. strarray.Add(m_money2);
  13443. strarray.Add(m_waiter2);
  13444. strarray.Add(m_time4);
  13445. strarray.Add(m_money3);
  13446. strarray.Add("");
  13447. strarray.Add(m_time5);
  13448. for (i = 32; i <= 40; i++)
  13449. {
  13450. StrRect = load2.m_rcarray.ElementAt(i - 1);
  13451. StrRect.left += 4;
  13452. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13453. }
  13454. ///////////////////////////////
  13455. strarray.RemoveAll();
  13456. strarray.Add("");//m_name1);
  13457. strarray.Add("");//m_name2);
  13458. CString phone;
  13459. if (m_phone1.IsEmpty() == 0)
  13460. phone = m_phone1 + ",";
  13461. phone += m_phone2;
  13462. phone.TrimRight(",");
  13463. strarray.Add("");//phone);
  13464. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  13465. strarray.Add(m_ren);
  13466. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13467. for (i = 7; i <= 12; i++)
  13468. {
  13469. StrRect = load3.m_rcarray.ElementAt(i - 1);
  13470. StrRect.left += 4;
  13471. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13472. }
  13473. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  13474. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13475. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  13476. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13477. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  13478. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13479. //////////////////////////////
  13480. //开始画文字
  13481. StrRect = load2.m_rcarray.ElementAt(30);
  13482. StrRect.left += 3;
  13483. StrRect.top += 3;
  13484. StrRect.right -= 2;
  13485. StrRect.bottom -= 2;
  13486. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  13487. StrRect = load2.m_rcarray.ElementAt(29);
  13488. StrRect.left += 3;
  13489. StrRect.top += 3;
  13490. StrRect.right -= 2;
  13491. StrRect.bottom -= 2;
  13492. str = "";
  13493. for (i = 0; i < sparray.GetSize(); i++)
  13494. {
  13495. str += sparray.ElementAt(i).ElementAt(5);
  13496. str += " 数量:";
  13497. str += sparray.ElementAt(i).ElementAt(3);
  13498. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  13499. str += "\r\n";
  13500. }
  13501. str.TrimRight("\r\n");
  13502. AutoDraw(m_Print, StrRect, str, 1.4);
  13503. StrRect = load2.m_rcarray.ElementAt(40);
  13504. StrRect.top += 8;
  13505. m_Print.SetFontFace(12, 1, "黑体");
  13506. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  13507. StrRect.left += 3;
  13508. StrRect.top += 30;
  13509. StrRect.right -= 2;
  13510. StrRect.bottom -= 2;
  13511. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  13512. if (str.IsEmpty())
  13513. {
  13514. str = "\
  13515. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  13516. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  13517. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  13518. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  13519. 持良好的心境.\r\n\
  13520. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  13521. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  13522. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  13523. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  13524. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  13525. 勿进影室, 以免影响拍摄.\r\n\
  13526. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  13527. 师或店长沟通.\r\n\
  13528. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  13529. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  13530. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  13531. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  13532. 9. 本合同余额欠款须在拍照前付清.\r\n\
  13533. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  13534. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  13535. 还.";
  13536. }
  13537. AutoDraw(m_Print, StrRect, str, 1.8);
  13538. }
  13539. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13540. dlg.m_pDC = m_Print.GetPDC();
  13541. dlg.m_mode = 1;
  13542. if (aa == 0)
  13543. {
  13544. if (dlg.DoModal() != IDOK)
  13545. return;
  13546. printcot = dlg.m_num;
  13547. }
  13548. //结束打印
  13549. m_Print.EndPage();
  13550. m_Print.EndPrint();
  13551. }
  13552. }
  13553. void CMainFrame::InsideMsg()
  13554. {
  13555. ///内部消息
  13556. CString str;
  13557. g_sendhead.bsql = 0;
  13558. g_sendhead.code[0] = 126;
  13559. g_sendhead.tabcount = 1;
  13560. g_bNoConnDlg = 1;
  13561. g_pMainWnd->ProcessChatMessageRequest2(1); g_bNoConnDlg = 0;
  13562. if (g_bSendOK == 0)return;
  13563. CArray<CStringArray, CStringArray>m_List1array;
  13564. DataToArray(&g_List1array);//, &m_List1array);
  13565. int i = 0;
  13566. m_List1array.SetSize(g_List1array.GetSize());
  13567. for ( i = 0; i < g_List1array.GetSize(); i++)
  13568. {
  13569. m_List1array.ElementAt(i).Copy(g_List1array.ElementAt(i));
  13570. }
  13571. str = "," + g_user.name + ",";
  13572. for (i = g_List1array.GetSize() - 1; i >= 0; i--)
  13573. {
  13574. CString receivers2 = g_List1array.ElementAt(i).ElementAt(4);
  13575. receivers2.TrimLeft(",");
  13576. receivers2.TrimRight(",");
  13577. receivers2 = "," + receivers2 + ",";
  13578. CString receivers = g_List1array.ElementAt(i).ElementAt(3);
  13579. receivers.TrimLeft(",");
  13580. receivers.TrimRight(",");
  13581. receivers = "," + receivers + ",";
  13582. if (receivers.Find(str) == -1)
  13583. g_List1array.RemoveAt(i);
  13584. else if (receivers2.Find(str) != -1)
  13585. g_List1array.RemoveAt(i);
  13586. }
  13587. if (g_List1array.GetSize())
  13588. {
  13589. ShowMsg dlg;
  13590. dlg.DoModal();
  13591. }
  13592. for (i = m_List1array.GetSize() - 1; i >= 0; i--)
  13593. {
  13594. CString receivers2 = m_List1array.ElementAt(i).ElementAt(4);
  13595. receivers2.TrimLeft(",");
  13596. receivers2.TrimRight(",");
  13597. receivers2 = "," + receivers2 + ",";
  13598. CString receivers = m_List1array.ElementAt(i).ElementAt(3);
  13599. if (receivers != "")
  13600. m_List1array.RemoveAt(i);
  13601. else if (receivers2.Find(str) != -1)
  13602. m_List1array.RemoveAt(i);
  13603. }
  13604. if (m_List1array.GetSize())
  13605. {
  13606. SendInsideMsg2 dlg;
  13607. dlg.m_bShow = 1;
  13608. dlg.m_pArray = &m_List1array;
  13609. dlg.DoModal();
  13610. }
  13611. }
  13612. //定金
  13613. /************************************************************************/
  13614. /*
  13615. 函数:PrintHireDress
  13616. 描述:打印礼服出租单;
  13617. 参数:
  13618. strOrderNumber 礼服订单号;
  13619. 注意:
  13620. */
  13621. /************************************************************************/
  13622. void CMainFrame::PrintHireDress(CString strOrderNumber) // 打印礼服出租单;
  13623. {
  13624. int printcot = 1;
  13625. for (int aa = 0; aa < printcot; aa++)
  13626. {
  13627. CPrintRX m_Print;
  13628. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13629. {
  13630. m_Print.InitToPrint(NULL, 1);
  13631. }
  13632. else
  13633. {
  13634. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13635. if (name.IsEmpty())
  13636. m_Print.InitToPrint(NULL, 1);
  13637. else
  13638. {
  13639. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13640. if (nret == -1 && aa == 0)
  13641. {
  13642. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  13643. }
  13644. }
  13645. }
  13646. m_Print.StartPrint();
  13647. m_Print.StartPage();
  13648. LoadRect load;
  13649. load.SetLiaPath("21.lia");
  13650. load.SetMargins(0, 0);
  13651. if (!load.Load())
  13652. {
  13653. return;
  13654. }
  13655. int i;
  13656. //////////////////////////////////////////////////////////////
  13657. //CString filter="id='"+strOrderNumber+"';id='"+strOrderNumber+"';id='"+strOrderNumber+"'";
  13658. CString strFilter;
  13659. strFilter.Format("id='%s';id='%s';id='%s'", strOrderNumber, strOrderNumber, strOrderNumber);
  13660. g_sendhead.bsql = 0;
  13661. g_sendhead.code[0] = 73;
  13662. g_sendhead.code[1] = 74;
  13663. g_sendhead.code[2] = 52;
  13664. g_sendhead.tabcount = 3;
  13665. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  13666. if (g_bSendOK == 0)
  13667. {
  13668. return;
  13669. }
  13670. CArray<CStringArray, CStringArray>dresshirearray;
  13671. CArray<CStringArray, CStringArray>dresshiredataarray;
  13672. CArray<CStringArray, CStringArray>clientarray;
  13673. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13674. if (dresshirearray.GetSize() == 0)
  13675. {
  13676. return;
  13677. }
  13678. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10);
  13679. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7);
  13680. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8);
  13681. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6);
  13682. if (clientarray.GetSize() == 0)
  13683. {
  13684. return;
  13685. }
  13686. //AfxMessageBox("打印礼服出租单-()");
  13687. CString m_name2 = clientarray.ElementAt(0).ElementAt(2);
  13688. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13689. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13690. CString m_time3 = clientarray.ElementAt(0).ElementAt(20);
  13691. //#if JEFF_TEST
  13692. // if ( dresshiredataarray.GetSize() == 0 )
  13693. // {
  13694. // AfxMessageBox("没衣服");
  13695. // }
  13696. //#endif
  13697. CString sItem;
  13698. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13699. {
  13700. sItem += "编号:";
  13701. sItem += dresshiredataarray.ElementAt(i).ElementAt(1);
  13702. sItem += " ";
  13703. sItem += " 名称:";
  13704. sItem += dresshiredataarray.ElementAt(i).ElementAt(2);
  13705. sItem += " 数量:";
  13706. sItem += dresshiredataarray.ElementAt(i).ElementAt(3) + "\r\n";
  13707. }
  13708. sItem += "金额:";
  13709. sItem += dresshirearray.ElementAt(0).ElementAt(1);
  13710. sItem += " ";
  13711. sItem += " 押金:";
  13712. sItem += dresshirearray.ElementAt(0).ElementAt(2) + "\r\n";
  13713. ////////////////////////////////////////////////////////////////
  13714. int rcpos = -1;
  13715. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13716. m_Print.SetFontFace(17, 1, "宋体");
  13717. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13718. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13719. m_Print.SetFontFace(10, 1, "宋体");
  13720. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13721. CStringArray strarray;
  13722. strarray.Add("客户姓名");
  13723. strarray.Add("客户电话");
  13724. strarray.Add("预定日期");
  13725. strarray.Add("结婚日期");
  13726. strarray.Add("取件日期");
  13727. strarray.Add("归还日期");
  13728. strarray.Add("本店地址");
  13729. strarray.Add("电 话");
  13730. strarray.Add("客户地址");
  13731. strarray.Add("客户签名");
  13732. for (i = 2; i < 12; i++)
  13733. {
  13734. StrRect = load.m_rcarray.ElementAt(i);
  13735. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13736. }
  13737. strarray.RemoveAll();
  13738. strarray.Add(m_name2);
  13739. strarray.Add(m_phone2);
  13740. strarray.Add(m_inputdate);
  13741. strarray.Add(m_time3);
  13742. strarray.Add(m_date1);
  13743. strarray.Add(m_date2);
  13744. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13745. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13746. strarray.Add(m_addr2);
  13747. strarray.Add("");
  13748. for (i = 12; i < 22; i++)
  13749. {
  13750. StrRect = load.m_rcarray.ElementAt(i);
  13751. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13752. m_Print.DrawRect2(StrRect, 2);
  13753. }
  13754. for (i = 25; i < 30; i++)
  13755. {
  13756. StrRect = load.m_rcarray.ElementAt(i);
  13757. m_Print.DrawRect2(StrRect, 1);
  13758. }
  13759. StrRect = load.m_rcarray.ElementAt(22);
  13760. StrRect.top += 7;
  13761. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13762. StrRect = load.m_rcarray.ElementAt(23);
  13763. StrRect.top += 7;
  13764. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13765. StrRect = load.m_rcarray.ElementAt(24);
  13766. StrRect.top += 7;
  13767. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13768. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13769. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13770. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13771. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13772. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13773. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13774. if (str.IsEmpty())
  13775. {
  13776. str = "\
  13777. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13778. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13779. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13780. 4. 如有破损酌情赔偿.";
  13781. }
  13782. AutoDraw(m_Print, StrRect, str, 1.5);
  13783. PrintPreview dlg;
  13784. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13785. dlg.m_pDC = m_Print.GetPDC();
  13786. if (aa == 0)
  13787. {
  13788. if (dlg.DoModal() != IDOK)
  13789. return;
  13790. printcot = dlg.m_num;
  13791. }
  13792. //结束打印
  13793. m_Print.EndPage();
  13794. m_Print.EndPrint();
  13795. }
  13796. }
  13797. void CMainFrame::PrintHireDress_01(CString strOrderNumber) // 打印礼服出租单,无法改变结构,需要修改21.lia才能改变打印的布局;
  13798. {
  13799. int printcot = 1;
  13800. for (int aa = 0; aa < printcot; aa++)
  13801. {
  13802. CPrintRX m_Print;
  13803. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13804. {
  13805. m_Print.InitToPrint(NULL, 1);
  13806. }
  13807. else
  13808. {
  13809. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13810. if (name.IsEmpty())
  13811. m_Print.InitToPrint(NULL, 1);
  13812. else
  13813. {
  13814. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13815. if (nret == -1 && aa == 0)
  13816. {
  13817. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  13818. m_Print.InitToPrint(NULL, 1);
  13819. }
  13820. }
  13821. }
  13822. m_Print.StartPrint();
  13823. m_Print.StartPage();
  13824. LoadRect load;
  13825. load.SetLiaPath("21.lia");
  13826. load.SetMargins(0, 0);
  13827. if (!load.Load())return;
  13828. int i;
  13829. //////////////////////////////////////////////////////////////
  13830. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  13831. g_sendhead.bsql = 0;
  13832. g_sendhead.code[0] = 73; // dresshire表;
  13833. g_sendhead.code[1] = 74; // dresshiredata表;
  13834. g_sendhead.code[2] = 52; // client表;
  13835. g_sendhead.tabcount = 3;
  13836. g_pMainWnd->ProcessChatMessageRequest2(filter);
  13837. if (g_bSendOK == 0)
  13838. {
  13839. return;
  13840. }
  13841. CArray<CStringArray, CStringArray>dresshirearray;
  13842. CArray<CStringArray, CStringArray>dresshiredataarray;
  13843. CArray<CStringArray, CStringArray>clientarray;
  13844. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13845. if (dresshirearray.GetSize() == 0)return;
  13846. // dresshire;
  13847. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10); // 备注;
  13848. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7); // 取衣日期;
  13849. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8); // 还衣日期;
  13850. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6); // 记录日期;
  13851. CString strPrice = dresshirearray.ElementAt(0).ElementAt(1); // 金额;
  13852. CString strDeposit = dresshirearray.ElementAt(0).ElementAt(2); // 押金;
  13853. // client表;
  13854. if (clientarray.GetSize() == 0)return;
  13855. CString m_name2 = clientarray.ElementAt(0).ElementAt(2); // 女宾姓名;
  13856. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4); // 女宾手机;
  13857. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8); // 女宾地址;
  13858. CString m_time3 = clientarray.ElementAt(0).ElementAt(20); // 婚期;
  13859. // dresshiredata表;
  13860. CString sItem;
  13861. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13862. {
  13863. sItem += dresshiredataarray.ElementAt(i).ElementAt(1); // 礼服编号;
  13864. sItem += " ";
  13865. sItem += dresshiredataarray.ElementAt(i).ElementAt(2); // 礼服名称;
  13866. sItem += " 数量:";
  13867. sItem += dresshiredataarray.ElementAt(i).ElementAt(3) + "\r\n"; // 礼服数量;
  13868. }
  13869. sItem += " 金额:";
  13870. sItem += dresshirearray.ElementAt(0).ElementAt(1); // 出租金额;
  13871. sItem += " 押金:";
  13872. sItem += dresshirearray.ElementAt(0).ElementAt(2) + "\r\n"; // 押金;
  13873. ////////////////////////////////////////////////////////////////
  13874. int rcpos = -1;
  13875. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13876. m_Print.SetFontFace(17, 1, "宋体");
  13877. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13878. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13879. m_Print.SetFontFace(10, 1, "宋体");
  13880. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13881. CStringArray strarray;
  13882. strarray.Add("客户姓名"); // 1.
  13883. strarray.Add("客户电话");
  13884. strarray.Add("预定日期");
  13885. strarray.Add("结婚日期");
  13886. strarray.Add("取件日期"); // 5.
  13887. strarray.Add("归还日期");
  13888. strarray.Add("本店地址");
  13889. strarray.Add("电 话");
  13890. strarray.Add("客户地址");
  13891. strarray.Add("客户签名"); // 10.
  13892. //strarray.Add("金额");
  13893. //strarray.Add("押金");
  13894. for( i=2; i<12; i++)
  13895. //for (i = 2; i < 14; i++)
  13896. {
  13897. StrRect = load.m_rcarray.ElementAt(i);
  13898. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13899. }
  13900. strarray.RemoveAll();
  13901. strarray.Add(m_name2);
  13902. strarray.Add(m_phone2);
  13903. strarray.Add(m_inputdate);
  13904. strarray.Add(m_time3);
  13905. strarray.Add(m_date1);
  13906. strarray.Add(m_date2);
  13907. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13908. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13909. strarray.Add(m_addr2);
  13910. strarray.Add("");
  13911. strarray.Add(strPrice); // 金额;
  13912. strarray.Add(strDeposit); // 押金;
  13913. for( i=12; i<22; i++)
  13914. //for (i = 14; i < 24; i++)
  13915. {
  13916. StrRect = load.m_rcarray.ElementAt(i);
  13917. //m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i-12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13918. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 14), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13919. m_Print.DrawRect2(StrRect, 2);
  13920. }
  13921. for (i = 25; i < 30; i++)
  13922. {
  13923. StrRect = load.m_rcarray.ElementAt(i);
  13924. m_Print.DrawRect2(StrRect, 1);
  13925. }
  13926. StrRect = load.m_rcarray.ElementAt(22);
  13927. StrRect.top += 7;
  13928. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13929. StrRect = load.m_rcarray.ElementAt(23);
  13930. StrRect.top += 7;
  13931. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13932. StrRect = load.m_rcarray.ElementAt(24);
  13933. StrRect.top += 7;
  13934. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13935. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13936. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13937. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13938. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13939. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13940. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13941. if (str.IsEmpty())
  13942. {
  13943. str = "\
  13944. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13945. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13946. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13947. 4. 如有破损酌情赔偿.";
  13948. }
  13949. AutoDraw(m_Print, StrRect, str, 1.5);
  13950. PrintPreview dlg;
  13951. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13952. dlg.m_pDC = m_Print.GetPDC();
  13953. if (aa == 0)
  13954. {
  13955. if (dlg.DoModal() != IDOK)
  13956. return;
  13957. printcot = dlg.m_num;
  13958. }
  13959. //结束打印
  13960. m_Print.EndPage();
  13961. m_Print.EndPrint();
  13962. }
  13963. }
  13964. void CMainFrame::PrintTakeForm2(CArray<CStringArray, CStringArray>*Listarray)
  13965. {
  13966. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "选片客人明细表";
  13967. int pages = Listarray->GetSize() / 46;
  13968. if (Listarray->GetSize() % 46)pages++;
  13969. for (int aa = 0; aa < pages; aa++)
  13970. {
  13971. PrintPreview dlg;
  13972. CPrintRX m_Print;
  13973. m_Print.InitToPrint(NULL, 1);
  13974. m_Print.StartPrint();
  13975. m_Print.StartPage();
  13976. CRect mainrc(0, 0, 560, 793);
  13977. float fscale;
  13978. {
  13979. int w, h;
  13980. m_Print.GetWidHei(w, h);
  13981. fscale = (float)w / (float)h;
  13982. }
  13983. mainrc.DeflateRect(25, 40, 10, 0);
  13984. CRect rc, rc2;
  13985. rc = mainrc;
  13986. rc.bottom = rc.top;
  13987. rc.top -= 20;
  13988. m_Print.SetFontFace(16, 1, "黑体");
  13989. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13990. m_Print.SetFontFace(9, 1, "宋体");
  13991. CString str;
  13992. int wid[5] = { 200, 110, 70, 85, 62 };
  13993. int hei = 16;
  13994. if (fscale > 0.71)hei = 15;
  13995. rc = mainrc;
  13996. rc.bottom = rc.top + hei;
  13997. for (int i = 0; i < 47; i++)
  13998. {
  13999. rc2.top = rc.top + i*hei;
  14000. rc2.bottom = rc.bottom + i*hei;
  14001. rc2.left = rc.left;
  14002. rc2.right = rc.left + wid[0];
  14003. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14004. for (int j = 0; j<5; j++)
  14005. {
  14006. m_Print.DrawRect2(rc2, 1);
  14007. if (Listarray->GetSize()>aa * 46 + i)
  14008. {
  14009. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14010. rc2.left += 3;
  14011. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14012. rc2.left -= 3;
  14013. }
  14014. rc2.left += wid[j];
  14015. rc2.right = rc2.left + wid[j + 1];
  14016. }
  14017. }
  14018. rc2.top += 2;
  14019. rc2.left += 2; rc2.right = mainrc.right + 4;
  14020. m_Print.SetFontFace(8, 1, "宋体");
  14021. str.Format(" 页:%d/%d", aa + 1, pages);
  14022. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14023. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14024. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14025. dlg.m_pDC = m_Print.GetPDC();
  14026. // dlg.m_mode=1;
  14027. if (aa == 0)
  14028. {
  14029. if (dlg.DoModal() != IDOK)
  14030. return;
  14031. }
  14032. //结束打印
  14033. m_Print.EndPage();
  14034. m_Print.EndPrint();
  14035. }
  14036. }
  14037. void CMainFrame::PrintTakeForm3(CArray<CStringArray, CStringArray>*Listarray)
  14038. {
  14039. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "看设计客人明细表";
  14040. int pages = Listarray->GetSize() / 46;
  14041. if (Listarray->GetSize() % 46)pages++;
  14042. for (int aa = 0; aa < pages; aa++)
  14043. {
  14044. PrintPreview dlg;
  14045. CPrintRX m_Print;
  14046. m_Print.InitToPrint(NULL, 1);
  14047. m_Print.StartPrint();
  14048. m_Print.StartPage();
  14049. CRect mainrc(0, 0, 560, 793);
  14050. float fscale;
  14051. {
  14052. int w, h;
  14053. m_Print.GetWidHei(w, h);
  14054. fscale = (float)w / (float)h;
  14055. }
  14056. mainrc.DeflateRect(25, 40, 10, 0);
  14057. CRect rc, rc2;
  14058. rc = mainrc;
  14059. rc.bottom = rc.top;
  14060. rc.top -= 20;
  14061. m_Print.SetFontFace(16, 1, "黑体");
  14062. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14063. m_Print.SetFontFace(9, 1, "宋体");
  14064. CString str;
  14065. int wid[5] = { 200, 110, 70, 85, 62 };
  14066. int hei = 16;
  14067. if (fscale > 0.71)hei = 15;
  14068. rc = mainrc;
  14069. rc.bottom = rc.top + hei;
  14070. for (int i = 0; i < 47; i++)
  14071. {
  14072. rc2.top = rc.top + i*hei;
  14073. rc2.bottom = rc.bottom + i*hei;
  14074. rc2.left = rc.left;
  14075. rc2.right = rc.left + wid[0];
  14076. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14077. for (int j = 0; j<5; j++)
  14078. {
  14079. m_Print.DrawRect2(rc2, 1);
  14080. if (Listarray->GetSize()>aa * 46 + i)
  14081. {
  14082. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14083. rc2.left += 3;
  14084. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14085. rc2.left -= 3;
  14086. }
  14087. rc2.left += wid[j];
  14088. rc2.right = rc2.left + wid[j + 1];
  14089. }
  14090. }
  14091. rc2.top += 2;
  14092. rc2.left += 2; rc2.right = mainrc.right + 4;
  14093. m_Print.SetFontFace(8, 1, "宋体");
  14094. str.Format(" 页:%d/%d", aa + 1, pages);
  14095. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14096. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14097. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14098. dlg.m_pDC = m_Print.GetPDC();
  14099. // dlg.m_mode=1;
  14100. if (aa == 0)
  14101. {
  14102. if (dlg.DoModal() != IDOK)
  14103. return;
  14104. }
  14105. //结束打印
  14106. m_Print.EndPage();
  14107. m_Print.EndPrint();
  14108. }
  14109. }
  14110. void CMainFrame::PrintTakeForm4(CArray<CStringArray, CStringArray>*Listarray)
  14111. {
  14112. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "取件客人明细表";
  14113. int pages = Listarray->GetSize() / 46;
  14114. if (Listarray->GetSize() % 46)pages++;
  14115. for (int aa = 0; aa < pages; aa++)
  14116. {
  14117. PrintPreview dlg;
  14118. CPrintRX m_Print;
  14119. m_Print.InitToPrint(NULL, 1);
  14120. m_Print.StartPrint();
  14121. m_Print.StartPage();
  14122. CRect mainrc(0, 0, 560, 793);
  14123. float fscale;
  14124. {
  14125. int w, h;
  14126. m_Print.GetWidHei(w, h);
  14127. fscale = (float)w / (float)h;
  14128. }
  14129. mainrc.DeflateRect(25, 40, 10, 0);
  14130. CRect rc, rc2;
  14131. rc = mainrc;
  14132. rc.bottom = rc.top;
  14133. rc.top -= 20;
  14134. m_Print.SetFontFace(16, 1, "黑体");
  14135. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14136. m_Print.SetFontFace(9, 1, "宋体");
  14137. CString str;
  14138. int wid[5] = { 200, 110, 70, 85, 62 };
  14139. int hei = 16;
  14140. if (fscale > 0.71)hei = 15;
  14141. rc = mainrc;
  14142. rc.bottom = rc.top + hei;
  14143. for (int i = 0; i < 47; i++)
  14144. {
  14145. rc2.top = rc.top + i*hei;
  14146. rc2.bottom = rc.bottom + i*hei;
  14147. rc2.left = rc.left;
  14148. rc2.right = rc.left + wid[0];
  14149. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14150. for (int j = 0; j<5; j++)
  14151. {
  14152. m_Print.DrawRect2(rc2, 1);
  14153. if (Listarray->GetSize()>aa * 46 + i)
  14154. {
  14155. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14156. rc2.left += 3;
  14157. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14158. rc2.left -= 3;
  14159. }
  14160. rc2.left += wid[j];
  14161. rc2.right = rc2.left + wid[j + 1];
  14162. }
  14163. }
  14164. rc2.top += 2;
  14165. rc2.left += 2; rc2.right = mainrc.right + 4;
  14166. m_Print.SetFontFace(8, 1, "宋体");
  14167. str.Format(" 页:%d/%d", aa + 1, pages);
  14168. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14169. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14170. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14171. dlg.m_pDC = m_Print.GetPDC();
  14172. // dlg.m_mode=1;
  14173. if (aa == 0)
  14174. {
  14175. if (dlg.DoModal() != IDOK)
  14176. return;
  14177. }
  14178. //结束打印
  14179. m_Print.EndPage();
  14180. m_Print.EndPrint();
  14181. }
  14182. }
  14183. void CMainFrame::PrintTakeForm5(CArray<CStringArray, CStringArray>*Listarray)
  14184. {
  14185. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "婚庆客人明细表";
  14186. int pages = Listarray->GetSize() / 46;
  14187. if (Listarray->GetSize() % 46)pages++;
  14188. for (int aa = 0; aa < pages; aa++)
  14189. {
  14190. PrintPreview dlg;
  14191. CPrintRX m_Print;
  14192. m_Print.InitToPrint(NULL, 1);
  14193. m_Print.StartPrint();
  14194. m_Print.StartPage();
  14195. CRect mainrc(0, 0, 560, 793);
  14196. float fscale;
  14197. {
  14198. int w, h;
  14199. m_Print.GetWidHei(w, h);
  14200. fscale = (float)w / (float)h;
  14201. }
  14202. mainrc.DeflateRect(25, 40, 10, 0);
  14203. CRect rc, rc2;
  14204. rc = mainrc;
  14205. rc.bottom = rc.top;
  14206. rc.top -= 20;
  14207. m_Print.SetFontFace(16, 1, "黑体");
  14208. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14209. m_Print.SetFontFace(8, 1, "宋体");
  14210. CString str;
  14211. int wid[7] = { 165, 90, 90, 45, 45, 60, 35 };
  14212. int hei = 16;
  14213. if (fscale > 0.71)hei = 15;
  14214. rc = mainrc;
  14215. rc.bottom = rc.top + hei;
  14216. for (int i = 0; i < 47; i++)
  14217. {
  14218. rc2.top = rc.top + i*hei;
  14219. rc2.bottom = rc.bottom + i*hei;
  14220. rc2.left = rc.left;
  14221. rc2.right = rc.left + wid[0];
  14222. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14223. for (int j = 0; j<7; j++)
  14224. {
  14225. m_Print.DrawRect2(rc2, 1);
  14226. if (Listarray->GetSize()>aa * 46 + i)
  14227. {
  14228. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14229. rc2.left += 3;
  14230. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14231. rc2.left -= 3;
  14232. }
  14233. rc2.left += wid[j];
  14234. rc2.right = rc2.left + wid[j + 1];
  14235. }
  14236. }
  14237. rc2.top += 2;
  14238. rc2.left += 2; rc2.right = mainrc.right + 4;
  14239. m_Print.SetFontFace(8, 1, "宋体");
  14240. str.Format(" 页:%d/%d", aa + 1, pages);
  14241. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14242. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14243. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14244. dlg.m_pDC = m_Print.GetPDC();
  14245. // dlg.m_mode=1;
  14246. if (aa == 0)
  14247. {
  14248. if (dlg.DoModal() != IDOK)
  14249. return;
  14250. }
  14251. //结束打印
  14252. m_Print.EndPage();
  14253. m_Print.EndPrint();
  14254. }
  14255. }
  14256. void CMainFrame::PrintTakeForm1(CArray<CStringArray, CStringArray>*Listarray)
  14257. {
  14258. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "拍照客人明细表";
  14259. int pages = Listarray->GetSize() / 46;
  14260. if (Listarray->GetSize() % 46)pages++;
  14261. for (int aa = 0; aa < pages; aa++)
  14262. {
  14263. PrintPreview dlg;
  14264. CPrintRX m_Print;
  14265. m_Print.InitToPrint(NULL, 1);
  14266. m_Print.StartPrint();
  14267. m_Print.StartPage();
  14268. CRect mainrc(0, 0, 560, 793);
  14269. float fscale;
  14270. {
  14271. int w, h;
  14272. m_Print.GetWidHei(w, h);
  14273. fscale = (float)w / (float)h;
  14274. }
  14275. mainrc.DeflateRect(25, 40, 10, 0);
  14276. CRect rc, rc2;
  14277. rc = mainrc;
  14278. rc.bottom = rc.top;
  14279. rc.top -= 20;
  14280. m_Print.SetFontFace(16, 1, "黑体");
  14281. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14282. m_Print.SetFontFace(8, 1, "宋体");
  14283. CString str;
  14284. int wid[7] = { 165, 60, 90, 60, 60, 60, 35 };
  14285. int hei = 16;
  14286. if (fscale > 0.71)hei = 15;
  14287. rc = mainrc;
  14288. rc.bottom = rc.top + hei;
  14289. for (int i = 0; i < 47; i++)
  14290. {
  14291. rc2.top = rc.top + i*hei;
  14292. rc2.bottom = rc.bottom + i*hei;
  14293. rc2.left = rc.left;
  14294. rc2.right = rc.left + wid[0];
  14295. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14296. for (int j = 0; j<7; j++)
  14297. {
  14298. m_Print.DrawRect2(rc2, 1);
  14299. if (Listarray->GetSize()>aa * 46 + i)
  14300. {
  14301. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14302. rc2.left += 3;
  14303. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14304. rc2.left -= 3;
  14305. }
  14306. rc2.left += wid[j];
  14307. rc2.right = rc2.left + wid[j + 1];
  14308. }
  14309. }
  14310. rc2.top += 2;
  14311. rc2.left += 2; rc2.right = mainrc.right + 4;
  14312. m_Print.SetFontFace(8, 1, "宋体");
  14313. str.Format(" 页:%d/%d", aa + 1, pages);
  14314. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14315. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14316. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14317. dlg.m_pDC = m_Print.GetPDC();
  14318. // dlg.m_mode=1;
  14319. if (aa == 0)
  14320. {
  14321. if (dlg.DoModal() != IDOK)
  14322. return;
  14323. }
  14324. //结束打印
  14325. m_Print.EndPage();
  14326. m_Print.EndPrint();
  14327. }
  14328. }
  14329. void CMainFrame::ShowMonthForm2()
  14330. {
  14331. }
  14332. // dlg;