MainFrm.cpp 456 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600
  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. // 导入原片、初修、精修、设计结束后的回调函数(三合一);
  221. void CALLBACK ImgImportMergeCallback(IN LPCTSTR lpStrBranchId, IN LPCTSTR lpStrOrderNum, IN CONST INT& dwImgType, IN CONST DWORD& dwImgNum, IN LPCTSTR lpStrImgs, IN LPCTSTR lpStrImgExt)
  222. {
  223. AfxSetResourceHandle(g_Instance);
  224. // 1.判断参数有效性;
  225. if (lpStrBranchId == NULL || !strstr(lpStrBranchId, _T(".ly.com")) || lpStrOrderNum == NULL || _tcscmp(lpStrOrderNum, _T("")) == 0)
  226. {
  227. OutputDebugString(_T("回调函数参数(域名、订单号)无效\n"));
  228. return;
  229. }
  230. // 2.是否需要备份分店相片;
  231. BOOL bIsNeedBranchImg = FALSE;
  232. switch (dwImgType)
  233. {
  234. case 1://是否备份分店原片;
  235. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck1;
  236. break;
  237. case 2://是否备份分店修片;
  238. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck2;
  239. break;
  240. case 3://是否备份分店精修;
  241. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck3;
  242. break;
  243. case 4://是否备份分店设计;
  244. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck4;
  245. break;
  246. default:
  247. OutputDebugString(_T("未知相片类型!\n"));
  248. break;
  249. }
  250. // 3.同时更新IncrementalBack表;
  251. CString strSQLInsert = _T("");
  252. strSQLInsert.Format(INSERT_INCREMENT, 0, lpStrBranchId, CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S"), lpStrOrderNum, dwImgType, lpStrImgs, g_user.account, g_user.name);
  253. // 4.连接服务器,更新dindan和IncrementalBackup;
  254. g_sendhead.bsql = 1;
  255. if (g_bAllBranch)
  256. {// 多店汇总时;
  257. g_branchip = GetBranchIPbyId(lpStrBranchId);
  258. g_pMainWnd->OnDisconnect();
  259. g_branchname = GetBranchNamebyId(lpStrBranchId);
  260. g_bBranchModify = 1;
  261. if (dwImgType == OImgtype)
  262. {// 如果导入的是原片;
  263. CString strSQL = _T("");
  264. strSQL.Format(_T("update dindan set curno = '%d' where id = '%s' ***%s"), dwImgNum, lpStrOrderNum, strSQLInsert);
  265. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  266. }
  267. else
  268. {//导入的不是原片;
  269. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  270. }
  271. // 如果连接服务器失败,要记录下来;
  272. // if () .........
  273. g_pMainWnd->OnDisconnect();
  274. g_bBranchModify = 0;
  275. g_branchip = g_branchname = _T("");
  276. if (g_domain.CompareNoCase(lpStrBranchId) != 0 && bIsNeedBranchImg)
  277. {// 如果不是本店,且本店设置中需要备份分店相片,需要向本店添加导入相片记录;
  278. g_sendhead.bsql = 1;
  279. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  280. g_pMainWnd->OnDisconnect();
  281. g_bBranchModify = 0;
  282. }
  283. }
  284. else
  285. {// 连接本店或分店时;
  286. if (dwImgType == OImgtype)
  287. {// 如果导入的是原片;
  288. CString strSQL = _T("");
  289. strSQL.Format(_T("update dindan set curno = '%d' where id = '%s' ***%s"), dwImgNum, lpStrOrderNum, strSQLInsert);
  290. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  291. }
  292. else
  293. {//导入的不是原片;
  294. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  295. }
  296. if (g_domain.CompareNoCase(lpStrBranchId) != 0 && bIsNeedBranchImg)
  297. {// 如果不是本店,且本店设置中需要备份分店相片,需要向本店添加导入相片记录;
  298. #if 1
  299. ::SendMessage(g_pMainWnd->m_hWnd, MSG_KERNEL_SENDMSG, (WPARAM)lpStrBranchId, (LPARAM)&strSQLInsert);
  300. #else // 可能是VC6.0与VC9.0间DLL调用产生的问题,下面代码执行时会出错;
  301. // 如果连接的是分店,断开分店,回连本店;
  302. g_bBranchModify = FALSE;
  303. g_pMainWnd->OnDisconnect();
  304. g_branchname = g_branchip = _T("");
  305. g_sendhead.bsql = 1;
  306. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  307. g_pMainWnd->OnDisconnect();
  308. // 设置回分店连接;
  309. g_branchip = GetBranchIPbyId(lpStrBranchId);
  310. g_branchname = GetBranchNamebyId(lpStrBranchId);
  311. g_bBranchModify = TRUE;
  312. #endif
  313. }
  314. }
  315. if ( dwImgType == OImgtype )
  316. {// 最后一步,更新完了数据库,刷新TakFrom类所对应的对话框;
  317. HWND hWnd = ::FindWindowEx(g_pMainWnd->GetSafeHwnd(), NULL, _T("MDIClient"), NULL);
  318. if (hWnd)
  319. {
  320. hWnd = ::FindWindowEx(hWnd, NULL, NULL, _T("拍照"));
  321. if (hWnd)
  322. {
  323. hWnd = ::FindWindowEx(hWnd, NULL, _T("#32770"), NULL);
  324. if (hWnd)
  325. {
  326. ::SendMessage(hWnd, MSG_KERNEL_CALLBACK, 0, 0);
  327. }
  328. }
  329. }
  330. }
  331. }
  332. #endif
  333. /////////////////////////////////////////////////////////////////////////////
  334. // CMainFrame客人付款
  335. /////////////////////////////////////////////////////////////////////////////
  336. /////////////////////////////////////////////////////////////////////////////
  337. static void HandleClientNetEvent(IN SOCKET hSocket,
  338. IN ETransportEvent eEvent,
  339. IN void *pDataBuf,
  340. IN unsigned long nDataLen,
  341. IN int nError,
  342. IN void *pContext)
  343. {
  344. if (nError != TRANSPORT_OK)
  345. return;
  346. CMainFrame *pDlg = (CMainFrame *)pContext;
  347. if (NULL == pDlg)
  348. return;
  349. pDlg->ProcessNetEvent(eEvent, pDataBuf, nDataLen);
  350. }
  351. BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam)
  352. {
  353. CRect rtCtrl, rtWnd; // 子窗口,父窗口;
  354. if (hwnd)
  355. {
  356. ::GetWindowRect(hwnd, &rtCtrl); // 获取控件大小;
  357. ::GetWindowRect(GetParent(hwnd), &rtWnd); // 获取父窗口大小;
  358. rtCtrl.OffsetRect(-rtWnd.left, -rtWnd.top);
  359. float temp;
  360. temp = (float)rtCtrl.left*g_WidthScale;
  361. rtCtrl.left = (int)temp + g_dx;
  362. temp = (float)rtCtrl.top*g_HeightScale;
  363. rtCtrl.top = (int)temp + g_dy;
  364. temp = (float)rtCtrl.right*g_WidthScale;
  365. rtCtrl.right = (int)temp + g_dx;
  366. temp = (float)rtCtrl.bottom*g_HeightScale;
  367. rtCtrl.bottom = (int)temp + g_dy;
  368. ::MoveWindow(hwnd, rtCtrl.left, rtCtrl.top, rtCtrl.Width(), rtCtrl.Height(), TRUE);
  369. return TRUE;
  370. }
  371. else
  372. {
  373. return FALSE;
  374. }
  375. }
  376. IMPLEMENT_DYNCREATE(CMainFrame, CMDIFrameWnd)
  377. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  378. //{{AFX_MSG_MAP(CMainFrame)
  379. ON_WM_CREATE()
  380. ON_WM_DESTROY()
  381. ON_WM_CLOSE()
  382. ON_WM_TIMER()
  383. ON_COMMAND(IDM_choosephotoskin, Onchoosephotoskin)
  384. ON_COMMAND(IDM_PATH, OnPath)
  385. ON_COMMAND(IDM_SERVER, OnServer)
  386. ON_COMMAND(IDM_SHOWHIS, OnShowhis)
  387. ON_COMMAND(IDM_StaffAchievementShow, OnStaffAchievementShow)
  388. ON_COMMAND(IDM_AUTODELPHOTO, OnAutodelphoto)
  389. ON_COMMAND(IDM_PHOTOMANAGE, Onphotomanage)
  390. ON_COMMAND(IDM_COMPANYINFO, OnCompanyinfo)
  391. ON_COMMAND(IDM_HELPFILE, OnHelpfile)
  392. ON_COMMAND(IDM_PHOTOBAK, OnPhotobak)
  393. ON_COMMAND(IDM_TAOXIFG, OnTaoxifg)
  394. ON_COMMAND(IDM_ShowBakState, OnShowBakState)
  395. ON_WM_NCLBUTTONDBLCLK()
  396. ON_WM_NCHITTEST()
  397. ON_COMMAND(IDM_LOG, OnLog)
  398. //}}AFX_MSG_MAP
  399. ON_COMMAND_RANGE(0, 50000, OnCommandMenu)
  400. ON_MESSAGE(MSG_KERNEL_SENDMSG, OnKernelSendMessaage)
  401. END_MESSAGE_MAP()
  402. static UINT indicators[] =
  403. {
  404. ID_SEPARATOR, // status line indicator
  405. ID_INDICATOR_CAPS,
  406. ID_INDICATOR_NUM,
  407. ID_INDICATOR_SCRL,
  408. };
  409. /////////////////////////////////////////////////////////////////////////////
  410. // CMainFrame construction/destruction
  411. #if defined(VC70) || defined(VC60)
  412. UINT CMainFrame::OnNcHitTest(CPoint point)
  413. {
  414. if (CWnd::OnNcHitTest(point) == HTRIGHT || CWnd::OnNcHitTest(point) == HTLEFT || CWnd::OnNcHitTest(point) == HTTOP || CWnd::OnNcHitTest(point) == HTBOTTOM)
  415. return HTCLIENT;
  416. return CWnd::OnNcHitTest(point);
  417. }
  418. #else
  419. LRESULT CMainFrame::OnNcHitTest(CPoint point)
  420. {
  421. if (CWnd::OnNcHitTest(point) == HTRIGHT || CWnd::OnNcHitTest(point) == HTLEFT || CWnd::OnNcHitTest(point) == HTTOP || CWnd::OnNcHitTest(point) == HTBOTTOM)
  422. return HTCLIENT;
  423. return CWnd::OnNcHitTest(point);
  424. }
  425. #endif
  426. void CMainFrame::OnNcLButtonDblClk(UINT nFlags, CPoint point)
  427. {
  428. if (nFlags != HTCAPTION)
  429. CMDIFrameWnd::OnNcLButtonDblClk(nFlags, point);
  430. }
  431. // 回调使用;
  432. LRESULT CMainFrame::OnKernelSendMessaage(WPARAM wp, LPARAM lp)
  433. {
  434. CString strBranchId = (LPCTSTR)wp;
  435. CString strSQLInsert = *(CString*)lp;
  436. // 如果连接的是分店,断开分店,回连本店;
  437. g_bBranchModify = FALSE;
  438. g_pMainWnd->OnDisconnect();
  439. g_branchname = g_branchip = _T("");
  440. g_sendhead.bsql = 1;
  441. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  442. g_pMainWnd->OnDisconnect();
  443. // 设置回分店连接;
  444. g_branchip = GetBranchIPbyId(strBranchId);
  445. g_branchname = GetBranchNamebyId(strBranchId);
  446. g_bBranchModify = TRUE;
  447. g_pMainWnd->OnConnect();
  448. return 0;
  449. }
  450. CMainFrame::CMainFrame()
  451. {
  452. // TODO: add member initialization code here
  453. SetConnectionID(INVALID_SOCKET);
  454. m_pMainFrimDlg2 = NULL;
  455. m_bCheckF2F3 = AfxGetApp()->GetProfileInt(LYFZVERSION, "f2f3", 0);
  456. if (0 == ::PathFileExists(g_mainpath + "\\skin\\5.lia"))
  457. {
  458. g_bNoLoginLia = 1;
  459. }
  460. }
  461. CMainFrame::~CMainFrame()
  462. {
  463. if (m_pMainFrimDlg2)
  464. {
  465. m_pMainFrimDlg2->DestroyWindow();
  466. delete m_pMainFrimDlg2;
  467. }
  468. }
  469. void InTheMe(HWND m_hWnd)
  470. {
  471. BOOL bXpVisualStyle = FALSE;
  472. OSVERSIONINFO osvi;
  473. osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  474. ::GetVersionEx(&osvi);
  475. if ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) && (osvi.dwMajorVersion >= 5) && (osvi.dwMinorVersion >= 1))
  476. {
  477. HMODULE hUxTheme = ::LoadLibrary(_T("UxTheme.dll"));
  478. POPENTHEMEDATA pOpenThemeData;
  479. PCLOSETHEMEDATA pCloseThemeData;
  480. if (hUxTheme != NULL)
  481. {
  482. pOpenThemeData = (POPENTHEMEDATA)::GetProcAddress(hUxTheme, "OpenThemeData");
  483. pCloseThemeData = (PCLOSETHEMEDATA)::GetProcAddress(hUxTheme, "CloseThemeData");
  484. HTHEME hButtonTheme = (*pOpenThemeData)(m_hWnd, L"BUTTON");
  485. if (hButtonTheme != NULL)
  486. bXpVisualStyle = TRUE;
  487. (*pCloseThemeData)(hButtonTheme);
  488. }
  489. ::FreeLibrary(hUxTheme);
  490. }
  491. if (bXpVisualStyle)
  492. AfxMessageBox(_T("正在使用视觉主题 "));
  493. else
  494. AfxMessageBox(_T("没有使用视觉主题 "));
  495. }
  496. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  497. {
  498. if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  499. {
  500. // Jeff.创建失败的可能性小,加日志输出;
  501. return -1;
  502. }
  503. if (::PathFileExists(g_mainpath + "\\logo.ico"))
  504. {
  505. Bitmap *bmp = NULL;
  506. LoadImageFromFile((Image**)&bmp, g_mainpath + "\\logo.ico");
  507. // m_hIcon = AfxGetApp()->LoadIcon(g_mainpath+"\\logo.ico");
  508. bmp->GetHICON(&m_hIcon);
  509. delete bmp;
  510. SetIcon(m_hIcon, TRUE); // Set big icon
  511. SetIcon(m_hIcon, FALSE); // Set small icon
  512. }
  513. if (!m_wndClient.SubclassWindow(m_hWndMDIClient))
  514. {
  515. return -1;
  516. }
  517. if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  518. | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  519. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  520. {
  521. TRACE0("Failed to create toolbar\n");
  522. return -1; // fail to create
  523. }
  524. m_wndToolBar.LoadTrueColorToolBar(90, IDB_NORMAL, 0, IDB_DISABLE);
  525. // second toolbar must have different ID
  526. if (!m_wndToolBar2.Create(this, WS_CHILD | WS_VISIBLE | CBRS_LEFT | CBRS_NOALIGN,
  527. AFX_IDW_CONTROLBAR_FIRST + 32) ||
  528. !m_wndToolBar2.LoadToolBar(IDR_TOOLBAR1))
  529. {
  530. TRACE0("Failed to create toolbar\n");
  531. return -1; // fail to create
  532. }
  533. #ifndef NEW_SKIN
  534. if (!m_wndStatusBar.Create(this) ||
  535. !m_wndStatusBar.SetIndicators(indicators,
  536. sizeof(indicators)/sizeof(UINT)))
  537. {
  538. // Jeff.创建失败的可能性小,加日志输出;
  539. TRACE0("Failed to create status bar\n");
  540. return -1; // fail to create
  541. }
  542. m_wndStatusBar.SetPaneInfo(1,ID_INDICATOR_USER,SBPS_NORMAL,200);
  543. m_wndStatusBar.SetPaneText(1,"未登录",TRUE);
  544. #endif
  545. // TODO: Delete these three lines if you don't want the toolbar to
  546. // be dockable
  547. NewMenu2();
  548. ::GetWindowRect(this->m_hWndMDIClient, g_rc);
  549. g_pMainWnd = this;
  550. m_wndToolBar2.Init();
  551. g_rc.top += 38;
  552. g_rc.left += 160;
  553. /* m_WidthScale = (float)g_rc.Width ()/722;
  554. m_HeightScale = (float)g_rc.Height ()/533;*/
  555. g_user.bLongin = 0;
  556. SetTimer(1, 100, NULL);
  557. #ifdef USE_KERNEL_DLL
  558. if ( g_pIMGProcess )
  559. g_pIMGProcess->SetCallBack(ImgImportMergeCallback);
  560. #endif
  561. return 0;
  562. }
  563. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  564. {
  565. if (!CMDIFrameWnd::PreCreateWindow(cs))
  566. return FALSE;
  567. // TODO: Modify the Window class or styles here by modifying
  568. // the CREATESTRUCT cs
  569. cs.style &= ~WS_MAXIMIZEBOX;
  570. cs.style &= ~WS_THICKFRAME;
  571. cs.lpszName = g_title + "影楼管理系统";
  572. cs.style &= ~FWS_ADDTOTITLE;
  573. RECT rect;
  574. HWND hWnd = ::FindWindow("Shell_TrayWnd", 0);
  575. ::GetWindowRect(hWnd, &rect);
  576. cs.x = 0;
  577. cs.y = 0;
  578. cs.cx = GetSystemMetrics(SM_CXSCREEN);
  579. cs.cy = GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top) + 3;
  580. return TRUE;
  581. }
  582. /////////////////////////////////////////////////////////////////////////////
  583. // CMainFrame diagnostics
  584. #ifdef _DEBUG
  585. void CMainFrame::AssertValid() const
  586. {
  587. CMDIFrameWnd::AssertValid();
  588. }
  589. void CMainFrame::Dump(CDumpContext& dc) const
  590. {
  591. CMDIFrameWnd::Dump(dc);
  592. }
  593. #endif //_DEBUG
  594. /////////////////////////////////////////////////////////////////////////////
  595. // CMainFrame message handlers
  596. void CMainFrame::OnDestroy()
  597. {
  598. OnDisconnect();
  599. Transport_UnInit();
  600. m_Mdi.DeleteAll();
  601. if (g_hmouse)UnhookWindowsHookEx(g_hmouse);
  602. CMDIFrameWnd::OnDestroy();
  603. }
  604. void CMainFrame::OnClose()
  605. {
  606. g_bShowBar = 0;
  607. if (m_Mdi.MainClose())
  608. CMDIFrameWnd::OnClose();
  609. }//连接
  610. void CMainFrame::NewMenu2()
  611. {
  612. CMenu *pMemu = GetMenu();
  613. #ifdef BASIC_VERSION
  614. CMenu* submenu = pMemu->GetSubMenu(1);
  615. //submenu->RemoveMenu (IDM_StaffAchievementShow, MF_BYCOMMAND );//Jeff del 2014.06.16
  616. submenu->RemoveMenu (IDM_salaryset, MF_BYCOMMAND );
  617. #endif
  618. #if 0 // 此机用选片菜单项,去掉不用;
  619. {
  620. BOOL checked=AfxGetApp()->GetProfileInt (LYFZVERSION, "status", 0);
  621. if(checked)
  622. {
  623. CMenu* submenu = pMemu->GetSubMenu(1);
  624. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  625. }
  626. }
  627. #endif
  628. #ifndef BASIC_VERSION
  629. {
  630. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status2", 0);
  631. if (checked)
  632. {
  633. #if 0 // Jeff:去掉菜单,此机用于员工业绩查看的菜单选项;
  634. CMenu* submenu = pMemu->GetSubMenu(1);
  635. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  636. #endif
  637. g_bStaffAchievementShow = 1;
  638. SetTimer(3, 100, NULL);
  639. }
  640. }
  641. #endif
  642. if (g_bShowOK == 0)
  643. {
  644. CMenu* submenu = pMemu->GetSubMenu(2);
  645. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  646. }
  647. }
  648. HMENU CMainFrame::NewMenu()
  649. {
  650. //设置菜单为XP风格 IDM_SHOWHIS
  651. BCMenu::SetMenuDrawMode(1);
  652. //若取消下面这句注释,则可看到菜单的图标栏和文字栏背景颜色为白色,
  653. //文字颜色为蓝色,选中项的前景色为紫红色
  654. //m_menuXP.SetMenuXPItemColor(0x00FFFFFF,0x00FFFFFF,0x00FF0000,0x00FF00FF);
  655. // 设置菜单中图标大小为32×32
  656. // m_menuXP.SetIconSize(32,32);
  657. // 加载菜单资源
  658. m_menuXP.LoadMenu(IDR_MAINFRAME);
  659. // 加载菜单对应的工具栏资源
  660. // m_menuXP.LoadToolbar(IDR_MAINFRAME);
  661. /*由于菜单左边栏中默认的图标大小为16×16,而与之对应的Toolbar中图标大小为32×32,
  662. 因此菜单中图标不能正确显示,只显示出工具栏中图标的左上角部分,所以修改菜单中各
  663. 项对应的图标为24b色位图资源IDB_***,或者在LoadMenu之前调用SetIconSize,设置菜单
  664. 中图标大小为32×32*/
  665. // m_menuXP.SetIconSize(24,24);
  666. // m_menuXP.ModifyODMenu(NULL,IDM_YWBU,IDB_YW); //
  667. /* m_menuXP.ModifyODMenu(NULL,ID_FILE_OPEN,IDB_BITMAP5);
  668. m_menuXP.ModifyODMenu(NULL,ID_FILE_SAVE,IDB_BITMAP7);
  669. m_menuXP.ModifyODMenu(NULL,ID_FILE_PRINT,IDB_BITMAP6);
  670. m_menuXP.ModifyODMenu(NULL,ID_APP_ABOUT,IDB_BITMAP3);
  671. m_menuXP.ModifyODMenu(NULL,ID_APP_EXIT,IDB_BITMAP2);*/
  672. // m_menuXP.EnableMenuItem (0, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  673. // m_menuXP.EnableMenuItem (2, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  674. // m_menuXP.EnableMenuItem (3, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  675. // m_menuXP.EnableMenuItem (4, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  676. // m_menuXP.EnableMenuItem (5, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  677. // m_menuXP.EnableMenuItem (8, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  678. #if 0 // Jeff此机用选片菜单项不用;
  679. {
  680. BOOL checked=AfxGetApp()->GetProfileInt (LYFZVERSION, "status", 0);
  681. if(checked)
  682. {
  683. CMenu* submenu = m_menuXP.GetSubMenu(1);
  684. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  685. }
  686. }
  687. #endif
  688. {
  689. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status2", 0);
  690. if (checked)
  691. {
  692. #if 0 // Jeff:去掉此机用于员工业绩查看的菜单选项;
  693. CMenu* submenu = m_menuXP.GetSubMenu(1);
  694. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  695. #endif
  696. g_bStaffAchievementShow = 1;
  697. SetTimer(3, 100, NULL);
  698. }
  699. }
  700. if (g_bShowOK == 0)
  701. {
  702. CMenu* submenu = m_menuXP.GetSubMenu(2);
  703. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  704. }
  705. return(m_menuXP.Detach());
  706. }
  707. ///////////////////////////////////////////////////////
  708. //减少代码
  709. #define OPEN_MENU(x) m_Mdi.Append(pName, RUNTIME_CLASS(x), IDR_MAINFRAME, this, nID)
  710. //响应菜单命令
  711. void CMainFrame::OnCommandMenu(UINT nID) // 所有菜单命令都在这里处理;
  712. {
  713. if (nID >= 2000 && nID <= 2100)
  714. {
  715. OnBranchData(nID);
  716. return;
  717. }
  718. if (g_user.bLongin == 0)
  719. {
  720. if (g_bNoLoginLia)
  721. {
  722. Login dlg;
  723. dlg.SetLiaPath("5.lia");
  724. dlg.DoModal();
  725. }
  726. else
  727. {
  728. Login3 dlg;
  729. dlg.SetLiaPath("5.lia");
  730. dlg.DoModal();
  731. }
  732. return;
  733. if (g_user.bLongin == 0)return;
  734. }
  735. else
  736. {
  737. InsideMsg();
  738. }
  739. ResetTimer();
  740. if (nID >= 1000 && nID <= 1100)
  741. {
  742. OnHistory(nID);
  743. return;
  744. }
  745. LPSTR pName;
  746. //打开窗口
  747. switch (nID)
  748. {
  749. case IDM_PayOutSet:
  750. {
  751. if (IsHasRights(16) == 0)return;
  752. PayOutSet dlg;
  753. dlg.DoModal();
  754. return;
  755. }
  756. case IDM_SPLB:
  757. {
  758. if (IsHasRightsnew(29) == 0)return;
  759. SPLBDlg dlg;
  760. dlg.DoModal();
  761. return;
  762. }
  763. case IDM_JD:
  764. {
  765. if (IsHasRightsnew(49) == 0)return;
  766. SPLBDlg dlg;
  767. dlg.m_mode = 1;
  768. dlg.DoModal();
  769. return;
  770. }
  771. case IDM_AREA:
  772. {
  773. if (IsHasRightsnew(47) == 0)return;
  774. AreaDlg dlg;
  775. dlg.DoModal();
  776. return;
  777. }
  778. case IDM_Psw:
  779. {
  780. Psw dlg;
  781. dlg.DoModal();
  782. return;
  783. }
  784. case IDM_Set:
  785. {
  786. if (IsHasRightsnew(49) == 0)return;
  787. Set dlg;
  788. dlg.DoModal();
  789. return;
  790. }
  791. case IDM_HIDEWINDOW:
  792. {
  793. HideWindow dlg;
  794. dlg.DoModal();
  795. return;
  796. }
  797. case IDM_Logout:// Jeff.注销;
  798. {
  799. if(g_user.bLongin)
  800. WriteLog("退出系统!", "退出系统!");
  801. g_user.bLongin = 0;
  802. g_user.name.Empty();
  803. g_user.rights.Empty();
  804. g_user.account.Empty();
  805. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  806. g_pMainWnd2->RefreshOutlookBar();
  807. #ifndef NEW_SKIN
  808. m_wndStatusBar.SetPaneText(1, "未登录", TRUE);
  809. #endif
  810. m_Mdi.CloseAll();
  811. #ifdef ENTERPRISE_VERSION
  812. g_branchname.Empty();
  813. g_branchip.Empty();
  814. g_pMainWnd->OnDisconnect();
  815. g_bBranchModify = 0;
  816. #endif
  817. if (g_pMainWnd2)
  818. {
  819. g_pMainWnd2->DrawLogin();
  820. g_pMainWnd2->ShowBar(0);
  821. }
  822. g_hisyeararray.RemoveAll();
  823. g_pMainWnd->AddHistoryMenu(&g_hisyeararray);
  824. g_brancharray.RemoveAll();
  825. g_pMainWnd->AddBranchMenu(&g_brancharray);
  826. if (g_bNoLoginLia)
  827. {
  828. Login dlg;
  829. dlg.SetLiaPath("5.lia");
  830. dlg.DoModal();
  831. }
  832. else
  833. {
  834. Login3 dlg;
  835. dlg.SetLiaPath("5.lia");
  836. dlg.DoModal();
  837. }
  838. if (g_user.bLongin == 1)
  839. {
  840. if (g_pMainWnd2)
  841. {
  842. g_pMainWnd2->ShowBar(TRUE,TRUE);
  843. }
  844. }
  845. return;
  846. }
  847. case IDM_TODAY:
  848. pName = (LPSTR)(LPCSTR)"历史订单";
  849. // OPEN_MENU(SalarySet3);
  850. OPEN_MENU(DinDanHistroy);
  851. break;
  852. case IDM_TAKECONTROL:
  853. pName = (LPSTR)(LPCSTR)"摄控表";
  854. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(117)))
  855. OPEN_MENU(TodayForm2);
  856. else
  857. OPEN_MENU(TodayForm);
  858. break;
  859. case IDM_CLIENTMONEY:
  860. pName = (LPSTR)(LPCSTR)"客人付款";
  861. OPEN_MENU(ClientMoney);
  862. break;
  863. case IDM_TAKEAWAYBOOK:
  864. pName = (LPSTR)(LPCSTR)"发片/取件";
  865. OPEN_MENU(outsourcing);
  866. break;
  867. case IDM_CODE:
  868. pName = (LPSTR)(LPCSTR)"商品报表";
  869. OPEN_MENU(SPForm);
  870. break;
  871. case IDM_Daily:
  872. // if(IsHasRightsnew(22)==0)return;
  873. // pName = (LPSTR)(LPCSTR)"日财务表";
  874. // OPEN_MENU(DailyForm);
  875. pName = (LPSTR)(LPCSTR)"沟通助手";
  876. OPEN_MENU(InsideMsg);
  877. break;
  878. case IDM_ProcessAlarm:
  879. pName = (LPSTR)(LPCSTR)"流程监控";
  880. OPEN_MENU(ProcessAlarm);
  881. break;
  882. case IDM_DINDAN:
  883. // if(IsHasRights(7)==0)return;
  884. pName = (LPSTR)(LPCSTR)"订单报表";
  885. OPEN_MENU(DinDanFrom);
  886. break;
  887. case IDM_CLIENT:
  888. //if(IsHasRights(8)==0)return;
  889. pName = (LPSTR)(LPCSTR)"客户报表";
  890. OPEN_MENU(CClientForm);
  891. break;
  892. case IDM_PayOutInput:
  893. if (IsHasRightsnew(20) == 0)return;
  894. pName = (LPSTR)(LPCSTR)"现金支出";
  895. OPEN_MENU(PayOutInput);
  896. break;
  897. case IDM_salaryset:
  898. if (IsHasRightsnew(25) == 0)return;
  899. pName = (LPSTR)(LPCSTR)"工资设置";
  900. OPEN_MENU(SalarySet);
  901. break;
  902. case IDM_mysalary:
  903. if (IsHasRights(16) == 0)return;
  904. pName = (LPSTR)(LPCSTR)"我的工资";
  905. OPEN_MENU(MySalary);
  906. break;
  907. case IDM_SP:
  908. // if(IsHasRightsnew(29)==0)return;
  909. pName = (LPSTR)(LPCSTR)"商品设置";
  910. OPEN_MENU(ShangPin);
  911. break;
  912. case IDM_WORKER:
  913. if (IsHasRightsnew(27) == 0)return;
  914. pName = (LPSTR)(LPCSTR)"员工设置";
  915. OPEN_MENU(Worker);
  916. break;
  917. case IDM_TAOXI:
  918. if (IsHasRightsnew(30) == 0)return;
  919. pName = (LPSTR)(LPCSTR)"套系设置";
  920. OPEN_MENU(TXDlg);
  921. break;
  922. case IDM_TAOXISP:
  923. if (IsHasRightsnew(30) == 0)return;
  924. pName = (LPSTR)(LPCSTR)"套系赠送商品设置";
  925. OPEN_MENU(TXSPDlg);
  926. break;
  927. case IDM_Provider:
  928. if (IsHasRightsnew(32) == 0)return;
  929. pName = (LPSTR)(LPCSTR)"供应商设置";
  930. OPEN_MENU(ProviderDlg);
  931. break;
  932. case IDM_BUMEN:
  933. {
  934. if (IsHasRightsnew(49) == 0)return;
  935. BuMenDlg dlg;
  936. dlg.DoModal();
  937. return;
  938. }
  939. case IDM_Account:
  940. if (IsHasRightsnew(49) == 0)return;
  941. pName = (LPSTR)(LPCSTR)"账号管理";
  942. OPEN_MENU(Account);
  943. break;
  944. case IDM_YLCD:
  945. {
  946. //AfxMessageBox("IDM_YLCD");
  947. ::CopyFile(_T(g_path7 + "\\接单系统\\Regsvr32.exe"), _T(g_mainpath + "\\Regsvr32.exe"), 0);
  948. ::CopyFile(_T(g_path7 + "\\接单系统\\Flash9f.ocx"), _T(g_mainpath + "\\Flash9f.ocx"), 0);
  949. CString temp;
  950. temp.Format("%s\\regsvr32.exe /s %s\\Flash9f.OCX", g_mainpath, g_mainpath);
  951. WinExec(temp, SW_HIDE);
  952. ::CopyFile(_T(g_path7 + "\\接单系统\\接单系统.exe"), _T(g_mainpath + "\\接单系统.exe"), 0);
  953. ::CopyFile(_T(g_path7 + "\\接单系统\\my32.dll"), _T(g_mainpath + "\\my32.dll"), 0);
  954. ::CopyFile(_T(g_path7 + "\\接单系统\\server.dat"), _T(g_mainpath + "\\server.dat"), 0);
  955. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\接单系统.exe"), g_server, NULL, SW_SHOWNORMAL);
  956. }
  957. break;
  958. case IDM_YLCDMANAGE:
  959. ::CopyFile(_T(g_path7 + "\\接单系统\\资源管理器.exe"), _T(g_mainpath + "\\资源管理器.exe"), 0);
  960. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\资源管理器.exe"), g_server, NULL, SW_SHOWNORMAL);
  961. break;
  962. }
  963. }
  964. //减少代码
  965. ///////////////////////////////////////////////////////////////////////////////
  966. void CMainFrame::OnDisconnect()
  967. {
  968. printf("断开TCP连接\n");
  969. //CClientTunnel::GetInstance()->net_CloseSocket();
  970. m_tClientTunnel.net_CloseSocket();
  971. SetConnectionID(INVALID_SOCKET);
  972. }
  973. void CMainFrame::ProcessLoginResponse(void *pLoginResult)
  974. {
  975. if (NULL == pLoginResult) return;
  976. LOGIN_RESULT_STRU *ptLoginResult = (LOGIN_RESULT_STRU *)pLoginResult;
  977. DWORD dwConnectionID = ptLoginResult->tCommonMsg.dwConnectionID;
  978. SetConnectionID(dwConnectionID);
  979. BYTE byResult = ptLoginResult->byResult;
  980. if (LOGIN_RESULT_SUC == byResult)
  981. {
  982. //AfxMessageBox("登录成功"); // Jeff test;
  983. }
  984. else
  985. {
  986. OnDisconnect();
  987. }
  988. }
  989. /************************************************************************/
  990. /* 函数:ProcessLoginRequest[3/3/2016 IT];
  991. /* 描述:登陆服务器;
  992. /* 参数:;
  993. /* [IN] :;
  994. /* [OUT] :;
  995. /* [IN/OUT] :;
  996. /* 返回:登陆成功返回TRUE;
  997. /* 注意:;
  998. /* 示例:;
  999. /*
  1000. /* 修改:;
  1001. /* 日期:;
  1002. /* 内容:;
  1003. /************************************************************************/
  1004. BOOL CMainFrame::ProcessLoginRequest()
  1005. {
  1006. // 1.设置通信类型MSG_LOGIN_REQ,为登陆请求;
  1007. WORD wMessageId = 0;
  1008. if (g_conntype == 0 && !g_bConnLYFZ)
  1009. wMessageId = (MSG_LOGIN_REQ + 0X1FFF);
  1010. else// if (g_bConnLYFZ )
  1011. wMessageId = MSG_LOGIN_REQ;
  1012. // 2.填充发送数据;
  1013. TLOGIN_STRU tLogonInfo = { 0 };
  1014. tLogonInfo.tCommonMsg.dwConnectionID = GetConnectionID();//此时m_dwConnectionID为INVALIDE_SOCKET;
  1015. tLogonInfo.tCommonMsg.wMessageId = wMessageId;
  1016. CString strUserName = newGUID();// 以随机数作为登陆时的用户名称;
  1017. strUserName.TrimLeft();
  1018. strUserName.TrimRight();
  1019. #if defined(VC80) || defined(VC70) || defined(VC60)
  1020. strcpy(tLogonInfo.tUserInfo.szUserName, strUserName);
  1021. #else
  1022. strcpy_s(tLogonInfo.tUserInfo.szUserName, 31, strUserName);
  1023. #endif
  1024. DWORD dwDataLen = sizeof(TLOGIN_STRU);
  1025. // 3.填充数据头;
  1026. TMessageHeader tHeader = { 0 };
  1027. tHeader.wMessageId = wMessageId;
  1028. tHeader.dwDataLen = dwDataLen;
  1029. // 4.发送数据;
  1030. //unsigned long ulSendLen = CClientTunnel::GetInstance()->net_Send(&tHeader, (void *)&tLogonInfo, dwDataLen);
  1031. unsigned long ulSendLen = m_tClientTunnel.net_Send(&tHeader, (void *)&tLogonInfo, dwDataLen);
  1032. if (ulSendLen == SOCKET_ERROR)
  1033. {
  1034. return 0;
  1035. }
  1036. return 1;
  1037. }
  1038. DWORD CMainFrame::GetConnectionID()
  1039. {
  1040. return m_dwConnectionID;
  1041. }
  1042. void CMainFrame::SetConnectionID(DWORD dwConnection)
  1043. {
  1044. m_dwConnectionID = dwConnection;
  1045. }
  1046. /************************************************************************/
  1047. /* 函数:ProcessChatMessageRequest2[3/3/2016 IT];
  1048. /* 描述:;
  1049. /* 参数:;
  1050. /* [IN] code:;
  1051. /* 返回:void;
  1052. /* 注意:
  1053. OnConnect() -> ProcessChatMessageRequest()
  1054. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1055. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1056. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1057. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1058. 5.关闭对话框和断开连接;;
  1059. /* 示例:;
  1060. /*
  1061. /* 修改:;
  1062. /* 日期:;
  1063. /* 内容:;
  1064. /************************************************************************/
  1065. void CMainFrame::ProcessChatMessageRequest2(BYTE code)
  1066. {
  1067. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1068. SendDataDlg dlg;
  1069. dlg.m_bycode = code;
  1070. dlg.DoModal();
  1071. }
  1072. //*********************************************//
  1073. /*
  1074. 函数:ProcessChatMessageRequest2
  1075. 参数:CString sql [IN]
  1076. 返回:无
  1077. 过程:OnConnect() -> ProcessChatMessageRequest()
  1078. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1079. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1080. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1081. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1082. 5.关闭对话框和断开连接;
  1083. */
  1084. //*********************************************//
  1085. void CMainFrame::ProcessChatMessageRequest2(CString sql)
  1086. {
  1087. if ((sql.Find("insert") != -1 || sql.Find("update") != -1 || sql.Find("delete") != -1) && g_branchname != "" && g_bBranchModify == 0)
  1088. {
  1089. AfxMessageBox("当前为分店数据查看状态,不能更改分店数据!", MB_ICONSTOP);
  1090. g_bSendOK = 0;
  1091. return;
  1092. }
  1093. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1094. SendDataDlg dlg;
  1095. dlg.m_strSQL = sql;
  1096. dlg.DoModal();
  1097. }
  1098. //*********************************************//
  1099. /*
  1100. 函数:ProcessChatMessageRequest2
  1101. 参数:BYTE *pData [IN], int length [IN]
  1102. 返回:无
  1103. 过程:OnConnect() -> ProcessChatMessageRequest()
  1104. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1105. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1106. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1107. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1108. 5.关闭对话框和断开连接;
  1109. */
  1110. //*********************************************//
  1111. void CMainFrame::ProcessChatMessageRequest2(BYTE *pData, int length)
  1112. {
  1113. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1114. SendDataDlg dlg;
  1115. dlg.m_pData = pData;
  1116. dlg.m_nlength = length;
  1117. dlg.DoModal(); // DoModal未执行完时,就被其他函数销毁,导致局部函数dlg无效;
  1118. }
  1119. /************************************************************************/
  1120. /*
  1121. 函数:ProcessChatMessageRequest
  1122. 描述:对服务发送数据;
  1123. 参数:void *szDataBuf[IN], int nDataLen[IN]
  1124. 返回:发送成功与否;
  1125. */
  1126. /************************************************************************/
  1127. BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)
  1128. {
  1129. #ifdef _DEBUG
  1130. if (g_nSendCode == 18)
  1131. {
  1132. INT nSendLen = nDataLen + sizeof(TCHAT_MESSAGE_STRU) + sizeof(TMessageHeader);
  1133. if ( nSendLen == 0)
  1134. {
  1135. printf("dfdfdfdfd\n");
  1136. }
  1137. }
  1138. #endif
  1139. // 1.获取当前与服务器连接的id;
  1140. DWORD dwFromUserID = GetConnectionID();
  1141. // 2.设置通信类型为MSG_CHATMESSAGE_REQ;
  1142. WORD wMessageId = 0;
  1143. if (g_conntype == 0 && !g_bConnLYFZ)
  1144. wMessageId = (MSG_CHATMESSAGE_REQ + 0X3FFF);
  1145. else
  1146. wMessageId = MSG_CHATMESSAGE_REQ;
  1147. // 3.计算出欲发送的数据的长度 dwDataLen;
  1148. DWORD dwDataLen = sizeof(TCHAT_MESSAGE_STRU) + nDataLen;
  1149. BYTE *pSendData = new BYTE[dwDataLen];
  1150. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU*)pSendData;
  1151. memset(pChatMessage, 0x00, dwDataLen);
  1152. // 3.1.g_nYearpos==-1,表示连接是当前主数据库,其他值表示历史数据库;
  1153. if (g_nYearpos == -1)
  1154. g_sendhead.length[99] = g_nYearpos;
  1155. else
  1156. g_sendhead.length[99] = g_nYearpos * 32142953 + 10966236;
  1157. g_sendhead.length[98] = 987123768;
  1158. memcpy(pSendData, &g_sendhead, sizeof(g_sendhead));
  1159. #ifdef ENTERPRISE_VERSION
  1160. if (g_bBranchModify == 0)
  1161. #if defined(VC60) || defined(VC70)
  1162. strcpy(pChatMessage->szFromUserName, g_branchname);
  1163. #else
  1164. strcpy_s(pChatMessage->szFromUserName, 30, g_branchname);
  1165. #endif
  1166. #endif
  1167. // 4.填充发送的数据结构;
  1168. pChatMessage->tCommonMsg.dwConnectionID = GetConnectionID();
  1169. pChatMessage->tCommonMsg.wMessageId = wMessageId;
  1170. pChatMessage->dwFromUserID = dwFromUserID;
  1171. pChatMessage->dwToUserID = g_nSendCode;//▲▲g_nSendCode在服务端同为dwToUserID;
  1172. pChatMessage->wMessageLen = nDataLen;
  1173. memcpy(pChatMessage->byFileContent, szDataBuf, nDataLen);
  1174. // 5.填充数据头;
  1175. TMessageHeader tHeader = { 0 };
  1176. tHeader.wMessageId = wMessageId;
  1177. tHeader.dwDataLen = dwDataLen;
  1178. // 6.发送数据;
  1179. BOOL bRet = 0;
  1180. //unsigned long ulSendLen = CClientTunnel::GetInstance()->net_Send(&tHeader, (void *)pChatMessage, dwDataLen);
  1181. unsigned long ulSendLen = m_tClientTunnel.net_Send(&tHeader, (void *)pChatMessage, dwDataLen);
  1182. if (ulSendLen != SOCKET_ERROR)
  1183. {
  1184. bRet = 1;
  1185. }
  1186. // 7.发送完毕,释放内存;
  1187. delete[] pSendData;
  1188. return bRet;
  1189. }
  1190. /************************************************************************/
  1191. /*
  1192. 函数:ProcessChatMessageResponse
  1193. 描述:接收服务返回的数据;
  1194. 参数:void *pResponse[IN]
  1195. 返回:无;
  1196. 调用关系:
  1197. 1.由 void CMainFrame::ProcessNetEvent(...)调用
  1198. */
  1199. /************************************************************************/
  1200. void CMainFrame::ProcessChatMessageResponse(void *pResponse)
  1201. {
  1202. // 1.数据空,直接返回;
  1203. if (NULL == pResponse)
  1204. return;
  1205. // 2.数据解析过程;
  1206. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pResponse;
  1207. int nMessageLen = pChatMessage->wMessageLen;
  1208. int nMessageLen2 = pChatMessage->dwToUserID; // 在服务器中被处理了,一般使dwToUserID=wMessageLen;
  1209. // Jeff.dwFromUserID==8888表示的内容是更新客户端skin界面数据,只有两处dwToUserID==211和dwToUserID==21;
  1210. // Jeff.其余的大多数都是 dwFromUserID = wMessageLen = dwToUserID 三者相等;
  1211. if (nMessageLen == nMessageLen2 && pChatMessage->dwFromUserID != 8888)
  1212. {
  1213. // 2.1.清除全局变量g_pData数据,用于保存接收的实际数据;
  1214. if (g_pData)
  1215. delete[]g_pData;
  1216. g_pData = NULL;
  1217. g_pData = new BYTE[nMessageLen];
  1218. memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
  1219. memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
  1220. g_nLeng = nMessageLen;
  1221. if (nMessageLen <= sizeof(DWORD))
  1222. {
  1223. memcpy(&g_ncount, pChatMessage->byFileContent, sizeof(DWORD));
  1224. }
  1225. KillTimer(2);
  1226. if (g_hSendWnd)
  1227. {
  1228. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);//关闭发送对话框;
  1229. }
  1230. }
  1231. else if (nMessageLen == nMessageLen2 && pChatMessage->dwFromUserID == 8888)
  1232. {
  1233. if (g_pData2)
  1234. delete[]g_pData2;
  1235. g_pData2 = NULL;
  1236. g_pData2 = new BYTE[nMessageLen2];
  1237. memcpy(g_pData2, pChatMessage->byFileContent, nMessageLen2);
  1238. g_nLeng2 = nMessageLen2;
  1239. KillTimer(2);
  1240. if (g_hSendWnd)
  1241. {
  1242. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1243. }
  1244. }
  1245. else if (nMessageLen2 == 42 )
  1246. {
  1247. if (g_pData)
  1248. delete[]g_pData;
  1249. g_pData = NULL;
  1250. g_pData = new BYTE[nMessageLen];
  1251. memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
  1252. memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
  1253. g_nLeng = nMessageLen;
  1254. g_bSendOK = TRUE;
  1255. KillTimer(2);
  1256. if (g_hSendWnd)
  1257. {
  1258. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);//关闭发送对话框;
  1259. }
  1260. }
  1261. else if ( nMessageLen2 == 43)
  1262. {
  1263. if (g_pData)
  1264. delete[]g_pData;
  1265. g_pData = NULL;
  1266. KillTimer(2);
  1267. if (g_hSendWnd)
  1268. {
  1269. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1270. }
  1271. return;
  1272. }
  1273. else // 登陆返回;
  1274. {
  1275. if (g_bConnLYFZ)
  1276. {
  1277. if (g_pData)
  1278. delete[]g_pData;
  1279. g_pData = NULL;
  1280. g_pData = new BYTE[nMessageLen];
  1281. memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
  1282. memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
  1283. g_nLeng = nMessageLen;
  1284. if (nMessageLen <= sizeof(DWORD))
  1285. {
  1286. memcpy(&g_ncount, pChatMessage->byFileContent, sizeof(DWORD));
  1287. }
  1288. KillTimer(2);
  1289. if (g_hSendWnd)
  1290. {
  1291. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1292. }
  1293. return;
  1294. }
  1295. if (g_conntype) // Jeff.g_conntype == 1,表示连接公司服务器的返回,用于集团版解析*.ly.com的IP地址;
  1296. {
  1297. // KillTimer(2);
  1298. char *szChatMessage = new char[nMessageLen + 1];
  1299. memset(szChatMessage, 0x00, nMessageLen + 1);
  1300. memcpy(szChatMessage, pChatMessage->byFileContent, nMessageLen);
  1301. g_server = szChatMessage;
  1302. delete[]szChatMessage;
  1303. CStdioFile fp;
  1304. CString path = g_mainpath + "\\ip.txt";
  1305. ::DeleteFile(path); // 删除ip.txt;
  1306. fp.Open(path, CFile::modeCreate | CFile::modeWrite);
  1307. fp.WriteString(g_server);
  1308. fp.Close();
  1309. g_conntype = 0;
  1310. // g_serverip=g_server;
  1311. return;
  1312. }
  1313. if (g_pData2 == NULL)
  1314. {
  1315. g_pData2 = new BYTE[nMessageLen2];
  1316. g_nLeng2 = 0;
  1317. }
  1318. memcpy(g_pData2 + g_nLeng2, pChatMessage->byFileContent, nMessageLen);
  1319. g_nLeng2 += nMessageLen;
  1320. if (g_nLeng2 == nMessageLen2)//已收完
  1321. {
  1322. KillTimer(2);
  1323. if (g_hSendWnd)
  1324. {
  1325. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1326. }
  1327. }
  1328. else
  1329. {
  1330. KillTimer(2);
  1331. SetTimer(2, g_ntimeout, NULL);
  1332. }
  1333. }
  1334. }
  1335. #if USE_SHARE_FLORD
  1336. /************************************************************************/
  1337. /*
  1338. Date: 2015-04-11
  1339. Author: Jeff
  1340. 函数:GetSharePathInfo
  1341. 描述:获取共享目录表的所有信息;
  1342. 参数:
  1343. 返回:成功返回TRUE;
  1344. 注意:获取的表记录存储在全局变量g_aryOfSharePathInfo中;
  1345. 调用约定:在登陆软件时调用,且必须连接的服务器是本店的;
  1346. */
  1347. /************************************************************************/
  1348. BOOL CMainFrame::GetSharePathInfo()
  1349. {
  1350. // 1.连接的数据库必须是本局域网的服务器;
  1351. if ( g_bAllBranch || !g_branchname.IsEmpty() || !g_branchip.IsEmpty() )
  1352. {
  1353. // 非当前局域网服务器;
  1354. return FALSE;
  1355. }
  1356. // 2.获取当前连接的分店域名是否与g_domain一致;
  1357. g_sendhead.bsql = 0;
  1358. g_sendhead.code[0] = 29;
  1359. g_sendhead.tabcount = 1;
  1360. g_pMainWnd->ProcessChatMessageRequest2(23);
  1361. if ( !g_bSendOK )
  1362. {
  1363. // 连接服务器失败;
  1364. return FALSE;
  1365. }
  1366. CArray<CStringArray,CStringArray> strArray;
  1367. DataToArray(&strArray);
  1368. CString strCurBranchDomain = _T("");
  1369. if ( strArray.GetSize() )
  1370. {
  1371. strCurBranchDomain = strArray.ElementAt(0).ElementAt(0);
  1372. if ( strCurBranchDomain.Find(_T(".ly.com")) == -1)
  1373. {
  1374. // 当前获取的域名有错;
  1375. return FALSE;
  1376. }
  1377. }
  1378. if ( g_domain.CompareNoCase(strCurBranchDomain) != 0)
  1379. {
  1380. // 当前连接的分店域名与局域网服务器域名不一致;
  1381. return FALSE;
  1382. }
  1383. // 3.获取可用的共享信息;//select * from NetShareInfo where enable = 1;
  1384. CString strFilter = _T("");
  1385. strFilter.Format(_T("enable = 1"));
  1386. int g_nYearposTemp=g_nYearpos;
  1387. g_nYearpos=-1;
  1388. g_bSendOK = 0;
  1389. g_sendhead.bsql = 0;
  1390. g_sendhead.code[0] = 236;
  1391. g_sendhead.tabcount = 1;
  1392. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  1393. g_nYearpos = g_nYearposTemp;
  1394. if ( !g_bSendOK )
  1395. {
  1396. // 获取共享信息失败;
  1397. return FALSE;
  1398. }
  1399. g_aryOfSharePathInfo.RemoveAll();
  1400. DataToArray(&g_aryOfSharePathInfo);
  1401. return g_aryOfSharePathInfo.GetSize() ? TRUE : FALSE;
  1402. }
  1403. #endif
  1404. BOOL CMainFrame::OnConnectBranch()
  1405. {
  1406. if (g_branchip == "")
  1407. {
  1408. return 0;
  1409. }
  1410. if ( 0 == GetSysIniInfo(g_szModulePath, g_branchname + _T(".ini")) )
  1411. {
  1412. //WriteTextLog("分店配置存在:%s, ip:%s, 端口号:%d", g_branchname, g_branchip, g_dwCSPort);
  1413. if ( g_szHostComputerIP[0] != '\0') // 如果分店配置文件不填ip,则使用公司记录的ip;
  1414. g_branchip = g_szHostComputerIP;
  1415. MyGetIPByName2(g_branchip);
  1416. }
  1417. else
  1418. {
  1419. // 调用过一次GetSysIniInfo, g_dwCSPort会被清空;
  1420. GetSysIniInfo();
  1421. }
  1422. g_conntype = 0;
  1423. CString strServerAddress = g_branchip;
  1424. char *szServerAddress = strServerAddress.GetBuffer(0);
  1425. strServerAddress.ReleaseBuffer();
  1426. /*for Client, IP and Port can be 0,
  1427. and for Server, IP is LocalIP, and Port is Listening Port*/
  1428. //int nResult = CClientTunnel::GetInstance()->net_OpenSocket(
  1429. int nResult = m_tClientTunnel.net_OpenSocket(
  1430. Transport_Client,
  1431. 0,
  1432. HandleClientNetEvent,
  1433. this);
  1434. if (TRANSPORT_OK != nResult)
  1435. {
  1436. // AfxMessageBox("网络初始化失败!");
  1437. return 0;
  1438. }
  1439. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1440. DWORD wPort = g_dwCSPort;
  1441. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1442. if (TRANSPORT_OK != nResult)
  1443. {
  1444. m_tClientTunnel.net_CloseSocket();
  1445. return OnConnectBranch2();
  1446. }
  1447. return ProcessLoginRequest();
  1448. }
  1449. BOOL CMainFrame::OnConnectBranch2()
  1450. {
  1451. if (g_branchip2 == "")
  1452. {
  1453. return 0;
  1454. }
  1455. g_conntype = 0;
  1456. CString strServerAddress = g_branchip2;
  1457. char *szServerAddress = strServerAddress.GetBuffer(0);
  1458. strServerAddress.ReleaseBuffer();
  1459. /*for Client, IP and Port can be 0,
  1460. and for Server, IP is LocalIP, and Port is Listening Port*/
  1461. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1462. 0,
  1463. HandleClientNetEvent,
  1464. this);
  1465. if (TRANSPORT_OK != nResult)
  1466. {
  1467. // AfxMessageBox("网络初始化失败!");
  1468. return 0;
  1469. }
  1470. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1471. DWORD wPort = SERVER_PORT; // 5678
  1472. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1473. if (TRANSPORT_OK != nResult)
  1474. {
  1475. m_tClientTunnel.net_CloseSocket();
  1476. return 0;
  1477. }
  1478. return ProcessLoginRequest();
  1479. }
  1480. BOOL CMainFrame::OnConnectIP()
  1481. {
  1482. CString strServerAddress = g_server;
  1483. char *szServerAddress = strServerAddress.GetBuffer(0);
  1484. strServerAddress.ReleaseBuffer();
  1485. /*for Client, IP and Port can be 0,
  1486. and for Server, IP is LocalIP, and Port is Listening Port*/
  1487. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1488. 0,
  1489. HandleClientNetEvent,
  1490. this);
  1491. if (TRANSPORT_OK != nResult)
  1492. {
  1493. // AfxMessageBox("网络初始化失败!");
  1494. return 0;
  1495. }
  1496. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1497. DWORD wPort = SERVER_PORT; // 5678
  1498. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1499. if (TRANSPORT_OK != nResult)
  1500. {
  1501. m_tClientTunnel.net_CloseSocket();
  1502. return 0;
  1503. }
  1504. return ProcessLoginRequest();
  1505. }
  1506. //ip.txt
  1507. BOOL CMainFrame::OnConnectLYFZ()
  1508. {
  1509. #ifdef _DEBUG
  1510. CString strBranchIP = "192.168.1.66";
  1511. #else
  1512. CString strBranchIP = "lijiafz.vicp.net";
  1513. #endif
  1514. MyGetIPByName2(strBranchIP);
  1515. if (strBranchIP == "")
  1516. {
  1517. return 0;
  1518. }
  1519. g_conntype = 0; // Jeff.Delete at 2014.10.18
  1520. //g_conntype = 1;
  1521. CString strServerAddress = strBranchIP;
  1522. char *szServerAddress = strServerAddress.GetBuffer(0);
  1523. strServerAddress.ReleaseBuffer();
  1524. /*for Client, IP and Port can be 0,
  1525. and for Server, IP is LocalIP, and Port is Listening Port*/
  1526. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1527. 0,
  1528. HandleClientNetEvent,
  1529. this);
  1530. if (TRANSPORT_OK != nResult)
  1531. {
  1532. return 0;
  1533. }
  1534. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1535. DWORD wPort = GetPort();
  1536. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1537. if (TRANSPORT_OK != nResult)
  1538. {
  1539. m_tClientTunnel.net_CloseSocket();
  1540. return 0;
  1541. }
  1542. return ProcessLoginRequest();
  1543. }
  1544. BOOL CMainFrame::OnConnect()
  1545. {
  1546. // 1.Jeff 断开(如果有在在未关的连接)之前的连接;
  1547. OnDisconnect();
  1548. // 2.根据需要连接指定的服务器;
  1549. if (g_bBranchModify)
  1550. {
  1551. // Jeff.g_bBranchModify在g_bGenBranchData=1时,在welcome::OnTimer里被设置为1;
  1552. return OnConnectBranch();// 连接集团版分店;
  1553. }
  1554. if (g_bConnLYFZ)
  1555. {
  1556. return OnConnectLYFZ();// 连接公司服务端程序;
  1557. }
  1558. g_conntype = 0;
  1559. CString strServerAddress = g_server;
  1560. // 3.如果dbconfig.dat里保存的是*.ly.com的信息,就要读取ip.txt里的IP地址;
  1561. if (g_serverbak.Find(".ly.com") != -1)
  1562. {
  1563. strServerAddress = g_serverbak;
  1564. CStdioFile fp;
  1565. CString path = g_mainpath + "\\ip.txt";
  1566. if (::PathFileExists(path))
  1567. {
  1568. fp.Open(path, CFile::modeRead);
  1569. fp.ReadString(g_server);
  1570. fp.Close();
  1571. if (OnConnectIP())
  1572. {
  1573. // g_serverip=g_server;
  1574. return 1;
  1575. }
  1576. g_server = strServerAddress;
  1577. OnDisconnect();//MessageBox("ip失败");
  1578. }
  1579. g_conntype = 1; // Jeff.连接公司服务器,用于获取集团版*.ly.com的解析IP结果;
  1580. strServerAddress = "lijiafz.vicp.net";
  1581. MyGetIPByName2(strServerAddress);
  1582. if (strServerAddress.IsEmpty())
  1583. {
  1584. return 0;//OnConnect2();
  1585. }
  1586. }
  1587. else if (g_ntimeout == 29000)//非远程 30000
  1588. {
  1589. strServerAddress = g_serverarray.ElementAt(g_conpos);
  1590. }
  1591. // 4.如果没有IP.txt或dbconfig.dat里的不是ly.com信息,而是一般的计算机名称;
  1592. char *szServerAddress = strServerAddress.GetBuffer(0);
  1593. strServerAddress.ReleaseBuffer();
  1594. // AfxMessageBox("连接:"+strServerAddress);
  1595. /*for Client, IP and Port can be 0,
  1596. and for Server, IP is LocalIP, and Port is Listening Port*/
  1597. // 5.创建通信对象连接;
  1598. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1599. 0,
  1600. HandleClientNetEvent,
  1601. this);
  1602. if (TRANSPORT_OK != nResult)
  1603. {
  1604. return 0;
  1605. }
  1606. GetSysIniInfo();
  1607. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1608. DWORD wPort = g_dwCSPort;
  1609. if (g_conntype) wPort = GetPort();
  1610. // 6.连接公司服务器或影楼服务器;
  1611. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1612. if (TRANSPORT_OK != nResult)
  1613. {
  1614. m_tClientTunnel.net_CloseSocket();
  1615. if (g_conntype)// Jeff.连接公司服务器,用于获取集团版*.ly.com的解析IP结果;
  1616. {
  1617. return 0;//OnConnect2();
  1618. }
  1619. if (g_serverarray.GetSize() > 1)
  1620. {
  1621. if (g_conpos < (g_serverarray.GetSize() - 1))
  1622. {
  1623. g_conpos++;
  1624. return OnConnect();
  1625. }
  1626. else
  1627. {
  1628. g_conpos = 0;
  1629. return 0;
  1630. }
  1631. }
  1632. return 0;
  1633. }
  1634. return ProcessLoginRequest();
  1635. }
  1636. BOOL CMainFrame::OnConnect2()
  1637. {
  1638. g_conntype = 2;
  1639. CString server = "http://www.lyfz.net/download/ip.txt";
  1640. char buf[MAX_PATH];
  1641. ::GetTempPath(sizeof(buf), buf);
  1642. CString m_strTempDir = buf;
  1643. DWORD m_dwHttpRequestFlags = HSR_DOWNLOAD | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
  1644. INTERNET_PORT m_dwPort;
  1645. DWORD dwType;
  1646. CInternetSession m_cis;
  1647. CHttpConnection *m_pHttp;
  1648. CString m_strServer;
  1649. CString m_strIniPath;
  1650. AfxParseURL(server, dwType, m_strServer, m_strIniPath, m_dwPort);
  1651. if (dwType != AFX_INET_SERVICE_HTTP)
  1652. {
  1653. return 0;//OnConnect3();
  1654. }
  1655. m_cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5);
  1656. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1657. try
  1658. {
  1659. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1660. }
  1661. catch (CInternetException* pEx)
  1662. {
  1663. return 0;//OnConnect3();
  1664. }
  1665. CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_GET,
  1666. m_strIniPath, NULL, 1, NULL, NULL, m_dwHttpRequestFlags);
  1667. try
  1668. {
  1669. pFile->SendRequest();
  1670. }
  1671. catch (CInternetException* pEx)
  1672. {
  1673. pFile->Close();
  1674. return 0;//OnConnect3();
  1675. }
  1676. if (pFile)
  1677. {
  1678. CStdioFile csf;
  1679. csf.Open(m_strTempDir + "\\ip.txt", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
  1680. char buf[2048];
  1681. int n;
  1682. while ((n = pFile->Read(buf, 2048)) > 0)
  1683. csf.Write(buf, n);
  1684. csf.Close();
  1685. pFile->Close();
  1686. }
  1687. CString strServerAddress;
  1688. CStdioFile fp;
  1689. fp.Open(m_strTempDir + "\\ip.txt", CFile::modeRead);
  1690. fp.ReadString(strServerAddress);
  1691. fp.Close();
  1692. char *szServerAddress = strServerAddress.GetBuffer(0);
  1693. strServerAddress.ReleaseBuffer();
  1694. /*for Client, IP and Port can be 0,
  1695. and for Server, IP is LocalIP, and Port is Listening Port*/
  1696. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1697. 0,
  1698. HandleClientNetEvent,
  1699. this);
  1700. if (TRANSPORT_OK != nResult)
  1701. {
  1702. return 0;
  1703. }
  1704. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1705. DWORD wPort = SERVER_PORT; // 5678
  1706. if (g_conntype)wPort = GetPort();
  1707. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1708. if (TRANSPORT_OK != nResult)
  1709. {
  1710. m_tClientTunnel.net_CloseSocket();
  1711. return 0;//OnConnect3();
  1712. }
  1713. return ProcessLoginRequest();
  1714. }
  1715. BOOL CMainFrame::OnConnect3()
  1716. {
  1717. g_conntype = 3;
  1718. CString server = "http://photo.bjlyfz.com/download/ip.txt";
  1719. char buf[MAX_PATH];
  1720. ::GetTempPath(sizeof(buf), buf);
  1721. CString m_strTempDir = buf;
  1722. DWORD m_dwHttpRequestFlags = HSR_DOWNLOAD | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
  1723. INTERNET_PORT m_dwPort;
  1724. DWORD dwType;
  1725. CInternetSession m_cis;
  1726. CHttpConnection *m_pHttp;
  1727. CString m_strServer;
  1728. CString m_strIniPath;
  1729. AfxParseURL(server, dwType, m_strServer, m_strIniPath, m_dwPort);
  1730. if (dwType != AFX_INET_SERVICE_HTTP)
  1731. {
  1732. return FALSE;
  1733. }
  1734. m_cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5);
  1735. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1736. try
  1737. {
  1738. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1739. }
  1740. catch (CInternetException* pEx)
  1741. {
  1742. return false;
  1743. }
  1744. CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_GET,
  1745. m_strIniPath, NULL, 1, NULL, NULL, m_dwHttpRequestFlags);
  1746. try
  1747. {
  1748. pFile->SendRequest();
  1749. }
  1750. catch (CInternetException* pEx)
  1751. {
  1752. pFile->Close();
  1753. return false;
  1754. }
  1755. if (pFile)
  1756. {
  1757. CStdioFile csf;
  1758. csf.Open(m_strTempDir + "\\ip.txt", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
  1759. char buf[2048];
  1760. int n;
  1761. while ((n = pFile->Read(buf, 2048)) > 0)
  1762. csf.Write(buf, n);
  1763. csf.Close();
  1764. pFile->Close();
  1765. }
  1766. CString strServerAddress;
  1767. CStdioFile fp;
  1768. fp.Open(m_strTempDir + "\\ip.txt", CFile::modeRead);
  1769. fp.ReadString(strServerAddress);
  1770. fp.Close();
  1771. char *szServerAddress = strServerAddress.GetBuffer(0);
  1772. strServerAddress.ReleaseBuffer();
  1773. /*for Client, IP and Port can be 0,
  1774. and for Server, IP is LocalIP, and Port is Listening Port*/
  1775. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1776. 0,
  1777. HandleClientNetEvent,
  1778. this);
  1779. if (TRANSPORT_OK != nResult)
  1780. {
  1781. return 0;
  1782. }
  1783. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1784. DWORD wPort = SERVER_PORT; // 5678
  1785. if (g_conntype)wPort = GetPort();
  1786. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1787. if (TRANSPORT_OK != nResult)
  1788. {
  1789. m_tClientTunnel.net_CloseSocket();
  1790. return 0;
  1791. }
  1792. return ProcessLoginRequest();
  1793. }
  1794. void CMainFrame::ProcessNetEvent(int nEventType, void *pRecvMsg, DWORD dwDataLen)
  1795. {
  1796. #ifdef _DEBUG
  1797. printf("ProcessNetEvent\n\n");
  1798. #endif
  1799. if (Transport_ReadEv == nEventType)
  1800. {
  1801. if (NULL == pRecvMsg) return;
  1802. TMessageHeader* pHeader = (TMessageHeader *)pRecvMsg;
  1803. char *pDataBuf = (char *)pRecvMsg + MESSAGE_HEADER_LEN;
  1804. WORD dwMessageID = pHeader->wMessageId;
  1805. switch (dwMessageID)
  1806. {
  1807. case MSG_LOGIN_RESP:
  1808. case (MSG_LOGIN_RESP + 0X2FFF) :
  1809. {
  1810. LOGIN_RESULT_STRU tLoginResult = { 0 };
  1811. memcpy(&tLoginResult, pDataBuf, sizeof(LOGIN_RESULT_STRU));
  1812. ProcessLoginResponse(&tLoginResult);
  1813. break;
  1814. }
  1815. case MSG_USERINFO_RESP:
  1816. {
  1817. break;
  1818. }
  1819. case MSG_LOGOUT_RESP:
  1820. {
  1821. break;
  1822. }
  1823. case MSG_CHATMESSAGE_RESP:
  1824. case (MSG_CHATMESSAGE_RESP + 0X4FFF) :
  1825. {
  1826. static int i = 0;
  1827. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pDataBuf;
  1828. ProcessChatMessageResponse((void *)pChatMessage);
  1829. break;
  1830. }
  1831. default:
  1832. {
  1833. break;
  1834. }
  1835. }
  1836. }
  1837. else if (Transport_CloseEv == nEventType)
  1838. {
  1839. OnDisconnect();
  1840. }
  1841. }
  1842. //extern BOOL g_bNeedCoon;
  1843. extern BOOL EncryptFile2(BYTE *buffer, DWORD leng, PCHAR szPassword);
  1844. void CMainFrame::OnTimer(UINT nIDEvent)
  1845. {
  1846. // TODO: Add your message handler code here and/or call default
  1847. if (1 == nIDEvent)
  1848. {
  1849. KillTimer(nIDEvent);
  1850. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status", 0);//status:此机用选片菜单项
  1851. // checked==1:此机用选片菜单项
  1852. // g_bStaffAchievementShow==1:此机用于员工业绩查看
  1853. if (checked && g_bStaffAchievementShow == 0) // .此机用选片菜单项;
  1854. {
  1855. KillTimer(3);
  1856. #ifdef NEW_SKIN
  1857. Welcome weldlg;
  1858. weldlg.DoModal();
  1859. #endif
  1860. ChoosePhotoSkin dlg;
  1861. dlg.SetLiaPath("1.lia");
  1862. if (dlg.DoModal() != IDOK)
  1863. {
  1864. PostMessage(WM_QUIT);
  1865. return;
  1866. }
  1867. if (dlg.m_exitcode == 3)
  1868. {
  1869. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  1870. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  1871. }
  1872. else
  1873. {
  1874. ShowWindow(SW_SHOW);
  1875. #ifdef NEW_SKIN
  1876. if (m_pMainFrimDlg2 == NULL)
  1877. {
  1878. m_pMainFrimDlg2 = new MainFrimDlg2;
  1879. m_pMainFrimDlg2->SetLiaPath("10.lia");
  1880. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  1881. }
  1882. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1883. #endif
  1884. }
  1885. }
  1886. else if (g_bStaffAchievementShow == 0) // .非选片、非查看员工业绩;
  1887. {
  1888. #ifdef NEW_SKIN
  1889. g_bNoConnDlg = 1;
  1890. Welcome weldlg;
  1891. weldlg.DoModal();
  1892. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1893. ShowWindow(SW_SHOW);
  1894. g_bNoConnDlg = 0;
  1895. if (g_bNoLoginLia) // Jeff.OnCreate里判断skin文件有5.lia, g_bNoLoginLia = 0, 无 g_bNoLoginLia = 1;
  1896. {
  1897. Login dlg;
  1898. dlg.SetLiaPath("5.lia");
  1899. dlg.DoModal();
  1900. }
  1901. else
  1902. {
  1903. Login3 dlg;
  1904. dlg.SetLiaPath("5.lia"); // Login3的父类为MyDlg,在BOOL MyDlg::OnInitDialog()里调用了纯虚函数Init();
  1905. dlg.DoModal();
  1906. // 数据库完整性提醒;
  1907. if ( 1 == atoi(g_cominfoarray.ElementAt(0).ElementAt(159)) )
  1908. {
  1909. MessageBox(_T("贵店数据库可能已损坏,请尽快联系售后人员进行确认或维护,联系电话:0752-2398865 或 4006-067-068!"), _T("重要提示:"), MB_OK | MB_TOPMOST /*| MB_SETFOREGROUND*/ | MB_ICONWARNING);
  1910. if ( !g_bRunOnCorruptdb )
  1911. exit(0);
  1912. }
  1913. }
  1914. if (g_user.bLongin && g_pMainWnd2)
  1915. {
  1916. g_pMainWnd2->ShowBar(TRUE,TRUE);
  1917. InsideMsg();
  1918. }
  1919. #else
  1920. ShowWindow(SW_SHOW);
  1921. if (g_bNoLoginLia)
  1922. {
  1923. Login dlg;
  1924. dlg.SetLiaPath ("5.lia");
  1925. dlg.DoModal();
  1926. }
  1927. else
  1928. {
  1929. Login3 dlg;
  1930. dlg.SetLiaPath ("5.lia");
  1931. dlg.DoModal();
  1932. }
  1933. #endif
  1934. }
  1935. if (g_hmouse == NULL)
  1936. {
  1937. g_hmouse = SetWindowsHookEx(WH_MOUSE, MouseProc, 0, ::GetCurrentThreadId());
  1938. }
  1939. }
  1940. else if (2 == nIDEvent) //29秒后,若连接和发送未完成,将关闭连接和发送框;
  1941. {
  1942. KillTimer(2);
  1943. if (g_hConnectWnd)
  1944. ::PostMessage(g_hConnectWnd, WM_CLOSE, 0, 0);
  1945. if (g_hSendWnd)
  1946. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1947. if (g_bStaffAchievementShow == 0 && g_bConnLYFZ == 0)
  1948. {
  1949. if (g_bGenBranchData == 0)
  1950. {
  1951. if (g_branchip != "")
  1952. AfxMessageBox("连接分店:" + g_branchname + "失败!", MB_ICONINFORMATION);
  1953. else
  1954. AfxMessageBox("连接服务器失败!", MB_ICONINFORMATION);
  1955. }
  1956. OnDisconnect();
  1957. }
  1958. g_bSendOK = 0;
  1959. g_bNeedCoon = 1;
  1960. }
  1961. else if (3 == nIDEvent)
  1962. {
  1963. KillTimer(3);
  1964. #ifdef NEW_SKIN
  1965. Welcome weldlg;
  1966. weldlg.DoModal();
  1967. #endif
  1968. ShowWindow(SW_SHOW);
  1969. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1970. g_sendhead.bsql = 0;
  1971. g_sendhead.code[0] = 24;
  1972. g_sendhead.code[1] = 1;
  1973. g_sendhead.tabcount = 2;
  1974. g_pMainWnd->ProcessChatMessageRequest2(1);
  1975. if (g_bSendOK == 0)
  1976. {
  1977. return;
  1978. }
  1979. CArray<CStringArray, CStringArray>patharray;
  1980. CArray<CStringArray, CStringArray>userarray;
  1981. DataToArray(&g_cominfoarray, &g_hisyeararray);
  1982. g_userarray.SetSize(userarray.GetSize(), 1);
  1983. int count = 0;
  1984. for (int ii = 0; ii < userarray.GetSize(); ii++)
  1985. {
  1986. if (userarray.ElementAt(ii).ElementAt(10) == "在职")
  1987. g_userarray.ElementAt(count++).Copy(userarray.ElementAt(ii));
  1988. }
  1989. g_userarray.SetSize(count, 1);
  1990. StaffAchievementShowAll dlg;
  1991. g_pMainWnd->GetOcx();
  1992. dlg.DoModal();
  1993. }
  1994. else if (5 == nIDEvent)
  1995. {
  1996. if (g_bInSkin)
  1997. {
  1998. OutputDebugString("使用皮肤\n");
  1999. return;
  2000. }
  2001. if (g_nAutoShowStaffAchievement == 1){
  2002. OutputDebugString("用于选片\n");
  2003. return;
  2004. }
  2005. if (g_bAllBranch){
  2006. OutputDebugString("多店汇总当中\n");
  2007. return;
  2008. }
  2009. if (g_user.bLongin)
  2010. {
  2011. // m_Mdi.CloseAll();
  2012. g_pMainWnd->OnCommandMenu(IDM_Logout);
  2013. }
  2014. /* g_nAutoShowStaffAchievement=1;
  2015. KillTimer(5);
  2016. StaffAchievementShowAll dlg;
  2017. g_pMainWnd->GetOcx();
  2018. dlg.DoModal ();*/
  2019. }
  2020. else if (6 == nIDEvent)
  2021. {
  2022. static BOOL bDouble = 0;
  2023. bDouble = !bDouble;
  2024. if (bDouble)
  2025. g_pMainWnd->OnCommandMenu(IDM_TAKEAWAYBOOK);
  2026. else
  2027. g_pMainWnd->OnCommandMenu(IDM_CLIENTMONEY);
  2028. }
  2029. else if (7 == nIDEvent)
  2030. {
  2031. KillTimer(7);
  2032. g_bAntiTheft = FALSE;
  2033. if (g_bInSkin)return;
  2034. if (g_nAutoShowStaffAchievement == 1)return;
  2035. if (g_bAllBranch)return;
  2036. #ifdef _DEBUG
  2037. printf("42开始请求服务器信息\n");
  2038. #endif
  2039. g_nSendCode = 42;
  2040. g_bSendOK = FALSE;
  2041. g_pMainWnd->ProcessChatMessageRequest2(1);
  2042. g_nSendCode = 0;
  2043. char *pResult = NULL;
  2044. if ( g_bSendOK )
  2045. {
  2046. cJSON *pJson = cJSON_Parse((char*)g_pData);
  2047. #ifdef _DEBUG
  2048. OutputDebugString("\n");
  2049. OutputDebugString((char*)g_pData);
  2050. OutputDebugString("\n");
  2051. #endif
  2052. cJSON_AddStringToObject(pJson, "软件版本", g_STStudioInfo.strStudioVer);
  2053. cJSON_AddStringToObject(pJson, "影楼名称", g_STStudioInfo.strStudioName);
  2054. cJSON_AddStringToObject(pJson, "影楼电话", g_STStudioInfo.strStudioPhone);
  2055. cJSON_AddStringToObject(pJson, "影楼地址", g_STStudioInfo.strStudioAddress);
  2056. cJSON_AddStringToObject(pJson, "影楼网址", g_STStudioInfo.strStudioWebSite);
  2057. cJSON_AddStringToObject(pJson, "影楼老板", g_STStudioInfo.strStudioManager);
  2058. cJSON_AddStringToObject(pJson, "影楼域名", g_domain);
  2059. cJSON_AddNumberToObject(pJson, "订单数量", g_STStudioInfo.dwStudioOrderCount);
  2060. cJSON_AddNumberToObject(pJson, "历史订单数量", g_STStudioInfo.dwStudioHistoryOrderCount);
  2061. pResult = cJSON_Print(pJson);
  2062. if ( pResult)
  2063. {
  2064. #ifdef _DEBUG
  2065. WriteTextLog(pResult);
  2066. #endif
  2067. cJSON_Delete(pJson);
  2068. // 指示连接的服务器为lijiafz.vicp.net;
  2069. g_bConnLYFZ = 1;
  2070. // 断开当前连接;
  2071. OnDisconnect();
  2072. g_bSendOK = FALSE;
  2073. g_nSendCode = 18;
  2074. int nEncryptlen = strlen(pResult);
  2075. #ifdef _DEBUG
  2076. printf("18:%d,%s\n\n",nEncryptlen, pResult);
  2077. #endif
  2078. EncryptFile2((BYTE*)pResult, nEncryptlen, "888666333");
  2079. g_pMainWnd->ProcessChatMessageRequest2((BYTE*)pResult, nEncryptlen);
  2080. g_nSendCode = 0;
  2081. delete[]pResult;
  2082. g_bSendLYFZ = 0;
  2083. g_bConnLYFZ = 0;
  2084. OnDisconnect();
  2085. #ifdef _DEBUG
  2086. printf("发送后台%s\n,断开当前连接,开始连接本地服务器\n", g_bSendOK ? "发送成功" : "发送失败");
  2087. #endif
  2088. if (g_bSendOK)
  2089. {
  2090. #ifdef _DEBUG
  2091. printf("43开始请求服务器信息\n");
  2092. #endif
  2093. g_nSendCode = 43;
  2094. g_pMainWnd->ProcessChatMessageRequest2(g_pData, g_nLeng);
  2095. g_nSendCode = 0;
  2096. g_bAntiTheft = FALSE;
  2097. }
  2098. }
  2099. }
  2100. }
  2101. }
  2102. void CMainFrame::OnOutbarNotify(CString strMsg)
  2103. {
  2104. if (g_user.bLongin == 0)
  2105. {
  2106. if (g_bNoLoginLia)
  2107. {
  2108. Login dlg;
  2109. dlg.SetLiaPath("5.lia");
  2110. dlg.DoModal();
  2111. }
  2112. else
  2113. {
  2114. Login3 dlg;
  2115. dlg.SetLiaPath("5.lia");
  2116. dlg.DoModal();
  2117. }
  2118. return;
  2119. if (g_user.bLongin == 0)return;
  2120. }
  2121. else
  2122. {
  2123. InsideMsg();
  2124. }
  2125. ResetTimer();
  2126. if (strMsg == "开单")
  2127. {
  2128. if (IsHasRights(0) == 0)return;
  2129. Booking2 dlg;
  2130. dlg.DoModal();
  2131. return;
  2132. }
  2133. else if (strMsg == "拍照")
  2134. {
  2135. if (IsHasRights(1) == 0)return;
  2136. UINT nID = 1;
  2137. LPSTR pName;
  2138. pName = (LPSTR)(LPCSTR)"拍照";
  2139. OPEN_MENU(TakeFrom);
  2140. return;
  2141. }
  2142. else if (strMsg == "修片")
  2143. {
  2144. if (IsHasRights(1) == 0)return;
  2145. UINT nID = 1;
  2146. LPSTR pName;
  2147. pName = (LPSTR)(LPCSTR)"修片";
  2148. OPEN_MENU(BeautifySkinFrom);
  2149. return;
  2150. }
  2151. else if (strMsg == "选片")
  2152. {
  2153. if (IsHasRights(2) == 0)return;
  2154. UINT nID = 1;
  2155. LPSTR pName;
  2156. pName = (LPSTR)(LPCSTR)"选片";
  2157. OPEN_MENU(ChoosePhotoForm);
  2158. return;
  2159. }
  2160. else if (strMsg == "精修")
  2161. {
  2162. if (IsHasRights(2) == 0)return;
  2163. UINT nID = 1;
  2164. LPSTR pName;
  2165. pName = (LPSTR)(LPCSTR)"精修";
  2166. OPEN_MENU(BeautifySkinFrom2);
  2167. return;
  2168. }
  2169. else if (strMsg == "设计")
  2170. {
  2171. if (IsHasRights(2) == 0)return;
  2172. UINT nID = 1;
  2173. LPSTR pName;
  2174. pName = (LPSTR)(LPCSTR)"设计";
  2175. OPEN_MENU(DesignFrom);
  2176. return;
  2177. }
  2178. else if (strMsg == "数码安排")
  2179. {
  2180. UINT nID = 1;
  2181. LPSTR pName;
  2182. pName = (LPSTR)(LPCSTR)"数码安排";
  2183. OPEN_MENU(DigitalWork);
  2184. return;
  2185. }
  2186. else if (strMsg == "刻盘")
  2187. {
  2188. UINT nID = 1;
  2189. LPSTR pName;
  2190. pName = (LPSTR)(LPCSTR)"刻盘";
  2191. OPEN_MENU(BurnCD);
  2192. return;
  2193. }
  2194. else if (strMsg == "相片冲印")
  2195. {
  2196. UINT nID = 1;
  2197. LPSTR pName;
  2198. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  2199. OPEN_MENU(PhotoPrintFrom);
  2200. return;
  2201. }
  2202. else if (strMsg == "发片/取件")
  2203. {
  2204. if (IsHasRights(3) == 0)return;
  2205. UINT nID = 1;
  2206. LPSTR pName;
  2207. pName = (LPSTR)(LPCSTR)"发片/取件";
  2208. OPEN_MENU(outsourcing);
  2209. return;
  2210. }
  2211. else if (strMsg == "满意度")
  2212. {
  2213. UINT nID = 1;
  2214. LPSTR pName;
  2215. pName = (LPSTR)(LPCSTR)"满意度";
  2216. OPEN_MENU(Satisfaction);
  2217. return;
  2218. }
  2219. else if (strMsg == "满意度汇总")
  2220. {
  2221. UINT nID = 1;
  2222. LPSTR pName;
  2223. pName = (LPSTR)(LPCSTR)"满意度汇总";
  2224. OPEN_MENU(SatisfactionReportForm);
  2225. return;
  2226. }
  2227. #if JEFF_DELETE_ON // 2014.11.14-PM 16:20
  2228. else if (strMsg == "回复统计")
  2229. {
  2230. UINT nID = 1;
  2231. LPSTR pName;
  2232. pName = (LPSTR)(LPCSTR)"回复统计";
  2233. OPEN_MENU(MsgReg2);
  2234. return;
  2235. }
  2236. #endif
  2237. /* else if(strMsg=="取件")
  2238. {
  2239. if(IsHasRights(3)==0)return;
  2240. UINT nID=1;
  2241. LPSTR pName ;
  2242. pName = (LPSTR)(LPCSTR)"取件";
  2243. OPEN_MENU(TakeAwayFrom);
  2244. return;
  2245. }*/
  2246. else if (strMsg == "其它收入")
  2247. {
  2248. if (IsHasRightsnew(16) == 0)return;
  2249. // if(IsHasRightsnew(48)==0)return;
  2250. UINT nID = 1;
  2251. LPSTR pName;
  2252. pName = (LPSTR)(LPCSTR)"其它收入";
  2253. OPEN_MENU(IncomeInput);
  2254. return;
  2255. }
  2256. else if (strMsg == "散客消费")
  2257. {
  2258. if (IsHasRightsnew(16) == 0)return;
  2259. UINT nID = 1;
  2260. LPSTR pName;
  2261. pName = (LPSTR)(LPCSTR)"散客消费";
  2262. OPEN_MENU(IncomeInput2);
  2263. return;
  2264. }
  2265. else if (strMsg == "员工奖罚")
  2266. {
  2267. if (IsHasRightsnew(16) == 0)return;
  2268. UINT nID = 1;
  2269. LPSTR pName;
  2270. pName = (LPSTR)(LPCSTR)"员工奖罚";
  2271. OPEN_MENU(IncomeInput3);
  2272. return;
  2273. }
  2274. else if (strMsg == "员工奖惩")
  2275. {
  2276. if (IsHasRightsnew(16) == 0)return;
  2277. UINT nID = 1;
  2278. LPSTR pName;
  2279. pName = (LPSTR)(LPCSTR)"员工奖惩";
  2280. OPEN_MENU(IncomeInput4);
  2281. return;
  2282. }
  2283. else if (strMsg == "订单收款")
  2284. {
  2285. if (IsHasRights(17) == 0)return;
  2286. UINT nID = 1;
  2287. LPSTR pName;
  2288. pName = (LPSTR)(LPCSTR)"订单收款";
  2289. OPEN_MENU(FinanceForm);
  2290. return;
  2291. }
  2292. else if (strMsg == "日财务表")
  2293. {
  2294. if (IsHasRightsnew(22) == 0)return;
  2295. UINT nID = 2;
  2296. LPSTR pName;
  2297. pName = (LPSTR)(LPCSTR)"日财务表";
  2298. OPEN_MENU(DailyForm);
  2299. return;
  2300. }
  2301. else if (strMsg == "提成比例")
  2302. {
  2303. #ifndef ENTERPRISE_VERSION
  2304. #ifndef CHILD_VERSION
  2305. #ifdef BASIC_VERSION
  2306. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2307. {
  2308. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2309. exit(0);return;
  2310. }
  2311. #else
  2312. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2313. {
  2314. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2315. exit(0);return;
  2316. }
  2317. #endif
  2318. #else
  2319. #ifdef BASIC_VERSION
  2320. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2321. {
  2322. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2323. exit(0);return;
  2324. }
  2325. #else
  2326. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2327. {
  2328. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2329. exit(0); return;
  2330. }
  2331. #endif
  2332. #endif
  2333. #else
  2334. #ifndef CHILD_VERSION
  2335. #ifdef BASIC_VERSION
  2336. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2337. {
  2338. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2339. exit(0); return;
  2340. }
  2341. #else
  2342. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2343. {
  2344. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2345. exit(0); return;
  2346. }
  2347. #endif
  2348. #else
  2349. #ifdef BASIC_VERSION
  2350. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2351. {
  2352. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2353. exit(0);return;
  2354. }
  2355. #else
  2356. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2357. {
  2358. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2359. exit(0); return;
  2360. }
  2361. #endif
  2362. #endif
  2363. #endif
  2364. UINT nID = 2;
  2365. LPSTR pName;
  2366. pName = (LPSTR)(LPCSTR)"提成比例";
  2367. OPEN_MENU(SalarySet2);
  2368. return;
  2369. }
  2370. //else if(strMsg=="员工工作")
  2371. else if (strMsg == "计件提成")
  2372. {
  2373. UINT nID = 2;
  2374. LPSTR pName;
  2375. //pName = (LPSTR)(LPCSTR)"员工工作";
  2376. pName = (LPSTR)(LPCSTR)"计件提成";
  2377. OPEN_MENU(SalarySet3);
  2378. return;
  2379. }
  2380. else if (strMsg == "工资管理")
  2381. {
  2382. #ifndef ENTERPRISE_VERSION
  2383. #ifndef CHILD_VERSION
  2384. #ifdef BASIC_VERSION
  2385. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2386. {
  2387. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2388. exit(0);return;
  2389. }
  2390. #else
  2391. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2392. {
  2393. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2394. exit(0);return;
  2395. }
  2396. #endif
  2397. #else
  2398. #ifdef BASIC_VERSION
  2399. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2400. {
  2401. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2402. exit(0);return;
  2403. }
  2404. #else
  2405. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2406. {
  2407. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2408. exit(0); return;
  2409. }
  2410. #endif
  2411. #endif
  2412. #else
  2413. #ifndef CHILD_VERSION
  2414. #ifdef BASIC_VERSION
  2415. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2416. {
  2417. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2418. exit(0); return;
  2419. }
  2420. #else
  2421. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2422. {
  2423. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2424. exit(0); return;
  2425. }
  2426. #endif
  2427. #else
  2428. #ifdef BASIC_VERSION
  2429. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2430. {
  2431. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2432. exit(0);return;
  2433. }
  2434. #else
  2435. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2436. {
  2437. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2438. exit(0); return;
  2439. }
  2440. #endif
  2441. #endif
  2442. #endif
  2443. UINT nID = 2;
  2444. LPSTR pName;
  2445. pName = (LPSTR)(LPCSTR)"工资管理";
  2446. OPEN_MENU(MySalary);
  2447. return;
  2448. }
  2449. else if (strMsg == "客人付款")
  2450. {
  2451. UINT nID = 2;
  2452. LPSTR pName;
  2453. pName = (LPSTR)(LPCSTR)"客人付款";
  2454. OPEN_MENU(ClientMoney);
  2455. return;
  2456. }
  2457. else if (strMsg == "工资报表")
  2458. {
  2459. #ifndef ENTERPRISE_VERSION
  2460. #ifndef CHILD_VERSION
  2461. #ifdef BASIC_VERSION
  2462. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2463. {
  2464. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2465. exit(0);return;
  2466. }
  2467. #else
  2468. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2469. {
  2470. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2471. exit(0);return;
  2472. }
  2473. #endif
  2474. #else
  2475. #ifdef BASIC_VERSION
  2476. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2477. {
  2478. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2479. exit(0);return;
  2480. }
  2481. #else
  2482. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2483. {
  2484. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2485. exit(0); return;
  2486. }
  2487. #endif
  2488. #endif
  2489. #else
  2490. #ifndef CHILD_VERSION
  2491. #ifdef BASIC_VERSION
  2492. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2493. {
  2494. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2495. exit(0); return;
  2496. }
  2497. #else
  2498. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2499. {
  2500. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2501. exit(0); return;
  2502. }
  2503. #endif
  2504. #else
  2505. #ifdef BASIC_VERSION
  2506. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2507. {
  2508. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2509. exit(0);return;
  2510. }
  2511. #else
  2512. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2513. {
  2514. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2515. exit(0); return;
  2516. }
  2517. #endif
  2518. #endif
  2519. #endif
  2520. if (IsHasRightsnew(25) == 0)return;
  2521. UINT nID = 2;
  2522. LPSTR pName;
  2523. pName = (LPSTR)(LPCSTR)"工资报表";
  2524. g_ncount = 100;
  2525. OPEN_MENU(MySalary);
  2526. return;
  2527. }
  2528. else if (strMsg == "员工业绩")
  2529. {
  2530. #ifndef ENTERPRISE_VERSION
  2531. #ifndef CHILD_VERSION
  2532. #ifdef BASIC_VERSION
  2533. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2534. {
  2535. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2536. exit(0);return;
  2537. }
  2538. #else
  2539. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2540. {
  2541. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2542. exit(0);return;
  2543. }
  2544. #endif
  2545. #else
  2546. #ifdef BASIC_VERSION
  2547. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2548. {
  2549. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2550. exit(0);return;
  2551. }
  2552. #else
  2553. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2554. {
  2555. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2556. exit(0); return;
  2557. }
  2558. #endif
  2559. #endif
  2560. #else
  2561. #ifndef CHILD_VERSION
  2562. #ifdef BASIC_VERSION
  2563. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2564. {
  2565. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2566. exit(0); return;
  2567. }
  2568. #else
  2569. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2570. {
  2571. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2572. exit(0); return;
  2573. }
  2574. #endif
  2575. #else
  2576. #ifdef BASIC_VERSION
  2577. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2578. {
  2579. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2580. exit(0);return;
  2581. }
  2582. #else
  2583. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2584. {
  2585. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2586. exit(0); return;
  2587. }
  2588. #endif
  2589. #endif
  2590. #endif
  2591. if (IsHasRightsnew(33) == 0)return;
  2592. UINT nID = 2;
  2593. LPSTR pName;
  2594. pName = (LPSTR)(LPCSTR)"员工业绩";
  2595. OPEN_MENU(StaffAchievement);
  2596. return;
  2597. }
  2598. else if (strMsg == "订单客户")
  2599. {
  2600. UINT nID = 2;
  2601. LPSTR pName;
  2602. pName = (LPSTR)(LPCSTR)"订单客户";
  2603. g_dx += 10000;
  2604. OPEN_MENU(CClientForm);
  2605. if (g_dx >= 10000)g_dx -= 10000;
  2606. return;
  2607. }
  2608. else if (strMsg == "意向客户")
  2609. {
  2610. UINT nID = 2;
  2611. LPSTR pName;
  2612. pName = (LPSTR)(LPCSTR)"意向客户";
  2613. OPEN_MENU(Client2Form);
  2614. return;
  2615. }
  2616. else if (strMsg == "老客户")
  2617. {
  2618. UINT nID = 2;
  2619. LPSTR pName;
  2620. pName = (LPSTR)(LPCSTR)"老客户";
  2621. OPEN_MENU(OldClient);
  2622. return;
  2623. }
  2624. else if (strMsg == "客户来电")
  2625. {
  2626. UINT nID = 2;
  2627. LPSTR pName;
  2628. pName = (LPSTR)(LPCSTR)"客户来电";
  2629. OPEN_MENU(PhoneRecord);
  2630. return;
  2631. }
  2632. else if (strMsg == "拨出电话")
  2633. {
  2634. UINT nID = 2;
  2635. LPSTR pName;
  2636. pName = (LPSTR)(LPCSTR)"拨出电话";
  2637. OPEN_MENU(PhoneRecordOut);
  2638. return;
  2639. }
  2640. else if (strMsg == "未接来电")
  2641. {
  2642. UINT nID = 2;
  2643. LPSTR pName;
  2644. pName = (LPSTR)(LPCSTR)"未接来电";
  2645. OPEN_MENU(MissCall);
  2646. return;
  2647. }
  2648. else if (strMsg == "客户流失")
  2649. {
  2650. UINT nID = 2;
  2651. LPSTR pName;
  2652. pName = (LPSTR)(LPCSTR)"客户流失";
  2653. OPEN_MENU(ClientReasonChart);
  2654. return;
  2655. }
  2656. else if (strMsg == "客户来源")
  2657. {
  2658. UINT nID = 2;
  2659. LPSTR pName;
  2660. pName = (LPSTR)(LPCSTR)"客户来源";
  2661. OPEN_MENU(ClientFromChart);
  2662. return;
  2663. }
  2664. else if (strMsg == "月财务表")
  2665. {
  2666. if (IsHasRightsnew(23) == 0)return;
  2667. UINT nID = 2;
  2668. LPSTR pName;
  2669. pName = (LPSTR)(LPCSTR)"月财务表";
  2670. OPEN_MENU(MonthForm);
  2671. return;
  2672. }
  2673. else if (strMsg == "支出报表")
  2674. {
  2675. if (IsHasRightsnew(23) == 0)return;
  2676. UINT nID = 2;
  2677. LPSTR pName;
  2678. pName = (LPSTR)(LPCSTR)"支出报表";
  2679. OPEN_MENU(MonthForm2);
  2680. return;
  2681. }
  2682. else if (strMsg == "年财务表")
  2683. {
  2684. if (IsHasRightsnew(24) == 0)return;
  2685. UINT nID = 2;
  2686. LPSTR pName;
  2687. pName = (LPSTR)(LPCSTR)"年财务表";
  2688. OPEN_MENU(YearForm);
  2689. return;
  2690. }
  2691. else if (strMsg == "年财务图表")
  2692. {
  2693. if (IsHasRightsnew(24) == 0)return;
  2694. GetOcx();
  2695. UINT nID = 2;
  2696. LPSTR pName;
  2697. pName = (LPSTR)(LPCSTR)"年财务图表";
  2698. OPEN_MENU(YearForm2);
  2699. return;
  2700. }
  2701. else if (strMsg == "订单图表")
  2702. {
  2703. GetOcx();
  2704. UINT nID = 2;
  2705. LPSTR pName;
  2706. pName = (LPSTR)(LPCSTR)"订单图表";
  2707. OPEN_MENU(DinDanForm);
  2708. return;
  2709. }
  2710. #ifdef ENTERPRISE_VERSION
  2711. else if (strMsg == "订单报表")
  2712. {
  2713. GetOcx();
  2714. UINT nID = 2;
  2715. LPSTR pName;
  2716. pName = (LPSTR)(LPCSTR)"订单报表2";
  2717. OPEN_MENU(DinDanFromBranch);
  2718. return;
  2719. }
  2720. else if (strMsg == "财务图表")
  2721. {
  2722. GetOcx();
  2723. UINT nID = 2;
  2724. LPSTR pName;
  2725. pName = (LPSTR)(LPCSTR)"财务图表";
  2726. OPEN_MENU(YearFormBranch);
  2727. return;
  2728. }
  2729. else if (strMsg == "订单图表")
  2730. {
  2731. GetOcx();
  2732. UINT nID = 2;
  2733. LPSTR pName;
  2734. pName = (LPSTR)(LPCSTR)"订单图表";
  2735. OPEN_MENU(YearFormBranch2);
  2736. return;
  2737. }
  2738. else if (strMsg == "摄控安排")
  2739. {
  2740. UINT nID = 2;
  2741. LPSTR pName;
  2742. pName = (LPSTR)(LPCSTR)"摄控安排";
  2743. g_bookingtype = 0;
  2744. OPEN_MENU(TodayForm);
  2745. return;
  2746. }
  2747. else if (strMsg == "选片预约")
  2748. {
  2749. UINT nID = 2;
  2750. LPSTR pName;
  2751. pName = (LPSTR)(LPCSTR)"选片预约";
  2752. g_bookingtype = 1;
  2753. OPEN_MENU(TodayForm);
  2754. return;
  2755. }
  2756. else if (strMsg == "看样预约")
  2757. {
  2758. UINT nID = 2;
  2759. LPSTR pName;
  2760. pName = (LPSTR)(LPCSTR)"看样预约";
  2761. g_bookingtype = 2;
  2762. OPEN_MENU(TodayForm);
  2763. return;
  2764. }
  2765. else if (strMsg == "取件预约")
  2766. {
  2767. UINT nID = 2;
  2768. LPSTR pName;
  2769. pName = (LPSTR)(LPCSTR)"取件预约";
  2770. g_bookingtype = 3;
  2771. OPEN_MENU(TodayForm);
  2772. return;
  2773. }
  2774. else if (strMsg == "婚庆安排")
  2775. {
  2776. UINT nID = 2;
  2777. LPSTR pName;
  2778. pName = (LPSTR)(LPCSTR)"婚庆安排";
  2779. g_bookingtype = 4;
  2780. OPEN_MENU(TodayForm);
  2781. return;
  2782. }
  2783. #endif
  2784. else if (strMsg == "员工资料")
  2785. {
  2786. UINT nID = 2;
  2787. LPSTR pName;
  2788. pName = (LPSTR)(LPCSTR)"员工资料";
  2789. if (g_bAllBranch)
  2790. OPEN_MENU(EmployeeForm2);
  2791. else
  2792. OPEN_MENU(EmployeeForm);
  2793. return;
  2794. }
  2795. else if (strMsg == "客户区域")
  2796. {
  2797. // if(IsHasRightsnew(48)==0)return;
  2798. GetOcx();
  2799. UINT nID = 2;
  2800. LPSTR pName;
  2801. pName = (LPSTR)(LPCSTR)"客户区域";
  2802. OPEN_MENU(AreaClient);
  2803. return;
  2804. }
  2805. else if (strMsg == "客户报表")
  2806. {
  2807. UINT nID = 3;
  2808. LPSTR pName;
  2809. pName = (LPSTR)(LPCSTR)"客户报表";
  2810. OPEN_MENU(CClientForm);
  2811. return;
  2812. }
  2813. else if (strMsg == "现金支出")
  2814. {
  2815. if (IsHasRightsnew(16) == 0)return;
  2816. UINT nID = 3;
  2817. LPSTR pName;
  2818. pName = (LPSTR)(LPCSTR)"现金支出";
  2819. OPEN_MENU(PayOutInput);
  2820. return;
  2821. }
  2822. else if (strMsg == "短信群发")
  2823. {
  2824. UINT nID = 3;
  2825. LPSTR pName;
  2826. pName = (LPSTR)(LPCSTR)"短信群发";
  2827. OPEN_MENU(SendMsg);
  2828. return;
  2829. }
  2830. else if (strMsg == "短信发送")
  2831. {
  2832. UINT nID = 3;
  2833. LPSTR pName;
  2834. pName = (LPSTR)(LPCSTR)"客户报表";
  2835. OPEN_MENU(CClientForm);
  2836. return;
  2837. }
  2838. else if (strMsg == "流程短信")
  2839. {
  2840. UINT nID = 3;
  2841. LPSTR pName;
  2842. pName = (LPSTR)(LPCSTR)"流程短信";
  2843. OPEN_MENU(WorkMsg);
  2844. return;
  2845. }
  2846. else if (strMsg == "员工短信")
  2847. {
  2848. UINT nID = 3;
  2849. LPSTR pName;
  2850. pName = (LPSTR)(LPCSTR)"员工短信";
  2851. OPEN_MENU(EmployeeMsg);
  2852. return;
  2853. }
  2854. else if (strMsg == "发送记录")
  2855. {
  2856. UINT nID = 3;
  2857. LPSTR pName;
  2858. pName = (LPSTR)(LPCSTR)"发送记录";
  2859. OPEN_MENU(MsgReg);
  2860. return;
  2861. }
  2862. else if (strMsg == "短信设置")
  2863. {
  2864. if (IsHasRightsnew(49) == 0)return;
  2865. MsgSet dlg;
  2866. dlg.DoModal();
  2867. return;
  2868. }
  2869. else if (strMsg == "金卡会员")
  2870. {
  2871. #ifndef ENTERPRISE_VERSION
  2872. #ifndef CHILD_VERSION
  2873. #ifdef BASIC_VERSION
  2874. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2875. {
  2876. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2877. exit(0);return;
  2878. }
  2879. #else
  2880. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2881. {
  2882. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2883. exit(0);return;
  2884. }
  2885. #endif
  2886. #else
  2887. #ifdef BASIC_VERSION
  2888. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2889. {
  2890. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2891. exit(0);return;
  2892. }
  2893. #else
  2894. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2895. {
  2896. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2897. exit(0); return;
  2898. }
  2899. #endif
  2900. #endif
  2901. #else
  2902. #ifndef CHILD_VERSION
  2903. #ifdef BASIC_VERSION
  2904. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2905. {
  2906. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2907. exit(0); return;
  2908. }
  2909. #else
  2910. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2911. {
  2912. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2913. exit(0); return;
  2914. }
  2915. #endif
  2916. #else
  2917. #ifdef BASIC_VERSION
  2918. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2919. {
  2920. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2921. exit(0);return;
  2922. }
  2923. #else
  2924. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2925. {
  2926. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2927. exit(0); return;
  2928. }
  2929. #endif
  2930. #endif
  2931. #endif
  2932. UINT nID = 3;
  2933. LPSTR pName;
  2934. pName = (LPSTR)(LPCSTR)"金卡会员";
  2935. OPEN_MENU(ShowMember);
  2936. return;
  2937. }
  2938. else if (strMsg == "现金子卡")
  2939. {
  2940. UINT nID = 3;
  2941. LPSTR pName;
  2942. pName = (LPSTR)(LPCSTR)"现金子卡";
  2943. OPEN_MENU(ShowMember2);
  2944. return;
  2945. }
  2946. else if (strMsg == "蓝钻会员")
  2947. {
  2948. #ifndef ENTERPRISE_VERSION
  2949. #ifndef CHILD_VERSION
  2950. #ifdef BASIC_VERSION
  2951. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2952. {
  2953. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2954. exit(0);return;
  2955. }
  2956. #else
  2957. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2958. {
  2959. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2960. exit(0);return;
  2961. }
  2962. #endif
  2963. #else
  2964. #ifdef BASIC_VERSION
  2965. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2966. {
  2967. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2968. exit(0);return;
  2969. }
  2970. #else
  2971. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2972. {
  2973. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2974. exit(0); return;
  2975. }
  2976. #endif
  2977. #endif
  2978. #else
  2979. #ifndef CHILD_VERSION
  2980. #ifdef BASIC_VERSION
  2981. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2982. {
  2983. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2984. exit(0); return;
  2985. }
  2986. #else
  2987. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2988. {
  2989. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2990. exit(0); return;
  2991. }
  2992. #endif
  2993. #else
  2994. #ifdef BASIC_VERSION
  2995. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2996. {
  2997. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2998. exit(0);return;
  2999. }
  3000. #else
  3001. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3002. {
  3003. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3004. exit(0); return;
  3005. }
  3006. #endif
  3007. #endif
  3008. #endif
  3009. UINT nID = 3;
  3010. LPSTR pName;
  3011. pName = (LPSTR)(LPCSTR)"蓝钻会员";
  3012. OPEN_MENU(ShowMemberBlue);
  3013. return;
  3014. }
  3015. else if (strMsg == "转介绍积分")
  3016. {
  3017. #ifndef ENTERPRISE_VERSION
  3018. #ifndef CHILD_VERSION
  3019. #ifdef BASIC_VERSION
  3020. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3021. {
  3022. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3023. exit(0);return;
  3024. }
  3025. #else
  3026. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3027. {
  3028. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3029. exit(0);return;
  3030. }
  3031. #endif
  3032. #else
  3033. #ifdef BASIC_VERSION
  3034. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3035. {
  3036. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3037. exit(0);return;
  3038. }
  3039. #else
  3040. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3041. {
  3042. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3043. exit(0); return;
  3044. }
  3045. #endif
  3046. #endif
  3047. #else
  3048. #ifndef CHILD_VERSION
  3049. #ifdef BASIC_VERSION
  3050. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3051. {
  3052. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3053. exit(0); return;
  3054. }
  3055. #else
  3056. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3057. {
  3058. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3059. exit(0); return;
  3060. }
  3061. #endif
  3062. #else
  3063. #ifdef BASIC_VERSION
  3064. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3065. {
  3066. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3067. exit(0);return;
  3068. }
  3069. #else
  3070. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3071. {
  3072. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3073. exit(0); return;
  3074. }
  3075. #endif
  3076. #endif
  3077. #endif
  3078. UINT nID = 3;
  3079. LPSTR pName;
  3080. pName = (LPSTR)(LPCSTR)"转介绍积分";
  3081. OPEN_MENU(Card2Reg);
  3082. return;
  3083. }
  3084. /* else if(strMsg=="转介绍图表")
  3085. {
  3086. #ifndef ENTERPRISE_VERSION
  3087. #ifndef CHILD_VERSION
  3088. #ifdef BASIC_VERSION
  3089. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="0")
  3090. {
  3091. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3092. exit(0);return;
  3093. }
  3094. #else
  3095. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3096. {
  3097. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3098. exit(0);return;
  3099. }
  3100. #endif
  3101. #else
  3102. #ifdef BASIC_VERSION
  3103. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3104. {
  3105. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3106. exit(0);return;
  3107. }
  3108. #else
  3109. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  3110. {
  3111. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3112. exit(0);return;
  3113. }
  3114. #endif
  3115. #endif
  3116. #else
  3117. #ifndef CHILD_VERSION
  3118. #ifdef BASIC_VERSION
  3119. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3120. {
  3121. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3122. exit(0);return;
  3123. }
  3124. #else
  3125. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="5")
  3126. {
  3127. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3128. exit(0);return;
  3129. }
  3130. #endif
  3131. #else
  3132. #ifdef BASIC_VERSION
  3133. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="6")
  3134. {
  3135. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3136. exit(0);return;
  3137. }
  3138. #else
  3139. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="7")
  3140. {
  3141. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3142. exit(0);return;
  3143. }
  3144. #endif
  3145. #endif
  3146. #endif
  3147. UINT nID=3;
  3148. LPSTR pName ;
  3149. pName = (LPSTR)(LPCSTR)"转介绍图表";
  3150. OPEN_MENU(Card2RegChart);
  3151. return;
  3152. }*/
  3153. else if (strMsg == "金卡图表")
  3154. {
  3155. UINT nID = 3;
  3156. LPSTR pName;
  3157. pName = (LPSTR)(LPCSTR)"金卡图表";
  3158. OPEN_MENU(MemberChart);
  3159. return;
  3160. }
  3161. else if (strMsg == "积分短信")
  3162. {
  3163. UINT nID = 3;
  3164. LPSTR pName;
  3165. pName = (LPSTR)(LPCSTR)"积分短信";
  3166. OPEN_MENU(ShowMemberMsg);
  3167. return;
  3168. }
  3169. else if (strMsg == "转介绍返现")
  3170. {
  3171. #ifndef ENTERPRISE_VERSION
  3172. #ifndef CHILD_VERSION
  3173. #ifdef BASIC_VERSION
  3174. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3175. {
  3176. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3177. exit(0);return;
  3178. }
  3179. #else
  3180. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3181. {
  3182. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3183. exit(0);return;
  3184. }
  3185. #endif
  3186. #else
  3187. #ifdef BASIC_VERSION
  3188. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3189. {
  3190. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3191. exit(0);return;
  3192. }
  3193. #else
  3194. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3195. {
  3196. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3197. exit(0); return;
  3198. }
  3199. #endif
  3200. #endif
  3201. #else
  3202. #ifndef CHILD_VERSION
  3203. #ifdef BASIC_VERSION
  3204. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3205. {
  3206. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3207. exit(0); return;
  3208. }
  3209. #else
  3210. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3211. {
  3212. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3213. exit(0); return;
  3214. }
  3215. #endif
  3216. #else
  3217. #ifdef BASIC_VERSION
  3218. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3219. {
  3220. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3221. exit(0);return;
  3222. }
  3223. #else
  3224. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3225. {
  3226. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3227. exit(0); return;
  3228. }
  3229. #endif
  3230. #endif
  3231. #endif
  3232. UINT nID = 3;
  3233. LPSTR pName;
  3234. pName = (LPSTR)(LPCSTR)"转介绍返现";
  3235. OPEN_MENU(Card2RegBlue);
  3236. return;
  3237. }
  3238. else if (strMsg == "转介绍图表")
  3239. {
  3240. #ifndef ENTERPRISE_VERSION
  3241. #ifndef CHILD_VERSION
  3242. #ifdef BASIC_VERSION
  3243. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3244. {
  3245. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3246. exit(0);return;
  3247. }
  3248. #else
  3249. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3250. {
  3251. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3252. exit(0);return;
  3253. }
  3254. #endif
  3255. #else
  3256. #ifdef BASIC_VERSION
  3257. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3258. {
  3259. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3260. exit(0);return;
  3261. }
  3262. #else
  3263. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3264. {
  3265. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3266. exit(0); return;
  3267. }
  3268. #endif
  3269. #endif
  3270. #else
  3271. #ifndef CHILD_VERSION
  3272. #ifdef BASIC_VERSION
  3273. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3274. {
  3275. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3276. exit(0); return;
  3277. }
  3278. #else
  3279. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3280. {
  3281. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3282. exit(0); return;
  3283. }
  3284. #endif
  3285. #else
  3286. #ifdef BASIC_VERSION
  3287. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3288. {
  3289. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3290. exit(0);return;
  3291. }
  3292. #else
  3293. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3294. {
  3295. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3296. exit(0); return;
  3297. }
  3298. #endif
  3299. #endif
  3300. #endif
  3301. UINT nID = 3;
  3302. LPSTR pName;
  3303. pName = (LPSTR)(LPCSTR)"转介绍图表";
  3304. OPEN_MENU(Card2RegChartBlue);
  3305. return;
  3306. }
  3307. else if (strMsg == "积分设置")
  3308. {
  3309. if (IsHasRightsnew(49) == 0)return;
  3310. MemberSet dlg;
  3311. dlg.DoModal();
  3312. return;
  3313. }
  3314. else if (strMsg == "礼服录入")
  3315. {
  3316. if (IsHasRightsnew(39) == 0)return;
  3317. UINT nID = 3;
  3318. LPSTR pName;
  3319. pName = (LPSTR)(LPCSTR)"礼服录入";
  3320. OPEN_MENU(DressManage);
  3321. return;
  3322. }
  3323. else if (strMsg == "礼服查看")
  3324. {
  3325. #ifndef ENTERPRISE_VERSION
  3326. #ifndef CHILD_VERSION
  3327. #ifdef BASIC_VERSION
  3328. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3329. {
  3330. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3331. exit(0);return;
  3332. }
  3333. #else
  3334. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3335. {
  3336. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3337. exit(0);return;
  3338. }
  3339. #endif
  3340. #else
  3341. #ifdef BASIC_VERSION
  3342. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3343. {
  3344. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3345. exit(0);return;
  3346. }
  3347. #else
  3348. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3349. {
  3350. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3351. exit(0); return;
  3352. }
  3353. #endif
  3354. #endif
  3355. #else
  3356. #ifndef CHILD_VERSION
  3357. #ifdef BASIC_VERSION
  3358. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3359. {
  3360. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3361. exit(0); return;
  3362. }
  3363. #else
  3364. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3365. {
  3366. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3367. exit(0); return;
  3368. }
  3369. #endif
  3370. #else
  3371. #ifdef BASIC_VERSION
  3372. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3373. {
  3374. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3375. exit(0);return;
  3376. }
  3377. #else
  3378. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3379. {
  3380. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3381. exit(0); return;
  3382. }
  3383. #endif
  3384. #endif
  3385. #endif
  3386. if (IsHasRightsnew(40) == 0)return;
  3387. UINT nID = 3;
  3388. LPSTR pName;
  3389. pName = (LPSTR)(LPCSTR)"礼服查看";
  3390. OPEN_MENU(ShowDress);
  3391. return;
  3392. }
  3393. else if (strMsg == "撞期预警")
  3394. {
  3395. UINT nID = 3;
  3396. LPSTR pName;
  3397. pName = (LPSTR)(LPCSTR)"撞期预警";
  3398. OPEN_MENU(DressEarlyWarning);
  3399. return;
  3400. }
  3401. else if (strMsg == "礼服出租")
  3402. {
  3403. UINT nID = 3;
  3404. LPSTR pName;
  3405. pName = (LPSTR)(LPCSTR)"礼服出租";
  3406. OPEN_MENU(ShowHireReg);
  3407. return;
  3408. }
  3409. else if (strMsg == "礼服图片")
  3410. {
  3411. ShowPic dlg;
  3412. dlg.m_mode = 4;
  3413. //dlg.m_path = g_path5 + "\\";
  3414. dlg.m_id = g_path5 + "\\";
  3415. dlg.DoModal();
  3416. return;
  3417. }
  3418. else if (strMsg == "商品类别设置")
  3419. {
  3420. if (IsHasRightsnew(29) == 0)return;
  3421. SPLBDlg dlg;
  3422. dlg.DoModal();
  3423. return;
  3424. }
  3425. else if (strMsg == "商品名称设置")
  3426. {
  3427. if (IsHasRightsnew(29) == 0)return;
  3428. UINT nID = 3;
  3429. LPSTR pName;
  3430. pName = (LPSTR)(LPCSTR)"商品设置";
  3431. OPEN_MENU(ShangPin);
  3432. return;
  3433. }
  3434. else if (strMsg == "固定资产管理")
  3435. {
  3436. UINT nID = 3;
  3437. LPSTR pName;
  3438. pName = (LPSTR)(LPCSTR)"固定资产管理";
  3439. OPEN_MENU(FixedAssets);
  3440. return;
  3441. }
  3442. else if (strMsg == "入库单")
  3443. {
  3444. if (IsHasRightsnew(44) == 0)return;
  3445. InputGoods dlg;
  3446. dlg.DoModal();
  3447. return;
  3448. }
  3449. else if (strMsg == "出库单")
  3450. {
  3451. #ifndef ENTERPRISE_VERSION
  3452. #ifndef CHILD_VERSION
  3453. #ifdef BASIC_VERSION
  3454. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3455. {
  3456. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3457. exit(0);return;
  3458. }
  3459. #else
  3460. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3461. {
  3462. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3463. exit(0);return;
  3464. }
  3465. #endif
  3466. #else
  3467. #ifdef BASIC_VERSION
  3468. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3469. {
  3470. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3471. exit(0);return;
  3472. }
  3473. #else
  3474. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3475. {
  3476. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3477. exit(0); return;
  3478. }
  3479. #endif
  3480. #endif
  3481. #else
  3482. #ifndef CHILD_VERSION
  3483. #ifdef BASIC_VERSION
  3484. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3485. {
  3486. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3487. exit(0); return;
  3488. }
  3489. #else
  3490. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3491. {
  3492. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3493. exit(0); return;
  3494. }
  3495. #endif
  3496. #else
  3497. #ifdef BASIC_VERSION
  3498. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3499. {
  3500. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3501. exit(0);return;
  3502. }
  3503. #else
  3504. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3505. {
  3506. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3507. exit(0); return;
  3508. }
  3509. #endif
  3510. #endif
  3511. #endif
  3512. if (IsHasRightsnew(45) == 0)return;
  3513. InputGoods dlg;
  3514. dlg.m_mode = 1;
  3515. dlg.DoModal();
  3516. return;
  3517. }
  3518. else if (strMsg == "库存查询")
  3519. {
  3520. #ifndef ENTERPRISE_VERSION
  3521. #ifndef CHILD_VERSION
  3522. #ifdef BASIC_VERSION
  3523. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3524. {
  3525. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3526. exit(0);return;
  3527. }
  3528. #else
  3529. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3530. {
  3531. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3532. exit(0);return;
  3533. }
  3534. #endif
  3535. #else
  3536. #ifdef BASIC_VERSION
  3537. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3538. {
  3539. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3540. exit(0);return;
  3541. }
  3542. #else
  3543. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3544. {
  3545. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3546. exit(0); return;
  3547. }
  3548. #endif
  3549. #endif
  3550. #else
  3551. #ifndef CHILD_VERSION
  3552. #ifdef BASIC_VERSION
  3553. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3554. {
  3555. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3556. exit(0); return;
  3557. }
  3558. #else
  3559. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3560. {
  3561. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3562. exit(0); return;
  3563. }
  3564. #endif
  3565. #else
  3566. #ifdef BASIC_VERSION
  3567. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3568. {
  3569. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3570. exit(0);return;
  3571. }
  3572. #else
  3573. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3574. {
  3575. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3576. exit(0); return;
  3577. }
  3578. #endif
  3579. #endif
  3580. #endif
  3581. UINT nID = 3;
  3582. LPSTR pName;
  3583. pName = (LPSTR)(LPCSTR)"库存查询";
  3584. OPEN_MENU(ShowGoods);
  3585. return;
  3586. }
  3587. else if (strMsg == "商品图表")
  3588. {
  3589. UINT nID = 3;
  3590. LPSTR pName;
  3591. pName = (LPSTR)(LPCSTR)"商品图表";
  3592. OPEN_MENU(StoreInfoChart);
  3593. return;
  3594. }
  3595. else if (strMsg == "成本核算")
  3596. {
  3597. UINT nID = 3;
  3598. LPSTR pName;
  3599. pName = (LPSTR)(LPCSTR)"成本核算";
  3600. OPEN_MENU(CostCal);
  3601. return;
  3602. }
  3603. else if (strMsg == "考勤记录")
  3604. {
  3605. UINT nID = 3;
  3606. LPSTR pName;
  3607. pName = (LPSTR)(LPCSTR)"考勤记录";
  3608. OPEN_MENU(LoginReg);
  3609. return;
  3610. }
  3611. else if (strMsg == "月统计")
  3612. {
  3613. UINT nID = 3;
  3614. LPSTR pName;
  3615. pName = (LPSTR)(LPCSTR)"月统计";
  3616. OPEN_MENU(LoginReg2);
  3617. return;
  3618. }
  3619. else if (strMsg == "时间设置")
  3620. {
  3621. if (IsHasRightsnew(21) == 0)return;
  3622. SetLoginTime dlg;
  3623. dlg.DoModal();
  3624. return;
  3625. }
  3626. else if (strMsg == "排班设置")
  3627. {
  3628. if (IsHasRightsnew(21) == 0)return;
  3629. SetLoginBan dlg;
  3630. dlg.DoModal();
  3631. return;
  3632. }
  3633. else if (strMsg == "意向查询")
  3634. {
  3635. UINT nID = 3;
  3636. LPSTR pName;
  3637. pName = (LPSTR)(LPCSTR)"意向查询";
  3638. OPEN_MENU(HospitalClient);
  3639. return;
  3640. }
  3641. else if (strMsg == "今日提醒")
  3642. {
  3643. UINT nID = 3;
  3644. LPSTR pName;
  3645. pName = (LPSTR)(LPCSTR)"今日提醒";
  3646. OPEN_MENU(HospitalClientAlarm);
  3647. return;
  3648. }
  3649. else if (strMsg == "跟踪短信")
  3650. {
  3651. UINT nID = 3;
  3652. LPSTR pName;
  3653. pName = (LPSTR)(LPCSTR)"跟踪短信";
  3654. OPEN_MENU(HospitalClientMsg);
  3655. return;
  3656. }
  3657. else if (strMsg == "意向单录入")
  3658. {
  3659. AddHospitalClient dlg;
  3660. dlg.DoModal();
  3661. return;
  3662. }
  3663. else if (strMsg == "资料设置")
  3664. {
  3665. HospitalInfoSet dlg;
  3666. dlg.DoModal();
  3667. return;
  3668. }
  3669. else if ( strMsg == _T("公众号设置"))
  3670. {
  3671. if (IsHasRightsnew(62) == 0)return;
  3672. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3673. {
  3674. lyfzLibrary::g_PtrShowWeiXinDialog(g_rc, g_bkcol);
  3675. lyfzLibrary::FreeWeiXinLibaray();
  3676. }
  3677. return;
  3678. }
  3679. else if ( strMsg == _T("模板消息设置"))
  3680. {
  3681. if (IsHasRightsnew(63) == 0)return;
  3682. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3683. {
  3684. lyfzLibrary::g_PtrShowWXMsgconfigDialog(g_rc, g_bkcol);
  3685. lyfzLibrary::FreeWeiXinLibaray();
  3686. }
  3687. return;
  3688. }
  3689. else if ( strMsg == _T("推送记录") )
  3690. {
  3691. if (IsHasRightsnew(64) == 0)return;
  3692. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3693. {
  3694. lyfzLibrary::g_PtrShowWXMsgRcordDialog(g_rc, g_bkcol);
  3695. lyfzLibrary::FreeWeiXinLibaray();
  3696. }
  3697. return;
  3698. }
  3699. AfxMessageBox(strMsg + ",开发中...");
  3700. }
  3701. // Jeff.当版本号不一致时,调用AutoUpdate.exe来升级YLGL.exe
  3702. void CMainFrame::AutoUpdate()
  3703. {
  3704. if (g_bBranchModify)
  3705. {
  3706. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3707. return;
  3708. }
  3709. else if (g_branchname != "")
  3710. {
  3711. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3712. return;
  3713. }
  3714. g_ntimeout = 30000;
  3715. if (!::PathFileExists(g_mainpath + "\\AutoUpdate.exe"))
  3716. {
  3717. g_sendhead.bsql = 0;
  3718. g_sendhead.code[0] = 99;
  3719. g_sendhead.tabcount = 1;
  3720. g_pMainWnd->ProcessChatMessageRequest2(99);
  3721. if (g_bSendOK == 0)
  3722. goto failed;
  3723. CFile fp;
  3724. fp.Open(g_mainpath + "\\AutoUpdate.exe", CFile::modeWrite | CFile::modeCreate);
  3725. fp.Write(g_pData, g_nLeng);
  3726. fp.Close();
  3727. }
  3728. {
  3729. ::DeleteFile(g_mainpath + "\\YLGL2.exe"); // 删除ylgl.exe;
  3730. g_sendhead.bsql = 0;
  3731. g_sendhead.code[0] = 98;
  3732. g_sendhead.tabcount = 1;
  3733. g_pMainWnd->ProcessChatMessageRequest2(99); if (g_bSendOK == 0)goto failed;
  3734. CFile fp;
  3735. fp.Open(g_mainpath + "\\YLGL2.exe", CFile::modeWrite | CFile::modeCreate);
  3736. fp.Write(g_pData, g_nLeng);
  3737. fp.Close();
  3738. }
  3739. AfxMessageBox("自动升级成功!", MB_ICONINFORMATION);
  3740. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\AutoUpdate.exe"), "12345", NULL, SW_SHOWNORMAL);
  3741. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3742. exit(0);
  3743. return;
  3744. failed:
  3745. AfxMessageBox("自动升级失败!", MB_ICONINFORMATION);
  3746. if (g_ntimeout == 30000)//非远程
  3747. {
  3748. AfxMessageBox("提醒:升级过程中需要传输较多的数据,如果网速慢可能导致远程升级失败!\r\n\
  3749. 可拷贝店内客户端用QQ传过来覆盖除dbconfig.dat的文件即可。", MB_ICONINFORMATION);
  3750. }
  3751. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3752. }
  3753. void CMainFrame::Onchoosephotoskin() //Jeff:此机用于选片菜单项;不在使用2014.06.16
  3754. {
  3755. if (g_user.bLongin == 0)
  3756. {
  3757. if (g_bNoLoginLia)
  3758. {
  3759. Login dlg;
  3760. dlg.SetLiaPath("5.lia");
  3761. dlg.DoModal();
  3762. }
  3763. else
  3764. {
  3765. Login3 dlg;
  3766. dlg.SetLiaPath("5.lia");
  3767. dlg.DoModal();
  3768. }
  3769. if (g_user.bLongin == 0)return;
  3770. }
  3771. // TODO: Add your command handler code here
  3772. CMenu *pMenu = GetMenu();
  3773. CMenu* submenu = pMenu->GetSubMenu(1);
  3774. UINT status = submenu->GetMenuState(IDM_choosephotoskin, MF_BYCOMMAND);
  3775. if (status&MF_CHECKED)
  3776. {
  3777. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_UNCHECKED);
  3778. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status", 0);
  3779. }
  3780. else
  3781. {
  3782. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  3783. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status", 1);
  3784. }
  3785. }
  3786. /*BOOL g_bInSkin = 0;*/
  3787. BOOL CMainFrame::IsCtrlDown()
  3788. {
  3789. short state = GetKeyState(VK_LCONTROL);
  3790. BYTE sta = (BYTE)(state >> 8);
  3791. state = GetKeyState(VK_RCONTROL);
  3792. BYTE sta2 = (BYTE)(state >> 8);
  3793. if (sta || sta2)
  3794. return 1;
  3795. else
  3796. return 0;
  3797. }//IsShiftDown
  3798. BOOL CMainFrame::IsShiftDown()
  3799. {
  3800. short state = GetKeyState(VK_LSHIFT);
  3801. BYTE sta = (BYTE)(state >> 8);
  3802. state = GetKeyState(VK_RSHIFT);
  3803. BYTE sta2 = (BYTE)(state >> 8);
  3804. if (sta || sta2)
  3805. return 1;
  3806. else
  3807. return 0;
  3808. }
  3809. BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
  3810. {
  3811. // TODO: Add your specialized code here and/or call the base class IDM_Logout
  3812. if (pMsg->message == WM_KEYDOWN)
  3813. {
  3814. switch (pMsg->wParam)
  3815. {
  3816. case VK_F12:
  3817. g_pMainWnd->OnCommandMenu(IDM_Logout);
  3818. return 1;
  3819. case VK_F1:
  3820. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  3821. return 1;
  3822. case VK_F2: // 此机用于选片和选设计;
  3823. {
  3824. if (g_pMainWnd->m_bCheckF2F3 && (IsShiftDown() == 0 || IsCtrlDown() == 0))return 1;
  3825. m_Mdi.MainClose();
  3826. if (g_user.bLongin)
  3827. {
  3828. SearchClient dlg;
  3829. dlg.SetLiaPath("2.lia");
  3830. if (dlg.DoModal() != IDOK)
  3831. {
  3832. if (dlg.m_bLogout)
  3833. {
  3834. g_user.bLongin = 0;
  3835. g_user.name.Empty();
  3836. g_user.rights.Empty();
  3837. g_user.account.Empty();
  3838. goto ll;
  3839. }
  3840. PostMessage(WM_QUIT);
  3841. return 1;
  3842. }
  3843. if (dlg.m_exitcode == 3)
  3844. {
  3845. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3846. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3847. }
  3848. else
  3849. {
  3850. ShowWindow(SW_SHOW);
  3851. #ifdef NEW_SKIN
  3852. if (m_pMainFrimDlg2 == NULL)
  3853. {
  3854. m_pMainFrimDlg2 = new MainFrimDlg2;
  3855. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3856. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3857. }
  3858. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3859. g_bInSkin = 0;
  3860. #endif
  3861. }
  3862. }
  3863. else
  3864. {
  3865. ll:
  3866. ChoosePhotoSkin dlg;
  3867. dlg.SetLiaPath("1.lia");
  3868. if (dlg.DoModal() != IDOK)
  3869. {
  3870. PostMessage(WM_QUIT);
  3871. return 1;
  3872. }
  3873. if (dlg.m_exitcode == 3)
  3874. {
  3875. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3876. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3877. }
  3878. else
  3879. {
  3880. ShowWindow(SW_SHOW);
  3881. #ifdef NEW_SKIN
  3882. if (m_pMainFrimDlg2 == NULL)
  3883. {
  3884. m_pMainFrimDlg2 = new MainFrimDlg2;
  3885. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3886. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3887. }
  3888. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3889. g_bInSkin = 0;
  3890. #endif
  3891. }
  3892. }
  3893. }
  3894. return 1;
  3895. case VK_F3: // 此机用于选片和选设计;
  3896. {
  3897. if (g_pMainWnd->m_bCheckF2F3 && (g_pMainWnd->IsShiftDown() == 0 || g_pMainWnd->IsCtrlDown() == 0))return 1;
  3898. m_Mdi.MainClose();
  3899. if (g_user.bLongin)
  3900. {
  3901. SearchClient dlg;
  3902. dlg.m_mode = 1;
  3903. dlg.SetLiaPath("2.lia");
  3904. if (dlg.DoModal() != IDOK)
  3905. {
  3906. if (dlg.m_bLogout)
  3907. {
  3908. g_user.bLongin = 0;
  3909. g_user.name.Empty();
  3910. g_user.rights.Empty();
  3911. g_user.account.Empty();
  3912. goto mm;
  3913. }
  3914. PostMessage(WM_QUIT);
  3915. return 1;
  3916. }
  3917. if (dlg.m_exitcode == 2)
  3918. {
  3919. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3920. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3921. }
  3922. else
  3923. {
  3924. ShowWindow(SW_SHOW);
  3925. #ifdef NEW_SKIN
  3926. if (m_pMainFrimDlg2 == NULL)
  3927. {
  3928. m_pMainFrimDlg2 = new MainFrimDlg2;
  3929. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3930. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3931. }
  3932. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3933. g_bInSkin = 0;
  3934. #endif
  3935. }
  3936. }
  3937. else
  3938. {
  3939. mm:
  3940. ChoosePhotoSkin dlg;
  3941. dlg.m_mode = 1;
  3942. dlg.SetLiaPath("1.lia");
  3943. if (dlg.DoModal() != IDOK)
  3944. {
  3945. PostMessage(WM_QUIT);
  3946. return 1;
  3947. }
  3948. if (dlg.m_exitcode == 2)
  3949. {
  3950. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3951. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3952. }
  3953. else
  3954. {
  3955. ShowWindow(SW_SHOW);
  3956. #ifdef NEW_SKIN
  3957. if (m_pMainFrimDlg2 == NULL)
  3958. {
  3959. m_pMainFrimDlg2 = new MainFrimDlg2;
  3960. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3961. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3962. }
  3963. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3964. g_bInSkin = 0;
  3965. #endif
  3966. }
  3967. }
  3968. }
  3969. return 1;
  3970. //#if 0 // 2015-05-30 禁用F11功能;
  3971. // case VK_F11:
  3972. // if (g_bInSkin)return 1;
  3973. // if (g_user.bLongin)
  3974. // {
  3975. // SqlDlg dlg;
  3976. // dlg.DoModal();
  3977. // }
  3978. // break;
  3979. //#endif
  3980. }
  3981. }
  3982. return CMDIFrameWnd::PreTranslateMessage(pMsg);
  3983. }
  3984. void CMainFrame::GetSkin()
  3985. {
  3986. return;
  3987. #ifdef MNLS_VERSION
  3988. if (::PathFileExists(g_mainpath + "\\skin\\4.lia"))
  3989. {
  3990. CFile fp;
  3991. fp.Open(g_mainpath + "\\skin\\4.lia", CFile::modeRead);
  3992. DWORD leng=fp.GetLength ();
  3993. fp.Close ();
  3994. if(leng!=194987)
  3995. ::DeleteFile (g_mainpath+"\\skin\\4.lia"); // 删除4.lia
  3996. }
  3997. if(!::PathFileExists (g_mainpath+"\\skin\\4.lia"))
  3998. {
  3999. ::CreateDirectory (g_mainpath+"\\skin", NULL);
  4000. g_sendhead.bsql=0;
  4001. g_sendhead.code[0]=100;
  4002. g_sendhead.tabcount=1;
  4003. g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return;
  4004. CFile fp;
  4005. fp.Open (g_mainpath+"\\skin\\4.lia", CFile::modeWrite|CFile::modeCreate);
  4006. fp.Write (g_pData, g_nLeng);
  4007. fp.Close ();
  4008. }
  4009. #endif
  4010. }
  4011. void AutoDraw(CPrintRX &m_Print, CRect &StrRect, CString &str, float fscale)
  4012. {
  4013. CString tempbz =_T(""), temp = _T("");
  4014. BOOL bRun = 0;
  4015. CSize size;
  4016. int fontsize = 12;
  4017. int i = 0;
  4018. ll: tempbz = str;
  4019. i = 0;
  4020. m_Print.SetFontFace(fontsize, 1, "宋体");
  4021. while (1)
  4022. {
  4023. if (!tempbz.IsEmpty())
  4024. {
  4025. temp = tempbz;
  4026. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4027. int right = 0;
  4028. CRect temprc = StrRect;
  4029. temprc.top += i*(fontsize*fscale); i++;
  4030. temprc.bottom = temprc.top + fontsize;
  4031. if (temprc.bottom > StrRect.bottom)break;
  4032. while (size.cx > temprc.Width())
  4033. {
  4034. right++;
  4035. temp = tempbz.Left(tempbz.GetLength() - (right));
  4036. if (GIsHalfHZ(temp))
  4037. {
  4038. right++;
  4039. temp.Delete(temp.GetLength() - 1);
  4040. }
  4041. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4042. }
  4043. // 判断最后的字符是否还含有半个汉字;
  4044. if ( GIsHalfHZ(temp) )
  4045. {
  4046. right++;
  4047. temp.Delete(temp.GetLength() -1);
  4048. temp = tempbz.Left(tempbz.GetLength() - (right));
  4049. }
  4050. if (temp.Find("\r\n") != -1)
  4051. {
  4052. temp = temp.Left(temp.Find("\r\n"));//i++;
  4053. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength() - 2);
  4054. }
  4055. else
  4056. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  4057. if (bRun)
  4058. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, temprc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4059. }
  4060. else
  4061. break;
  4062. }
  4063. if (tempbz.IsEmpty() == 0)
  4064. {
  4065. fontsize--;
  4066. goto ll;
  4067. }
  4068. if (bRun == 0)
  4069. {
  4070. bRun = 1;
  4071. goto ll;
  4072. }
  4073. }
  4074. void CMainFrame::PrintDinDan3(CString strOrderNumber)
  4075. {
  4076. // TODO: Add your control notification handler code here
  4077. CPrintRX m_Print;
  4078. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  4079. {
  4080. m_Print.InitToPrint(NULL, 1);
  4081. }
  4082. else
  4083. {
  4084. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  4085. if (name.IsEmpty())
  4086. m_Print.InitToPrint(NULL, 1);
  4087. else
  4088. {
  4089. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  4090. if (nret == -1)
  4091. {
  4092. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  4093. }
  4094. }
  4095. }
  4096. m_Print.StartPrint();
  4097. m_Print.StartPage();
  4098. LoadRect load;
  4099. load.SetLiaPath("11.lia");
  4100. load.SetMargins(0, 0);
  4101. if (!load.Load())return;
  4102. LoadRect load2;
  4103. load2.SetLiaPath("12.lia");
  4104. load2.SetMargins(0, 0);
  4105. if (!load2.Load())return;
  4106. LoadRect load3;
  4107. load3.SetLiaPath("13.lia");
  4108. load3.SetMargins(-6, 520);
  4109. if (!load3.Load())return;
  4110. int i;
  4111. //////////////////////////////////////////////////////////////
  4112. CStringArray txarray;
  4113. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "'";
  4114. g_sendhead.code[0] = 11;
  4115. g_sendhead.code[1] = 52;
  4116. g_sendhead.code[2] = 50;
  4117. g_sendhead.code[3] = 150;
  4118. g_sendhead.tabcount = 4;
  4119. g_sendhead.bsql = 0;
  4120. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  4121. CArray<CStringArray, CStringArray>sparray;
  4122. CArray<CStringArray, CStringArray>clientarray;
  4123. CArray<CStringArray, CStringArray>jdarray;
  4124. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray);
  4125. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  4126. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  4127. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  4128. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  4129. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  4130. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  4131. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  4132. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  4133. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  4134. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  4135. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  4136. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  4137. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  4138. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  4139. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  4140. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  4141. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  4142. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  4143. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  4144. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  4145. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  4146. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  4147. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  4148. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  4149. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  4150. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  4151. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  4152. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  4153. CString m_bz = "其它要求: " + g_List1array.ElementAt(0).ElementAt(38);
  4154. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  4155. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  4156. if (IsHasRights2new(31) == 0)
  4157. {
  4158. m_phone1 = "***";
  4159. m_phone2 = "***";
  4160. }
  4161. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  4162. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  4163. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  4164. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  4165. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  4166. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  4167. CString m_addr = m_addr1 + ";";
  4168. m_addr.TrimLeft(";");
  4169. m_addr += m_addr2;
  4170. CString m_qq = m_qq1 + ";";
  4171. m_qq.TrimLeft(";");
  4172. m_qq += m_qq2;
  4173. CString m_jd;
  4174. for (i = 0; i < jdarray.GetSize(); i++)
  4175. {
  4176. m_jd += jdarray.ElementAt(i).ElementAt(1);
  4177. m_jd += ";";
  4178. }
  4179. m_jd.TrimRight(";");
  4180. m_money1.Format("%f", atof(m_taoxijiage));
  4181. m_money2.Format("%f", atof(m_payed1));
  4182. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  4183. ConvertToPrice(m_money1);
  4184. ConvertToPrice(m_money2);
  4185. ConvertToPrice(m_money3);
  4186. ////////////////////////////////////////////////////////////////
  4187. int rcpos = -1;
  4188. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  4189. m_Print.SetFontFace(17, 1, "宋体");
  4190. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4191. StrRect.top -= 0;
  4192. StrRect.bottom -= 10;
  4193. StrRect.left -= 140;
  4194. StrRect.right = StrRect.left + 48;
  4195. m_Print.SetFontFace(15, 1, "宋体");
  4196. m_Print.SetColor(0xffffff);
  4197. m_Print.DrawRect(StrRect, 0);
  4198. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4199. StrRect.left = StrRect.right;
  4200. StrRect.right = StrRect.left + 48;
  4201. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  4202. m_Print.SetColor(0, RGB(255, 0, 0));
  4203. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4204. m_Print.SetColor(0);
  4205. m_Print.SetFontFace(12, 1, "宋体");
  4206. StrRect.left -= 48;
  4207. int hei = StrRect.Height();
  4208. StrRect.top = StrRect.bottom + 2;
  4209. StrRect.bottom += hei + 2;
  4210. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4211. StrRect.top = StrRect.bottom - 2;
  4212. StrRect.bottom += hei - 5;
  4213. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  4214. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4215. m_Print.SetFontFace(12, 1, "宋体");
  4216. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4217. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4218. m_Print.SetFontFace(11, 1, "宋体");
  4219. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4220. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4221. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4222. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4223. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4224. m_Print.DrawRect2(StrRect, 2);
  4225. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4226. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4227. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4228. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4229. m_Print.DrawRect2(StrRect, 2);
  4230. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4231. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4232. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4233. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4234. m_Print.DrawRect2(StrRect, 2);
  4235. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4236. m_Print.DrawText((LPTSTR)(LPCTSTR)"约单时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4237. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4238. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4239. m_Print.DrawRect2(StrRect, 2);
  4240. ////////////
  4241. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4242. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4243. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4244. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4245. m_Print.DrawRect2(StrRect, 2);
  4246. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4247. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4248. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4249. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4250. m_Print.DrawRect2(StrRect, 2);
  4251. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4252. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4253. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4254. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4255. m_Print.DrawRect2(StrRect, 2);
  4256. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4257. m_Print.DrawText((LPTSTR)(LPCTSTR)"大婚时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4258. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4259. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4260. m_Print.DrawRect2(StrRect, 2);
  4261. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4262. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客地址:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4263. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4264. m_Print.DrawText((LPTSTR)(LPCTSTR)m_addr, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4265. m_Print.DrawRect2(StrRect, 2);
  4266. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4267. m_Print.DrawText((LPTSTR)(LPCTSTR)"QQ/邮箱:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4268. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4269. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4270. m_Print.DrawRect2(StrRect, 2);
  4271. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4272. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系金额:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4273. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4274. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4275. m_Print.DrawRect2(StrRect, 2);
  4276. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4277. m_Print.DrawText((LPTSTR)(LPCTSTR)"定金:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4278. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4279. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4280. m_Print.DrawRect2(StrRect, 2);
  4281. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4282. m_Print.DrawText((LPTSTR)(LPCTSTR)"余额:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4283. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4284. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4285. m_Print.DrawRect2(StrRect, 2);
  4286. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4287. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4288. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4289. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4290. m_Print.DrawRect2(StrRect, 2);
  4291. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4292. m_Print.DrawText((LPTSTR)(LPCTSTR)"拍摄景点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4293. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4294. m_Print.DrawText((LPTSTR)(LPCTSTR)m_jd, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4295. m_Print.DrawRect2(StrRect, 2);
  4296. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4297. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内容提供: 男士服装:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4298. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4299. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4300. m_Print.DrawRect2(StrRect, 2);
  4301. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4302. m_Print.DrawText((LPTSTR)(LPCTSTR)"套", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  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_clothescount2, StrRect, 0, 0, FORMAT_HCENTER | 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)"套系内提供拍摄区服装/头饰造型", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4312. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4313. m_Print.DrawText((LPTSTR)(LPCTSTR)"其它:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4314. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4315. m_Print.DrawText((LPTSTR)(LPCTSTR)" ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4316. m_Print.DrawRect2(StrRect, 2);
  4317. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4318. m_Print.DrawText((LPTSTR)(LPCTSTR)"专业数码拍摄:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4319. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4320. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4321. m_Print.DrawRect2(StrRect, 2);
  4322. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4323. m_Print.DrawText((LPTSTR)(LPCTSTR)"张", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4324. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4325. m_Print.DrawText((LPTSTR)(LPCTSTR)"(JPG格式数据)", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4326. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4327. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内赠送:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4328. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4329. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_List1array.ElementAt(0).ElementAt(9)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4330. m_Print.DrawRect2(StrRect, 2);
  4331. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4332. m_Print.DrawText((LPTSTR)(LPCTSTR)"张设计排版精修入册", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4333. //////////////////////load2
  4334. rcpos = -1;
  4335. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4336. m_Print.DrawText((LPTSTR)(LPCTSTR)"原始数据套系内张数JPG格式光盘壹只", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4337. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4338. m_Print.DrawText((LPTSTR)(LPCTSTR)"其它:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4339. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4340. // m_Print.DrawText((LPTSTR)(LPCTSTR)"", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4341. // AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4342. m_Print.DrawRect2(StrRect, 2);
  4343. m_Print.SetFontFace(11, 1, "宋体");
  4344. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4345. m_Print.DrawText((LPTSTR)(LPCTSTR)"客人产品:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4346. int rowcount = sparray.GetSize() / 8;
  4347. int needaddrow = 0;
  4348. while (sparray.GetSize() > rowcount * 8 + needaddrow)
  4349. needaddrow++;
  4350. int pos = 0;
  4351. CString str = "";
  4352. int addcount = 0;
  4353. if (needaddrow > 0)
  4354. addcount = 1;
  4355. else
  4356. addcount = 0;
  4357. needaddrow--;
  4358. str.Empty();
  4359. for (i = 0; i < rowcount + addcount; i++)
  4360. {
  4361. str += sparray.ElementAt(pos).ElementAt(5);
  4362. str += " 数量:";
  4363. str += sparray.ElementAt(pos).ElementAt(3);
  4364. str += ";";
  4365. pos++;
  4366. }
  4367. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4368. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4369. m_Print.DrawRect2(StrRect, 2);
  4370. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4371. if (needaddrow > 0)
  4372. addcount = 1;
  4373. else
  4374. addcount = 0;
  4375. needaddrow--;
  4376. str.Empty();
  4377. for (i = 0; i < rowcount + addcount; i++)
  4378. {
  4379. str += sparray.ElementAt(pos).ElementAt(5);
  4380. str += " 数量:";
  4381. str += sparray.ElementAt(pos).ElementAt(3);
  4382. str += ";";
  4383. pos++;
  4384. }
  4385. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4386. m_Print.DrawRect2(StrRect, 2);
  4387. StrRect = load2.m_rcarray.ElementAt(++rcpos);//7
  4388. if (needaddrow > 0)
  4389. addcount = 1;
  4390. else
  4391. addcount = 0;
  4392. needaddrow--;
  4393. str.Empty();
  4394. for (i = 0; i < rowcount + addcount; i++)
  4395. {
  4396. str += sparray.ElementAt(pos).ElementAt(5);
  4397. str += " 数量:";
  4398. str += sparray.ElementAt(pos).ElementAt(3);
  4399. str += ";";
  4400. pos++;
  4401. }
  4402. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4403. m_Print.DrawRect2(StrRect, 2);
  4404. StrRect = load2.m_rcarray.ElementAt(++rcpos);//8
  4405. if (needaddrow > 0)
  4406. addcount = 1;
  4407. else
  4408. addcount = 0;
  4409. needaddrow--;
  4410. str.Empty();
  4411. for (i = 0; i < rowcount + addcount; i++)
  4412. {
  4413. str += sparray.ElementAt(pos).ElementAt(5);
  4414. str += " 数量:";
  4415. str += sparray.ElementAt(pos).ElementAt(3);
  4416. str += ";";
  4417. pos++;
  4418. }
  4419. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4420. m_Print.DrawRect2(StrRect, 2);
  4421. StrRect = load2.m_rcarray.ElementAt(++rcpos);//9
  4422. if (needaddrow > 0)
  4423. addcount = 1;
  4424. else
  4425. addcount = 0;
  4426. needaddrow--;
  4427. str.Empty();
  4428. for (i = 0; i < rowcount + addcount; i++)
  4429. {
  4430. str += sparray.ElementAt(pos).ElementAt(5);
  4431. str += " 数量:";
  4432. str += sparray.ElementAt(pos).ElementAt(3);
  4433. str += ";";
  4434. pos++;
  4435. }
  4436. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4437. m_Print.DrawRect2(StrRect, 2);
  4438. StrRect = load2.m_rcarray.ElementAt(++rcpos);//10
  4439. if (needaddrow > 0)
  4440. addcount = 1;
  4441. else
  4442. addcount = 0;
  4443. needaddrow--;
  4444. str.Empty();
  4445. for (i = 0; i < rowcount + addcount; i++)
  4446. {
  4447. str += sparray.ElementAt(pos).ElementAt(5);
  4448. str += " 数量:";
  4449. str += sparray.ElementAt(pos).ElementAt(3);
  4450. str += ";";
  4451. pos++;
  4452. }
  4453. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4454. m_Print.DrawRect2(StrRect, 2);
  4455. StrRect = load2.m_rcarray.ElementAt(++rcpos);//11
  4456. if (needaddrow > 0)
  4457. addcount = 1;
  4458. else
  4459. addcount = 0;
  4460. needaddrow--;
  4461. str.Empty();
  4462. for (i = 0; i < rowcount + addcount; i++)
  4463. {
  4464. str += sparray.ElementAt(pos).ElementAt(5);
  4465. str += " 数量:";
  4466. str += sparray.ElementAt(pos).ElementAt(3);
  4467. str += ";";
  4468. pos++;
  4469. }
  4470. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4471. m_Print.DrawRect2(StrRect, 2);
  4472. StrRect = load2.m_rcarray.ElementAt(++rcpos);//12
  4473. if (needaddrow > 0)
  4474. addcount = 1;
  4475. else
  4476. addcount = 0;
  4477. needaddrow--;
  4478. str.Empty();
  4479. for (i = 0; i < rowcount + addcount; i++)
  4480. {
  4481. str += sparray.ElementAt(pos).ElementAt(5);
  4482. str += " 数量:";
  4483. str += sparray.ElementAt(pos).ElementAt(3);
  4484. str += ";";
  4485. pos++;
  4486. }
  4487. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4488. m_Print.DrawRect2(StrRect, 2);
  4489. /* StrRect=load2.m_rcarray .ElementAt (++rcpos);//12
  4490. if(needaddrow>0)
  4491. addcount=1;
  4492. else
  4493. addcount=0;
  4494. needaddrow--;
  4495. str.Empty ();
  4496. for( i=0; i<rowcount+addcount; i++)
  4497. {
  4498. str+=sparray.ElementAt (pos).ElementAt (5);
  4499. str+=" 数量:";
  4500. str+=sparray.ElementAt (pos).ElementAt (3);
  4501. str+=";";
  4502. pos++;
  4503. }
  4504. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4505. m_Print.DrawRect2(StrRect, 2);
  4506. StrRect=load2.m_rcarray .ElementAt (++rcpos);//14
  4507. if(needaddrow>0)
  4508. addcount=1;
  4509. else
  4510. addcount=0;
  4511. needaddrow--;
  4512. str.Empty ();
  4513. for( i=0; i<rowcount+addcount; i++)
  4514. {
  4515. str+=sparray.ElementAt (pos).ElementAt (5);
  4516. str+=" 数量:";
  4517. str+=sparray.ElementAt (pos).ElementAt (3);
  4518. str+=";";
  4519. pos++;
  4520. }
  4521. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4522. m_Print.DrawRect2(StrRect, 2);*/
  4523. CRect sprc[2];
  4524. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4525. // AutoDraw(m_Print, StrRect, m_bz.Left (leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4526. m_Print.DrawRect2(StrRect, 2);
  4527. sprc[0] = StrRect;
  4528. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4529. // AutoDraw(m_Print, StrRect, m_bz.Right (leng-leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4530. m_Print.DrawRect2(StrRect, 2);
  4531. sprc[1] = StrRect;
  4532. //AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4533. {
  4534. CString temp, tempspno, tempbz;
  4535. CSize size;
  4536. BOOL bRun = 0;
  4537. int fontsize = 12;
  4538. ll: tempspno = m_bz;
  4539. m_Print.SetFontFace(fontsize, 1, "宋体");
  4540. for (i = 0; i<2; i++)
  4541. {
  4542. if (!tempspno.IsEmpty())
  4543. {
  4544. temp = tempspno;
  4545. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4546. int right = 0;
  4547. CRect temprc = sprc[i];
  4548. while (size.cx>temprc.Width())
  4549. {
  4550. right++;
  4551. temp = tempspno.Left(tempspno.GetLength() - (right));
  4552. if (GIsHalfHZ(temp))
  4553. {
  4554. right++;
  4555. temp.Delete(temp.GetLength() - 1);
  4556. }
  4557. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4558. }
  4559. if (bRun)
  4560. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4561. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  4562. if (tempspno.IsEmpty())i++;
  4563. }
  4564. }
  4565. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  4566. {
  4567. fontsize--;
  4568. goto ll;
  4569. }
  4570. if (bRun == 0)
  4571. {
  4572. bRun = 1;
  4573. goto ll;
  4574. }
  4575. }
  4576. m_Print.SetFontFace(11, 1, "宋体");
  4577. //////////////////////load3
  4578. rcpos = -1;
  4579. for (i = 0; i < 24; i++)
  4580. {
  4581. StrRect = load3.m_rcarray.ElementAt(i);
  4582. m_Print.DrawRect2(StrRect, 1);
  4583. }
  4584. CStringArray strarray;
  4585. strarray.Add("营业员");
  4586. strarray.Add("前台接待");
  4587. strarray.Add("化妆师");
  4588. strarray.Add("礼服师");
  4589. strarray.Add("摄影师");
  4590. strarray.Add("摄影助理");
  4591. strarray.Add("美工师");
  4592. strarray.Add("设计师");
  4593. for (i = 0; i < 8; i++)
  4594. {
  4595. StrRect = load3.m_rcarray.ElementAt(i);
  4596. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4597. }
  4598. strarray.RemoveAll();
  4599. strarray.Add(m_ren);
  4600. strarray.Add(g_List1array.ElementAt(0).ElementAt(49));
  4601. strarray.Add(m_waiter2);
  4602. strarray.Add(g_List1array.ElementAt(0).ElementAt(51));
  4603. strarray.Add(m_waiter1);
  4604. strarray.Add(g_List1array.ElementAt(0).ElementAt(50));
  4605. strarray.Add("");
  4606. strarray.Add(m_waiter4);
  4607. for (i = 8; i < 16; i++)
  4608. {
  4609. StrRect = load3.m_rcarray.ElementAt(i);
  4610. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 8), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4611. }
  4612. StrRect = load3.m_rcarray.ElementAt(27);
  4613. m_Print.DrawText((LPTSTR)(LPCTSTR)"客户电话: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4614. StrRect = load3.m_rcarray.ElementAt(28);
  4615. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4616. m_Print.SetFontFace(13, 1, "宋体");
  4617. StrRect = load3.m_rcarray.ElementAt(25);
  4618. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4619. StrRect = load3.m_rcarray.ElementAt(26);
  4620. m_Print.DrawRect2(StrRect, 2);
  4621. StrRect = load3.m_rcarray.ElementAt(24);
  4622. str = "\
  4623. 顾客须知\r\n\
  4624. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  4625. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  4626. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  4627. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  4628. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  4629. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  4630. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  4631. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  4632. AutoDraw(m_Print, StrRect, str, 1.8f);
  4633. PrintPreview dlg;
  4634. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4635. dlg.m_pDC = m_Print.GetPDC();
  4636. if (dlg.DoModal() != IDOK)return;
  4637. //结束打印
  4638. m_Print.EndPage();
  4639. m_Print.EndPrint();
  4640. }
  4641. void CMainFrame::PrintDailyForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4642. {
  4643. // TODO: Add your control notification handler code here
  4644. int pages = Listarray->GetSize() / 46;
  4645. if (Listarray->GetSize() % 46)pages++;
  4646. for (int aa = 0; aa < pages; aa++)
  4647. {
  4648. PrintPreview dlg;
  4649. CPrintRX m_Print;
  4650. m_Print.InitToPrint(NULL, 1);
  4651. m_Print.StartPrint();
  4652. m_Print.StartPage();
  4653. CRect mainrc(0, 0, 560, 793);
  4654. float fscale;
  4655. {
  4656. int w, h;
  4657. m_Print.GetWidHei(w, h);
  4658. fscale = (float)w / (float)h;
  4659. }
  4660. mainrc.DeflateRect(25, 40, 10, 0);
  4661. CRect rc, rc2;
  4662. rc = mainrc;
  4663. rc.bottom = rc.top;
  4664. rc.top -= 20;
  4665. m_Print.SetFontFace(16, 1, "黑体");
  4666. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4667. m_Print.SetFontFace(9, 1, "宋体");
  4668. CString str;
  4669. int wid[4] = { 320, 60, 60, 90 };
  4670. int hei = 16;
  4671. if (fscale > 0.71)hei = 15;
  4672. rc = mainrc;
  4673. rc.bottom = rc.top + hei;
  4674. for (int i = 0; i < 47; i++)
  4675. {
  4676. rc2.top = rc.top + i*hei;
  4677. rc2.bottom = rc.bottom + i*hei;
  4678. rc2.left = rc.left;
  4679. rc2.right = rc.left + wid[0];
  4680. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  4681. for (int j = 0; j<4; j++)
  4682. {
  4683. m_Print.DrawRect2(rc2, 1);
  4684. if (Listarray->GetSize()>aa * 46 + i)
  4685. {
  4686. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  4687. rc2.left += 3;
  4688. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4689. rc2.left -= 3;
  4690. }
  4691. rc2.left += wid[j];
  4692. rc2.right = rc2.left + wid[j + 1];
  4693. }
  4694. }
  4695. rc2.top += 2;
  4696. rc2.left += 2; rc2.right = mainrc.right + 4;
  4697. m_Print.SetFontFace(8, 1, "宋体");
  4698. int infopos = info.Find("***");
  4699. if (infopos != -1)
  4700. {
  4701. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Left(infopos), rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4702. CRect rc3 = rc2;
  4703. rc3.top = rc2.bottom - 4;
  4704. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Right(info.GetLength() - infopos - 3), rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4705. }
  4706. else
  4707. m_Print.DrawText((LPTSTR)(LPCTSTR)info, rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4708. str.Format(" 页:%d/%d", aa + 1, pages);
  4709. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4710. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  4711. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4712. dlg.m_pDC = m_Print.GetPDC();
  4713. // dlg.m_mode=1;
  4714. if (aa == 0)
  4715. {
  4716. if (dlg.DoModal() != IDOK)
  4717. return;
  4718. }
  4719. //结束打印
  4720. m_Print.EndPage();
  4721. m_Print.EndPrint();
  4722. }
  4723. }
  4724. void CMainFrame::PrintLoginForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4725. {
  4726. // TODO: Add your control notification handler code here
  4727. int sinlecount = 33 * 6;
  4728. int pages = Listarray->GetSize() / sinlecount;
  4729. if (Listarray->GetSize() % sinlecount)pages++;
  4730. for (int aa = 0; aa < pages; aa++)
  4731. {
  4732. PrintPreview dlg;
  4733. CPrintRX m_Print;
  4734. m_Print.InitToPrint(NULL, 1);
  4735. m_Print.StartPrint();
  4736. m_Print.StartPage();
  4737. CRect mainrc(0, 0, 560, 793);
  4738. float fscale;
  4739. {
  4740. int w, h;
  4741. m_Print.GetWidHei(w, h);
  4742. fscale = (float)w / (float)h;
  4743. }
  4744. mainrc.DeflateRect(25, 40, 10, 0);
  4745. CString str;
  4746. CRect rc, rc2;
  4747. rc = mainrc;
  4748. rc.bottom = rc.top;
  4749. rc.top -= 20;
  4750. rc.left -= 20;
  4751. m_Print.SetFontFace(12, 1, "黑体");
  4752. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4753. m_Print.SetFontFace(6, 1, "宋体");
  4754. str.Format(" 页:%d/%d", aa + 1, pages);
  4755. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4756. rc.right = mainrc.right + 20;
  4757. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4758. int wid[2] = { 50, 110 };
  4759. int hei = 11;
  4760. rc = mainrc;
  4761. rc.bottom = rc.top + hei;
  4762. rc.top += 10;
  4763. rc.bottom += 10;
  4764. int dtx = rc.Width() / 3 + 18;
  4765. int dty = 380;
  4766. for (int j = 0; j < 6; j++)
  4767. {
  4768. if (Listarray->GetSize() < aa*sinlecount + 33 * (j + 1))continue;
  4769. for (int i = 0; i < 33; i++)
  4770. {
  4771. rc2.top = rc.top + i*hei;
  4772. rc2.bottom = rc.bottom + i*hei;
  4773. rc2.left = rc.left;
  4774. rc2.right = rc.left + wid[0];
  4775. if (i == 0)
  4776. {
  4777. // rc2.left +=wid[1];
  4778. rc2.right += wid[1];
  4779. }
  4780. if (j == 1 || j == 4)
  4781. {
  4782. rc2.left += dtx;
  4783. rc2.right += dtx;
  4784. }
  4785. if (j == 2 || j == 5)
  4786. {
  4787. rc2.left += dtx * 2;
  4788. rc2.right += dtx * 2;
  4789. }
  4790. if (j == 3 || j == 4 || j == 5)
  4791. {
  4792. rc2.top += dty;
  4793. rc2.bottom += dty;
  4794. }
  4795. m_Print.DrawRect2(rc2, 1);
  4796. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4797. {
  4798. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(0);
  4799. rc2.left += 3;
  4800. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4801. rc2.left -= 3;
  4802. }
  4803. if (i == 0)continue;
  4804. rc2.left = rc2.right;
  4805. rc2.right += wid[1];
  4806. m_Print.DrawRect2(rc2, 1);
  4807. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4808. {
  4809. if (Listarray->ElementAt(aa*sinlecount + 33 * j + i).GetSize() > 1)
  4810. {
  4811. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(1);
  4812. rc2.left += 3;
  4813. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4814. rc2.left -= 3;
  4815. }
  4816. }
  4817. /* if(Listarray->GetSize ()>aa*46+i)
  4818. {
  4819. str=Listarray->ElementAt (aa*46+i).ElementAt (j);
  4820. rc2.left +=3;
  4821. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4822. rc2.left -=3;
  4823. }
  4824. rc2.left +=wid[j];
  4825. rc2.right =rc2.left+wid[j+1];*/
  4826. }
  4827. }
  4828. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4829. dlg.m_pDC = m_Print.GetPDC();
  4830. if (aa == 0)
  4831. {
  4832. if (dlg.DoModal() != IDOK)
  4833. return;
  4834. }
  4835. //结束打印
  4836. m_Print.EndPage();
  4837. m_Print.EndPrint();
  4838. }
  4839. }
  4840. void CMainFrame::PrintTakeForm(CArray<CStringArray, CStringArray>*Listarray)
  4841. {
  4842. CString title;
  4843. CString info;
  4844. // TODO: Add your control notification handler code here
  4845. int sinlecount = 4;
  4846. int pages = Listarray->GetSize() / sinlecount;
  4847. if (Listarray->GetSize() % sinlecount)pages++;
  4848. for (int aa = 0; aa < pages; aa++)
  4849. {
  4850. PrintPreview dlg;
  4851. CPrintRX m_Print;
  4852. m_Print.InitToPrint(NULL, 1);
  4853. m_Print.StartPrint();
  4854. m_Print.StartPage();
  4855. CRect mainrc(0, 0, 560, 793);
  4856. float fscale;
  4857. {
  4858. int w, h;
  4859. m_Print.GetWidHei(w, h);
  4860. fscale = (float)w / (float)h;
  4861. }
  4862. mainrc.DeflateRect(25, 40, 10, 0);
  4863. CString str;
  4864. CRect rc, rc2;
  4865. rc = mainrc;
  4866. rc.bottom = rc.top;
  4867. rc.top -= 20;
  4868. rc.left -= 20;
  4869. m_Print.SetFontFace(6, 1, "宋体");
  4870. str.Format(" 页:%d/%d", aa + 1, pages);
  4871. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4872. rc.right = mainrc.right + 10;
  4873. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4874. m_Print.SetFontFace(12, 1, "宋体");
  4875. int wid[2] = { 70, 190 };
  4876. int hei = 22;
  4877. rc = mainrc;
  4878. rc.bottom = rc.top + hei;
  4879. rc.top += 10;
  4880. rc.bottom += 10;
  4881. int dtx = rc.Width() / 2 + 18;
  4882. int dty = 380;
  4883. int arraysize = Listarray->ElementAt(0).GetSize();
  4884. for (int j = 0; j < 4; j++)
  4885. {
  4886. if (Listarray->GetSize() <= aa*sinlecount + j)continue;
  4887. for (int i = 0; i < arraysize; i++)
  4888. {
  4889. rc2.top = rc.top + i / 2 * hei;
  4890. rc2.bottom = rc.bottom + i / 2 * hei;
  4891. rc2.left = rc.left;
  4892. rc2.right = rc.left + wid[0];
  4893. if (i % 2)
  4894. {
  4895. rc2.left = rc2.right;
  4896. rc2.right += wid[1];
  4897. }
  4898. if (j == 1 || j == 3)
  4899. {
  4900. rc2.left += dtx;
  4901. rc2.right += dtx;
  4902. }
  4903. if (j == 2 || j == 3)
  4904. {
  4905. rc2.top += dty;
  4906. rc2.bottom += dty;
  4907. }
  4908. if (i == arraysize - 1 || i == arraysize - 2)
  4909. {
  4910. rc2.bottom += hei * 2;
  4911. }
  4912. m_Print.DrawRect2(rc2, 1);
  4913. {
  4914. str = Listarray->ElementAt(aa*sinlecount + j).ElementAt(i);
  4915. if (i == arraysize - 1)
  4916. {
  4917. CRect rc3 = rc2;
  4918. rc3.left += 3;
  4919. rc3.top += 3;
  4920. AutoDraw(m_Print, rc3, str, 1.4f);
  4921. }
  4922. else if (i == arraysize - 2)
  4923. {
  4924. CRect rc3 = rc2;
  4925. rc3.left += 3;
  4926. rc3.top += 3;
  4927. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4928. }
  4929. else
  4930. {
  4931. rc2.left += 3;
  4932. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4933. rc2.left -= 3;
  4934. }
  4935. }
  4936. }
  4937. }
  4938. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4939. dlg.m_pDC = m_Print.GetPDC();
  4940. if (aa == 0)
  4941. {
  4942. if (dlg.DoModal() != IDOK)
  4943. return;
  4944. }
  4945. //结束打印
  4946. m_Print.EndPage();
  4947. m_Print.EndPrint();
  4948. }
  4949. }
  4950. void CMainFrame::PrintThumbNail(CStringArray *array, CString client, BOOL bDir, CString m_size)
  4951. {
  4952. // TODO: Add your control notification handler code here
  4953. CStringArray titlearray;
  4954. CStringArray namearray;
  4955. CStringArray noarray;
  4956. CArray<CRect, CRect>rcarray;
  4957. CArray<CRect, CRect>widtharray;
  4958. if (m_size != "")
  4959. {
  4960. int pos = m_size.Find(";");
  4961. while (pos != -1)
  4962. {
  4963. CString size = m_size.Left(pos);
  4964. int pos2 = size.Find(":");
  4965. if (pos2 != -1)
  4966. {
  4967. CString str;
  4968. CRect rc;
  4969. str = size.Left(pos2);
  4970. noarray.Add(str);
  4971. str = size.Right(size.GetLength() - pos2 - 1);
  4972. pos2 = str.Find(",");
  4973. namearray.Add(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4974. pos2 = str.Find(",");
  4975. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4976. pos2 = str.Find(",");
  4977. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4978. widtharray.Add(rc);
  4979. pos2 = str.Find(",");
  4980. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4981. pos2 = str.Find(",");
  4982. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4983. pos2 = str.Find(",");
  4984. rc.right = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4985. rc.bottom = atoi(str);
  4986. rcarray.Add(rc);
  4987. }
  4988. m_size = m_size.Right(m_size.GetLength() - pos - 1);
  4989. pos = m_size.Find(";");
  4990. }
  4991. }
  4992. PrintPreview dlg;
  4993. CPrintRX m_Print;
  4994. m_Print.InitToPrint(NULL, 1);
  4995. m_Print.StartPrint();
  4996. m_Print.StartPage();
  4997. CRect mainrc(0, 0, 560, 793);
  4998. mainrc.DeflateRect(25, 50, 10, 0);
  4999. m_Print.SetFontFace(10, 1, "宋体");
  5000. CRect rc, rc2;
  5001. rc = mainrc;
  5002. rc.bottom = rc.top;
  5003. rc.top -= 20;
  5004. m_Print.DrawText((LPTSTR)(LPCTSTR)client, rc, 0, 0, FORMAT_LEFT | FORMAT_UP);
  5005. rc.bottom -= 5;
  5006. m_Print.DrawRect2(rc, 2);
  5007. if (array->GetSize() > 130)m_Print.SetFontFace(8, 1, "宋体");
  5008. if (bDir)m_Print.SetFontFace(6, 1, "宋体");
  5009. ////////////////////////////////////////////////////////////////
  5010. int imgcount = array->GetSize();
  5011. int dtx = 5;
  5012. int dty = 15;
  5013. int cx, cy;
  5014. int countx = 5;
  5015. int county = 1;
  5016. while (1)
  5017. {
  5018. if (countx*county >= imgcount)
  5019. {
  5020. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  5021. cy = cx * 4 / 3;
  5022. break;
  5023. }
  5024. else
  5025. {
  5026. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  5027. cy = cx * 4 / 3;
  5028. if (cy*(county + 1) + dty*county < mainrc.Height())//Y方向可以增加一个
  5029. {
  5030. county++;
  5031. }
  5032. else//Y方向不能加,X方向加
  5033. {
  5034. countx++;
  5035. county = 1;
  5036. }
  5037. }
  5038. }
  5039. int imgpos = 0;
  5040. CString stemp;
  5041. CPen pen(PS_SOLID, 1, RGB(255, 0, 0));
  5042. CPen *oldpen = m_Print.m_DC.SelectObject(&pen);
  5043. CPen *oldpen2 = m_Print.m_memdc.SelectObject(&pen);
  5044. for (int i = 0; i < county; i++)
  5045. {
  5046. for (int j = 0; j < countx; j++)
  5047. {
  5048. rc = mainrc;
  5049. rc.top += i*(cy + dty);
  5050. rc.left += j*(cx + dtx);
  5051. rc.right = rc.left + cx;
  5052. rc.bottom = rc.top + cy;
  5053. Image *pImg = NULL;
  5054. if (imgpos >= array->GetSize())break;
  5055. CString str = array->ElementAt(imgpos);
  5056. CString spath = str.Left(str.ReverseFind('\\') + 1);
  5057. spath += "m";
  5058. spath += str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5059. if (PathFileExists(spath))
  5060. ::LoadImageFromBuf(&pImg, spath);
  5061. else
  5062. {
  5063. ::LoadImageFromBuf(&pImg, str);
  5064. if (pImg == NULL)continue;
  5065. int orientation = GetOrientation(pImg);
  5066. if (orientation == 8)
  5067. pImg->RotateFlip(Rotate270FlipNone);
  5068. else if (orientation == 6)
  5069. pImg->RotateFlip(Rotate90FlipNone);
  5070. }
  5071. if (pImg == NULL)continue;
  5072. rc2 = rc;
  5073. RectFitDes(pImg->GetWidth(), pImg->GetHeight(), rc);
  5074. imgpos++;
  5075. m_Print.DrawImage(pImg, rc);
  5076. int imgwidth = pImg->GetWidth();
  5077. delete pImg;
  5078. rc2.top = rc2.bottom + 3;
  5079. rc2.bottom += 10;
  5080. if (bDir == 0)
  5081. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5082. else
  5083. {
  5084. stemp = str.Left(str.ReverseFind('\\'));
  5085. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5086. if (stemp.ReverseFind('\\') != -1)
  5087. {
  5088. stemp = stemp.Right(stemp.GetLength() - stemp.ReverseFind('\\') - 1);
  5089. str = stemp + "\\" + str;
  5090. }
  5091. }
  5092. if (str.Find(".") != -1)
  5093. str = str.Left(str.Find("."));
  5094. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5095. if (noarray.GetSize())
  5096. {
  5097. rc2 = rc;
  5098. for (int aa = 0; aa < noarray.GetSize(); aa++)
  5099. {
  5100. float scale = (float)rc2.Width() / (float)imgwidth;
  5101. if (noarray.ElementAt(aa) == str)
  5102. {
  5103. int nIndex = aa;
  5104. CRect rc = rcarray.ElementAt(nIndex);
  5105. int wid = widtharray.ElementAt(nIndex).left;
  5106. int hei = widtharray.ElementAt(nIndex).top;
  5107. scale *= (float)imgwidth / (float)wid;
  5108. rc.left *= scale;
  5109. rc.right *= scale;
  5110. rc.top *= scale;
  5111. rc.bottom *= scale;
  5112. rc.left += rc2.left;
  5113. rc.right += rc2.left;
  5114. rc.top += rc2.top;
  5115. rc.bottom += rc2.top;
  5116. if (rc.left < rc2.left)rc.left = rc2.left;
  5117. if (rc.right > rc2.right)rc.right = rc2.right;
  5118. if (rc.top < rc2.top)rc.top = rc2.top;
  5119. if (rc.bottom > rc2.bottom)rc.bottom = rc2.bottom;
  5120. m_Print.DrawRect2(rc, 1);
  5121. }
  5122. }
  5123. }
  5124. }
  5125. }
  5126. m_Print.m_DC.SelectObject(oldpen);
  5127. m_Print.m_memdc.SelectObject(oldpen2);
  5128. /* CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  5129. StrRect.top -=15;StrRect.bottom -=15;
  5130. Image *pImg=NULL;
  5131. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  5132. m_Print.DrawImage(pImg, StrRect);
  5133. delete pImg;
  5134. m_Print.SetFontFace(10, 1, "宋体");
  5135. StrRect=load.m_rcarray .ElementAt (20);
  5136. StrRect.right=load.m_rcarray .ElementAt (23).right;
  5137. StrRect.top -=18;StrRect.bottom -=18;
  5138. CString str="地址:"+g_cominfoarray.ElementAt (0).ElementAt (12);
  5139. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5140. */
  5141. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  5142. dlg.m_pDC = m_Print.GetPDC();
  5143. if (dlg.DoModal() != IDOK)
  5144. return;
  5145. //结束打印
  5146. m_Print.EndPage();
  5147. m_Print.EndPrint();
  5148. }
  5149. // remark by Jeff
  5150. // 函数:PrintDinDan
  5151. // 参数:
  5152. // strOrderNumber:订单单号;(Order number)
  5153. // 返回:void
  5154. // 注意:#
  5155. void CMainFrame::PrintDinDan(CString strOrderNumber)//打印订单报表;
  5156. {
  5157. int printcot = 1;
  5158. for (int aa = 0; aa < printcot; aa++)
  5159. {
  5160. PrintPreview dlg;
  5161. CPrintRX m_Print;
  5162. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  5163. {
  5164. m_Print.InitToPrint(NULL, 1);
  5165. }
  5166. else
  5167. {
  5168. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  5169. if (name.IsEmpty())
  5170. m_Print.InitToPrint(NULL, 1);
  5171. else
  5172. {
  5173. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  5174. if (nret == -1 && aa == 0)
  5175. {
  5176. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  5177. }
  5178. }
  5179. }
  5180. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 0)
  5181. {
  5182. #ifdef ZHIAI_VERSION
  5183. PrintDinDan3(strOrderNumber);
  5184. return;
  5185. #endif
  5186. #ifdef SZBLCT_VERSION
  5187. PrintDinDan4(strOrderNumber);
  5188. return;
  5189. #endif
  5190. m_Print.StartPrint();
  5191. m_Print.StartPage();
  5192. LoadRect load;
  5193. load.SetLiaPath("6.lia");
  5194. load.SetMargins(-14, 15);
  5195. if (!load.Load())return;
  5196. LoadRect load2;
  5197. load2.SetLiaPath("7.lia");
  5198. load2.SetMargins(-14, 216 + 15);
  5199. if (!load2.Load())return;
  5200. LoadRect load3;
  5201. load3.SetLiaPath("8.lia");
  5202. load3.SetMargins(-14, 705 + 15);
  5203. if (!load3.Load())return;
  5204. int i;
  5205. //////////////////////////////////////////////////////////////
  5206. CStringArray txarray;
  5207. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  5208. g_sendhead.code[0] = 11;
  5209. g_sendhead.code[1] = 52;
  5210. g_sendhead.code[2] = 50;
  5211. g_sendhead.code[3] = 150;
  5212. g_sendhead.code[4] = 77;
  5213. g_sendhead.code[5] = 4;
  5214. g_sendhead.tabcount = 6;
  5215. g_sendhead.bsql = 0;
  5216. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5217. CArray<CStringArray, CStringArray>sparray;
  5218. CArray<CStringArray, CStringArray>clientarray;
  5219. CArray<CStringArray, CStringArray>phonearray;
  5220. CArray<CStringArray, CStringArray>fgarray;
  5221. CArray<CStringArray, CStringArray>danweiarray;
  5222. CArray<CStringArray, CStringArray>jdarray;
  5223. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5224. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5225. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5226. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5227. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5228. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5229. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5230. CString m_taoxiname;
  5231. if (m_zs.Find("\\") != -1)
  5232. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  5233. else
  5234. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  5235. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5236. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5237. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5238. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5239. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5240. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5241. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5242. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5243. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5244. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5245. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5246. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5247. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5248. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5249. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5250. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5251. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5252. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5253. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5254. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5255. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5256. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5257. if (jdarray.GetSize())
  5258. {
  5259. if (m_bz.IsEmpty() == 0)
  5260. m_bz = "\r\n" + m_bz;
  5261. m_bz += "景点:";
  5262. }
  5263. #ifdef DDF_VERSION
  5264. m_bz += "219店:219路馨园小区对面\r\n";
  5265. m_bz += "金色店:万科金色家园小区东门南走20米荣光社区一楼\r\n";
  5266. m_bz += "万泰店:万泰锦绣华城小区正门\r\n";
  5267. #else
  5268. for (i = 0; i < jdarray.GetSize(); i++)
  5269. {
  5270. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5271. }
  5272. m_bz.TrimRight(";");
  5273. #endif
  5274. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5275. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5276. if (IsHasRights2new(31) == 0)
  5277. {
  5278. m_phone1 = "***";
  5279. m_phone2 = "***";
  5280. }
  5281. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5282. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5283. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  5284. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  5285. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  5286. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  5287. filter = "name='" + m_ren + "'";
  5288. g_sendhead.code[0] = 5;
  5289. g_sendhead.tabcount = 1;
  5290. g_sendhead.bsql = 0;
  5291. int g_nYearposTemp = g_nYearpos;
  5292. g_nYearpos = -1;
  5293. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5294. g_nYearpos = g_nYearposTemp;
  5295. if (g_bSendOK == 0)return;
  5296. DataToArray(&phonearray);
  5297. m_money1.Format("%f", atof(m_taoxijiage));
  5298. m_money2.Format("%f", atof(m_payed1));
  5299. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5300. ConvertToPrice(m_money1);
  5301. ConvertToPrice(m_money2);
  5302. ConvertToPrice(m_money3);
  5303. ////////////////////////////////////////////////////////////////
  5304. int rcpos = -1;
  5305. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  5306. StrRect.top -= 15; StrRect.bottom -= 15;
  5307. Image *pImg = NULL;
  5308. #ifdef MNLS_VERSION
  5309. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  5310. #else
  5311. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  5312. #endif
  5313. m_Print.DrawImage(pImg, StrRect);
  5314. delete pImg;
  5315. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5316. {
  5317. Image *pImg = NULL;
  5318. g_nSendCode = 31;
  5319. int g_nYearposTemp = g_nYearpos;
  5320. g_nYearpos = -1;
  5321. g_pMainWnd->ProcessChatMessageRequest2(1);
  5322. g_nYearpos = g_nYearposTemp;
  5323. g_nSendCode = 0;
  5324. if (g_bSendOK == 0)return;
  5325. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5326. if (pImg)
  5327. {
  5328. StrRect.left = 30;
  5329. StrRect.top = 12;
  5330. StrRect.right = StrRect.left + 60;
  5331. StrRect.bottom = StrRect.top + 60;
  5332. m_Print.DrawImage(pImg, StrRect);
  5333. delete pImg; pImg = NULL;
  5334. }
  5335. }
  5336. m_Print.SetFontFace(11, 1, "宋体");
  5337. StrRect = load.m_rcarray.ElementAt(20);
  5338. StrRect.right = load.m_rcarray.ElementAt(23).right;
  5339. StrRect.top -= 18; StrRect.bottom -= 18;
  5340. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  5341. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5342. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  5343. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5344. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5345. StrRect.top -= 15; StrRect.bottom -= 15;
  5346. #ifdef MNLS_VERSION
  5347. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5348. #endif
  5349. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5350. StrRect.top -= 15; StrRect.bottom -= 15;
  5351. #ifdef MNLS_VERSION
  5352. m_Print.DrawRect(StrRect);
  5353. #endif
  5354. m_Print.SetFontFace(7, 1, "黑体");
  5355. m_Print.SetColor(0xffffff);
  5356. #ifdef MNLS_VERSION
  5357. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5358. #endif
  5359. m_Print.SetColor(0);
  5360. m_Print.SetFontFace(15, 1, "宋体");
  5361. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5362. StrRect.top -= 15; StrRect.bottom -= 15;
  5363. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同预约订单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5364. CStringArray strarray;
  5365. strarray.Add("NO: " + strOrderNumber);
  5366. CString date;
  5367. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  5368. strarray.Add(date);
  5369. strarray.Add("喜爱");
  5370. strarray.Add("格调");
  5371. if (fgarray.GetSize() == 12)
  5372. {
  5373. for (int i = 0; i < 12; i++)
  5374. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  5375. }
  5376. else
  5377. {
  5378. strarray.Add("复古典雅");
  5379. strarray.Add("温文尔雅");
  5380. strarray.Add("豪华艳丽");
  5381. strarray.Add("传统大方");
  5382. strarray.Add("新潮个性");
  5383. strarray.Add("浪漫奔放");
  5384. strarray.Add("简单素雅");
  5385. strarray.Add("活泼俏丽");
  5386. strarray.Add("妩媚温馨");
  5387. strarray.Add("温柔贤惠");
  5388. strarray.Add("成熟感性");
  5389. strarray.Add("清纯可爱");
  5390. }
  5391. strarray.Add("姓名");
  5392. // strarray.Add("职业");
  5393. strarray.Add("");
  5394. strarray.Add("地址");
  5395. strarray.Add("电话");
  5396. #ifdef CHILD_VERSION
  5397. strarray.Add("家长");
  5398. strarray.Add("宝宝");
  5399. #else
  5400. strarray.Add("先生");
  5401. strarray.Add("女士");
  5402. #endif
  5403. m_Print.SetFontFace(11, 1, "宋体");
  5404. for (i = 0; i < strarray.GetSize(); i++)
  5405. {
  5406. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5407. if (i < 2)
  5408. {
  5409. StrRect.top -= 15; StrRect.bottom -= 15;
  5410. }
  5411. if (i>15)
  5412. m_Print.DrawRect2(StrRect, 1);
  5413. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5414. }
  5415. for (i = 29; i <= 40; i++)
  5416. {
  5417. if (m_style.GetLength() <= (i - 29))continue;
  5418. if (m_style.GetAt(i - 29) != '1')continue;
  5419. StrRect = load.m_rcarray.ElementAt(i - 1);
  5420. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5421. }
  5422. for (i = 27; i <= 48; i++)
  5423. {
  5424. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5425. m_Print.DrawRect2(StrRect, 1);
  5426. }
  5427. #ifdef CHILD_VERSION
  5428. StrRect = load.m_rcarray.ElementAt(45);
  5429. StrRect.right = StrRect.left + 62;
  5430. m_Print.DrawRect2(StrRect, 1);
  5431. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5432. StrRect.left = StrRect.right;
  5433. StrRect.right = StrRect.left + 62;
  5434. m_Print.DrawRect2(StrRect, 1);
  5435. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5436. StrRect.left = StrRect.right;
  5437. StrRect.right = StrRect.left + 62;
  5438. m_Print.DrawRect2(StrRect, 1);
  5439. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5440. StrRect.left = StrRect.right;
  5441. StrRect.right = StrRect.left + 62;
  5442. m_Print.DrawRect2(StrRect, 1);
  5443. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5444. #endif
  5445. /////////////////////////
  5446. strarray.RemoveAll();
  5447. CString temp;
  5448. temp.Format("拍摄多款选 %d 款,其中影", atoi(m_outside) + atoi(m_outside2));
  5449. strarray.Add(temp);
  5450. temp.Format("棚景 %d 款,景点 %d 款.", atoi(m_outside2), atoi(m_outside));
  5451. strarray.Add(temp);
  5452. strarray.Add("化妆");
  5453. strarray.Add("造型");
  5454. #ifdef CHILD_VERSION
  5455. strarray.Add("");
  5456. #else
  5457. strarray.Add("婚纱");
  5458. #endif
  5459. strarray.Add("服饰");
  5460. strarray.Add("配");
  5461. strarray.Add("置");
  5462. strarray.Add("其");
  5463. strarray.Add("它");
  5464. strarray.Add("套系名称");
  5465. strarray.Add("镜款");
  5466. strarray.Add("套系总价");
  5467. strarray.Add("主摄影师");
  5468. strarray.Add("拍摄日期");
  5469. strarray.Add("定金");
  5470. #ifdef CHILD_VERSION
  5471. strarray.Add("主引导师");
  5472. #else
  5473. strarray.Add("主化妆师");
  5474. #endif
  5475. strarray.Add("看样日期");
  5476. strarray.Add("欠款余额");
  5477. strarray.Add("总监");
  5478. strarray.Add("取件日期");
  5479. rcpos = -1;
  5480. for (i = 0; i < strarray.GetSize(); i++)
  5481. {
  5482. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5483. if (i>9)
  5484. m_Print.DrawRect2(StrRect, 1);
  5485. #ifdef CHILD_VERSION
  5486. if (i == 5)
  5487. StrRect.top -= StrRect.Height();
  5488. #endif
  5489. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5490. }
  5491. for (i = 22; i <= 41; i++)
  5492. {
  5493. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5494. m_Print.DrawRect2(StrRect, 1);
  5495. }
  5496. /////////////////////////////
  5497. strarray.RemoveAll();
  5498. #ifdef CHILD_VERSION
  5499. strarray.Add("顾客方 家长:");
  5500. strarray.Add("宝宝:");
  5501. #else
  5502. strarray.Add("顾客方 先生:");
  5503. strarray.Add("女士:");
  5504. #endif
  5505. strarray.Add("电话:");
  5506. strarray.Add("影楼方 店长:");
  5507. strarray.Add("接单人:");
  5508. strarray.Add("电话:");
  5509. rcpos = -1;
  5510. for (i = 0; i < strarray.GetSize(); i++)
  5511. {
  5512. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5513. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5514. }
  5515. for (i = 7; i <= 12; i++)
  5516. {
  5517. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5518. // if(i!=10)
  5519. m_Print.DrawRect2(StrRect, 2);
  5520. }
  5521. //////////////////////////////////////
  5522. //开始打数据
  5523. strarray.RemoveAll();
  5524. strarray.Add(m_name1);
  5525. strarray.Add(m_name2);
  5526. /// strarray.Add (m_occupation1);
  5527. // strarray.Add (m_occupation2);
  5528. strarray.Add("");
  5529. strarray.Add("");
  5530. strarray.Add(m_addr1);
  5531. #ifdef CHILD_VERSION
  5532. strarray.Add("");
  5533. #else
  5534. strarray.Add(m_addr2);
  5535. #endif
  5536. strarray.Add(m_phone1);
  5537. strarray.Add(m_phone2);
  5538. for (i = 41; i <= 48; i++)
  5539. {
  5540. StrRect = load.m_rcarray.ElementAt(i - 1);
  5541. StrRect.left += 4;
  5542. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5543. }
  5544. ///////////////////////////////
  5545. strarray.RemoveAll();
  5546. strarray.Add(m_money1);
  5547. strarray.Add(m_waiter1);
  5548. strarray.Add(m_time2);
  5549. strarray.Add(m_money2);
  5550. strarray.Add(m_waiter2);
  5551. strarray.Add(m_time4);
  5552. strarray.Add(m_money3);
  5553. strarray.Add("");
  5554. strarray.Add(m_time5);
  5555. for (i = 32; i <= 40; i++)
  5556. {
  5557. StrRect = load2.m_rcarray.ElementAt(i - 1);
  5558. StrRect.left += 4;
  5559. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5560. }
  5561. ///////////////////////////////
  5562. strarray.RemoveAll();
  5563. strarray.Add(m_name1);
  5564. strarray.Add(m_name2);
  5565. CString phone;
  5566. if (m_phone1.IsEmpty() == 0)
  5567. phone = m_phone1 + ",";
  5568. phone += m_phone2;
  5569. phone.TrimRight(",");
  5570. strarray.Add(phone);
  5571. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  5572. strarray.Add(m_ren);
  5573. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  5574. for (i = 7; i <= 12; i++)
  5575. {
  5576. StrRect = load3.m_rcarray.ElementAt(i - 1);
  5577. StrRect.left += 4;
  5578. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5579. }
  5580. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  5581. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5582. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  5583. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5584. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  5585. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5586. //////////////////////////////
  5587. //开始画文字
  5588. StrRect = load2.m_rcarray.ElementAt(30);
  5589. StrRect.left += 3;
  5590. StrRect.top += 3;
  5591. StrRect.right -= 2;
  5592. StrRect.bottom -= 2;
  5593. AutoDraw(m_Print, StrRect, m_bz, 1.4f);
  5594. StrRect = load2.m_rcarray.ElementAt(29);
  5595. StrRect.left += 3;
  5596. StrRect.top += 3;
  5597. StrRect.right -= 2;
  5598. StrRect.bottom -= 2;
  5599. str = "";
  5600. for (i = 0; i < sparray.GetSize(); i++)
  5601. {
  5602. str += sparray.ElementAt(i).ElementAt(5);
  5603. str += " 数量:";
  5604. str += sparray.ElementAt(i).ElementAt(3);
  5605. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5606. str += "\r\n";
  5607. }
  5608. str.TrimRight("\r\n");
  5609. AutoDraw(m_Print, StrRect, str, 1.4);
  5610. StrRect = load2.m_rcarray.ElementAt(40);
  5611. StrRect.top += 8;
  5612. m_Print.SetFontFace(12, 1, "黑体");
  5613. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5614. StrRect.left += 3;
  5615. StrRect.top += 30;
  5616. StrRect.right -= 2;
  5617. StrRect.bottom -= 2;
  5618. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5619. if (str.IsEmpty())
  5620. {
  5621. str = "\
  5622. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5623. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5624. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5625. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5626. 持良好的心境.\r\n\
  5627. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5628. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5629. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5630. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5631. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5632. 勿进影室, 以免影响拍摄.\r\n\
  5633. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5634. 师或店长沟通.\r\n\
  5635. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5636. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5637. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5638. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5639. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5640. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5641. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5642. 还.";
  5643. }
  5644. AutoDraw(m_Print, StrRect, str, 1.8);
  5645. }
  5646. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 1)
  5647. {//AfxMessageBox("yyy");
  5648. m_Print.StartPrint();
  5649. m_Print.StartPage();
  5650. LoadRect load;
  5651. load.SetLiaPath("6-2.lia");
  5652. load.SetMargins(0, 0);
  5653. if (!load.Load())return;
  5654. int i;
  5655. //////////////////////////////////////////////////////////////
  5656. CStringArray txarray;
  5657. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  5658. g_sendhead.code[0] = 11;
  5659. g_sendhead.code[1] = 52;
  5660. g_sendhead.code[2] = 50;
  5661. g_sendhead.code[3] = 150;
  5662. g_sendhead.code[4] = 77;
  5663. g_sendhead.code[5] = 4;
  5664. g_sendhead.tabcount = 6;
  5665. g_sendhead.bsql = 0;
  5666. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5667. CArray<CStringArray, CStringArray>sparray;
  5668. CArray<CStringArray, CStringArray>clientarray;
  5669. CArray<CStringArray, CStringArray>phonearray;
  5670. CArray<CStringArray, CStringArray>fgarray;
  5671. CArray<CStringArray, CStringArray>danweiarray;
  5672. CArray<CStringArray, CStringArray>jdarray;
  5673. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5674. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5675. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5676. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5677. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5678. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5679. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  5680. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5681. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5682. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5683. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5684. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5685. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5686. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5687. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5688. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5689. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5690. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5691. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5692. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5693. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5694. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5695. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5696. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5697. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5698. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5699. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5700. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5701. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5702. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5703. if (jdarray.GetSize())
  5704. {
  5705. if (m_bz.IsEmpty() == 0)
  5706. m_bz = "\r\n" + m_bz;
  5707. m_bz += "景点:";
  5708. }
  5709. for (i = 0; i < jdarray.GetSize(); i++)
  5710. {
  5711. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5712. }
  5713. m_bz.TrimRight(";");
  5714. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5715. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5716. if (IsHasRights2new(31) == 0)
  5717. {
  5718. m_phone1 = "***";
  5719. m_phone2 = "***";
  5720. }
  5721. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5722. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5723. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  5724. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  5725. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  5726. CString str;
  5727. filter = "name='" + m_ren + "'";
  5728. g_sendhead.code[0] = 5;
  5729. g_sendhead.tabcount = 1;
  5730. g_sendhead.bsql = 0;
  5731. int g_nYearposTemp = g_nYearpos;
  5732. g_nYearpos = -1;
  5733. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5734. g_nYearpos = g_nYearposTemp;
  5735. if (g_bSendOK == 0)return;
  5736. DataToArray(&phonearray);
  5737. m_money1.Format("%f", atof(m_taoxijiage));
  5738. m_money2.Format("%f", atof(m_payed1));
  5739. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5740. ConvertToPrice(m_money1);
  5741. ConvertToPrice(m_money2);
  5742. ConvertToPrice(m_money3);
  5743. ////////////////////////////////////////////////////////////////
  5744. int rcpos = -1;
  5745. CRect StrRect = load.m_rcarray.ElementAt(0);
  5746. m_Print.SetFontFace(25, 1, "黑体");
  5747. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "预约单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5748. m_Print.SetFontFace(11, 1, "宋体");
  5749. StrRect = load.m_rcarray.ElementAt(1);
  5750. if (m_time1.GetLength() == 10)
  5751. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  5752. else
  5753. str = "开单日期:";
  5754. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5755. StrRect = load.m_rcarray.ElementAt(2);
  5756. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + strOrderNumber), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5757. CStringArray strarray;
  5758. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5759. {
  5760. Image *pImg = NULL;
  5761. g_nSendCode = 31;
  5762. int g_nYearposTemp = g_nYearpos;
  5763. g_nYearpos = -1;
  5764. g_pMainWnd->ProcessChatMessageRequest2(1);
  5765. g_nYearpos = g_nYearposTemp;
  5766. g_nSendCode = 0;
  5767. if (g_bSendOK == 0)return;
  5768. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5769. if (pImg)
  5770. {
  5771. StrRect.left = 47;
  5772. StrRect.top = 12;
  5773. StrRect.right = StrRect.left + 60;
  5774. StrRect.bottom = StrRect.top + 60;
  5775. m_Print.DrawImage(pImg, StrRect);
  5776. delete pImg; pImg = NULL;
  5777. }
  5778. }
  5779. #ifdef CHILD_VERSION
  5780. strarray.Add("家长姓名");
  5781. strarray.Add("宝宝姓名");
  5782. #else
  5783. strarray.Add("先生姓名");
  5784. strarray.Add("女士姓名");
  5785. #endif
  5786. strarray.Add("服装套数");
  5787. // strarray.Add ("拍摄张数");
  5788. #ifdef CHILD_VERSION
  5789. strarray.Add("出生日期");
  5790. #else
  5791. strarray.Add("结婚日期");
  5792. #endif
  5793. strarray.Add("拍摄日期");
  5794. strarray.Add("联系电话");
  5795. strarray.Add("联系电话");
  5796. strarray.Add("造型套数");
  5797. if (m_zs.Find("\\") != -1)
  5798. strarray.Add("入底\\入册");
  5799. else
  5800. strarray.Add("入底张数");
  5801. strarray.Add("选片日期");
  5802. strarray.Add("QQ/邮箱");
  5803. strarray.Add("套系总额");
  5804. strarray.Add("定金");
  5805. strarray.Add("余款金额");
  5806. strarray.Add("取件日期");
  5807. strarray.Add(m_name1);
  5808. strarray.Add(m_name2);
  5809. strarray.Add(m_clothescount);
  5810. // str.Format("%d", atoi(m_zs)*3);
  5811. // strarray.Add (str);
  5812. #ifdef CHILD_VERSION
  5813. strarray.Add(m_birthday1);
  5814. #else
  5815. strarray.Add(m_time3);
  5816. #endif
  5817. strarray.Add(m_time2);
  5818. strarray.Add(m_phone1);
  5819. strarray.Add(m_phone2);
  5820. strarray.Add(m_clothescount2);
  5821. strarray.Add(m_zs);
  5822. strarray.Add(m_time4);
  5823. strarray.Add(m_qq1);
  5824. strarray.Add(m_money1);
  5825. strarray.Add(m_money2);
  5826. strarray.Add(m_money3);
  5827. strarray.Add(m_time5);
  5828. for (i = 4; i <= 33; i++)
  5829. {
  5830. StrRect = load.m_rcarray.ElementAt(i - 1);
  5831. m_Print.DrawRect2(StrRect, 1);
  5832. if (strarray.GetSize() > (i - 4))
  5833. {
  5834. if (i <= 18)
  5835. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5836. else
  5837. {
  5838. StrRect.left += 4;
  5839. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5840. }
  5841. }
  5842. }
  5843. int dt = 413;
  5844. StrRect = load.m_rcarray.ElementAt(36); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5845. m_Print.DrawText((LPTSTR)(LPCTSTR)"门市签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5846. StrRect = load.m_rcarray.ElementAt(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5847. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5848. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5849. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5850. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  5851. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5852. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  5853. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5854. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  5855. m_Print.DrawText((LPTSTR)(LPCTSTR)("网址:" + g_cominfoarray.ElementAt(0).ElementAt(13)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5856. //////////////////////////////
  5857. //开始画文字
  5858. StrRect = load.m_rcarray.ElementAt(7);
  5859. int hei = StrRect.Height();
  5860. StrRect.top += hei;
  5861. StrRect.bottom += hei;
  5862. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5863. StrRect.top += dt;
  5864. StrRect.bottom += dt;
  5865. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5866. StrRect = load.m_rcarray.ElementAt(17);
  5867. StrRect.top += hei;
  5868. StrRect.bottom += hei;
  5869. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5870. StrRect = load.m_rcarray.ElementAt(33);
  5871. StrRect.bottom = StrRect.top + dt; m_Print.DrawRect2(StrRect, 1);
  5872. StrRect.top += hei;
  5873. StrRect.left += 3;
  5874. StrRect.top += 3;
  5875. StrRect.right -= 2;
  5876. StrRect.bottom -= 2;
  5877. str = "";
  5878. for (i = 0; i < sparray.GetSize(); i++)
  5879. {
  5880. str += sparray.ElementAt(i).ElementAt(5);
  5881. str += " 数量:";
  5882. str += sparray.ElementAt(i).ElementAt(3);
  5883. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5884. str += "\r\n";
  5885. }
  5886. str.TrimRight("\r\n");
  5887. AutoDraw(m_Print, StrRect, str, 1.4);
  5888. StrRect = load.m_rcarray.ElementAt(33);
  5889. StrRect.top += dt;
  5890. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5891. StrRect.top += hei;
  5892. StrRect.left += 3;
  5893. StrRect.top += 3;
  5894. StrRect.right -= 2;
  5895. StrRect.bottom -= 2;
  5896. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  5897. StrRect = load.m_rcarray.ElementAt(34);
  5898. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5899. StrRect.top += hei;
  5900. StrRect.left += 3;
  5901. StrRect.top += 3;
  5902. StrRect.right -= 2;
  5903. StrRect.bottom -= 2;
  5904. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5905. if (str.IsEmpty())
  5906. {
  5907. str = "\
  5908. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5909. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5910. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5911. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5912. 持良好的心境.\r\n\
  5913. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5914. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5915. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5916. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5917. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5918. 勿进影室, 以免影响拍摄.\r\n\
  5919. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5920. 师或店长沟通.\r\n\
  5921. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5922. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5923. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5924. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5925. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5926. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5927. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5928. 还.";
  5929. }
  5930. AutoDraw(m_Print, StrRect, str, 1.8);
  5931. StrRect = load.m_rcarray.ElementAt(35);
  5932. StrRect.bottom += 100;
  5933. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  5934. 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∨";
  5935. // AutoDraw(m_Print, StrRect, str, 1.4);
  5936. }
  5937. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 2)
  5938. {
  5939. PrintDinDan5(strOrderNumber);
  5940. return;
  5941. }
  5942. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  5943. {
  5944. PrintDinDan6(strOrderNumber);
  5945. return;
  5946. }
  5947. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  5948. dlg.m_pDC = m_Print.GetPDC();
  5949. dlg.m_mode = 1;
  5950. if (aa == 0)
  5951. {
  5952. if (dlg.DoModal() != IDOK)
  5953. return;
  5954. printcot = dlg.m_num;
  5955. }
  5956. //结束打印
  5957. m_Print.EndPage();
  5958. m_Print.EndPrint();
  5959. }
  5960. }
  5961. void CovertDate2(CString date, CString &date2)
  5962. {
  5963. try
  5964. {
  5965. if (date == "2013-04-09")
  5966. {
  5967. date2 = "2013-02-29";
  5968. return;
  5969. }
  5970. ///////////////////////////////////
  5971. date2 = date;
  5972. GongToLong(date2);
  5973. ////////////////////////////////////
  5974. return;
  5975. CCalendarConvert m_CalendarConvert;
  5976. SYSTEMTIME src = { 0 };
  5977. SYSTEMTIME dst = { 0 };
  5978. COleDateTime m_timeLunar(atoi(date.Mid(0, 4)), atoi(date.Mid(5, 2)), atoi(date.Mid(8, 2)), 0, 0, 0);
  5979. COleDateTime m_timeGregorian;
  5980. m_timeLunar.GetAsSystemTime(src);
  5981. BOOL bEmbolism = 0;
  5982. if (m_CalendarConvert.Gregorian2Lunar(&src, &dst, &bEmbolism))
  5983. {
  5984. m_timeGregorian = m_CalendarConvert.ConvertSysTime2OleDateTime(&dst);
  5985. date2.Format("%04d-%02d-%02d", m_timeGregorian.GetYear(), m_timeGregorian.GetMonth(), m_timeGregorian.GetDay());
  5986. if (m_timeGregorian.GetYear() == -1)date2 = "2000-13-32";
  5987. }
  5988. else
  5989. {
  5990. date2.Empty();
  5991. }
  5992. }
  5993. catch (...)
  5994. {
  5995. }
  5996. }
  5997. void CMainFrame::PrintDinDan5(CString m_id)
  5998. {
  5999. int printcot = 1;
  6000. for (int aa = 0; aa < printcot; aa++)
  6001. {
  6002. PrintPreview dlg;
  6003. CPrintRX m_Print;
  6004. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6005. {
  6006. m_Print.InitToPrint(NULL, 1);
  6007. }
  6008. else
  6009. {
  6010. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  6011. if (name.IsEmpty())
  6012. m_Print.InitToPrint(NULL, 1);
  6013. else
  6014. {
  6015. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6016. if (nret == -1 && aa == 0)
  6017. {
  6018. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6019. }
  6020. }
  6021. }
  6022. {
  6023. m_Print.StartPrint();
  6024. m_Print.StartPage();
  6025. LoadRect load;
  6026. load.SetLiaPath("19.lia");
  6027. load.SetMargins(0, -20);
  6028. if (!load.Load())return;
  6029. int i;
  6030. //////////////////////////////////////////////////////////////
  6031. CStringArray txarray;
  6032. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  6033. g_sendhead.code[0] = 11;
  6034. g_sendhead.code[1] = 52;
  6035. g_sendhead.code[2] = 50;
  6036. g_sendhead.code[3] = 150;
  6037. g_sendhead.code[4] = 77;
  6038. g_sendhead.code[5] = 4;
  6039. g_sendhead.tabcount = 6;
  6040. g_sendhead.bsql = 0;
  6041. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  6042. CArray<CStringArray, CStringArray>sparray;
  6043. CArray<CStringArray, CStringArray>clientarray;
  6044. CArray<CStringArray, CStringArray>phonearray;
  6045. CArray<CStringArray, CStringArray>fgarray;
  6046. CArray<CStringArray, CStringArray>danweiarray;
  6047. CArray<CStringArray, CStringArray>jdarray;
  6048. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  6049. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  6050. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  6051. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  6052. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  6053. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  6054. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  6055. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  6056. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  6057. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  6058. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  6059. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  6060. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  6061. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  6062. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  6063. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  6064. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  6065. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  6066. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  6067. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  6068. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  6069. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  6070. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  6071. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  6072. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  6073. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  6074. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  6075. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  6076. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(36);
  6077. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  6078. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6079. CString m_txtype = g_List1array.ElementAt(0).ElementAt(52);
  6080. CString m_memberno = g_List1array.ElementAt(0).ElementAt(47);
  6081. CString str;
  6082. if (jdarray.GetSize())
  6083. {
  6084. if (m_bz.IsEmpty() == 0)
  6085. m_bz = "\r\n" + m_bz;
  6086. m_bz += "景点:";
  6087. }
  6088. for (i = 0; i < jdarray.GetSize(); i++)
  6089. {
  6090. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  6091. }
  6092. m_bz.TrimRight(";");
  6093. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  6094. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  6095. if (IsHasRights2new(31) == 0)
  6096. {
  6097. m_phone1 = "***";
  6098. m_phone2 = "***";
  6099. }
  6100. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  6101. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  6102. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  6103. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  6104. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  6105. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  6106. BOOL check1 = atoi(clientarray.ElementAt(0).ElementAt(15));
  6107. filter = "name='" + m_ren + "'";
  6108. g_sendhead.code[0] = 5;
  6109. g_sendhead.tabcount = 1;
  6110. g_sendhead.bsql = 0;
  6111. int g_nYearposTemp = g_nYearpos;
  6112. g_nYearpos = -1;
  6113. g_pMainWnd->ProcessChatMessageRequest2(filter);
  6114. g_nYearpos = g_nYearposTemp;
  6115. if (g_bSendOK == 0)return;
  6116. DataToArray(&phonearray);
  6117. m_money1.Format("%f", atof(m_taoxijiage));
  6118. m_money2.Format("%f", atof(m_payed1));
  6119. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  6120. ConvertToPrice(m_money1);
  6121. ConvertToPrice(m_money2);
  6122. ConvertToPrice(m_money3);
  6123. ////////////////////////////////////////////////////////////////
  6124. int rcpos = -1;
  6125. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6126. //Image *pImg=NULL;
  6127. // ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  6128. // m_Print.DrawImage(pImg, StrRect);
  6129. // delete pImg;
  6130. m_Print.SetFontFace(20, 1, "宋体");
  6131. StrRect = load.m_rcarray.ElementAt(1);
  6132. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "定单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6133. m_Print.SetFontFace(12, 1, "宋体");
  6134. StrRect = load.m_rcarray.ElementAt(2);
  6135. m_Print.DrawText((LPTSTR)(LPCTSTR)("NO." + m_id), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6136. StrRect = load.m_rcarray.ElementAt(3);
  6137. str.Format("%s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  6138. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6139. StrRect = load.m_rcarray.ElementAt(4);
  6140. m_Print.DrawText((LPTSTR)(LPCTSTR)("联系人:" + m_name1), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6141. CStringArray strarray;
  6142. strarray.Add("姓名");
  6143. strarray.Add("性别");
  6144. strarray.Add("年龄");
  6145. strarray.Add("出生年月");
  6146. strarray.Add("套系价格");
  6147. strarray.Add("定金");
  6148. strarray.Add("欠款");
  6149. strarray.Add("拍摄类型");
  6150. strarray.Add("会员卡号");
  6151. strarray.Add("定单人");
  6152. strarray.Add("入底\\入册");
  6153. strarray.Add("联系电话");
  6154. for (i = 6; i <= 17; i++)
  6155. {
  6156. StrRect = load.m_rcarray.ElementAt(i - 1);
  6157. m_Print.DrawRect2(StrRect, 1);
  6158. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 6), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6159. }
  6160. strarray.RemoveAll();
  6161. strarray.Add(m_name2);
  6162. strarray.Add(m_sex);
  6163. if (m_birthday.GetLength() != 10)
  6164. strarray.Add("");
  6165. else
  6166. {
  6167. int year = 0;
  6168. if (check1)
  6169. {
  6170. CString date2;
  6171. CovertDate2(g_date, date2);
  6172. year = atoi(date2.Left(4)) - atoi(m_birthday.Left(4));
  6173. if (date2.Right(5) >= m_birthday.Right(5))
  6174. year++;
  6175. }
  6176. else
  6177. {
  6178. year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  6179. if (g_date.Right(5) >= m_birthday.Right(5))
  6180. year++;
  6181. }
  6182. str.Format("%d", year);
  6183. strarray.Add(str);
  6184. }
  6185. strarray.Add(m_birthday);
  6186. strarray.Add(m_money1);
  6187. strarray.Add(m_money2);
  6188. strarray.Add(m_money3);
  6189. strarray.Add(m_txtype);
  6190. strarray.Add(m_memberno);
  6191. strarray.Add(m_ren);
  6192. strarray.Add(m_zs);
  6193. if (!m_phone1.IsEmpty())
  6194. strarray.Add(m_phone1);
  6195. else
  6196. strarray.Add(m_phone2);
  6197. for (i = 18; i <= 29; i++)
  6198. {
  6199. StrRect = load.m_rcarray.ElementAt(i - 1);
  6200. m_Print.DrawRect2(StrRect, 1);
  6201. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6202. }
  6203. strarray.RemoveAll();
  6204. strarray.Add("摄影师");
  6205. strarray.Add("拍照时间");
  6206. strarray.Add("选片人");
  6207. strarray.Add("选片时间");
  6208. strarray.Add("引导师");
  6209. strarray.Add("设计师");
  6210. strarray.Add("取件时间");
  6211. strarray.Add("顾客签字");
  6212. for (i = 34; i <= 41; i++)
  6213. {
  6214. StrRect = load.m_rcarray.ElementAt(i - 1);
  6215. m_Print.DrawRect2(StrRect, 1);
  6216. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 34), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6217. }
  6218. strarray.RemoveAll();
  6219. strarray.Add(m_waiter1);
  6220. strarray.Add(m_time2);
  6221. strarray.Add(m_waiter3);
  6222. strarray.Add(m_time4);
  6223. strarray.Add(m_waiter2);
  6224. strarray.Add(m_waiter4);
  6225. strarray.Add(m_time5);
  6226. strarray.Add("");
  6227. for (i = 42; i <= 49; i++)
  6228. {
  6229. StrRect = load.m_rcarray.ElementAt(i - 1);
  6230. m_Print.DrawRect2(StrRect, 1);
  6231. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6232. }
  6233. m_Print.SetFontFace(15, 1, "宋体");
  6234. StrRect = load.m_rcarray.ElementAt(29);
  6235. m_Print.DrawRect2(StrRect, 1);
  6236. StrRect.top += 45;
  6237. m_Print.DrawText((LPTSTR)(LPCTSTR)"拍", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6238. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6239. m_Print.DrawText((LPTSTR)(LPCTSTR)"内", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6240. m_Print.DrawText((LPTSTR)(LPCTSTR)"容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  6241. StrRect = load.m_rcarray.ElementAt(30);
  6242. m_Print.DrawRect2(StrRect, 1);
  6243. StrRect.top += 45;
  6244. m_Print.DrawText((LPTSTR)(LPCTSTR)"友", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6245. m_Print.DrawText((LPTSTR)(LPCTSTR)"情", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6246. m_Print.DrawText((LPTSTR)(LPCTSTR)"提", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6247. m_Print.DrawText((LPTSTR)(LPCTSTR)"示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  6248. m_Print.SetFontFace(10, 1, "宋体");
  6249. StrRect = load.m_rcarray.ElementAt(37); StrRect.top = StrRect.bottom + 2;
  6250. str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  6251. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  6252. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  6253. StrRect = load.m_rcarray.ElementAt(48); StrRect.top = StrRect.bottom + 2; StrRect.left -= 200;
  6254. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  6255. //开始画文字
  6256. StrRect = load.m_rcarray.ElementAt(31);
  6257. StrRect.left += 3;
  6258. StrRect.top += 3;
  6259. StrRect.right -= 2;
  6260. StrRect.bottom -= 2;
  6261. str = "";
  6262. for (i = 0; i < sparray.GetSize(); i++)
  6263. {
  6264. str += sparray.ElementAt(i).ElementAt(5);
  6265. str += " 数量:";
  6266. str += sparray.ElementAt(i).ElementAt(3);
  6267. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6268. str += "\r\n";
  6269. }
  6270. str.TrimRight("\r\n");
  6271. m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6272. m_bz.TrimLeft();
  6273. if (m_bz != "")
  6274. {
  6275. str += "\r\n"; str += "\r\n";
  6276. str += "备注:" + m_bz;
  6277. }
  6278. AutoDraw(m_Print, StrRect, str, 1.4);
  6279. StrRect = load.m_rcarray.ElementAt(32); m_Print.DrawRect2(StrRect, 1);
  6280. StrRect.left += 3;
  6281. StrRect.top += 3;
  6282. StrRect.right -= 2;
  6283. StrRect.bottom -= 2;
  6284. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6285. if (str.IsEmpty())
  6286. {
  6287. str = "\
  6288. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6289. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6290. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6291. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6292. 持良好的心境.\r\n\
  6293. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6294. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6295. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6296. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6297. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6298. 勿进影室, 以免影响拍摄.\r\n\
  6299. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6300. 师或店长沟通.\r\n\
  6301. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6302. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6303. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6304. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6305. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6306. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6307. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6308. 还.";
  6309. }
  6310. AutoDraw(m_Print, StrRect, str, 1.8);
  6311. }
  6312. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6313. dlg.m_pDC = m_Print.GetPDC();
  6314. dlg.m_mode = 1;
  6315. if (aa == 0)
  6316. {
  6317. if (dlg.DoModal() != IDOK)
  6318. return;
  6319. printcot = dlg.m_num;
  6320. }
  6321. //结束打印
  6322. m_Print.EndPage();
  6323. m_Print.EndPrint();
  6324. }
  6325. }
  6326. void CMainFrame::PrintDinDan4(CString m_id)
  6327. {
  6328. // TODO: Add your control notification handler code here
  6329. CPrintRX m_Print;
  6330. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6331. {
  6332. m_Print.InitToPrint(NULL, 1);
  6333. }
  6334. else
  6335. {
  6336. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  6337. if (name.IsEmpty())
  6338. m_Print.InitToPrint(NULL, 1);
  6339. else
  6340. {
  6341. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6342. if (nret == -1)
  6343. {
  6344. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6345. }
  6346. }
  6347. }
  6348. m_Print.StartPrint();
  6349. m_Print.StartPage();
  6350. LoadRect load;
  6351. load.SetLiaPath("6-2.lia");
  6352. load.SetMargins(0, 0);
  6353. if (!load.Load())return;
  6354. int i;
  6355. //////////////////////////////////////////////////////////////
  6356. CStringArray txarray;
  6357. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  6358. g_sendhead.code[0] = 11;
  6359. g_sendhead.code[1] = 52;
  6360. g_sendhead.code[2] = 50;
  6361. g_sendhead.code[3] = 150;
  6362. g_sendhead.code[4] = 77;
  6363. g_sendhead.code[5] = 4;
  6364. g_sendhead.tabcount = 6;
  6365. g_sendhead.bsql = 0;
  6366. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  6367. CArray<CStringArray, CStringArray>sparray;
  6368. CArray<CStringArray, CStringArray>clientarray;
  6369. CArray<CStringArray, CStringArray>phonearray;
  6370. CArray<CStringArray, CStringArray>fgarray;
  6371. CArray<CStringArray, CStringArray>danweiarray;
  6372. CArray<CStringArray, CStringArray>jdarray;
  6373. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  6374. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  6375. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  6376. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  6377. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  6378. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  6379. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  6380. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  6381. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  6382. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  6383. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  6384. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  6385. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  6386. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  6387. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  6388. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  6389. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  6390. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  6391. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  6392. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  6393. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  6394. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  6395. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  6396. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  6397. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  6398. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  6399. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  6400. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  6401. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  6402. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6403. if (jdarray.GetSize())
  6404. {
  6405. if (m_bz.IsEmpty() == 0)
  6406. m_bz = "\r\n" + m_bz;
  6407. m_bz += "景点:";
  6408. }
  6409. for (i = 0; i < jdarray.GetSize(); i++)
  6410. {
  6411. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  6412. }
  6413. m_bz.TrimRight(";");
  6414. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  6415. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  6416. if (IsHasRights2new(31) == 0)
  6417. {
  6418. m_phone1 = "***";
  6419. m_phone2 = "***";
  6420. }
  6421. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  6422. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  6423. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  6424. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  6425. CString str;
  6426. filter = "name='" + m_ren + "'";
  6427. g_sendhead.code[0] = 5;
  6428. g_sendhead.tabcount = 1;
  6429. g_sendhead.bsql = 0;
  6430. int g_nYearposTemp = g_nYearpos;
  6431. g_nYearpos = -1;
  6432. g_pMainWnd->ProcessChatMessageRequest2(filter);
  6433. g_nYearpos = g_nYearposTemp;
  6434. if (g_bSendOK == 0)return;
  6435. DataToArray(&phonearray);
  6436. m_money1.Format("%f", atof(m_taoxijiage));
  6437. m_money2.Format("%f", atof(m_payed1));
  6438. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  6439. ConvertToPrice(m_money1);
  6440. ConvertToPrice(m_money2);
  6441. ConvertToPrice(m_money3);
  6442. ////////////////////////////////////////////////////////////////
  6443. int rcpos = -1;
  6444. CRect StrRect = load.m_rcarray.ElementAt(0);
  6445. m_Print.SetFontFace(25, 1, "黑体");
  6446. m_Print.DrawText((LPTSTR)(LPCTSTR)"巴黎春天婚纱摄影预约单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6447. m_Print.SetFontFace(11, 1, "宋体");
  6448. StrRect = load.m_rcarray.ElementAt(1);
  6449. if (m_time1.GetLength() == 10)
  6450. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  6451. else
  6452. str = "开单日期:";
  6453. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6454. StrRect = load.m_rcarray.ElementAt(2);
  6455. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + m_id), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6456. CStringArray strarray;
  6457. strarray.Add("先生姓名");
  6458. strarray.Add("女士姓名");
  6459. strarray.Add("服装套数");
  6460. strarray.Add("拍摄张数");
  6461. strarray.Add("拍摄日期");
  6462. strarray.Add("联系电话");
  6463. strarray.Add("联系电话");
  6464. strarray.Add("造型套数");
  6465. strarray.Add("入册张数");
  6466. strarray.Add("选片日期");
  6467. strarray.Add("QQ/邮箱");
  6468. strarray.Add("套系总额");
  6469. strarray.Add("定金");
  6470. strarray.Add("余款金额");
  6471. strarray.Add("取件日期");
  6472. strarray.Add(m_name1);
  6473. strarray.Add(m_name2);
  6474. strarray.Add(m_clothescount);
  6475. str.Format("%d", atoi(m_zs) * 3);
  6476. strarray.Add(str);
  6477. strarray.Add(m_time2);
  6478. strarray.Add(m_phone1);
  6479. strarray.Add(m_phone2);
  6480. strarray.Add(m_clothescount2);
  6481. strarray.Add(m_zs);
  6482. strarray.Add(m_time4);
  6483. strarray.Add(m_qq1);
  6484. strarray.Add(m_money1);
  6485. strarray.Add(m_money2);
  6486. strarray.Add(m_money3);
  6487. strarray.Add(m_time5);
  6488. for (i = 4; i <= 33; i++)
  6489. {
  6490. StrRect = load.m_rcarray.ElementAt(i - 1);
  6491. m_Print.DrawRect2(StrRect, 1);
  6492. if (strarray.GetSize() > (i - 4))
  6493. {
  6494. if (i <= 18)
  6495. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6496. else
  6497. {
  6498. StrRect.left += 4;
  6499. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6500. }
  6501. }
  6502. }
  6503. int dt = 413;
  6504. StrRect = load.m_rcarray.ElementAt(36); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6505. m_Print.DrawText((LPTSTR)(LPCTSTR)"门市签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6506. StrRect = load.m_rcarray.ElementAt(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6507. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6508. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6509. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6510. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  6511. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址:深圳市红岭中路中深国际大厦首层,二十二层", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6512. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  6513. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:0755-61308198 61308199 25860696 25860697", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6514. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  6515. m_Print.DrawText((LPTSTR)(LPCTSTR)"网址:www.paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6516. StrRect = load.m_rcarray.ElementAt(43); StrRect.top += dt; StrRect.bottom += dt;
  6517. m_Print.DrawText((LPTSTR)(LPCTSTR)"邮箱:blct@paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6518. //////////////////////////////
  6519. //开始画文字
  6520. StrRect = load.m_rcarray.ElementAt(7);
  6521. int hei = StrRect.Height();
  6522. StrRect.top += hei;
  6523. StrRect.bottom += hei;
  6524. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6525. StrRect.top += dt;
  6526. StrRect.bottom += dt;
  6527. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6528. StrRect = load.m_rcarray.ElementAt(17);
  6529. StrRect.top += hei;
  6530. StrRect.bottom += hei;
  6531. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6532. StrRect = load.m_rcarray.ElementAt(33);
  6533. StrRect.bottom = StrRect.top + dt; m_Print.DrawRect2(StrRect, 1);
  6534. StrRect.top += hei;
  6535. StrRect.left += 3;
  6536. StrRect.top += 3;
  6537. StrRect.right -= 2;
  6538. StrRect.bottom -= 2;
  6539. str = "";
  6540. for (i = 0; i < sparray.GetSize(); i++)
  6541. {
  6542. str += sparray.ElementAt(i).ElementAt(5);
  6543. str += " 数量:";
  6544. str += sparray.ElementAt(i).ElementAt(3);
  6545. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6546. str += "\r\n";
  6547. }
  6548. str.TrimRight("\r\n");
  6549. AutoDraw(m_Print, StrRect, str, 1.4);
  6550. StrRect = load.m_rcarray.ElementAt(33);
  6551. StrRect.top += dt;
  6552. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6553. StrRect.top += hei;
  6554. StrRect.left += 3;
  6555. StrRect.top += 3;
  6556. StrRect.right -= 2;
  6557. StrRect.bottom -= 2;
  6558. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  6559. StrRect = load.m_rcarray.ElementAt(34);
  6560. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6561. StrRect.top += hei;
  6562. StrRect.left += 3;
  6563. StrRect.top += 3;
  6564. StrRect.right -= 2;
  6565. StrRect.bottom -= 2;
  6566. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6567. if (str.IsEmpty())
  6568. {
  6569. str = "\
  6570. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6571. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6572. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6573. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6574. 持良好的心境.\r\n\
  6575. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6576. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6577. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6578. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6579. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6580. 勿进影室, 以免影响拍摄.\r\n\
  6581. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6582. 师或店长沟通.\r\n\
  6583. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6584. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6585. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6586. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6587. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6588. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6589. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6590. 还.";
  6591. }
  6592. AutoDraw(m_Print, StrRect, str, 1.8);
  6593. StrRect = load.m_rcarray.ElementAt(35);
  6594. StrRect.bottom += 100;
  6595. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  6596. 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∨";
  6597. AutoDraw(m_Print, StrRect, str, 1.4);
  6598. PrintPreview dlg;
  6599. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6600. dlg.m_pDC = m_Print.GetPDC();
  6601. if (dlg.DoModal() != IDOK)return;
  6602. //结束打印
  6603. m_Print.EndPage();
  6604. m_Print.EndPrint();
  6605. }
  6606. int CalHeight_01(CRect &rc, CStringArray *saContent, CPrintRX *Print, int FORMAT)
  6607. {
  6608. CSize size;
  6609. int nMaxheight = 0;
  6610. CString strTemp;
  6611. CString strContent;
  6612. int nSize = saContent->GetSize();
  6613. int nRow = 0; // 行数;
  6614. for (int i = 0; i < nSize; i++)
  6615. {
  6616. strTemp = "";
  6617. strContent = saContent->ElementAt(i);
  6618. while (FALSE == strContent.IsEmpty())
  6619. {
  6620. strContent = strContent.Mid(strTemp.GetLength());
  6621. if (strContent.IsEmpty())
  6622. break;
  6623. Print->GetStrSize((LPTSTR)(LPCTSTR)strContent, size);
  6624. if (size.cx <= rc.Width())
  6625. {
  6626. CRect rc2 = rc;
  6627. rc2.top += nRow*(size.cy + 1);
  6628. rc2.bottom = rc2.top + (size.cy + 1);
  6629. Print->DrawText((LPTSTR)(LPCTSTR)strContent, rc2, 0, 0, FORMAT | FORMAT_UP);
  6630. nMaxheight = max(nMaxheight, rc2.bottom);
  6631. nRow++;
  6632. break;
  6633. }
  6634. int right = 0;
  6635. while (size.cx > rc.Width())
  6636. {
  6637. right++;
  6638. strTemp = strContent.Left(strContent.GetLength() - (right));
  6639. if (GIsHalfHZ(strTemp))
  6640. {
  6641. right++;
  6642. strTemp.Delete(strTemp.GetLength() - 1);
  6643. }
  6644. Print->GetStrSize((LPTSTR)(LPCTSTR)strTemp, size);
  6645. }
  6646. CRect rc2 = rc;
  6647. rc2.top += nRow*(size.cy + 1);
  6648. rc2.bottom = rc2.top + (size.cy + 1);
  6649. Print->DrawText((LPTSTR)(LPCTSTR)strTemp, rc2, 0, 0, FORMAT | FORMAT_UP); //printf("Jeff:str=%s\n\n",str);// Jeff Printf;
  6650. nRow++;
  6651. nMaxheight = max(nMaxheight, rc2.bottom);
  6652. }
  6653. }
  6654. return (nMaxheight == 0) ? (rc.bottom + 1) : (nMaxheight + 1);
  6655. }
  6656. /************************************************************************/
  6657. /*
  6658. 多字节字符编码下的CaleHeight函数;
  6659. 函数:CaleHeight
  6660. 描述:计算出一行高度可变,宽度特定的表格(CArray<CRect,CRect>),在输入指定内容时(CStringArray),表格高度变化最大的值。
  6661. 参数:
  6662. aRowRect: 一行表格,CArray::GetSize()表示表格列数;
  6663. aRowStr: 与表格对应的一行字符,CStringArray::GetSize()大小与CArray::GetSize()一致。
  6664. pPrinter: 打印机实例指针;
  6665. nFormat: 字符串的显示格式。
  6666. 返回:返回最大的表格高度;
  6667. 注意:只能多字节下使用,因为函数GIsHalfHZ。
  6668. */
  6669. /************************************************************************/
  6670. INT CalcHeight( IN CArray<CRect, CRect> &aRowRect, IN CStringArray &aRowStr, IN CPrintRX *pPrinter, IN CONST INT& nFormat)
  6671. {
  6672. // 参数有效性;
  6673. if( aRowRect.GetSize() != aRowStr.GetSize() )
  6674. {
  6675. OutputDebugString(_T("表格列数与字符列数不等!\n"));
  6676. return -1;
  6677. }
  6678. if( pPrinter == NULL )
  6679. {
  6680. OutputDebugString(_T("打印机句柄指针无效\n"));
  6681. return -1;
  6682. }
  6683. // 表格字串长度;
  6684. CSize size;
  6685. // 当前表格字体高度;
  6686. INT nGridFontHeight = 0;
  6687. // 当前表格区域;
  6688. CRect curGrid;
  6689. // 当前表格字符串;
  6690. CString strGridContent;
  6691. // 最大值高底;
  6692. INT nMaxHeigth = 0;
  6693. // 当前换行数;
  6694. INT nWrapRows = 0;
  6695. // 当前换行字串;
  6696. CString strWrapRow = _T("");
  6697. // 表格列数;
  6698. INT nColumns = aRowRect.GetSize();
  6699. // 临时表格;
  6700. CRect rcGrid;
  6701. // 循环计算每个表格的高度;
  6702. for( INT i = 0; i < nColumns; i++ )
  6703. {
  6704. nWrapRows = 0;
  6705. strWrapRow.Empty();
  6706. curGrid = aRowRect.ElementAt(i);
  6707. strGridContent = aRowStr.ElementAt(i);
  6708. nMaxHeigth = max(nMaxHeigth, curGrid.bottom);
  6709. while( !strGridContent.IsEmpty() )
  6710. {
  6711. strGridContent = strGridContent.Right(strGridContent.GetLength() - strWrapRow.GetLength());
  6712. if ( strGridContent.IsEmpty() )
  6713. {
  6714. OutputDebugString(_T("表格字符已空\n"));
  6715. break;
  6716. }
  6717. pPrinter->GetStrSize((LPTSTR)(LPCTSTR)strGridContent, size);
  6718. nGridFontHeight = size.cy + 1;
  6719. // 字串长度 <= 表格宽度;
  6720. if( size.cx <= curGrid.Width() )
  6721. {
  6722. rcGrid = curGrid;
  6723. rcGrid.top += nWrapRows*nGridFontHeight;
  6724. rcGrid.bottom = rcGrid.top + nGridFontHeight;
  6725. nMaxHeigth = max(nMaxHeigth, rcGrid.bottom);
  6726. pPrinter->DrawText((LPTSTR)(LPCTSTR)strGridContent, rcGrid, 0, 0, nFormat|FORMAT_UP);
  6727. break;
  6728. }
  6729. else
  6730. {// 字串长度 >= 表格宽度;
  6731. INT nRight = 0; // 字串右位置;
  6732. // 从右边开始逐个字符取出,直到左边字串小于表格宽度;
  6733. while( size.cx > curGrid.Width() )
  6734. {
  6735. nRight++;
  6736. strWrapRow = strGridContent.Left(strGridContent.GetLength() - nRight);
  6737. if( GIsHalfHZ(strWrapRow) )
  6738. {// 判断字串最后一个字符是否是汉字;
  6739. nRight++;
  6740. strWrapRow.Delete(strWrapRow.GetLength() - 1);
  6741. }
  6742. pPrinter->GetStrSize((LPTSTR)(LPCTSTR)strWrapRow, size);
  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)strWrapRow, rcGrid, 0, 0, nFormat|FORMAT_UP);
  6749. // 换行加+1;
  6750. nWrapRows++;
  6751. }
  6752. }
  6753. }
  6754. return nMaxHeigth + 1;
  6755. }
  6756. void CMainFrame::PrintReceipt(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  6757. {
  6758. //AfxMessageBox("abce");
  6759. int i = 0;
  6760. int printcot = 1;
  6761. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  6762. {
  6763. g_sendhead.bsql = 0;
  6764. g_sendhead.code[0] = 24;
  6765. g_sendhead.tabcount = 1;
  6766. int g_nYearposTemp = g_nYearpos;
  6767. g_nYearpos = -1;
  6768. g_pMainWnd->ProcessChatMessageRequest2(1);
  6769. g_nYearpos = g_nYearposTemp;
  6770. if (0 == g_bSendOK)return;
  6771. DataToArray(&g_cominfoarray);
  6772. CString SerialNo;
  6773. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6774. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  6775. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6776. CString sql;
  6777. sql.Format("update version set [serialno]='%s'", SerialNo);
  6778. g_sendhead.bsql=1;
  6779. g_nYearposTemp=g_nYearpos;
  6780. g_nYearpos=-1;
  6781. g_pMainWnd->ProcessChatMessageRequest2(sql);
  6782. g_nYearpos=g_nYearposTemp;
  6783. #endif
  6784. // 1.创建打印对象
  6785. CPrintRX m_Print;
  6786. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6787. {
  6788. m_Print.InitToPrint(NULL, 1);
  6789. }
  6790. else
  6791. {
  6792. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  6793. if (name.IsEmpty())
  6794. m_Print.InitToPrint(NULL, 1);
  6795. else
  6796. {
  6797. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6798. if (nret == -1 && aa == 0)
  6799. {
  6800. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6801. }
  6802. }
  6803. }
  6804. // 2.开始打印
  6805. m_Print.StartPrint();
  6806. m_Print.StartPage();
  6807. LoadRect load;
  6808. BOOL bSmall = 0;
  6809. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  6810. {
  6811. bSmall = 1;
  6812. load.SetLiaPath("20.lia");
  6813. }
  6814. else
  6815. load.SetLiaPath("10.lia");
  6816. if (bSmall)
  6817. load.SetMargins(0, 0);
  6818. else
  6819. load.SetMargins(10, 0);
  6820. if (!load.Load())return;
  6821. int rcpos = -1;
  6822. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6823. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  6824. {
  6825. Image *pImg = NULL;
  6826. g_nSendCode = 31;
  6827. int g_nYearposTemp = g_nYearpos;
  6828. g_nYearpos = -1;
  6829. g_pMainWnd->ProcessChatMessageRequest2(1);
  6830. g_nYearpos = g_nYearposTemp;
  6831. g_nSendCode = 0;
  6832. if (g_bSendOK == 0)return;
  6833. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  6834. if (pImg)
  6835. {
  6836. StrRect.left = 65;
  6837. if (bSmall) StrRect.left = 55;
  6838. StrRect.top = 10;
  6839. StrRect.right = StrRect.left + 58;
  6840. StrRect.bottom = StrRect.top + 58;
  6841. // 3.打印2维码图像;
  6842. m_Print.DrawImage(pImg, StrRect);
  6843. delete pImg;
  6844. pImg = NULL;
  6845. }
  6846. }
  6847. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  6848. if (bSmall)
  6849. {
  6850. m_Print.SetFontFace(18, 1, "黑体");
  6851. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6852. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6853. m_Print.SetFontFace(9, 1, "宋体");
  6854. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6855. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6856. m_Print.SetFontFace(6, 1, "宋体");
  6857. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6858. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6859. m_Print.SetFontFace(9, 1, "宋体");
  6860. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6861. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6862. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6863. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6864. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6865. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6866. int hei = StrRect.Height();
  6867. StrRect.bottom = StrRect.top;
  6868. StrRect.top -= 8;
  6869. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6870. m_Print.SetFontFace(11, 1, "宋体");
  6871. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6872. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6873. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6874. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6875. m_Print.SetFontFace(8, 1, "宋体");
  6876. for (i = 7; i < 24; i++)
  6877. {
  6878. StrRect = load.m_rcarray.ElementAt(i);
  6879. m_Print.DrawRect2(StrRect, 1);
  6880. }
  6881. for (i = 9; i < 24; i++)
  6882. {
  6883. StrRect = load.m_rcarray.ElementAt(i);
  6884. StrRect.left += 2;
  6885. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6886. }
  6887. m_Print.SetFontFace(6, 1, "宋体");
  6888. for (i = 24; i < 26; i++)
  6889. {
  6890. StrRect = load.m_rcarray.ElementAt(i);
  6891. StrRect.left += 2;
  6892. if (i == 24)
  6893. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6894. else
  6895. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6896. }
  6897. // StrRect=load.m_rcarray .ElementAt (27);
  6898. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  6899. }
  6900. else//大单
  6901. {
  6902. // 1.打印表头(蒙娜丽莎收款单)
  6903. m_Print.SetFontFace(20, 1, "黑体");
  6904. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6905. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6906. m_Print.SetFontFace(11, 1, "宋体");
  6907. // 2.打印订单号(NO.20140608-001)
  6908. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6909. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6910. // 3.打印SerialNo(SerialNo.01062)
  6911. int hei = StrRect.Height();
  6912. StrRect.bottom = StrRect.top;
  6913. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6914. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6915. // 4.打印影楼地址信息、电话;
  6916. m_Print.SetFontFace(8, 1, "宋体");
  6917. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6918. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6919. m_Print.SetFontFace(11, 1, "宋体");
  6920. // 5.打印客户姓名
  6921. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6922. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6923. // 6.打印客户联系电话
  6924. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6925. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6926. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6927. // 7.打印开单日期
  6928. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6929. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6930. // 8.打印列字段:收款项目
  6931. m_Print.SetFontFace(13, 1, "宋体");
  6932. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6933. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6934. //printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6935. // 9.打印列字段:金额
  6936. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6937. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6938. //printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6939. // 10.打印列字段:开单人
  6940. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6941. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6942. //printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6943. // 11.画表格-画3列;
  6944. m_Print.SetFontFace(11, 1, "宋体");
  6945. for (i = 7; i < 10; i++)
  6946. {
  6947. StrRect = load.m_rcarray.ElementAt(i);
  6948. m_Print.DrawRect2(StrRect, 1);
  6949. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6950. }
  6951. // 12.打印详细内容
  6952. int dty = 0;
  6953. int dtytemp = 0;
  6954. // for( i=10; i<14; i+=3)
  6955. for (i = 10; i<22; i += 3) // 循环4次,再画
  6956. {
  6957. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  6958. CArray<CRect, CRect>rcarray;
  6959. CStringArray strarray2;
  6960. StrRect = load.m_rcarray.ElementAt(i);
  6961. StrRect.top += dty;
  6962. StrRect.bottom += dty;
  6963. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  6964. {
  6965. StrRect = load.m_rcarray.ElementAt(i - 1);
  6966. StrRect.top += dty;
  6967. StrRect.bottom += dty;
  6968. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  6969. break;
  6970. }
  6971. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  6972. StrRect.left += 2;
  6973. StrRect.right -= 2;
  6974. StrRect.top += 4;
  6975. rcarray.Add(StrRect);
  6976. strarray2.Add(pArray->ElementAt(i));
  6977. // 指定格子宽度,计算字符串占几行(高度).
  6978. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  6979. dtytemp = bottom - StrRect.bottom;
  6980. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  6981. // 重新获取表格大小,并画出表格;
  6982. StrRect = load.m_rcarray.ElementAt(i);
  6983. StrRect.bottom += dtytemp;
  6984. StrRect.top += dty;
  6985. StrRect.bottom += dty;
  6986. m_Print.DrawRect2(StrRect, 1);
  6987. // 获取下一表格大小,并画出表格;
  6988. StrRect = load.m_rcarray.ElementAt(i + 1);
  6989. StrRect.top += dty;
  6990. StrRect.bottom += dty;
  6991. StrRect.bottom += dtytemp;
  6992. m_Print.DrawRect2(StrRect, 1);
  6993. StrRect.left += 2;
  6994. // 打印出金额字段内容
  6995. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6996. //printf("Jeff:%d:%s\n\n",i+1,pArray->ElementAt(i+1));//Jeff Printf;
  6997. StrRect = load.m_rcarray.ElementAt(i + 2);
  6998. StrRect.top += dty;
  6999. StrRect.bottom += dty;
  7000. StrRect.bottom += dtytemp;
  7001. m_Print.DrawRect2(StrRect, 1);
  7002. StrRect.left += 2;
  7003. // 打印开单人字段内容
  7004. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7005. //printf("Jeff:%d:%s\n\n",i+2,pArray->ElementAt(i+2));//Jeff Printf;
  7006. dty += dtytemp;
  7007. }
  7008. //.打印->付款情况 应付 实付 欠款.
  7009. i = 22;
  7010. StrRect = load.m_rcarray.ElementAt(i);
  7011. StrRect.top += dty;
  7012. StrRect.bottom += dty;
  7013. m_Print.DrawRect2(StrRect, 1);
  7014. StrRect.left += 2;
  7015. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7016. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7017. //.打印->合计人民币(大写):.......
  7018. i = 23;
  7019. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  7020. m_Print.DrawRect2(StrRect, 1);
  7021. StrRect.left += 2;
  7022. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7023. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7024. m_Print.SetFontFace(7, 1, "宋体");
  7025. for (i = 24; i < 27; i++)
  7026. {
  7027. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  7028. StrRect.left += 2;
  7029. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7030. }
  7031. StrRect = load.m_rcarray.ElementAt(24); StrRect.top += dty; StrRect.bottom += dty;
  7032. hei = StrRect.Height();
  7033. StrRect.top += hei;
  7034. StrRect.bottom += hei;
  7035. StrRect.right += 100;
  7036. StrRect.left += 2;
  7037. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  7038. AutoDraw(m_Print, StrRect, pArray->ElementAt(27), 1.0);
  7039. }
  7040. PrintPreview dlg;
  7041. dlg.m_mode = 3;
  7042. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  7043. dlg.m_pDC = m_Print.GetPDC();
  7044. if (aa == 0)
  7045. {
  7046. if (dlg.DoModal() != IDOK)
  7047. return;
  7048. printcot = dlg.m_num;
  7049. }
  7050. //结束打印
  7051. m_Print.EndPage();
  7052. m_Print.EndPrint();
  7053. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7054. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7055. CString sql;
  7056. sql.Format("update version set [serialno]='%s'", SerialNo);
  7057. g_sendhead.bsql = 1;
  7058. g_nYearposTemp = g_nYearpos;
  7059. g_nYearpos = -1;
  7060. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7061. g_nYearpos = g_nYearposTemp;
  7062. #endif
  7063. }
  7064. }
  7065. /************************************************************************/
  7066. /*
  7067. 函数:PrintRechargeRecord
  7068. 描述:打印会员卡充值记录;
  7069. 参数:
  7070. pArryRechargeRecod[IN]:要打印的数据;
  7071. 返回:
  7072. 注意:
  7073. 示例:
  7074. */
  7075. /************************************************************************/
  7076. void CMainFrame::PrintRechargeRecord(CStringArray *pArryRechargeRecod)
  7077. {
  7078. }
  7079. void CMainFrame::PrintReceipt_01(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  7080. {
  7081. //AfxMessageBox("abce");
  7082. int i = 0;
  7083. int printcot = 1;
  7084. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  7085. {
  7086. g_sendhead.bsql = 0;
  7087. g_sendhead.code[0] = 24;
  7088. g_sendhead.tabcount = 1;
  7089. int g_nYearposTemp = g_nYearpos;
  7090. g_nYearpos = -1;
  7091. g_pMainWnd->ProcessChatMessageRequest2(1);
  7092. g_nYearpos = g_nYearposTemp;
  7093. if (0 == g_bSendOK)return;
  7094. DataToArray(&g_cominfoarray);
  7095. CString SerialNo;
  7096. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7097. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7098. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7099. CString sql;
  7100. sql.Format("update version set [serialno]='%s'", SerialNo);
  7101. g_sendhead.bsql=1;
  7102. g_nYearposTemp=g_nYearpos;
  7103. g_nYearpos=-1;
  7104. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7105. g_nYearpos=g_nYearposTemp;
  7106. #endif
  7107. // 1.创建打印对象
  7108. CPrintRX m_Print;
  7109. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7110. {
  7111. m_Print.InitToPrint(NULL, 1);
  7112. }
  7113. else
  7114. {
  7115. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  7116. if (name.IsEmpty())
  7117. m_Print.InitToPrint(NULL, 1);
  7118. else
  7119. {
  7120. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  7121. if (nret == -1 && aa == 0)
  7122. {
  7123. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  7124. m_Print.InitToPrint(NULL, 1);
  7125. }
  7126. }
  7127. }
  7128. // 2.开始打印
  7129. m_Print.StartPrint();
  7130. m_Print.StartPage();
  7131. LoadRect load;
  7132. BOOL bSmall = 0;
  7133. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  7134. {
  7135. bSmall = 1;
  7136. load.SetLiaPath("20.lia");
  7137. }
  7138. else
  7139. load.SetLiaPath("10.lia");
  7140. if (bSmall)
  7141. load.SetMargins(0, 0);
  7142. else
  7143. load.SetMargins(10, 0);
  7144. if (!load.Load())return;
  7145. int rcpos = -1;
  7146. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7147. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  7148. {
  7149. Image *pImg = NULL;
  7150. g_nSendCode = 31;
  7151. int g_nYearposTemp = g_nYearpos;
  7152. g_nYearpos = -1;
  7153. g_pMainWnd->ProcessChatMessageRequest2(1);
  7154. g_nYearpos = g_nYearposTemp;
  7155. g_nSendCode = 0;
  7156. if (g_bSendOK == 0)return;
  7157. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7158. if (pImg)
  7159. {
  7160. StrRect.left = 65;
  7161. if (bSmall) StrRect.left = 55;
  7162. StrRect.top = 10;
  7163. StrRect.right = StrRect.left + 58;
  7164. StrRect.bottom = StrRect.top + 58;
  7165. // 3.打印2维码图像;
  7166. m_Print.DrawImage(pImg, StrRect);
  7167. delete pImg;
  7168. pImg = NULL;
  7169. }
  7170. }
  7171. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  7172. if (bSmall)
  7173. {
  7174. m_Print.SetFontFace(18, 1, "黑体");
  7175. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7176. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7177. m_Print.SetFontFace(9, 1, "宋体");
  7178. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7179. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7180. m_Print.SetFontFace(6, 1, "宋体");
  7181. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7182. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7183. m_Print.SetFontFace(9, 1, "宋体");
  7184. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7185. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7186. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7187. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7188. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7189. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7190. int hei = StrRect.Height();
  7191. StrRect.bottom = StrRect.top;
  7192. StrRect.top -= 8;
  7193. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7194. m_Print.SetFontFace(11, 1, "宋体");
  7195. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7196. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7197. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7198. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7199. m_Print.SetFontFace(8, 1, "宋体");
  7200. for ( i = 7; i < 24; i++)
  7201. {
  7202. StrRect = load.m_rcarray.ElementAt(i);
  7203. m_Print.DrawRect2(StrRect, 1);
  7204. }
  7205. for (i = 9; i < 24; i++)
  7206. {
  7207. StrRect = load.m_rcarray.ElementAt(i);
  7208. StrRect.left += 2;
  7209. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7210. }
  7211. m_Print.SetFontFace(6, 1, "宋体");
  7212. for (i = 24; i < 26; i++)
  7213. {
  7214. StrRect = load.m_rcarray.ElementAt(i);
  7215. StrRect.left += 2;
  7216. if (i == 24)
  7217. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7218. else
  7219. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7220. }
  7221. // StrRect=load.m_rcarray .ElementAt (27);
  7222. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  7223. }
  7224. else//大单
  7225. {
  7226. // 1.打印表头(蒙娜丽莎收款单)
  7227. m_Print.SetFontFace(20, 1, "黑体");
  7228. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7229. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7230. m_Print.SetFontFace(11, 1, "宋体");
  7231. // 2.打印订单号(NO.20140608-001)
  7232. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7233. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7234. // 3.打印SerialNo(SerialNo.01062)
  7235. int hei = StrRect.Height();
  7236. StrRect.bottom = StrRect.top;
  7237. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7238. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7239. // 4.打印影楼地址信息、电话;
  7240. m_Print.SetFontFace(8, 1, "宋体");
  7241. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7242. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7243. m_Print.SetFontFace(11, 1, "宋体");
  7244. // 5.打印客户姓名
  7245. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7246. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7247. // 6.打印客户联系电话
  7248. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7249. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7250. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7251. // 7.打印开单日期
  7252. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7253. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7254. #if 0 // Original Edition
  7255. // 8.打印列字段:收款项目
  7256. m_Print.SetFontFace(13, 1, "宋体");
  7257. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7258. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7259. printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7260. // 9.打印列字段:金额
  7261. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7262. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7263. printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7264. // 10.打印列字段:开单人
  7265. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7266. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7267. printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7268. #else
  7269. // 8.打印列字段:收款项目
  7270. m_Print.SetFontFace(13, 1, "宋体");
  7271. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7272. StrRect = CRect(66, 85, 280, 105);
  7273. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7274. //m_Print.DrawText("收款项目",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7275. // 8.1 Jeff add:支付方式
  7276. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7277. StrRect = CRect(280, 85, 350, 105);
  7278. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7279. //m_Print.DrawText("支付方式",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7280. // 9.打印列字段:金额
  7281. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7282. StrRect = CRect(350, 85, 442, 105);
  7283. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7284. //m_Print.DrawText("金额",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7285. // 10.打印列字段:开单人
  7286. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7287. StrRect = CRect(442, 85, 535, 105);
  7288. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7289. //m_Print.DrawText("开单人",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7290. //rcpos += 3;
  7291. #endif
  7292. // 11.画表格-画3列;old
  7293. // 11.draw 4 column
  7294. m_Print.SetFontFace(11, 1, "宋体");
  7295. //for( i=7; i<10; i++)
  7296. //{
  7297. // StrRect=load.m_rcarray.ElementAt(i);
  7298. // m_Print.DrawRect2(StrRect, 1);
  7299. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7300. //}
  7301. m_Print.DrawRect2(CRect(66, 85, 280, 105), 1);
  7302. m_Print.DrawRect2(CRect(280, 85, 350, 105), 1);
  7303. m_Print.DrawRect2(CRect(350, 85, 442, 105), 1);
  7304. m_Print.DrawRect2(CRect(442, 85, 535, 105), 1);
  7305. // 12.打印详细内容
  7306. int dty = 0;
  7307. int dtytemp = 0;
  7308. // for( i=10; i<14; i+=3)
  7309. //for( i=10; i<22; i+=3) // 循环4次,再画
  7310. int j = 0;
  7311. for (i = 10, j = 11; i<22; i += 3, j += 4) // 循环4次,再画
  7312. {
  7313. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  7314. CArray<CRect, CRect>rcarray;
  7315. CStringArray strarray2;
  7316. StrRect = load.m_rcarray.ElementAt(i);
  7317. StrRect.top += dty;
  7318. StrRect.bottom += dty;
  7319. StrRect.right -= 70; // Jeff add
  7320. //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;
  7321. /*
  7322. 4次的CRect
  7323. 66,105,350,125
  7324. 66,126,350,146
  7325. 66,147,350,167
  7326. 66,168,350,188
  7327. */
  7328. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  7329. {
  7330. StrRect = load.m_rcarray.ElementAt(i - 1);
  7331. StrRect.top += dty;
  7332. StrRect.bottom += dty;
  7333. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  7334. break;
  7335. }
  7336. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  7337. StrRect.left += 2;
  7338. StrRect.right -= 2;
  7339. StrRect.top += 4;
  7340. rcarray.Add(StrRect);
  7341. //strarray2.Add(pArray->ElementAt(i+1));
  7342. strarray2.Add(pArray->ElementAt(j));
  7343. //printf("Jeff:%d:%s\n\n",j,pArray->ElementAt(j));//Jeff Printf;
  7344. // 指定格子宽度,计算字符串占几行(高度).
  7345. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  7346. dtytemp = bottom - StrRect.bottom;
  7347. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7348. // 重新获取表格大小,并画出表格;
  7349. /*
  7350. CRect(66,85,280,105),
  7351. CRect(280,85,350,105)
  7352. CRect(350,85,442,105)
  7353. CRect(442,85,535,105)
  7354. CRect(66,105,350,125),
  7355. CRect(66,126,350,146)
  7356. CRect(66,147,350,167)
  7357. CRect(66,168,350,188)
  7358. */
  7359. // 画收款项目框及打印内容;
  7360. StrRect = load.m_rcarray.ElementAt(i);
  7361. //StrRect=CRect(66,85,280,105);
  7362. StrRect.bottom += dtytemp;
  7363. StrRect.top += dty;
  7364. StrRect.bottom += dty;
  7365. //StrRect.left -= 70; // Jeff add
  7366. StrRect.right -= 70; // Jeff add
  7367. //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;
  7368. m_Print.DrawRect2(StrRect, 1);
  7369. // 画支付方式框及打印内容;
  7370. StrRect = load.m_rcarray.ElementAt(i);
  7371. //StrRect=CRect(280,85,350,105);
  7372. StrRect.bottom += dtytemp;
  7373. StrRect.top += dty;
  7374. StrRect.bottom += dty;
  7375. StrRect.left += StrRect.Width() - 70;
  7376. //StrRect.right += 70; // Jeff add
  7377. //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;
  7378. m_Print.DrawRect2(StrRect, 1);
  7379. StrRect.left += 2;
  7380. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7381. //printf("Jeff:%d:%s\n\n",j+1,pArray->ElementAt(j+1));//Jeff Printf;
  7382. // 画金额框及打印内容;
  7383. StrRect = load.m_rcarray.ElementAt(i + 1);
  7384. //StrRect=CRect(350,85,442,105);
  7385. StrRect.top += dty;
  7386. StrRect.bottom += dty;
  7387. StrRect.bottom += dtytemp;
  7388. //StrRect.right -= 70; // Jeff add
  7389. //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;
  7390. m_Print.DrawRect2(StrRect, 1);
  7391. StrRect.left += 2;
  7392. // 打印出金额字段内容
  7393. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7394. //printf("Jeff:%d:%s\n\n",j+2,pArray->ElementAt(j+2));//Jeff Printf;
  7395. // 画开单人框及打印内容;
  7396. StrRect = load.m_rcarray.ElementAt(i + 2);
  7397. //StrRect=CRect(442,85,535,105);
  7398. StrRect.top += dty;
  7399. StrRect.bottom += dty;
  7400. StrRect.bottom += dtytemp;
  7401. //StrRect.right -= 70; // Jeff add
  7402. //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;
  7403. m_Print.DrawRect2(StrRect, 1);
  7404. StrRect.left += 2;
  7405. // 打印开单人字段内容
  7406. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 3), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7407. //printf("Jeff:%d:%s\n\n",j+3,pArray->ElementAt(j+3));//Jeff Printf;
  7408. dty += dtytemp;
  7409. }
  7410. //.打印->付款情况 应付 实付 欠款.
  7411. i = 22;
  7412. j = 27;
  7413. StrRect = load.m_rcarray.ElementAt(i);
  7414. StrRect.top += dty;
  7415. StrRect.bottom += dty;
  7416. m_Print.DrawRect2(StrRect, 1);
  7417. StrRect.left += 2;
  7418. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7419. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7420. //.打印->合计人民币(大写):.......
  7421. i = 23;
  7422. j = 28;
  7423. StrRect = load.m_rcarray.ElementAt(i);
  7424. StrRect.top += dty;
  7425. StrRect.bottom += dty;
  7426. m_Print.DrawRect2(StrRect, 1);
  7427. StrRect.left += 2;
  7428. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7429. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7430. // 打印总金额;
  7431. m_Print.SetFontFace(7, 1, "宋体");
  7432. for (i = 24, j = 29; i < 27; i++, j++)
  7433. {
  7434. StrRect = load.m_rcarray.ElementAt(i);
  7435. StrRect.top += dty;
  7436. StrRect.bottom += dty;
  7437. StrRect.left += 2;
  7438. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7439. }
  7440. StrRect = load.m_rcarray.ElementAt(24);
  7441. StrRect.top += dty;
  7442. StrRect.bottom += dty;
  7443. hei = StrRect.Height();
  7444. StrRect.top += hei;
  7445. StrRect.bottom += hei;
  7446. StrRect.right += 100;
  7447. StrRect.left += 2;
  7448. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  7449. AutoDraw(m_Print, StrRect, pArray->ElementAt(32), 1.0);
  7450. }
  7451. PrintPreview dlg;
  7452. dlg.m_mode = 3;
  7453. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  7454. dlg.m_pDC = m_Print.GetPDC();
  7455. if (aa == 0)
  7456. {
  7457. if (dlg.DoModal() != IDOK)
  7458. {
  7459. return;
  7460. }
  7461. printcot = dlg.m_num;
  7462. }
  7463. //结束打印
  7464. m_Print.EndPage();
  7465. m_Print.EndPrint();
  7466. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7467. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7468. CString sql;
  7469. sql.Format("update version set [serialno]='%s'", SerialNo);
  7470. g_sendhead.bsql = 1;
  7471. g_nYearposTemp = g_nYearpos;
  7472. g_nYearpos = -1;
  7473. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7474. g_nYearpos = g_nYearposTemp;
  7475. #endif
  7476. }
  7477. }
  7478. void CMainFrame::PrintReceipt_02(CStringArray *pArray, CPrintRX *pPrinter, const int &nCount, const BOOL bPrintImmediately) // 打印订单*预约收款、预约补款*
  7479. {
  7480. //AfxMessageBox("abce");
  7481. int printcot = 1;
  7482. // for(int aa=0; aa<printcot; aa++) // Jeff, printcot=1....
  7483. // {
  7484. g_sendhead.bsql = 0;
  7485. g_sendhead.code[0] = 24;
  7486. g_sendhead.tabcount = 1;
  7487. int g_nYearposTemp = g_nYearpos;
  7488. g_nYearpos = -1;
  7489. g_pMainWnd->ProcessChatMessageRequest2(1);
  7490. g_nYearpos = g_nYearposTemp;
  7491. if (0 == g_bSendOK)return;
  7492. DataToArray(&g_cominfoarray);
  7493. CString SerialNo;
  7494. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7495. CPrintRX *tagPrinter = NULL;
  7496. if (pPrinter == NULL)
  7497. {
  7498. // 1.创建打印对象
  7499. tagPrinter = new CPrintRX;
  7500. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7501. {
  7502. tagPrinter->InitToPrint(NULL, 1);
  7503. }
  7504. else
  7505. {
  7506. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  7507. if (name.IsEmpty())
  7508. {
  7509. tagPrinter->InitToPrint(NULL, 1);
  7510. }
  7511. else
  7512. {
  7513. int nret = tagPrinter->InitToPrint((char*)(LPCTSTR)name, 1);
  7514. ///if(nret==-1 && aa==0)
  7515. if (nret == -1)
  7516. {
  7517. if (bPrintImmediately == FALSE)
  7518. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  7519. tagPrinter->InitToPrint(NULL, 1);
  7520. }
  7521. }
  7522. }
  7523. // 2.开始打印
  7524. tagPrinter->StartPrint();
  7525. tagPrinter->StartPage();
  7526. }
  7527. else
  7528. {
  7529. //SerialNo.Format ("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126))+1);
  7530. tagPrinter = pPrinter;
  7531. }
  7532. LoadRect load;
  7533. BOOL bSmall = 0;
  7534. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  7535. {
  7536. bSmall = 1;
  7537. load.SetLiaPath("20.lia");
  7538. }
  7539. else
  7540. load.SetLiaPath("10.lia");
  7541. if (bSmall)
  7542. load.SetMargins(0, 0);
  7543. else
  7544. load.SetMargins(10, 0);
  7545. if (!load.Load())return;
  7546. int rcpos = -1;
  7547. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7548. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  7549. {
  7550. Image *pImg = NULL;
  7551. g_nSendCode = 31;
  7552. int g_nYearposTemp = g_nYearpos;
  7553. g_nYearpos = -1;
  7554. g_pMainWnd->ProcessChatMessageRequest2(1);
  7555. g_nYearpos = g_nYearposTemp;
  7556. g_nSendCode = 0;
  7557. if (g_bSendOK == 0)return;
  7558. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7559. if (pImg)
  7560. {
  7561. StrRect.left = 65;
  7562. if (bSmall) StrRect.left = 55;
  7563. StrRect.top = 10;
  7564. StrRect.right = StrRect.left + 58;
  7565. StrRect.bottom = StrRect.top + 58;
  7566. // 3.打印2维码图像;
  7567. tagPrinter->DrawImage(pImg, StrRect);
  7568. delete pImg;
  7569. pImg = NULL;
  7570. }
  7571. }
  7572. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  7573. if (bSmall)
  7574. {
  7575. tagPrinter->SetFontFace(18, 1, "黑体");
  7576. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7577. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7578. tagPrinter->SetFontFace(9, 1, "宋体");
  7579. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7580. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7581. tagPrinter->SetFontFace(6, 1, "宋体");
  7582. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7583. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7584. tagPrinter->SetFontFace(9, 1, "宋体");
  7585. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7586. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7587. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7588. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7589. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7590. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7591. int hei = StrRect.Height();
  7592. StrRect.bottom = StrRect.top;
  7593. StrRect.top -= 8;
  7594. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7595. tagPrinter->SetFontFace(11, 1, "宋体");
  7596. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7597. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7598. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7599. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7600. tagPrinter->SetFontFace(8, 1, "宋体");
  7601. int i = 0;
  7602. for (i = 7; i < 24; i++)
  7603. {
  7604. StrRect = load.m_rcarray.ElementAt(i);
  7605. tagPrinter->DrawRect2(StrRect, 1);
  7606. }
  7607. for (i = 9; i < 24; i++)
  7608. {
  7609. StrRect = load.m_rcarray.ElementAt(i);
  7610. StrRect.left += 2;
  7611. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7612. }
  7613. tagPrinter->SetFontFace(6, 1, "宋体");
  7614. for (i = 24; i < 26; i++)
  7615. {
  7616. StrRect = load.m_rcarray.ElementAt(i);
  7617. StrRect.left += 2;
  7618. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7619. }
  7620. StrRect = load.m_rcarray.ElementAt(22);
  7621. int nH = StrRect.Height();
  7622. int nW = StrRect.Width();
  7623. int nlen = load.m_rcarray.GetSize();
  7624. int nLeft = StrRect.left;
  7625. int j = 0;
  7626. for (i = 27; i<32; i++)
  7627. {
  7628. CRect rct = StrRect;
  7629. if(i == 31)
  7630. {
  7631. rct.top = rct.top + (nH*(j - 1));
  7632. rct.bottom = rct.top + nH;
  7633. rct.left = rct.left + 200;
  7634. rct.right = rct.left + 200;
  7635. }
  7636. else
  7637. {
  7638. rct.top = rct.top + (nH*j);
  7639. rct.bottom = rct.top + nH;
  7640. rct.left = rct.left + 2;
  7641. rct.right = rct.left + 200;
  7642. }
  7643. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), rct, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7644. j++;
  7645. }
  7646. }
  7647. else//大单
  7648. {
  7649. // 1.打印表头(蒙娜丽莎收款单)
  7650. tagPrinter->SetFontFace(20, 1, "黑体");
  7651. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7652. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7653. tagPrinter->SetFontFace(11, 1, "宋体");
  7654. // 2.打印订单号(NO.20140608-001)
  7655. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7656. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7657. // 3.打印SerialNo(SerialNo.01062)
  7658. int hei = StrRect.Height();
  7659. StrRect.bottom = StrRect.top;
  7660. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7661. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7662. // 4.打印影楼地址信息、电话;
  7663. tagPrinter->SetFontFace(8, 1, "宋体");
  7664. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7665. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7666. tagPrinter->SetFontFace(11, 1, "宋体");
  7667. // 5.打印客户姓名
  7668. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7669. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7670. // 6.打印客户联系电话
  7671. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7672. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7673. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7674. // 7.打印开单日期
  7675. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7676. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7677. #if 0 // Original Edition
  7678. // 8.打印列字段:收款项目
  7679. tagPrinter->SetFontFace(13, 1, "宋体");
  7680. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7681. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7682. printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7683. // 9.打印列字段:金额
  7684. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7685. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7686. printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7687. // 10.打印列字段:开单人
  7688. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7689. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7690. printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7691. #else
  7692. // 8.打印列字段:收款项目
  7693. tagPrinter->SetFontFace(13, 1, "宋体");
  7694. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7695. StrRect = CRect(66, 85, 280, 105);
  7696. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7697. //m_Print.DrawText("收款项目",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7698. // 8.1 Jeff add:支付方式
  7699. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7700. StrRect = CRect(280, 85, 350, 105);
  7701. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7702. //m_Print.DrawText("支付方式",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7703. // 9.打印列字段:金额
  7704. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7705. StrRect = CRect(350, 85, 442, 105);
  7706. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7707. //m_Print.DrawText("金额",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7708. // 10.打印列字段:开单人
  7709. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7710. StrRect = CRect(442, 85, 535, 105);
  7711. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7712. //m_Print.DrawText("开单人",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7713. //rcpos += 3;
  7714. #endif
  7715. // 11.画表格-画3列;old
  7716. // 11.draw 4 column
  7717. tagPrinter->SetFontFace(11, 1, "宋体");
  7718. int i;
  7719. //for( i=7; i<10; i++)
  7720. //{
  7721. // StrRect=load.m_rcarray.ElementAt(i);
  7722. // m_Print.DrawRect2(StrRect, 1);
  7723. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7724. //}
  7725. tagPrinter->DrawRect2(CRect(66, 85, 280, 105), 1);
  7726. tagPrinter->DrawRect2(CRect(280, 85, 350, 105), 1);
  7727. tagPrinter->DrawRect2(CRect(350, 85, 442, 105), 1);
  7728. tagPrinter->DrawRect2(CRect(442, 85, 535, 105), 1);
  7729. // 12.打印详细内容
  7730. int dty = 0;
  7731. int dtytemp = 0;
  7732. // for( i=10; i<14; i+=3)
  7733. //for( i=10; i<22; i+=3) // 循环4次,再画
  7734. int j = 0;
  7735. for (i = 10, j = 11; i<22; i += 3, j += 4) // 循环4次,再画
  7736. {
  7737. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  7738. CArray<CRect, CRect>rcarray;
  7739. CStringArray strarray2;
  7740. StrRect = load.m_rcarray.ElementAt(i);
  7741. StrRect.top += dty;
  7742. StrRect.bottom += dty;
  7743. StrRect.right -= 70; // Jeff add
  7744. //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;
  7745. /*
  7746. 4次的CRect
  7747. 66,105,350,125
  7748. 66,126,350,146
  7749. 66,147,350,167
  7750. 66,168,350,188
  7751. */
  7752. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  7753. {
  7754. StrRect = load.m_rcarray.ElementAt(i - 1);
  7755. StrRect.top += dty;
  7756. StrRect.bottom += dty;
  7757. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  7758. break;
  7759. }
  7760. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  7761. StrRect.left += 2;
  7762. StrRect.right -= 2;
  7763. StrRect.top += 4;
  7764. rcarray.Add(StrRect);
  7765. //strarray2.Add(pArray->ElementAt(i+1));
  7766. strarray2.Add(pArray->ElementAt(j));
  7767. //printf("Jeff:%d:%s\n\n",j,pArray->ElementAt(j));//Jeff Printf;
  7768. // 指定格子宽度,计算字符串占几行(高度).
  7769. INT bottom = CalcHeight(rcarray, strarray2, tagPrinter, FORMAT_LEFT);
  7770. dtytemp = bottom - StrRect.bottom;
  7771. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7772. // 重新获取表格大小,并画出表格;
  7773. /*
  7774. CRect(66,85,280,105),
  7775. CRect(280,85,350,105)
  7776. CRect(350,85,442,105)
  7777. CRect(442,85,535,105)
  7778. CRect(66,105,350,125),
  7779. CRect(66,126,350,146)
  7780. CRect(66,147,350,167)
  7781. CRect(66,168,350,188)
  7782. */
  7783. // 画收款项目框及打印内容;
  7784. StrRect = load.m_rcarray.ElementAt(i);
  7785. //StrRect=CRect(66,85,280,105);
  7786. StrRect.bottom += dtytemp;
  7787. StrRect.top += dty;
  7788. StrRect.bottom += dty;
  7789. //StrRect.left -= 70; // Jeff add
  7790. StrRect.right -= 70; // Jeff add
  7791. //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;
  7792. tagPrinter->DrawRect2(StrRect, 1);
  7793. // 画支付方式框及打印内容;
  7794. StrRect = load.m_rcarray.ElementAt(i);
  7795. //StrRect=CRect(280,85,350,105);
  7796. StrRect.bottom += dtytemp;
  7797. StrRect.top += dty;
  7798. StrRect.bottom += dty;
  7799. StrRect.left += StrRect.Width() - 70;
  7800. //StrRect.right += 70; // Jeff add
  7801. //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;
  7802. tagPrinter->DrawRect2(StrRect, 1);
  7803. StrRect.left += 2;
  7804. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7805. //printf("Jeff:%d:%s\n\n",j+1,pArray->ElementAt(j+1));//Jeff Printf;
  7806. // 画金额框及打印内容;
  7807. StrRect = load.m_rcarray.ElementAt(i + 1);
  7808. //StrRect=CRect(350,85,442,105);
  7809. StrRect.top += dty;
  7810. StrRect.bottom += dty;
  7811. StrRect.bottom += dtytemp;
  7812. //StrRect.right -= 70; // Jeff add
  7813. //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;
  7814. tagPrinter->DrawRect2(StrRect, 1);
  7815. StrRect.left += 2;
  7816. // 打印出金额字段内容
  7817. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7818. //printf("Jeff:%d:%s\n\n",j+2,pArray->ElementAt(j+2));//Jeff Printf;
  7819. // 画开单人框及打印内容;
  7820. StrRect = load.m_rcarray.ElementAt(i + 2);
  7821. //StrRect=CRect(442,85,535,105);
  7822. StrRect.top += dty;
  7823. StrRect.bottom += dty;
  7824. StrRect.bottom += dtytemp;
  7825. //StrRect.right -= 70; // Jeff add
  7826. //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;
  7827. tagPrinter->DrawRect2(StrRect, 1);
  7828. StrRect.left += 2;
  7829. // 打印开单人字段内容
  7830. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 3), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7831. //printf("Jeff:%d:%s\n\n",j+3,pArray->ElementAt(j+3));//Jeff Printf;
  7832. dty += dtytemp;
  7833. }
  7834. //.打印->付款情况 应付 实付 欠款.
  7835. i = 22;
  7836. j = 27;
  7837. StrRect = load.m_rcarray.ElementAt(i);
  7838. StrRect.top += dty;
  7839. StrRect.bottom += dty;
  7840. tagPrinter->DrawRect2(StrRect, 1);
  7841. StrRect.left += 2;
  7842. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7843. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7844. //.打印->合计人民币(大写):.......
  7845. i = 23;
  7846. j = 28;
  7847. StrRect = load.m_rcarray.ElementAt(i);
  7848. StrRect.top += dty;
  7849. StrRect.bottom += dty;
  7850. tagPrinter->DrawRect2(StrRect, 1);
  7851. StrRect.left += 2;
  7852. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7853. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7854. // 打印总金额;
  7855. tagPrinter->SetFontFace(7, 1, "宋体");
  7856. for (i = 24, j = 29; i < 27; i++, j++)
  7857. {
  7858. StrRect = load.m_rcarray.ElementAt(i);
  7859. StrRect.top += dty;
  7860. StrRect.bottom += dty;
  7861. StrRect.left += 2;
  7862. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7863. }
  7864. StrRect = load.m_rcarray.ElementAt(24);
  7865. StrRect.top += dty;
  7866. StrRect.bottom += dty;
  7867. hei = StrRect.Height();
  7868. StrRect.top += hei;
  7869. StrRect.bottom += hei;
  7870. StrRect.right += 100;
  7871. StrRect.left += 2;
  7872. StrRect = load.m_rcarray.ElementAt(27);
  7873. StrRect.top += dty;
  7874. StrRect.bottom += dty;
  7875. AutoDraw(*tagPrinter, StrRect, pArray->ElementAt(32), 1.0);
  7876. }
  7877. if (bPrintImmediately == TRUE)
  7878. {
  7879. printcot = nCount;
  7880. ////结束打印
  7881. tagPrinter->EndPage();
  7882. tagPrinter->EndPrint();
  7883. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7884. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7885. CString sql;
  7886. sql.Format("update version set [serialno]='%s'", SerialNo);
  7887. g_sendhead.bsql = 1;
  7888. g_nYearposTemp = g_nYearpos;
  7889. g_nYearpos = -1;
  7890. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7891. g_nYearpos = g_nYearposTemp;
  7892. #endif
  7893. }
  7894. else
  7895. {
  7896. PrintPreview dlg;
  7897. dlg.m_mode = 3;
  7898. tagPrinter->GetWidHei(dlg.m_w, dlg.m_h);
  7899. dlg.m_pDC = tagPrinter->GetPDC();
  7900. //if(aa==0)
  7901. //{
  7902. if (dlg.DoModal() != IDOK)
  7903. {
  7904. return;
  7905. }
  7906. else
  7907. {
  7908. printcot = dlg.m_num;
  7909. //m_Print.deletePrinter();
  7910. for (int i = 0; i < printcot; i++)
  7911. {
  7912. //tagPrinter->EndPage();
  7913. //tagPrinter->m_DC.AbortDoc(); // 结束清空由StartDoc写入的内容;2014-09-15;
  7914. //tagPrinter->m_DC.EndDoc();
  7915. //Sleep(10000);
  7916. //tagPrinter->StartPrint();
  7917. //tagPrinter->NewPage();
  7918. //PrintReceipt_02(pArray,/*tagPrinter*/NULL,printcot,TRUE);
  7919. PrintReceipt_02(pArray, tagPrinter, printcot, TRUE);
  7920. }
  7921. }
  7922. if (tagPrinter) delete tagPrinter;
  7923. //}
  7924. }
  7925. //}
  7926. }
  7927. void CMainFrame::PrintFlowChart(CString strOrderNumber) // 选片打单;
  7928. {
  7929. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(75)))
  7930. {
  7931. // Jeff 使用风格2打印;
  7932. //PrintFlowChart3_20151116(strOrderNumber);
  7933. PrintFlowChart3(strOrderNumber);
  7934. return;
  7935. }
  7936. #ifdef ZHIAI_VERSION
  7937. PrintFlowChart2(strOrderNumber);
  7938. return;
  7939. #endif
  7940. int i = 0;
  7941. int printcot = 1;
  7942. for (int aa = 0; aa < printcot; aa++)
  7943. {
  7944. CPrintRX m_Print;
  7945. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7946. {
  7947. m_Print.InitToPrint(NULL, 1);
  7948. }
  7949. else
  7950. {
  7951. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  7952. if (name.IsEmpty())
  7953. m_Print.InitToPrint(NULL, 1);
  7954. else
  7955. {
  7956. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  7957. if (nret == -1 && aa == 0)
  7958. {
  7959. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  7960. }
  7961. }
  7962. }
  7963. m_Print.StartPrint();
  7964. m_Print.StartPage();
  7965. // CRect StrRect(0,0,560,818);
  7966. LoadRect load;
  7967. load.SetLiaPath("4.lia");
  7968. load.SetMargins(-14, -14);
  7969. if (!load.Load())return;
  7970. LoadRect load2;
  7971. load2.SetMargins(-14, 472 + 27 - 14);
  7972. load2.SetLiaPath("5.lia");
  7973. if (!load2.Load())return;
  7974. //////////////////////////////////////////////////////////////
  7975. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2'";
  7976. g_sendhead.code[0] = 54;
  7977. g_sendhead.code[1] = 223;
  7978. g_sendhead.tabcount = 2;
  7979. g_sendhead.bsql = 0;
  7980. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  7981. CArray<CStringArray, CStringArray>sparray;
  7982. DataToArray(&g_List1array, &sparray);
  7983. CString spno;
  7984. for ( i = 0; i < sparray.GetSize(); i++)
  7985. {
  7986. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  7987. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  7988. if (sparray.ElementAt(i).ElementAt(5) == "入册" && sparray.ElementAt(i).ElementAt(5) == "入底" && sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  7989. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  7990. spno += sparray.ElementAt(i).ElementAt(5);
  7991. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  7992. spno += "; ";
  7993. else
  7994. {
  7995. spno += ":";
  7996. spno += sparray.ElementAt(i).ElementAt(6);
  7997. spno += "; ";
  7998. }
  7999. }
  8000. spno += " 加挑:";
  8001. for (i = 0; i < sparray.GetSize(); i++)
  8002. {
  8003. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8004. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8005. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8006. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8007. spno += sparray.ElementAt(i).ElementAt(5);
  8008. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  8009. spno += "; ";
  8010. else
  8011. {
  8012. spno += ":";
  8013. spno += sparray.ElementAt(i).ElementAt(6);
  8014. spno += "; ";
  8015. }
  8016. }
  8017. if (spno.Right(6) == " 加挑:")
  8018. {
  8019. spno = spno.Left(spno.GetLength() - 6);
  8020. }
  8021. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8022. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8023. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8024. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8025. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8026. if (m_urgent.IsEmpty())m_urgent = "否";
  8027. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8028. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8029. // CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  8030. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8031. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8032. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8033. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8034. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8035. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8036. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8037. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8038. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(17) + g_List1array.ElementAt(0).ElementAt(29);
  8039. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8040. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8041. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8042. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8043. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8044. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8045. CString m_sum3;
  8046. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8047. ::ConvertToPrice(m_sum3);
  8048. if (m_money3.IsEmpty())m_money3 = "0";
  8049. // m_money3=m_money3+"/"+m_sum3;
  8050. CString name;
  8051. if (!m_name1.IsEmpty())
  8052. name = m_name1 + ",";
  8053. name += m_name2;
  8054. name.TrimRight(",");
  8055. CString phone;
  8056. if (!m_phone1.IsEmpty())
  8057. phone = m_phone1 + ",";
  8058. phone += m_phone2; phone.TrimRight(",");
  8059. if (IsHasRights2new(31) == 0)
  8060. phone = "***";
  8061. CStringArray strarray;
  8062. strarray.Add(m_urgent);
  8063. strarray.Add(m_ren);
  8064. strarray.Add(m_waiter3);
  8065. strarray.Add(name);
  8066. strarray.Add(m_time2);
  8067. strarray.Add(m_time4);
  8068. strarray.Add(m_money3);
  8069. strarray.Add(m_sum3);
  8070. strarray.Add(m_takezs);
  8071. strarray.Add(m_taoxizs);
  8072. strarray.Add(m_choosezs);
  8073. strarray.Add(strOrderNumber);
  8074. strarray.Add(phone);
  8075. ////////////////////////////////////////////////////////////////
  8076. int rcpos = -1;
  8077. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8078. Image *pImg = NULL;
  8079. #ifdef MNLS_VERSION
  8080. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  8081. #else
  8082. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  8083. #endif
  8084. m_Print.DrawImage(pImg, StrRect);
  8085. delete pImg;
  8086. m_Print.SetFontFace(11, 1, "宋体");
  8087. StrRect = load2.m_rcarray.ElementAt(7);
  8088. StrRect.top = load2.m_rcarray.ElementAt(15).top - 15;
  8089. StrRect.bottom = load2.m_rcarray.ElementAt(15).bottom - 15;
  8090. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  8091. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8092. StrRect.top += 15;
  8093. StrRect.bottom += 15;
  8094. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  8095. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8096. m_Print.SetFontFace(15, 1, "宋体");
  8097. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8098. #ifdef MNLS_VERSION
  8099. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8100. #endif
  8101. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8102. #ifdef MNLS_VERSION
  8103. m_Print.DrawRect(StrRect);
  8104. #endif
  8105. m_Print.SetFontFace(7, 1, "黑体");
  8106. m_Print.SetColor(0xffffff);
  8107. #ifdef MNLS_VERSION
  8108. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8109. #endif
  8110. m_Print.SetColor(0);
  8111. m_Print.SetFontFace(25, 1, "黑体");
  8112. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8113. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8114. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  8115. {
  8116. Image *pImg = NULL;
  8117. g_nSendCode = 31;
  8118. int g_nYearposTemp = g_nYearpos;
  8119. g_nYearpos = -1;
  8120. g_pMainWnd->ProcessChatMessageRequest2(1);
  8121. g_nYearpos = g_nYearposTemp;
  8122. g_nSendCode = 0;
  8123. if (g_bSendOK == 0)return;
  8124. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8125. if (pImg)
  8126. {
  8127. StrRect.left = 450;
  8128. StrRect.top = 22;
  8129. StrRect.right = StrRect.left + 60;
  8130. StrRect.bottom = StrRect.top + 60;
  8131. m_Print.DrawImage(pImg, StrRect);
  8132. delete pImg; pImg = NULL;
  8133. }
  8134. }
  8135. #ifdef CHILD_VERSION
  8136. CString title[13] = { "是否加急:", "接单门市:", \
  8137. "选样人员:", "客人姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  8138. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:"
  8139. };
  8140. #else
  8141. CString title[13] = { "是否加急:", "接单门市:", \
  8142. "选样人员:", "新郎新娘姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  8143. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:" };
  8144. #endif
  8145. m_Print.SetFontFace(12, 1, "宋体");
  8146. for (i = 0; i < 13; i++)
  8147. {
  8148. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8149. if (i < 3)
  8150. m_Print.DrawRect2(StrRect, 0);
  8151. else
  8152. m_Print.DrawRect2(StrRect, 1);
  8153. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8154. }
  8155. for (i = 18; i <= 37; i++)
  8156. {
  8157. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8158. if (i >= 19 && i <= 21)
  8159. m_Print.DrawRect2(StrRect, 2);
  8160. /* else if(i==26)
  8161. {
  8162. CRect rc=StrRect;
  8163. CRect rc2=rc;
  8164. rc.right -=rc2.Width ()/2;
  8165. m_Print.DrawRect2(rc, 1);
  8166. rc2.left +=rc.Width ();
  8167. m_Print.DrawRect2(rc2, 1);
  8168. }*/
  8169. else
  8170. m_Print.DrawRect2(StrRect, 1);
  8171. if (i == 18)
  8172. {
  8173. StrRect.left += 5;
  8174. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8175. }
  8176. }
  8177. //////////////////////////////////////
  8178. rcpos = -1;
  8179. for (i = 0; i < 8; i++)
  8180. {
  8181. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8182. m_Print.DrawRect2(StrRect, 1);
  8183. }
  8184. #ifdef CHILD_VERSION
  8185. CString title2[4] = { "引导师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  8186. #else
  8187. CString title2[4] = { "化妆师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  8188. #endif
  8189. for (i = 0; i < 4; i++)
  8190. {
  8191. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8192. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8193. }
  8194. for (i = 0; i < 4; i++)
  8195. {
  8196. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8197. m_Print.DrawRect2(StrRect, 2);
  8198. }
  8199. StrRect = load2.m_rcarray.ElementAt(11);
  8200. StrRect.top -= 15;
  8201. StrRect.bottom -= 15;
  8202. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客选片签名:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8203. StrRect = load2.m_rcarray.ElementAt(15);
  8204. StrRect.top -= 15;
  8205. StrRect.bottom -= 15;
  8206. m_Print.DrawRect2(StrRect, 2);
  8207. ///////////////////////////////////////////
  8208. for (i = 19; i <= 31; i++)
  8209. {
  8210. StrRect = load.m_rcarray.ElementAt(i - 1);
  8211. StrRect.left += 4;
  8212. if (i == 31)
  8213. {
  8214. if (m_phone1.IsEmpty() == 0 && m_phone2.IsEmpty() == 0)
  8215. {
  8216. StrRect.top += 2;
  8217. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  8218. StrRect.top += 8;
  8219. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8220. }
  8221. else
  8222. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8223. }
  8224. /* else if((i-19)==7)
  8225. {
  8226. CRect rc=StrRect;
  8227. CRect rc2=rc;
  8228. rc.right -=rc2.Width ()/2;
  8229. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8230. rc2.left +=rc.Width ()+3;
  8231. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8232. }*/
  8233. else
  8234. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8235. }
  8236. strarray.RemoveAll();
  8237. strarray.Add(m_waiter2);
  8238. strarray.Add(m_waiter1);
  8239. strarray.Add(m_waiter4);
  8240. for (i = 13; i <= 15; i++)
  8241. {
  8242. StrRect = load2.m_rcarray.ElementAt(i - 1);
  8243. StrRect.left += 4;
  8244. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8245. }
  8246. ///////////spno
  8247. CRect sprc[14];
  8248. for (i = 0; i < 14; i++)
  8249. {
  8250. if (i < 7)
  8251. {
  8252. if (i == 0)
  8253. {
  8254. StrRect = load.m_rcarray.ElementAt(17); StrRect.left += 94; StrRect.right -= 3;
  8255. }
  8256. else
  8257. {
  8258. StrRect = load.m_rcarray.ElementAt(30 + i); StrRect.left += 4; StrRect.right -= 3;
  8259. }
  8260. }
  8261. else
  8262. {
  8263. StrRect = load2.m_rcarray.ElementAt(i - 7); StrRect.left += 4; StrRect.right -= 3;
  8264. }
  8265. sprc[i] = StrRect;
  8266. }
  8267. CString temp, tempspno, tempbz;
  8268. CSize size;
  8269. BOOL bRun = 0;
  8270. int fontsize = 12;
  8271. ll: tempspno = spno;
  8272. tempbz = m_bz;
  8273. m_Print.SetFontFace(fontsize, 1, "宋体");
  8274. for (i = 0; i<14; i++)
  8275. {
  8276. if (!tempspno.IsEmpty())
  8277. {
  8278. temp = tempspno;
  8279. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8280. int right = 0;
  8281. CRect temprc = sprc[i];
  8282. while (size.cx>temprc.Width())
  8283. {
  8284. right++;
  8285. temp = tempspno.Left(tempspno.GetLength() - (right));
  8286. if (GIsHalfHZ(temp))
  8287. {
  8288. right++;
  8289. temp.Delete(temp.GetLength() - 1);
  8290. }
  8291. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8292. }
  8293. if (bRun)
  8294. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8295. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  8296. if (tempspno.IsEmpty())i++;
  8297. }
  8298. else if (!tempbz.IsEmpty())
  8299. {
  8300. temp = tempbz;
  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 = tempbz.Left(tempbz.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. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  8318. }
  8319. }
  8320. if (tempspno.IsEmpty() == 0 || tempbz.IsEmpty() == 0)
  8321. {
  8322. fontsize--;
  8323. goto ll;
  8324. }
  8325. if (bRun == 0)
  8326. {
  8327. bRun = 1;
  8328. goto ll;
  8329. }
  8330. PrintPreview dlg;
  8331. dlg.m_mode = 2;
  8332. dlg.m_name = name;
  8333. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8334. dlg.m_pDC = m_Print.GetPDC();
  8335. if (aa == 0)
  8336. {
  8337. if (dlg.DoModal() != IDOK)
  8338. return;
  8339. printcot = dlg.m_num;
  8340. }
  8341. //结束打印
  8342. m_Print.EndPage();
  8343. m_Print.EndPrint();
  8344. }
  8345. }
  8346. void CMainFrame::PrintFlowChart3LKAY(CString strOrderNumber)
  8347. {
  8348. int i = 0;
  8349. int printcot = 1;
  8350. for (int aa = 0; aa < printcot; aa++)
  8351. {
  8352. CPrintRX m_Print;
  8353. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  8354. {
  8355. m_Print.InitToPrint(NULL, 1);
  8356. }
  8357. else
  8358. {
  8359. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  8360. if (name.IsEmpty())
  8361. m_Print.InitToPrint(NULL, 1);
  8362. else
  8363. {
  8364. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8365. if (nret == -1 && aa == 0)
  8366. {
  8367. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8368. }
  8369. }
  8370. }
  8371. m_Print.StartPrint();
  8372. m_Print.StartPage();
  8373. LoadRect load;
  8374. load.SetLiaPath("18.lia");
  8375. load.SetMargins(10, 0);
  8376. if (!load.Load())return;
  8377. CString str;
  8378. int rcpos = -1;
  8379. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8380. m_Print.SetFontFace(25, 1, "宋体");
  8381. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8382. m_Print.SetFontFace(15, 1, "宋体");
  8383. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8384. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8385. m_Print.SetFontFace(9, 1, "宋体");
  8386. //////////////////////////////////////////////////////////////
  8387. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8388. g_sendhead.code[0] = 54;
  8389. g_sendhead.code[1] = 223;
  8390. g_sendhead.code[2] = 52;
  8391. g_sendhead.tabcount = 3;
  8392. g_sendhead.bsql = 0;
  8393. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  8394. CArray<CStringArray, CStringArray>sparray;
  8395. CArray<CStringArray, CStringArray>clientarray;
  8396. DataToArray(&g_List1array, &sparray, &clientarray);
  8397. CString spno;
  8398. CStringArray sparray2;
  8399. for ( i = 0; i < sparray.GetSize(); i++)
  8400. {
  8401. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8402. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8403. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8404. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8405. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8406. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8407. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8408. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8409. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8410. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8411. }
  8412. for (i = 0; i < sparray.GetSize(); i++)
  8413. {
  8414. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8415. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8416. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8417. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8418. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8419. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8420. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8421. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8422. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8423. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8424. }
  8425. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8426. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8427. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8428. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8429. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8430. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8431. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8432. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8433. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8434. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8435. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8436. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8437. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8438. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8439. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8440. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8441. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8442. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8443. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8444. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8445. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8446. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8447. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8448. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8449. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8450. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8451. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8452. CString m_sum3;
  8453. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8454. ::ConvertToPrice(m_sum3);
  8455. if (m_money3.IsEmpty())m_money3 = "0";
  8456. int dty = 0;
  8457. CString name;
  8458. if (!m_name1.IsEmpty())
  8459. name = m_name1 + ",";
  8460. name += m_name2;
  8461. name.TrimRight(",");
  8462. CString phone;
  8463. if (!m_phone1.IsEmpty())
  8464. phone = m_phone1 + ",";
  8465. phone += m_phone2; phone.TrimRight(",");
  8466. if (IsHasRights2new(31) == 0)
  8467. phone = "***";
  8468. CStringArray strarray;
  8469. #ifdef CHILD_VERSION
  8470. if (m_birthday.IsEmpty())
  8471. strarray.Add("姓名/性别");
  8472. else
  8473. strarray.Add("姓名/性别/年龄");
  8474. #else
  8475. strarray.Add("客人姓名");
  8476. #endif
  8477. strarray.Add("电话");
  8478. strarray.Add("单号");
  8479. strarray.Add("套系");
  8480. strarray.Add("选样");
  8481. strarray.Add("余款/加挑");
  8482. strarray.Add("选片/日期");
  8483. #ifdef CHILD_VERSION
  8484. if (m_birthday.IsEmpty())
  8485. strarray.Add(name + "/" + m_sex);
  8486. else
  8487. {
  8488. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8489. m_birthday.Format("%d", year + 1);
  8490. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8491. }
  8492. #else
  8493. strarray.Add(name);
  8494. #endif
  8495. strarray.Add(phone);
  8496. strarray.Add(strOrderNumber);
  8497. strarray.Add(m_taoxiname);
  8498. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8499. strarray.Add(str);
  8500. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8501. strarray.Add(str);
  8502. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8503. for (i = 3; i <= 16; i++)
  8504. {
  8505. StrRect = load.m_rcarray.ElementAt(i - 1);
  8506. if (i < 10)
  8507. {
  8508. m_Print.DrawRect2(StrRect, 1);
  8509. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8510. }
  8511. }
  8512. StrRect = load.m_rcarray.ElementAt(29);
  8513. m_Print.DrawRect2(StrRect, 1);
  8514. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8515. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  8516. {
  8517. Image *pImg = NULL;
  8518. g_nSendCode = 31;
  8519. int g_nYearposTemp = g_nYearpos;
  8520. g_nYearpos = -1;
  8521. g_pMainWnd->ProcessChatMessageRequest2(1);
  8522. g_nYearpos = g_nYearposTemp;
  8523. g_nSendCode = 0;
  8524. if (g_bSendOK == 0)return;
  8525. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8526. if (pImg)
  8527. {
  8528. StrRect.left = 485;
  8529. StrRect.top = 12;
  8530. StrRect.right = StrRect.left + 60;
  8531. StrRect.bottom = StrRect.top + 60;
  8532. m_Print.DrawImage(pImg, StrRect);
  8533. delete pImg; pImg = NULL;
  8534. }
  8535. }
  8536. CArray<CRect, CRect>rcarray;
  8537. CStringArray strarray2;
  8538. for (i = 10; i <= 16; i++)
  8539. {
  8540. StrRect = load.m_rcarray.ElementAt(i - 1);
  8541. StrRect.left += 2;
  8542. StrRect.right -= 2;
  8543. StrRect.top += 2;
  8544. rcarray.Add(StrRect);
  8545. strarray2.Add(strarray.ElementAt(7 + i - 10));
  8546. }
  8547. if (1)
  8548. {
  8549. StrRect = load.m_rcarray.ElementAt(30);
  8550. StrRect.left += 2;
  8551. StrRect.right -= 2;
  8552. StrRect.top += 2;
  8553. rcarray.Add(StrRect);
  8554. strarray2.Add(m_time6 + "/" + m_time5);
  8555. }
  8556. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8557. for (i = 10; i <= 16; i++)
  8558. {
  8559. StrRect = load.m_rcarray.ElementAt(i - 1);
  8560. if (i == 10)
  8561. {
  8562. dty += bottom - StrRect.bottom;
  8563. }
  8564. StrRect.bottom = bottom;
  8565. m_Print.DrawRect2(StrRect, 1);
  8566. }
  8567. if (1)
  8568. {
  8569. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  8570. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  8571. // m_Print.DrawText((LPTSTR)(LPCTSTR)(m_time6+"/"+m_time5), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER );
  8572. }
  8573. m_Print.SetFontFace(15, 1, "宋体");
  8574. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  8575. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8576. m_Print.SetFontFace(9, 1, "宋体");
  8577. strarray.RemoveAll();
  8578. strarray.Add("产品名称");
  8579. strarray.Add("数量");
  8580. strarray.Add("P数");
  8581. strarray.Add("张数");
  8582. strarray.Add("照片编号");
  8583. CArray<CRect, CRect>rc2array;
  8584. int wid = 25;
  8585. for (i = 18; i <= 22; i++)
  8586. {
  8587. StrRect = load.m_rcarray.ElementAt(i - 1);
  8588. if (i == 19)
  8589. {
  8590. StrRect.right = StrRect.left + wid;
  8591. }
  8592. if (i == 20)
  8593. {
  8594. StrRect = load.m_rcarray.ElementAt(i - 2);
  8595. StrRect.left += wid; StrRect.right = StrRect.left;
  8596. StrRect.right += wid;
  8597. }
  8598. if (i == 21)
  8599. {
  8600. StrRect = load.m_rcarray.ElementAt(i - 3);
  8601. StrRect.left += wid * 2; StrRect.right = StrRect.left;
  8602. StrRect.right += wid;
  8603. wid = StrRect.right;
  8604. }
  8605. if (i == 22)
  8606. {
  8607. StrRect = load.m_rcarray.ElementAt(i - 3);
  8608. StrRect.left = wid;
  8609. }
  8610. StrRect.top += dty; StrRect.bottom += dty;
  8611. m_Print.DrawRect2(StrRect, 1);
  8612. StrRect.left += 2;
  8613. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8614. StrRect.left -= 2;
  8615. StrRect.top = StrRect.bottom;
  8616. StrRect.bottom += 18;
  8617. rc2array.Add(StrRect);
  8618. }
  8619. int curypos = 0;
  8620. for (i = 0; i < sparray2.GetSize(); i += 5)
  8621. {
  8622. rcarray.RemoveAll();
  8623. strarray2.RemoveAll();
  8624. int j = 0;
  8625. for ( j = 0; j < 5; j++)
  8626. {
  8627. StrRect = rc2array.ElementAt(j);
  8628. StrRect.left += 2;
  8629. StrRect.right -= 2;
  8630. StrRect.top += 2;
  8631. rcarray.Add(StrRect);
  8632. strarray2.Add(sparray2.ElementAt(i + j));
  8633. }
  8634. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8635. rcarray.RemoveAll();
  8636. for (j = 0; j < 5; j++)
  8637. {
  8638. StrRect = rc2array.ElementAt(j);
  8639. if (j == 0)
  8640. {
  8641. dty += bottom - StrRect.bottom;
  8642. }
  8643. StrRect.bottom = bottom;
  8644. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8645. StrRect.top = StrRect.bottom;
  8646. StrRect.bottom += 18;
  8647. rcarray.Add(StrRect);
  8648. }
  8649. rc2array.RemoveAll();
  8650. rc2array.Copy(rcarray);
  8651. }
  8652. m_Print.SetFontFace(15, 1, "宋体");
  8653. StrRect = load.m_rcarray.ElementAt(20);
  8654. dty = curypos - StrRect.bottom + 35;
  8655. StrRect.top += dty; StrRect.bottom += dty;
  8656. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8657. m_Print.SetFontFace(9, 1, "宋体");
  8658. rcarray.RemoveAll();
  8659. strarray2.RemoveAll();
  8660. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8661. StrRect.left += 2;
  8662. StrRect.right -= 2;
  8663. StrRect.top += 2;
  8664. rcarray.Add(StrRect);
  8665. strarray2.Add(m_bz);
  8666. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8667. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8668. dty += bottom - StrRect.bottom;
  8669. StrRect.bottom = bottom;
  8670. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8671. m_Print.SetFontFace(10, 1, "宋体");
  8672. StrRect = load.m_rcarray.ElementAt(22);
  8673. dty = curypos - StrRect.bottom + 25;
  8674. StrRect.top += dty; StrRect.bottom += dty;
  8675. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  8676. if (m_edit9.IsEmpty())
  8677. {
  8678. m_edit9 = "\
  8679. 经确认后的照片均排入制作流程,\r\n\
  8680. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  8681. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  8682. }
  8683. CString info1, info2, info3;
  8684. int newlinepos = m_edit9.Find("\r\n");
  8685. if (newlinepos != -1)
  8686. {
  8687. info1 = m_edit9.Left(newlinepos);
  8688. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8689. }
  8690. newlinepos = m_edit9.Find("\r\n");
  8691. if (newlinepos != -1)
  8692. {
  8693. info2 = m_edit9.Left(newlinepos);
  8694. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8695. info3 = m_edit9;
  8696. }
  8697. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8698. StrRect = load.m_rcarray.ElementAt(23);
  8699. StrRect.top += dty; StrRect.bottom += dty;
  8700. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8701. StrRect = load.m_rcarray.ElementAt(24);
  8702. StrRect.top += dty; StrRect.bottom += dty;
  8703. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8704. StrRect.top += 15;
  8705. StrRect.bottom += 15;
  8706. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8707. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  8708. StrRect = load.m_rcarray.ElementAt(25);
  8709. StrRect.top += dty - dy;
  8710. StrRect.bottom += dty - dy;
  8711. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8712. StrRect = load.m_rcarray.ElementAt(26);
  8713. StrRect.top += dty - dy;
  8714. StrRect.bottom += dty - dy;
  8715. m_Print.DrawRect2(StrRect, 2);
  8716. StrRect = load.m_rcarray.ElementAt(25);
  8717. StrRect.top += dty + 15 - dy;
  8718. StrRect.bottom += dty + 15 - dy;
  8719. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8720. StrRect = load.m_rcarray.ElementAt(26);
  8721. StrRect.top += dty + 15 - dy;
  8722. StrRect.bottom += dty + 15 - dy;
  8723. m_Print.DrawRect2(StrRect, 2);
  8724. StrRect = load.m_rcarray.ElementAt(25);
  8725. StrRect.top += dty + 15 * 2 - dy;
  8726. StrRect.bottom += dty + 15 * 2 - dy;
  8727. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8728. StrRect = load.m_rcarray.ElementAt(26);
  8729. StrRect.top += dty + 15 * 2 - dy;
  8730. StrRect.bottom += dty + 15 * 2 - dy;
  8731. m_Print.DrawRect2(StrRect, 2);
  8732. PrintPreview dlg; dlg.m_mode = 2;
  8733. dlg.m_name = name;
  8734. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8735. dlg.m_pDC = m_Print.GetPDC();
  8736. if (aa == 0)
  8737. {
  8738. if (dlg.DoModal() != IDOK)
  8739. return;
  8740. printcot = dlg.m_num;
  8741. }
  8742. //结束打印
  8743. m_Print.EndPage();
  8744. m_Print.EndPrint();
  8745. }
  8746. }
  8747. void CMainFrame::PrintFlowChart3(CString strOrderNumber) // 选片打单 风格2;
  8748. {
  8749. #ifdef LKAY_VERSION
  8750. PrintFlowChart3LKAY(strOrderNumber);
  8751. return;
  8752. #endif
  8753. int i = 0;
  8754. int j = 0;
  8755. int printcot = 1;
  8756. for (int aa = 0; aa < printcot; aa++)
  8757. {
  8758. BOOL bSecondPage = 0;
  8759. int nPrintedPos = 0;
  8760. for (int bb = 0; bb < 2; bb++)
  8761. {
  8762. if (bb && bSecondPage == 0)break;
  8763. CPrintRX m_Print;
  8764. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58))) // 58-[version].[setcheck1] ==1,使用默认打印机;
  8765. {
  8766. m_Print.InitToPrint(NULL, 1);
  8767. }
  8768. else // 否则使用指定的打印机;
  8769. {
  8770. CString name = g_cominfoarray.ElementAt(0).ElementAt(64); // 64-[version].[printer2] 制作单打印机;
  8771. if (name.IsEmpty())
  8772. m_Print.InitToPrint(NULL, 1);
  8773. else
  8774. {
  8775. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8776. if (nret == -1 && aa == 0)
  8777. {
  8778. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8779. }
  8780. }
  8781. }
  8782. m_Print.StartPrint();
  8783. m_Print.StartPage();
  8784. LoadRect load;
  8785. load.SetLiaPath("18.lia");
  8786. load.SetMargins(10, 0);
  8787. if (!load.Load())return;
  8788. CString str;
  8789. int rcpos = -1;
  8790. // ■■■■■■从18.lia获取到第一个区域大小 - 1.显示店名;
  8791. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8792. if ((bb == 0 && bSecondPage == 0))
  8793. {
  8794. m_Print.SetFontFace(25, 1, "宋体");
  8795. // 10-[version].[info1] 店名;
  8796. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8797. m_Print.SetFontFace(15, 1, "宋体");
  8798. // ■■■■■■从18.lia获取第二个区域大小 - 2.显示"基本资料";
  8799. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8800. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8801. m_Print.SetFontFace(9, 1, "宋体");
  8802. }
  8803. //////////////////////////////////////////////////////////////
  8804. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8805. g_sendhead.code[0] = 54; // dindan;
  8806. g_sendhead.code[1] = 223; // dindanspview2; shangpin+dindansp;
  8807. g_sendhead.code[2] = 52; // client;
  8808. g_sendhead.tabcount = 3;
  8809. g_sendhead.bsql = 0;
  8810. g_pMainWnd->ProcessChatMessageRequest2(filter);
  8811. if (g_bSendOK == 0)return;
  8812. CArray<CStringArray, CStringArray>sparray;
  8813. CArray<CStringArray, CStringArray>clientarray;
  8814. DataToArray(&g_List1array, &sparray, &clientarray);
  8815. CString spno;
  8816. CStringArray sparray2;
  8817. for ( i = 0; i < sparray.GetSize(); i++)
  8818. {
  8819. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8820. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8821. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8822. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8823. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8824. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8825. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8826. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8827. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8828. }
  8829. for (i = 0; i < sparray.GetSize(); i++)
  8830. {
  8831. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8832. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8833. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8834. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8835. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8836. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8837. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8838. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8839. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8840. }
  8841. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8842. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8843. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8844. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8845. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8846. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8847. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8848. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8849. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8850. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8851. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8852. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8853. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8854. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8855. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8856. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8857. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8858. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8859. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  8860. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8861. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8862. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8863. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8864. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8865. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8866. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8867. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8868. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8869. CString m_sum3;
  8870. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8871. ::ConvertToPrice(m_sum3);
  8872. if (m_money3.IsEmpty())m_money3 = "0";
  8873. int dty = 0;
  8874. CString name;
  8875. if (!m_name1.IsEmpty())
  8876. name = m_name1 + ",";
  8877. name += m_name2;
  8878. name.TrimRight(",");
  8879. CString phone;
  8880. if (!m_phone1.IsEmpty())
  8881. phone = m_phone1 + ",";
  8882. phone += m_phone2; phone.TrimRight(",");
  8883. if (IsHasRights2new(31) == 0)
  8884. phone = "***";
  8885. CStringArray strarray;
  8886. CArray<CRect, CRect>rcarray;
  8887. CStringArray strarray2; CArray<CRect, CRect>rc2array;
  8888. int bottom;
  8889. if ((bb == 0 && bSecondPage == 0))
  8890. {
  8891. #ifdef CHILD_VERSION
  8892. if (m_birthday.IsEmpty())
  8893. strarray.Add("姓名/性别");
  8894. else
  8895. strarray.Add("姓名/性别/年龄");
  8896. #else
  8897. strarray.Add("客人姓名"); // 第3.1区域 -3.显示客人姓名;
  8898. #endif
  8899. strarray.Add("电话");
  8900. strarray.Add("单号");
  8901. strarray.Add("套系");
  8902. strarray.Add("选样");
  8903. strarray.Add("余款/加挑");
  8904. strarray.Add("选片/日期");
  8905. #ifdef CHILD_VERSION
  8906. if (m_birthday.IsEmpty())
  8907. strarray.Add(name + "/" + m_sex);
  8908. else
  8909. {
  8910. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8911. m_birthday.Format("%d", year + 1);
  8912. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8913. }
  8914. #else
  8915. strarray.Add(name); // 第4.1区域 -3.显示客人姓名;
  8916. #endif
  8917. strarray.Add(phone);
  8918. strarray.Add(strOrderNumber);
  8919. strarray.Add(m_taoxiname);
  8920. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8921. strarray.Add(str);
  8922. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8923. strarray.Add(str);
  8924. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8925. for (i = 3; i <= 16; i++)
  8926. {
  8927. // ■■■■■■从18.lia中获取第3~16的区域大小;
  8928. StrRect = load.m_rcarray.ElementAt(i - 1);
  8929. if (i < 10)
  8930. {
  8931. m_Print.DrawRect2(StrRect, 1);
  8932. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8933. }
  8934. }
  8935. // ■■■■■■从18.lia中获取第30的区域大小;
  8936. StrRect = load.m_rcarray.ElementAt(29);
  8937. m_Print.DrawRect2(StrRect, 1);
  8938. BOOL bPrintDate = 1;
  8939. #ifdef DDF_VERSION
  8940. // bPrintDate=0;
  8941. #else
  8942. if (m_time5 == "" && m_time6 == "")
  8943. bPrintDate = 0;
  8944. #endif
  8945. if (bPrintDate)
  8946. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8947. else
  8948. {
  8949. #ifdef CHILD_VERSION
  8950. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/引导", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8951. #else
  8952. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/化妆", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8953. #endif
  8954. }
  8955. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138))) // [version].[reverse3]
  8956. {
  8957. Image *pImg = NULL;
  8958. g_nSendCode = 31;
  8959. int g_nYearposTemp = g_nYearpos;
  8960. g_nYearpos = -1;
  8961. g_pMainWnd->ProcessChatMessageRequest2(1);
  8962. g_nYearpos = g_nYearposTemp;
  8963. g_nSendCode = 0;
  8964. if (g_bSendOK == 0)return;
  8965. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8966. // Jeff二维码的区域不是从18.lia里获取的,是固定在右上角指定区域;
  8967. if (pImg)
  8968. {
  8969. StrRect.left = 485;
  8970. StrRect.top = 12;
  8971. StrRect.right = StrRect.left + 60;
  8972. StrRect.bottom = StrRect.top + 60;
  8973. m_Print.DrawImage(pImg, StrRect);
  8974. delete pImg; pImg = NULL;
  8975. }
  8976. }
  8977. // CArray<CRect,CRect>rcarray;
  8978. // CStringArray strarray2;
  8979. // ■■■■■■从18.lia中获取第10的区域大小;
  8980. for (i = 10; i <= 16; i++)
  8981. {
  8982. StrRect = load.m_rcarray.ElementAt(i - 1);
  8983. StrRect.left += 2;
  8984. StrRect.right -= 2;
  8985. StrRect.top += 2;
  8986. rcarray.Add(StrRect);
  8987. strarray2.Add(strarray.ElementAt(7 + i - 10));
  8988. }
  8989. if (1)
  8990. {
  8991. // ■■■■■■从18.lia中获取第31的区域大小;
  8992. StrRect = load.m_rcarray.ElementAt(30);
  8993. StrRect.left += 2;
  8994. StrRect.right -= 2;
  8995. StrRect.top += 2;
  8996. rcarray.Add(StrRect);
  8997. if (bPrintDate)
  8998. strarray2.Add(m_time6 + "/" + m_time5);
  8999. else
  9000. {
  9001. strarray2.Add(m_waiter1 + "/" + m_waiter2);
  9002. }
  9003. }
  9004. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  9005. for (i = 10; i <= 16; i++)
  9006. {
  9007. StrRect = load.m_rcarray.ElementAt(i - 1);
  9008. if (i == 10)
  9009. {
  9010. dty += bottom - StrRect.bottom;
  9011. }
  9012. StrRect.bottom = bottom;
  9013. m_Print.DrawRect2(StrRect, 1);
  9014. }
  9015. if (1)
  9016. {
  9017. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  9018. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  9019. }
  9020. m_Print.SetFontFace(15, 1, "宋体");
  9021. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  9022. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9023. }
  9024. int curypos = 0;
  9025. int oldpos = 0;
  9026. if (bb == 1)
  9027. {
  9028. dty = -100;
  9029. oldpos = nPrintedPos;
  9030. if (oldpos == 0)oldpos = 10000;
  9031. }
  9032. m_Print.SetFontFace(9, 1, "宋体");
  9033. strarray.RemoveAll();
  9034. if ((oldpos != 10000 && oldpos < sparray2.GetSize()) || bb == 0)
  9035. {
  9036. strarray.Add("产品名称");
  9037. strarray.Add("数量");
  9038. strarray.Add("照片编号");
  9039. for (i = 18; i <= 20; i++)
  9040. {
  9041. StrRect = load.m_rcarray.ElementAt(i - 1);
  9042. StrRect.top += dty;
  9043. StrRect.bottom += dty;
  9044. m_Print.DrawRect2(StrRect, 1);
  9045. StrRect.left += 2;
  9046. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9047. StrRect.left -= 2;
  9048. StrRect.top = StrRect.bottom;
  9049. StrRect.bottom += 18;
  9050. rc2array.Add(StrRect);
  9051. }
  9052. }
  9053. for (i = oldpos; i < sparray2.GetSize(); i += 3)
  9054. {
  9055. rcarray.RemoveAll();
  9056. strarray2.RemoveAll();
  9057. for ( j = 0; j < 3; j++)
  9058. {
  9059. StrRect = rc2array.ElementAt(j);
  9060. StrRect.left += 2;
  9061. StrRect.right -= 2;
  9062. StrRect.top += 2;
  9063. rcarray.Add(StrRect);
  9064. #if JEFF_TEST_ON
  9065. if (2 == j)
  9066. {
  9067. CString strImg = sparray2.ElementAt(i + 2);
  9068. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  9069. if (nImgCount != 0)
  9070. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  9071. else if (!strImg.IsEmpty())
  9072. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  9073. strarray2.Add(strImg);
  9074. }
  9075. else
  9076. strarray2.Add(sparray2.ElementAt(i + j));
  9077. #else
  9078. strarray2.Add(sparray2.ElementAt(i + j));
  9079. #endif
  9080. }
  9081. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9082. rcarray.RemoveAll();
  9083. for (j = 0; j < 3; j++)
  9084. {
  9085. StrRect = rc2array.ElementAt(j);
  9086. if (j == 0)
  9087. {
  9088. dty += bottom - StrRect.bottom;
  9089. }
  9090. StrRect.bottom = bottom;
  9091. m_Print.DrawRect2(StrRect, 1);
  9092. curypos = StrRect.bottom;
  9093. StrRect.top = StrRect.bottom;
  9094. StrRect.bottom += 18;
  9095. rcarray.Add(StrRect);
  9096. }
  9097. rc2array.RemoveAll();
  9098. rc2array.Copy(rcarray);
  9099. if (bottom > 750)
  9100. {
  9101. bSecondPage = 1;
  9102. nPrintedPos = i + 3;
  9103. break;
  9104. }
  9105. }
  9106. if ((bb == 0 && bSecondPage == 0) || (bb == 1 && bSecondPage == 1))
  9107. {
  9108. m_Print.SetFontFace(15, 1, "宋体");
  9109. StrRect = load.m_rcarray.ElementAt(20);
  9110. dty = curypos - StrRect.bottom + 35;
  9111. StrRect.top += dty;
  9112. StrRect.bottom += dty;
  9113. if (StrRect.bottom > 700 && bb == 0)
  9114. {
  9115. bSecondPage = 1;
  9116. }
  9117. else
  9118. {
  9119. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9120. m_Print.SetFontFace(9, 1, "宋体");
  9121. rcarray.RemoveAll();
  9122. strarray2.RemoveAll();
  9123. StrRect = load.m_rcarray.ElementAt(21);
  9124. StrRect.top += dty;
  9125. StrRect.bottom += dty;
  9126. StrRect.left += 2;
  9127. StrRect.right -= 2;
  9128. StrRect.top += 2;
  9129. rcarray.Add(StrRect);
  9130. #if JEFF_TEST_ON
  9131. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9132. strarray2.RemoveAll();
  9133. CString strFind = "要求:";
  9134. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  9135. do
  9136. {
  9137. int nIndex = strbz3.Find(strFind, 1);
  9138. if (nIndex != -1)
  9139. {
  9140. CString strbz = strbz3.Left(nIndex);
  9141. strbz3 = strbz3.Mid(nIndex);
  9142. strarray2.Add(strbz);
  9143. }
  9144. else
  9145. {
  9146. strarray2.Add(strbz3);
  9147. strbz3 = "";
  9148. }
  9149. } while (strbz3.Find(strFind) != -1);
  9150. strarray2.Add(g_List1array.ElementAt(0).ElementAt(29));
  9151. strarray2.Add(g_List1array.ElementAt(0).ElementAt(23));
  9152. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  9153. #else
  9154. strarray2.Add(m_bz);
  9155. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9156. #endif
  9157. StrRect = load.m_rcarray.ElementAt(21);
  9158. StrRect.top += dty;
  9159. StrRect.bottom += dty;
  9160. dty += bottom - StrRect.bottom;
  9161. StrRect.bottom = bottom;
  9162. m_Print.DrawRect2(StrRect, 1);
  9163. curypos = StrRect.bottom;
  9164. m_Print.SetFontFace(10, 1, "宋体");
  9165. StrRect = load.m_rcarray.ElementAt(22);
  9166. dty = curypos - StrRect.bottom + 25;
  9167. StrRect.top += dty;
  9168. StrRect.bottom += dty;
  9169. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  9170. if (m_edit9.IsEmpty())
  9171. {
  9172. m_edit9 = "\
  9173. 经确认后的照片均排入制作流程,\r\n\
  9174. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9175. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9176. }
  9177. CString info1, info2, info3;
  9178. int newlinepos = m_edit9.Find("\r\n");
  9179. if (newlinepos != -1)
  9180. {
  9181. info1 = m_edit9.Left(newlinepos);
  9182. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9183. }
  9184. newlinepos = m_edit9.Find("\r\n");
  9185. if (newlinepos != -1)
  9186. {
  9187. info2 = m_edit9.Left(newlinepos);
  9188. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9189. info3 = m_edit9;
  9190. }
  9191. #ifdef QCH_VERSION
  9192. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9193. StrRect = load.m_rcarray.ElementAt(23);
  9194. StrRect.top += dty; StrRect.bottom += dty;
  9195. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9196. StrRect=load.m_rcarray .ElementAt (24);
  9197. StrRect.top +=dty;StrRect.bottom +=dty;
  9198. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9199. StrRect.top +=15;
  9200. StrRect.bottom +=15;
  9201. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9202. #else
  9203. if (1)
  9204. {
  9205. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9206. StrRect = load.m_rcarray.ElementAt(23);
  9207. StrRect.top += dty; StrRect.bottom += dty;
  9208. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9209. StrRect = load.m_rcarray.ElementAt(24);
  9210. StrRect.top += dty; StrRect.bottom += dty;
  9211. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9212. }
  9213. else
  9214. {
  9215. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9216. StrRect = load.m_rcarray.ElementAt(23);
  9217. StrRect.top += dty; StrRect.bottom += dty;
  9218. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9219. StrRect = load.m_rcarray.ElementAt(24);
  9220. StrRect.top += dty; StrRect.bottom += dty;
  9221. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9222. }
  9223. StrRect.top += 15;
  9224. StrRect.bottom += 15;
  9225. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9226. #endif
  9227. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  9228. StrRect = load.m_rcarray.ElementAt(25);
  9229. StrRect.top += dty - dy;
  9230. StrRect.bottom += dty - dy;
  9231. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9232. StrRect = load.m_rcarray.ElementAt(26);
  9233. StrRect.top += dty - dy;
  9234. StrRect.bottom += dty - dy;
  9235. m_Print.DrawRect2(StrRect, 2);
  9236. StrRect = load.m_rcarray.ElementAt(25);
  9237. StrRect.top += dty + 15 - dy;
  9238. StrRect.bottom += dty + 15 - dy;
  9239. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9240. StrRect = load.m_rcarray.ElementAt(26);
  9241. StrRect.top += dty + 15 - dy;
  9242. StrRect.bottom += dty + 15 - dy;
  9243. m_Print.DrawRect2(StrRect, 2);
  9244. StrRect = load.m_rcarray.ElementAt(25);
  9245. StrRect.top += dty + 15 * 2 - dy;
  9246. StrRect.bottom += dty + 15 * 2 - dy;
  9247. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9248. StrRect = load.m_rcarray.ElementAt(26);
  9249. StrRect.top += dty + 15 * 2 - dy;
  9250. StrRect.bottom += dty + 15 * 2 - dy;
  9251. m_Print.DrawRect2(StrRect, 2);
  9252. }
  9253. }
  9254. PrintPreview dlg; dlg.m_mode = 2;
  9255. dlg.m_name = name;
  9256. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  9257. dlg.m_pDC = m_Print.GetPDC();
  9258. if (aa == 0)
  9259. {
  9260. if (dlg.DoModal() != IDOK)
  9261. return;
  9262. printcot = dlg.m_num;
  9263. }
  9264. //结束打印
  9265. m_Print.EndPage();
  9266. m_Print.EndPrint();
  9267. }
  9268. }
  9269. }
  9270. void CMainFrame::PrintFlowChart3_20151116(CString strOrderNumber) // 选片打单 风格2;
  9271. {
  9272. #ifdef LKAY_VERSION
  9273. PrintFlowChart3LKAY(strOrderNumber);
  9274. return;
  9275. #endif
  9276. int i = 0;
  9277. int j = 0;
  9278. int printcot = 1;
  9279. for (int aa = 0; aa < printcot; aa++)
  9280. {
  9281. BOOL bSecondPage = 0;
  9282. int nPrintedPos = 0;
  9283. for (int bb = 0; bb < 3; bb++)
  9284. {
  9285. if (bb && bSecondPage == 0)break;
  9286. CPrintRX m_Print;
  9287. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58))) // 58-[version].[setcheck1] ==1,使用默认打印机;
  9288. {
  9289. m_Print.InitToPrint(NULL, 1);
  9290. }
  9291. else // 否则使用指定的打印机;
  9292. {
  9293. CString name = g_cominfoarray.ElementAt(0).ElementAt(64); // 64-[version].[printer2] 制作单打印机;
  9294. if (name.IsEmpty())
  9295. m_Print.InitToPrint(NULL, 1);
  9296. else
  9297. {
  9298. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9299. if (nret == -1 && aa == 0)
  9300. {
  9301. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9302. }
  9303. }
  9304. }
  9305. m_Print.StartPrint();
  9306. m_Print.StartPage();
  9307. LoadRect load;
  9308. load.SetLiaPath("18.lia");
  9309. load.SetMargins(10, 0);
  9310. if (!load.Load())return;
  9311. CString str;
  9312. int rcpos = -1;
  9313. // ■■■■■■从18.lia获取到第一个区域大小 - 1.显示店名;
  9314. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  9315. if ((bb == 0 && bSecondPage == 0))
  9316. {
  9317. m_Print.SetFontFace(25, 1, "宋体");
  9318. // 10-[version].[info1] 店名;
  9319. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9320. m_Print.SetFontFace(15, 1, "宋体");
  9321. // ■■■■■■从18.lia获取第二个区域大小 - 2.显示"基本资料";
  9322. StrRect = load.m_rcarray.ElementAt(++rcpos);
  9323. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9324. m_Print.SetFontFace(9, 1, "宋体");
  9325. }
  9326. //////////////////////////////////////////////////////////////////////////
  9327. // 获取打印所需要的数据,并布局好;
  9328. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  9329. g_sendhead.code[0] = 54; // dindan;
  9330. g_sendhead.code[1] = 223; // dindanspview2; shangpin+dindansp;
  9331. g_sendhead.code[2] = 52; // client;
  9332. g_sendhead.tabcount = 3;
  9333. g_sendhead.bsql = 0;
  9334. g_pMainWnd->ProcessChatMessageRequest2(filter);
  9335. if (g_bSendOK == 0)return;
  9336. CArray<CStringArray, CStringArray>sparray;
  9337. CArray<CStringArray, CStringArray>clientarray;
  9338. DataToArray(&g_List1array, &sparray, &clientarray);
  9339. CString spno;
  9340. CStringArray sparray2;
  9341. for ( i = 0; i < sparray.GetSize(); i++)
  9342. {
  9343. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  9344. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  9345. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  9346. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9347. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  9348. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9349. sparray2.Add(sparray.ElementAt(i).ElementAt(5)); // 商品名称;
  9350. sparray2.Add(sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  9351. sparray2.Add(sparray.ElementAt(i).ElementAt(6)); // 选中的相片串;
  9352. sparray2.Add(sparray.ElementAt(i).ElementAt(10)); // 商品备注;
  9353. }
  9354. for (i = 0; i < sparray.GetSize(); i++)
  9355. {
  9356. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  9357. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  9358. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  9359. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9360. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  9361. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9362. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+"); // 商品名称;
  9363. sparray2.Add(sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  9364. sparray2.Add(sparray.ElementAt(i).ElementAt(6)); // 选中的相片串;
  9365. sparray2.Add(sparray.ElementAt(i).ElementAt(10)); // 商品备注;
  9366. }
  9367. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  9368. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  9369. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  9370. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  9371. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  9372. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  9373. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  9374. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  9375. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  9376. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  9377. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  9378. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  9379. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  9380. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  9381. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  9382. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  9383. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  9384. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  9385. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9386. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  9387. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  9388. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  9389. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  9390. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  9391. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  9392. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  9393. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  9394. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  9395. CString m_sum3;
  9396. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  9397. ::ConvertToPrice(m_sum3);
  9398. if (m_money3.IsEmpty())m_money3 = "0";
  9399. int dty = 0;
  9400. CString name;
  9401. if (!m_name1.IsEmpty())
  9402. name = m_name1 + ",";
  9403. name += m_name2;
  9404. name.TrimRight(",");
  9405. CString phone;
  9406. if (!m_phone1.IsEmpty())
  9407. phone = m_phone1 + ",";
  9408. phone += m_phone2; phone.TrimRight(",");
  9409. if (IsHasRights2new(31) == 0)
  9410. phone = "***";
  9411. CStringArray strarray;
  9412. CArray<CRect, CRect>rcarray;
  9413. CStringArray strarray2; CArray<CRect, CRect>rc2array;
  9414. int bottom;
  9415. //////////////////////////////////////////////////////////////////////////
  9416. // 开始画打印DC;
  9417. if ((bb == 0 && bSecondPage == 0))
  9418. {
  9419. #ifdef CHILD_VERSION
  9420. if (m_birthday.IsEmpty())
  9421. strarray.Add("姓名/性别");
  9422. else
  9423. strarray.Add("姓名/性别/年龄");
  9424. #else
  9425. strarray.Add("客人姓名"); // 第3.1区域 -3.显示客人姓名;
  9426. #endif
  9427. strarray.Add("电话");
  9428. strarray.Add("单号");
  9429. strarray.Add("套系");
  9430. strarray.Add("选样");
  9431. strarray.Add("余款/加挑");
  9432. strarray.Add("选片/日期");
  9433. #ifdef CHILD_VERSION
  9434. if (m_birthday.IsEmpty())
  9435. strarray.Add(name + "/" + m_sex);
  9436. else
  9437. {
  9438. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  9439. m_birthday.Format("%d", year + 1);
  9440. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  9441. }
  9442. #else
  9443. strarray.Add(name); // 第4.1区域 -3.显示客人姓名;
  9444. #endif
  9445. strarray.Add(phone);
  9446. strarray.Add(strOrderNumber);
  9447. strarray.Add(m_taoxiname);
  9448. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9449. strarray.Add(str);
  9450. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  9451. strarray.Add(str);
  9452. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  9453. for (i = 3; i <= 16; i++)
  9454. {
  9455. // ■■■■■■从18.lia中获取第3~16的区域大小;
  9456. StrRect = load.m_rcarray.ElementAt(i - 1);
  9457. if (i < 10)
  9458. {
  9459. m_Print.DrawRect2(StrRect, 1);
  9460. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9461. }
  9462. }
  9463. // ■■■■■■从18.lia中获取第30的区域大小;
  9464. StrRect = load.m_rcarray.ElementAt(29);
  9465. m_Print.DrawRect2(StrRect, 1);
  9466. BOOL bPrintDate = 1;
  9467. #ifdef DDF_VERSION
  9468. // bPrintDate=0;
  9469. #else
  9470. if (m_time5 == "" && m_time6 == "")
  9471. bPrintDate = 0;
  9472. #endif
  9473. if (bPrintDate)
  9474. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9475. else
  9476. {
  9477. #ifdef CHILD_VERSION
  9478. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/引导", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9479. #else
  9480. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/化妆", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9481. #endif
  9482. }
  9483. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138))) // [version].[reverse3]
  9484. {
  9485. Image *pImg = NULL;
  9486. g_nSendCode = 31;
  9487. int g_nYearposTemp = g_nYearpos;
  9488. g_nYearpos = -1;
  9489. g_pMainWnd->ProcessChatMessageRequest2(1);
  9490. g_nYearpos = g_nYearposTemp;
  9491. g_nSendCode = 0;
  9492. if (g_bSendOK == 0)return;
  9493. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  9494. // Jeff二维码的区域不是从18.lia里获取的,是固定在右上角指定区域;
  9495. if (pImg)
  9496. {
  9497. StrRect.left = 485;
  9498. StrRect.top = 12;
  9499. StrRect.right = StrRect.left + 60;
  9500. StrRect.bottom = StrRect.top + 60;
  9501. m_Print.DrawImage(pImg, StrRect);
  9502. delete pImg; pImg = NULL;
  9503. }
  9504. }
  9505. // CArray<CRect,CRect>rcarray;
  9506. // CStringArray strarray2;
  9507. // ■■■■■■从18.lia中获取第10的区域大小;
  9508. for (i = 10; i <= 16; i++)
  9509. {
  9510. StrRect = load.m_rcarray.ElementAt(i - 1);
  9511. StrRect.left += 2;
  9512. StrRect.right -= 2;
  9513. StrRect.top += 2;
  9514. rcarray.Add(StrRect);
  9515. strarray2.Add(strarray.ElementAt(7 + i - 10));
  9516. }
  9517. if (1)
  9518. {
  9519. // ■■■■■■从18.lia中获取第31的区域大小;
  9520. StrRect = load.m_rcarray.ElementAt(30);
  9521. StrRect.left += 2;
  9522. StrRect.right -= 2;
  9523. StrRect.top += 2;
  9524. rcarray.Add(StrRect);
  9525. if (bPrintDate)
  9526. strarray2.Add(m_time6 + "/" + m_time5);
  9527. else
  9528. {
  9529. strarray2.Add(m_waiter1 + "/" + m_waiter2);
  9530. }
  9531. }
  9532. int bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  9533. for (i = 10; i <= 16; i++)
  9534. {
  9535. StrRect = load.m_rcarray.ElementAt(i - 1);
  9536. if (i == 10)
  9537. {
  9538. dty += bottom - StrRect.bottom;
  9539. }
  9540. StrRect.bottom = bottom;
  9541. m_Print.DrawRect2(StrRect, 1);
  9542. }
  9543. if (1)
  9544. {
  9545. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  9546. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  9547. }
  9548. m_Print.SetFontFace(15, 1, "宋体");
  9549. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  9550. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9551. }
  9552. int curypos = 0;
  9553. int oldpos = 0;
  9554. if (bb == 1)
  9555. {
  9556. dty = -100;
  9557. oldpos = nPrintedPos;
  9558. if (oldpos == 0)oldpos = 10000;
  9559. }
  9560. m_Print.SetFontFace(9, 1, "宋体");
  9561. strarray.RemoveAll();
  9562. if ((oldpos != 10000 && oldpos < sparray2.GetSize()) || bb == 0)
  9563. {
  9564. strarray.Add("产品名称");
  9565. strarray.Add("数量");
  9566. strarray.Add("照片编号");
  9567. strarray.Add(_T("备注"));
  9568. CRect mycr[4] = {
  9569. CRect(39,172,130,189), // 产品名称;
  9570. CRect(130,172,157,189), // 产品数量;
  9571. CRect(157,172,407,189), // 相片;
  9572. CRect(407,172,546,189) // 备注;
  9573. };
  9574. for (i = 0; i <= 3; i++)
  9575. {
  9576. StrRect = mycr[i];
  9577. StrRect.top += dty;
  9578. StrRect.bottom += dty;
  9579. m_Print.DrawRect2(StrRect, 1);
  9580. StrRect.left += 2;
  9581. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9582. StrRect.left -= 2;
  9583. StrRect.top = StrRect.bottom;
  9584. StrRect.bottom += 18;
  9585. rc2array.Add(StrRect);
  9586. }
  9587. }
  9588. for (i = oldpos; i < sparray2.GetSize(); i += 4)
  9589. {
  9590. rcarray.RemoveAll();
  9591. strarray2.RemoveAll();
  9592. for ( j = 0; j < 4; j++)
  9593. {
  9594. StrRect = rc2array.ElementAt(j);
  9595. StrRect.left += 2;
  9596. StrRect.right -= 2;
  9597. StrRect.top += 2;
  9598. rcarray.Add(StrRect);
  9599. #if JEFF_TEST_ON
  9600. if (2 == j)
  9601. {
  9602. CString strImg = sparray2.ElementAt(i + 2);
  9603. //int nImgCount = strImg.Replace(",", ",");
  9604. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  9605. if (nImgCount != 0)
  9606. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  9607. else if (!strImg.IsEmpty())
  9608. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  9609. strarray2.Add(strImg);
  9610. }
  9611. else
  9612. strarray2.Add(sparray2.ElementAt(i + j));
  9613. #else
  9614. strarray2.Add(sparray2.ElementAt(i + j));
  9615. #endif
  9616. }
  9617. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9618. rcarray.RemoveAll();
  9619. for (j = 0; j < 4; j++)
  9620. {
  9621. StrRect = rc2array.ElementAt(j);
  9622. if (j == 0)
  9623. {
  9624. dty += bottom - StrRect.bottom;
  9625. }
  9626. StrRect.bottom = bottom;
  9627. m_Print.DrawRect2(StrRect, 1);
  9628. curypos = StrRect.bottom;
  9629. StrRect.top = StrRect.bottom;
  9630. StrRect.bottom += 18;
  9631. rcarray.Add(StrRect);
  9632. }
  9633. rc2array.RemoveAll();
  9634. rc2array.Copy(rcarray);
  9635. if (bottom > 750)
  9636. {
  9637. bSecondPage = 1;
  9638. nPrintedPos = i + 3;
  9639. break;
  9640. }
  9641. }
  9642. if ((bb == 0 && bSecondPage == 0) || (bb == 1 && bSecondPage == 1))
  9643. {
  9644. m_Print.SetFontFace(15, 1, "宋体");
  9645. StrRect = load.m_rcarray.ElementAt(20);
  9646. dty = curypos - StrRect.bottom + 35;
  9647. StrRect.top += dty;
  9648. StrRect.bottom += dty;
  9649. if (StrRect.bottom > 700 && bb == 0)
  9650. {
  9651. bSecondPage = 1;
  9652. }
  9653. else
  9654. {
  9655. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9656. m_Print.SetFontFace(9, 1, "宋体");
  9657. rcarray.RemoveAll();
  9658. strarray2.RemoveAll();
  9659. StrRect = load.m_rcarray.ElementAt(21);
  9660. StrRect.top += dty;
  9661. StrRect.bottom += dty;
  9662. StrRect.left += 2;
  9663. StrRect.right -= 2;
  9664. StrRect.top += 2;
  9665. rcarray.Add(StrRect);
  9666. #if JEFF_TEST_ON
  9667. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9668. strarray2.RemoveAll();
  9669. CString strFind = "要求:";
  9670. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  9671. do
  9672. {
  9673. int nIndex = strbz3.Find(strFind, 1);
  9674. if (nIndex != -1)
  9675. {
  9676. CString strbz = strbz3.Left(nIndex);
  9677. strbz3 = strbz3.Mid(nIndex);
  9678. strarray2.Add(strbz);
  9679. }
  9680. else
  9681. {
  9682. strarray2.Add(strbz3);
  9683. strbz3 = "";
  9684. }
  9685. } while (strbz3.Find(strFind) != -1);
  9686. strarray2.Add(g_List1array.ElementAt(0).ElementAt(29));
  9687. strarray2.Add(g_List1array.ElementAt(0).ElementAt(23));
  9688. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  9689. #else
  9690. strarray2.Add(m_bz);
  9691. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9692. #endif
  9693. StrRect = load.m_rcarray.ElementAt(21);
  9694. StrRect.top += dty;
  9695. StrRect.bottom += dty;
  9696. dty += bottom - StrRect.bottom;
  9697. StrRect.bottom = bottom;
  9698. m_Print.DrawRect2(StrRect, 1);
  9699. curypos = StrRect.bottom;
  9700. m_Print.SetFontFace(10, 1, "宋体");
  9701. StrRect = load.m_rcarray.ElementAt(22);
  9702. dty = curypos - StrRect.bottom + 25;
  9703. StrRect.top += dty;
  9704. StrRect.bottom += dty;
  9705. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  9706. if (m_edit9.IsEmpty())
  9707. {
  9708. m_edit9 = "\
  9709. 经确认后的照片均排入制作流程,\r\n\
  9710. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9711. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9712. }
  9713. CString info1, info2, info3;
  9714. int newlinepos = m_edit9.Find("\r\n");
  9715. if (newlinepos != -1)
  9716. {
  9717. info1 = m_edit9.Left(newlinepos);
  9718. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9719. }
  9720. newlinepos = m_edit9.Find("\r\n");
  9721. if (newlinepos != -1)
  9722. {
  9723. info2 = m_edit9.Left(newlinepos);
  9724. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9725. info3 = m_edit9;
  9726. }
  9727. #ifdef QCH_VERSION
  9728. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9729. StrRect = load.m_rcarray.ElementAt(23);
  9730. StrRect.top += dty; StrRect.bottom += dty;
  9731. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9732. StrRect=load.m_rcarray .ElementAt (24);
  9733. StrRect.top +=dty;StrRect.bottom +=dty;
  9734. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9735. StrRect.top +=15;
  9736. StrRect.bottom +=15;
  9737. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9738. #else
  9739. if (1)
  9740. {
  9741. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9742. StrRect = load.m_rcarray.ElementAt(23);
  9743. StrRect.top += dty; StrRect.bottom += dty;
  9744. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9745. StrRect = load.m_rcarray.ElementAt(24);
  9746. StrRect.top += dty; StrRect.bottom += dty;
  9747. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9748. }
  9749. else
  9750. {
  9751. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9752. StrRect = load.m_rcarray.ElementAt(23);
  9753. StrRect.top += dty; StrRect.bottom += dty;
  9754. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9755. StrRect = load.m_rcarray.ElementAt(24);
  9756. StrRect.top += dty; StrRect.bottom += dty;
  9757. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9758. }
  9759. StrRect.top += 15;
  9760. StrRect.bottom += 15;
  9761. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9762. #endif
  9763. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  9764. StrRect = load.m_rcarray.ElementAt(25);
  9765. StrRect.top += dty - dy;
  9766. StrRect.bottom += dty - dy;
  9767. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9768. StrRect = load.m_rcarray.ElementAt(26);
  9769. StrRect.top += dty - dy;
  9770. StrRect.bottom += dty - dy;
  9771. m_Print.DrawRect2(StrRect, 2);
  9772. StrRect = load.m_rcarray.ElementAt(25);
  9773. StrRect.top += dty + 15 - dy;
  9774. StrRect.bottom += dty + 15 - dy;
  9775. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9776. StrRect = load.m_rcarray.ElementAt(26);
  9777. StrRect.top += dty + 15 - dy;
  9778. StrRect.bottom += dty + 15 - dy;
  9779. m_Print.DrawRect2(StrRect, 2);
  9780. StrRect = load.m_rcarray.ElementAt(25);
  9781. StrRect.top += dty + 15 * 2 - dy;
  9782. StrRect.bottom += dty + 15 * 2 - dy;
  9783. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9784. StrRect = load.m_rcarray.ElementAt(26);
  9785. StrRect.top += dty + 15 * 2 - dy;
  9786. StrRect.bottom += dty + 15 * 2 - dy;
  9787. m_Print.DrawRect2(StrRect, 2);
  9788. }
  9789. }
  9790. PrintPreview dlg; dlg.m_mode = 2;
  9791. dlg.m_name = name;
  9792. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  9793. dlg.m_pDC = m_Print.GetPDC();
  9794. if (aa == 0)
  9795. {
  9796. if (dlg.DoModal() != IDOK)
  9797. return;
  9798. printcot = dlg.m_num;
  9799. }
  9800. //结束打印
  9801. m_Print.EndPage();
  9802. m_Print.EndPrint();
  9803. }
  9804. }
  9805. }
  9806. //void CMainFrame::PrintFlowChart4(CString m_id) // 选设计打单函数;
  9807. void CMainFrame::PrintFlowChart4(CString strOrderNumber) // 选设计打单函数,使用18.lia文件;
  9808. {
  9809. int i = 0;
  9810. int j = 0;
  9811. int printcot = 1;
  9812. for (int aa = 0; aa < printcot; aa++)
  9813. {
  9814. CPrintRX m_Print;
  9815. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  9816. {
  9817. m_Print.InitToPrint(NULL, 1);
  9818. }
  9819. else
  9820. {
  9821. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  9822. if (name.IsEmpty())
  9823. m_Print.InitToPrint(NULL, 1);
  9824. else
  9825. {
  9826. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9827. if (nret == -1 && aa == 0)
  9828. {
  9829. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9830. }
  9831. }
  9832. }
  9833. m_Print.StartPrint();
  9834. m_Print.StartPage();
  9835. LoadRect load;
  9836. load.SetLiaPath("18.lia");
  9837. load.SetMargins(10, 0);
  9838. if (!load.Load())return;
  9839. CString str;
  9840. int rcpos = -1;
  9841. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  9842. m_Print.SetFontFace(25, 1, "宋体");
  9843. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9844. m_Print.SetFontFace(15, 1, "宋体");
  9845. StrRect = load.m_rcarray.ElementAt(++rcpos);
  9846. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9847. m_Print.SetFontFace(9, 1, "宋体");
  9848. //////////////////////////////////////////////////////////////
  9849. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  9850. g_sendhead.code[0] = 54;
  9851. g_sendhead.code[1] = 223;
  9852. g_sendhead.code[2] = 52;
  9853. g_sendhead.tabcount = 3;
  9854. g_sendhead.bsql = 0;
  9855. g_pMainWnd->ProcessChatMessageRequest2(filter);
  9856. if (g_bSendOK == 0)return;
  9857. CArray<CStringArray, CStringArray>sparray;
  9858. CArray<CStringArray, CStringArray>clientarray;
  9859. DataToArray(&g_List1array, &sparray, &clientarray);
  9860. CString spno;
  9861. CStringArray sparray2;
  9862. for ( i = 0; i < sparray.GetSize(); i++)
  9863. {
  9864. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  9865. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(8).IsEmpty())continue;
  9866. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9867. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9868. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  9869. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9870. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9871. }
  9872. for (i = 0; i < sparray.GetSize(); i++)
  9873. {
  9874. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  9875. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  9876. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  9877. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9878. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9879. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  9880. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9881. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9882. }
  9883. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  9884. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  9885. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  9886. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  9887. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  9888. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  9889. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  9890. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  9891. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  9892. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  9893. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  9894. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  9895. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  9896. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  9897. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  9898. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  9899. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  9900. CString m_bz = g_List1array.ElementAt(0).ElementAt(17);
  9901. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(25);
  9902. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  9903. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  9904. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  9905. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  9906. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  9907. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  9908. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  9909. CString m_waiter8 = g_List1array.ElementAt(0).ElementAt(27);
  9910. CString m_replace = g_List1array.ElementAt(0).ElementAt(28);
  9911. if (!m_replace.IsEmpty())
  9912. {
  9913. m_replace = "设计替换照片:" + m_replace;
  9914. m_replace.Replace("$", ";");
  9915. m_replace.TrimLeft(";");
  9916. m_bz += ";";
  9917. m_bz += m_replace;
  9918. }
  9919. CString m_sum3;
  9920. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  9921. ::ConvertToPrice(m_sum3);
  9922. if (m_money3.IsEmpty())m_money3 = "0";
  9923. int dty = 0;
  9924. CString name;
  9925. if (!m_name1.IsEmpty())
  9926. name = m_name1 + ",";
  9927. name += m_name2;
  9928. name.TrimRight(",");
  9929. CString phone;
  9930. if (!m_phone1.IsEmpty())
  9931. phone = m_phone1 + ",";
  9932. phone += m_phone2; phone.TrimRight(",");
  9933. if (IsHasRights2new(31) == 0)
  9934. phone = "***";
  9935. CStringArray strarray;
  9936. #ifdef CHILD_VERSION
  9937. if (m_birthday.IsEmpty())
  9938. strarray.Add("姓名/性别");
  9939. else
  9940. strarray.Add("姓名/性别/年龄");
  9941. #else
  9942. strarray.Add("客人姓名");
  9943. #endif
  9944. strarray.Add("电话");
  9945. strarray.Add("单号");
  9946. strarray.Add("套系");
  9947. strarray.Add("");
  9948. strarray.Add("余款/加挑");
  9949. strarray.Add("看设计/日期");
  9950. #ifdef CHILD_VERSION
  9951. if (m_birthday.IsEmpty())
  9952. strarray.Add(name + "/" + m_sex);
  9953. else
  9954. {
  9955. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  9956. m_birthday.Format("%d", year + 1);
  9957. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  9958. }
  9959. #else
  9960. strarray.Add(name);
  9961. #endif
  9962. strarray.Add(phone);
  9963. strarray.Add(strOrderNumber);
  9964. strarray.Add(m_taoxiname);
  9965. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9966. strarray.Add("");
  9967. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  9968. strarray.Add(str);
  9969. strarray.Add(m_waiter8 + "/" + m_time6);
  9970. //////////////////////////////////////////////
  9971. if (1)
  9972. {
  9973. StrRect = load.m_rcarray.ElementAt(6);
  9974. int addwid = StrRect.Width() / 6;
  9975. for (i = 3; i <= 6; i++)
  9976. {
  9977. StrRect = load.m_rcarray.ElementAt(i - 1);
  9978. StrRect.left += (i - 3)*addwid;
  9979. StrRect.right += (i - 2)*addwid;
  9980. load.m_rcarray.SetAt(i - 1, StrRect);
  9981. }
  9982. StrRect.left = StrRect.right = -1;
  9983. load.m_rcarray.SetAt(6, StrRect);
  9984. for (i = 10; i <= 13; i++)
  9985. {
  9986. StrRect = load.m_rcarray.ElementAt(i - 1);
  9987. StrRect.left += (i - 10)*addwid;
  9988. StrRect.right += (i - 9)*addwid;
  9989. load.m_rcarray.SetAt(i - 1, StrRect);
  9990. }
  9991. StrRect.left = StrRect.right = -1;
  9992. load.m_rcarray.SetAt(13, StrRect);
  9993. StrRect = load.m_rcarray.ElementAt(7);
  9994. int rcwid = StrRect.Width();
  9995. StrRect.left = load.m_rcarray.ElementAt(5).right;
  9996. StrRect.right = StrRect.left + rcwid + addwid;
  9997. load.m_rcarray.SetAt(7, StrRect);
  9998. StrRect = load.m_rcarray.ElementAt(8);
  9999. StrRect.left = load.m_rcarray.ElementAt(7).right;
  10000. StrRect.right = load.m_rcarray.ElementAt(29).left;
  10001. load.m_rcarray.SetAt(8, StrRect);
  10002. StrRect = load.m_rcarray.ElementAt(14);
  10003. rcwid = StrRect.Width();
  10004. StrRect.left = load.m_rcarray.ElementAt(12).right;
  10005. StrRect.right = StrRect.left + rcwid + addwid;
  10006. load.m_rcarray.SetAt(14, StrRect);
  10007. StrRect = load.m_rcarray.ElementAt(15);
  10008. StrRect.left = load.m_rcarray.ElementAt(14).right;
  10009. StrRect.right = load.m_rcarray.ElementAt(29).left;
  10010. load.m_rcarray.SetAt(15, StrRect);
  10011. }
  10012. ////////////////////////////////////////////////
  10013. for (i = 3; i <= 16; i++)
  10014. {
  10015. StrRect = load.m_rcarray.ElementAt(i - 1);
  10016. if (i < 10)
  10017. {
  10018. m_Print.DrawRect2(StrRect, 1);
  10019. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10020. }
  10021. }
  10022. StrRect = load.m_rcarray.ElementAt(29);
  10023. m_Print.DrawRect2(StrRect, 1);
  10024. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10025. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  10026. {
  10027. Image *pImg = NULL;
  10028. g_nSendCode = 31;
  10029. int g_nYearposTemp = g_nYearpos;
  10030. g_nYearpos = -1;
  10031. g_pMainWnd->ProcessChatMessageRequest2(1);
  10032. g_nYearpos = g_nYearposTemp;
  10033. g_nSendCode = 0;
  10034. if (g_bSendOK == 0)return;
  10035. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  10036. if (pImg)
  10037. {
  10038. StrRect.left = 485;
  10039. StrRect.top = 12;
  10040. StrRect.right = StrRect.left + 60;
  10041. StrRect.bottom = StrRect.top + 60;
  10042. m_Print.DrawImage(pImg, StrRect);
  10043. delete pImg; pImg = NULL;
  10044. }
  10045. }
  10046. CArray<CRect, CRect>rcarray;
  10047. CStringArray strarray2;
  10048. for (i = 10; i <= 16; i++)
  10049. {
  10050. StrRect = load.m_rcarray.ElementAt(i - 1);
  10051. StrRect.left += 2;
  10052. StrRect.right -= 2;
  10053. StrRect.top += 2;
  10054. rcarray.Add(StrRect);
  10055. strarray2.Add(strarray.ElementAt(7 + i - 10));
  10056. }
  10057. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  10058. for (i = 10; i <= 16; i++)
  10059. {
  10060. StrRect = load.m_rcarray.ElementAt(i - 1);
  10061. if (i == 10)
  10062. {
  10063. dty += bottom - StrRect.bottom;
  10064. }
  10065. StrRect.bottom = bottom;
  10066. m_Print.DrawRect2(StrRect, 1);
  10067. }
  10068. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  10069. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  10070. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time5, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  10071. m_Print.SetFontFace(15, 1, "宋体");
  10072. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  10073. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10074. m_Print.SetFontFace(9, 1, "宋体");
  10075. strarray.RemoveAll();
  10076. strarray.Add("产品名称");
  10077. strarray.Add("数量");
  10078. strarray.Add("照片编号");
  10079. CArray<CRect, CRect>rc2array;
  10080. for (i = 18; i <= 20; i++)
  10081. {
  10082. StrRect = load.m_rcarray.ElementAt(i - 1); StrRect.top += dty; StrRect.bottom += dty;
  10083. m_Print.DrawRect2(StrRect, 1);
  10084. StrRect.left += 2;
  10085. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10086. StrRect.left -= 2;
  10087. StrRect.top = StrRect.bottom;
  10088. StrRect.bottom += 18;
  10089. rc2array.Add(StrRect);
  10090. }
  10091. int curypos = 0;
  10092. for (i = 0; i < sparray2.GetSize(); i += 3)
  10093. {
  10094. rcarray.RemoveAll();
  10095. strarray2.RemoveAll();
  10096. for ( j = 0; j < 3; j++)
  10097. {
  10098. StrRect = rc2array.ElementAt(j);
  10099. StrRect.left += 2;
  10100. StrRect.right -= 2;
  10101. StrRect.top += 2;
  10102. rcarray.Add(StrRect);
  10103. #if JEFF_TEST_ON
  10104. if (2 == j)
  10105. {
  10106. CString strImg = sparray2.ElementAt(i + 2);
  10107. //int nImgCount = strImg.Replace(",", ",");
  10108. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  10109. if (nImgCount != 0)
  10110. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  10111. else if (!strImg.IsEmpty())
  10112. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  10113. strarray2.Add(strImg);
  10114. }
  10115. else
  10116. strarray2.Add(sparray2.ElementAt(i + j));
  10117. #else
  10118. strarray2.Add(sparray2.ElementAt(i + j));
  10119. #endif
  10120. }
  10121. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  10122. rcarray.RemoveAll();
  10123. for (j = 0; j < 3; j++)
  10124. {
  10125. StrRect = rc2array.ElementAt(j);
  10126. if (j == 0)
  10127. {
  10128. dty += bottom - StrRect.bottom;
  10129. }
  10130. StrRect.bottom = bottom;
  10131. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  10132. StrRect.top = StrRect.bottom;
  10133. StrRect.bottom += 18;
  10134. rcarray.Add(StrRect);
  10135. }
  10136. rc2array.RemoveAll();
  10137. rc2array.Copy(rcarray);
  10138. }
  10139. m_Print.SetFontFace(15, 1, "宋体");
  10140. StrRect = load.m_rcarray.ElementAt(20);
  10141. dty = curypos - StrRect.bottom + 35;
  10142. StrRect.top += dty; StrRect.bottom += dty;
  10143. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10144. m_Print.SetFontFace(9, 1, "宋体");
  10145. rcarray.RemoveAll();
  10146. strarray2.RemoveAll();
  10147. StrRect = load.m_rcarray.ElementAt(21);
  10148. StrRect.top += dty;
  10149. StrRect.bottom += dty;
  10150. StrRect.left += 2;
  10151. StrRect.right -= 2;
  10152. StrRect.top += 2;
  10153. rcarray.Add(StrRect);
  10154. #if JEFF_TEST_ON
  10155. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  10156. strarray2.RemoveAll();
  10157. CString strFind = "要求:";
  10158. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  10159. do
  10160. {
  10161. int nIndex = strbz3.Find(strFind, 1);
  10162. if (nIndex != -1)
  10163. {
  10164. CString strbz = strbz3.Left(nIndex);
  10165. strbz3 = strbz3.Mid(nIndex);
  10166. strarray2.Add(strbz);
  10167. }
  10168. else
  10169. {
  10170. strarray2.Add(strbz3);
  10171. strbz3 = "";
  10172. }
  10173. } while (strbz3.Find(strFind) != -1);
  10174. strarray2.Add(g_List1array.ElementAt(0).ElementAt(25));
  10175. if (!m_replace.IsEmpty())
  10176. {
  10177. m_replace = "设计替换照片:" + m_replace;
  10178. m_replace.Replace("$", ";");
  10179. m_replace.TrimLeft(";");
  10180. }
  10181. strarray2.Add(m_replace);
  10182. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  10183. #else
  10184. strarray2.Add(m_bz);
  10185. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  10186. #endif
  10187. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  10188. dty += bottom - StrRect.bottom;
  10189. StrRect.bottom = bottom;
  10190. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  10191. m_Print.SetFontFace(10, 1, "宋体");
  10192. StrRect = load.m_rcarray.ElementAt(22);
  10193. dty = curypos - StrRect.bottom + 25;
  10194. StrRect.top += dty; StrRect.bottom += dty;
  10195. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  10196. if (m_edit9.IsEmpty())
  10197. {
  10198. m_edit9 = "\
  10199. 经确认后的照片均排入制作流程,\r\n\
  10200. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  10201. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  10202. }
  10203. CString info1, info2, info3;
  10204. int newlinepos = m_edit9.Find("\r\n");
  10205. if (newlinepos != -1)
  10206. {
  10207. info1 = m_edit9.Left(newlinepos);
  10208. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  10209. }
  10210. newlinepos = m_edit9.Find("\r\n");
  10211. if (newlinepos != -1)
  10212. {
  10213. info2 = m_edit9.Left(newlinepos);
  10214. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  10215. info3 = m_edit9;
  10216. }
  10217. if (1)
  10218. {
  10219. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10220. StrRect = load.m_rcarray.ElementAt(23);
  10221. StrRect.top += dty; StrRect.bottom += dty;
  10222. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10223. StrRect = load.m_rcarray.ElementAt(24);
  10224. StrRect.top += dty; StrRect.bottom += dty;
  10225. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10226. }
  10227. else
  10228. {
  10229. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10230. StrRect = load.m_rcarray.ElementAt(23);
  10231. StrRect.top += dty; StrRect.bottom += dty;
  10232. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10233. StrRect = load.m_rcarray.ElementAt(24);
  10234. StrRect.top += dty; StrRect.bottom += dty;
  10235. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10236. }
  10237. StrRect = load.m_rcarray.ElementAt(25);
  10238. StrRect.top += dty; StrRect.bottom += dty;
  10239. m_Print.DrawText((LPTSTR)(LPCTSTR)"贵宾签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10240. StrRect = load.m_rcarray.ElementAt(26);
  10241. StrRect.top += dty; StrRect.bottom += dty;
  10242. m_Print.DrawRect2(StrRect, 2);
  10243. m_Print.SetFontFace(9, 1, "宋体");
  10244. StrRect = load.m_rcarray.ElementAt(27);
  10245. StrRect.top += dty; StrRect.bottom += dty;
  10246. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10247. StrRect = load.m_rcarray.ElementAt(28);
  10248. StrRect.top += dty; StrRect.bottom += dty;
  10249. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10250. PrintPreview dlg;//dlg.m_mode=2;
  10251. dlg.m_name = name;
  10252. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  10253. dlg.m_pDC = m_Print.GetPDC();
  10254. if (aa == 0)
  10255. {
  10256. if (dlg.DoModal() != IDOK)
  10257. return;
  10258. printcot = dlg.m_num;
  10259. }
  10260. //结束打印
  10261. m_Print.EndPage();
  10262. m_Print.EndPrint();
  10263. }
  10264. }
  10265. /*
  10266. void CMainFrame::PrintFlowChart(CString m_id)
  10267. {
  10268. CPrintRX m_Print;
  10269. m_Print.InitToPrint(NULL, 1);
  10270. m_Print.StartPrint();
  10271. m_Print.StartPage();
  10272. // CRect StrRect(0,0,560,818);
  10273. LoadRect load;
  10274. load.SetLiaPath ("4.lia");
  10275. load.SetMargins(-14,-14);
  10276. if(!load.Load ())return;
  10277. LoadRect load2;
  10278. load2.SetMargins(-14,472+27-14);
  10279. load2.SetLiaPath ("5.lia");
  10280. if(!load2.Load ())return;
  10281. //////////////////////////////////////////////////////////////
  10282. CString filter="id='"+m_id+"';id='"+m_id+"'";
  10283. g_sendhead.code[0]=54;
  10284. g_sendhead.code[1]=50;
  10285. g_sendhead.tabcount=2;
  10286. g_sendhead.bsql=0;
  10287. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  10288. CArray<CStringArray, CStringArray>sparray;
  10289. DataToArray(&g_List1array,&sparray);
  10290. CString spno;
  10291. for(int i=0; i<sparray.GetSize (); i++)
  10292. {
  10293. if(sparray.ElementAt (i).ElementAt (4)=="4" && sparray.ElementAt (i).ElementAt (5)!="入册")continue;
  10294. if(sparray.ElementAt (i).ElementAt (5)=="入册"&&sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  10295. spno+=sparray.ElementAt (i).ElementAt (5);
  10296. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  10297. spno+=";";
  10298. else
  10299. {
  10300. spno+=":";
  10301. spno+=sparray.ElementAt (i).ElementAt (6);
  10302. spno+=";";
  10303. }
  10304. }
  10305. spno+=" 加挑:";
  10306. for( i=0; i<sparray.GetSize (); i++)
  10307. {
  10308. if(sparray.ElementAt (i).ElementAt (4)!="4")continue;
  10309. if(sparray.ElementAt (i).ElementAt (5)=="入册")continue;
  10310. spno+=sparray.ElementAt (i).ElementAt (5);
  10311. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  10312. spno+=";";
  10313. else
  10314. {
  10315. spno+=":";
  10316. spno+=sparray.ElementAt (i).ElementAt (6);
  10317. spno+=";";
  10318. }
  10319. }
  10320. if(spno.Right (6)==" 加挑:")
  10321. {
  10322. spno=spno.Left (spno.GetLength ()-6);
  10323. }
  10324. CString m_name1 = g_List1array.ElementAt (0).ElementAt (1);
  10325. CString m_name2 = g_List1array.ElementAt (0).ElementAt (2);
  10326. CString m_phone1=g_List1array.ElementAt (0).ElementAt (3);
  10327. CString m_phone2=g_List1array.ElementAt (0).ElementAt (4);
  10328. CString m_urgent=g_List1array.ElementAt (0).ElementAt (5);
  10329. if(m_urgent.IsEmpty ())m_urgent="否";
  10330. CString m_time2 = g_List1array.ElementAt (0).ElementAt (6);
  10331. CString m_time4 = g_List1array.ElementAt (0).ElementAt (7);
  10332. CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  10333. CString m_takezs = g_List1array.ElementAt (0).ElementAt (9);
  10334. CString m_taoxizs = g_List1array.ElementAt (0).ElementAt (10);
  10335. CString m_choosezs = g_List1array.ElementAt (0).ElementAt (11);
  10336. CString m_ren = g_List1array.ElementAt (0).ElementAt (12);
  10337. CString m_waiter3 = g_List1array.ElementAt (0).ElementAt (13);
  10338. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (14);
  10339. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (15);
  10340. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (16);
  10341. CString m_bz = "客人要求: "+g_List1array.ElementAt (0).ElementAt (17);
  10342. CString m_money3 = g_List1array.ElementAt (0).ElementAt (18);
  10343. CString m_money1 = g_List1array.ElementAt (0).ElementAt (19);
  10344. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (20);
  10345. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (21);
  10346. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (22);
  10347. CString m_sum3;
  10348. m_sum3.Format ("%0.2f", atof(m_taoxijiage)+atof(m_payed4)-(atof(m_payed5)+atof(m_money1)));
  10349. ::ConvertToPrice (m_sum3);
  10350. if(m_money3.IsEmpty ())m_money3="0";
  10351. // m_money3=m_money3+"/"+m_sum3;
  10352. CString name;
  10353. if(!m_name1.IsEmpty ())
  10354. name=m_name1+",";
  10355. name+=m_name2;
  10356. name.TrimRight (",");
  10357. CString phone;
  10358. if(!m_phone1.IsEmpty ())
  10359. phone=m_phone1+",";
  10360. phone+=m_phone2;phone.TrimRight (",");
  10361. CStringArray strarray;
  10362. strarray.Add (m_urgent);
  10363. strarray.Add (m_ren);
  10364. strarray.Add (m_waiter3);
  10365. strarray.Add (name);
  10366. strarray.Add (m_time2);
  10367. strarray.Add (m_time4);
  10368. strarray.Add (m_time5);
  10369. strarray.Add (m_money3);
  10370. strarray.Add (m_takezs);
  10371. strarray.Add (m_taoxizs);
  10372. strarray.Add (m_choosezs);
  10373. strarray.Add (m_id);
  10374. strarray.Add (phone);
  10375. ////////////////////////////////////////////////////////////////
  10376. int rcpos=-1;
  10377. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  10378. Image *pImg=NULL;
  10379. #ifdef MNLS_VERSION
  10380. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG") );
  10381. #else
  10382. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  10383. #endif
  10384. m_Print.DrawImage(pImg, StrRect);
  10385. delete pImg;
  10386. m_Print.SetFontFace(15, 1, "宋体");
  10387. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10388. #ifdef MNLS_VERSION
  10389. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10390. #endif
  10391. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10392. #ifdef MNLS_VERSION
  10393. m_Print.DrawRect(StrRect);
  10394. #endif
  10395. m_Print.SetFontFace(7, 1, "黑体");
  10396. m_Print.SetColor(0xffffff);
  10397. #ifdef MNLS_VERSION
  10398. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10399. #endif
  10400. m_Print.SetColor(0);
  10401. m_Print.SetFontFace(25, 1, "黑体");
  10402. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10403. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10404. CString title[13]={"是否加急:","接单门市:","选样人员:","新郎新娘姓名:","拍照日期:","选片日期:","取件日期:","加挑/余款:","拍摄总张数:","应挑选张数:","额外加挑张数:","票号:","客户联系电话:"};
  10405. m_Print.SetFontFace(12, 1, "宋体");
  10406. for( i=0; i<13; i++)
  10407. {
  10408. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10409. if(i<3)
  10410. m_Print.DrawRect2(StrRect, 0);
  10411. else
  10412. m_Print.DrawRect2(StrRect, 1);
  10413. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10414. }
  10415. for( i=18; i<=37; i++)
  10416. {
  10417. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10418. if(i>=19&&i<=21)
  10419. m_Print.DrawRect2(StrRect, 2);
  10420. else if(i==26)
  10421. {
  10422. CRect rc=StrRect;
  10423. CRect rc2=rc;
  10424. rc.right -=rc2.Width ()/2;
  10425. m_Print.DrawRect2(rc, 1);
  10426. rc2.left +=rc.Width ();
  10427. m_Print.DrawRect2(rc2, 1);
  10428. }
  10429. else
  10430. m_Print.DrawRect2(StrRect, 1);
  10431. if(i==18)
  10432. {
  10433. StrRect.left +=5;
  10434. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10435. }
  10436. }
  10437. //////////////////////////////////////
  10438. rcpos=-1;
  10439. for( i=0; i<8; i++)
  10440. {
  10441. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10442. m_Print.DrawRect2(StrRect, 1);
  10443. }
  10444. CString title2[4]={"化妆师:","摄影师:","数码设计师:","顾客签名:"};
  10445. for( i=0; i<4; i++)
  10446. {
  10447. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10448. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10449. }
  10450. for( i=0; i<4; i++)
  10451. {
  10452. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10453. m_Print.DrawRect2(StrRect, 2);
  10454. }
  10455. ///////////////////////////////////////////
  10456. for( i=19; i<=31; i++)
  10457. {
  10458. StrRect=load.m_rcarray .ElementAt (i-1);
  10459. StrRect.left +=4;
  10460. if(i==31)
  10461. {
  10462. if(m_phone1.IsEmpty ()==0 && m_phone2.IsEmpty ()==0)
  10463. {
  10464. StrRect.top +=2;
  10465. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  10466. StrRect.top +=8;
  10467. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10468. }
  10469. else
  10470. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10471. }
  10472. else if((i-19)==7)
  10473. {
  10474. CRect rc=StrRect;
  10475. CRect rc2=rc;
  10476. rc.right -=rc2.Width ()/2;
  10477. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10478. rc2.left +=rc.Width ()+3;
  10479. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10480. }
  10481. else
  10482. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10483. }
  10484. strarray.RemoveAll ();
  10485. strarray.Add (m_waiter2);
  10486. strarray.Add (m_waiter1);
  10487. strarray.Add (m_waiter4);
  10488. for( i=13; i<=15; i++)
  10489. {
  10490. StrRect=load2.m_rcarray .ElementAt (i-1);
  10491. StrRect.left +=4;
  10492. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10493. }
  10494. ///////////spno
  10495. CRect sprc[14];
  10496. for(i=0; i<14; i++)
  10497. {
  10498. if(i<7)
  10499. {
  10500. if(i==0)
  10501. {
  10502. StrRect=load.m_rcarray .ElementAt (17);StrRect.left +=94;StrRect.right -=3;
  10503. }
  10504. else
  10505. {
  10506. StrRect=load.m_rcarray .ElementAt (30+i);StrRect.left +=4;StrRect.right -=3;
  10507. }
  10508. }
  10509. else
  10510. {
  10511. StrRect=load2.m_rcarray .ElementAt (i-7);StrRect.left +=4;StrRect.right -=3;
  10512. }
  10513. sprc[i]=StrRect;
  10514. // m_Print.DrawText((LPTSTR)(LPCTSTR)"xxx", sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10515. }
  10516. CString temp,tempspno,tempbz;
  10517. CSize size;
  10518. BOOL bRun=0;
  10519. int fontsize=12;
  10520. ll: tempspno=spno;
  10521. tempbz=m_bz;
  10522. m_Print.SetFontFace(fontsize, 1, "宋体");
  10523. for( i=0; i<14; i++)
  10524. {
  10525. if(!tempspno.IsEmpty ())
  10526. {
  10527. temp=tempspno;
  10528. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10529. int right=0;
  10530. CRect temprc=sprc[i];
  10531. while(size.cx>temprc.Width ())
  10532. {
  10533. right++;
  10534. temp=tempspno.Left (tempspno.GetLength ()-(right));
  10535. if(GIsHalfHZ(temp))
  10536. {
  10537. right++;
  10538. temp.Delete (temp.GetLength ()-1);
  10539. }
  10540. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10541. }
  10542. if(bRun)
  10543. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10544. tempspno=tempspno.Right (tempspno.GetLength ()-temp.GetLength ());
  10545. if(tempspno.IsEmpty ())i++;
  10546. }
  10547. else if(!tempbz.IsEmpty ())
  10548. {
  10549. temp=tempbz;
  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=tempbz.Left (tempbz.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. tempbz=tempbz.Right (tempbz.GetLength ()-temp.GetLength ());
  10567. }
  10568. }
  10569. if(tempspno.IsEmpty ()==0 || tempbz.IsEmpty ()==0)
  10570. {
  10571. fontsize--;
  10572. goto ll;
  10573. }
  10574. if(bRun==0)
  10575. {
  10576. bRun=1;
  10577. goto ll;
  10578. }
  10579. PrintPreview dlg;
  10580. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  10581. dlg.m_pDC =m_Print.GetPDC() ;
  10582. if(dlg.DoModal ()!=IDOK)return;
  10583. //结束打印
  10584. m_Print.EndPage();
  10585. m_Print.EndPrint();
  10586. }
  10587. void CMainFrame::SetSelFolder(int pos)
  10588. {
  10589. m_wndToolBar2.SetSelFolder(pos);
  10590. }*/
  10591. void CMainFrame::ToPhotoPrint()
  10592. {
  10593. UINT nID = 1;
  10594. LPSTR pName;
  10595. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  10596. OPEN_MENU(PhotoPrintFrom);
  10597. }
  10598. void CMainFrame::GetOcx()
  10599. {
  10600. char path[MAX_PATH];
  10601. ::GetSystemDirectory(path, MAX_PATH);
  10602. CString syspath = path;
  10603. try
  10604. {
  10605. if (!::PathFileExists(syspath + "\\MSCHRT20.OCX"))
  10606. {
  10607. g_sendhead.bsql = 0;
  10608. g_sendhead.code[0] = 103;
  10609. g_sendhead.tabcount = 1;
  10610. g_pMainWnd->ProcessChatMessageRequest2(1); if (g_bSendOK == 0)return;
  10611. CFile fp;
  10612. if (fp.Open(syspath + "\\MSCHRT20.OCX", CFile::modeWrite | CFile::modeCreate))
  10613. {
  10614. fp.Write(g_pData, g_nLeng);
  10615. fp.Close();
  10616. ::Sleep(1000);
  10617. }
  10618. }
  10619. CString temp;
  10620. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10621. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10622. }
  10623. catch (...)
  10624. {
  10625. }
  10626. try
  10627. {
  10628. CString temp;
  10629. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10630. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10631. }
  10632. catch (...)
  10633. {
  10634. }
  10635. }
  10636. void CMainFrame::OnServer()
  10637. {
  10638. // TODO: Add your command handler code here
  10639. DBConfig dlg;
  10640. dlg.DoModal();
  10641. }
  10642. void CMainFrame::OnPath()
  10643. {
  10644. // TODO: Add your command handler code here
  10645. if (g_user.bLongin == 0)
  10646. {
  10647. if (g_bNoLoginLia)
  10648. {
  10649. Login dlg;
  10650. dlg.SetLiaPath("5.lia");
  10651. dlg.DoModal();
  10652. }
  10653. else
  10654. {
  10655. Login3 dlg;
  10656. dlg.SetLiaPath("5.lia");
  10657. dlg.DoModal();
  10658. }
  10659. if (g_user.bLongin == 0)return;
  10660. }
  10661. if (IsHasRightsnew(49) == 0)return;
  10662. SetPathDlg2 dlg;
  10663. dlg.DoModal();
  10664. }
  10665. void CMainFrame::OnShowhis()
  10666. {
  10667. // TODO: Add your command handler code here
  10668. if (g_user.bLongin == 0)
  10669. {
  10670. if (g_bNoLoginLia)
  10671. {
  10672. Login dlg;
  10673. dlg.SetLiaPath("5.lia");
  10674. dlg.DoModal();
  10675. }
  10676. else
  10677. {
  10678. Login3 dlg;
  10679. dlg.SetLiaPath("5.lia");
  10680. dlg.DoModal();
  10681. }
  10682. if (g_user.bLongin == 0)return;
  10683. }
  10684. if (IsHasRightsnew(52) == 0)return;
  10685. CMenu *pMenu = GetMenu();
  10686. CMenu* submenu = pMenu->GetSubMenu(2);
  10687. UINT status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10688. if (status&MF_CHECKED)
  10689. {
  10690. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_UNCHECKED);
  10691. g_bShowOK = 1;
  10692. }
  10693. else
  10694. {
  10695. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  10696. g_bShowOK = 0;
  10697. } m_Mdi.CloseAll();
  10698. }
  10699. void CMainFrame::AddHistoryMenu(CArray<CStringArray, CStringArray>*hisyeararray) // 添加历史数据库菜单;
  10700. {
  10701. #ifdef NEW_SKIN
  10702. CMenu* m_menuXP = GetMenu();
  10703. CMenu* submenu = m_menuXP->GetSubMenu(2);
  10704. // 删除原有菜单;
  10705. int i = 0;
  10706. for ( i = 0; i < 100; i++)
  10707. {
  10708. submenu->DeleteMenu(1000 + i, MF_BYCOMMAND);
  10709. }
  10710. // 重创菜单,从资源ID1000开始;
  10711. for (i = 0; i < hisyeararray->GetSize(); i++)
  10712. {
  10713. submenu->AppendMenu(MF_STRING, 1000 + i, "查看历史数据:" + hisyeararray->ElementAt(i).ElementAt(0)); // 第一项菜单项;
  10714. }
  10715. g_nYearpos = -1;
  10716. #else
  10717. HMENU hMenu = ::GetMenu(m_hWnd);
  10718. m_menuXP.Attach(hMenu);
  10719. BCMenu* submenu = (BCMenu*)m_menuXP.GetSubMenu(2);
  10720. for (int i = 0; i < 100; i++)
  10721. {
  10722. submenu->DeleteMenu (1000+i, MF_BYCOMMAND);
  10723. }
  10724. for( i=0; i<hisyeararray->GetSize (); i++)
  10725. {
  10726. submenu->AppendMenu(MF_STRING, 1000+i, "查看历史数据:"+hisyeararray->ElementAt (i).ElementAt (0)); // 第一项菜单项
  10727. }
  10728. m_menuXP.Detach ();
  10729. g_nYearpos = -1;
  10730. #endif
  10731. }
  10732. /************************************************************************/
  10733. /*
  10734. Jeff
  10735. 函数:AddBranchMenu()
  10736. 参数:CArray<CStringArray, CStringArray> *branchArray
  10737. 返回:void
  10738. 注意:
  10739. 调用关系:
  10740. */
  10741. /************************************************************************/
  10742. void CMainFrame::AddBranchMenu(CArray<CStringArray, CStringArray>*branchArray)
  10743. {
  10744. //WriteTextLog("AddBranchMenu,添加集团版菜单");
  10745. #ifdef ENTERPRISE_VERSION
  10746. CMenu *m_menuXP = GetMenu();
  10747. CMenu* submenu = m_menuXP->GetSubMenu(0);
  10748. int i = 0;
  10749. for ( i = 0; i < 100; i++)
  10750. {
  10751. submenu->DeleteMenu(2000 + i, MF_BYCOMMAND);
  10752. }
  10753. g_menubranchname.RemoveAll();
  10754. CString name;
  10755. int a = 0;
  10756. #if 0 // Jeff.add for test
  10757. CString strCount;
  10758. strCount.Format("历史数据库个数=%d", branchArray->GetSize());
  10759. WriteTextLog(strCount);
  10760. #endif
  10761. for (i = 0; i < branchArray->GetSize() - 1; i++)
  10762. {
  10763. //WriteTextLog("111");
  10764. //WriteTextLog(hisyeararray->ElementAt(i).ElementAt(0));
  10765. //WriteTextLog(name);
  10766. if (name == "")
  10767. {
  10768. name = branchArray->ElementAt(i).ElementAt(0);
  10769. #ifndef SQLSERVER_VERSION
  10770. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10771. a++;
  10772. #endif
  10773. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10774. a++;
  10775. g_menubranchname.Add(name);
  10776. continue;
  10777. }
  10778. else if (branchArray->ElementAt(i).ElementAt(0).Find(name) != -1 && ((branchArray->ElementAt(i).ElementAt(0).GetLength() - name.GetLength()) == 4))
  10779. {
  10780. continue;
  10781. }
  10782. name = branchArray->ElementAt(i).ElementAt(0);
  10783. #ifndef SQLSERVER_VERSION
  10784. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10785. a++;
  10786. #endif
  10787. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10788. g_menubranchname.Add(name);
  10789. a++;
  10790. //WriteTextLog("222");
  10791. }
  10792. if ((branchArray->GetSize() - 1) > 0)
  10793. {
  10794. if (branchArray->ElementAt(0).ElementAt(3) == "总店")
  10795. submenu->AppendMenu(MF_STRING, 2000 + a, "多店数据汇总");
  10796. }
  10797. #endif
  10798. }
  10799. // Jeff:如果选择了历史数据库,则开单的数据会录入到该历史数据库中,而非当前数据库;
  10800. // g_nYearpos==-1,表示当前主数据库,其他>=0的值表示历史数据库在g_historydb中的索引值;
  10801. void CMainFrame::OnHistory(UINT nID) // 选择历史数据库菜单响应;
  10802. {
  10803. CMenu* pMenu = GetMenu();
  10804. CMenu* submenu = pMenu->GetSubMenu(2);
  10805. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10806. if (g_user.bLongin == 0)
  10807. {
  10808. if (g_bNoLoginLia)
  10809. {
  10810. Login dlg;
  10811. dlg.SetLiaPath("5.lia");
  10812. dlg.DoModal();
  10813. }
  10814. else
  10815. {
  10816. Login3 dlg;
  10817. dlg.SetLiaPath("5.lia");
  10818. dlg.DoModal();
  10819. }
  10820. if (g_user.bLongin == 0)return;
  10821. }
  10822. if (IsHasRightsnew(52) == 0)return;
  10823. m_Mdi.CloseAll();
  10824. for (int i = 0; i < 100; i++)
  10825. {
  10826. submenu->CheckMenuItem(1000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10827. }
  10828. if (status&MF_CHECKED)
  10829. {
  10830. g_nYearpos = -1;
  10831. status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10832. if (status&MF_CHECKED)
  10833. g_bShowOK = 0;
  10834. else
  10835. g_bShowOK = 1;
  10836. }
  10837. else
  10838. {
  10839. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10840. g_nYearpos = nID - 1000;
  10841. g_bShowOK = 1;
  10842. }
  10843. }
  10844. void CMainFrame::OnBranchData(UINT nID)
  10845. {
  10846. #ifdef ENTERPRISE_VERSION
  10847. #ifdef SQLSERVER_VERSION
  10848. OnBranchData2(nID);
  10849. return;
  10850. #endif
  10851. #endif
  10852. }
  10853. void CMainFrame::OnBranchData2(UINT nID)
  10854. {
  10855. #ifdef ENTERPRISE_VERSION
  10856. g_bAllBranch = 0;
  10857. m_Mdi.CloseAll();
  10858. OnDisconnect();
  10859. CMenu *pMenu = GetMenu();
  10860. CMenu* submenu = pMenu->GetSubMenu(0);
  10861. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10862. for (int i = 0; i < 100; i++)
  10863. {
  10864. submenu->CheckMenuItem(2000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10865. }
  10866. if (status&MF_CHECKED)
  10867. {
  10868. g_branchname.Empty();
  10869. g_branchip.Empty();
  10870. g_bBranchModify = 0;
  10871. g_user.bLongin = 0;
  10872. if (g_bNoLoginLia)
  10873. {
  10874. Login dlg;
  10875. dlg.SetLiaPath("5.lia");
  10876. dlg.DoModal();
  10877. }
  10878. else
  10879. {
  10880. Login3 dlg;
  10881. dlg.SetLiaPath("5.lia");
  10882. dlg.DoModal();
  10883. }
  10884. g_pMainWnd2->RefreshOutlookBar();
  10885. g_pMainWnd2->DrawLogin();
  10886. g_path1 = g_path1bak;
  10887. g_path2 = g_path2bak;
  10888. g_path3 = g_path3bak;
  10889. g_path4 = g_path4bak;
  10890. g_path5 = g_path5bak;
  10891. g_path6 = g_path6bak;
  10892. g_path7 = g_path7bak;
  10893. g_pMainWnd2->EnableBtns(1);
  10894. }
  10895. else
  10896. {
  10897. BOOL bNeedCheckRights = 1;
  10898. if (g_user.bLongin && g_branchname == "")//无需登陆本店判断其访问分店权限
  10899. {
  10900. bNeedCheckRights = 0;
  10901. }
  10902. #ifndef SQLSERVER_VERSION
  10903. if ((g_menubranchname.GetSize() * 2) == nID - 2000)//多店数据汇总
  10904. #else
  10905. if ((g_menubranchname.GetSize()) == nID - 2000)//多店数据汇总
  10906. #endif
  10907. {
  10908. g_branchname.Empty();
  10909. g_branchip.Empty();
  10910. g_bBranchModify = 0;
  10911. if (bNeedCheckRights)
  10912. {
  10913. g_user.bLongin = 0;
  10914. if (g_user.bLongin == 0)
  10915. {
  10916. if (g_bNoLoginLia)
  10917. {
  10918. Login dlg;
  10919. dlg.SetLiaPath("5.lia");
  10920. dlg.DoModal();
  10921. }
  10922. else
  10923. {
  10924. Login3 dlg;
  10925. dlg.SetLiaPath("5.lia");
  10926. dlg.DoModal();
  10927. }
  10928. if (g_user.bLongin == 0)return;
  10929. }
  10930. }
  10931. if (IsHasRightsnew(28) == 0)
  10932. {
  10933. return;
  10934. }
  10935. g_bAllBranch = 1; g_pMainWnd2->ShowBar(0);
  10936. g_pMainWnd2->RefreshOutlookBar2();
  10937. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10938. g_branchname.Empty();
  10939. g_branchip.Empty();
  10940. g_bBranchModify = 0;
  10941. g_pMainWnd2->DrawLogin();
  10942. g_pMainWnd2->EnableBtns(0);
  10943. g_path1 = g_path1bak;
  10944. g_path2 = g_path2bak;
  10945. g_path3 = g_path3bak;
  10946. g_path4 = g_path4bak;
  10947. g_path5 = g_path5bak;
  10948. g_path6 = g_path6bak;
  10949. g_path7 = g_path7bak;
  10950. }
  10951. else
  10952. {
  10953. if (bNeedCheckRights)
  10954. {
  10955. g_branchname.Empty();
  10956. g_branchip.Empty();
  10957. g_bBranchModify = 0;
  10958. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_UNCHECKED);
  10959. g_user.bLongin = 0;
  10960. if (g_pMainWnd2)
  10961. {
  10962. g_pMainWnd2->DrawLogin();
  10963. g_pMainWnd2->ShowBar(0);
  10964. }
  10965. if (g_bNoLoginLia)
  10966. {
  10967. Login dlg;
  10968. dlg.SetLiaPath("5.lia");
  10969. dlg.DoModal();
  10970. }
  10971. else
  10972. {
  10973. Login3 dlg;
  10974. dlg.SetLiaPath("5.lia");
  10975. dlg.DoModal();
  10976. }
  10977. if (g_user.bLongin == 0)return;
  10978. }
  10979. if (IsHasRightsnew(28) == 0)
  10980. {
  10981. return;
  10982. }
  10983. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10984. #ifndef SQLSERVER_VERSION
  10985. if (nID % 2 == 0)
  10986. g_branchname = g_menubranchname.ElementAt((nID - 2000) / 2);
  10987. else
  10988. g_branchname = g_menubranchname.ElementAt((nID - 2001) / 2);
  10989. #else
  10990. g_branchname = g_menubranchname.ElementAt(nID - 2000);
  10991. #endif
  10992. //printf("选择分店:%s\n", g_branchname);
  10993. g_branchip.Empty();
  10994. CString domainname = "";
  10995. for (int i = 0; i < g_brancharray.GetSize(); i++)
  10996. {
  10997. /*
  10998. for(int j=0; j<g_brancharray.GetSize(); j++)
  10999. printf("%s\n", g_brancharray.ElementAt(i).ElementAt(j));
  11000. */
  11001. if (g_branchname == g_brancharray.ElementAt(i).ElementAt(0))
  11002. {
  11003. g_branchip = g_brancharray.ElementAt(i).ElementAt(1);
  11004. g_branchip2 = g_brancharray.ElementAt(i).ElementAt(4);
  11005. domainname = g_brancharray.ElementAt(i).ElementAt(2);
  11006. }
  11007. }
  11008. g_path1 = g_path1bak;
  11009. g_path2 = g_path2bak;
  11010. g_path3 = g_path3bak;
  11011. g_path4 = g_path4bak;
  11012. g_path5 = g_path5bak;
  11013. g_path6 = g_path6bak;
  11014. g_path7 = g_path7bak;
  11015. if (domainname.IsEmpty())
  11016. {
  11017. g_path1 = g_path2 = g_path3 = g_path4 = g_path5 = g_path6 = g_path7 = "xxx";
  11018. }
  11019. else
  11020. {
  11021. g_path1 += "\\" + domainname;
  11022. g_path2 += "\\" + domainname;
  11023. g_path3 += "\\" + domainname;
  11024. g_path4 += "\\" + domainname;
  11025. g_path5 += "\\" + domainname;
  11026. g_path6 += "\\" + domainname;
  11027. g_path7 += "\\" + domainname;
  11028. }
  11029. g_bBranchModify = 1;
  11030. /* CArray<CStringArray, CStringArray>yeararray;
  11031. for( i=0; i<g_brancharray.GetSize (); i++)
  11032. {
  11033. if(g_brancharray.ElementAt (i).ElementAt (0).Find (g_branchname)!=-1 && g_branchname!=g_brancharray.ElementAt (i).ElementAt (0))
  11034. {
  11035. int size=yeararray.GetSize ();
  11036. yeararray.SetSize(size+1,1);
  11037. CString str=g_brancharray.ElementAt (i).ElementAt (0);
  11038. str.Delete (0, g_branchname.GetLength ());
  11039. yeararray.ElementAt (size).Add (str);
  11040. }
  11041. }
  11042. AddHistoryMenu(&yeararray);*/
  11043. if (g_bBranchModify)OnDisconnect();
  11044. if (1)
  11045. {
  11046. g_user.bLongin = 0;
  11047. g_user.name.Empty();
  11048. g_user.rights.Empty();
  11049. g_user.account.Empty();
  11050. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  11051. g_pMainWnd2->RefreshOutlookBar();
  11052. m_Mdi.CloseAll();
  11053. if (g_pMainWnd2)
  11054. {
  11055. g_pMainWnd2->DrawLogin();
  11056. g_pMainWnd2->ShowBar(0);
  11057. }
  11058. if (g_bNoLoginLia)
  11059. {
  11060. Login dlg;
  11061. dlg.SetLiaPath("5.lia");
  11062. dlg.DoModal();
  11063. }
  11064. else
  11065. {
  11066. Login3 dlg;
  11067. dlg.SetLiaPath("5.lia");
  11068. dlg.DoModal();
  11069. }
  11070. if (g_user.bLongin == 0)return;
  11071. if (g_pMainWnd2)g_pMainWnd2->ShowBar(1);
  11072. }
  11073. g_pMainWnd2->DrawLogin();
  11074. g_pMainWnd2->EnableBtns(1);
  11075. }
  11076. g_nYearpos = -1;
  11077. }
  11078. #endif
  11079. }
  11080. void CMainFrame::OnStaffAchievementShow() //Jeff:此机只用于员工看业绩;
  11081. {
  11082. // TODO: Add your command handler code here
  11083. if (g_user.bLongin == 0) // 是否登陆系统;
  11084. {
  11085. if (g_bNoLoginLia)
  11086. {
  11087. Login dlg;
  11088. dlg.SetLiaPath("5.lia");
  11089. dlg.DoModal();
  11090. }
  11091. else
  11092. {
  11093. Login3 dlg;
  11094. dlg.SetLiaPath("5.lia");
  11095. dlg.DoModal();
  11096. }
  11097. if (g_user.bLongin == 0)return;
  11098. }
  11099. if (IsHasRightsnew(49) == 0)return;// 是否有权限进行设置;
  11100. CMenu *pMenu = GetMenu();
  11101. CMenu* submenu = pMenu->GetSubMenu(1);
  11102. UINT status = submenu->GetMenuState(IDM_StaffAchievementShow, MF_BYCOMMAND);
  11103. if (status&MF_CHECKED)
  11104. {
  11105. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_UNCHECKED);
  11106. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status2", 0);
  11107. g_bStaffAchievementShow = 0;
  11108. TCHAR szKey[MAX_PATH];
  11109. TCHAR szDir[MAX_PATH];
  11110. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  11111. HKEY hKey = 0;
  11112. DWORD disp = 0;
  11113. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  11114. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  11115. if (lResult == ERROR_SUCCESS)
  11116. {
  11117. RegDeleteValue(hKey, "YLGLMAINAUTORUN");
  11118. RegDeleteKey(hKey, "YLGLMAINAUTORUN");
  11119. RegCloseKey(hKey);
  11120. }
  11121. }
  11122. else
  11123. {
  11124. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  11125. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status2", 1);
  11126. g_bStaffAchievementShow = 1;
  11127. TCHAR szKey[MAX_PATH];
  11128. TCHAR szDir[MAX_PATH];
  11129. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  11130. HKEY hKey = 0;
  11131. DWORD disp = 0;
  11132. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  11133. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  11134. if (lResult == ERROR_SUCCESS)
  11135. {
  11136. lResult = RegSetValueEx(hKey, "YLGLMAINAUTORUN", 0, REG_SZ, (const unsigned char*)szDir, lstrlen(szDir));
  11137. RegCloseKey(hKey);
  11138. }
  11139. StaffAchievementSet dlg;
  11140. dlg.DoModal();
  11141. }
  11142. }
  11143. void CMainFrame::PrintDinDan2(CString m_id)
  11144. {
  11145. #ifdef MODERN_VERSION
  11146. SelContent seldlg;
  11147. if (seldlg.DoModal() != IDOK)return;
  11148. CPrintRX m_Print;
  11149. m_Print.InitToPrint(NULL, 1);
  11150. m_Print.StartPrint();
  11151. m_Print.StartPage();
  11152. // CRect StrRect(0,0,560,818);
  11153. LoadRect load;
  11154. LoadRect load2;
  11155. LoadRect load3;
  11156. load.SetLiaPath ("9.lia");
  11157. load.SetMargins(-14,0);
  11158. if(!load.Load ())return;
  11159. int i;
  11160. //////////////////////////////////////////////////////////////
  11161. CStringArray txarray;
  11162. CString filter="id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"'";
  11163. g_sendhead.code[0]=11;
  11164. g_sendhead.code[1]=52;
  11165. g_sendhead.code[2]=50;
  11166. g_sendhead.code[3]=38;
  11167. g_sendhead.code[4]=27;
  11168. g_sendhead.tabcount=5;
  11169. g_sendhead.bsql=0;
  11170. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  11171. CArray<CStringArray, CStringArray>sparray;
  11172. CArray<CStringArray, CStringArray>clientarray;
  11173. CArray<CStringArray, CStringArray>phonearray;
  11174. CArray<CStringArray, CStringArray>bukuan2array;
  11175. CArray<CStringArray, CStringArray>bukuanarray;
  11176. DataToArray(&g_List1array, &clientarray, &sparray, &bukuan2array, &bukuanarray);
  11177. CTime tm=CTime::GetCurrentTime ();
  11178. CString str;
  11179. CString m_money1 = g_List1array.ElementAt (0).ElementAt (1);
  11180. CString m_money2 = g_List1array.ElementAt (0).ElementAt (2);
  11181. CString m_money3 = g_List1array.ElementAt (0).ElementAt (3);
  11182. CString m_name1 = g_List1array.ElementAt (0).ElementAt (4);
  11183. CString m_name2 = g_List1array.ElementAt (0).ElementAt (5);
  11184. CString m_taoxiname= g_List1array.ElementAt (0).ElementAt (7);
  11185. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (8);
  11186. CString m_zs = g_List1array.ElementAt (0).ElementAt (9);
  11187. CString m_time1 = g_List1array.ElementAt (0).ElementAt (10);
  11188. CString m_time2 = g_List1array.ElementAt (0).ElementAt (11);
  11189. CString m_time3 = g_List1array.ElementAt (0).ElementAt (12);
  11190. CString m_ren = g_List1array.ElementAt (0).ElementAt (14);
  11191. CString m_discount = g_List1array.ElementAt (0).ElementAt (15);
  11192. CString m_payed1 = g_List1array.ElementAt (0).ElementAt (16);
  11193. CString m_payed2 = g_List1array.ElementAt (0).ElementAt (17);
  11194. CString m_payed3 = g_List1array.ElementAt (0).ElementAt (18);
  11195. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (19);
  11196. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (20);
  11197. CString m_time4 = g_List1array.ElementAt (0).ElementAt (21);
  11198. CString m_time5 = g_List1array.ElementAt (0).ElementAt (22);
  11199. CString m_clothescount = g_List1array.ElementAt (0).ElementAt (26);
  11200. CString m_clothescount2 = g_List1array.ElementAt (0).ElementAt (27);
  11201. CString m_outside = g_List1array.ElementAt (0).ElementAt (28);
  11202. CString m_outside2 = g_List1array.ElementAt (0).ElementAt (29);
  11203. CString m_style = g_List1array.ElementAt (0).ElementAt (30);
  11204. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (34);
  11205. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (35);
  11206. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (37);
  11207. CString m_bz = g_List1array.ElementAt (0).ElementAt (38);
  11208. CString m_phone1=clientarray.ElementAt (0).ElementAt (3);
  11209. CString m_phone2=clientarray.ElementAt (0).ElementAt (4);
  11210. CString m_addr1=clientarray.ElementAt (0).ElementAt (7);
  11211. CString m_addr2=clientarray.ElementAt (0).ElementAt (8);
  11212. CString m_occupation1=clientarray.ElementAt (0).ElementAt (9);
  11213. CString m_occupation2=clientarray.ElementAt (0).ElementAt (10);
  11214. filter="name='"+m_ren+"'";
  11215. g_sendhead.code[0]=5;
  11216. g_sendhead.tabcount=1;
  11217. g_sendhead.bsql=0;
  11218. int g_nYearposTemp=g_nYearpos;
  11219. g_nYearpos=-1;
  11220. g_pMainWnd->ProcessChatMessageRequest2(filter);
  11221. g_nYearpos=g_nYearposTemp;
  11222. if(g_bSendOK==0)return;
  11223. DataToArray(&phonearray);
  11224. m_money2.Format ("%f", atof(m_payed5)+atof(m_money1));
  11225. m_money1.Format ("%f", atof(m_taoxijiage)+atof(m_payed4));
  11226. m_money3.Format ("%f", atof(m_money1)-atof(m_money2));
  11227. ConvertToPrice(m_money1);
  11228. ConvertToPrice(m_money2);
  11229. ConvertToPrice(m_money3);
  11230. ////////////////////////////////////////////////////////////////
  11231. int rcpos=-1;
  11232. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  11233. Image *pImg=NULL;
  11234. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo2.jpg");
  11235. if(seldlg.m_bFrame)
  11236. m_Print.DrawImage(pImg, StrRect);
  11237. delete pImg;
  11238. m_Print.SetFontFace(16, 1, "黑体");
  11239. StrRect=load.m_rcarray .ElementAt (++rcpos);
  11240. if(seldlg.m_bFrame)
  11241. ///////////////////////////////不用改
  11242. m_Print.DrawText((LPTSTR)(LPCTSTR)"摩登新娘工作流程单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11243. m_Print.SetFontFace(10, 1, "宋体");
  11244. for( i=3; i<=6; i++)
  11245. {
  11246. StrRect=load.m_rcarray .ElementAt (i-1);
  11247. if(seldlg.m_bFrame)
  11248. m_Print.DrawRect2(StrRect, 1);
  11249. }
  11250. CStringArray strarray;
  11251. if(seldlg.m_bBooking==0)
  11252. {
  11253. m_name1.Empty ();
  11254. m_name2.Empty ();
  11255. m_phone1.Empty ();
  11256. m_phone2.Empty ();
  11257. m_addr1.Empty ();
  11258. m_addr2.Empty ();
  11259. m_taoxiname.Empty ();
  11260. m_taoxijiage.Empty ();
  11261. }
  11262. if(seldlg.m_bFrame )
  11263. {
  11264. strarray.Add("新郎:"+m_name1);
  11265. strarray.Add("H");
  11266. strarray.Add("O");
  11267. strarray.Add("手机:"+m_phone1);
  11268. strarray.Add("新娘:"+m_name2);
  11269. strarray.Add("H");
  11270. strarray.Add("O");
  11271. strarray.Add("手机:"+m_phone2);
  11272. }
  11273. else
  11274. {
  11275. strarray.Add(" "+m_name1);
  11276. strarray.Add("");
  11277. strarray.Add("");
  11278. strarray.Add(" "+m_phone1);
  11279. strarray.Add(" "+m_name2);
  11280. strarray.Add("");
  11281. strarray.Add("");
  11282. strarray.Add(" "+m_phone2);
  11283. }
  11284. for( i=7; i<=14; i++)
  11285. {
  11286. StrRect=load.m_rcarray .ElementAt (i-1);
  11287. StrRect.left +=2;
  11288. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11289. }
  11290. StrRect=load.m_rcarray .ElementAt (3);
  11291. StrRect.left +=2;
  11292. if(seldlg.m_bFrame)
  11293. str="地址:"+m_addr1;
  11294. else
  11295. str=" "+m_addr1;
  11296. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11297. StrRect=load.m_rcarray .ElementAt (5);
  11298. StrRect.left +=2;
  11299. if(seldlg.m_bFrame)
  11300. str="地址:"+m_addr2;
  11301. else
  11302. str=" "+m_addr2;
  11303. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11304. //////////////////////////////////////////////////////
  11305. StrRect=load.m_rcarray .ElementAt (14);
  11306. str="预\r\n约";
  11307. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11308. StrRect.top +=46;
  11309. StrRect.left +=2;
  11310. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11311. m_Print.SetFontFace(10, 1, "宋体");
  11312. StrRect=load.m_rcarray .ElementAt (15);
  11313. if(seldlg.m_bFrame)
  11314. str="套系名称:"+m_taoxiname;
  11315. else
  11316. str=" "+m_taoxiname;
  11317. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11318. StrRect.left +=4;
  11319. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11320. StrRect=load.m_rcarray .ElementAt (16);
  11321. if(seldlg.m_bFrame)
  11322. str="单价:"+m_taoxijiage;
  11323. else
  11324. str=" "+m_taoxijiage;
  11325. StrRect.left +=2;
  11326. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11327. StrRect=load.m_rcarray .ElementAt (21);
  11328. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11329. str="新人签名:";
  11330. StrRect.left +=2;
  11331. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11332. StrRect=load.m_rcarray .ElementAt (22);
  11333. if(seldlg.m_bBooking==0)
  11334. {
  11335. if(seldlg.m_bFrame)
  11336. str="未付款:";
  11337. else
  11338. str=" ";
  11339. }
  11340. else
  11341. {
  11342. if(seldlg.m_bFrame)
  11343. str="未付款:"+m_money3;
  11344. else
  11345. str=" "+m_money3;
  11346. }
  11347. StrRect.left +=2;
  11348. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11349. StrRect=load.m_rcarray .ElementAt (23);
  11350. str="结婚秘书:";
  11351. StrRect.left +=2;
  11352. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11353. StrRect=load.m_rcarray .ElementAt (24);
  11354. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11355. StrRect.left +=3;
  11356. StrRect.top +=3;
  11357. StrRect.right -=2;
  11358. StrRect.bottom -=2;
  11359. int realpos=0;str="";
  11360. for(i=0; i<sparray.GetSize (); i++)
  11361. {
  11362. if(atoi(sparray.ElementAt (i).ElementAt (4))!=1)continue;
  11363. str+=sparray.ElementAt (i).ElementAt (5);
  11364. str+=" 数量:";
  11365. str+=sparray.ElementAt (i).ElementAt (3);
  11366. if(realpos%2)
  11367. str+="\r\n";
  11368. else
  11369. str+=" ";
  11370. realpos++;
  11371. }
  11372. str.TrimRight ("\r\n");
  11373. str.TrimRight (" ");
  11374. if(seldlg.m_bBooking)AutoDraw(m_Print, StrRect, str, 1.4);
  11375. ///////////////////////////////////////////////////////////
  11376. StrRect=load.m_rcarray .ElementAt (14);
  11377. StrRect.top +=1*122;
  11378. StrRect.bottom +=1*122;
  11379. str="拍\r\n照";
  11380. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11381. StrRect.top +=46;
  11382. StrRect.left +=2;
  11383. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11384. m_Print.SetFontFace(10, 1, "宋体");
  11385. StrRect=load.m_rcarray .ElementAt (15);
  11386. StrRect.top +=1*122;
  11387. StrRect.bottom +=1*122;
  11388. str="拍照内容: 白 晚 特 便";
  11389. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11390. StrRect.left +=4;
  11391. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11392. StrRect=load.m_rcarray .ElementAt (21);
  11393. StrRect.top +=1*122;
  11394. StrRect.bottom +=1*122;
  11395. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11396. str=" 新人签名:";
  11397. StrRect.left +=2;
  11398. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11399. StrRect=load.m_rcarray .ElementAt (22);
  11400. StrRect.top +=1*122;
  11401. StrRect.bottom +=1*122;
  11402. if(seldlg.m_bTake)
  11403. {
  11404. if(seldlg.m_bFrame)
  11405. str="未付款:"+m_money3;
  11406. else
  11407. str=" "+m_money3;
  11408. }
  11409. else
  11410. {
  11411. if(seldlg.m_bFrame)
  11412. str="未付款:";
  11413. else
  11414. str=" ";
  11415. }
  11416. StrRect.left +=2;
  11417. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11418. StrRect=load.m_rcarray .ElementAt (23);
  11419. StrRect.top +=1*122;
  11420. StrRect.bottom +=1*122;
  11421. str="结婚秘书:";
  11422. StrRect.left +=2;
  11423. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11424. StrRect=load.m_rcarray .ElementAt (24);
  11425. StrRect.top +=1*122;
  11426. StrRect.bottom +=1*122;
  11427. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11428. StrRect.left +=3;
  11429. StrRect.top +=3;
  11430. StrRect.right -=2;
  11431. StrRect.bottom -=2;
  11432. if(seldlg.m_bTake)
  11433. {
  11434. str="";
  11435. for(i=0; i<bukuan2array.GetSize (); i++)
  11436. {
  11437. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=1)continue;
  11438. str+="加挑: ";
  11439. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11440. str+="\r\n";
  11441. }
  11442. str.TrimRight ("\r\n");
  11443. str.TrimRight (" ");
  11444. AutoDraw(m_Print, StrRect, str, 1.4);
  11445. }
  11446. ///////////////////////////////////////////////////////////
  11447. StrRect=load.m_rcarray .ElementAt (14);
  11448. StrRect.top +=2*122;
  11449. StrRect.bottom +=2*122;
  11450. str="选\r\n样";
  11451. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11452. StrRect.top +=46;
  11453. StrRect.left +=2;
  11454. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11455. m_Print.SetFontFace(10, 1, "宋体");
  11456. StrRect=load.m_rcarray .ElementAt (15);
  11457. StrRect.top +=2*122;
  11458. StrRect.bottom +=2*122;
  11459. str="选片内容:";
  11460. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11461. StrRect.left +=4;
  11462. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11463. StrRect=load.m_rcarray .ElementAt (21);
  11464. StrRect.top +=2*122;
  11465. StrRect.bottom +=2*122;
  11466. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11467. str=" 新人签名:";
  11468. StrRect.left +=2;
  11469. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11470. StrRect=load.m_rcarray .ElementAt (22);
  11471. StrRect.top +=2*122;
  11472. StrRect.bottom +=2*122;
  11473. if(seldlg.m_bChoose)
  11474. {
  11475. if(seldlg.m_bFrame)
  11476. str="未付款:"+m_money3;
  11477. else
  11478. str=" "+m_money3;
  11479. }
  11480. else
  11481. {
  11482. if(seldlg.m_bFrame)
  11483. str="未付款:";
  11484. else
  11485. str=" ";
  11486. }
  11487. StrRect.left +=2;
  11488. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11489. StrRect=load.m_rcarray .ElementAt (23);
  11490. StrRect.top +=2*122;
  11491. StrRect.bottom +=2*122;
  11492. str="结婚秘书:";
  11493. StrRect.left +=2;
  11494. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11495. StrRect=load.m_rcarray .ElementAt (24);
  11496. StrRect.top +=2*122;
  11497. StrRect.bottom +=2*122;
  11498. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11499. if(seldlg.m_bChoose)
  11500. {
  11501. StrRect.left +=3;
  11502. StrRect.top +=3;
  11503. StrRect.right -=2;
  11504. StrRect.bottom -=2;
  11505. str="";
  11506. for(i=0; i<bukuan2array.GetSize (); i++)
  11507. {
  11508. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=2)continue;
  11509. str+="加挑: ";
  11510. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11511. str+="\r\n";
  11512. }
  11513. str.TrimRight ("\r\n");
  11514. str.TrimRight (" ");
  11515. AutoDraw(m_Print, StrRect, str, 1.4);
  11516. }
  11517. ///////////////////////////////////////////////////////////
  11518. StrRect=load.m_rcarray .ElementAt (14);
  11519. StrRect.top +=3*122;
  11520. StrRect.bottom +=3*122;
  11521. str="结\r\n婚";
  11522. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11523. StrRect.top +=46;
  11524. StrRect.left +=2;
  11525. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11526. m_Print.SetFontFace(10, 1, "宋体");
  11527. StrRect=load.m_rcarray .ElementAt (15);
  11528. StrRect.top +=3*122;
  11529. StrRect.bottom +=3*122;
  11530. str="结婚内容: 区 白 晚 押金:";
  11531. if(seldlg.m_bFrame) m_Print.DrawRect2(StrRect, 1);
  11532. StrRect.left +=4;
  11533. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11534. StrRect=load.m_rcarray .ElementAt (21);
  11535. StrRect.top +=3*122;
  11536. StrRect.bottom +=3*122;
  11537. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11538. str=" 新人签名:";
  11539. StrRect.left +=2;
  11540. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11541. StrRect=load.m_rcarray .ElementAt (22);
  11542. StrRect.top +=3*122;
  11543. StrRect.bottom +=3*122;
  11544. if(seldlg.m_bBooking)
  11545. {
  11546. if(seldlg.m_bFrame)
  11547. str="未付款:"+m_money3;
  11548. else
  11549. str=" "+m_money3;
  11550. }
  11551. else
  11552. {
  11553. if(seldlg.m_bFrame)
  11554. str="未付款:";
  11555. else
  11556. str=" ";
  11557. }
  11558. StrRect.left +=2;
  11559. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11560. StrRect=load.m_rcarray .ElementAt (23);
  11561. StrRect.top +=3*122;
  11562. StrRect.bottom +=3*122;
  11563. str="结婚秘书:";
  11564. StrRect.left +=2;
  11565. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11566. StrRect=load.m_rcarray .ElementAt (24);
  11567. StrRect.top +=3*122;
  11568. StrRect.bottom +=3*122;
  11569. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11570. if(seldlg.m_bBooking)
  11571. {
  11572. StrRect.left +=3;
  11573. StrRect.top +=3;
  11574. StrRect.right -=2;
  11575. StrRect.bottom -=2;
  11576. realpos=0;str="";
  11577. for(i=0; i<sparray.GetSize (); i++)
  11578. {
  11579. if(atoi(sparray.ElementAt (i).ElementAt (4))!=2)continue;
  11580. str+=sparray.ElementAt (i).ElementAt (5);
  11581. str+=" 数量:";
  11582. str+=sparray.ElementAt (i).ElementAt (3);
  11583. if(realpos%2)
  11584. str+="\r\n";
  11585. else
  11586. str+=" ";
  11587. realpos++;
  11588. }
  11589. str.TrimRight ("\r\n");
  11590. str.TrimRight (" ");
  11591. AutoDraw(m_Print, StrRect, str, 1.4);
  11592. }
  11593. ///////////////////////////////////////
  11594. strarray.RemoveAll ();
  11595. if(seldlg.m_bFrame)
  11596. {
  11597. strarray.Add ("项目");
  11598. strarray.Add ("万");
  11599. strarray.Add ("千");
  11600. strarray.Add ("百");
  11601. strarray.Add ("十");
  11602. strarray.Add ("个");
  11603. strarray.Add ("收 银");
  11604. }
  11605. else
  11606. {
  11607. strarray.Add ("");
  11608. strarray.Add ("");
  11609. strarray.Add ("");
  11610. strarray.Add ("");
  11611. strarray.Add ("");
  11612. strarray.Add ("");
  11613. strarray.Add ("");
  11614. }
  11615. CStringArray strarray2;
  11616. float ftotal=0;
  11617. int realcount=0;
  11618. if(seldlg.m_bBooking)
  11619. {
  11620. for(i=0; i<bukuanarray.GetSize (); i++)
  11621. {
  11622. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=3 && atoi(bukuanarray.ElementAt (i).ElementAt (6))!=4)continue;
  11623. realcount++;
  11624. if(realcount>6)break;
  11625. str=bukuanarray.ElementAt (i).ElementAt (1);
  11626. ftotal+=atof(str);
  11627. strarray2.Add (GetW(str));
  11628. strarray2.Add (GetK(str));
  11629. strarray2.Add (GetB(str));
  11630. strarray2.Add (GetS(str));
  11631. strarray2.Add (GetG(str));
  11632. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11633. }
  11634. }
  11635. while(strarray2.GetSize ()<36)
  11636. strarray2.Add ("");
  11637. str.Format ("%f", ftotal);
  11638. strarray2.Add (GetW(str));
  11639. strarray2.Add (GetK(str));
  11640. strarray2.Add (GetB(str));
  11641. strarray2.Add (GetS(str));
  11642. strarray2.Add (GetG(str));
  11643. strarray2.Add ("");
  11644. //拍照
  11645. ftotal=0;
  11646. realcount=0;
  11647. if(seldlg.m_bTake)
  11648. {
  11649. for(i=0; i<bukuanarray.GetSize (); i++)
  11650. {
  11651. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=1)continue;
  11652. realcount++;
  11653. if(realcount>6)break;
  11654. str=bukuanarray.ElementAt (i).ElementAt (1);
  11655. ftotal+=atof(str);
  11656. strarray2.Add (GetW(str));
  11657. strarray2.Add (GetK(str));
  11658. strarray2.Add (GetB(str));
  11659. strarray2.Add (GetS(str));
  11660. strarray2.Add (GetG(str));
  11661. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11662. }
  11663. }
  11664. while(strarray2.GetSize ()<42+36)
  11665. strarray2.Add ("");
  11666. str.Format ("%f", ftotal);
  11667. strarray2.Add (GetW(str));
  11668. strarray2.Add (GetK(str));
  11669. strarray2.Add (GetB(str));
  11670. strarray2.Add (GetS(str));
  11671. strarray2.Add (GetG(str));
  11672. strarray2.Add ("");
  11673. //选片
  11674. ftotal=0;
  11675. realcount=0;
  11676. if(seldlg.m_bChoose)
  11677. {
  11678. for(i=0; i<bukuanarray.GetSize (); i++)
  11679. {
  11680. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=2)continue;
  11681. realcount++;
  11682. if(realcount>6)break;
  11683. str=bukuanarray.ElementAt (i).ElementAt (1);
  11684. ftotal+=atof(str);
  11685. strarray2.Add (GetW(str));
  11686. strarray2.Add (GetK(str));
  11687. strarray2.Add (GetB(str));
  11688. strarray2.Add (GetS(str));
  11689. strarray2.Add (GetG(str));
  11690. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11691. }
  11692. }
  11693. while(strarray2.GetSize ()<42*2+36)
  11694. strarray2.Add ("");
  11695. str.Format ("%f", ftotal);
  11696. strarray2.Add (GetW(str));
  11697. strarray2.Add (GetK(str));
  11698. strarray2.Add (GetB(str));
  11699. strarray2.Add (GetS(str));
  11700. strarray2.Add (GetG(str));
  11701. strarray2.Add ("");
  11702. /////////////////////////////
  11703. CRect temprc;
  11704. for(int n=0; n<4; n++)
  11705. {
  11706. StrRect=load.m_rcarray .ElementAt (17);
  11707. StrRect.top +=n*122;
  11708. StrRect.bottom +=n*122;
  11709. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11710. StrRect=load.m_rcarray .ElementAt (18);
  11711. if(n)
  11712. {
  11713. StrRect.left +=36;
  11714. StrRect.right +=36;
  11715. }
  11716. StrRect.top +=n*122;
  11717. StrRect.bottom +=n*122;
  11718. if(seldlg.m_bFrame)
  11719. str.Format("%d年", tm.GetYear ());
  11720. else
  11721. str.Format("%d ", tm.GetYear ());
  11722. 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))
  11723. {
  11724. if(seldlg.m_bFrame)
  11725. str=" 年";
  11726. else
  11727. str=" ";
  11728. }
  11729. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11730. StrRect=load.m_rcarray .ElementAt (19);
  11731. if(n)
  11732. {
  11733. StrRect.left +=38;
  11734. StrRect.right +=38;
  11735. }
  11736. StrRect.top +=n*122;
  11737. StrRect.bottom +=n*122;
  11738. if(seldlg.m_bFrame)
  11739. str.Format("%02d月", tm.GetMonth ());
  11740. else
  11741. str.Format("%02d ", tm.GetMonth ());
  11742. 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))
  11743. {
  11744. if(seldlg.m_bFrame)
  11745. str=" 月";
  11746. else
  11747. str=" ";
  11748. }
  11749. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11750. StrRect=load.m_rcarray .ElementAt (20);
  11751. if(n)
  11752. {
  11753. StrRect.left +=36;
  11754. StrRect.right +=36;
  11755. }
  11756. StrRect.top +=n*122;
  11757. StrRect.bottom +=n*122;
  11758. if(seldlg.m_bFrame)
  11759. str.Format("%02d日", tm.GetDay ());
  11760. else
  11761. str.Format("%02d ", tm.GetDay ());
  11762. 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))
  11763. {
  11764. if(seldlg.m_bFrame)
  11765. str=" 日";
  11766. else
  11767. str=" ";
  11768. }
  11769. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11770. for(i=26; i<=32; i++)
  11771. {
  11772. StrRect=load.m_rcarray .ElementAt (i-1);
  11773. StrRect.bottom -=14;
  11774. for(int j=0; j<8; j++)
  11775. {
  11776. StrRect.top=StrRect.bottom;
  11777. if(j>2)
  11778. {
  11779. StrRect.bottom =StrRect.top+14;
  11780. }
  11781. else
  11782. {
  11783. StrRect.bottom =StrRect.top+13;
  11784. }
  11785. temprc=StrRect;
  11786. StrRect.top +=n*122;
  11787. StrRect.bottom +=n*122;
  11788. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11789. if(i==26 && j==4 && seldlg.m_bFrame)
  11790. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11791. else if(i==26 && j==5 && seldlg.m_bFrame)
  11792. m_Print.DrawText((LPTSTR)(LPCTSTR)"付款", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11793. else if(i==26 && j==7 && seldlg.m_bFrame)
  11794. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11795. else if(j==0)
  11796. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-26), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11797. else if(j && i>26 && n<3)
  11798. {
  11799. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray2.ElementAt ((j-1)*6+(i-27)+n*42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11800. }
  11801. StrRect=temprc;
  11802. }
  11803. }
  11804. }
  11805. if(seldlg.m_bFrame)
  11806. {
  11807. StrRect=load.m_rcarray .ElementAt (32);
  11808. str="注\r\n意\r\n事\r\n项";
  11809. StrRect.top +=367;
  11810. StrRect.bottom +=367;
  11811. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11812. StrRect.top +=17;
  11813. StrRect.left +=2;
  11814. AutoDraw(m_Print, StrRect, str, 1.4);
  11815. StrRect=load.m_rcarray .ElementAt (33);
  11816. str="1: 本预约单自预定日期起一年内有效.定金在拍照套系金额中扣出.预定金一概不退\r\n\
  11817. 2: 多拍照片只供筛选.恕不奉送.版权所有.不得私自拷贝\r\n\
  11818. 3: 拍照款请于拍照时一次付清\r\n\
  11819. 4: 新娘装AM8:00前钟点费另计.婚纱礼服出租押金500-2000元\r\n\
  11820. 5: 本公司设有豪华VIP礼服区.及皇家御用礼服展区.但需另外加价.详情请咨本店人员\r\n\
  11821. 6: 安瓶, 美甲一次性化妆用具等均属增值服务部分,则需另外加价,详情咨询本店工作人员\r\n\
  11822. 7: 本电脑机械故障导致文件资料丢失.本公司只提供补拍服务\r\n\
  11823. 8: 每次前来请务必携带本单交给工作人员.本单是您在摩登新娘拍照的凭证.办理有关手续凭本单办理盖\r\n\
  11824. 章后方可生效";
  11825. StrRect.top +=367;
  11826. StrRect.bottom +=367;
  11827. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11828. StrRect.top +=4;
  11829. StrRect.left +=2;
  11830. AutoDraw(m_Print, StrRect, str, 1.0);
  11831. StrRect=load.m_rcarray .ElementAt (34);
  11832. 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)";
  11833. AutoDraw(m_Print, StrRect, str, 1.0);
  11834. m_Print.SetFontFace(13, 1, "宋体");
  11835. StrRect=load.m_rcarray .ElementAt (35);
  11836. str="地 址: 汉口 . 解放大道 . 头道街东部购物公园C栋二,三层";
  11837. StrRect.top +=367;
  11838. StrRect.bottom +=367;
  11839. StrRect.left +=2;
  11840. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11841. StrRect=load.m_rcarray .ElementAt (36);
  11842. str="喜讯热线: 027-81888799 81888599 81888699";
  11843. StrRect.top +=367;
  11844. StrRect.bottom +=367;
  11845. StrRect.left +=2;
  11846. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11847. }
  11848. PrintPreview dlg;
  11849. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  11850. dlg.m_pDC =m_Print.GetPDC() ;
  11851. if(dlg.DoModal ()!=IDOK)return;
  11852. //结束打印
  11853. m_Print.EndPage();
  11854. m_Print.EndPrint();
  11855. #endif
  11856. }
  11857. extern CString GetHMoney(CString str);
  11858. void CMainFrame::PrintReceipt3(CString strOrderNumber, CStringArray *pArray, float money)
  11859. {
  11860. int printcot = 1;
  11861. for (int aa = 0; aa < printcot; aa++)
  11862. {
  11863. g_sendhead.bsql = 0;
  11864. g_sendhead.code[0] = 24;
  11865. g_sendhead.tabcount = 1;
  11866. int g_nYearposTemp = g_nYearpos;
  11867. g_nYearpos = -1;
  11868. g_pMainWnd->ProcessChatMessageRequest2(1);
  11869. g_nYearpos = g_nYearposTemp;
  11870. if (0 == g_bSendOK)return;
  11871. DataToArray(&g_cominfoarray);
  11872. CString SerialNo;
  11873. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  11874. CPrintRX m_Print;
  11875. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  11876. {
  11877. m_Print.InitToPrint(NULL, 1);
  11878. }
  11879. else
  11880. {
  11881. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  11882. if (name.IsEmpty())
  11883. m_Print.InitToPrint(NULL, 1);
  11884. else
  11885. {
  11886. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  11887. if (nret == -1 && aa == 0)
  11888. {
  11889. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  11890. }
  11891. }
  11892. }
  11893. m_Print.StartPrint();
  11894. m_Print.StartPage();
  11895. LoadRect load;
  11896. load.SetLiaPath("15.lia");
  11897. load.SetMargins(0, 0);
  11898. if (!load.Load())return;
  11899. int i;
  11900. //////////////////////////////////////////////////////////////
  11901. CStringArray txarray;
  11902. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  11903. g_sendhead.code[0] = 11;
  11904. g_sendhead.code[1] = 52;
  11905. g_sendhead.tabcount = 2;
  11906. g_sendhead.bsql = 0;
  11907. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  11908. CArray<CStringArray, CStringArray>sparray;
  11909. CArray<CStringArray, CStringArray>clientarray;
  11910. DataToArray(&g_List1array, &clientarray);
  11911. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  11912. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  11913. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  11914. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  11915. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  11916. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  11917. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  11918. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  11919. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  11920. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  11921. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  11922. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  11923. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  11924. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  11925. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  11926. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  11927. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  11928. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  11929. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  11930. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  11931. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  11932. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  11933. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  11934. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  11935. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  11936. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  11937. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  11938. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  11939. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  11940. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  11941. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  11942. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  11943. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  11944. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  11945. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  11946. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  11947. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  11948. CString m_addr = m_addr1 + ";";
  11949. m_addr.TrimLeft(";");
  11950. m_addr += m_addr2;
  11951. CString m_qq = m_qq1 + ";";
  11952. m_qq.TrimLeft(";");
  11953. m_qq += m_qq2;
  11954. m_money1.Format("%f", atof(m_taoxijiage));
  11955. m_money2.Format("%f", atof(m_payed1));
  11956. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  11957. ConvertToPrice(m_money1);
  11958. ConvertToPrice(m_money2);
  11959. ConvertToPrice(m_money3);
  11960. ////////////////////////////////////////////////////////////////
  11961. int rcpos = -1;
  11962. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  11963. m_Print.SetFontFace(17, 1, "宋体");
  11964. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11965. StrRect.top -= 0;
  11966. StrRect.bottom -= 10;
  11967. StrRect.left -= 140;
  11968. StrRect.right = StrRect.left + 48;
  11969. m_Print.SetFontFace(15, 1, "宋体");
  11970. m_Print.SetColor(0xffffff);
  11971. m_Print.DrawRect(StrRect, 0);
  11972. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11973. StrRect.left = StrRect.right;
  11974. StrRect.right = StrRect.left + 48;
  11975. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  11976. m_Print.SetColor(0, RGB(255, 0, 0));
  11977. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11978. m_Print.SetColor(0);
  11979. m_Print.SetFontFace(12, 1, "宋体");
  11980. StrRect.left -= 48;
  11981. int hei = StrRect.Height();
  11982. StrRect.top = StrRect.bottom + 2;
  11983. StrRect.bottom += hei + 2;
  11984. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11985. StrRect.top = StrRect.bottom - 2;
  11986. StrRect.bottom += hei - 5;
  11987. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  11988. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11989. m_Print.SetFontFace(12, 1, "宋体");
  11990. m_Print.DrawText((LPTSTR)(LPCTSTR)"收款单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11991. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11992. m_Print.SetFontFace(9, 1, "宋体");
  11993. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11994. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11995. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11996. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11997. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11998. m_Print.DrawRect2(StrRect, 2);
  11999. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12000. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12001. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12002. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12003. m_Print.DrawRect2(StrRect, 2);
  12004. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12005. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12006. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12007. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12008. m_Print.DrawRect2(StrRect, 2);
  12009. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12010. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约地点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12011. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12012. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12013. m_Print.DrawRect2(StrRect, 2);
  12014. ////////////
  12015. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12016. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12017. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12018. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12019. m_Print.DrawRect2(StrRect, 2);
  12020. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12021. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12022. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12023. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12024. m_Print.DrawRect2(StrRect, 2);
  12025. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12026. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12027. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12028. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12029. m_Print.DrawRect2(StrRect, 2);
  12030. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12031. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12032. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12033. m_Print.DrawText((LPTSTR)(LPCTSTR)g_date, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12034. m_Print.DrawRect2(StrRect, 2);
  12035. for (i = 19; i < 49; i++)
  12036. {
  12037. if (i >= 44)
  12038. {
  12039. StrRect = load.m_rcarray.ElementAt(i - 5);
  12040. int hei = StrRect.Height();
  12041. StrRect.top += hei;
  12042. StrRect.bottom += hei;
  12043. }
  12044. else
  12045. StrRect = load.m_rcarray.ElementAt(i);
  12046. m_Print.DrawRect2(StrRect, 1);
  12047. }
  12048. float fmoney = 0;
  12049. for (i = 19; i < 49; i++)
  12050. {
  12051. if (i >= 44)
  12052. {
  12053. StrRect = load.m_rcarray.ElementAt(i - 5);
  12054. int hei = StrRect.Height();
  12055. StrRect.top += hei;
  12056. StrRect.bottom += hei;
  12057. }
  12058. else
  12059. StrRect = load.m_rcarray.ElementAt(i);
  12060. StrRect.left += 2;
  12061. /* if((i-19)%5==2)
  12062. {
  12063. fmoney+=atof(pArray->ElementAt (i-19));
  12064. }*/
  12065. m_Print.DrawText((LPTSTR)(LPCTSTR)(pArray->ElementAt(i - 19)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12066. }
  12067. m_money2.Format("%f", money);
  12068. ConvertToPrice(m_money2);
  12069. StrRect = load.m_rcarray.ElementAt(44);
  12070. CString str;
  12071. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 实收¥: %s 元 收银员: %s", \
  12072. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  12073. m_money2, g_user.name);
  12074. m_Print.DrawRect2(StrRect, 1);
  12075. StrRect.left += 3;
  12076. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12077. StrRect = load.m_rcarray.ElementAt(46);
  12078. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12079. StrRect = load.m_rcarray.ElementAt(47);
  12080. m_Print.DrawRect2(StrRect, 2);
  12081. StrRect = load.m_rcarray.ElementAt(48);
  12082. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12083. StrRect = load.m_rcarray.ElementAt(45);
  12084. str = "\
  12085. 顾客须知\r\n\
  12086. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  12087. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  12088. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  12089. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  12090. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  12091. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  12092. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  12093. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12094. AutoDraw(m_Print, StrRect, str, 1.8);
  12095. PrintPreview dlg;
  12096. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12097. dlg.m_pDC = m_Print.GetPDC();
  12098. if (aa == 0)
  12099. {
  12100. if (dlg.DoModal() != IDOK)
  12101. return;
  12102. printcot = dlg.m_num;
  12103. }
  12104. //结束打印
  12105. m_Print.EndPage();
  12106. m_Print.EndPrint();
  12107. }
  12108. }
  12109. void CMainFrame::PrintReceipt2(CString strOrderNumber)
  12110. {
  12111. int printcot = 1;
  12112. for (int aa = 0; aa < printcot; aa++)
  12113. {
  12114. g_sendhead.bsql = 0;
  12115. g_sendhead.code[0] = 24;
  12116. g_sendhead.tabcount = 1;
  12117. int g_nYearposTemp = g_nYearpos;
  12118. g_nYearpos = -1;
  12119. g_pMainWnd->ProcessChatMessageRequest2(1);
  12120. g_nYearpos = g_nYearposTemp;
  12121. if (0 == g_bSendOK)return;
  12122. DataToArray(&g_cominfoarray);
  12123. CString SerialNo;
  12124. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  12125. CPrintRX m_Print;
  12126. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12127. {
  12128. m_Print.InitToPrint(NULL, 1);
  12129. }
  12130. else
  12131. {
  12132. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  12133. if (name.IsEmpty())
  12134. m_Print.InitToPrint(NULL, 1);
  12135. else
  12136. {
  12137. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12138. if (nret == -1 && aa == 0)
  12139. {
  12140. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12141. }
  12142. }
  12143. }
  12144. m_Print.StartPrint();
  12145. m_Print.StartPage();
  12146. LoadRect load;
  12147. load.SetLiaPath("14.lia");
  12148. load.SetMargins(0, 0);
  12149. if (!load.Load())return;
  12150. int i;
  12151. //////////////////////////////////////////////////////////////
  12152. CStringArray txarray;
  12153. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  12154. g_sendhead.code[0] = 11;
  12155. g_sendhead.code[1] = 52;
  12156. g_sendhead.code[2] = 93;
  12157. g_sendhead.tabcount = 3;
  12158. g_sendhead.bsql = 0;
  12159. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12160. CArray<CStringArray, CStringArray>sparray;
  12161. CArray<CStringArray, CStringArray>clientarray;
  12162. CArray<CStringArray, CStringArray>moneyarray;
  12163. DataToArray(&g_List1array, &clientarray, &moneyarray);
  12164. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12165. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12166. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12167. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12168. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12169. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  12170. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12171. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12172. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12173. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12174. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12175. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12176. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12177. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12178. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12179. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12180. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12181. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12182. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12183. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12184. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12185. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12186. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12187. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12188. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12189. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12190. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12191. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12192. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  12193. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12194. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12195. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  12196. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  12197. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  12198. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  12199. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  12200. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  12201. CString m_addr = m_addr1 + ";";
  12202. m_addr.TrimLeft(";");
  12203. m_addr += m_addr2;
  12204. CString m_qq = m_qq1 + ";";
  12205. m_qq.TrimLeft(";");
  12206. m_qq += m_qq2;
  12207. m_money1.Format("%f", atof(m_taoxijiage));
  12208. m_money2 = "0";
  12209. for (i = 0; i < moneyarray.GetSize(); i++)
  12210. {
  12211. if (moneyarray.ElementAt(i).ElementAt(5) == "预约收款")
  12212. m_money2 = moneyarray.ElementAt(i).ElementAt(1);
  12213. }
  12214. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  12215. ConvertToPrice(m_money1);
  12216. ConvertToPrice(m_money2);
  12217. ConvertToPrice(m_money3);
  12218. ////////////////////////////////////////////////////////////////
  12219. int rcpos = -1;
  12220. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12221. m_Print.SetFontFace(17, 1, "宋体");
  12222. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12223. StrRect.top -= 0;
  12224. StrRect.bottom -= 10;
  12225. StrRect.left -= 140;
  12226. StrRect.right = StrRect.left + 48;
  12227. m_Print.SetFontFace(15, 1, "宋体");
  12228. m_Print.SetColor(0xffffff);
  12229. m_Print.DrawRect(StrRect, 0);
  12230. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12231. StrRect.left = StrRect.right;
  12232. StrRect.right = StrRect.left + 48;
  12233. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12234. m_Print.SetColor(0, RGB(255, 0, 0));
  12235. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12236. m_Print.SetColor(0);
  12237. m_Print.SetFontFace(12, 1, "宋体");
  12238. StrRect.left -= 48;
  12239. int hei = StrRect.Height();
  12240. StrRect.top = StrRect.bottom + 2;
  12241. StrRect.bottom += hei + 2;
  12242. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12243. StrRect.top = StrRect.bottom - 2;
  12244. StrRect.bottom += hei - 5;
  12245. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12246. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12247. m_Print.SetFontFace(12, 1, "宋体");
  12248. m_Print.DrawText((LPTSTR)(LPCTSTR)"定金单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12249. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12250. m_Print.SetFontFace(9, 1, "宋体");
  12251. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12252. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12253. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12254. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12255. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12256. m_Print.DrawRect2(StrRect, 2);
  12257. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12258. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12259. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12260. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12261. m_Print.DrawRect2(StrRect, 2);
  12262. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12263. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12264. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12265. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12266. m_Print.DrawRect2(StrRect, 2);
  12267. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12268. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约地点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12269. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12270. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12271. m_Print.DrawRect2(StrRect, 2);
  12272. ////////////
  12273. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12274. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12275. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12276. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12277. m_Print.DrawRect2(StrRect, 2);
  12278. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12279. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12280. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12281. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12282. m_Print.DrawRect2(StrRect, 2);
  12283. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12284. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12285. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12286. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12287. m_Print.DrawRect2(StrRect, 2);
  12288. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12289. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12290. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12291. m_Print.DrawText((LPTSTR)(LPCTSTR)g_date, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12292. m_Print.DrawRect2(StrRect, 2);
  12293. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12294. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客地址:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12295. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12296. m_Print.DrawText((LPTSTR)(LPCTSTR)m_addr, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12297. m_Print.DrawRect2(StrRect, 2);
  12298. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12299. m_Print.DrawText((LPTSTR)(LPCTSTR)"大婚时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12300. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12301. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12302. m_Print.DrawRect2(StrRect, 2);
  12303. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12304. m_Print.DrawText((LPTSTR)(LPCTSTR)"QQ/MSN:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12305. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12306. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12307. m_Print.DrawRect2(StrRect, 2);
  12308. CStringArray strarray;
  12309. strarray.Add("套系名称");
  12310. strarray.Add("总 额");
  12311. strarray.Add("定 金");
  12312. strarray.Add("余 款");
  12313. strarray.Add("摄影日期");
  12314. strarray.Add(m_taoxiname);
  12315. strarray.Add(m_money1);
  12316. strarray.Add(m_money2);
  12317. strarray.Add(m_money3);
  12318. strarray.Add(m_time2);
  12319. for (i = 25; i < 37; i++)
  12320. {
  12321. StrRect = load.m_rcarray.ElementAt(i);
  12322. m_Print.DrawRect2(StrRect, 1);
  12323. }
  12324. for (i = 25; i < 35; i++)
  12325. {
  12326. StrRect = load.m_rcarray.ElementAt(i);
  12327. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 25), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12328. }
  12329. StrRect = load.m_rcarray.ElementAt(35);
  12330. StrRect.left += 5;
  12331. StrRect.top += 5;
  12332. m_Print.DrawText((LPTSTR)(LPCTSTR)" 备 注:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  12333. StrRect = load.m_rcarray.ElementAt(36);
  12334. CString str;
  12335. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 ¥: %s 元 收银员: %s", \
  12336. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  12337. m_money2, g_user.name);
  12338. StrRect.left += 3;
  12339. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12340. StrRect = load.m_rcarray.ElementAt(38);
  12341. m_Print.DrawText((LPTSTR)(LPCTSTR)"营业员:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12342. StrRect = load.m_rcarray.ElementAt(39);
  12343. m_Print.DrawText((LPTSTR)(LPCTSTR)m_ren, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12344. m_Print.DrawRect2(StrRect, 2);
  12345. StrRect = load.m_rcarray.ElementAt(40);
  12346. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12347. StrRect = load.m_rcarray.ElementAt(41);
  12348. m_Print.DrawRect2(StrRect, 2);
  12349. StrRect = load.m_rcarray.ElementAt(42);
  12350. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12351. StrRect = load.m_rcarray.ElementAt(37);
  12352. str = "\
  12353. 顾客须知\r\n\
  12354. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  12355. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  12356. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  12357. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  12358. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  12359. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  12360. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  12361. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12362. AutoDraw(m_Print, StrRect, str, 1.8);
  12363. PrintPreview dlg;
  12364. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12365. dlg.m_pDC = m_Print.GetPDC();
  12366. if (aa == 0)
  12367. {
  12368. if (dlg.DoModal() != IDOK)
  12369. return;
  12370. printcot = dlg.m_num;
  12371. }
  12372. //结束打印
  12373. m_Print.EndPage();
  12374. m_Print.EndPrint();
  12375. }
  12376. }
  12377. void CMainFrame::OnAutodelphoto()
  12378. {
  12379. // TODO: Add your command handler code here
  12380. if (g_user.bLongin == 0)
  12381. {
  12382. if (g_bNoLoginLia)
  12383. {
  12384. Login dlg;
  12385. dlg.SetLiaPath("5.lia");
  12386. dlg.DoModal();
  12387. }
  12388. else
  12389. {
  12390. Login3 dlg;
  12391. dlg.SetLiaPath("5.lia");
  12392. dlg.DoModal();
  12393. }
  12394. if (g_user.bLongin == 0)return;
  12395. }
  12396. if (IsHasRightsnew(49) == 0)return;
  12397. DelPhotoSet dlg;
  12398. dlg.DoModal();
  12399. }
  12400. void CMainFrame::Onphotomanage() // 客照管理中心;
  12401. {
  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. ShowPic3 dlg;
  12420. dlg.DoModal();
  12421. }
  12422. void CMainFrame::OnCompanyinfo()
  12423. {
  12424. // TODO: Add your command handler code here
  12425. if (g_user.bLongin == 0)
  12426. {
  12427. if (g_bNoLoginLia)
  12428. {
  12429. Login dlg;
  12430. dlg.SetLiaPath("5.lia");
  12431. dlg.DoModal();
  12432. }
  12433. else
  12434. {
  12435. Login3 dlg;
  12436. dlg.SetLiaPath("5.lia");
  12437. dlg.DoModal();
  12438. }
  12439. if (g_user.bLongin == 0)return;
  12440. }
  12441. if (IsHasRightsnew(49) == 0)return;
  12442. CompanyInfo dlg;
  12443. dlg.DoModal();
  12444. }
  12445. void CMainFrame::OnTaoxifg()
  12446. {
  12447. // TODO: Add your command handler code here
  12448. if (g_user.bLongin == 0)
  12449. {
  12450. if (g_bNoLoginLia)
  12451. {
  12452. Login dlg;
  12453. dlg.SetLiaPath("5.lia");
  12454. dlg.DoModal();
  12455. }
  12456. else
  12457. {
  12458. Login3 dlg;
  12459. dlg.SetLiaPath("5.lia");
  12460. dlg.DoModal();
  12461. }
  12462. if (g_user.bLongin == 0)return;
  12463. }
  12464. if (IsHasRightsnew(49) == 0)return;
  12465. TXFG dlg;
  12466. dlg.DoModal();
  12467. }
  12468. void CMainFrame::OnHelpfile()
  12469. {
  12470. // TODO: Add your command handler code here
  12471. // ShellExecute(NULL, _T("open"), _T(g_mainpath+"\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  12472. // if(::PathFileExists (g_mainpath+"\\zx.dll"))
  12473. // ShellExecute(NULL, _T("open"), _T("www.zcsmkj.com"), "", NULL, SW_SHOWNORMAL);
  12474. // else
  12475. ShellExecute(NULL, _T("open"), _T("www.lyfz.net"), "", NULL, SW_SHOWNORMAL);
  12476. }
  12477. void CMainFrame::OnPhotobak()
  12478. {
  12479. // TODO: Add your command handler code here
  12480. if (g_user.bLongin == 0)
  12481. {
  12482. if (g_bNoLoginLia)
  12483. {
  12484. Login dlg;
  12485. dlg.SetLiaPath("5.lia");
  12486. dlg.DoModal();
  12487. }
  12488. else
  12489. {
  12490. Login3 dlg;
  12491. dlg.SetLiaPath("5.lia");
  12492. dlg.DoModal();
  12493. }
  12494. if (g_user.bLongin == 0)return;
  12495. }
  12496. if (IsHasRightsnew(49) == 0)return;
  12497. PhotoBak dlg;
  12498. dlg.DoModal();
  12499. }
  12500. //客户报表
  12501. void CMainFrame::OnClose2()
  12502. { // TODO: Add your message handler code here and/or call default
  12503. if (AfxMessageBox("是否退出系统?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  12504. if(g_user.bLongin)
  12505. WriteLog("退出系统!", "退出系统!");
  12506. g_bShowBar = 0;
  12507. if (m_Mdi.MainClose())
  12508. CMDIFrameWnd::OnClose();
  12509. }
  12510. //
  12511. void CMainFrame::ResetTimer()
  12512. {
  12513. }
  12514. void CMainFrame::LinkClick(CString str, int nParent)
  12515. {
  12516. g_pMainWnd2->m_bar.LinkClick(str);
  12517. }
  12518. void CMainFrame::PrintFlowChart2(CString m_id)
  12519. {
  12520. CPrintRX m_Print;
  12521. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12522. {
  12523. m_Print.InitToPrint(NULL, 1);
  12524. }
  12525. else
  12526. {
  12527. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  12528. if (name.IsEmpty())
  12529. m_Print.InitToPrint(NULL, 1);
  12530. else
  12531. {
  12532. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12533. if (nret == -1)
  12534. {
  12535. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12536. }
  12537. }
  12538. }
  12539. m_Print.StartPrint();
  12540. m_Print.StartPage();
  12541. LoadRect load;
  12542. load.SetLiaPath("16.lia");
  12543. load.SetMargins(0, 0);
  12544. if (!load.Load())return;
  12545. LoadRect load2;
  12546. load2.SetLiaPath("17.lia");
  12547. load2.SetMargins(0, 660);
  12548. if (!load2.Load())return;
  12549. int i;
  12550. //////////////////////////////////////////////////////////////
  12551. CStringArray txarray;
  12552. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and kind<>'2'";
  12553. g_sendhead.code[0] = 11;
  12554. g_sendhead.code[1] = 52;
  12555. g_sendhead.code[2] = 223;
  12556. g_sendhead.tabcount = 3;
  12557. g_sendhead.bsql = 0;
  12558. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12559. CArray<CStringArray, CStringArray>sparray;
  12560. CArray<CStringArray, CStringArray>clientarray;
  12561. DataToArray(&g_List1array, &clientarray, &sparray);
  12562. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12563. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12564. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12565. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12566. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12567. CString m_photocount = g_List1array.ElementAt(0).ElementAt(9);
  12568. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12569. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12570. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12571. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12572. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12573. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12574. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12575. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12576. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12577. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12578. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12579. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12580. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12581. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12582. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12583. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12584. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12585. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12586. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12587. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12588. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12589. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12590. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(39) + g_List1array.ElementAt(0).ElementAt(75);
  12591. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12592. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12593. CString spno;
  12594. for (i = 0; i < sparray.GetSize(); i++)
  12595. {
  12596. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  12597. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  12598. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  12599. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12600. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12601. spno += sparray.ElementAt(i).ElementAt(5);
  12602. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12603. spno += "; ";
  12604. else
  12605. {
  12606. spno += ":";
  12607. spno += sparray.ElementAt(i).ElementAt(6);
  12608. spno += "; ";
  12609. }
  12610. }
  12611. spno += " 加挑:";
  12612. for (i = 0; i < sparray.GetSize(); i++)
  12613. {
  12614. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  12615. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  12616. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  12617. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12618. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12619. spno += sparray.ElementAt(i).ElementAt(5);
  12620. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12621. spno += "; ";
  12622. else
  12623. {
  12624. spno += ":";
  12625. spno += sparray.ElementAt(i).ElementAt(6);
  12626. spno += "; ";
  12627. }
  12628. }
  12629. if (spno.Right(6) == " 加挑:")
  12630. {
  12631. spno = spno.Left(spno.GetLength() - 6);
  12632. }
  12633. ////////////////////////////////////////////////////////////////
  12634. int rcpos = -1;
  12635. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12636. m_Print.SetFontFace(17, 1, "宋体");
  12637. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12638. StrRect.top -= 0;
  12639. StrRect.bottom -= 10;
  12640. StrRect.left -= 140;
  12641. StrRect.right = StrRect.left + 48;
  12642. m_Print.SetFontFace(15, 1, "宋体");
  12643. m_Print.SetColor(0xffffff);
  12644. m_Print.DrawRect(StrRect, 0);
  12645. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12646. StrRect.left = StrRect.right;
  12647. StrRect.right = StrRect.left + 48;
  12648. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12649. m_Print.SetColor(0, RGB(255, 0, 0));
  12650. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12651. m_Print.SetColor(0);
  12652. m_Print.SetFontFace(12, 1, "宋体");
  12653. StrRect.left -= 48;
  12654. int hei = StrRect.Height();
  12655. StrRect.top = StrRect.bottom + 2;
  12656. StrRect.bottom += hei + 2;
  12657. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12658. StrRect.top = StrRect.bottom - 2;
  12659. StrRect.bottom += hei - 5;
  12660. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12661. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12662. m_Print.SetFontFace(12, 1, "宋体");
  12663. m_Print.DrawText((LPTSTR)(LPCTSTR)"加做取件单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12664. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12665. m_Print.SetFontFace(11, 1, "宋体");
  12666. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + m_id), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12667. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12668. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12669. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12670. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12671. m_Print.DrawRect2(StrRect, 2);
  12672. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12673. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12674. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12675. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12676. m_Print.DrawRect2(StrRect, 2);
  12677. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12678. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12679. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12680. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time4, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12681. m_Print.DrawRect2(StrRect, 2);
  12682. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12683. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12684. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12685. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time5, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12686. m_Print.DrawRect2(StrRect, 2);
  12687. ////////////
  12688. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12689. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12690. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12691. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12692. m_Print.DrawRect2(StrRect, 2);
  12693. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12694. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12695. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12696. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12697. m_Print.DrawRect2(StrRect, 2);
  12698. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12699. m_Print.DrawText((LPTSTR)(LPCTSTR)"赠送张数:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12700. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12701. m_Print.DrawText((LPTSTR)(LPCTSTR)m_photocount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12702. m_Print.DrawRect2(StrRect, 2);
  12703. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12704. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12705. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12706. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12707. m_Print.DrawRect2(StrRect, 2);
  12708. ////////////
  12709. ///////////spno
  12710. CRect sprc[22];
  12711. StrRect = load.m_rcarray.ElementAt(19);
  12712. StrRect.left += 4; StrRect.right -= 3;
  12713. hei = StrRect.Height();
  12714. for (i = 0; i < 22; i++)
  12715. {
  12716. sprc[i] = StrRect;
  12717. m_Print.DrawRect2(StrRect, 1);
  12718. if (i == 0)
  12719. {
  12720. StrRect.left += 5;
  12721. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12722. StrRect.left -= 5;
  12723. }
  12724. StrRect.top = StrRect.bottom;
  12725. StrRect.bottom = StrRect.top + hei;
  12726. sprc[i].left += 4; sprc[i].right -= 3;
  12727. }
  12728. StrRect.bottom = StrRect.top + 60;
  12729. m_Print.DrawRect2(StrRect, 1);
  12730. StrRect.left += 3; StrRect.top += 3;
  12731. StrRect.right -= 3; StrRect.bottom -= 3;
  12732. AutoDraw(m_Print, StrRect, m_bz, 1.8);
  12733. CString temp, tempspno, tempbz;
  12734. CSize size;
  12735. BOOL bRun = 0;
  12736. int fontsize = 12;
  12737. ll: tempspno = spno;
  12738. m_Print.SetFontFace(fontsize, 1, "宋体");
  12739. for (i = 1; i<22; i++)
  12740. {
  12741. if (!tempspno.IsEmpty())
  12742. {
  12743. temp = tempspno;
  12744. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12745. int right = 0;
  12746. CRect temprc = sprc[i];
  12747. while (size.cx>temprc.Width())
  12748. {
  12749. right++;
  12750. temp = tempspno.Left(tempspno.GetLength() - (right));
  12751. if (GIsHalfHZ(temp))
  12752. {
  12753. right++;
  12754. temp.Delete(temp.GetLength() - 1);
  12755. }
  12756. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12757. }
  12758. if (bRun)
  12759. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12760. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  12761. if (tempspno.IsEmpty())i++;
  12762. }
  12763. }
  12764. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  12765. {
  12766. fontsize--;
  12767. goto ll;
  12768. }
  12769. if (bRun == 0)
  12770. {
  12771. bRun = 1;
  12772. goto ll;
  12773. }
  12774. m_Print.SetFontFace(12, 1, "宋体");
  12775. StrRect = load2.m_rcarray.ElementAt(1);
  12776. m_Print.DrawText((LPTSTR)(LPCTSTR)"喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12777. StrRect = load2.m_rcarray.ElementAt(2);
  12778. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12779. StrRect = load2.m_rcarray.ElementAt(3);
  12780. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12781. StrRect = load2.m_rcarray.ElementAt(4);
  12782. m_Print.DrawRect2(StrRect, 2);
  12783. StrRect = load2.m_rcarray.ElementAt(0);
  12784. CString str = "\
  12785. 爱心提示:如对制作有任何要求请清楚列出,所有制作内容一经确认将按要求制作。\r\n\
  12786. 选样文件从拍摄日期计算将保留二个月;套相成品按取件日期保留三个月,逾期不做保留。\r\n\
  12787. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12788. AutoDraw(m_Print, StrRect, str, 1.8);
  12789. PrintPreview dlg; dlg.m_mode = 2;
  12790. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12791. dlg.m_pDC = m_Print.GetPDC();
  12792. if (dlg.DoModal() != IDOK)return;
  12793. //结束打印
  12794. m_Print.EndPage();
  12795. m_Print.EndPrint();
  12796. }
  12797. //分店
  12798. CString CMainFrame::GetDanWei(CString name, CArray<CStringArray, CStringArray>*array)
  12799. {
  12800. for (int i = 0; i < array->GetSize(); i++)
  12801. {
  12802. if (name == array->ElementAt(i).ElementAt(1))
  12803. return array->ElementAt(i).ElementAt(2);
  12804. }
  12805. return "";
  12806. }
  12807. //g_sendhead
  12808. int CMainFrame::GetPort()
  12809. {
  12810. static int aaa = -1;
  12811. if (aaa == -1)
  12812. {
  12813. aaa = CTime::GetCurrentTime().GetSecond() % 7;
  12814. }
  12815. aaa++;
  12816. if (aaa >= 7)aaa = 0;
  12817. return 8387 + aaa;
  12818. }
  12819. void CMainFrame::OnShowBakState()
  12820. {
  12821. // TODO: Add your command handler code here
  12822. g_sendhead.bsql = 0;
  12823. g_sendhead.code[0] = 171;
  12824. g_sendhead.tabcount = 1;
  12825. g_pMainWnd->ProcessChatMessageRequest2(1);
  12826. if (g_bSendOK == 0)
  12827. {
  12828. return;
  12829. }
  12830. CArray<CStringArray, CStringArray>g_bakstatearray;
  12831. DataToArray(&g_bakstatearray);
  12832. while (g_bakstatearray.GetSize() > 7)
  12833. {
  12834. g_bakstatearray.RemoveAt(0);
  12835. }
  12836. int photocount = 0;
  12837. int infocount = 0;
  12838. for (int i = 0; i < g_bakstatearray.GetSize(); i++)
  12839. {
  12840. if (g_bakstatearray.ElementAt(i).ElementAt(1) != "1")photocount++;
  12841. if (g_bakstatearray.ElementAt(i).ElementAt(2) != "1")infocount++;
  12842. }
  12843. ShowBakState dlg;
  12844. dlg.m_pArray = &g_bakstatearray;
  12845. dlg.DoModal();
  12846. }
  12847. void CMainFrame::PrintReceipt2(CStringArray *pArray)
  12848. {
  12849. int i = 0;
  12850. int printcot = 1;
  12851. for (int aa = 0; aa < printcot; aa++)
  12852. {
  12853. g_sendhead.bsql = 0;
  12854. g_sendhead.code[0] = 24;
  12855. g_sendhead.tabcount = 1;
  12856. int g_nYearposTemp = g_nYearpos;
  12857. g_nYearpos = -1;
  12858. g_pMainWnd->ProcessChatMessageRequest2(1);
  12859. g_nYearpos = g_nYearposTemp;
  12860. if (0 == g_bSendOK)return;
  12861. DataToArray(&g_cominfoarray);
  12862. CString SerialNo;
  12863. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  12864. CPrintRX m_Print;
  12865. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12866. {
  12867. m_Print.InitToPrint(NULL, 1);
  12868. }
  12869. else
  12870. {
  12871. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  12872. if (name.IsEmpty())
  12873. m_Print.InitToPrint(NULL, 1);
  12874. else
  12875. {
  12876. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12877. if (nret == -1 && aa == 0)
  12878. {
  12879. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12880. }
  12881. }
  12882. }
  12883. m_Print.StartPrint();
  12884. m_Print.StartPage();
  12885. LoadRect load;
  12886. BOOL bSmall = 0;
  12887. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  12888. {
  12889. bSmall = 1;
  12890. load.SetLiaPath("20.lia");
  12891. }
  12892. else
  12893. load.SetLiaPath("10.lia");
  12894. if (bSmall)
  12895. load.SetMargins(-10, 0);
  12896. else
  12897. load.SetMargins(10, 0);
  12898. if (!load.Load())return;
  12899. int rcpos = -1;
  12900. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12901. Image *pImg = NULL;
  12902. #ifdef MNLS_VERSION
  12903. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  12904. #else
  12905. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  12906. #endif
  12907. // m_Print.DrawImage(pImg, StrRect);
  12908. delete pImg;
  12909. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  12910. {
  12911. Image *pImg = NULL;
  12912. g_nSendCode = 31;
  12913. int g_nYearposTemp = g_nYearpos;
  12914. g_nYearpos = -1;
  12915. g_pMainWnd->ProcessChatMessageRequest2(1);
  12916. g_nYearpos = g_nYearposTemp;
  12917. g_nSendCode = 0;
  12918. if (g_bSendOK == 0)return;
  12919. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  12920. if (pImg)
  12921. {
  12922. StrRect.left = 65;
  12923. if (bSmall)StrRect.left = 55;
  12924. StrRect.top = 10;
  12925. StrRect.right = StrRect.left + 58;
  12926. StrRect.bottom = StrRect.top + 58;
  12927. m_Print.DrawImage(pImg, StrRect);
  12928. delete pImg; pImg = NULL;
  12929. }
  12930. }
  12931. if (bSmall)
  12932. {
  12933. m_Print.SetFontFace(18, 1, "黑体");
  12934. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12935. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12936. m_Print.SetFontFace(9, 1, "宋体");
  12937. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12938. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12939. m_Print.SetFontFace(6, 1, "宋体");
  12940. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12941. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12942. m_Print.SetFontFace(9, 1, "宋体");
  12943. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12944. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12945. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12946. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12947. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12948. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12949. int hei = StrRect.Height();
  12950. StrRect.bottom = StrRect.top;
  12951. StrRect.top -= 8;
  12952. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  12953. m_Print.SetFontFace(10, 1, "宋体");
  12954. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12955. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12956. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12957. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12958. m_Print.SetFontFace(9, 1, "宋体");
  12959. for ( i = 7; i < 24; i++)
  12960. {
  12961. StrRect = load.m_rcarray.ElementAt(i);
  12962. m_Print.DrawRect2(StrRect, 1);
  12963. }
  12964. for (i = 9; i < 24; i++)
  12965. {
  12966. StrRect = load.m_rcarray.ElementAt(i);
  12967. StrRect.left += 2;
  12968. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12969. }
  12970. m_Print.SetFontFace(6, 1, "宋体");
  12971. for (i = 24; i < 26; i++)
  12972. {
  12973. StrRect = load.m_rcarray.ElementAt(i);
  12974. StrRect.left += 2;
  12975. if (i == 24)
  12976. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12977. else
  12978. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12979. }
  12980. }
  12981. else//大单
  12982. {
  12983. m_Print.SetFontFace(20, 1, "黑体");
  12984. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12985. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12986. m_Print.SetFontFace(11, 1, "宋体");
  12987. // StrRect=load.m_rcarray .ElementAt (++rcpos);
  12988. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12989. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15;
  12990. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12991. int hei = StrRect.Height();
  12992. StrRect.bottom = StrRect.top;
  12993. StrRect.top -= 10;
  12994. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  12995. m_Print.SetFontFace(8, 1, "宋体");
  12996. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12997. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12998. m_Print.SetFontFace(11, 1, "宋体");
  12999. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13000. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13001. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13002. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13003. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13004. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13005. m_Print.SetFontFace(13, 1, "宋体");
  13006. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13007. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13008. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13009. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13010. m_Print.SetFontFace(11, 1, "宋体");
  13011. for ( i = 7; i < 24; i++)
  13012. {
  13013. StrRect = load.m_rcarray.ElementAt(i);
  13014. m_Print.DrawRect2(StrRect, 1);
  13015. }
  13016. for (i = 9; i < 24; i++)
  13017. {
  13018. StrRect = load.m_rcarray.ElementAt(i);
  13019. StrRect.left += 2;
  13020. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13021. }
  13022. m_Print.SetFontFace(8, 1, "宋体");
  13023. for (i = 24; i < 27; i++)
  13024. {
  13025. StrRect = load.m_rcarray.ElementAt(i);
  13026. StrRect.left += 2;
  13027. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13028. }
  13029. }
  13030. PrintPreview dlg;
  13031. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13032. dlg.m_pDC = m_Print.GetPDC();
  13033. if (aa == 0)
  13034. {
  13035. if (dlg.DoModal() != IDOK)
  13036. return;
  13037. printcot = dlg.m_num;
  13038. }
  13039. //结束打印
  13040. m_Print.EndPage();
  13041. m_Print.EndPrint();
  13042. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  13043. CString sql;
  13044. sql.Format("update version set [serialno2]='%s'", SerialNo);
  13045. g_sendhead.bsql = 1;
  13046. g_nYearposTemp = g_nYearpos;
  13047. g_nYearpos = -1;
  13048. g_pMainWnd->ProcessChatMessageRequest2(sql);
  13049. g_nYearpos = g_nYearposTemp;
  13050. }
  13051. }
  13052. //出生年月
  13053. //第一联
  13054. void CMainFrame::OnLog()
  13055. {
  13056. // TODO: Add your command handler code here OnShowBakState
  13057. if (IsHasRightsnew(49) == 0)return;
  13058. ShowLOg dlg;
  13059. dlg.DoModal();
  13060. }
  13061. // www.lyfz.net 8888
  13062. void CMainFrame::PrintDinDan6(CString m_id)
  13063. {
  13064. // TODO: Add your control notification handler code here 预约订单
  13065. int printcot = 1;
  13066. for (int aa = 0; aa < printcot; aa++)
  13067. {
  13068. PrintPreview dlg;
  13069. CPrintRX m_Print;
  13070. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13071. {
  13072. m_Print.InitToPrint(NULL, 1);
  13073. }
  13074. else
  13075. {
  13076. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  13077. if (name.IsEmpty())
  13078. m_Print.InitToPrint(NULL, 1);
  13079. else
  13080. {
  13081. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13082. if (nret == -1 && aa == 0)
  13083. {
  13084. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  13085. }
  13086. }
  13087. }
  13088. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  13089. {
  13090. m_Print.StartPrint();
  13091. m_Print.StartPage();
  13092. LoadRect load;
  13093. load.SetLiaPath("6.lia");
  13094. load.SetMargins(-14, 15);
  13095. if (!load.Load())return;
  13096. LoadRect load2;
  13097. load2.SetLiaPath("7.lia");
  13098. load2.SetMargins(-14, 216 + 15);
  13099. if (!load2.Load())return;
  13100. LoadRect load3;
  13101. load3.SetLiaPath("8.lia");
  13102. load3.SetMargins(-14, 705 + 15);
  13103. if (!load3.Load())return;
  13104. int i;
  13105. //////////////////////////////////////////////////////////////
  13106. CStringArray txarray;
  13107. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  13108. g_sendhead.code[0] = 11;
  13109. g_sendhead.code[1] = 52;
  13110. g_sendhead.code[2] = 50;
  13111. g_sendhead.code[3] = 150;
  13112. g_sendhead.code[4] = 77;
  13113. g_sendhead.code[5] = 4;
  13114. g_sendhead.tabcount = 6;
  13115. g_sendhead.bsql = 0;
  13116. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  13117. CArray<CStringArray, CStringArray>sparray;
  13118. CArray<CStringArray, CStringArray>clientarray;
  13119. CArray<CStringArray, CStringArray>phonearray;
  13120. CArray<CStringArray, CStringArray>fgarray;
  13121. CArray<CStringArray, CStringArray>danweiarray;
  13122. CArray<CStringArray, CStringArray>jdarray;
  13123. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  13124. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  13125. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  13126. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  13127. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  13128. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  13129. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  13130. CString m_taoxiname;
  13131. if (m_zs.Find("\\") != -1)
  13132. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  13133. else
  13134. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  13135. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  13136. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  13137. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  13138. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  13139. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  13140. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  13141. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  13142. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  13143. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  13144. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  13145. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  13146. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  13147. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  13148. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  13149. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  13150. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  13151. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  13152. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  13153. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  13154. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  13155. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  13156. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  13157. if (jdarray.GetSize())
  13158. {
  13159. if (m_bz.IsEmpty() == 0)
  13160. m_bz = "\r\n" + m_bz;
  13161. m_bz += "景点:";
  13162. }
  13163. for (i = 0; i < jdarray.GetSize(); i++)
  13164. {
  13165. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  13166. }
  13167. m_bz.TrimRight(";");
  13168. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  13169. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13170. if (IsHasRights2new(31) == 0)
  13171. {
  13172. m_phone1 = "***";
  13173. m_phone2 = "***";
  13174. }
  13175. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  13176. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13177. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  13178. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  13179. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  13180. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  13181. filter = "name='" + m_ren + "'";
  13182. g_sendhead.code[0] = 5;
  13183. g_sendhead.tabcount = 1;
  13184. g_sendhead.bsql = 0;
  13185. int g_nYearposTemp = g_nYearpos;
  13186. g_nYearpos = -1;
  13187. g_pMainWnd->ProcessChatMessageRequest2(filter);
  13188. g_nYearpos = g_nYearposTemp;
  13189. if (g_bSendOK == 0)return;
  13190. DataToArray(&phonearray);
  13191. m_money1.Format("%f", atof(m_taoxijiage));
  13192. m_money2.Format("%f", atof(m_payed1));
  13193. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  13194. ConvertToPrice(m_money1);
  13195. ConvertToPrice(m_money2);
  13196. ConvertToPrice(m_money3);
  13197. ////////////////////////////////////////////////////////////////
  13198. int rcpos = -1;
  13199. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13200. StrRect.top -= 15; StrRect.bottom -= 15;
  13201. Image *pImg = NULL;
  13202. #ifdef MNLS_VERSION
  13203. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  13204. #else
  13205. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  13206. #endif
  13207. m_Print.DrawImage(pImg, StrRect);
  13208. delete pImg;
  13209. m_Print.SetFontFace(11, 1, "宋体");
  13210. StrRect = load.m_rcarray.ElementAt(20);
  13211. StrRect.right = load.m_rcarray.ElementAt(23).right;
  13212. StrRect.top -= 18; StrRect.bottom -= 18;
  13213. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  13214. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13215. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  13216. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13217. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13218. StrRect.top -= 15; StrRect.bottom -= 15;
  13219. #ifdef MNLS_VERSION
  13220. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13221. #endif
  13222. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13223. StrRect.top -= 15; StrRect.bottom -= 15;
  13224. #ifdef MNLS_VERSION
  13225. m_Print.DrawRect(StrRect);
  13226. #endif
  13227. m_Print.SetFontFace(7, 1, "黑体");
  13228. m_Print.SetColor(0xffffff);
  13229. #ifdef MNLS_VERSION
  13230. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13231. #endif
  13232. m_Print.SetColor(0);
  13233. m_Print.SetFontFace(15, 1, "宋体");
  13234. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13235. StrRect.top -= 15; StrRect.bottom -= 15;
  13236. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同拍摄单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13237. CStringArray strarray;
  13238. strarray.Add("NO: " + m_id);
  13239. CString date;
  13240. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  13241. strarray.Add(date);
  13242. strarray.Add("喜爱");
  13243. strarray.Add("格调");
  13244. if (fgarray.GetSize() == 12)
  13245. {
  13246. for (int i = 0; i < 12; i++)
  13247. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  13248. }
  13249. else
  13250. {
  13251. strarray.Add("复古典雅");
  13252. strarray.Add("温文尔雅");
  13253. strarray.Add("豪华艳丽");
  13254. strarray.Add("传统大方");
  13255. strarray.Add("新潮个性");
  13256. strarray.Add("浪漫奔放");
  13257. strarray.Add("简单素雅");
  13258. strarray.Add("活泼俏丽");
  13259. strarray.Add("妩媚温馨");
  13260. strarray.Add("温柔贤惠");
  13261. strarray.Add("成熟感性");
  13262. strarray.Add("清纯可爱");
  13263. }
  13264. strarray.Add("姓名");
  13265. // strarray.Add("职业");
  13266. strarray.Add("");
  13267. strarray.Add("地址");
  13268. strarray.Add("电话");
  13269. #ifdef CHILD_VERSION
  13270. strarray.Add("家长");
  13271. strarray.Add("宝宝");
  13272. #else
  13273. strarray.Add("先生");
  13274. strarray.Add("女士");
  13275. #endif
  13276. m_Print.SetFontFace(11, 1, "宋体");
  13277. for (i = 0; i < strarray.GetSize(); i++)
  13278. {
  13279. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13280. if (i < 2)
  13281. {
  13282. StrRect.top -= 15; StrRect.bottom -= 15;
  13283. }
  13284. if (i>15)
  13285. m_Print.DrawRect2(StrRect, 1);
  13286. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13287. }
  13288. for (i = 29; i <= 40; i++)
  13289. {
  13290. if (m_style.GetLength() <= (i - 29))continue;
  13291. if (m_style.GetAt(i - 29) != '1')continue;
  13292. StrRect = load.m_rcarray.ElementAt(i - 1);
  13293. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13294. }
  13295. for (i = 27; i <= 48; i++)
  13296. {
  13297. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13298. m_Print.DrawRect2(StrRect, 1);
  13299. }
  13300. #ifdef CHILD_VERSION
  13301. StrRect = load.m_rcarray.ElementAt(45);
  13302. StrRect.right = StrRect.left + 62;
  13303. m_Print.DrawRect2(StrRect, 1);
  13304. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13305. StrRect.left = StrRect.right;
  13306. StrRect.right = StrRect.left + 62;
  13307. m_Print.DrawRect2(StrRect, 1);
  13308. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13309. StrRect.left = StrRect.right;
  13310. StrRect.right = StrRect.left + 62;
  13311. m_Print.DrawRect2(StrRect, 1);
  13312. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13313. StrRect.left = StrRect.right;
  13314. StrRect.right = StrRect.left + 62;
  13315. m_Print.DrawRect2(StrRect, 1);
  13316. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13317. #endif
  13318. /////////////////////////
  13319. strarray.RemoveAll();
  13320. CString temp;
  13321. temp.Format("拍摄 选 %d 款,其中", atoi(m_outside) + atoi(m_outside2));
  13322. strarray.Add(temp);
  13323. temp.Format("内景 %d 款,外景 %d 款.", atoi(m_outside2), atoi(m_outside));
  13324. strarray.Add(temp);
  13325. strarray.Add("化妆");
  13326. strarray.Add("造型");
  13327. #ifdef CHILD_VERSION
  13328. strarray.Add("");
  13329. #else
  13330. strarray.Add("婚纱");
  13331. #endif
  13332. strarray.Add("服饰");
  13333. strarray.Add("配");
  13334. strarray.Add("置");
  13335. strarray.Add("其");
  13336. strarray.Add("它");
  13337. strarray.Add("套系名称");
  13338. strarray.Add("镜款");
  13339. strarray.Add("套系总价");
  13340. strarray.Add("主摄影师");
  13341. strarray.Add("拍摄日期");
  13342. strarray.Add("定金");
  13343. #ifdef CHILD_VERSION
  13344. strarray.Add("主引导师");
  13345. #else
  13346. strarray.Add("主化妆师");
  13347. #endif
  13348. strarray.Add("看样日期");
  13349. strarray.Add("补 余 款");
  13350. strarray.Add("总监");
  13351. strarray.Add("取件日期");
  13352. rcpos = -1;
  13353. for (i = 0; i < strarray.GetSize(); i++)
  13354. {
  13355. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13356. if (i>9)
  13357. m_Print.DrawRect2(StrRect, 1);
  13358. #ifdef CHILD_VERSION
  13359. if (i == 5)
  13360. StrRect.top -= StrRect.Height();
  13361. #endif
  13362. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13363. }
  13364. for (i = 22; i <= 41; i++)
  13365. {
  13366. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13367. m_Print.DrawRect2(StrRect, 1);
  13368. }
  13369. /////////////////////////////
  13370. strarray.RemoveAll();
  13371. #ifdef CHILD_VERSION
  13372. strarray.Add("顾客方 家长:");
  13373. strarray.Add("宝宝:");
  13374. #else
  13375. strarray.Add("顾客方 先生:");
  13376. strarray.Add("女士:");
  13377. #endif
  13378. strarray.Add("电话:");
  13379. strarray.Add("影楼方 店长:");
  13380. strarray.Add("接单人:");
  13381. strarray.Add("电话:");
  13382. rcpos = -1;
  13383. for (i = 0; i < strarray.GetSize(); i++)
  13384. {
  13385. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13386. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13387. }
  13388. for (i = 7; i <= 12; i++)
  13389. {
  13390. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13391. // if(i!=10)
  13392. m_Print.DrawRect2(StrRect, 2);
  13393. }
  13394. //////////////////////////////////////
  13395. //开始打数据
  13396. strarray.RemoveAll();
  13397. strarray.Add(m_name1);
  13398. strarray.Add(m_name2);
  13399. strarray.Add("");
  13400. strarray.Add("");
  13401. strarray.Add(m_addr1);
  13402. #ifdef CHILD_VERSION
  13403. strarray.Add("");
  13404. #else
  13405. strarray.Add(m_addr2);
  13406. #endif
  13407. strarray.Add(m_phone1);
  13408. strarray.Add(m_phone2);
  13409. for (i = 41; i <= 48; i++)
  13410. {
  13411. StrRect = load.m_rcarray.ElementAt(i - 1);
  13412. StrRect.left += 4;
  13413. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13414. }
  13415. ///////////////////////////////
  13416. strarray.RemoveAll();
  13417. strarray.Add(m_money1);
  13418. strarray.Add(m_waiter1);
  13419. strarray.Add(m_time2);
  13420. strarray.Add(m_money2);
  13421. strarray.Add(m_waiter2);
  13422. strarray.Add(m_time4);
  13423. strarray.Add(m_money3);
  13424. strarray.Add("");
  13425. strarray.Add(m_time5);
  13426. for (i = 32; i <= 40; i++)
  13427. {
  13428. StrRect = load2.m_rcarray.ElementAt(i - 1);
  13429. StrRect.left += 4;
  13430. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13431. }
  13432. ///////////////////////////////
  13433. strarray.RemoveAll();
  13434. strarray.Add("");//m_name1);
  13435. strarray.Add("");//m_name2);
  13436. CString phone;
  13437. if (m_phone1.IsEmpty() == 0)
  13438. phone = m_phone1 + ",";
  13439. phone += m_phone2;
  13440. phone.TrimRight(",");
  13441. strarray.Add("");//phone);
  13442. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  13443. strarray.Add(m_ren);
  13444. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13445. for (i = 7; i <= 12; i++)
  13446. {
  13447. StrRect = load3.m_rcarray.ElementAt(i - 1);
  13448. StrRect.left += 4;
  13449. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13450. }
  13451. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  13452. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13453. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  13454. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13455. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  13456. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13457. //////////////////////////////
  13458. //开始画文字
  13459. StrRect = load2.m_rcarray.ElementAt(30);
  13460. StrRect.left += 3;
  13461. StrRect.top += 3;
  13462. StrRect.right -= 2;
  13463. StrRect.bottom -= 2;
  13464. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  13465. StrRect = load2.m_rcarray.ElementAt(29);
  13466. StrRect.left += 3;
  13467. StrRect.top += 3;
  13468. StrRect.right -= 2;
  13469. StrRect.bottom -= 2;
  13470. str = "";
  13471. for (i = 0; i < sparray.GetSize(); i++)
  13472. {
  13473. str += sparray.ElementAt(i).ElementAt(5);
  13474. str += " 数量:";
  13475. str += sparray.ElementAt(i).ElementAt(3);
  13476. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  13477. str += "\r\n";
  13478. }
  13479. str.TrimRight("\r\n");
  13480. AutoDraw(m_Print, StrRect, str, 1.4);
  13481. StrRect = load2.m_rcarray.ElementAt(40);
  13482. StrRect.top += 8;
  13483. m_Print.SetFontFace(12, 1, "黑体");
  13484. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  13485. StrRect.left += 3;
  13486. StrRect.top += 30;
  13487. StrRect.right -= 2;
  13488. StrRect.bottom -= 2;
  13489. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  13490. if (str.IsEmpty())
  13491. {
  13492. str = "\
  13493. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  13494. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  13495. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  13496. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  13497. 持良好的心境.\r\n\
  13498. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  13499. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  13500. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  13501. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  13502. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  13503. 勿进影室, 以免影响拍摄.\r\n\
  13504. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  13505. 师或店长沟通.\r\n\
  13506. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  13507. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  13508. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  13509. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  13510. 9. 本合同余额欠款须在拍照前付清.\r\n\
  13511. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  13512. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  13513. 还.";
  13514. }
  13515. AutoDraw(m_Print, StrRect, str, 1.8);
  13516. }
  13517. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13518. dlg.m_pDC = m_Print.GetPDC();
  13519. dlg.m_mode = 1;
  13520. if (aa == 0)
  13521. {
  13522. if (dlg.DoModal() != IDOK)
  13523. return;
  13524. printcot = dlg.m_num;
  13525. }
  13526. //结束打印
  13527. m_Print.EndPage();
  13528. m_Print.EndPrint();
  13529. }
  13530. }
  13531. void CMainFrame::InsideMsg()
  13532. {
  13533. ///内部消息
  13534. CString str;
  13535. g_sendhead.bsql = 0;
  13536. g_sendhead.code[0] = 126;
  13537. g_sendhead.tabcount = 1;
  13538. g_bNoConnDlg = 1;
  13539. g_pMainWnd->ProcessChatMessageRequest2(1); g_bNoConnDlg = 0;
  13540. if (g_bSendOK == 0)return;
  13541. CArray<CStringArray, CStringArray>m_List1array;
  13542. DataToArray(&g_List1array);//, &m_List1array);
  13543. int i = 0;
  13544. m_List1array.SetSize(g_List1array.GetSize());
  13545. for ( i = 0; i < g_List1array.GetSize(); i++)
  13546. {
  13547. m_List1array.ElementAt(i).Copy(g_List1array.ElementAt(i));
  13548. }
  13549. str = "," + g_user.name + ",";
  13550. for (i = g_List1array.GetSize() - 1; i >= 0; i--)
  13551. {
  13552. CString receivers2 = g_List1array.ElementAt(i).ElementAt(4);
  13553. receivers2.TrimLeft(",");
  13554. receivers2.TrimRight(",");
  13555. receivers2 = "," + receivers2 + ",";
  13556. CString receivers = g_List1array.ElementAt(i).ElementAt(3);
  13557. receivers.TrimLeft(",");
  13558. receivers.TrimRight(",");
  13559. receivers = "," + receivers + ",";
  13560. if (receivers.Find(str) == -1)
  13561. g_List1array.RemoveAt(i);
  13562. else if (receivers2.Find(str) != -1)
  13563. g_List1array.RemoveAt(i);
  13564. }
  13565. if (g_List1array.GetSize())
  13566. {
  13567. ShowMsg dlg;
  13568. dlg.DoModal();
  13569. }
  13570. for (i = m_List1array.GetSize() - 1; i >= 0; i--)
  13571. {
  13572. CString receivers2 = m_List1array.ElementAt(i).ElementAt(4);
  13573. receivers2.TrimLeft(",");
  13574. receivers2.TrimRight(",");
  13575. receivers2 = "," + receivers2 + ",";
  13576. CString receivers = m_List1array.ElementAt(i).ElementAt(3);
  13577. if (receivers != "")
  13578. m_List1array.RemoveAt(i);
  13579. else if (receivers2.Find(str) != -1)
  13580. m_List1array.RemoveAt(i);
  13581. }
  13582. if (m_List1array.GetSize())
  13583. {
  13584. SendInsideMsg2 dlg;
  13585. dlg.m_bShow = 1;
  13586. dlg.m_pArray = &m_List1array;
  13587. dlg.DoModal();
  13588. }
  13589. }
  13590. //定金
  13591. /************************************************************************/
  13592. /*
  13593. 函数:PrintHireDress
  13594. 描述:打印礼服出租单;
  13595. 参数:
  13596. strOrderNumber 礼服订单号;
  13597. 注意:
  13598. */
  13599. /************************************************************************/
  13600. void CMainFrame::PrintHireDress(CString strOrderNumber) // 打印礼服出租单;
  13601. {
  13602. int printcot = 1;
  13603. for (int aa = 0; aa < printcot; aa++)
  13604. {
  13605. CPrintRX m_Print;
  13606. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13607. {
  13608. m_Print.InitToPrint(NULL, 1);
  13609. }
  13610. else
  13611. {
  13612. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13613. if (name.IsEmpty())
  13614. m_Print.InitToPrint(NULL, 1);
  13615. else
  13616. {
  13617. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13618. if (nret == -1 && aa == 0)
  13619. {
  13620. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  13621. }
  13622. }
  13623. }
  13624. m_Print.StartPrint();
  13625. m_Print.StartPage();
  13626. LoadRect load;
  13627. load.SetLiaPath("21.lia");
  13628. load.SetMargins(0, 0);
  13629. if (!load.Load())
  13630. {
  13631. return;
  13632. }
  13633. int i;
  13634. //////////////////////////////////////////////////////////////
  13635. //CString filter="id='"+strOrderNumber+"';id='"+strOrderNumber+"';id='"+strOrderNumber+"'";
  13636. CString strFilter;
  13637. strFilter.Format("id='%s';id='%s';id='%s'", strOrderNumber, strOrderNumber, strOrderNumber);
  13638. g_sendhead.bsql = 0;
  13639. g_sendhead.code[0] = 73;
  13640. g_sendhead.code[1] = 74;
  13641. g_sendhead.code[2] = 52;
  13642. g_sendhead.tabcount = 3;
  13643. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  13644. if (g_bSendOK == 0)
  13645. {
  13646. return;
  13647. }
  13648. CArray<CStringArray, CStringArray>dresshirearray;
  13649. CArray<CStringArray, CStringArray>dresshiredataarray;
  13650. CArray<CStringArray, CStringArray>clientarray;
  13651. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13652. if (dresshirearray.GetSize() == 0)
  13653. {
  13654. return;
  13655. }
  13656. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10);
  13657. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7);
  13658. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8);
  13659. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6);
  13660. if (clientarray.GetSize() == 0)
  13661. {
  13662. return;
  13663. }
  13664. //AfxMessageBox("打印礼服出租单-()");
  13665. CString m_name2 = clientarray.ElementAt(0).ElementAt(2);
  13666. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13667. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13668. CString m_time3 = clientarray.ElementAt(0).ElementAt(20);
  13669. //#if JEFF_TEST
  13670. // if ( dresshiredataarray.GetSize() == 0 )
  13671. // {
  13672. // AfxMessageBox("没衣服");
  13673. // }
  13674. //#endif
  13675. CString sItem;
  13676. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13677. {
  13678. sItem += "编号:";
  13679. sItem += dresshiredataarray.ElementAt(i).ElementAt(1);
  13680. sItem += " ";
  13681. sItem += " 名称:";
  13682. sItem += dresshiredataarray.ElementAt(i).ElementAt(2);
  13683. sItem += " 数量:";
  13684. sItem += dresshiredataarray.ElementAt(i).ElementAt(3) + "\r\n";
  13685. }
  13686. sItem += "金额:";
  13687. sItem += dresshirearray.ElementAt(0).ElementAt(1);
  13688. sItem += " ";
  13689. sItem += " 押金:";
  13690. sItem += dresshirearray.ElementAt(0).ElementAt(2) + "\r\n";
  13691. ////////////////////////////////////////////////////////////////
  13692. int rcpos = -1;
  13693. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13694. m_Print.SetFontFace(17, 1, "宋体");
  13695. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13696. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13697. m_Print.SetFontFace(10, 1, "宋体");
  13698. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13699. CStringArray strarray;
  13700. strarray.Add("客户姓名");
  13701. strarray.Add("客户电话");
  13702. strarray.Add("预定日期");
  13703. strarray.Add("结婚日期");
  13704. strarray.Add("取件日期");
  13705. strarray.Add("归还日期");
  13706. strarray.Add("本店地址");
  13707. strarray.Add("电 话");
  13708. strarray.Add("客户地址");
  13709. strarray.Add("客户签名");
  13710. for (i = 2; i < 12; i++)
  13711. {
  13712. StrRect = load.m_rcarray.ElementAt(i);
  13713. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13714. }
  13715. strarray.RemoveAll();
  13716. strarray.Add(m_name2);
  13717. strarray.Add(m_phone2);
  13718. strarray.Add(m_inputdate);
  13719. strarray.Add(m_time3);
  13720. strarray.Add(m_date1);
  13721. strarray.Add(m_date2);
  13722. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13723. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13724. strarray.Add(m_addr2);
  13725. strarray.Add("");
  13726. for (i = 12; i < 22; i++)
  13727. {
  13728. StrRect = load.m_rcarray.ElementAt(i);
  13729. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13730. m_Print.DrawRect2(StrRect, 2);
  13731. }
  13732. for (i = 25; i < 30; i++)
  13733. {
  13734. StrRect = load.m_rcarray.ElementAt(i);
  13735. m_Print.DrawRect2(StrRect, 1);
  13736. }
  13737. StrRect = load.m_rcarray.ElementAt(22);
  13738. StrRect.top += 7;
  13739. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13740. StrRect = load.m_rcarray.ElementAt(23);
  13741. StrRect.top += 7;
  13742. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13743. StrRect = load.m_rcarray.ElementAt(24);
  13744. StrRect.top += 7;
  13745. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13746. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13747. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13748. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13749. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13750. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13751. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13752. if (str.IsEmpty())
  13753. {
  13754. str = "\
  13755. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13756. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13757. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13758. 4. 如有破损酌情赔偿.";
  13759. }
  13760. AutoDraw(m_Print, StrRect, str, 1.5);
  13761. PrintPreview dlg;
  13762. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13763. dlg.m_pDC = m_Print.GetPDC();
  13764. if (aa == 0)
  13765. {
  13766. if (dlg.DoModal() != IDOK)
  13767. return;
  13768. printcot = dlg.m_num;
  13769. }
  13770. //结束打印
  13771. m_Print.EndPage();
  13772. m_Print.EndPrint();
  13773. }
  13774. }
  13775. void CMainFrame::PrintHireDress_01(CString strOrderNumber) // 打印礼服出租单,无法改变结构,需要修改21.lia才能改变打印的布局;
  13776. {
  13777. int printcot = 1;
  13778. for (int aa = 0; aa < printcot; aa++)
  13779. {
  13780. CPrintRX m_Print;
  13781. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13782. {
  13783. m_Print.InitToPrint(NULL, 1);
  13784. }
  13785. else
  13786. {
  13787. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13788. if (name.IsEmpty())
  13789. m_Print.InitToPrint(NULL, 1);
  13790. else
  13791. {
  13792. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13793. if (nret == -1 && aa == 0)
  13794. {
  13795. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  13796. m_Print.InitToPrint(NULL, 1);
  13797. }
  13798. }
  13799. }
  13800. m_Print.StartPrint();
  13801. m_Print.StartPage();
  13802. LoadRect load;
  13803. load.SetLiaPath("21.lia");
  13804. load.SetMargins(0, 0);
  13805. if (!load.Load())return;
  13806. int i;
  13807. //////////////////////////////////////////////////////////////
  13808. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  13809. g_sendhead.bsql = 0;
  13810. g_sendhead.code[0] = 73; // dresshire表;
  13811. g_sendhead.code[1] = 74; // dresshiredata表;
  13812. g_sendhead.code[2] = 52; // client表;
  13813. g_sendhead.tabcount = 3;
  13814. g_pMainWnd->ProcessChatMessageRequest2(filter);
  13815. if (g_bSendOK == 0)
  13816. {
  13817. return;
  13818. }
  13819. CArray<CStringArray, CStringArray>dresshirearray;
  13820. CArray<CStringArray, CStringArray>dresshiredataarray;
  13821. CArray<CStringArray, CStringArray>clientarray;
  13822. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13823. if (dresshirearray.GetSize() == 0)return;
  13824. // dresshire;
  13825. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10); // 备注;
  13826. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7); // 取衣日期;
  13827. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8); // 还衣日期;
  13828. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6); // 记录日期;
  13829. CString strPrice = dresshirearray.ElementAt(0).ElementAt(1); // 金额;
  13830. CString strDeposit = dresshirearray.ElementAt(0).ElementAt(2); // 押金;
  13831. // client表;
  13832. if (clientarray.GetSize() == 0)return;
  13833. CString m_name2 = clientarray.ElementAt(0).ElementAt(2); // 女宾姓名;
  13834. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4); // 女宾手机;
  13835. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8); // 女宾地址;
  13836. CString m_time3 = clientarray.ElementAt(0).ElementAt(20); // 婚期;
  13837. // dresshiredata表;
  13838. CString sItem;
  13839. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13840. {
  13841. sItem += dresshiredataarray.ElementAt(i).ElementAt(1); // 礼服编号;
  13842. sItem += " ";
  13843. sItem += dresshiredataarray.ElementAt(i).ElementAt(2); // 礼服名称;
  13844. sItem += " 数量:";
  13845. sItem += dresshiredataarray.ElementAt(i).ElementAt(3) + "\r\n"; // 礼服数量;
  13846. }
  13847. sItem += " 金额:";
  13848. sItem += dresshirearray.ElementAt(0).ElementAt(1); // 出租金额;
  13849. sItem += " 押金:";
  13850. sItem += dresshirearray.ElementAt(0).ElementAt(2) + "\r\n"; // 押金;
  13851. ////////////////////////////////////////////////////////////////
  13852. int rcpos = -1;
  13853. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13854. m_Print.SetFontFace(17, 1, "宋体");
  13855. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13856. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13857. m_Print.SetFontFace(10, 1, "宋体");
  13858. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13859. CStringArray strarray;
  13860. strarray.Add("客户姓名"); // 1.
  13861. strarray.Add("客户电话");
  13862. strarray.Add("预定日期");
  13863. strarray.Add("结婚日期");
  13864. strarray.Add("取件日期"); // 5.
  13865. strarray.Add("归还日期");
  13866. strarray.Add("本店地址");
  13867. strarray.Add("电 话");
  13868. strarray.Add("客户地址");
  13869. strarray.Add("客户签名"); // 10.
  13870. //strarray.Add("金额");
  13871. //strarray.Add("押金");
  13872. for( i=2; i<12; i++)
  13873. //for (i = 2; i < 14; i++)
  13874. {
  13875. StrRect = load.m_rcarray.ElementAt(i);
  13876. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13877. }
  13878. strarray.RemoveAll();
  13879. strarray.Add(m_name2);
  13880. strarray.Add(m_phone2);
  13881. strarray.Add(m_inputdate);
  13882. strarray.Add(m_time3);
  13883. strarray.Add(m_date1);
  13884. strarray.Add(m_date2);
  13885. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13886. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13887. strarray.Add(m_addr2);
  13888. strarray.Add("");
  13889. strarray.Add(strPrice); // 金额;
  13890. strarray.Add(strDeposit); // 押金;
  13891. for( i=12; i<22; i++)
  13892. //for (i = 14; i < 24; i++)
  13893. {
  13894. StrRect = load.m_rcarray.ElementAt(i);
  13895. //m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i-12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13896. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 14), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13897. m_Print.DrawRect2(StrRect, 2);
  13898. }
  13899. for (i = 25; i < 30; i++)
  13900. {
  13901. StrRect = load.m_rcarray.ElementAt(i);
  13902. m_Print.DrawRect2(StrRect, 1);
  13903. }
  13904. StrRect = load.m_rcarray.ElementAt(22);
  13905. StrRect.top += 7;
  13906. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13907. StrRect = load.m_rcarray.ElementAt(23);
  13908. StrRect.top += 7;
  13909. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13910. StrRect = load.m_rcarray.ElementAt(24);
  13911. StrRect.top += 7;
  13912. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13913. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13914. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13915. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13916. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13917. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13918. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13919. if (str.IsEmpty())
  13920. {
  13921. str = "\
  13922. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13923. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13924. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13925. 4. 如有破损酌情赔偿.";
  13926. }
  13927. AutoDraw(m_Print, StrRect, str, 1.5);
  13928. PrintPreview dlg;
  13929. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13930. dlg.m_pDC = m_Print.GetPDC();
  13931. if (aa == 0)
  13932. {
  13933. if (dlg.DoModal() != IDOK)
  13934. return;
  13935. printcot = dlg.m_num;
  13936. }
  13937. //结束打印
  13938. m_Print.EndPage();
  13939. m_Print.EndPrint();
  13940. }
  13941. }
  13942. void CMainFrame::PrintTakeForm2(CArray<CStringArray, CStringArray>*Listarray)
  13943. {
  13944. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "选片客人明细表";
  13945. int pages = Listarray->GetSize() / 46;
  13946. if (Listarray->GetSize() % 46)pages++;
  13947. for (int aa = 0; aa < pages; aa++)
  13948. {
  13949. PrintPreview dlg;
  13950. CPrintRX m_Print;
  13951. m_Print.InitToPrint(NULL, 1);
  13952. m_Print.StartPrint();
  13953. m_Print.StartPage();
  13954. CRect mainrc(0, 0, 560, 793);
  13955. float fscale;
  13956. {
  13957. int w, h;
  13958. m_Print.GetWidHei(w, h);
  13959. fscale = (float)w / (float)h;
  13960. }
  13961. mainrc.DeflateRect(25, 40, 10, 0);
  13962. CRect rc, rc2;
  13963. rc = mainrc;
  13964. rc.bottom = rc.top;
  13965. rc.top -= 20;
  13966. m_Print.SetFontFace(16, 1, "黑体");
  13967. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13968. m_Print.SetFontFace(9, 1, "宋体");
  13969. CString str;
  13970. int wid[5] = { 200, 110, 70, 85, 62 };
  13971. int hei = 16;
  13972. if (fscale > 0.71)hei = 15;
  13973. rc = mainrc;
  13974. rc.bottom = rc.top + hei;
  13975. for (int i = 0; i < 47; i++)
  13976. {
  13977. rc2.top = rc.top + i*hei;
  13978. rc2.bottom = rc.bottom + i*hei;
  13979. rc2.left = rc.left;
  13980. rc2.right = rc.left + wid[0];
  13981. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  13982. for (int j = 0; j<5; j++)
  13983. {
  13984. m_Print.DrawRect2(rc2, 1);
  13985. if (Listarray->GetSize()>aa * 46 + i)
  13986. {
  13987. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  13988. rc2.left += 3;
  13989. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13990. rc2.left -= 3;
  13991. }
  13992. rc2.left += wid[j];
  13993. rc2.right = rc2.left + wid[j + 1];
  13994. }
  13995. }
  13996. rc2.top += 2;
  13997. rc2.left += 2; rc2.right = mainrc.right + 4;
  13998. m_Print.SetFontFace(8, 1, "宋体");
  13999. str.Format(" 页:%d/%d", aa + 1, pages);
  14000. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14001. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14002. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14003. dlg.m_pDC = m_Print.GetPDC();
  14004. // dlg.m_mode=1;
  14005. if (aa == 0)
  14006. {
  14007. if (dlg.DoModal() != IDOK)
  14008. return;
  14009. }
  14010. //结束打印
  14011. m_Print.EndPage();
  14012. m_Print.EndPrint();
  14013. }
  14014. }
  14015. void CMainFrame::PrintTakeForm3(CArray<CStringArray, CStringArray>*Listarray)
  14016. {
  14017. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "看设计客人明细表";
  14018. int pages = Listarray->GetSize() / 46;
  14019. if (Listarray->GetSize() % 46)pages++;
  14020. for (int aa = 0; aa < pages; aa++)
  14021. {
  14022. PrintPreview dlg;
  14023. CPrintRX m_Print;
  14024. m_Print.InitToPrint(NULL, 1);
  14025. m_Print.StartPrint();
  14026. m_Print.StartPage();
  14027. CRect mainrc(0, 0, 560, 793);
  14028. float fscale;
  14029. {
  14030. int w, h;
  14031. m_Print.GetWidHei(w, h);
  14032. fscale = (float)w / (float)h;
  14033. }
  14034. mainrc.DeflateRect(25, 40, 10, 0);
  14035. CRect rc, rc2;
  14036. rc = mainrc;
  14037. rc.bottom = rc.top;
  14038. rc.top -= 20;
  14039. m_Print.SetFontFace(16, 1, "黑体");
  14040. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14041. m_Print.SetFontFace(9, 1, "宋体");
  14042. CString str;
  14043. int wid[5] = { 200, 110, 70, 85, 62 };
  14044. int hei = 16;
  14045. if (fscale > 0.71)hei = 15;
  14046. rc = mainrc;
  14047. rc.bottom = rc.top + hei;
  14048. for (int i = 0; i < 47; i++)
  14049. {
  14050. rc2.top = rc.top + i*hei;
  14051. rc2.bottom = rc.bottom + i*hei;
  14052. rc2.left = rc.left;
  14053. rc2.right = rc.left + wid[0];
  14054. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14055. for (int j = 0; j<5; j++)
  14056. {
  14057. m_Print.DrawRect2(rc2, 1);
  14058. if (Listarray->GetSize()>aa * 46 + i)
  14059. {
  14060. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14061. rc2.left += 3;
  14062. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14063. rc2.left -= 3;
  14064. }
  14065. rc2.left += wid[j];
  14066. rc2.right = rc2.left + wid[j + 1];
  14067. }
  14068. }
  14069. rc2.top += 2;
  14070. rc2.left += 2; rc2.right = mainrc.right + 4;
  14071. m_Print.SetFontFace(8, 1, "宋体");
  14072. str.Format(" 页:%d/%d", aa + 1, pages);
  14073. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14074. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14075. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14076. dlg.m_pDC = m_Print.GetPDC();
  14077. // dlg.m_mode=1;
  14078. if (aa == 0)
  14079. {
  14080. if (dlg.DoModal() != IDOK)
  14081. return;
  14082. }
  14083. //结束打印
  14084. m_Print.EndPage();
  14085. m_Print.EndPrint();
  14086. }
  14087. }
  14088. void CMainFrame::PrintTakeForm4(CArray<CStringArray, CStringArray>*Listarray)
  14089. {
  14090. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "取件客人明细表";
  14091. int pages = Listarray->GetSize() / 46;
  14092. if (Listarray->GetSize() % 46)pages++;
  14093. for (int aa = 0; aa < pages; aa++)
  14094. {
  14095. PrintPreview dlg;
  14096. CPrintRX m_Print;
  14097. m_Print.InitToPrint(NULL, 1);
  14098. m_Print.StartPrint();
  14099. m_Print.StartPage();
  14100. CRect mainrc(0, 0, 560, 793);
  14101. float fscale;
  14102. {
  14103. int w, h;
  14104. m_Print.GetWidHei(w, h);
  14105. fscale = (float)w / (float)h;
  14106. }
  14107. mainrc.DeflateRect(25, 40, 10, 0);
  14108. CRect rc, rc2;
  14109. rc = mainrc;
  14110. rc.bottom = rc.top;
  14111. rc.top -= 20;
  14112. m_Print.SetFontFace(16, 1, "黑体");
  14113. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14114. m_Print.SetFontFace(9, 1, "宋体");
  14115. CString str;
  14116. int wid[5] = { 200, 110, 70, 85, 62 };
  14117. int hei = 16;
  14118. if (fscale > 0.71)hei = 15;
  14119. rc = mainrc;
  14120. rc.bottom = rc.top + hei;
  14121. for (int i = 0; i < 47; i++)
  14122. {
  14123. rc2.top = rc.top + i*hei;
  14124. rc2.bottom = rc.bottom + i*hei;
  14125. rc2.left = rc.left;
  14126. rc2.right = rc.left + wid[0];
  14127. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14128. for (int j = 0; j<5; j++)
  14129. {
  14130. m_Print.DrawRect2(rc2, 1);
  14131. if (Listarray->GetSize()>aa * 46 + i)
  14132. {
  14133. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14134. rc2.left += 3;
  14135. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14136. rc2.left -= 3;
  14137. }
  14138. rc2.left += wid[j];
  14139. rc2.right = rc2.left + wid[j + 1];
  14140. }
  14141. }
  14142. rc2.top += 2;
  14143. rc2.left += 2; rc2.right = mainrc.right + 4;
  14144. m_Print.SetFontFace(8, 1, "宋体");
  14145. str.Format(" 页:%d/%d", aa + 1, pages);
  14146. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14147. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14148. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14149. dlg.m_pDC = m_Print.GetPDC();
  14150. // dlg.m_mode=1;
  14151. if (aa == 0)
  14152. {
  14153. if (dlg.DoModal() != IDOK)
  14154. return;
  14155. }
  14156. //结束打印
  14157. m_Print.EndPage();
  14158. m_Print.EndPrint();
  14159. }
  14160. }
  14161. void CMainFrame::PrintTakeForm5(CArray<CStringArray, CStringArray>*Listarray)
  14162. {
  14163. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "婚庆客人明细表";
  14164. int pages = Listarray->GetSize() / 46;
  14165. if (Listarray->GetSize() % 46)pages++;
  14166. for (int aa = 0; aa < pages; aa++)
  14167. {
  14168. PrintPreview dlg;
  14169. CPrintRX m_Print;
  14170. m_Print.InitToPrint(NULL, 1);
  14171. m_Print.StartPrint();
  14172. m_Print.StartPage();
  14173. CRect mainrc(0, 0, 560, 793);
  14174. float fscale;
  14175. {
  14176. int w, h;
  14177. m_Print.GetWidHei(w, h);
  14178. fscale = (float)w / (float)h;
  14179. }
  14180. mainrc.DeflateRect(25, 40, 10, 0);
  14181. CRect rc, rc2;
  14182. rc = mainrc;
  14183. rc.bottom = rc.top;
  14184. rc.top -= 20;
  14185. m_Print.SetFontFace(16, 1, "黑体");
  14186. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14187. m_Print.SetFontFace(8, 1, "宋体");
  14188. CString str;
  14189. int wid[7] = { 165, 90, 90, 45, 45, 60, 35 };
  14190. int hei = 16;
  14191. if (fscale > 0.71)hei = 15;
  14192. rc = mainrc;
  14193. rc.bottom = rc.top + hei;
  14194. for (int i = 0; i < 47; i++)
  14195. {
  14196. rc2.top = rc.top + i*hei;
  14197. rc2.bottom = rc.bottom + i*hei;
  14198. rc2.left = rc.left;
  14199. rc2.right = rc.left + wid[0];
  14200. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14201. for (int j = 0; j<7; j++)
  14202. {
  14203. m_Print.DrawRect2(rc2, 1);
  14204. if (Listarray->GetSize()>aa * 46 + i)
  14205. {
  14206. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14207. rc2.left += 3;
  14208. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14209. rc2.left -= 3;
  14210. }
  14211. rc2.left += wid[j];
  14212. rc2.right = rc2.left + wid[j + 1];
  14213. }
  14214. }
  14215. rc2.top += 2;
  14216. rc2.left += 2; rc2.right = mainrc.right + 4;
  14217. m_Print.SetFontFace(8, 1, "宋体");
  14218. str.Format(" 页:%d/%d", aa + 1, pages);
  14219. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14220. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14221. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14222. dlg.m_pDC = m_Print.GetPDC();
  14223. // dlg.m_mode=1;
  14224. if (aa == 0)
  14225. {
  14226. if (dlg.DoModal() != IDOK)
  14227. return;
  14228. }
  14229. //结束打印
  14230. m_Print.EndPage();
  14231. m_Print.EndPrint();
  14232. }
  14233. }
  14234. void CMainFrame::PrintTakeForm1(CArray<CStringArray, CStringArray>*Listarray)
  14235. {
  14236. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "拍照客人明细表";
  14237. int pages = Listarray->GetSize() / 46;
  14238. if (Listarray->GetSize() % 46)pages++;
  14239. for (int aa = 0; aa < pages; aa++)
  14240. {
  14241. PrintPreview dlg;
  14242. CPrintRX m_Print;
  14243. m_Print.InitToPrint(NULL, 1);
  14244. m_Print.StartPrint();
  14245. m_Print.StartPage();
  14246. CRect mainrc(0, 0, 560, 793);
  14247. float fscale;
  14248. {
  14249. int w, h;
  14250. m_Print.GetWidHei(w, h);
  14251. fscale = (float)w / (float)h;
  14252. }
  14253. mainrc.DeflateRect(25, 40, 10, 0);
  14254. CRect rc, rc2;
  14255. rc = mainrc;
  14256. rc.bottom = rc.top;
  14257. rc.top -= 20;
  14258. m_Print.SetFontFace(16, 1, "黑体");
  14259. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14260. m_Print.SetFontFace(8, 1, "宋体");
  14261. CString str;
  14262. int wid[7] = { 165, 60, 90, 60, 60, 60, 35 };
  14263. int hei = 16;
  14264. if (fscale > 0.71)hei = 15;
  14265. rc = mainrc;
  14266. rc.bottom = rc.top + hei;
  14267. for (int i = 0; i < 47; i++)
  14268. {
  14269. rc2.top = rc.top + i*hei;
  14270. rc2.bottom = rc.bottom + i*hei;
  14271. rc2.left = rc.left;
  14272. rc2.right = rc.left + wid[0];
  14273. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14274. for (int j = 0; j<7; j++)
  14275. {
  14276. m_Print.DrawRect2(rc2, 1);
  14277. if (Listarray->GetSize()>aa * 46 + i)
  14278. {
  14279. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14280. rc2.left += 3;
  14281. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14282. rc2.left -= 3;
  14283. }
  14284. rc2.left += wid[j];
  14285. rc2.right = rc2.left + wid[j + 1];
  14286. }
  14287. }
  14288. rc2.top += 2;
  14289. rc2.left += 2; rc2.right = mainrc.right + 4;
  14290. m_Print.SetFontFace(8, 1, "宋体");
  14291. str.Format(" 页:%d/%d", aa + 1, pages);
  14292. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14293. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14294. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14295. dlg.m_pDC = m_Print.GetPDC();
  14296. // dlg.m_mode=1;
  14297. if (aa == 0)
  14298. {
  14299. if (dlg.DoModal() != IDOK)
  14300. return;
  14301. }
  14302. //结束打印
  14303. m_Print.EndPage();
  14304. m_Print.EndPrint();
  14305. }
  14306. }
  14307. void CMainFrame::ShowMonthForm2()
  14308. {
  14309. }
  14310. // dlg;