MainFrm.cpp 458 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640
  1. // MainFrm.cpp : implementation of the CMainFrame class 员工工作
  2. #include "stdafx.h"
  3. #include "YLGL.h"
  4. #include "resource.h"
  5. #include "MainFrm.h"
  6. #include <afxinet.h>
  7. #include "ConnectDlg.h"
  8. #include "SendDataDlg.h"
  9. #include "DinDanHistroy.h"
  10. #include "ShangPin.h"
  11. #include "SPLBDlg.h"
  12. #include "BuMenDlg.h"
  13. #include "Worker.h"
  14. #include "ShowPic3.h"
  15. #include "TXDlg.h"
  16. #include "TXSPDlg.h"
  17. #include "MsgReg2.h"
  18. #include "ProviderDlg.h"
  19. #include "Booking.h"
  20. #include "Booking2.h"
  21. #include "PayOutSet.h"
  22. #include "PayOutInput.h"
  23. #include "IncomeInput.h"
  24. #include "IncomeInput2.h"
  25. #include "IncomeInput3.h"
  26. #include "IncomeInput4.h"
  27. #include "DressEarlyWarning.h"
  28. #include "annualfee.h"
  29. #include "DailyForm.h"
  30. #include "MonthForm.h"
  31. #include "ProcessAlarm.h"
  32. #include "MonthForm2.h"
  33. #include "YearForm.h"
  34. #include "ClientForm.h"
  35. #include "ClientForm2.h"
  36. #include "ClientForm3.h"
  37. #include "DinDanFrom.h"
  38. #include "Satisfaction.h"
  39. //#include "SatisfactionForm.h"
  40. #include "SatisfactionReportForm.h"
  41. #include "TodayForm.h"
  42. #include "WorkerReport.h"
  43. #include "TodayForm2.h"
  44. #include "SendInsideMsg2.h"
  45. #include "StoreInfoChart.h"
  46. #include "FixedAssets.h"
  47. #include "SPForm.h"
  48. #include "ShowMsg.h"
  49. #include "Account.h"
  50. #include "Login.h"
  51. #include "Login3.h"
  52. #include "Psw.h"
  53. #include "AreaDlg.h"
  54. #include "TakeFrom.h"
  55. #include "ChoosePhotoForm.h"
  56. #include "BeautifySkinFrom.h"
  57. #include "DesignFrom.h"
  58. #include "outsourcing.h"
  59. #include "ChoosePhotoSkin.h"
  60. #include "SalarySet.h"
  61. #include "SalarySet2.h"
  62. #include "MySalary.h"
  63. #include "PrintRX.h"
  64. #include "LoadRect.h"
  65. #include "PrintPreview.h"
  66. #include "SearchClient.h"
  67. #include "BeautifySkinFrom2.h"
  68. #include "FinanceForm.h"
  69. #include "PhotoPrintFrom.h"
  70. //#include "SqlDlg.h"
  71. #include "YearForm2.h"
  72. #include "AreaClient.h"
  73. #include "DBConfig.h"
  74. #include "SetPathDlg2.h"
  75. #include "StaffAchievement.h"
  76. #include "BurnCD.h"
  77. #include "StaffAchievementSet.h"
  78. #include "StaffAchievementShowAll.h"
  79. #include "SelContent.h"
  80. #include "ClientMoney.h"
  81. #include "DelPhotoSet.h"
  82. #include "ompanyInfo.h"
  83. #include "ClientForm.h"
  84. #include "PhotoBak.h"
  85. #include "MsgReg.h"
  86. #include "SendMsg.h"
  87. #include "MsgSet.h"
  88. #include "ShowMember.h"
  89. #include "ShowMember2.h"
  90. #include "MemberSet.h"
  91. #include "DressManage.h"
  92. #include "ShowDress.h"
  93. #include "ShowPic.h"
  94. #include "ShowHireReg.h"
  95. #include "InputGoods.h"
  96. #include "ShowGoods.h"
  97. #include "CostCal.h"
  98. #include "Welcome.h"
  99. #include "EmployeeMsg.h"
  100. #include "TXFG.h"
  101. #include "EmployeeForm.h"
  102. #include "EmployeeForm2.h"
  103. #include "Client2Form.h"
  104. #include "Client2FormLYFZ.h"
  105. #include "OldClient.h"
  106. #include "ClientReasonChart.h"
  107. #include "ClientFromChart.h"
  108. #include "WorkMsg.h"
  109. #include "SetLoginTime.h"
  110. #include "SetLoginBan.h"
  111. #include "LoginReg.h"
  112. #include "LoginReg2.h"
  113. #include "PhoneRecord.h"
  114. #include "PhoneRecordOut.h"
  115. #include "MissCall.h"
  116. #include "InsideMsg.h"
  117. #include "Card2Reg.h"
  118. #include "Card2RegChart.h"
  119. #include "ShowMemberBlue.h"
  120. #include "Card2RegBlue.h"
  121. #include "Card2RegChartBlue.h"
  122. #include "DigitalWork.h"
  123. #include "HideWindow.h"
  124. #include "SalarySet3.h"
  125. #include "YearFormBranch.h"
  126. #include "YearFormBranch2.h"
  127. #include "Set.h"
  128. #include "DinDanFromBranch.h"
  129. #include "MemberChart.h"
  130. #include "ShowMemberMsg.h"
  131. #include "ShowBakState.h"
  132. #include "DinDanForm.h"
  133. #include "CalendarConvert.h"
  134. #include "ShowLOg.h"
  135. #include "HospitalClient.h"
  136. #include "HospitalClientAlarm.h"
  137. #include "HospitalInfoSet.h"
  138. #include "AddHospitalClient.h"
  139. #include "HospitalClientMsg.h"
  140. #ifndef VC60
  141. #include "msgId_def.h"
  142. #include "struct_def.h"
  143. #endif //#ifndef VC60
  144. #ifdef _DEBUG
  145. #define new DEBUG_NEW
  146. #undef THIS_FILE
  147. static char THIS_FILE[] = __FILE__;
  148. #endif
  149. #ifndef WINVER
  150. #define WINVER 0x0400
  151. #endif
  152. #ifndef _WIN32_WINNT
  153. #define _WIN32_WINNT 0x0400
  154. #endif
  155. #ifndef _WIN32_WINDOWS
  156. #define _WIN32_WINDOWS 0x0410
  157. #endif
  158. #ifndef _WIN32_IE
  159. #define _WIN32_IE 0x0400
  160. #endif
  161. #include "uxtheme.h "
  162. typedef HTHEME(__stdcall * POPENTHEMEDATA)(HWND hwnd, LPCWSTR pszClassList);
  163. typedef HRESULT(__stdcall * PCLOSETHEMEDATA)(HTHEME hTheme);
  164. HHOOK g_hmouse = NULL; //g_sendhead zx.dll
  165. //extern void WriteClientLog(CString str); // Jeff写客户端日志;
  166. // Jeff.remark;
  167. // 函数:MouseProc
  168. // 参数:
  169. // nCode hook code
  170. // wParam message identifier
  171. // lParam mouse coordinates
  172. // 返回:
  173. //
  174. LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam)
  175. {
  176. if (g_pMainWnd)
  177. {
  178. if(g_cominfoarray.GetSize() > 0)
  179. {
  180. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(133)) && atoi(g_cominfoarray.ElementAt(0).ElementAt(134)) > 0)
  181. {
  182. g_pMainWnd->KillTimer(5);
  183. g_pMainWnd->SetTimer(5, atoi(g_cominfoarray.ElementAt(0).ElementAt(134)) * 60 * 1000, NULL);
  184. }
  185. }
  186. if (g_bSendLYFZ)
  187. {
  188. g_pMainWnd->KillTimer(7);
  189. g_pMainWnd->SetTimer(7, 5 * 60 * 1000, NULL);
  190. }
  191. }
  192. return CallNextHookEx(g_hmouse, nCode, wParam, lParam);
  193. }
  194. CRect g_rc; // 屏幕坐标值,区域是放置对话框。
  195. CMainFrame *g_pMainWnd = NULL;
  196. extern HWND g_hSendWnd;
  197. extern HWND g_hConnectWnd;
  198. //extern CString newGUID();
  199. #ifdef USE_KERNEL_DLL
  200. /************************************************************************/
  201. /*
  202. 函数:kernelCallback
  203. 描述:kernel.dll的回调函数;
  204. 参数:
  205. lpStrBranchId: 域名;
  206. lpStrOrder: 订单号;
  207. dwImgType: 相片类型;
  208. dwImgNum: 重命名使用,返回的相片编号;
  209. lpStrImg: IncrementalBack表使用的content字段内容,指定备份文件名的相片;
  210. lpStrImgExt: IncrementalBack表使用的backupExt字段内容,指定要备份的扩展名相片;
  211. 返回:void
  212. */
  213. /************************************************************************/
  214. #include "ImportPhoto.h"
  215. // 导入原片、初修、精修、设计结束后的回调函数(三合一);
  216. void CALLBACK ImgImportMergeCallback(IN LPCTSTR lpStrBranchId, IN LPCTSTR lpStrOrderNum, IN CONST INT& dwImgType, IN CONST DWORD& dwImgNum, IN LPCTSTR lpStrImgs, IN LPCTSTR lpStrImgExt)
  217. {
  218. AfxSetResourceHandle(g_Instance);
  219. // 1.判断参数有效性;
  220. if (lpStrBranchId == NULL || !strstr(lpStrBranchId, _T(".ly.com")) || lpStrOrderNum == NULL || _tcscmp(lpStrOrderNum, _T("")) == 0)
  221. {
  222. OutputDebugString(_T("回调函数参数(域名、订单号)无效\n"));
  223. return;
  224. }
  225. // 2.是否需要备份分店相片;
  226. BOOL bIsNeedBranchImg = FALSE;
  227. switch (dwImgType)
  228. {
  229. case 1://是否备份分店原片;
  230. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck1;
  231. break;
  232. case 2://是否备份分店修片;
  233. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck2;
  234. break;
  235. case 3://是否备份分店精修;
  236. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck3;
  237. break;
  238. case 4://是否备份分店设计;
  239. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck4;
  240. break;
  241. default:
  242. OutputDebugString(_T("未知相片类型!\n"));
  243. break;
  244. }
  245. // 3.同时更新IncrementalBack表;
  246. CString strSQLInsert = _T("");
  247. strSQLInsert.Format(INSERT_INCREMENT, 0, lpStrBranchId, CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S"), lpStrOrderNum, dwImgType, lpStrImgs, g_user.account, g_user.name);
  248. // 4.连接服务器,更新dindan和IncrementalBackup;
  249. g_sendhead.bsql = 1;
  250. if (g_bAllBranch)
  251. {// 多店汇总时;
  252. g_branchip = GetBranchIPbyId(lpStrBranchId);
  253. g_pMainWnd->OnDisconnect();
  254. g_branchname = GetBranchNamebyId(lpStrBranchId);
  255. g_bBranchModify = 1;
  256. if (dwImgType == OImgtype)
  257. {// 如果导入的是原片;
  258. CString strSQL = _T("");
  259. strSQL.Format(_T("update dindan set curno = '%d' where id = '%s' ***%s"), dwImgNum, lpStrOrderNum, strSQLInsert);
  260. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  261. }
  262. else
  263. {//导入的不是原片;
  264. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  265. }
  266. // 如果连接服务器失败,要记录下来;
  267. // if () .........
  268. g_pMainWnd->OnDisconnect();
  269. g_bBranchModify = 0;
  270. g_branchip = g_branchname = _T("");
  271. if (g_domain.CompareNoCase(lpStrBranchId) != 0 && bIsNeedBranchImg)
  272. {// 如果不是本店,且本店设置中需要备份分店相片,需要向本店添加导入相片记录;
  273. g_sendhead.bsql = 1;
  274. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  275. g_pMainWnd->OnDisconnect();
  276. g_bBranchModify = 0;
  277. }
  278. }
  279. else
  280. {// 连接本店或分店时;
  281. if (dwImgType == OImgtype)
  282. {// 如果导入的是原片;
  283. CString strSQL = _T("");
  284. strSQL.Format(_T("update dindan set curno = '%d' where id = '%s' ***%s"), dwImgNum, lpStrOrderNum, strSQLInsert);
  285. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  286. }
  287. else
  288. {//导入的不是原片;
  289. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  290. }
  291. if (g_domain.CompareNoCase(lpStrBranchId) != 0 && bIsNeedBranchImg)
  292. {// 如果不是本店,且本店设置中需要备份分店相片,需要向本店添加导入相片记录;
  293. #if 1
  294. ::SendMessage(g_pMainWnd->m_hWnd, MSG_KERNEL_SENDMSG, (WPARAM)lpStrBranchId, (LPARAM)&strSQLInsert);
  295. #else // 可能是VC6.0与VC9.0间DLL调用产生的问题,下面代码执行时会出错;
  296. // 如果连接的是分店,断开分店,回连本店;
  297. g_bBranchModify = FALSE;
  298. g_pMainWnd->OnDisconnect();
  299. g_branchname = g_branchip = _T("");
  300. g_sendhead.bsql = 1;
  301. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  302. g_pMainWnd->OnDisconnect();
  303. // 设置回分店连接;
  304. g_branchip = GetBranchIPbyId(lpStrBranchId);
  305. g_branchname = GetBranchNamebyId(lpStrBranchId);
  306. g_bBranchModify = TRUE;
  307. #endif
  308. }
  309. }
  310. if ( dwImgType == OImgtype )
  311. {// 最后一步,更新完了数据库,刷新TakFrom类所对应的对话框;
  312. HWND hWnd = ::FindWindowEx(g_pMainWnd->GetSafeHwnd(), NULL, _T("MDIClient"), NULL);
  313. if (hWnd)
  314. {
  315. hWnd = ::FindWindowEx(hWnd, NULL, NULL, _T("拍照"));
  316. if (hWnd)
  317. {
  318. hWnd = ::FindWindowEx(hWnd, NULL, _T("#32770"), NULL);
  319. if (hWnd)
  320. {
  321. ::SendMessage(hWnd, MSG_KERNEL_CALLBACK, 0, 0);
  322. }
  323. }
  324. }
  325. }
  326. }
  327. #endif
  328. /////////////////////////////////////////////////////////////////////////////
  329. // CMainFrame客人付款
  330. /////////////////////////////////////////////////////////////////////////////
  331. /////////////////////////////////////////////////////////////////////////////
  332. static void HandleClientNetEvent(IN SOCKET hSocket,
  333. IN ETransportEvent eEvent,
  334. IN void *pDataBuf,
  335. IN unsigned long nDataLen,
  336. IN int nError,
  337. IN void *pContext)
  338. {
  339. if (nError != TRANSPORT_OK)
  340. return;
  341. CMainFrame *pDlg = (CMainFrame *)pContext;
  342. if (NULL == pDlg)
  343. return;
  344. pDlg->ProcessNetEvent(eEvent, pDataBuf, nDataLen);
  345. }
  346. BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam)
  347. {
  348. CRect rtCtrl, rtWnd; // 子窗口,父窗口;
  349. if (hwnd)
  350. {
  351. ::GetWindowRect(hwnd, &rtCtrl); // 获取控件大小;
  352. ::GetWindowRect(GetParent(hwnd), &rtWnd); // 获取父窗口大小;
  353. // printf("Jeff:g_WidthScale=%d,g_HeightScale=%d,rtWnd.left=%d,rtWnd.top=%d\n\n",g_WidthScale,g_HeightScale,rtWnd.left,rtWnd.top);
  354. // printf("Jeff:old:ctrl.left=%d,ctrl.top=%d,ctrl.right=%d,ctrl.bottom=%d\n\n",rtCtrl.left,rtCtrl.top,rtCtrl.right,rtCtrl.bottom);
  355. rtCtrl.OffsetRect(-rtWnd.left, -rtWnd.top);
  356. float temp;
  357. temp = (float)rtCtrl.left*g_WidthScale;
  358. rtCtrl.left = (int)temp + g_dx;
  359. temp = (float)rtCtrl.top*g_HeightScale;
  360. rtCtrl.top = (int)temp + g_dy;
  361. temp = (float)rtCtrl.right*g_WidthScale;
  362. rtCtrl.right = (int)temp + g_dx;
  363. temp = (float)rtCtrl.bottom*g_HeightScale;
  364. rtCtrl.bottom = (int)temp + g_dy;
  365. //printf("Jeff:new:ctrl.left=%d,ctrl.top=%d,ctrl.right=%d,ctrl.bottom=%d\n\n",rtCtrl.left,rtCtrl.top,rtCtrl.right,rtCtrl.bottom);
  366. ::MoveWindow(hwnd, rtCtrl.left, rtCtrl.top, rtCtrl.Width(), rtCtrl.Height(), TRUE);
  367. return TRUE;
  368. }
  369. else
  370. {
  371. return FALSE;
  372. }
  373. }
  374. IMPLEMENT_DYNCREATE(CMainFrame, CMDIFrameWnd)
  375. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  376. //{{AFX_MSG_MAP(CMainFrame)
  377. ON_WM_CREATE()
  378. ON_WM_DESTROY()
  379. ON_WM_CLOSE()
  380. ON_WM_TIMER()
  381. ON_COMMAND(IDM_choosephotoskin, Onchoosephotoskin)
  382. ON_COMMAND(IDM_PATH, OnPath)
  383. ON_COMMAND(IDM_SERVER, OnServer)
  384. ON_COMMAND(IDM_SHOWHIS, OnShowhis)
  385. ON_COMMAND(IDM_StaffAchievementShow, OnStaffAchievementShow)
  386. ON_COMMAND(IDM_AUTODELPHOTO, OnAutodelphoto)
  387. ON_COMMAND(IDM_PHOTOMANAGE, Onphotomanage)
  388. ON_COMMAND(IDM_COMPANYINFO, OnCompanyinfo)
  389. ON_COMMAND(IDM_HELPFILE, OnHelpfile)
  390. ON_COMMAND(IDM_PHOTOBAK, OnPhotobak)
  391. ON_COMMAND(IDM_TAOXIFG, OnTaoxifg)
  392. ON_COMMAND(IDM_ShowBakState, OnShowBakState)
  393. ON_WM_NCLBUTTONDBLCLK()
  394. ON_WM_NCHITTEST()
  395. ON_COMMAND(IDM_LOG, OnLog)
  396. //}}AFX_MSG_MAP
  397. ON_COMMAND_RANGE(0, 50000, OnCommandMenu)
  398. ON_MESSAGE(MSG_KERNEL_SENDMSG, OnKernelSendMessaage)
  399. END_MESSAGE_MAP()
  400. static UINT indicators[] =
  401. {
  402. ID_SEPARATOR, // status line indicator
  403. ID_INDICATOR_CAPS,
  404. ID_INDICATOR_NUM,
  405. ID_INDICATOR_SCRL,
  406. };
  407. /////////////////////////////////////////////////////////////////////////////
  408. // CMainFrame construction/destruction
  409. #ifdef VC60
  410. UINT CMainFrame::OnNcHitTest(CPoint point)
  411. {
  412. if (CWnd::OnNcHitTest(point) == HTRIGHT || CWnd::OnNcHitTest(point) == HTLEFT || CWnd::OnNcHitTest(point) == HTTOP || CWnd::OnNcHitTest(point) == HTBOTTOM)
  413. return HTCLIENT;
  414. return CWnd::OnNcHitTest(point);
  415. }
  416. #else
  417. LRESULT CMainFrame::OnNcHitTest(CPoint point)
  418. {
  419. if (CWnd::OnNcHitTest(point) == HTRIGHT || CWnd::OnNcHitTest(point) == HTLEFT || CWnd::OnNcHitTest(point) == HTTOP || CWnd::OnNcHitTest(point) == HTBOTTOM)
  420. return HTCLIENT;
  421. return CWnd::OnNcHitTest(point);
  422. }
  423. #endif
  424. void CMainFrame::OnNcLButtonDblClk(UINT nFlags, CPoint point)
  425. {
  426. if (nFlags != HTCAPTION)
  427. CMDIFrameWnd::OnNcLButtonDblClk(nFlags, point);
  428. }
  429. // 回调使用;
  430. LRESULT CMainFrame::OnKernelSendMessaage(WPARAM wp, LPARAM lp)
  431. {
  432. CString strBranchId = (LPCTSTR)wp;
  433. CString strSQLInsert = *(CString*)lp;
  434. // 如果连接的是分店,断开分店,回连本店;
  435. g_bBranchModify = FALSE;
  436. g_pMainWnd->OnDisconnect();
  437. g_branchname = g_branchip = _T("");
  438. g_sendhead.bsql = 1;
  439. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  440. g_pMainWnd->OnDisconnect();
  441. // 设置回分店连接;
  442. g_branchip = GetBranchIPbyId(strBranchId);
  443. g_branchname = GetBranchNamebyId(strBranchId);
  444. g_bBranchModify = TRUE;
  445. g_pMainWnd->OnConnect();
  446. return 0;
  447. }
  448. CMainFrame::CMainFrame()
  449. {
  450. // TODO: add member initialization code here
  451. SetConnectionID(INVALID_SOCKET);
  452. m_pMainFrimDlg2 = NULL;
  453. m_bCheckF2F3 = AfxGetApp()->GetProfileInt(LYFZVERSION, "f2f3", 0);
  454. if (0 == ::PathFileExists(g_mainpath + "\\skin\\5.lia"))
  455. {
  456. g_bNoLoginLia = 1;
  457. }
  458. }
  459. CMainFrame::~CMainFrame()
  460. {
  461. if (m_pMainFrimDlg2)
  462. {
  463. m_pMainFrimDlg2->DestroyWindow();
  464. delete m_pMainFrimDlg2;
  465. }
  466. }
  467. void InTheMe(HWND m_hWnd)
  468. {
  469. BOOL bXpVisualStyle = FALSE;
  470. OSVERSIONINFO osvi;
  471. osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  472. ::GetVersionEx(&osvi);
  473. if ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) && (osvi.dwMajorVersion >= 5) && (osvi.dwMinorVersion >= 1))
  474. {
  475. HMODULE hUxTheme = ::LoadLibrary(_T("UxTheme.dll"));
  476. POPENTHEMEDATA pOpenThemeData;
  477. PCLOSETHEMEDATA pCloseThemeData;
  478. if (hUxTheme != NULL)
  479. {
  480. pOpenThemeData = (POPENTHEMEDATA)::GetProcAddress(hUxTheme, "OpenThemeData");
  481. pCloseThemeData = (PCLOSETHEMEDATA)::GetProcAddress(hUxTheme, "CloseThemeData");
  482. HTHEME hButtonTheme = (*pOpenThemeData)(m_hWnd, L"BUTTON");
  483. if (hButtonTheme != NULL)
  484. bXpVisualStyle = TRUE;
  485. (*pCloseThemeData)(hButtonTheme);
  486. }
  487. ::FreeLibrary(hUxTheme);
  488. }
  489. if (bXpVisualStyle)
  490. AfxMessageBox(_T("正在使用视觉主题 "));
  491. else
  492. AfxMessageBox(_T("没有使用视觉主题 "));
  493. }
  494. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  495. {
  496. if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  497. {
  498. // Jeff.创建失败的可能性小,加日志输出;
  499. return -1;
  500. }
  501. if (g_server.Find(".ly.com") != -1)
  502. {
  503. g_ntimeout = 30000;
  504. }
  505. if (::PathFileExists(g_mainpath + "\\logo.ico"))
  506. {
  507. Bitmap *bmp = NULL;
  508. LoadImageFromFile((Image**)&bmp, g_mainpath + "\\logo.ico");
  509. // m_hIcon = AfxGetApp()->LoadIcon(g_mainpath+"\\logo.ico");
  510. bmp->GetHICON(&m_hIcon);
  511. delete bmp;
  512. SetIcon(m_hIcon, TRUE); // Set big icon
  513. SetIcon(m_hIcon, FALSE); // Set small icon
  514. }
  515. if (!m_wndClient.SubclassWindow(m_hWndMDIClient))
  516. {
  517. return -1;
  518. }
  519. if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  520. | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  521. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  522. {
  523. TRACE0("Failed to create toolbar\n");
  524. return -1; // fail to create
  525. }
  526. m_wndToolBar.LoadTrueColorToolBar(90, IDB_NORMAL, 0, IDB_DISABLE);
  527. // second toolbar must have different ID
  528. if (!m_wndToolBar2.Create(this, WS_CHILD | WS_VISIBLE | CBRS_LEFT | CBRS_NOALIGN,
  529. AFX_IDW_CONTROLBAR_FIRST + 32) ||
  530. !m_wndToolBar2.LoadToolBar(IDR_TOOLBAR1))
  531. {
  532. TRACE0("Failed to create toolbar\n");
  533. return -1; // fail to create
  534. }
  535. #ifndef NEW_SKIN
  536. if (!m_wndStatusBar.Create(this) ||
  537. !m_wndStatusBar.SetIndicators(indicators,
  538. sizeof(indicators)/sizeof(UINT)))
  539. {
  540. // Jeff.创建失败的可能性小,加日志输出;
  541. TRACE0("Failed to create status bar\n");
  542. return -1; // fail to create
  543. }
  544. m_wndStatusBar.SetPaneInfo(1,ID_INDICATOR_USER,SBPS_NORMAL,200);
  545. m_wndStatusBar.SetPaneText(1,"未登录",TRUE);
  546. #endif
  547. // TODO: Delete these three lines if you don't want the toolbar to
  548. // be dockable
  549. NewMenu2();
  550. ::GetWindowRect(this->m_hWndMDIClient, g_rc);
  551. g_pMainWnd = this;
  552. m_wndToolBar2.Init();
  553. g_rc.top += 38;
  554. g_rc.left += 160;
  555. /* m_WidthScale = (float)g_rc.Width ()/722;
  556. m_HeightScale = (float)g_rc.Height ()/533;*/
  557. g_user.bLongin = 0;
  558. SetTimer(1, 100, NULL);
  559. #ifdef USE_KERNEL_DLL
  560. if ( g_pIMGProcess )
  561. g_pIMGProcess->SetCallBack(ImgImportMergeCallback);
  562. #endif
  563. return 0;
  564. }
  565. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  566. {
  567. if (!CMDIFrameWnd::PreCreateWindow(cs))
  568. return FALSE;
  569. // TODO: Modify the Window class or styles here by modifying
  570. // the CREATESTRUCT cs
  571. cs.style &= ~WS_MAXIMIZEBOX;
  572. cs.style &= ~WS_THICKFRAME;
  573. cs.lpszName = g_title + "影楼管理系统";
  574. cs.style &= ~FWS_ADDTOTITLE;
  575. RECT rect;
  576. HWND hWnd = ::FindWindow("Shell_TrayWnd", 0);
  577. ::GetWindowRect(hWnd, &rect);
  578. cs.x = 0;
  579. cs.y = 0;
  580. cs.cx = GetSystemMetrics(SM_CXSCREEN);
  581. cs.cy = GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top) + 3;
  582. return TRUE;
  583. }
  584. /////////////////////////////////////////////////////////////////////////////
  585. // CMainFrame diagnostics
  586. #ifdef _DEBUG
  587. void CMainFrame::AssertValid() const
  588. {
  589. CMDIFrameWnd::AssertValid();
  590. }
  591. void CMainFrame::Dump(CDumpContext& dc) const
  592. {
  593. CMDIFrameWnd::Dump(dc);
  594. }
  595. #endif //_DEBUG
  596. /////////////////////////////////////////////////////////////////////////////
  597. // CMainFrame message handlers
  598. void CMainFrame::OnDestroy()
  599. {
  600. OnDisconnect();
  601. #ifdef VC60
  602. Transport_UnInit();
  603. #else
  604. CClientTunnel::Transport_UnInit();
  605. #endif //#ifdef VC60
  606. m_Mdi.DeleteAll();
  607. if (g_hmouse)UnhookWindowsHookEx(g_hmouse);
  608. CMDIFrameWnd::OnDestroy();
  609. }
  610. void CMainFrame::OnClose()
  611. {
  612. g_bShowBar = 0;
  613. if (m_Mdi.MainClose())
  614. CMDIFrameWnd::OnClose();
  615. }//连接
  616. void CMainFrame::NewMenu2()
  617. {
  618. CMenu *pMemu = GetMenu();
  619. #ifdef BASIC_VERSION
  620. CMenu* submenu = pMemu->GetSubMenu(1);
  621. //submenu->RemoveMenu (IDM_StaffAchievementShow, MF_BYCOMMAND );//Jeff del 2014.06.16
  622. submenu->RemoveMenu (IDM_salaryset, MF_BYCOMMAND );
  623. #endif
  624. #if 0 // 此机用选片菜单项,去掉不用;
  625. {
  626. BOOL checked=AfxGetApp()->GetProfileInt (LYFZVERSION, "status", 0);
  627. if(checked)
  628. {
  629. CMenu* submenu = pMemu->GetSubMenu(1);
  630. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  631. }
  632. }
  633. #endif
  634. #ifndef BASIC_VERSION
  635. {
  636. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status2", 0);
  637. if (checked)
  638. {
  639. #if 0 // Jeff:去掉菜单,此机用于员工业绩查看的菜单选项;
  640. CMenu* submenu = pMemu->GetSubMenu(1);
  641. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  642. #endif
  643. g_bStaffAchievementShow = 1;
  644. SetTimer(3, 100, NULL);
  645. }
  646. }
  647. #endif
  648. if (g_bShowOK == 0)
  649. {
  650. CMenu* submenu = pMemu->GetSubMenu(2);
  651. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  652. }
  653. }
  654. HMENU CMainFrame::NewMenu()
  655. {
  656. //设置菜单为XP风格 IDM_SHOWHIS
  657. BCMenu::SetMenuDrawMode(1);
  658. //若取消下面这句注释,则可看到菜单的图标栏和文字栏背景颜色为白色,
  659. //文字颜色为蓝色,选中项的前景色为紫红色
  660. //m_menuXP.SetMenuXPItemColor(0x00FFFFFF,0x00FFFFFF,0x00FF0000,0x00FF00FF);
  661. // 设置菜单中图标大小为32×32
  662. // m_menuXP.SetIconSize(32,32);
  663. // 加载菜单资源
  664. m_menuXP.LoadMenu(IDR_MAINFRAME);
  665. // 加载菜单对应的工具栏资源
  666. // m_menuXP.LoadToolbar(IDR_MAINFRAME);
  667. /*由于菜单左边栏中默认的图标大小为16×16,而与之对应的Toolbar中图标大小为32×32,
  668. 因此菜单中图标不能正确显示,只显示出工具栏中图标的左上角部分,所以修改菜单中各
  669. 项对应的图标为24b色位图资源IDB_***,或者在LoadMenu之前调用SetIconSize,设置菜单
  670. 中图标大小为32×32*/
  671. // m_menuXP.SetIconSize(24,24);
  672. // m_menuXP.ModifyODMenu(NULL,IDM_YWBU,IDB_YW); //
  673. /* m_menuXP.ModifyODMenu(NULL,ID_FILE_OPEN,IDB_BITMAP5);
  674. m_menuXP.ModifyODMenu(NULL,ID_FILE_SAVE,IDB_BITMAP7);
  675. m_menuXP.ModifyODMenu(NULL,ID_FILE_PRINT,IDB_BITMAP6);
  676. m_menuXP.ModifyODMenu(NULL,ID_APP_ABOUT,IDB_BITMAP3);
  677. m_menuXP.ModifyODMenu(NULL,ID_APP_EXIT,IDB_BITMAP2);*/
  678. // m_menuXP.EnableMenuItem (0, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  679. // m_menuXP.EnableMenuItem (2, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  680. // m_menuXP.EnableMenuItem (3, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  681. // m_menuXP.EnableMenuItem (4, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  682. // m_menuXP.EnableMenuItem (5, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  683. // m_menuXP.EnableMenuItem (8, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  684. #if 0 // Jeff此机用选片菜单项不用;
  685. {
  686. BOOL checked=AfxGetApp()->GetProfileInt (LYFZVERSION, "status", 0);
  687. if(checked)
  688. {
  689. CMenu* submenu = m_menuXP.GetSubMenu(1);
  690. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  691. }
  692. }
  693. #endif
  694. {
  695. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status2", 0);
  696. if (checked)
  697. {
  698. #if 0 // Jeff:去掉此机用于员工业绩查看的菜单选项;
  699. CMenu* submenu = m_menuXP.GetSubMenu(1);
  700. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  701. #endif
  702. g_bStaffAchievementShow = 1;
  703. SetTimer(3, 100, NULL);
  704. }
  705. }
  706. if (g_bShowOK == 0)
  707. {
  708. CMenu* submenu = m_menuXP.GetSubMenu(2);
  709. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  710. }
  711. return(m_menuXP.Detach());
  712. }
  713. ///////////////////////////////////////////////////////
  714. //减少代码
  715. #define OPEN_MENU(x) m_Mdi.Append(pName, RUNTIME_CLASS(x), IDR_MAINFRAME, this, nID)
  716. //响应菜单命令
  717. void CMainFrame::OnCommandMenu(UINT nID) // 所有菜单命令都在这里处理;
  718. {
  719. if (nID >= 2000 && nID <= 2100)
  720. {
  721. OnBranchData(nID);
  722. return;
  723. }
  724. if (g_user.bLongin == 0)
  725. {
  726. if (g_bNoLoginLia)
  727. {
  728. Login dlg;
  729. dlg.SetLiaPath("5.lia");
  730. dlg.DoModal();
  731. }
  732. else
  733. {
  734. Login3 dlg;
  735. dlg.SetLiaPath("5.lia");
  736. dlg.DoModal();
  737. }
  738. return;
  739. if (g_user.bLongin == 0)return;
  740. }
  741. else
  742. {
  743. InsideMsg();
  744. }
  745. ResetTimer();
  746. if (nID >= 1000 && nID <= 1100)
  747. {
  748. OnHistory(nID);
  749. return;
  750. }
  751. LPSTR pName;
  752. //打开窗口
  753. switch (nID)
  754. {
  755. case IDM_PayOutSet:
  756. {
  757. if (IsHasRights(16) == 0)return;
  758. PayOutSet dlg;
  759. dlg.DoModal();
  760. return;
  761. }
  762. case IDM_SPLB:
  763. {
  764. if (IsHasRightsnew(29) == 0)return;
  765. SPLBDlg dlg;
  766. dlg.DoModal();
  767. return;
  768. }
  769. case IDM_JD:
  770. {
  771. if (IsHasRightsnew(49) == 0)return;
  772. SPLBDlg dlg;
  773. dlg.m_mode = 1;
  774. dlg.DoModal();
  775. return;
  776. }
  777. case IDM_AREA:
  778. {
  779. if (IsHasRightsnew(47) == 0)return;
  780. AreaDlg dlg;
  781. dlg.DoModal();
  782. return;
  783. }
  784. case IDM_Psw:
  785. {
  786. Psw dlg;
  787. dlg.DoModal();
  788. return;
  789. }
  790. case IDM_Set:
  791. {
  792. if (IsHasRightsnew(49) == 0)return;
  793. Set dlg;
  794. dlg.DoModal();
  795. return;
  796. }
  797. case IDM_HIDEWINDOW:
  798. {
  799. HideWindow dlg;
  800. dlg.DoModal();
  801. return;
  802. }
  803. case IDM_Logout:// Jeff.注销;
  804. {
  805. if(g_user.bLongin)
  806. WriteLog("退出系统!", "退出系统!");
  807. g_user.bLongin = 0;
  808. g_user.name.Empty();
  809. g_user.rights.Empty();
  810. g_user.account.Empty();
  811. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  812. g_pMainWnd2->RefreshOutlookBar();
  813. #ifndef NEW_SKIN
  814. m_wndStatusBar.SetPaneText(1, "未登录", TRUE);
  815. #endif
  816. m_Mdi.CloseAll();
  817. #ifdef ENTERPRISE_VERSION
  818. g_branchname.Empty();
  819. g_branchip.Empty();
  820. g_pMainWnd->OnDisconnect();
  821. g_bBranchModify = 0;
  822. #endif
  823. if (g_pMainWnd2)
  824. {
  825. g_pMainWnd2->DrawLogin();
  826. g_pMainWnd2->ShowBar(0);
  827. }
  828. g_hisyeararray.RemoveAll();
  829. g_pMainWnd->AddHistoryMenu(&g_hisyeararray);
  830. g_brancharray.RemoveAll();
  831. g_pMainWnd->AddBranchMenu(&g_brancharray);
  832. if (g_bNoLoginLia)
  833. {
  834. Login dlg;
  835. dlg.SetLiaPath("5.lia");
  836. dlg.DoModal();
  837. }
  838. else
  839. {
  840. Login3 dlg;
  841. dlg.SetLiaPath("5.lia");
  842. dlg.DoModal();
  843. }
  844. if (g_user.bLongin == 1)
  845. {
  846. if (g_pMainWnd2)
  847. {
  848. g_pMainWnd2->ShowBar(TRUE,TRUE);
  849. }
  850. }
  851. return;
  852. }
  853. case IDM_TODAY:
  854. pName = (LPSTR)(LPCSTR)"历史订单";
  855. // OPEN_MENU(SalarySet3);
  856. OPEN_MENU(DinDanHistroy);
  857. break;
  858. case IDM_TAKECONTROL:
  859. pName = (LPSTR)(LPCSTR)"摄控表";
  860. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(117)))
  861. OPEN_MENU(TodayForm2);
  862. else
  863. OPEN_MENU(TodayForm);
  864. break;
  865. case IDM_CLIENTMONEY:
  866. pName = (LPSTR)(LPCSTR)"客人付款";
  867. OPEN_MENU(ClientMoney);
  868. break;
  869. case IDM_TAKEAWAYBOOK:
  870. pName = (LPSTR)(LPCSTR)"发片/取件";
  871. OPEN_MENU(outsourcing);
  872. break;
  873. case IDM_CODE:
  874. pName = (LPSTR)(LPCSTR)"商品报表";
  875. OPEN_MENU(SPForm);
  876. break;
  877. case IDM_Daily:
  878. // if(IsHasRightsnew(22)==0)return;
  879. // pName = (LPSTR)(LPCSTR)"日财务表";
  880. // OPEN_MENU(DailyForm);
  881. pName = (LPSTR)(LPCSTR)"沟通助手";
  882. OPEN_MENU(InsideMsg);
  883. break;
  884. case IDM_ProcessAlarm:
  885. pName = (LPSTR)(LPCSTR)"流程监控";
  886. OPEN_MENU(ProcessAlarm);
  887. break;
  888. case IDM_DINDAN:
  889. // if(IsHasRights(7)==0)return;
  890. pName = (LPSTR)(LPCSTR)"订单报表";
  891. OPEN_MENU(DinDanFrom);
  892. break;
  893. case IDM_CLIENT:
  894. //if(IsHasRights(8)==0)return;
  895. pName = (LPSTR)(LPCSTR)"客户报表";
  896. OPEN_MENU(CClientForm);
  897. break;
  898. case IDM_PayOutInput:
  899. if (IsHasRightsnew(20) == 0)return;
  900. pName = (LPSTR)(LPCSTR)"现金支出";
  901. OPEN_MENU(PayOutInput);
  902. break;
  903. case IDM_salaryset:
  904. if (IsHasRightsnew(25) == 0)return;
  905. pName = (LPSTR)(LPCSTR)"工资设置";
  906. OPEN_MENU(SalarySet);
  907. break;
  908. case IDM_mysalary:
  909. if (IsHasRights(16) == 0)return;
  910. pName = (LPSTR)(LPCSTR)"我的工资";
  911. OPEN_MENU(MySalary);
  912. break;
  913. case IDM_SP:
  914. // if(IsHasRightsnew(29)==0)return;
  915. pName = (LPSTR)(LPCSTR)"商品设置";
  916. OPEN_MENU(ShangPin);
  917. break;
  918. case IDM_WORKER:
  919. if (IsHasRightsnew(27) == 0)return;
  920. pName = (LPSTR)(LPCSTR)"员工设置";
  921. OPEN_MENU(Worker);
  922. break;
  923. case IDM_TAOXI:
  924. if (IsHasRightsnew(30) == 0)return;
  925. pName = (LPSTR)(LPCSTR)"套系设置";
  926. OPEN_MENU(TXDlg);
  927. break;
  928. case IDM_TAOXISP:
  929. if (IsHasRightsnew(30) == 0)return;
  930. pName = (LPSTR)(LPCSTR)"套系赠送商品设置";
  931. OPEN_MENU(TXSPDlg);
  932. break;
  933. case IDM_Provider:
  934. if (IsHasRightsnew(32) == 0)return;
  935. pName = (LPSTR)(LPCSTR)"供应商设置";
  936. OPEN_MENU(ProviderDlg);
  937. break;
  938. case IDM_BUMEN:
  939. {
  940. if (IsHasRightsnew(49) == 0)return;
  941. BuMenDlg dlg;
  942. dlg.DoModal();
  943. return;
  944. }
  945. case IDM_Account:
  946. if (IsHasRightsnew(49) == 0)return;
  947. pName = (LPSTR)(LPCSTR)"账号管理";
  948. OPEN_MENU(Account);
  949. break;
  950. case IDM_YLCD:
  951. {
  952. //AfxMessageBox("IDM_YLCD");
  953. ::CopyFile(_T(g_path7 + "\\接单系统\\Regsvr32.exe"), _T(g_mainpath + "\\Regsvr32.exe"), 0);
  954. ::CopyFile(_T(g_path7 + "\\接单系统\\Flash9f.ocx"), _T(g_mainpath + "\\Flash9f.ocx"), 0);
  955. CString temp;
  956. temp.Format("%s\\regsvr32.exe /s %s\\Flash9f.OCX", g_mainpath, g_mainpath);
  957. WinExec(temp, SW_HIDE);
  958. ::CopyFile(_T(g_path7 + "\\接单系统\\接单系统.exe"), _T(g_mainpath + "\\接单系统.exe"), 0);
  959. ::CopyFile(_T(g_path7 + "\\接单系统\\my32.dll"), _T(g_mainpath + "\\my32.dll"), 0);
  960. ::CopyFile(_T(g_path7 + "\\接单系统\\server.dat"), _T(g_mainpath + "\\server.dat"), 0);
  961. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\接单系统.exe"), g_server, NULL, SW_SHOWNORMAL);
  962. }
  963. break;
  964. case IDM_YLCDMANAGE:
  965. ::CopyFile(_T(g_path7 + "\\接单系统\\资源管理器.exe"), _T(g_mainpath + "\\资源管理器.exe"), 0);
  966. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\资源管理器.exe"), g_server, NULL, SW_SHOWNORMAL);
  967. break;
  968. }
  969. }
  970. //减少代码
  971. ///////////////////////////////////////////////////////////////////////////////
  972. void CMainFrame::OnDisconnect()
  973. {
  974. printf("断开TCP连接\n");
  975. m_tClientTunnel.net_CloseSocket();
  976. SetConnectionID(INVALID_SOCKET);
  977. }
  978. void CMainFrame::ProcessLoginResponse(void *pLoginResult)
  979. {
  980. if (NULL == pLoginResult) return;
  981. LOGIN_RESULT_STRU *ptLoginResult = (LOGIN_RESULT_STRU *)pLoginResult;
  982. DWORD dwConnectionID = ptLoginResult->tCommonMsg.dwConnectionID;
  983. SetConnectionID(dwConnectionID);
  984. BYTE byResult = ptLoginResult->byResult;
  985. if (LOGIN_RESULT_SUC == byResult)
  986. {
  987. //AfxMessageBox("登录成功"); // Jeff test;
  988. }
  989. else
  990. {
  991. OnDisconnect();
  992. }
  993. }
  994. /************************************************************************/
  995. /* 函数:ProcessLoginRequest[3/3/2016 IT];
  996. /* 描述:登陆服务器;
  997. /* 参数:;
  998. /* [IN] :;
  999. /* [OUT] :;
  1000. /* [IN/OUT] :;
  1001. /* 返回:登陆成功返回TRUE;
  1002. /* 注意:;
  1003. /* 示例:;
  1004. /*
  1005. /* 修改:;
  1006. /* 日期:;
  1007. /* 内容:;
  1008. /************************************************************************/
  1009. BOOL CMainFrame::ProcessLoginRequest()
  1010. {
  1011. // 1.设置通信类型MSG_LOGIN_REQ,为登陆请求;
  1012. WORD wMessageId = 0;
  1013. if (g_conntype == 0 && !g_bConnLYFZ)
  1014. wMessageId = (MSG_LOGIN_REQ + 0X1FFF);
  1015. else// if (g_bConnLYFZ )
  1016. wMessageId = MSG_LOGIN_REQ;
  1017. // 2.填充发送数据;
  1018. TLOGIN_STRU tLogonInfo = { 0 };
  1019. tLogonInfo.tCommonMsg.dwConnectionID = GetConnectionID();//此时m_dwConnectionID为INVALIDE_SOCKET;
  1020. tLogonInfo.tCommonMsg.wMessageId = wMessageId;
  1021. CString strUserName = newGUID();// 以随机数作为登陆时的用户名称;
  1022. strUserName.TrimLeft();
  1023. strUserName.TrimRight();
  1024. #ifdef VC60
  1025. strcpy(tLogonInfo.tUserInfo.szUserName, strUserName);
  1026. #else
  1027. strcpy_s(tLogonInfo.tUserInfo.szUserName, 31, strUserName);
  1028. #endif
  1029. DWORD dwDataLen = sizeof(TLOGIN_STRU);
  1030. // 3.填充数据头;
  1031. TMessageHeader tHeader = { 0 };
  1032. tHeader.wMessageId = wMessageId;
  1033. tHeader.dwDataLen = dwDataLen;
  1034. // 4.发送数据;
  1035. unsigned long ulSendLen = m_tClientTunnel.net_Send(&tHeader, (void *)&tLogonInfo, dwDataLen);
  1036. if (ulSendLen == SOCKET_ERROR)
  1037. {
  1038. return 0;
  1039. }
  1040. return 1;
  1041. }
  1042. DWORD CMainFrame::GetConnectionID()
  1043. {
  1044. return m_dwConnectionID;
  1045. }
  1046. void CMainFrame::SetConnectionID(DWORD dwConnection)
  1047. {
  1048. m_dwConnectionID = dwConnection;
  1049. }
  1050. /************************************************************************/
  1051. /* 函数:ProcessChatMessageRequest2[3/3/2016 IT];
  1052. /* 描述:;
  1053. /* 参数:;
  1054. /* [IN] code:;
  1055. /* 返回:void;
  1056. /* 注意:
  1057. OnConnect() -> ProcessChatMessageRequest()
  1058. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1059. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1060. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1061. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1062. 5.关闭对话框和断开连接;;
  1063. /* 示例:;
  1064. /*
  1065. /* 修改:;
  1066. /* 日期:;
  1067. /* 内容:;
  1068. /************************************************************************/
  1069. void CMainFrame::ProcessChatMessageRequest2(BYTE code)
  1070. {
  1071. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1072. SendDataDlg dlg;
  1073. dlg.m_bycode = code;
  1074. dlg.DoModal();
  1075. }
  1076. //*********************************************//
  1077. /*
  1078. 函数:ProcessChatMessageRequest2
  1079. 参数:CString sql [IN]
  1080. 返回:无
  1081. 过程:OnConnect() -> ProcessChatMessageRequest()
  1082. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1083. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1084. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1085. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1086. 5.关闭对话框和断开连接;
  1087. */
  1088. //*********************************************//
  1089. void CMainFrame::ProcessChatMessageRequest2(CString sql)
  1090. {
  1091. if ((sql.Find("insert") != -1 || sql.Find("update") != -1 || sql.Find("delete") != -1) && g_branchname != "" && g_bBranchModify == 0)
  1092. {
  1093. AfxMessageBox("当前为分店数据查看状态,不能更改分店数据!", MB_ICONSTOP);
  1094. g_bSendOK = 0;
  1095. return;
  1096. }
  1097. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1098. SendDataDlg dlg;
  1099. dlg.m_strSQL = sql;
  1100. dlg.DoModal();
  1101. }
  1102. //*********************************************//
  1103. /*
  1104. 函数:ProcessChatMessageRequest2
  1105. 参数:BYTE *pData [IN], int length [IN]
  1106. 返回:无
  1107. 过程:OnConnect() -> ProcessChatMessageRequest()
  1108. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1109. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1110. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1111. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1112. 5.关闭对话框和断开连接;
  1113. */
  1114. //*********************************************//
  1115. void CMainFrame::ProcessChatMessageRequest2(BYTE *pData, int length)
  1116. {
  1117. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1118. SendDataDlg dlg;
  1119. dlg.m_pData = pData;
  1120. dlg.m_nlength = length;
  1121. dlg.DoModal(); // DoModal未执行完时,就被其他函数销毁,导致局部函数dlg无效;
  1122. }
  1123. /************************************************************************/
  1124. /*
  1125. 函数:ProcessChatMessageRequest
  1126. 描述:对服务发送数据;
  1127. 参数:void *szDataBuf[IN], int nDataLen[IN]
  1128. 返回:发送成功与否;
  1129. */
  1130. /************************************************************************/
  1131. BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)
  1132. {
  1133. // 1.获取当前与服务器连接的id;
  1134. DWORD dwFromUserID = GetConnectionID();
  1135. // 2.设置通信类型为MSG_CHATMESSAGE_REQ;
  1136. WORD wMessageId = 0;
  1137. if (g_conntype == 0 && !g_bConnLYFZ)
  1138. wMessageId = (MSG_CHATMESSAGE_REQ + 0X3FFF);
  1139. else
  1140. wMessageId = MSG_CHATMESSAGE_REQ;
  1141. // 3.计算出欲发送的数据的长度 dwDataLen;
  1142. DWORD dwDataLen = sizeof(TCHAT_MESSAGE_STRU) + nDataLen;
  1143. BYTE *pSendData = new BYTE[dwDataLen];
  1144. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU*)pSendData;
  1145. memset(pChatMessage, 0x00, dwDataLen);
  1146. // 3.1.g_nYearpos==-1,表示连接是当前主数据库,其他值表示历史数据库;
  1147. if (g_nYearpos == -1)
  1148. g_sendhead.length[99] = g_nYearpos;
  1149. else
  1150. g_sendhead.length[99] = g_nYearpos * 32142953 + 10966236;
  1151. g_sendhead.length[98] = 987123768;
  1152. memcpy(pSendData, &g_sendhead, sizeof(g_sendhead));
  1153. #ifdef ENTERPRISE_VERSION
  1154. if (g_bBranchModify == 0)
  1155. #ifdef VC60
  1156. strcpy(pChatMessage->szFromUserName, g_branchname);
  1157. #else
  1158. strcpy_s(pChatMessage->szFromUserName, 30, g_branchname);
  1159. #endif
  1160. #endif
  1161. // 4.填充发送的数据结构;
  1162. pChatMessage->tCommonMsg.dwConnectionID = GetConnectionID();
  1163. pChatMessage->tCommonMsg.wMessageId = wMessageId;
  1164. pChatMessage->dwFromUserID = dwFromUserID;
  1165. pChatMessage->dwToUserID = g_nSendCode;//▲▲g_nSendCode在服务端同为dwToUserID;
  1166. pChatMessage->wMessageLen = nDataLen;
  1167. memcpy(pChatMessage->byFileContent, szDataBuf, nDataLen);
  1168. // 5.填充数据头;
  1169. TMessageHeader tHeader = { 0 };
  1170. tHeader.wMessageId = wMessageId;
  1171. tHeader.dwDataLen = dwDataLen;
  1172. // 6.发送数据;
  1173. BOOL bRet = 0;
  1174. unsigned long ulSendLen = m_tClientTunnel.net_Send(&tHeader, (void *)pChatMessage, dwDataLen);
  1175. if (ulSendLen != SOCKET_ERROR)
  1176. {
  1177. bRet = 1;
  1178. }
  1179. // 7.发送完毕,释放内存;
  1180. delete[] pSendData;
  1181. return bRet;
  1182. }
  1183. /************************************************************************/
  1184. /*
  1185. 函数:ProcessChatMessageResponse
  1186. 描述:接收服务返回的数据;
  1187. 参数:void *pResponse[IN]
  1188. 返回:无;
  1189. 调用关系:
  1190. 1.由 void CMainFrame::ProcessNetEvent(...)调用
  1191. */
  1192. /************************************************************************/
  1193. void CMainFrame::ProcessChatMessageResponse(void *pResponse)
  1194. {
  1195. // 1.数据空,直接返回;
  1196. if (NULL == pResponse)
  1197. return;
  1198. // 2.数据解析过程;
  1199. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pResponse;
  1200. int nMessageLen = pChatMessage->wMessageLen;
  1201. int nMessageLen2 = pChatMessage->dwToUserID; // 在服务器中被处理了,一般使dwToUserID=wMessageLen;
  1202. // Jeff.dwFromUserID==8888表示的内容是更新客户端skin界面数据,只有两处dwToUserID==211和dwToUserID==21;
  1203. // Jeff.其余的大多数都是 dwFromUserID = wMessageLen = dwToUserID 三者相等;
  1204. if (nMessageLen == nMessageLen2 && pChatMessage->dwFromUserID != 8888)
  1205. {
  1206. // 2.1.清除全局变量g_pData数据,用于保存接收的实际数据;
  1207. if (g_pData)
  1208. delete[]g_pData;
  1209. g_pData = NULL;
  1210. g_pData = new BYTE[nMessageLen];
  1211. memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
  1212. memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
  1213. g_nLeng = nMessageLen;
  1214. if (nMessageLen <= sizeof(DWORD))
  1215. {
  1216. memcpy(&g_ncount, pChatMessage->byFileContent, sizeof(DWORD));
  1217. }
  1218. KillTimer(2);
  1219. if (g_hSendWnd)
  1220. {
  1221. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);//关闭发送对话框;
  1222. }
  1223. }
  1224. else if (nMessageLen == nMessageLen2 && pChatMessage->dwFromUserID == 8888)
  1225. {
  1226. if (g_pData2)
  1227. delete[]g_pData2;
  1228. g_pData2 = NULL;
  1229. g_pData2 = new BYTE[nMessageLen2];
  1230. memcpy(g_pData2, pChatMessage->byFileContent, nMessageLen2);
  1231. g_nLeng2 = nMessageLen2;
  1232. KillTimer(2);
  1233. if (g_hSendWnd)
  1234. {
  1235. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1236. }
  1237. }
  1238. else // 登陆返回;
  1239. {
  1240. if (g_bConnLYFZ)
  1241. {
  1242. if (g_pData)
  1243. delete[]g_pData;
  1244. g_pData = NULL;
  1245. g_pData = new BYTE[nMessageLen];
  1246. memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
  1247. memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
  1248. g_nLeng = nMessageLen;
  1249. if (nMessageLen <= sizeof(DWORD))
  1250. {
  1251. memcpy(&g_ncount, pChatMessage->byFileContent, sizeof(DWORD));
  1252. }
  1253. KillTimer(2);
  1254. if (g_hSendWnd)
  1255. {
  1256. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1257. }
  1258. return;
  1259. }
  1260. if (g_conntype) // Jeff.g_conntype == 1,表示连接公司服务器的返回,用于集团版解析*.ly.com的IP地址;
  1261. {
  1262. // KillTimer(2);
  1263. char *szChatMessage = new char[nMessageLen + 1];
  1264. memset(szChatMessage, 0x00, nMessageLen + 1);
  1265. memcpy(szChatMessage, pChatMessage->byFileContent, nMessageLen);
  1266. g_server = szChatMessage;
  1267. delete[]szChatMessage;
  1268. CStdioFile fp;
  1269. CString path = g_mainpath + "\\ip.txt";
  1270. ::DeleteFile(path); // 删除ip.txt;
  1271. fp.Open(path, CFile::modeCreate | CFile::modeWrite);
  1272. fp.WriteString(g_server);
  1273. fp.Close();
  1274. g_conntype = 0;
  1275. // g_serverip=g_server;
  1276. return;
  1277. }
  1278. if (g_pData2 == NULL)
  1279. {
  1280. g_pData2 = new BYTE[nMessageLen2];
  1281. g_nLeng2 = 0;
  1282. }
  1283. memcpy(g_pData2 + g_nLeng2, pChatMessage->byFileContent, nMessageLen);
  1284. g_nLeng2 += nMessageLen;
  1285. if (g_nLeng2 == nMessageLen2)//已收完
  1286. {
  1287. KillTimer(2);
  1288. if (g_hSendWnd)
  1289. {
  1290. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1291. }
  1292. }
  1293. else
  1294. {
  1295. KillTimer(2);
  1296. SetTimer(2, g_ntimeout, NULL);
  1297. }
  1298. }
  1299. }
  1300. #if USE_SHARE_FLORD
  1301. /************************************************************************/
  1302. /*
  1303. Date: 2015-04-11
  1304. Author: Jeff
  1305. 函数:GetSharePathInfo
  1306. 描述:获取共享目录表的所有信息;
  1307. 参数:
  1308. 返回:成功返回TRUE;
  1309. 注意:获取的表记录存储在全局变量g_aryOfSharePathInfo中;
  1310. 调用约定:在登陆软件时调用,且必须连接的服务器是本店的;
  1311. */
  1312. /************************************************************************/
  1313. BOOL CMainFrame::GetSharePathInfo()
  1314. {
  1315. // 1.连接的数据库必须是本局域网的服务器;
  1316. if ( g_bAllBranch || !g_branchname.IsEmpty() || !g_branchip.IsEmpty() )
  1317. {
  1318. // 非当前局域网服务器;
  1319. return FALSE;
  1320. }
  1321. // 2.获取当前连接的分店域名是否与g_domain一致;
  1322. g_sendhead.bsql = 0;
  1323. g_sendhead.code[0] = 29;
  1324. g_sendhead.tabcount = 1;
  1325. g_pMainWnd->ProcessChatMessageRequest2(23);
  1326. if ( !g_bSendOK )
  1327. {
  1328. // 连接服务器失败;
  1329. return FALSE;
  1330. }
  1331. CArray<CStringArray,CStringArray> strArray;
  1332. DataToArray(&strArray);
  1333. CString strCurBranchDomain = _T("");
  1334. if ( strArray.GetSize() )
  1335. {
  1336. strCurBranchDomain = strArray.ElementAt(0).ElementAt(0);
  1337. if ( strCurBranchDomain.Find(_T(".ly.com")) == -1)
  1338. {
  1339. // 当前获取的域名有错;
  1340. return FALSE;
  1341. }
  1342. }
  1343. if ( g_domain.CompareNoCase(strCurBranchDomain) != 0)
  1344. {
  1345. // 当前连接的分店域名与局域网服务器域名不一致;
  1346. return FALSE;
  1347. }
  1348. // 3.获取可用的共享信息;//select * from NetShareInfo where enable = 1;
  1349. CString strFilter = _T("");
  1350. strFilter.Format(_T("enable = 1"));
  1351. int g_nYearposTemp=g_nYearpos;
  1352. g_nYearpos=-1;
  1353. g_bSendOK = 0;
  1354. g_sendhead.bsql = 0;
  1355. g_sendhead.code[0] = 236;
  1356. g_sendhead.tabcount = 1;
  1357. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  1358. g_nYearpos = g_nYearposTemp;
  1359. if ( !g_bSendOK )
  1360. {
  1361. // 获取共享信息失败;
  1362. return FALSE;
  1363. }
  1364. g_aryOfSharePathInfo.RemoveAll();
  1365. DataToArray(&g_aryOfSharePathInfo);
  1366. return g_aryOfSharePathInfo.GetSize() ? TRUE : FALSE;
  1367. }
  1368. #endif
  1369. BOOL CMainFrame::OnConnectBranch()
  1370. {
  1371. if (g_branchip == "")
  1372. {
  1373. return 0;
  1374. }
  1375. g_conntype = 0;
  1376. CString strServerAddress = g_branchip;
  1377. char *szServerAddress = strServerAddress.GetBuffer(0);
  1378. strServerAddress.ReleaseBuffer();
  1379. /*for Client, IP and Port can be 0,
  1380. and for Server, IP is LocalIP, and Port is Listening Port*/
  1381. int nResult = m_tClientTunnel.net_OpenSocket(
  1382. Transport_Client,
  1383. 0,
  1384. HandleClientNetEvent,
  1385. this);
  1386. if (TRANSPORT_OK != nResult)
  1387. {
  1388. // AfxMessageBox("网络初始化失败!");
  1389. return 0;
  1390. }
  1391. GetSysIniInfo(g_szModulePath, g_branchname + _T(".ini"));
  1392. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1393. DWORD wPort = g_dwCSPort;
  1394. #ifdef VC60
  1395. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1396. if (TRANSPORT_OK != nResult)
  1397. #else
  1398. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1399. if (!nResult)
  1400. #endif
  1401. {
  1402. m_tClientTunnel.net_CloseSocket();
  1403. return OnConnectBranch2();
  1404. }
  1405. return ProcessLoginRequest();
  1406. }
  1407. BOOL CMainFrame::OnConnectBranch2()
  1408. {
  1409. if (g_branchip2 == "")
  1410. {
  1411. return 0;
  1412. }
  1413. g_conntype = 0;
  1414. CString strServerAddress = g_branchip2;
  1415. char *szServerAddress = strServerAddress.GetBuffer(0);
  1416. strServerAddress.ReleaseBuffer();
  1417. /*for Client, IP and Port can be 0,
  1418. and for Server, IP is LocalIP, and Port is Listening Port*/
  1419. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1420. 0,
  1421. HandleClientNetEvent,
  1422. this);
  1423. if (TRANSPORT_OK != nResult)
  1424. {
  1425. // AfxMessageBox("网络初始化失败!");
  1426. return 0;
  1427. }
  1428. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1429. DWORD wPort = SERVER_PORT; // 5678
  1430. #ifdef VC60
  1431. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1432. if (TRANSPORT_OK != nResult)
  1433. #else
  1434. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1435. if (!nResult)
  1436. #endif
  1437. {
  1438. m_tClientTunnel.net_CloseSocket();
  1439. return 0;
  1440. }
  1441. return ProcessLoginRequest();
  1442. }
  1443. BOOL CMainFrame::OnConnectIP()
  1444. {
  1445. CString strServerAddress = g_server;
  1446. char *szServerAddress = strServerAddress.GetBuffer(0);
  1447. strServerAddress.ReleaseBuffer();
  1448. /*for Client, IP and Port can be 0,
  1449. and for Server, IP is LocalIP, and Port is Listening Port*/
  1450. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1451. 0,
  1452. HandleClientNetEvent,
  1453. this);
  1454. if (TRANSPORT_OK != nResult)
  1455. {
  1456. // AfxMessageBox("网络初始化失败!");
  1457. return 0;
  1458. }
  1459. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1460. DWORD wPort = SERVER_PORT; // 5678
  1461. #ifdef VC60
  1462. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1463. if (TRANSPORT_OK != nResult)
  1464. #else
  1465. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1466. if (!nResult)
  1467. #endif
  1468. {
  1469. m_tClientTunnel.net_CloseSocket();
  1470. return 0;
  1471. }
  1472. return ProcessLoginRequest();
  1473. }
  1474. //ip.txt
  1475. BOOL CMainFrame::OnConnectLYFZ()
  1476. {
  1477. CString strBranchIP = "lijiafz.vicp.net";
  1478. MyGetIPByName2(strBranchIP);
  1479. if (strBranchIP == "")
  1480. {
  1481. return 0;
  1482. }
  1483. g_conntype = 0; // Jeff.Delete at 2014.10.18
  1484. //g_conntype = 1;
  1485. CString strServerAddress = strBranchIP;
  1486. char *szServerAddress = strServerAddress.GetBuffer(0);
  1487. strServerAddress.ReleaseBuffer();
  1488. /*for Client, IP and Port can be 0,
  1489. and for Server, IP is LocalIP, and Port is Listening Port*/
  1490. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1491. 0,
  1492. HandleClientNetEvent,
  1493. this);
  1494. if (TRANSPORT_OK != nResult)
  1495. {
  1496. return 0;
  1497. }
  1498. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1499. DWORD wPort = GetPort();
  1500. #ifdef VC60
  1501. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1502. if (TRANSPORT_OK != nResult)
  1503. #else
  1504. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1505. if (!nResult)
  1506. #endif
  1507. {
  1508. m_tClientTunnel.net_CloseSocket();
  1509. return 0;
  1510. }
  1511. return ProcessLoginRequest();
  1512. }
  1513. BOOL CMainFrame::OnConnect()
  1514. {
  1515. // 1.Jeff 断开(如果有在在未关的连接)之前的连接;
  1516. OnDisconnect();
  1517. // 2.根据需要连接指定的服务器;
  1518. if (g_bBranchModify)
  1519. {
  1520. // Jeff.g_bBranchModify在g_bGenBranchData=1时,在welcome::OnTimer里被设置为1;
  1521. return OnConnectBranch();// 连接集团版分店;
  1522. }
  1523. if (g_bConnLYFZ)
  1524. {
  1525. return OnConnectLYFZ();// 连接公司服务端程序;
  1526. }
  1527. g_conntype = 0;
  1528. CString strServerAddress = g_server;
  1529. // 3.如果dbconfig.dat里保存的是*.ly.com的信息,就要读取ip.txt里的IP地址;
  1530. if (g_serverbak.Find(".ly.com") != -1)
  1531. {
  1532. strServerAddress = g_serverbak;
  1533. CStdioFile fp;
  1534. CString path = g_mainpath + "\\ip.txt";
  1535. if (::PathFileExists(path))
  1536. {
  1537. fp.Open(path, CFile::modeRead);
  1538. fp.ReadString(g_server);
  1539. fp.Close();
  1540. if (OnConnectIP())
  1541. {
  1542. // g_serverip=g_server;
  1543. return 1;
  1544. }
  1545. g_server = strServerAddress;
  1546. OnDisconnect();//MessageBox("ip失败");
  1547. }
  1548. g_conntype = 1; // Jeff.连接公司服务器,用于获取集团版*.ly.com的解析IP结果;
  1549. strServerAddress = "lijiafz.vicp.net";
  1550. MyGetIPByName2(strServerAddress);
  1551. if (strServerAddress.IsEmpty())
  1552. {
  1553. return 0;//OnConnect2();
  1554. }
  1555. }
  1556. else if (g_ntimeout == 29000)//非远程 30000
  1557. {
  1558. strServerAddress = g_serverarray.ElementAt(g_conpos);
  1559. }
  1560. // 4.如果没有IP.txt或dbconfig.dat里的不是ly.com信息,而是一般的计算机名称;
  1561. char *szServerAddress = strServerAddress.GetBuffer(0);
  1562. strServerAddress.ReleaseBuffer();
  1563. // AfxMessageBox("连接:"+strServerAddress);
  1564. /*for Client, IP and Port can be 0,
  1565. and for Server, IP is LocalIP, and Port is Listening Port*/
  1566. // 5.创建通信对象连接;
  1567. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1568. 0,
  1569. HandleClientNetEvent,
  1570. this);
  1571. if (TRANSPORT_OK != nResult)
  1572. {
  1573. return 0;
  1574. }
  1575. GetSysIniInfo();
  1576. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1577. DWORD wPort = g_dwCSPort;
  1578. if (g_conntype) wPort = GetPort();
  1579. // 6.连接公司服务器或影楼服务器;
  1580. #ifdef VC60
  1581. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1582. if (TRANSPORT_OK != nResult)
  1583. #else
  1584. nResult = m_tClientTunnel.net_Connect(szServerAddress,wPort);
  1585. if (!nResult)
  1586. #endif
  1587. {
  1588. m_tClientTunnel.net_CloseSocket();
  1589. if (g_conntype)// Jeff.连接公司服务器,用于获取集团版*.ly.com的解析IP结果;
  1590. {
  1591. return 0;//OnConnect2();
  1592. }
  1593. if (g_serverarray.GetSize() > 1)
  1594. {
  1595. if (g_conpos < (g_serverarray.GetSize() - 1))
  1596. {
  1597. g_conpos++;
  1598. return OnConnect();
  1599. }
  1600. else
  1601. {
  1602. g_conpos = 0;
  1603. return 0;
  1604. }
  1605. }
  1606. return 0;
  1607. }
  1608. return ProcessLoginRequest();
  1609. }
  1610. BOOL CMainFrame::OnConnect2()
  1611. {
  1612. g_conntype = 2;
  1613. CString server = "http://www.lyfz.net/download/ip.txt";
  1614. char buf[MAX_PATH];
  1615. ::GetTempPath(sizeof(buf), buf);
  1616. CString m_strTempDir = buf;
  1617. DWORD m_dwHttpRequestFlags = HSR_DOWNLOAD | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
  1618. INTERNET_PORT m_dwPort;
  1619. DWORD dwType;
  1620. CInternetSession m_cis;
  1621. CHttpConnection *m_pHttp;
  1622. CString m_strServer;
  1623. CString m_strIniPath;
  1624. AfxParseURL(server, dwType, m_strServer, m_strIniPath, m_dwPort);
  1625. if (dwType != AFX_INET_SERVICE_HTTP)
  1626. {
  1627. return 0;//OnConnect3();
  1628. }
  1629. m_cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5);
  1630. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1631. try
  1632. {
  1633. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1634. }
  1635. catch (CInternetException* pEx)
  1636. {
  1637. return 0;//OnConnect3();
  1638. }
  1639. CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_GET,
  1640. m_strIniPath, NULL, 1, NULL, NULL, m_dwHttpRequestFlags);
  1641. try
  1642. {
  1643. pFile->SendRequest();
  1644. }
  1645. catch (CInternetException* pEx)
  1646. {
  1647. pFile->Close();
  1648. return 0;//OnConnect3();
  1649. }
  1650. if (pFile)
  1651. {
  1652. CStdioFile csf;
  1653. csf.Open(m_strTempDir + "\\ip.txt", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
  1654. char buf[2048];
  1655. int n;
  1656. while ((n = pFile->Read(buf, 2048)) > 0)
  1657. csf.Write(buf, n);
  1658. csf.Close();
  1659. pFile->Close();
  1660. }
  1661. CString strServerAddress;
  1662. CStdioFile fp;
  1663. fp.Open(m_strTempDir + "\\ip.txt", CFile::modeRead);
  1664. fp.ReadString(strServerAddress);
  1665. fp.Close();
  1666. char *szServerAddress = strServerAddress.GetBuffer(0);
  1667. strServerAddress.ReleaseBuffer();
  1668. /*for Client, IP and Port can be 0,
  1669. and for Server, IP is LocalIP, and Port is Listening Port*/
  1670. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1671. 0,
  1672. HandleClientNetEvent,
  1673. this);
  1674. if (TRANSPORT_OK != nResult)
  1675. {
  1676. return 0;
  1677. }
  1678. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1679. DWORD wPort = SERVER_PORT; // 5678
  1680. if (g_conntype)wPort = GetPort();
  1681. #ifdef VC60
  1682. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1683. if (TRANSPORT_OK != nResult)
  1684. #else
  1685. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1686. if (!nResult)
  1687. #endif
  1688. {
  1689. m_tClientTunnel.net_CloseSocket();
  1690. return 0;//OnConnect3();
  1691. }
  1692. return ProcessLoginRequest();
  1693. }
  1694. BOOL CMainFrame::OnConnect3()
  1695. {
  1696. g_conntype = 3;
  1697. CString server = "http://photo.bjlyfz.com/download/ip.txt";
  1698. char buf[MAX_PATH];
  1699. ::GetTempPath(sizeof(buf), buf);
  1700. CString m_strTempDir = buf;
  1701. DWORD m_dwHttpRequestFlags = HSR_DOWNLOAD | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
  1702. INTERNET_PORT m_dwPort;
  1703. DWORD dwType;
  1704. CInternetSession m_cis;
  1705. CHttpConnection *m_pHttp;
  1706. CString m_strServer;
  1707. CString m_strIniPath;
  1708. AfxParseURL(server, dwType, m_strServer, m_strIniPath, m_dwPort);
  1709. if (dwType != AFX_INET_SERVICE_HTTP)
  1710. {
  1711. return FALSE;
  1712. }
  1713. m_cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5);
  1714. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1715. try
  1716. {
  1717. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1718. }
  1719. catch (CInternetException* pEx)
  1720. {
  1721. return false;
  1722. }
  1723. CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_GET,
  1724. m_strIniPath, NULL, 1, NULL, NULL, m_dwHttpRequestFlags);
  1725. try
  1726. {
  1727. pFile->SendRequest();
  1728. }
  1729. catch (CInternetException* pEx)
  1730. {
  1731. pFile->Close();
  1732. return false;
  1733. }
  1734. if (pFile)
  1735. {
  1736. CStdioFile csf;
  1737. csf.Open(m_strTempDir + "\\ip.txt", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
  1738. char buf[2048];
  1739. int n;
  1740. while ((n = pFile->Read(buf, 2048)) > 0)
  1741. csf.Write(buf, n);
  1742. csf.Close();
  1743. pFile->Close();
  1744. }
  1745. CString strServerAddress;
  1746. CStdioFile fp;
  1747. fp.Open(m_strTempDir + "\\ip.txt", CFile::modeRead);
  1748. fp.ReadString(strServerAddress);
  1749. fp.Close();
  1750. char *szServerAddress = strServerAddress.GetBuffer(0);
  1751. strServerAddress.ReleaseBuffer();
  1752. /*for Client, IP and Port can be 0,
  1753. and for Server, IP is LocalIP, and Port is Listening Port*/
  1754. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1755. 0,
  1756. HandleClientNetEvent,
  1757. this);
  1758. if (TRANSPORT_OK != nResult)
  1759. {
  1760. return 0;
  1761. }
  1762. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1763. DWORD wPort = SERVER_PORT; // 5678
  1764. if (g_conntype)wPort = GetPort();
  1765. #ifdef VC60
  1766. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1767. if (TRANSPORT_OK != nResult)
  1768. #else
  1769. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1770. if (!nResult)
  1771. #endif
  1772. {
  1773. m_tClientTunnel.net_CloseSocket();
  1774. return 0;
  1775. }
  1776. return ProcessLoginRequest();
  1777. }
  1778. void CMainFrame::ProcessNetEvent(int nEventType, void *pRecvMsg, DWORD dwDataLen)
  1779. {
  1780. //printf("Jeff:ProcessNetEvent\n\n");//Jeff Printf;
  1781. if (Transport_ReadEv == nEventType)
  1782. {
  1783. if (NULL == pRecvMsg) return;
  1784. TMessageHeader* pHeader = (TMessageHeader *)pRecvMsg;
  1785. char *pDataBuf = (char *)pRecvMsg + MESSAGE_HEADER_LEN;
  1786. WORD dwMessageID = pHeader->wMessageId;
  1787. switch (dwMessageID)
  1788. {
  1789. case MSG_LOGIN_RESP:
  1790. case (MSG_LOGIN_RESP + 0X2FFF) :
  1791. {
  1792. LOGIN_RESULT_STRU tLoginResult = { 0 };
  1793. memcpy(&tLoginResult, pDataBuf, sizeof(LOGIN_RESULT_STRU));
  1794. ProcessLoginResponse(&tLoginResult);
  1795. break;
  1796. }
  1797. case MSG_USERINFO_RESP:
  1798. {
  1799. break;
  1800. }
  1801. case MSG_LOGOUT_RESP:
  1802. {
  1803. break;
  1804. }
  1805. case MSG_CHATMESSAGE_RESP:
  1806. case (MSG_CHATMESSAGE_RESP + 0X4FFF) :
  1807. {
  1808. static int i = 0;
  1809. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pDataBuf;
  1810. ProcessChatMessageResponse((void *)pChatMessage);
  1811. break;
  1812. }
  1813. default:
  1814. {
  1815. break;
  1816. }
  1817. }
  1818. }
  1819. else if (Transport_CloseEv == nEventType)
  1820. {
  1821. OnDisconnect();
  1822. }
  1823. }
  1824. //extern BOOL g_bNeedCoon;
  1825. extern BOOL EncryptFile2(BYTE *buffer, DWORD leng, PCHAR szPassword);
  1826. void CMainFrame::OnTimer(UINT nIDEvent)
  1827. {
  1828. // TODO: Add your message handler code here and/or call default
  1829. if (1 == nIDEvent)
  1830. {
  1831. KillTimer(nIDEvent);
  1832. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status", 0);//status:此机用选片菜单项
  1833. // checked==1:此机用选片菜单项
  1834. // g_bStaffAchievementShow==1:此机用于员工业绩查看
  1835. if (checked && g_bStaffAchievementShow == 0) // .此机用选片菜单项;
  1836. {
  1837. KillTimer(3);
  1838. #ifdef NEW_SKIN
  1839. Welcome weldlg;
  1840. weldlg.DoModal();
  1841. #endif
  1842. ChoosePhotoSkin dlg;
  1843. dlg.SetLiaPath("1.lia");
  1844. if (dlg.DoModal() != IDOK)
  1845. {
  1846. PostMessage(WM_QUIT);
  1847. return;
  1848. }
  1849. if (dlg.m_exitcode == 3)
  1850. {
  1851. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  1852. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  1853. }
  1854. else
  1855. {
  1856. ShowWindow(SW_SHOW);
  1857. #ifdef NEW_SKIN
  1858. if (m_pMainFrimDlg2 == NULL)
  1859. {
  1860. m_pMainFrimDlg2 = new MainFrimDlg2;
  1861. m_pMainFrimDlg2->SetLiaPath("10.lia");
  1862. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  1863. }
  1864. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1865. #endif
  1866. }
  1867. }
  1868. else if (g_bStaffAchievementShow == 0) // .非选片、非查看员工业绩;
  1869. {
  1870. #ifdef NEW_SKIN
  1871. g_bNoConnDlg = 1;
  1872. Welcome weldlg;
  1873. weldlg.DoModal();
  1874. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1875. ShowWindow(SW_SHOW);
  1876. g_bNoConnDlg = 0;
  1877. if (g_bNoLoginLia) // Jeff.OnCreate里判断skin文件有5.lia, g_bNoLoginLia = 0, 无 g_bNoLoginLia = 1;
  1878. {
  1879. Login dlg;
  1880. dlg.SetLiaPath("5.lia");
  1881. dlg.DoModal();
  1882. }
  1883. else
  1884. {
  1885. Login3 dlg;
  1886. dlg.SetLiaPath("5.lia"); // Login3的父类为MyDlg,在BOOL MyDlg::OnInitDialog()里调用了纯虚函数Init();
  1887. dlg.DoModal();
  1888. }
  1889. if (g_user.bLongin && g_pMainWnd2)
  1890. {
  1891. g_pMainWnd2->ShowBar(TRUE,TRUE);
  1892. InsideMsg();
  1893. }
  1894. #else
  1895. ShowWindow(SW_SHOW);
  1896. if (g_bNoLoginLia)
  1897. {
  1898. Login dlg;
  1899. dlg.SetLiaPath ("5.lia");
  1900. dlg.DoModal();
  1901. }
  1902. else
  1903. {
  1904. Login3 dlg;
  1905. dlg.SetLiaPath ("5.lia");
  1906. dlg.DoModal();
  1907. }
  1908. #endif
  1909. }
  1910. if (g_hmouse == NULL)
  1911. {
  1912. g_hmouse = SetWindowsHookEx(WH_MOUSE, MouseProc, 0, ::GetCurrentThreadId());
  1913. }
  1914. }
  1915. else if (2 == nIDEvent) //29秒后,若连接和发送未完成,将关闭连接和发送框;
  1916. {
  1917. KillTimer(2);
  1918. if (g_hConnectWnd)
  1919. ::PostMessage(g_hConnectWnd, WM_CLOSE, 0, 0);
  1920. if (g_hSendWnd)
  1921. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1922. if (g_bStaffAchievementShow == 0 && g_bConnLYFZ == 0)
  1923. {
  1924. if (g_bGenBranchData == 0)
  1925. {
  1926. if (g_branchip != "")
  1927. AfxMessageBox("连接分店:" + g_branchname + "失败!", MB_ICONINFORMATION);
  1928. else
  1929. AfxMessageBox("连接服务器失败!", MB_ICONINFORMATION);
  1930. }
  1931. OnDisconnect();
  1932. }
  1933. g_bSendOK = 0;
  1934. g_bNeedCoon = 1;
  1935. }
  1936. else if (3 == nIDEvent)
  1937. {
  1938. KillTimer(3);
  1939. #ifdef NEW_SKIN
  1940. Welcome weldlg;
  1941. weldlg.DoModal();
  1942. #endif
  1943. ShowWindow(SW_SHOW);
  1944. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1945. g_sendhead.bsql = 0;
  1946. g_sendhead.code[0] = 24;
  1947. g_sendhead.code[1] = 1;
  1948. g_sendhead.tabcount = 2;
  1949. g_pMainWnd->ProcessChatMessageRequest2(1);
  1950. if (g_bSendOK == 0)
  1951. {
  1952. return;
  1953. }
  1954. CArray<CStringArray, CStringArray>patharray;
  1955. CArray<CStringArray, CStringArray>userarray;
  1956. DataToArray(&g_cominfoarray, &g_hisyeararray);
  1957. g_userarray.SetSize(userarray.GetSize(), 1);
  1958. int count = 0;
  1959. for (int ii = 0; ii < userarray.GetSize(); ii++)
  1960. {
  1961. if (userarray.ElementAt(ii).ElementAt(10) == "在职")
  1962. g_userarray.ElementAt(count++).Copy(userarray.ElementAt(ii));
  1963. }
  1964. g_userarray.SetSize(count, 1);
  1965. StaffAchievementShowAll dlg;
  1966. g_pMainWnd->GetOcx();
  1967. dlg.DoModal();
  1968. }
  1969. else if (5 == nIDEvent)
  1970. {
  1971. if (g_bInSkin)
  1972. {
  1973. OutputDebugString("使用皮肤\n");
  1974. return;
  1975. }
  1976. if (g_nAutoShowStaffAchievement == 1){
  1977. OutputDebugString("用于选片\n");
  1978. return;
  1979. }
  1980. if (g_bAllBranch){
  1981. OutputDebugString("多店汇总当中\n");
  1982. return;
  1983. }
  1984. if (g_user.bLongin)
  1985. {
  1986. // m_Mdi.CloseAll();
  1987. g_pMainWnd->OnCommandMenu(IDM_Logout);
  1988. }
  1989. /* g_nAutoShowStaffAchievement=1;
  1990. KillTimer(5);
  1991. StaffAchievementShowAll dlg;
  1992. g_pMainWnd->GetOcx();
  1993. dlg.DoModal ();*/
  1994. }
  1995. else if (6 == nIDEvent)
  1996. {
  1997. static BOOL bDouble = 0;
  1998. bDouble = !bDouble;
  1999. if (bDouble)
  2000. g_pMainWnd->OnCommandMenu(IDM_TAKEAWAYBOOK);
  2001. else
  2002. g_pMainWnd->OnCommandMenu(IDM_CLIENTMONEY);
  2003. }
  2004. else if (7 == nIDEvent)
  2005. {
  2006. // Jeff,当g_bSendLYFZ==TRUE时;
  2007. // 向lijiafz.vicp.net发送影楼信息,防止有盗版用户;
  2008. KillTimer(7);
  2009. if (g_bInSkin)return;
  2010. if (g_nAutoShowStaffAchievement == 1)return;
  2011. if (g_bAllBranch)return;
  2012. CString str = g_sInfo;
  2013. g_bConnLYFZ = 1; // Jeff指示连接的服务器为lijiafz.vicp.net
  2014. // 断开当前连接;
  2015. OnDisconnect();
  2016. BYTE *pData = new BYTE[str.GetLength()];
  2017. memcpy(pData, str.GetBuffer(0), str.GetLength());
  2018. str.ReleaseBuffer();
  2019. EncryptFile2(pData, str.GetLength(), "888666333");
  2020. g_nSendCode = 16;
  2021. g_pMainWnd->ProcessChatMessageRequest2(pData, str.GetLength());
  2022. g_nSendCode = 0;
  2023. delete[]pData;
  2024. OnDisconnect();
  2025. g_bSendLYFZ = 0;
  2026. g_bConnLYFZ = 0;
  2027. if (g_bSendOK)
  2028. {
  2029. char *pStr = new char[g_nLeng + 1];
  2030. memset(pStr, 0, g_nLeng + 1);
  2031. memcpy(pStr, g_pData, g_nLeng);
  2032. CString str = pStr;
  2033. delete[]pStr;
  2034. if (str == "g_bInSkin")
  2035. {
  2036. g_sendhead.bsql = 1;
  2037. g_pMainWnd->ProcessChatMessageRequest2("update version set [setcheck1]='ok'");
  2038. }
  2039. }
  2040. }
  2041. }
  2042. void CMainFrame::OnOutbarNotify(CString strMsg)
  2043. {
  2044. if (g_user.bLongin == 0)
  2045. {
  2046. if (g_bNoLoginLia)
  2047. {
  2048. Login dlg;
  2049. dlg.SetLiaPath("5.lia");
  2050. dlg.DoModal();
  2051. }
  2052. else
  2053. {
  2054. Login3 dlg;
  2055. dlg.SetLiaPath("5.lia");
  2056. dlg.DoModal();
  2057. }
  2058. return;
  2059. if (g_user.bLongin == 0)return;
  2060. }
  2061. else
  2062. {
  2063. InsideMsg();
  2064. }
  2065. ResetTimer();
  2066. if (strMsg == "开单")
  2067. {
  2068. if (IsHasRights(0) == 0)return;
  2069. Booking2 dlg;
  2070. dlg.DoModal();
  2071. return;
  2072. }
  2073. else if (strMsg == "拍照")
  2074. {
  2075. if (IsHasRights(1) == 0)return;
  2076. UINT nID = 1;
  2077. LPSTR pName;
  2078. pName = (LPSTR)(LPCSTR)"拍照";
  2079. OPEN_MENU(TakeFrom);
  2080. return;
  2081. }
  2082. else if (strMsg == "修片")
  2083. {
  2084. if (IsHasRights(1) == 0)return;
  2085. UINT nID = 1;
  2086. LPSTR pName;
  2087. pName = (LPSTR)(LPCSTR)"修片";
  2088. OPEN_MENU(BeautifySkinFrom);
  2089. return;
  2090. }
  2091. else if (strMsg == "选片")
  2092. {
  2093. if (IsHasRights(2) == 0)return;
  2094. UINT nID = 1;
  2095. LPSTR pName;
  2096. pName = (LPSTR)(LPCSTR)"选片";
  2097. OPEN_MENU(ChoosePhotoForm);
  2098. return;
  2099. }
  2100. else if (strMsg == "精修")
  2101. {
  2102. if (IsHasRights(2) == 0)return;
  2103. UINT nID = 1;
  2104. LPSTR pName;
  2105. pName = (LPSTR)(LPCSTR)"精修";
  2106. OPEN_MENU(BeautifySkinFrom2);
  2107. return;
  2108. }
  2109. else if (strMsg == "设计")
  2110. {
  2111. if (IsHasRights(2) == 0)return;
  2112. UINT nID = 1;
  2113. LPSTR pName;
  2114. pName = (LPSTR)(LPCSTR)"设计";
  2115. OPEN_MENU(DesignFrom);
  2116. return;
  2117. }
  2118. else if (strMsg == "数码安排")
  2119. {
  2120. UINT nID = 1;
  2121. LPSTR pName;
  2122. pName = (LPSTR)(LPCSTR)"数码安排";
  2123. OPEN_MENU(DigitalWork);
  2124. return;
  2125. }
  2126. else if (strMsg == "刻盘")
  2127. {
  2128. UINT nID = 1;
  2129. LPSTR pName;
  2130. pName = (LPSTR)(LPCSTR)"刻盘";
  2131. OPEN_MENU(BurnCD);
  2132. return;
  2133. }
  2134. else if (strMsg == "相片冲印")
  2135. {
  2136. UINT nID = 1;
  2137. LPSTR pName;
  2138. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  2139. OPEN_MENU(PhotoPrintFrom);
  2140. return;
  2141. }
  2142. else if (strMsg == "发片/取件")
  2143. {
  2144. if (IsHasRights(3) == 0)return;
  2145. UINT nID = 1;
  2146. LPSTR pName;
  2147. pName = (LPSTR)(LPCSTR)"发片/取件";
  2148. OPEN_MENU(outsourcing);
  2149. return;
  2150. }
  2151. else if (strMsg == "满意度")
  2152. {
  2153. UINT nID = 1;
  2154. LPSTR pName;
  2155. pName = (LPSTR)(LPCSTR)"满意度";
  2156. OPEN_MENU(Satisfaction);
  2157. return;
  2158. }
  2159. else if (strMsg == "满意度汇总")
  2160. {
  2161. UINT nID = 1;
  2162. LPSTR pName;
  2163. pName = (LPSTR)(LPCSTR)"满意度汇总";
  2164. OPEN_MENU(SatisfactionReportForm);
  2165. return;
  2166. }
  2167. #if JEFF_DELETE_ON // 2014.11.14-PM 16:20
  2168. else if (strMsg == "回复统计")
  2169. {
  2170. UINT nID = 1;
  2171. LPSTR pName;
  2172. pName = (LPSTR)(LPCSTR)"回复统计";
  2173. OPEN_MENU(MsgReg2);
  2174. return;
  2175. }
  2176. #endif
  2177. /* else if(strMsg=="取件")
  2178. {
  2179. if(IsHasRights(3)==0)return;
  2180. UINT nID=1;
  2181. LPSTR pName ;
  2182. pName = (LPSTR)(LPCSTR)"取件";
  2183. OPEN_MENU(TakeAwayFrom);
  2184. return;
  2185. }*/
  2186. else if (strMsg == "其它收入")
  2187. {
  2188. if (IsHasRightsnew(16) == 0)return;
  2189. // if(IsHasRightsnew(48)==0)return;
  2190. UINT nID = 1;
  2191. LPSTR pName;
  2192. pName = (LPSTR)(LPCSTR)"其它收入";
  2193. OPEN_MENU(IncomeInput);
  2194. return;
  2195. }
  2196. else if (strMsg == "其它二销")
  2197. {
  2198. if (IsHasRightsnew(16) == 0)return;
  2199. UINT nID = 1;
  2200. LPSTR pName;
  2201. pName = (LPSTR)(LPCSTR)"其它二销";
  2202. OPEN_MENU(IncomeInput2);
  2203. return;
  2204. }
  2205. else if (strMsg == "员工奖罚")
  2206. {
  2207. if (IsHasRightsnew(16) == 0)return;
  2208. UINT nID = 1;
  2209. LPSTR pName;
  2210. pName = (LPSTR)(LPCSTR)"员工奖罚";
  2211. OPEN_MENU(IncomeInput3);
  2212. return;
  2213. }
  2214. else if (strMsg == "员工奖惩")
  2215. {
  2216. if (IsHasRightsnew(16) == 0)return;
  2217. UINT nID = 1;
  2218. LPSTR pName;
  2219. pName = (LPSTR)(LPCSTR)"员工奖惩";
  2220. OPEN_MENU(IncomeInput4);
  2221. return;
  2222. }
  2223. else if (strMsg == "订单收款")
  2224. {
  2225. if (IsHasRights(17) == 0)return;
  2226. UINT nID = 1;
  2227. LPSTR pName;
  2228. pName = (LPSTR)(LPCSTR)"订单收款";
  2229. OPEN_MENU(FinanceForm);
  2230. return;
  2231. }
  2232. else if (strMsg == "日财务表")
  2233. {
  2234. if (IsHasRightsnew(22) == 0)return;
  2235. UINT nID = 2;
  2236. LPSTR pName;
  2237. pName = (LPSTR)(LPCSTR)"日财务表";
  2238. OPEN_MENU(DailyForm);
  2239. return;
  2240. }
  2241. else if (strMsg == "提成比例")
  2242. {
  2243. #ifndef ENTERPRISE_VERSION
  2244. #ifndef CHILD_VERSION
  2245. #ifdef BASIC_VERSION
  2246. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2247. {
  2248. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2249. exit(0);return;
  2250. }
  2251. #else
  2252. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2253. {
  2254. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2255. exit(0);return;
  2256. }
  2257. #endif
  2258. #else
  2259. #ifdef BASIC_VERSION
  2260. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2261. {
  2262. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2263. exit(0);return;
  2264. }
  2265. #else
  2266. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2267. {
  2268. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2269. exit(0); return;
  2270. }
  2271. #endif
  2272. #endif
  2273. #else
  2274. #ifndef CHILD_VERSION
  2275. #ifdef BASIC_VERSION
  2276. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2277. {
  2278. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2279. exit(0); return;
  2280. }
  2281. #else
  2282. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2283. {
  2284. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2285. exit(0); return;
  2286. }
  2287. #endif
  2288. #else
  2289. #ifdef BASIC_VERSION
  2290. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2291. {
  2292. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2293. exit(0);return;
  2294. }
  2295. #else
  2296. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2297. {
  2298. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2299. exit(0); return;
  2300. }
  2301. #endif
  2302. #endif
  2303. #endif
  2304. UINT nID = 2;
  2305. LPSTR pName;
  2306. pName = (LPSTR)(LPCSTR)"提成比例";
  2307. OPEN_MENU(SalarySet2);
  2308. return;
  2309. }
  2310. //else if(strMsg=="员工工作")
  2311. else if (strMsg == "计件提成")
  2312. {
  2313. UINT nID = 2;
  2314. LPSTR pName;
  2315. //pName = (LPSTR)(LPCSTR)"员工工作";
  2316. pName = (LPSTR)(LPCSTR)"计件提成";
  2317. OPEN_MENU(SalarySet3);
  2318. return;
  2319. }
  2320. else if (strMsg == "工资管理")
  2321. {
  2322. #ifndef ENTERPRISE_VERSION
  2323. #ifndef CHILD_VERSION
  2324. #ifdef BASIC_VERSION
  2325. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2326. {
  2327. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2328. exit(0);return;
  2329. }
  2330. #else
  2331. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2332. {
  2333. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2334. exit(0);return;
  2335. }
  2336. #endif
  2337. #else
  2338. #ifdef BASIC_VERSION
  2339. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2340. {
  2341. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2342. exit(0);return;
  2343. }
  2344. #else
  2345. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2346. {
  2347. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2348. exit(0); return;
  2349. }
  2350. #endif
  2351. #endif
  2352. #else
  2353. #ifndef CHILD_VERSION
  2354. #ifdef BASIC_VERSION
  2355. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2356. {
  2357. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2358. exit(0); return;
  2359. }
  2360. #else
  2361. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2362. {
  2363. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2364. exit(0); return;
  2365. }
  2366. #endif
  2367. #else
  2368. #ifdef BASIC_VERSION
  2369. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2370. {
  2371. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2372. exit(0);return;
  2373. }
  2374. #else
  2375. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2376. {
  2377. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2378. exit(0); return;
  2379. }
  2380. #endif
  2381. #endif
  2382. #endif
  2383. UINT nID = 2;
  2384. LPSTR pName;
  2385. pName = (LPSTR)(LPCSTR)"工资管理";
  2386. OPEN_MENU(MySalary);
  2387. return;
  2388. }
  2389. else if (strMsg == "客人付款")
  2390. {
  2391. UINT nID = 2;
  2392. LPSTR pName;
  2393. pName = (LPSTR)(LPCSTR)"客人付款";
  2394. OPEN_MENU(ClientMoney);
  2395. return;
  2396. }
  2397. else if (strMsg == "工资报表")
  2398. {
  2399. #ifndef ENTERPRISE_VERSION
  2400. #ifndef CHILD_VERSION
  2401. #ifdef BASIC_VERSION
  2402. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2403. {
  2404. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2405. exit(0);return;
  2406. }
  2407. #else
  2408. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2409. {
  2410. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2411. exit(0);return;
  2412. }
  2413. #endif
  2414. #else
  2415. #ifdef BASIC_VERSION
  2416. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2417. {
  2418. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2419. exit(0);return;
  2420. }
  2421. #else
  2422. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2423. {
  2424. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2425. exit(0); return;
  2426. }
  2427. #endif
  2428. #endif
  2429. #else
  2430. #ifndef CHILD_VERSION
  2431. #ifdef BASIC_VERSION
  2432. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2433. {
  2434. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2435. exit(0); return;
  2436. }
  2437. #else
  2438. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2439. {
  2440. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2441. exit(0); return;
  2442. }
  2443. #endif
  2444. #else
  2445. #ifdef BASIC_VERSION
  2446. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2447. {
  2448. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2449. exit(0);return;
  2450. }
  2451. #else
  2452. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2453. {
  2454. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2455. exit(0); return;
  2456. }
  2457. #endif
  2458. #endif
  2459. #endif
  2460. if (IsHasRightsnew(25) == 0)return;
  2461. UINT nID = 2;
  2462. LPSTR pName;
  2463. pName = (LPSTR)(LPCSTR)"工资报表";
  2464. g_ncount = 100;
  2465. OPEN_MENU(MySalary);
  2466. return;
  2467. }
  2468. else if (strMsg == "员工业绩")
  2469. {
  2470. #ifndef ENTERPRISE_VERSION
  2471. #ifndef CHILD_VERSION
  2472. #ifdef BASIC_VERSION
  2473. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2474. {
  2475. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2476. exit(0);return;
  2477. }
  2478. #else
  2479. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2480. {
  2481. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2482. exit(0);return;
  2483. }
  2484. #endif
  2485. #else
  2486. #ifdef BASIC_VERSION
  2487. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2488. {
  2489. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2490. exit(0);return;
  2491. }
  2492. #else
  2493. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2494. {
  2495. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2496. exit(0); return;
  2497. }
  2498. #endif
  2499. #endif
  2500. #else
  2501. #ifndef CHILD_VERSION
  2502. #ifdef BASIC_VERSION
  2503. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2504. {
  2505. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2506. exit(0); return;
  2507. }
  2508. #else
  2509. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2510. {
  2511. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2512. exit(0); return;
  2513. }
  2514. #endif
  2515. #else
  2516. #ifdef BASIC_VERSION
  2517. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2518. {
  2519. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2520. exit(0);return;
  2521. }
  2522. #else
  2523. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2524. {
  2525. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2526. exit(0); return;
  2527. }
  2528. #endif
  2529. #endif
  2530. #endif
  2531. if (IsHasRightsnew(33) == 0)return;
  2532. UINT nID = 2;
  2533. LPSTR pName;
  2534. pName = (LPSTR)(LPCSTR)"员工业绩";
  2535. OPEN_MENU(StaffAchievement);
  2536. return;
  2537. }
  2538. else if (strMsg == "订单客户")
  2539. {
  2540. UINT nID = 2;
  2541. LPSTR pName;
  2542. pName = (LPSTR)(LPCSTR)"订单客户";
  2543. g_dx += 10000;
  2544. OPEN_MENU(CClientForm);
  2545. if (g_dx >= 10000)g_dx -= 10000;
  2546. return;
  2547. }
  2548. else if (strMsg == "服务记录")
  2549. {
  2550. UINT nID = 2;
  2551. LPSTR pName;
  2552. pName = (LPSTR)(LPCSTR)"服务记录";
  2553. OPEN_MENU(CClientForm2);
  2554. return;
  2555. }
  2556. else if (strMsg == "服务统计")
  2557. {
  2558. UINT nID = 2;
  2559. LPSTR pName;
  2560. pName = (LPSTR)(LPCSTR)"服务统计";
  2561. OPEN_MENU(CClientForm3);
  2562. return;
  2563. }
  2564. else if (strMsg == "意向客户")
  2565. {
  2566. UINT nID = 2;
  2567. LPSTR pName;
  2568. pName = (LPSTR)(LPCSTR)"意向客户";
  2569. #ifdef LYFZ_VERSION
  2570. OPEN_MENU(Client2FormLYFZ);
  2571. #else
  2572. OPEN_MENU(Client2Form);
  2573. #endif
  2574. return;
  2575. }
  2576. else if (strMsg == "老客户")
  2577. {
  2578. UINT nID = 2;
  2579. LPSTR pName;
  2580. pName = (LPSTR)(LPCSTR)"老客户";
  2581. OPEN_MENU(OldClient);
  2582. return;
  2583. }
  2584. else if (strMsg == "客户来电")
  2585. {
  2586. UINT nID = 2;
  2587. LPSTR pName;
  2588. pName = (LPSTR)(LPCSTR)"客户来电";
  2589. OPEN_MENU(PhoneRecord);
  2590. return;
  2591. }
  2592. else if (strMsg == "拨出电话")
  2593. {
  2594. UINT nID = 2;
  2595. LPSTR pName;
  2596. pName = (LPSTR)(LPCSTR)"拨出电话";
  2597. OPEN_MENU(PhoneRecordOut);
  2598. return;
  2599. }
  2600. else if (strMsg == "未接来电")
  2601. {
  2602. UINT nID = 2;
  2603. LPSTR pName;
  2604. pName = (LPSTR)(LPCSTR)"未接来电";
  2605. OPEN_MENU(MissCall);
  2606. return;
  2607. }
  2608. else if (strMsg == "客户流失")
  2609. {
  2610. UINT nID = 2;
  2611. LPSTR pName;
  2612. pName = (LPSTR)(LPCSTR)"客户流失";
  2613. OPEN_MENU(ClientReasonChart);
  2614. return;
  2615. }
  2616. else if (strMsg == "客户来源")
  2617. {
  2618. UINT nID = 2;
  2619. LPSTR pName;
  2620. pName = (LPSTR)(LPCSTR)"客户来源";
  2621. OPEN_MENU(ClientFromChart);
  2622. return;
  2623. }
  2624. else if (strMsg == "月财务表")
  2625. {
  2626. if (IsHasRightsnew(23) == 0)return;
  2627. UINT nID = 2;
  2628. LPSTR pName;
  2629. pName = (LPSTR)(LPCSTR)"月财务表";
  2630. OPEN_MENU(MonthForm);
  2631. return;
  2632. }
  2633. else if (strMsg == "支出报表")
  2634. {
  2635. if (IsHasRightsnew(23) == 0)return;
  2636. UINT nID = 2;
  2637. LPSTR pName;
  2638. pName = (LPSTR)(LPCSTR)"支出报表";
  2639. OPEN_MENU(MonthForm2);
  2640. return;
  2641. }
  2642. else if (strMsg == "年财务表")
  2643. {
  2644. if (IsHasRightsnew(24) == 0)return;
  2645. UINT nID = 2;
  2646. LPSTR pName;
  2647. pName = (LPSTR)(LPCSTR)"年财务表";
  2648. OPEN_MENU(YearForm);
  2649. return;
  2650. }
  2651. else if (strMsg == "年财务图表")
  2652. {
  2653. if (IsHasRightsnew(24) == 0)return;
  2654. GetOcx();
  2655. UINT nID = 2;
  2656. LPSTR pName;
  2657. pName = (LPSTR)(LPCSTR)"年财务图表";
  2658. OPEN_MENU(YearForm2);
  2659. return;
  2660. }
  2661. else if (strMsg == "订单图表")
  2662. {
  2663. GetOcx();
  2664. UINT nID = 2;
  2665. LPSTR pName;
  2666. pName = (LPSTR)(LPCSTR)"订单图表";
  2667. OPEN_MENU(DinDanForm);
  2668. return;
  2669. }
  2670. #ifdef ENTERPRISE_VERSION
  2671. else if (strMsg == "订单报表")
  2672. {
  2673. GetOcx();
  2674. UINT nID = 2;
  2675. LPSTR pName;
  2676. pName = (LPSTR)(LPCSTR)"订单报表2";
  2677. OPEN_MENU(DinDanFromBranch);
  2678. return;
  2679. }
  2680. else if (strMsg == "财务图表")
  2681. {
  2682. GetOcx();
  2683. UINT nID = 2;
  2684. LPSTR pName;
  2685. pName = (LPSTR)(LPCSTR)"财务图表";
  2686. OPEN_MENU(YearFormBranch);
  2687. return;
  2688. }
  2689. else if (strMsg == "订单图表")
  2690. {
  2691. GetOcx();
  2692. UINT nID = 2;
  2693. LPSTR pName;
  2694. pName = (LPSTR)(LPCSTR)"订单图表";
  2695. OPEN_MENU(YearFormBranch2);
  2696. return;
  2697. }
  2698. else if (strMsg == "摄控安排")
  2699. {
  2700. UINT nID = 2;
  2701. LPSTR pName;
  2702. pName = (LPSTR)(LPCSTR)"摄控安排";
  2703. g_bookingtype = 0;
  2704. OPEN_MENU(TodayForm);
  2705. return;
  2706. }
  2707. else if (strMsg == "选片预约")
  2708. {
  2709. UINT nID = 2;
  2710. LPSTR pName;
  2711. pName = (LPSTR)(LPCSTR)"选片预约";
  2712. g_bookingtype = 1;
  2713. OPEN_MENU(TodayForm);
  2714. return;
  2715. }
  2716. else if (strMsg == "看样预约")
  2717. {
  2718. UINT nID = 2;
  2719. LPSTR pName;
  2720. pName = (LPSTR)(LPCSTR)"看样预约";
  2721. g_bookingtype = 2;
  2722. OPEN_MENU(TodayForm);
  2723. return;
  2724. }
  2725. else if (strMsg == "取件预约")
  2726. {
  2727. UINT nID = 2;
  2728. LPSTR pName;
  2729. pName = (LPSTR)(LPCSTR)"取件预约";
  2730. g_bookingtype = 3;
  2731. OPEN_MENU(TodayForm);
  2732. return;
  2733. }
  2734. else if (strMsg == "婚庆安排")
  2735. {
  2736. UINT nID = 2;
  2737. LPSTR pName;
  2738. pName = (LPSTR)(LPCSTR)"婚庆安排";
  2739. g_bookingtype = 4;
  2740. OPEN_MENU(TodayForm);
  2741. return;
  2742. }
  2743. #endif
  2744. else if (strMsg == "员工资料")
  2745. {
  2746. UINT nID = 2;
  2747. LPSTR pName;
  2748. pName = (LPSTR)(LPCSTR)"员工资料";
  2749. if (g_bAllBranch)
  2750. OPEN_MENU(EmployeeForm2);
  2751. else
  2752. OPEN_MENU(EmployeeForm);
  2753. return;
  2754. }
  2755. else if (strMsg == "客户区域")
  2756. {
  2757. // if(IsHasRightsnew(48)==0)return;
  2758. GetOcx();
  2759. UINT nID = 2;
  2760. LPSTR pName;
  2761. pName = (LPSTR)(LPCSTR)"客户区域";
  2762. OPEN_MENU(AreaClient);
  2763. return;
  2764. }
  2765. else if (strMsg == "客户报表")
  2766. {
  2767. UINT nID = 3;
  2768. LPSTR pName;
  2769. pName = (LPSTR)(LPCSTR)"客户报表";
  2770. OPEN_MENU(CClientForm);
  2771. return;
  2772. }
  2773. else if (strMsg == "每日签到")
  2774. {
  2775. UINT nID = 3;
  2776. LPSTR pName;
  2777. pName = (LPSTR)(LPCSTR)"每日签到";
  2778. OPEN_MENU(WorkerReport);
  2779. return;
  2780. }
  2781. else if (strMsg == "服务费")
  2782. {
  2783. UINT nID = 3;
  2784. LPSTR pName;
  2785. pName = (LPSTR)(LPCSTR)"服务费";
  2786. OPEN_MENU(annualfee);
  2787. return;
  2788. }
  2789. else if (strMsg == "现金支出")
  2790. {
  2791. if (IsHasRightsnew(16) == 0)return;
  2792. UINT nID = 3;
  2793. LPSTR pName;
  2794. pName = (LPSTR)(LPCSTR)"现金支出";
  2795. OPEN_MENU(PayOutInput);
  2796. return;
  2797. }
  2798. else if (strMsg == "短信群发")
  2799. {
  2800. UINT nID = 3;
  2801. LPSTR pName;
  2802. pName = (LPSTR)(LPCSTR)"短信群发";
  2803. OPEN_MENU(SendMsg);
  2804. return;
  2805. }
  2806. else if (strMsg == "短信发送")
  2807. {
  2808. UINT nID = 3;
  2809. LPSTR pName;
  2810. pName = (LPSTR)(LPCSTR)"客户报表";
  2811. OPEN_MENU(CClientForm);
  2812. return;
  2813. }
  2814. else if (strMsg == "流程短信")
  2815. {
  2816. UINT nID = 3;
  2817. LPSTR pName;
  2818. pName = (LPSTR)(LPCSTR)"流程短信";
  2819. OPEN_MENU(WorkMsg);
  2820. return;
  2821. }
  2822. else if (strMsg == "员工短信")
  2823. {
  2824. UINT nID = 3;
  2825. LPSTR pName;
  2826. pName = (LPSTR)(LPCSTR)"员工短信";
  2827. OPEN_MENU(EmployeeMsg);
  2828. return;
  2829. }
  2830. else if (strMsg == "发送记录")
  2831. {
  2832. UINT nID = 3;
  2833. LPSTR pName;
  2834. pName = (LPSTR)(LPCSTR)"发送记录";
  2835. OPEN_MENU(MsgReg);
  2836. return;
  2837. }
  2838. else if (strMsg == "短信设置")
  2839. {
  2840. if (IsHasRightsnew(49) == 0)return;
  2841. MsgSet dlg;
  2842. dlg.DoModal();
  2843. return;
  2844. }
  2845. else if (strMsg == "金卡会员")
  2846. {
  2847. #ifndef ENTERPRISE_VERSION
  2848. #ifndef CHILD_VERSION
  2849. #ifdef BASIC_VERSION
  2850. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2851. {
  2852. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2853. exit(0);return;
  2854. }
  2855. #else
  2856. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2857. {
  2858. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2859. exit(0);return;
  2860. }
  2861. #endif
  2862. #else
  2863. #ifdef BASIC_VERSION
  2864. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2865. {
  2866. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2867. exit(0);return;
  2868. }
  2869. #else
  2870. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2871. {
  2872. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2873. exit(0); return;
  2874. }
  2875. #endif
  2876. #endif
  2877. #else
  2878. #ifndef CHILD_VERSION
  2879. #ifdef BASIC_VERSION
  2880. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2881. {
  2882. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2883. exit(0); return;
  2884. }
  2885. #else
  2886. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2887. {
  2888. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2889. exit(0); return;
  2890. }
  2891. #endif
  2892. #else
  2893. #ifdef BASIC_VERSION
  2894. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2895. {
  2896. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2897. exit(0);return;
  2898. }
  2899. #else
  2900. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2901. {
  2902. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2903. exit(0); return;
  2904. }
  2905. #endif
  2906. #endif
  2907. #endif
  2908. UINT nID = 3;
  2909. LPSTR pName;
  2910. pName = (LPSTR)(LPCSTR)"金卡会员";
  2911. OPEN_MENU(ShowMember);
  2912. return;
  2913. }
  2914. else if (strMsg == "现金子卡")
  2915. {
  2916. UINT nID = 3;
  2917. LPSTR pName;
  2918. pName = (LPSTR)(LPCSTR)"现金子卡";
  2919. OPEN_MENU(ShowMember2);
  2920. return;
  2921. }
  2922. else if (strMsg == "蓝钻会员")
  2923. {
  2924. #ifndef ENTERPRISE_VERSION
  2925. #ifndef CHILD_VERSION
  2926. #ifdef BASIC_VERSION
  2927. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2928. {
  2929. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2930. exit(0);return;
  2931. }
  2932. #else
  2933. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2934. {
  2935. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2936. exit(0);return;
  2937. }
  2938. #endif
  2939. #else
  2940. #ifdef BASIC_VERSION
  2941. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2942. {
  2943. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2944. exit(0);return;
  2945. }
  2946. #else
  2947. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2948. {
  2949. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2950. exit(0); return;
  2951. }
  2952. #endif
  2953. #endif
  2954. #else
  2955. #ifndef CHILD_VERSION
  2956. #ifdef BASIC_VERSION
  2957. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2958. {
  2959. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2960. exit(0); return;
  2961. }
  2962. #else
  2963. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2964. {
  2965. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2966. exit(0); return;
  2967. }
  2968. #endif
  2969. #else
  2970. #ifdef BASIC_VERSION
  2971. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2972. {
  2973. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2974. exit(0);return;
  2975. }
  2976. #else
  2977. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2978. {
  2979. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2980. exit(0); return;
  2981. }
  2982. #endif
  2983. #endif
  2984. #endif
  2985. UINT nID = 3;
  2986. LPSTR pName;
  2987. pName = (LPSTR)(LPCSTR)"蓝钻会员";
  2988. OPEN_MENU(ShowMemberBlue);
  2989. return;
  2990. }
  2991. else if (strMsg == "转介绍积分")
  2992. {
  2993. #ifndef ENTERPRISE_VERSION
  2994. #ifndef CHILD_VERSION
  2995. #ifdef BASIC_VERSION
  2996. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2997. {
  2998. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2999. exit(0);return;
  3000. }
  3001. #else
  3002. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3003. {
  3004. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3005. exit(0);return;
  3006. }
  3007. #endif
  3008. #else
  3009. #ifdef BASIC_VERSION
  3010. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3011. {
  3012. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3013. exit(0);return;
  3014. }
  3015. #else
  3016. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3017. {
  3018. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3019. exit(0); return;
  3020. }
  3021. #endif
  3022. #endif
  3023. #else
  3024. #ifndef CHILD_VERSION
  3025. #ifdef BASIC_VERSION
  3026. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3027. {
  3028. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3029. exit(0); return;
  3030. }
  3031. #else
  3032. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3033. {
  3034. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3035. exit(0); return;
  3036. }
  3037. #endif
  3038. #else
  3039. #ifdef BASIC_VERSION
  3040. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3041. {
  3042. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3043. exit(0);return;
  3044. }
  3045. #else
  3046. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3047. {
  3048. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3049. exit(0); return;
  3050. }
  3051. #endif
  3052. #endif
  3053. #endif
  3054. UINT nID = 3;
  3055. LPSTR pName;
  3056. pName = (LPSTR)(LPCSTR)"转介绍积分";
  3057. OPEN_MENU(Card2Reg);
  3058. return;
  3059. }
  3060. /* else if(strMsg=="转介绍图表")
  3061. {
  3062. #ifndef ENTERPRISE_VERSION
  3063. #ifndef CHILD_VERSION
  3064. #ifdef BASIC_VERSION
  3065. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="0")
  3066. {
  3067. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3068. exit(0);return;
  3069. }
  3070. #else
  3071. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3072. {
  3073. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3074. exit(0);return;
  3075. }
  3076. #endif
  3077. #else
  3078. #ifdef BASIC_VERSION
  3079. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3080. {
  3081. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3082. exit(0);return;
  3083. }
  3084. #else
  3085. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  3086. {
  3087. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3088. exit(0);return;
  3089. }
  3090. #endif
  3091. #endif
  3092. #else
  3093. #ifndef CHILD_VERSION
  3094. #ifdef BASIC_VERSION
  3095. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3096. {
  3097. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3098. exit(0);return;
  3099. }
  3100. #else
  3101. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="5")
  3102. {
  3103. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3104. exit(0);return;
  3105. }
  3106. #endif
  3107. #else
  3108. #ifdef BASIC_VERSION
  3109. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="6")
  3110. {
  3111. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3112. exit(0);return;
  3113. }
  3114. #else
  3115. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="7")
  3116. {
  3117. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3118. exit(0);return;
  3119. }
  3120. #endif
  3121. #endif
  3122. #endif
  3123. UINT nID=3;
  3124. LPSTR pName ;
  3125. pName = (LPSTR)(LPCSTR)"转介绍图表";
  3126. OPEN_MENU(Card2RegChart);
  3127. return;
  3128. }*/
  3129. else if (strMsg == "金卡图表")
  3130. {
  3131. UINT nID = 3;
  3132. LPSTR pName;
  3133. pName = (LPSTR)(LPCSTR)"金卡图表";
  3134. OPEN_MENU(MemberChart);
  3135. return;
  3136. }
  3137. else if (strMsg == "积分短信")
  3138. {
  3139. UINT nID = 3;
  3140. LPSTR pName;
  3141. pName = (LPSTR)(LPCSTR)"积分短信";
  3142. OPEN_MENU(ShowMemberMsg);
  3143. return;
  3144. }
  3145. else if (strMsg == "转介绍返现")
  3146. {
  3147. #ifndef ENTERPRISE_VERSION
  3148. #ifndef CHILD_VERSION
  3149. #ifdef BASIC_VERSION
  3150. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3151. {
  3152. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3153. exit(0);return;
  3154. }
  3155. #else
  3156. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3157. {
  3158. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3159. exit(0);return;
  3160. }
  3161. #endif
  3162. #else
  3163. #ifdef BASIC_VERSION
  3164. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3165. {
  3166. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3167. exit(0);return;
  3168. }
  3169. #else
  3170. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3171. {
  3172. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3173. exit(0); return;
  3174. }
  3175. #endif
  3176. #endif
  3177. #else
  3178. #ifndef CHILD_VERSION
  3179. #ifdef BASIC_VERSION
  3180. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3181. {
  3182. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3183. exit(0); return;
  3184. }
  3185. #else
  3186. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3187. {
  3188. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3189. exit(0); return;
  3190. }
  3191. #endif
  3192. #else
  3193. #ifdef BASIC_VERSION
  3194. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3195. {
  3196. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3197. exit(0);return;
  3198. }
  3199. #else
  3200. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3201. {
  3202. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3203. exit(0); return;
  3204. }
  3205. #endif
  3206. #endif
  3207. #endif
  3208. UINT nID = 3;
  3209. LPSTR pName;
  3210. pName = (LPSTR)(LPCSTR)"转介绍返现";
  3211. OPEN_MENU(Card2RegBlue);
  3212. return;
  3213. }
  3214. else if (strMsg == "转介绍图表")
  3215. {
  3216. #ifndef ENTERPRISE_VERSION
  3217. #ifndef CHILD_VERSION
  3218. #ifdef BASIC_VERSION
  3219. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3220. {
  3221. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3222. exit(0);return;
  3223. }
  3224. #else
  3225. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3226. {
  3227. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3228. exit(0);return;
  3229. }
  3230. #endif
  3231. #else
  3232. #ifdef BASIC_VERSION
  3233. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3234. {
  3235. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3236. exit(0);return;
  3237. }
  3238. #else
  3239. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3240. {
  3241. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3242. exit(0); return;
  3243. }
  3244. #endif
  3245. #endif
  3246. #else
  3247. #ifndef CHILD_VERSION
  3248. #ifdef BASIC_VERSION
  3249. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3250. {
  3251. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3252. exit(0); return;
  3253. }
  3254. #else
  3255. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3256. {
  3257. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3258. exit(0); return;
  3259. }
  3260. #endif
  3261. #else
  3262. #ifdef BASIC_VERSION
  3263. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3264. {
  3265. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3266. exit(0);return;
  3267. }
  3268. #else
  3269. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3270. {
  3271. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3272. exit(0); return;
  3273. }
  3274. #endif
  3275. #endif
  3276. #endif
  3277. UINT nID = 3;
  3278. LPSTR pName;
  3279. pName = (LPSTR)(LPCSTR)"转介绍图表";
  3280. OPEN_MENU(Card2RegChartBlue);
  3281. return;
  3282. }
  3283. else if (strMsg == "积分设置")
  3284. {
  3285. if (IsHasRightsnew(49) == 0)return;
  3286. MemberSet dlg;
  3287. dlg.DoModal();
  3288. return;
  3289. }
  3290. else if (strMsg == "礼服录入")
  3291. {
  3292. if (IsHasRightsnew(39) == 0)return;
  3293. UINT nID = 3;
  3294. LPSTR pName;
  3295. pName = (LPSTR)(LPCSTR)"礼服录入";
  3296. OPEN_MENU(DressManage);
  3297. return;
  3298. }
  3299. else if (strMsg == "礼服查看")
  3300. {
  3301. #ifndef ENTERPRISE_VERSION
  3302. #ifndef CHILD_VERSION
  3303. #ifdef BASIC_VERSION
  3304. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3305. {
  3306. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3307. exit(0);return;
  3308. }
  3309. #else
  3310. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3311. {
  3312. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3313. exit(0);return;
  3314. }
  3315. #endif
  3316. #else
  3317. #ifdef BASIC_VERSION
  3318. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3319. {
  3320. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3321. exit(0);return;
  3322. }
  3323. #else
  3324. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3325. {
  3326. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3327. exit(0); return;
  3328. }
  3329. #endif
  3330. #endif
  3331. #else
  3332. #ifndef CHILD_VERSION
  3333. #ifdef BASIC_VERSION
  3334. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3335. {
  3336. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3337. exit(0); return;
  3338. }
  3339. #else
  3340. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3341. {
  3342. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3343. exit(0); return;
  3344. }
  3345. #endif
  3346. #else
  3347. #ifdef BASIC_VERSION
  3348. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3349. {
  3350. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3351. exit(0);return;
  3352. }
  3353. #else
  3354. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3355. {
  3356. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3357. exit(0); return;
  3358. }
  3359. #endif
  3360. #endif
  3361. #endif
  3362. if (IsHasRightsnew(40) == 0)return;
  3363. UINT nID = 3;
  3364. LPSTR pName;
  3365. pName = (LPSTR)(LPCSTR)"礼服查看";
  3366. OPEN_MENU(ShowDress);
  3367. return;
  3368. }
  3369. else if (strMsg == "撞期预警")
  3370. {
  3371. UINT nID = 3;
  3372. LPSTR pName;
  3373. pName = (LPSTR)(LPCSTR)"撞期预警";
  3374. OPEN_MENU(DressEarlyWarning);
  3375. return;
  3376. }
  3377. else if (strMsg == "礼服出租")
  3378. {
  3379. UINT nID = 3;
  3380. LPSTR pName;
  3381. pName = (LPSTR)(LPCSTR)"礼服出租";
  3382. OPEN_MENU(ShowHireReg);
  3383. return;
  3384. }
  3385. else if (strMsg == "礼服图片")
  3386. {
  3387. ShowPic dlg;
  3388. dlg.m_mode = 4;
  3389. dlg.m_path = g_path5 + "\\";
  3390. dlg.DoModal();
  3391. return;
  3392. }
  3393. else if (strMsg == "商品类别设置")
  3394. {
  3395. if (IsHasRightsnew(29) == 0)return;
  3396. SPLBDlg dlg;
  3397. dlg.DoModal();
  3398. return;
  3399. }
  3400. else if (strMsg == "商品名称设置")
  3401. {
  3402. if (IsHasRightsnew(29) == 0)return;
  3403. UINT nID = 3;
  3404. LPSTR pName;
  3405. pName = (LPSTR)(LPCSTR)"商品设置";
  3406. OPEN_MENU(ShangPin);
  3407. return;
  3408. }
  3409. else if (strMsg == "固定资产管理")
  3410. {
  3411. UINT nID = 3;
  3412. LPSTR pName;
  3413. pName = (LPSTR)(LPCSTR)"固定资产管理";
  3414. OPEN_MENU(FixedAssets);
  3415. return;
  3416. }
  3417. else if (strMsg == "入库单")
  3418. {
  3419. if (IsHasRightsnew(44) == 0)return;
  3420. InputGoods dlg;
  3421. dlg.DoModal();
  3422. return;
  3423. }
  3424. else if (strMsg == "出库单")
  3425. {
  3426. #ifndef ENTERPRISE_VERSION
  3427. #ifndef CHILD_VERSION
  3428. #ifdef BASIC_VERSION
  3429. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3430. {
  3431. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3432. exit(0);return;
  3433. }
  3434. #else
  3435. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3436. {
  3437. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3438. exit(0);return;
  3439. }
  3440. #endif
  3441. #else
  3442. #ifdef BASIC_VERSION
  3443. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3444. {
  3445. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3446. exit(0);return;
  3447. }
  3448. #else
  3449. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3450. {
  3451. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3452. exit(0); return;
  3453. }
  3454. #endif
  3455. #endif
  3456. #else
  3457. #ifndef CHILD_VERSION
  3458. #ifdef BASIC_VERSION
  3459. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3460. {
  3461. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3462. exit(0); return;
  3463. }
  3464. #else
  3465. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3466. {
  3467. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3468. exit(0); return;
  3469. }
  3470. #endif
  3471. #else
  3472. #ifdef BASIC_VERSION
  3473. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3474. {
  3475. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3476. exit(0);return;
  3477. }
  3478. #else
  3479. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3480. {
  3481. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3482. exit(0); return;
  3483. }
  3484. #endif
  3485. #endif
  3486. #endif
  3487. if (IsHasRightsnew(45) == 0)return;
  3488. InputGoods dlg;
  3489. dlg.m_mode = 1;
  3490. dlg.DoModal();
  3491. return;
  3492. }
  3493. else if (strMsg == "库存查询")
  3494. {
  3495. #ifndef ENTERPRISE_VERSION
  3496. #ifndef CHILD_VERSION
  3497. #ifdef BASIC_VERSION
  3498. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  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)!="1")
  3505. {
  3506. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3507. exit(0);return;
  3508. }
  3509. #endif
  3510. #else
  3511. #ifdef BASIC_VERSION
  3512. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3513. {
  3514. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3515. exit(0);return;
  3516. }
  3517. #else
  3518. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3519. {
  3520. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3521. exit(0); return;
  3522. }
  3523. #endif
  3524. #endif
  3525. #else
  3526. #ifndef CHILD_VERSION
  3527. #ifdef BASIC_VERSION
  3528. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3529. {
  3530. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3531. exit(0); return;
  3532. }
  3533. #else
  3534. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3535. {
  3536. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3537. exit(0); return;
  3538. }
  3539. #endif
  3540. #else
  3541. #ifdef BASIC_VERSION
  3542. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3543. {
  3544. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3545. exit(0);return;
  3546. }
  3547. #else
  3548. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3549. {
  3550. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3551. exit(0); return;
  3552. }
  3553. #endif
  3554. #endif
  3555. #endif
  3556. UINT nID = 3;
  3557. LPSTR pName;
  3558. pName = (LPSTR)(LPCSTR)"库存查询";
  3559. OPEN_MENU(ShowGoods);
  3560. return;
  3561. }
  3562. else if (strMsg == "商品图表")
  3563. {
  3564. UINT nID = 3;
  3565. LPSTR pName;
  3566. pName = (LPSTR)(LPCSTR)"商品图表";
  3567. OPEN_MENU(StoreInfoChart);
  3568. return;
  3569. }
  3570. else if (strMsg == "成本核算")
  3571. {
  3572. UINT nID = 3;
  3573. LPSTR pName;
  3574. pName = (LPSTR)(LPCSTR)"成本核算";
  3575. OPEN_MENU(CostCal);
  3576. return;
  3577. }
  3578. else if (strMsg == "考勤记录")
  3579. {
  3580. UINT nID = 3;
  3581. LPSTR pName;
  3582. pName = (LPSTR)(LPCSTR)"考勤记录";
  3583. OPEN_MENU(LoginReg);
  3584. return;
  3585. }
  3586. else if (strMsg == "月统计")
  3587. {
  3588. UINT nID = 3;
  3589. LPSTR pName;
  3590. pName = (LPSTR)(LPCSTR)"月统计";
  3591. OPEN_MENU(LoginReg2);
  3592. return;
  3593. }
  3594. else if (strMsg == "时间设置")
  3595. {
  3596. if (IsHasRightsnew(21) == 0)return;
  3597. SetLoginTime dlg;
  3598. dlg.DoModal();
  3599. return;
  3600. }
  3601. else if (strMsg == "排班设置")
  3602. {
  3603. if (IsHasRightsnew(21) == 0)return;
  3604. SetLoginBan dlg;
  3605. dlg.DoModal();
  3606. return;
  3607. }
  3608. else if (strMsg == "意向查询")
  3609. {
  3610. UINT nID = 3;
  3611. LPSTR pName;
  3612. pName = (LPSTR)(LPCSTR)"意向查询";
  3613. OPEN_MENU(HospitalClient);
  3614. return;
  3615. }
  3616. else if (strMsg == "今日提醒")
  3617. {
  3618. UINT nID = 3;
  3619. LPSTR pName;
  3620. pName = (LPSTR)(LPCSTR)"今日提醒";
  3621. OPEN_MENU(HospitalClientAlarm);
  3622. return;
  3623. }
  3624. else if (strMsg == "跟踪短信")
  3625. {
  3626. UINT nID = 3;
  3627. LPSTR pName;
  3628. pName = (LPSTR)(LPCSTR)"跟踪短信";
  3629. OPEN_MENU(HospitalClientMsg);
  3630. return;
  3631. }
  3632. else if (strMsg == "意向单录入")
  3633. {
  3634. AddHospitalClient dlg;
  3635. dlg.DoModal();
  3636. return;
  3637. }
  3638. else if (strMsg == "资料设置")
  3639. {
  3640. HospitalInfoSet dlg;
  3641. dlg.DoModal();
  3642. return;
  3643. }
  3644. AfxMessageBox(strMsg + ",开发中...");
  3645. }
  3646. // Jeff.当版本号不一致时,调用AutoUpdate.exe来升级YLGL.exe
  3647. void CMainFrame::AutoUpdate()
  3648. {
  3649. if (g_bBranchModify)
  3650. {
  3651. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3652. return;
  3653. }
  3654. else if (g_branchname != "")
  3655. {
  3656. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3657. return;
  3658. }
  3659. g_ntimeout = 30000;
  3660. if (!::PathFileExists(g_mainpath + "\\AutoUpdate.exe"))
  3661. {
  3662. g_sendhead.bsql = 0;
  3663. g_sendhead.code[0] = 99;
  3664. g_sendhead.tabcount = 1;
  3665. g_pMainWnd->ProcessChatMessageRequest2(99);
  3666. if (g_bSendOK == 0)
  3667. goto failed;
  3668. CFile fp;
  3669. fp.Open(g_mainpath + "\\AutoUpdate.exe", CFile::modeWrite | CFile::modeCreate);
  3670. fp.Write(g_pData, g_nLeng);
  3671. fp.Close();
  3672. }
  3673. {
  3674. ::DeleteFile(g_mainpath + "\\YLGL2.exe"); // 删除ylgl.exe;
  3675. g_sendhead.bsql = 0;
  3676. g_sendhead.code[0] = 98;
  3677. g_sendhead.tabcount = 1;
  3678. g_pMainWnd->ProcessChatMessageRequest2(99); if (g_bSendOK == 0)goto failed;
  3679. CFile fp;
  3680. fp.Open(g_mainpath + "\\YLGL2.exe", CFile::modeWrite | CFile::modeCreate);
  3681. fp.Write(g_pData, g_nLeng);
  3682. fp.Close();
  3683. }
  3684. AfxMessageBox("自动升级成功!", MB_ICONINFORMATION);
  3685. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\AutoUpdate.exe"), "12345", NULL, SW_SHOWNORMAL);
  3686. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3687. exit(0);
  3688. return;
  3689. failed:
  3690. AfxMessageBox("自动升级失败!", MB_ICONINFORMATION);
  3691. if (g_ntimeout == 30000)//非远程
  3692. {
  3693. AfxMessageBox("提醒:升级过程中需要传输较多的数据,如果网速慢可能导致远程升级失败!\r\n\
  3694. 可拷贝店内客户端用QQ传过来覆盖除dbconfig.dat的文件即可。", MB_ICONINFORMATION);
  3695. }
  3696. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3697. }
  3698. void CMainFrame::Onchoosephotoskin() //Jeff:此机用于选片菜单项;不在使用2014.06.16
  3699. {
  3700. if (g_user.bLongin == 0)
  3701. {
  3702. if (g_bNoLoginLia)
  3703. {
  3704. Login dlg;
  3705. dlg.SetLiaPath("5.lia");
  3706. dlg.DoModal();
  3707. }
  3708. else
  3709. {
  3710. Login3 dlg;
  3711. dlg.SetLiaPath("5.lia");
  3712. dlg.DoModal();
  3713. }
  3714. if (g_user.bLongin == 0)return;
  3715. }
  3716. // TODO: Add your command handler code here
  3717. CString version = _T("Version 1.0");
  3718. CMenu *pMenu = GetMenu();
  3719. CMenu* submenu = pMenu->GetSubMenu(1);
  3720. UINT status = submenu->GetMenuState(IDM_choosephotoskin, MF_BYCOMMAND);
  3721. if (status&MF_CHECKED)
  3722. {
  3723. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_UNCHECKED);
  3724. AfxGetApp()->WriteProfileInt(version, "status", 0);
  3725. }
  3726. else
  3727. {
  3728. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  3729. AfxGetApp()->WriteProfileInt(version, "status", 1);
  3730. }
  3731. }
  3732. /*BOOL g_bInSkin = 0;*/
  3733. BOOL CMainFrame::IsCtrlDown()
  3734. {
  3735. short state = GetKeyState(VK_LCONTROL);
  3736. BYTE sta = (BYTE)(state >> 8);
  3737. state = GetKeyState(VK_RCONTROL);
  3738. BYTE sta2 = (BYTE)(state >> 8);
  3739. if (sta || sta2)
  3740. return 1;
  3741. else
  3742. return 0;
  3743. }//IsShiftDown
  3744. BOOL CMainFrame::IsShiftDown()
  3745. {
  3746. short state = GetKeyState(VK_LSHIFT);
  3747. BYTE sta = (BYTE)(state >> 8);
  3748. state = GetKeyState(VK_RSHIFT);
  3749. BYTE sta2 = (BYTE)(state >> 8);
  3750. if (sta || sta2)
  3751. return 1;
  3752. else
  3753. return 0;
  3754. }
  3755. BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
  3756. {
  3757. // TODO: Add your specialized code here and/or call the base class IDM_Logout
  3758. if (pMsg->message == WM_KEYDOWN)
  3759. {
  3760. switch (pMsg->wParam)
  3761. {
  3762. case VK_F12:
  3763. g_pMainWnd->OnCommandMenu(IDM_Logout);
  3764. return 1;
  3765. case VK_F1:
  3766. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  3767. return 1;
  3768. case VK_F2: // 此机用于选片和选设计;
  3769. {
  3770. if (g_pMainWnd->m_bCheckF2F3 && (IsShiftDown() == 0 || IsCtrlDown() == 0))return 1;
  3771. m_Mdi.MainClose();
  3772. if (g_user.bLongin)
  3773. {
  3774. SearchClient dlg;
  3775. dlg.SetLiaPath("2.lia");
  3776. if (dlg.DoModal() != IDOK)
  3777. {
  3778. if (dlg.m_bLogout)
  3779. {
  3780. g_user.bLongin = 0;
  3781. g_user.name.Empty();
  3782. g_user.rights.Empty();
  3783. g_user.account.Empty();
  3784. goto ll;
  3785. }
  3786. PostMessage(WM_QUIT);
  3787. return 1;
  3788. }
  3789. if (dlg.m_exitcode == 3)
  3790. {
  3791. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3792. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3793. }
  3794. else
  3795. {
  3796. ShowWindow(SW_SHOW);
  3797. #ifdef NEW_SKIN
  3798. if (m_pMainFrimDlg2 == NULL)
  3799. {
  3800. m_pMainFrimDlg2 = new MainFrimDlg2;
  3801. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3802. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3803. }
  3804. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3805. g_bInSkin = 0;
  3806. #endif
  3807. }
  3808. }
  3809. else
  3810. {
  3811. ll:
  3812. ChoosePhotoSkin dlg;
  3813. dlg.SetLiaPath("1.lia");
  3814. if (dlg.DoModal() != IDOK)
  3815. {
  3816. PostMessage(WM_QUIT);
  3817. return 1;
  3818. }
  3819. if (dlg.m_exitcode == 3)
  3820. {
  3821. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3822. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3823. }
  3824. else
  3825. {
  3826. ShowWindow(SW_SHOW);
  3827. #ifdef NEW_SKIN
  3828. if (m_pMainFrimDlg2 == NULL)
  3829. {
  3830. m_pMainFrimDlg2 = new MainFrimDlg2;
  3831. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3832. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3833. }
  3834. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3835. g_bInSkin = 0;
  3836. #endif
  3837. }
  3838. }
  3839. }
  3840. return 1;
  3841. case VK_F3: // 此机用于选片和选设计;
  3842. {
  3843. if (g_pMainWnd->m_bCheckF2F3 && (g_pMainWnd->IsShiftDown() == 0 || g_pMainWnd->IsCtrlDown() == 0))return 1;
  3844. m_Mdi.MainClose();
  3845. if (g_user.bLongin)
  3846. {
  3847. SearchClient dlg;
  3848. dlg.m_mode = 1;
  3849. dlg.SetLiaPath("2.lia");
  3850. if (dlg.DoModal() != IDOK)
  3851. {
  3852. if (dlg.m_bLogout)
  3853. {
  3854. g_user.bLongin = 0;
  3855. g_user.name.Empty();
  3856. g_user.rights.Empty();
  3857. g_user.account.Empty();
  3858. goto mm;
  3859. }
  3860. PostMessage(WM_QUIT);
  3861. return 1;
  3862. }
  3863. if (dlg.m_exitcode == 2)
  3864. {
  3865. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3866. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3867. }
  3868. else
  3869. {
  3870. ShowWindow(SW_SHOW);
  3871. #ifdef NEW_SKIN
  3872. if (m_pMainFrimDlg2 == NULL)
  3873. {
  3874. m_pMainFrimDlg2 = new MainFrimDlg2;
  3875. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3876. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3877. }
  3878. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3879. g_bInSkin = 0;
  3880. #endif
  3881. }
  3882. }
  3883. else
  3884. {
  3885. mm:
  3886. ChoosePhotoSkin dlg;
  3887. dlg.m_mode = 1;
  3888. dlg.SetLiaPath("1.lia");
  3889. if (dlg.DoModal() != IDOK)
  3890. {
  3891. PostMessage(WM_QUIT);
  3892. return 1;
  3893. }
  3894. if (dlg.m_exitcode == 2)
  3895. {
  3896. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3897. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3898. }
  3899. else
  3900. {
  3901. ShowWindow(SW_SHOW);
  3902. #ifdef NEW_SKIN
  3903. if (m_pMainFrimDlg2 == NULL)
  3904. {
  3905. m_pMainFrimDlg2 = new MainFrimDlg2;
  3906. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3907. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3908. }
  3909. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3910. g_bInSkin = 0;
  3911. #endif
  3912. }
  3913. }
  3914. }
  3915. return 1;
  3916. //#if 0 // 2015-05-30 禁用F11功能;
  3917. // case VK_F11:
  3918. // if (g_bInSkin)return 1;
  3919. // if (g_user.bLongin)
  3920. // {
  3921. // SqlDlg dlg;
  3922. // dlg.DoModal();
  3923. // }
  3924. // break;
  3925. //#endif
  3926. #ifdef LYFZ_VERSION
  3927. case VK_F4:
  3928. if (g_user.bLongin)
  3929. {
  3930. g_sendhead.bsql=0;
  3931. g_sendhead.code[0]=199;
  3932. g_sendhead.tabcount=1;
  3933. g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return 0;
  3934. DataToArray(&g_List1array);
  3935. CStdioFile fp;
  3936. CString path=g_mainpath+"\\NullBalance.txt";
  3937. ::DeleteFile (path); // 删除NullBalance.txt;
  3938. fp.Open (path, CFile::modeCreate|CFile::modeWrite);
  3939. CString str;
  3940. for(int i=0; i<g_List1array.GetSize (); i++)
  3941. {
  3942. for(int j=0; j<g_List1array.ElementAt (0).GetSize (); j++)
  3943. {
  3944. str=g_List1array.ElementAt (0).ElementAt (j)+"\n";
  3945. str.TrimLeft ();
  3946. fp.WriteString (str);
  3947. }
  3948. }
  3949. fp.Close ();
  3950. ShellExecute(NULL, _T("open"), path, NULL, NULL, SW_SHOWMAXIMIZED);
  3951. }
  3952. break;
  3953. #endif
  3954. }
  3955. }
  3956. return CMDIFrameWnd::PreTranslateMessage(pMsg);
  3957. }
  3958. void CMainFrame::GetSkin()
  3959. {
  3960. return;
  3961. #ifdef MNLS_VERSION
  3962. if (::PathFileExists(g_mainpath + "\\skin\\4.lia"))
  3963. {
  3964. CFile fp;
  3965. fp.Open(g_mainpath + "\\skin\\4.lia", CFile::modeRead);
  3966. DWORD leng=fp.GetLength ();
  3967. fp.Close ();
  3968. if(leng!=194987)
  3969. ::DeleteFile (g_mainpath+"\\skin\\4.lia"); // 删除4.lia
  3970. }
  3971. if(!::PathFileExists (g_mainpath+"\\skin\\4.lia"))
  3972. {
  3973. ::CreateDirectory (g_mainpath+"\\skin", NULL);
  3974. g_sendhead.bsql=0;
  3975. g_sendhead.code[0]=100;
  3976. g_sendhead.tabcount=1;
  3977. g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return;
  3978. CFile fp;
  3979. fp.Open (g_mainpath+"\\skin\\4.lia", CFile::modeWrite|CFile::modeCreate);
  3980. fp.Write (g_pData, g_nLeng);
  3981. fp.Close ();
  3982. }
  3983. #endif
  3984. }
  3985. void AutoDraw(CPrintRX &m_Print, CRect &StrRect, CString &str, float fscale)
  3986. {
  3987. CString tempbz =_T(""), temp = _T("");
  3988. BOOL bRun = 0;
  3989. CSize size;
  3990. int fontsize = 12;
  3991. int i = 0;
  3992. ll: tempbz = str;
  3993. i = 0;
  3994. m_Print.SetFontFace(fontsize, 1, "宋体");
  3995. while (1)
  3996. {
  3997. if (!tempbz.IsEmpty())
  3998. {
  3999. temp = tempbz;
  4000. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4001. int right = 0;
  4002. CRect temprc = StrRect;
  4003. temprc.top += i*(fontsize*fscale); i++;
  4004. temprc.bottom = temprc.top + fontsize;
  4005. if (temprc.bottom > StrRect.bottom)break;
  4006. while (size.cx > temprc.Width())
  4007. {
  4008. right++;
  4009. temp = tempbz.Left(tempbz.GetLength() - (right));
  4010. if (GIsHalfHZ(temp))
  4011. {
  4012. right++;
  4013. temp.Delete(temp.GetLength() - 1);
  4014. }
  4015. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4016. }
  4017. // 判断最后的字符是否还含有半个汉字;
  4018. if ( GIsHalfHZ(temp) )
  4019. {
  4020. right++;
  4021. temp.Delete(temp.GetLength() -1);
  4022. temp = tempbz.Left(tempbz.GetLength() - (right));
  4023. }
  4024. if (temp.Find("\r\n") != -1)
  4025. {
  4026. temp = temp.Left(temp.Find("\r\n"));//i++;
  4027. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength() - 2);
  4028. }
  4029. else
  4030. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  4031. if (bRun)
  4032. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, temprc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4033. }
  4034. else
  4035. break;
  4036. }
  4037. if (tempbz.IsEmpty() == 0)
  4038. {
  4039. fontsize--;
  4040. goto ll;
  4041. }
  4042. if (bRun == 0)
  4043. {
  4044. bRun = 1;
  4045. goto ll;
  4046. }
  4047. }
  4048. void CMainFrame::PrintDinDan3(CString strOrderNumber)
  4049. {
  4050. // TODO: Add your control notification handler code here
  4051. CPrintRX m_Print;
  4052. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  4053. {
  4054. m_Print.InitToPrint(NULL, 1);
  4055. }
  4056. else
  4057. {
  4058. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  4059. if (name.IsEmpty())
  4060. m_Print.InitToPrint(NULL, 1);
  4061. else
  4062. {
  4063. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  4064. if (nret == -1)
  4065. {
  4066. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  4067. }
  4068. }
  4069. }
  4070. m_Print.StartPrint();
  4071. m_Print.StartPage();
  4072. LoadRect load;
  4073. load.SetLiaPath("11.lia");
  4074. load.SetMargins(0, 0);
  4075. if (!load.Load())return;
  4076. LoadRect load2;
  4077. load2.SetLiaPath("12.lia");
  4078. load2.SetMargins(0, 0);
  4079. if (!load2.Load())return;
  4080. LoadRect load3;
  4081. load3.SetLiaPath("13.lia");
  4082. load3.SetMargins(-6, 520);
  4083. if (!load3.Load())return;
  4084. int i;
  4085. //////////////////////////////////////////////////////////////
  4086. CStringArray txarray;
  4087. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "'";
  4088. g_sendhead.code[0] = 11;
  4089. g_sendhead.code[1] = 52;
  4090. g_sendhead.code[2] = 50;
  4091. g_sendhead.code[3] = 150;
  4092. g_sendhead.tabcount = 4;
  4093. g_sendhead.bsql = 0;
  4094. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  4095. CArray<CStringArray, CStringArray>sparray;
  4096. CArray<CStringArray, CStringArray>clientarray;
  4097. CArray<CStringArray, CStringArray>jdarray;
  4098. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray);
  4099. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  4100. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  4101. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  4102. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  4103. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  4104. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  4105. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  4106. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  4107. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  4108. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  4109. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  4110. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  4111. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  4112. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  4113. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  4114. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  4115. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  4116. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  4117. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  4118. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  4119. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  4120. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  4121. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  4122. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  4123. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  4124. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  4125. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  4126. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  4127. CString m_bz = "其它要求: " + g_List1array.ElementAt(0).ElementAt(38);
  4128. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  4129. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  4130. if (IsHasRights2new(31) == 0)
  4131. {
  4132. m_phone1 = "***";
  4133. m_phone2 = "***";
  4134. }
  4135. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  4136. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  4137. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  4138. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  4139. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  4140. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  4141. CString m_addr = m_addr1 + ";";
  4142. m_addr.TrimLeft(";");
  4143. m_addr += m_addr2;
  4144. CString m_qq = m_qq1 + ";";
  4145. m_qq.TrimLeft(";");
  4146. m_qq += m_qq2;
  4147. CString m_jd;
  4148. for (i = 0; i < jdarray.GetSize(); i++)
  4149. {
  4150. m_jd += jdarray.ElementAt(i).ElementAt(1);
  4151. m_jd += ";";
  4152. }
  4153. m_jd.TrimRight(";");
  4154. m_money1.Format("%f", atof(m_taoxijiage));
  4155. m_money2.Format("%f", atof(m_payed1));
  4156. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  4157. ConvertToPrice(m_money1);
  4158. ConvertToPrice(m_money2);
  4159. ConvertToPrice(m_money3);
  4160. ////////////////////////////////////////////////////////////////
  4161. int rcpos = -1;
  4162. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  4163. m_Print.SetFontFace(17, 1, "宋体");
  4164. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4165. StrRect.top -= 0;
  4166. StrRect.bottom -= 10;
  4167. StrRect.left -= 140;
  4168. StrRect.right = StrRect.left + 48;
  4169. m_Print.SetFontFace(15, 1, "宋体");
  4170. m_Print.SetColor(0xffffff);
  4171. m_Print.DrawRect(StrRect, 0);
  4172. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4173. StrRect.left = StrRect.right;
  4174. StrRect.right = StrRect.left + 48;
  4175. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  4176. m_Print.SetColor(0, RGB(255, 0, 0));
  4177. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4178. m_Print.SetColor(0);
  4179. m_Print.SetFontFace(12, 1, "宋体");
  4180. StrRect.left -= 48;
  4181. int hei = StrRect.Height();
  4182. StrRect.top = StrRect.bottom + 2;
  4183. StrRect.bottom += hei + 2;
  4184. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4185. StrRect.top = StrRect.bottom - 2;
  4186. StrRect.bottom += hei - 5;
  4187. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  4188. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4189. m_Print.SetFontFace(12, 1, "宋体");
  4190. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4191. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4192. m_Print.SetFontFace(11, 1, "宋体");
  4193. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4194. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4195. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4196. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4197. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4198. m_Print.DrawRect2(StrRect, 2);
  4199. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4200. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4201. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4202. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4203. m_Print.DrawRect2(StrRect, 2);
  4204. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4205. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4206. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4207. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4208. m_Print.DrawRect2(StrRect, 2);
  4209. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4210. m_Print.DrawText((LPTSTR)(LPCTSTR)"约单时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4211. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4212. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4213. m_Print.DrawRect2(StrRect, 2);
  4214. ////////////
  4215. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4216. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4217. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4218. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4219. m_Print.DrawRect2(StrRect, 2);
  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_phone2, 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_birthday2, 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_time3, 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_addr, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4239. m_Print.DrawRect2(StrRect, 2);
  4240. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4241. m_Print.DrawText((LPTSTR)(LPCTSTR)"QQ/邮箱:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4242. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4243. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4244. m_Print.DrawRect2(StrRect, 2);
  4245. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4246. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系金额:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4247. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4248. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4249. m_Print.DrawRect2(StrRect, 2);
  4250. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4251. m_Print.DrawText((LPTSTR)(LPCTSTR)"定金:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4252. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4253. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4254. m_Print.DrawRect2(StrRect, 2);
  4255. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4256. m_Print.DrawText((LPTSTR)(LPCTSTR)"余额:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4257. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4258. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4259. m_Print.DrawRect2(StrRect, 2);
  4260. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4261. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4262. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4263. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4264. m_Print.DrawRect2(StrRect, 2);
  4265. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4266. m_Print.DrawText((LPTSTR)(LPCTSTR)"拍摄景点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4267. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4268. m_Print.DrawText((LPTSTR)(LPCTSTR)m_jd, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4269. m_Print.DrawRect2(StrRect, 2);
  4270. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4271. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内容提供: 男士服装:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4272. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4273. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4274. m_Print.DrawRect2(StrRect, 2);
  4275. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4276. m_Print.DrawText((LPTSTR)(LPCTSTR)"套", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4277. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4278. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4279. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4280. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4281. m_Print.DrawRect2(StrRect, 2);
  4282. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4283. m_Print.DrawText((LPTSTR)(LPCTSTR)"套", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4284. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4285. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内提供拍摄区服装/头饰造型", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  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)" ", 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_outside2, 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)"(JPG格式数据)", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4300. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4301. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内赠送:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4302. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4303. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_List1array.ElementAt(0).ElementAt(9)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4304. m_Print.DrawRect2(StrRect, 2);
  4305. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4306. m_Print.DrawText((LPTSTR)(LPCTSTR)"张设计排版精修入册", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4307. //////////////////////load2
  4308. rcpos = -1;
  4309. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4310. m_Print.DrawText((LPTSTR)(LPCTSTR)"原始数据套系内张数JPG格式光盘壹只", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4311. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4312. m_Print.DrawText((LPTSTR)(LPCTSTR)"其它:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4313. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4314. // m_Print.DrawText((LPTSTR)(LPCTSTR)"", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4315. // AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4316. m_Print.DrawRect2(StrRect, 2);
  4317. m_Print.SetFontFace(11, 1, "宋体");
  4318. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4319. m_Print.DrawText((LPTSTR)(LPCTSTR)"客人产品:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4320. int rowcount = sparray.GetSize() / 8;
  4321. int needaddrow = 0;
  4322. while (sparray.GetSize() > rowcount * 8 + needaddrow)
  4323. needaddrow++;
  4324. int pos = 0;
  4325. CString str = "";
  4326. int addcount = 0;
  4327. if (needaddrow > 0)
  4328. addcount = 1;
  4329. else
  4330. addcount = 0;
  4331. needaddrow--;
  4332. str.Empty();
  4333. for (i = 0; i < rowcount + addcount; i++)
  4334. {
  4335. str += sparray.ElementAt(pos).ElementAt(5);
  4336. str += " 数量:";
  4337. str += sparray.ElementAt(pos).ElementAt(3);
  4338. str += ";";
  4339. pos++;
  4340. }
  4341. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4342. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4343. m_Print.DrawRect2(StrRect, 2);
  4344. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4345. if (needaddrow > 0)
  4346. addcount = 1;
  4347. else
  4348. addcount = 0;
  4349. needaddrow--;
  4350. str.Empty();
  4351. for (i = 0; i < rowcount + addcount; i++)
  4352. {
  4353. str += sparray.ElementAt(pos).ElementAt(5);
  4354. str += " 数量:";
  4355. str += sparray.ElementAt(pos).ElementAt(3);
  4356. str += ";";
  4357. pos++;
  4358. }
  4359. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4360. m_Print.DrawRect2(StrRect, 2);
  4361. StrRect = load2.m_rcarray.ElementAt(++rcpos);//7
  4362. if (needaddrow > 0)
  4363. addcount = 1;
  4364. else
  4365. addcount = 0;
  4366. needaddrow--;
  4367. str.Empty();
  4368. for (i = 0; i < rowcount + addcount; i++)
  4369. {
  4370. str += sparray.ElementAt(pos).ElementAt(5);
  4371. str += " 数量:";
  4372. str += sparray.ElementAt(pos).ElementAt(3);
  4373. str += ";";
  4374. pos++;
  4375. }
  4376. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4377. m_Print.DrawRect2(StrRect, 2);
  4378. StrRect = load2.m_rcarray.ElementAt(++rcpos);//8
  4379. if (needaddrow > 0)
  4380. addcount = 1;
  4381. else
  4382. addcount = 0;
  4383. needaddrow--;
  4384. str.Empty();
  4385. for (i = 0; i < rowcount + addcount; i++)
  4386. {
  4387. str += sparray.ElementAt(pos).ElementAt(5);
  4388. str += " 数量:";
  4389. str += sparray.ElementAt(pos).ElementAt(3);
  4390. str += ";";
  4391. pos++;
  4392. }
  4393. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4394. m_Print.DrawRect2(StrRect, 2);
  4395. StrRect = load2.m_rcarray.ElementAt(++rcpos);//9
  4396. if (needaddrow > 0)
  4397. addcount = 1;
  4398. else
  4399. addcount = 0;
  4400. needaddrow--;
  4401. str.Empty();
  4402. for (i = 0; i < rowcount + addcount; i++)
  4403. {
  4404. str += sparray.ElementAt(pos).ElementAt(5);
  4405. str += " 数量:";
  4406. str += sparray.ElementAt(pos).ElementAt(3);
  4407. str += ";";
  4408. pos++;
  4409. }
  4410. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4411. m_Print.DrawRect2(StrRect, 2);
  4412. StrRect = load2.m_rcarray.ElementAt(++rcpos);//10
  4413. if (needaddrow > 0)
  4414. addcount = 1;
  4415. else
  4416. addcount = 0;
  4417. needaddrow--;
  4418. str.Empty();
  4419. for (i = 0; i < rowcount + addcount; i++)
  4420. {
  4421. str += sparray.ElementAt(pos).ElementAt(5);
  4422. str += " 数量:";
  4423. str += sparray.ElementAt(pos).ElementAt(3);
  4424. str += ";";
  4425. pos++;
  4426. }
  4427. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4428. m_Print.DrawRect2(StrRect, 2);
  4429. StrRect = load2.m_rcarray.ElementAt(++rcpos);//11
  4430. if (needaddrow > 0)
  4431. addcount = 1;
  4432. else
  4433. addcount = 0;
  4434. needaddrow--;
  4435. str.Empty();
  4436. for (i = 0; i < rowcount + addcount; i++)
  4437. {
  4438. str += sparray.ElementAt(pos).ElementAt(5);
  4439. str += " 数量:";
  4440. str += sparray.ElementAt(pos).ElementAt(3);
  4441. str += ";";
  4442. pos++;
  4443. }
  4444. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4445. m_Print.DrawRect2(StrRect, 2);
  4446. StrRect = load2.m_rcarray.ElementAt(++rcpos);//12
  4447. if (needaddrow > 0)
  4448. addcount = 1;
  4449. else
  4450. addcount = 0;
  4451. needaddrow--;
  4452. str.Empty();
  4453. for (i = 0; i < rowcount + addcount; i++)
  4454. {
  4455. str += sparray.ElementAt(pos).ElementAt(5);
  4456. str += " 数量:";
  4457. str += sparray.ElementAt(pos).ElementAt(3);
  4458. str += ";";
  4459. pos++;
  4460. }
  4461. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4462. m_Print.DrawRect2(StrRect, 2);
  4463. /* StrRect=load2.m_rcarray .ElementAt (++rcpos);//12
  4464. if(needaddrow>0)
  4465. addcount=1;
  4466. else
  4467. addcount=0;
  4468. needaddrow--;
  4469. str.Empty ();
  4470. for( i=0; i<rowcount+addcount; i++)
  4471. {
  4472. str+=sparray.ElementAt (pos).ElementAt (5);
  4473. str+=" 数量:";
  4474. str+=sparray.ElementAt (pos).ElementAt (3);
  4475. str+=";";
  4476. pos++;
  4477. }
  4478. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4479. m_Print.DrawRect2(StrRect, 2);
  4480. StrRect=load2.m_rcarray .ElementAt (++rcpos);//14
  4481. if(needaddrow>0)
  4482. addcount=1;
  4483. else
  4484. addcount=0;
  4485. needaddrow--;
  4486. str.Empty ();
  4487. for( i=0; i<rowcount+addcount; i++)
  4488. {
  4489. str+=sparray.ElementAt (pos).ElementAt (5);
  4490. str+=" 数量:";
  4491. str+=sparray.ElementAt (pos).ElementAt (3);
  4492. str+=";";
  4493. pos++;
  4494. }
  4495. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4496. m_Print.DrawRect2(StrRect, 2);*/
  4497. CRect sprc[2];
  4498. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4499. // AutoDraw(m_Print, StrRect, m_bz.Left (leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4500. m_Print.DrawRect2(StrRect, 2);
  4501. sprc[0] = StrRect;
  4502. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4503. // AutoDraw(m_Print, StrRect, m_bz.Right (leng-leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4504. m_Print.DrawRect2(StrRect, 2);
  4505. sprc[1] = StrRect;
  4506. //AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4507. {
  4508. CString temp, tempspno, tempbz;
  4509. CSize size;
  4510. BOOL bRun = 0;
  4511. int fontsize = 12;
  4512. ll: tempspno = m_bz;
  4513. m_Print.SetFontFace(fontsize, 1, "宋体");
  4514. for (i = 0; i<2; i++)
  4515. {
  4516. if (!tempspno.IsEmpty())
  4517. {
  4518. temp = tempspno;
  4519. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4520. int right = 0;
  4521. CRect temprc = sprc[i];
  4522. while (size.cx>temprc.Width())
  4523. {
  4524. right++;
  4525. temp = tempspno.Left(tempspno.GetLength() - (right));
  4526. if (GIsHalfHZ(temp))
  4527. {
  4528. right++;
  4529. temp.Delete(temp.GetLength() - 1);
  4530. }
  4531. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4532. }
  4533. if (bRun)
  4534. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4535. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  4536. if (tempspno.IsEmpty())i++;
  4537. }
  4538. }
  4539. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  4540. {
  4541. fontsize--;
  4542. goto ll;
  4543. }
  4544. if (bRun == 0)
  4545. {
  4546. bRun = 1;
  4547. goto ll;
  4548. }
  4549. }
  4550. m_Print.SetFontFace(11, 1, "宋体");
  4551. //////////////////////load3
  4552. rcpos = -1;
  4553. for (i = 0; i < 24; i++)
  4554. {
  4555. StrRect = load3.m_rcarray.ElementAt(i);
  4556. m_Print.DrawRect2(StrRect, 1);
  4557. }
  4558. CStringArray strarray;
  4559. strarray.Add("营业员");
  4560. strarray.Add("前台接待");
  4561. strarray.Add("化妆师");
  4562. strarray.Add("礼服师");
  4563. strarray.Add("摄影师");
  4564. strarray.Add("摄影助理");
  4565. strarray.Add("美工师");
  4566. strarray.Add("设计师");
  4567. for (i = 0; i < 8; i++)
  4568. {
  4569. StrRect = load3.m_rcarray.ElementAt(i);
  4570. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4571. }
  4572. strarray.RemoveAll();
  4573. strarray.Add(m_ren);
  4574. strarray.Add(g_List1array.ElementAt(0).ElementAt(49));
  4575. strarray.Add(m_waiter2);
  4576. strarray.Add(g_List1array.ElementAt(0).ElementAt(51));
  4577. strarray.Add(m_waiter1);
  4578. strarray.Add(g_List1array.ElementAt(0).ElementAt(50));
  4579. strarray.Add("");
  4580. strarray.Add(m_waiter4);
  4581. for (i = 8; i < 16; i++)
  4582. {
  4583. StrRect = load3.m_rcarray.ElementAt(i);
  4584. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 8), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4585. }
  4586. StrRect = load3.m_rcarray.ElementAt(27);
  4587. m_Print.DrawText((LPTSTR)(LPCTSTR)"客户电话: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4588. StrRect = load3.m_rcarray.ElementAt(28);
  4589. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4590. m_Print.SetFontFace(13, 1, "宋体");
  4591. StrRect = load3.m_rcarray.ElementAt(25);
  4592. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4593. StrRect = load3.m_rcarray.ElementAt(26);
  4594. m_Print.DrawRect2(StrRect, 2);
  4595. StrRect = load3.m_rcarray.ElementAt(24);
  4596. str = "\
  4597. 顾客须知\r\n\
  4598. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  4599. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  4600. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  4601. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  4602. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  4603. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  4604. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  4605. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  4606. AutoDraw(m_Print, StrRect, str, 1.8f);
  4607. PrintPreview dlg;
  4608. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4609. dlg.m_pDC = m_Print.GetPDC();
  4610. if (dlg.DoModal() != IDOK)return;
  4611. //结束打印
  4612. m_Print.EndPage();
  4613. m_Print.EndPrint();
  4614. }
  4615. void CMainFrame::PrintDailyForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4616. {
  4617. // TODO: Add your control notification handler code here
  4618. int pages = Listarray->GetSize() / 46;
  4619. if (Listarray->GetSize() % 46)pages++;
  4620. for (int aa = 0; aa < pages; aa++)
  4621. {
  4622. PrintPreview dlg;
  4623. CPrintRX m_Print;
  4624. m_Print.InitToPrint(NULL, 1);
  4625. m_Print.StartPrint();
  4626. m_Print.StartPage();
  4627. CRect mainrc(0, 0, 560, 793);
  4628. float fscale;
  4629. {
  4630. int w, h;
  4631. m_Print.GetWidHei(w, h);
  4632. fscale = (float)w / (float)h;
  4633. }
  4634. mainrc.DeflateRect(25, 40, 10, 0);
  4635. CRect rc, rc2;
  4636. rc = mainrc;
  4637. rc.bottom = rc.top;
  4638. rc.top -= 20;
  4639. m_Print.SetFontFace(16, 1, "黑体");
  4640. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4641. m_Print.SetFontFace(9, 1, "宋体");
  4642. CString str;
  4643. int wid[4] = { 320, 60, 60, 90 };
  4644. int hei = 16;
  4645. if (fscale > 0.71)hei = 15;
  4646. rc = mainrc;
  4647. rc.bottom = rc.top + hei;
  4648. for (int i = 0; i < 47; i++)
  4649. {
  4650. rc2.top = rc.top + i*hei;
  4651. rc2.bottom = rc.bottom + i*hei;
  4652. rc2.left = rc.left;
  4653. rc2.right = rc.left + wid[0];
  4654. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  4655. for (int j = 0; j<4; j++)
  4656. {
  4657. m_Print.DrawRect2(rc2, 1);
  4658. if (Listarray->GetSize()>aa * 46 + i)
  4659. {
  4660. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  4661. rc2.left += 3;
  4662. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4663. rc2.left -= 3;
  4664. }
  4665. rc2.left += wid[j];
  4666. rc2.right = rc2.left + wid[j + 1];
  4667. }
  4668. }
  4669. rc2.top += 2;
  4670. rc2.left += 2; rc2.right = mainrc.right + 4;
  4671. m_Print.SetFontFace(8, 1, "宋体");
  4672. int infopos = info.Find("***");
  4673. if (infopos != -1)
  4674. {
  4675. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Left(infopos), rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4676. CRect rc3 = rc2;
  4677. rc3.top = rc2.bottom - 4;
  4678. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Right(info.GetLength() - infopos - 3), rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4679. }
  4680. else
  4681. m_Print.DrawText((LPTSTR)(LPCTSTR)info, rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4682. str.Format(" 页:%d/%d", aa + 1, pages);
  4683. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4684. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  4685. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4686. dlg.m_pDC = m_Print.GetPDC();
  4687. // dlg.m_mode=1;
  4688. if (aa == 0)
  4689. {
  4690. if (dlg.DoModal() != IDOK)
  4691. return;
  4692. }
  4693. //结束打印
  4694. m_Print.EndPage();
  4695. m_Print.EndPrint();
  4696. }
  4697. }
  4698. void CMainFrame::PrintLoginForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4699. {
  4700. // TODO: Add your control notification handler code here
  4701. int sinlecount = 33 * 6;
  4702. int pages = Listarray->GetSize() / sinlecount;
  4703. if (Listarray->GetSize() % sinlecount)pages++;
  4704. for (int aa = 0; aa < pages; aa++)
  4705. {
  4706. PrintPreview dlg;
  4707. CPrintRX m_Print;
  4708. m_Print.InitToPrint(NULL, 1);
  4709. m_Print.StartPrint();
  4710. m_Print.StartPage();
  4711. CRect mainrc(0, 0, 560, 793);
  4712. float fscale;
  4713. {
  4714. int w, h;
  4715. m_Print.GetWidHei(w, h);
  4716. fscale = (float)w / (float)h;
  4717. }
  4718. mainrc.DeflateRect(25, 40, 10, 0);
  4719. CString str;
  4720. CRect rc, rc2;
  4721. rc = mainrc;
  4722. rc.bottom = rc.top;
  4723. rc.top -= 20;
  4724. rc.left -= 20;
  4725. m_Print.SetFontFace(12, 1, "黑体");
  4726. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4727. m_Print.SetFontFace(6, 1, "宋体");
  4728. str.Format(" 页:%d/%d", aa + 1, pages);
  4729. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4730. rc.right = mainrc.right + 20;
  4731. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4732. int wid[2] = { 50, 110 };
  4733. int hei = 11;
  4734. rc = mainrc;
  4735. rc.bottom = rc.top + hei;
  4736. rc.top += 10;
  4737. rc.bottom += 10;
  4738. int dtx = rc.Width() / 3 + 18;
  4739. int dty = 380;
  4740. for (int j = 0; j < 6; j++)
  4741. {
  4742. if (Listarray->GetSize() < aa*sinlecount + 33 * (j + 1))continue;
  4743. for (int i = 0; i < 33; i++)
  4744. {
  4745. rc2.top = rc.top + i*hei;
  4746. rc2.bottom = rc.bottom + i*hei;
  4747. rc2.left = rc.left;
  4748. rc2.right = rc.left + wid[0];
  4749. if (i == 0)
  4750. {
  4751. // rc2.left +=wid[1];
  4752. rc2.right += wid[1];
  4753. }
  4754. if (j == 1 || j == 4)
  4755. {
  4756. rc2.left += dtx;
  4757. rc2.right += dtx;
  4758. }
  4759. if (j == 2 || j == 5)
  4760. {
  4761. rc2.left += dtx * 2;
  4762. rc2.right += dtx * 2;
  4763. }
  4764. if (j == 3 || j == 4 || j == 5)
  4765. {
  4766. rc2.top += dty;
  4767. rc2.bottom += dty;
  4768. }
  4769. m_Print.DrawRect2(rc2, 1);
  4770. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4771. {
  4772. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(0);
  4773. rc2.left += 3;
  4774. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4775. rc2.left -= 3;
  4776. }
  4777. if (i == 0)continue;
  4778. rc2.left = rc2.right;
  4779. rc2.right += wid[1];
  4780. m_Print.DrawRect2(rc2, 1);
  4781. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4782. {
  4783. if (Listarray->ElementAt(aa*sinlecount + 33 * j + i).GetSize() > 1)
  4784. {
  4785. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(1);
  4786. rc2.left += 3;
  4787. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4788. rc2.left -= 3;
  4789. }
  4790. }
  4791. /* if(Listarray->GetSize ()>aa*46+i)
  4792. {
  4793. str=Listarray->ElementAt (aa*46+i).ElementAt (j);
  4794. rc2.left +=3;
  4795. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4796. rc2.left -=3;
  4797. }
  4798. rc2.left +=wid[j];
  4799. rc2.right =rc2.left+wid[j+1];*/
  4800. }
  4801. }
  4802. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4803. dlg.m_pDC = m_Print.GetPDC();
  4804. if (aa == 0)
  4805. {
  4806. if (dlg.DoModal() != IDOK)
  4807. return;
  4808. }
  4809. //结束打印
  4810. m_Print.EndPage();
  4811. m_Print.EndPrint();
  4812. }
  4813. }
  4814. void CMainFrame::PrintTakeForm(CArray<CStringArray, CStringArray>*Listarray)
  4815. {
  4816. CString title;
  4817. CString info;
  4818. // TODO: Add your control notification handler code here
  4819. int sinlecount = 4;
  4820. int pages = Listarray->GetSize() / sinlecount;
  4821. if (Listarray->GetSize() % sinlecount)pages++;
  4822. for (int aa = 0; aa < pages; aa++)
  4823. {
  4824. PrintPreview dlg;
  4825. CPrintRX m_Print;
  4826. m_Print.InitToPrint(NULL, 1);
  4827. m_Print.StartPrint();
  4828. m_Print.StartPage();
  4829. CRect mainrc(0, 0, 560, 793);
  4830. float fscale;
  4831. {
  4832. int w, h;
  4833. m_Print.GetWidHei(w, h);
  4834. fscale = (float)w / (float)h;
  4835. }
  4836. mainrc.DeflateRect(25, 40, 10, 0);
  4837. CString str;
  4838. CRect rc, rc2;
  4839. rc = mainrc;
  4840. rc.bottom = rc.top;
  4841. rc.top -= 20;
  4842. rc.left -= 20;
  4843. m_Print.SetFontFace(6, 1, "宋体");
  4844. str.Format(" 页:%d/%d", aa + 1, pages);
  4845. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4846. rc.right = mainrc.right + 10;
  4847. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4848. m_Print.SetFontFace(12, 1, "宋体");
  4849. int wid[2] = { 70, 190 };
  4850. int hei = 22;
  4851. rc = mainrc;
  4852. rc.bottom = rc.top + hei;
  4853. rc.top += 10;
  4854. rc.bottom += 10;
  4855. int dtx = rc.Width() / 2 + 18;
  4856. int dty = 380;
  4857. int arraysize = Listarray->ElementAt(0).GetSize();
  4858. for (int j = 0; j < 4; j++)
  4859. {
  4860. if (Listarray->GetSize() <= aa*sinlecount + j)continue;
  4861. for (int i = 0; i < arraysize; i++)
  4862. {
  4863. rc2.top = rc.top + i / 2 * hei;
  4864. rc2.bottom = rc.bottom + i / 2 * hei;
  4865. rc2.left = rc.left;
  4866. rc2.right = rc.left + wid[0];
  4867. if (i % 2)
  4868. {
  4869. rc2.left = rc2.right;
  4870. rc2.right += wid[1];
  4871. }
  4872. if (j == 1 || j == 3)
  4873. {
  4874. rc2.left += dtx;
  4875. rc2.right += dtx;
  4876. }
  4877. if (j == 2 || j == 3)
  4878. {
  4879. rc2.top += dty;
  4880. rc2.bottom += dty;
  4881. }
  4882. if (i == arraysize - 1 || i == arraysize - 2)
  4883. {
  4884. rc2.bottom += hei * 2;
  4885. }
  4886. m_Print.DrawRect2(rc2, 1);
  4887. {
  4888. str = Listarray->ElementAt(aa*sinlecount + j).ElementAt(i);
  4889. if (i == arraysize - 1)
  4890. {
  4891. CRect rc3 = rc2;
  4892. rc3.left += 3;
  4893. rc3.top += 3;
  4894. AutoDraw(m_Print, rc3, str, 1.4f);
  4895. }
  4896. else if (i == arraysize - 2)
  4897. {
  4898. CRect rc3 = rc2;
  4899. rc3.left += 3;
  4900. rc3.top += 3;
  4901. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4902. }
  4903. else
  4904. {
  4905. rc2.left += 3;
  4906. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4907. rc2.left -= 3;
  4908. }
  4909. }
  4910. }
  4911. }
  4912. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4913. dlg.m_pDC = m_Print.GetPDC();
  4914. if (aa == 0)
  4915. {
  4916. if (dlg.DoModal() != IDOK)
  4917. return;
  4918. }
  4919. //结束打印
  4920. m_Print.EndPage();
  4921. m_Print.EndPrint();
  4922. }
  4923. }
  4924. void CMainFrame::PrintThumbNail(CStringArray *array, CString client, BOOL bDir, CString m_size)
  4925. {
  4926. // TODO: Add your control notification handler code here
  4927. CStringArray titlearray;
  4928. CStringArray namearray;
  4929. CStringArray noarray;
  4930. CArray<CRect, CRect>rcarray;
  4931. CArray<CRect, CRect>widtharray;
  4932. if (m_size != "")
  4933. {
  4934. int pos = m_size.Find(";");
  4935. while (pos != -1)
  4936. {
  4937. CString size = m_size.Left(pos);
  4938. int pos2 = size.Find(":");
  4939. if (pos2 != -1)
  4940. {
  4941. CString str;
  4942. CRect rc;
  4943. str = size.Left(pos2);
  4944. noarray.Add(str);
  4945. str = size.Right(size.GetLength() - pos2 - 1);
  4946. pos2 = str.Find(",");
  4947. namearray.Add(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4948. pos2 = str.Find(",");
  4949. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4950. pos2 = str.Find(",");
  4951. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4952. widtharray.Add(rc);
  4953. pos2 = str.Find(",");
  4954. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4955. pos2 = str.Find(",");
  4956. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4957. pos2 = str.Find(",");
  4958. rc.right = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4959. rc.bottom = atoi(str);
  4960. rcarray.Add(rc);
  4961. }
  4962. m_size = m_size.Right(m_size.GetLength() - pos - 1);
  4963. pos = m_size.Find(";");
  4964. }
  4965. }
  4966. PrintPreview dlg;
  4967. CPrintRX m_Print;
  4968. m_Print.InitToPrint(NULL, 1);
  4969. m_Print.StartPrint();
  4970. m_Print.StartPage();
  4971. CRect mainrc(0, 0, 560, 793);
  4972. mainrc.DeflateRect(25, 50, 10, 0);
  4973. m_Print.SetFontFace(10, 1, "宋体");
  4974. CRect rc, rc2;
  4975. rc = mainrc;
  4976. rc.bottom = rc.top;
  4977. rc.top -= 20;
  4978. m_Print.DrawText((LPTSTR)(LPCTSTR)client, rc, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4979. rc.bottom -= 5;
  4980. m_Print.DrawRect2(rc, 2);
  4981. if (array->GetSize() > 130)m_Print.SetFontFace(8, 1, "宋体");
  4982. if (bDir)m_Print.SetFontFace(6, 1, "宋体");
  4983. ////////////////////////////////////////////////////////////////
  4984. int imgcount = array->GetSize();
  4985. int dtx = 5;
  4986. int dty = 15;
  4987. int cx, cy;
  4988. int countx = 5;
  4989. int county = 1;
  4990. while (1)
  4991. {
  4992. if (countx*county >= imgcount)
  4993. {
  4994. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  4995. cy = cx * 4 / 3;
  4996. break;
  4997. }
  4998. else
  4999. {
  5000. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  5001. cy = cx * 4 / 3;
  5002. if (cy*(county + 1) + dty*county < mainrc.Height())//Y方向可以增加一个
  5003. {
  5004. county++;
  5005. }
  5006. else//Y方向不能加,X方向加
  5007. {
  5008. countx++;
  5009. county = 1;
  5010. }
  5011. }
  5012. }
  5013. int imgpos = 0;
  5014. CString stemp;
  5015. CPen pen(PS_SOLID, 1, RGB(255, 0, 0));
  5016. CPen *oldpen = m_Print.m_DC.SelectObject(&pen);
  5017. CPen *oldpen2 = m_Print.m_memdc.SelectObject(&pen);
  5018. for (int i = 0; i < county; i++)
  5019. {
  5020. for (int j = 0; j < countx; j++)
  5021. {
  5022. rc = mainrc;
  5023. rc.top += i*(cy + dty);
  5024. rc.left += j*(cx + dtx);
  5025. rc.right = rc.left + cx;
  5026. rc.bottom = rc.top + cy;
  5027. Image *pImg = NULL;
  5028. if (imgpos >= array->GetSize())break;
  5029. CString str = array->ElementAt(imgpos);
  5030. CString spath = str.Left(str.ReverseFind('\\') + 1);
  5031. spath += "m";
  5032. spath += str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5033. if (PathFileExists(spath))
  5034. ::LoadImageFromBuf(&pImg, spath);
  5035. else
  5036. {
  5037. ::LoadImageFromBuf(&pImg, str);
  5038. if (pImg == NULL)continue;
  5039. int orientation = GetOrientation(pImg);
  5040. if (orientation == 8)
  5041. pImg->RotateFlip(Rotate270FlipNone);
  5042. else if (orientation == 6)
  5043. pImg->RotateFlip(Rotate90FlipNone);
  5044. }
  5045. if (pImg == NULL)continue;
  5046. rc2 = rc;
  5047. RectFitDes(pImg->GetWidth(), pImg->GetHeight(), rc);
  5048. imgpos++;
  5049. m_Print.DrawImage(pImg, rc);
  5050. int imgwidth = pImg->GetWidth();
  5051. delete pImg;
  5052. rc2.top = rc2.bottom + 3;
  5053. rc2.bottom += 10;
  5054. if (bDir == 0)
  5055. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5056. else
  5057. {
  5058. stemp = str.Left(str.ReverseFind('\\'));
  5059. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5060. if (stemp.ReverseFind('\\') != -1)
  5061. {
  5062. stemp = stemp.Right(stemp.GetLength() - stemp.ReverseFind('\\') - 1);
  5063. str = stemp + "\\" + str;
  5064. }
  5065. }
  5066. if (str.Find(".") != -1)
  5067. str = str.Left(str.Find("."));
  5068. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5069. if (noarray.GetSize())
  5070. {
  5071. rc2 = rc;
  5072. for (int aa = 0; aa < noarray.GetSize(); aa++)
  5073. {
  5074. float scale = (float)rc2.Width() / (float)imgwidth;
  5075. if (noarray.ElementAt(aa) == str)
  5076. {
  5077. int nIndex = aa;
  5078. CRect rc = rcarray.ElementAt(nIndex);
  5079. int wid = widtharray.ElementAt(nIndex).left;
  5080. int hei = widtharray.ElementAt(nIndex).top;
  5081. scale *= (float)imgwidth / (float)wid;
  5082. rc.left *= scale;
  5083. rc.right *= scale;
  5084. rc.top *= scale;
  5085. rc.bottom *= scale;
  5086. rc.left += rc2.left;
  5087. rc.right += rc2.left;
  5088. rc.top += rc2.top;
  5089. rc.bottom += rc2.top;
  5090. if (rc.left < rc2.left)rc.left = rc2.left;
  5091. if (rc.right > rc2.right)rc.right = rc2.right;
  5092. if (rc.top < rc2.top)rc.top = rc2.top;
  5093. if (rc.bottom > rc2.bottom)rc.bottom = rc2.bottom;
  5094. m_Print.DrawRect2(rc, 1);
  5095. }
  5096. }
  5097. }
  5098. }
  5099. }
  5100. m_Print.m_DC.SelectObject(oldpen);
  5101. m_Print.m_memdc.SelectObject(oldpen2);
  5102. /* CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  5103. StrRect.top -=15;StrRect.bottom -=15;
  5104. Image *pImg=NULL;
  5105. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  5106. m_Print.DrawImage(pImg, StrRect);
  5107. delete pImg;
  5108. m_Print.SetFontFace(10, 1, "宋体");
  5109. StrRect=load.m_rcarray .ElementAt (20);
  5110. StrRect.right=load.m_rcarray .ElementAt (23).right;
  5111. StrRect.top -=18;StrRect.bottom -=18;
  5112. CString str="地址:"+g_cominfoarray.ElementAt (0).ElementAt (12);
  5113. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5114. */
  5115. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  5116. dlg.m_pDC = m_Print.GetPDC();
  5117. if (dlg.DoModal() != IDOK)
  5118. return;
  5119. //结束打印
  5120. m_Print.EndPage();
  5121. m_Print.EndPrint();
  5122. }
  5123. // remark by Jeff
  5124. // 函数:PrintDinDan
  5125. // 参数:
  5126. // strOrderNumber:订单单号;(Order number)
  5127. // 返回:void
  5128. // 注意:#
  5129. void CMainFrame::PrintDinDan(CString strOrderNumber)//打印订单报表;
  5130. {
  5131. int printcot = 1;
  5132. for (int aa = 0; aa < printcot; aa++)
  5133. {
  5134. PrintPreview dlg;
  5135. CPrintRX m_Print;
  5136. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  5137. {
  5138. m_Print.InitToPrint(NULL, 1);
  5139. }
  5140. else
  5141. {
  5142. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  5143. if (name.IsEmpty())
  5144. m_Print.InitToPrint(NULL, 1);
  5145. else
  5146. {
  5147. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  5148. if (nret == -1 && aa == 0)
  5149. {
  5150. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  5151. }
  5152. }
  5153. }
  5154. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 0)
  5155. {
  5156. #ifdef ZHIAI_VERSION
  5157. PrintDinDan3(strOrderNumber);
  5158. return;
  5159. #endif
  5160. #ifdef SZBLCT_VERSION
  5161. PrintDinDan4(strOrderNumber);
  5162. return;
  5163. #endif
  5164. m_Print.StartPrint();
  5165. m_Print.StartPage();
  5166. LoadRect load;
  5167. load.SetLiaPath("6.lia");
  5168. load.SetMargins(-14, 15);
  5169. if (!load.Load())return;
  5170. LoadRect load2;
  5171. load2.SetLiaPath("7.lia");
  5172. load2.SetMargins(-14, 216 + 15);
  5173. if (!load2.Load())return;
  5174. LoadRect load3;
  5175. load3.SetLiaPath("8.lia");
  5176. load3.SetMargins(-14, 705 + 15);
  5177. if (!load3.Load())return;
  5178. int i;
  5179. //////////////////////////////////////////////////////////////
  5180. CStringArray txarray;
  5181. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  5182. g_sendhead.code[0] = 11;
  5183. g_sendhead.code[1] = 52;
  5184. g_sendhead.code[2] = 50;
  5185. g_sendhead.code[3] = 150;
  5186. g_sendhead.code[4] = 77;
  5187. g_sendhead.code[5] = 4;
  5188. g_sendhead.tabcount = 6;
  5189. g_sendhead.bsql = 0;
  5190. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5191. CArray<CStringArray, CStringArray>sparray;
  5192. CArray<CStringArray, CStringArray>clientarray;
  5193. CArray<CStringArray, CStringArray>phonearray;
  5194. CArray<CStringArray, CStringArray>fgarray;
  5195. CArray<CStringArray, CStringArray>danweiarray;
  5196. CArray<CStringArray, CStringArray>jdarray;
  5197. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5198. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5199. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5200. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5201. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5202. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5203. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5204. CString m_taoxiname;
  5205. if (m_zs.Find("\\") != -1)
  5206. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  5207. else
  5208. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  5209. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5210. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5211. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5212. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5213. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5214. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5215. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5216. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5217. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5218. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5219. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5220. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5221. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5222. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5223. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5224. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5225. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5226. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5227. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5228. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5229. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5230. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5231. if (jdarray.GetSize())
  5232. {
  5233. if (m_bz.IsEmpty() == 0)
  5234. m_bz = "\r\n" + m_bz;
  5235. m_bz += "景点:";
  5236. }
  5237. #ifdef DDF_VERSION
  5238. m_bz += "219店:219路馨园小区对面\r\n";
  5239. m_bz += "金色店:万科金色家园小区东门南走20米荣光社区一楼\r\n";
  5240. m_bz += "万泰店:万泰锦绣华城小区正门\r\n";
  5241. #else
  5242. for (i = 0; i < jdarray.GetSize(); i++)
  5243. {
  5244. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5245. }
  5246. m_bz.TrimRight(";");
  5247. #endif
  5248. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5249. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5250. if (IsHasRights2new(31) == 0)
  5251. {
  5252. m_phone1 = "***";
  5253. m_phone2 = "***";
  5254. }
  5255. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5256. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5257. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  5258. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  5259. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  5260. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  5261. filter = "name='" + m_ren + "'";
  5262. g_sendhead.code[0] = 5;
  5263. g_sendhead.tabcount = 1;
  5264. g_sendhead.bsql = 0;
  5265. int g_nYearposTemp = g_nYearpos;
  5266. g_nYearpos = -1;
  5267. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5268. g_nYearpos = g_nYearposTemp;
  5269. if (g_bSendOK == 0)return;
  5270. DataToArray(&phonearray);
  5271. m_money1.Format("%f", atof(m_taoxijiage));
  5272. m_money2.Format("%f", atof(m_payed1));
  5273. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5274. ConvertToPrice(m_money1);
  5275. ConvertToPrice(m_money2);
  5276. ConvertToPrice(m_money3);
  5277. ////////////////////////////////////////////////////////////////
  5278. int rcpos = -1;
  5279. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  5280. StrRect.top -= 15; StrRect.bottom -= 15;
  5281. Image *pImg = NULL;
  5282. #ifdef MNLS_VERSION
  5283. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  5284. #else
  5285. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  5286. #endif
  5287. m_Print.DrawImage(pImg, StrRect);
  5288. delete pImg;
  5289. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5290. {
  5291. Image *pImg = NULL;
  5292. g_nSendCode = 31;
  5293. int g_nYearposTemp = g_nYearpos;
  5294. g_nYearpos = -1;
  5295. g_pMainWnd->ProcessChatMessageRequest2(1);
  5296. g_nYearpos = g_nYearposTemp;
  5297. g_nSendCode = 0;
  5298. if (g_bSendOK == 0)return;
  5299. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5300. if (pImg)
  5301. {
  5302. StrRect.left = 30;
  5303. StrRect.top = 12;
  5304. StrRect.right = StrRect.left + 60;
  5305. StrRect.bottom = StrRect.top + 60;
  5306. m_Print.DrawImage(pImg, StrRect);
  5307. delete pImg; pImg = NULL;
  5308. }
  5309. }
  5310. m_Print.SetFontFace(11, 1, "宋体");
  5311. StrRect = load.m_rcarray.ElementAt(20);
  5312. StrRect.right = load.m_rcarray.ElementAt(23).right;
  5313. StrRect.top -= 18; StrRect.bottom -= 18;
  5314. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  5315. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5316. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  5317. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5318. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5319. StrRect.top -= 15; StrRect.bottom -= 15;
  5320. #ifdef MNLS_VERSION
  5321. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5322. #endif
  5323. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5324. StrRect.top -= 15; StrRect.bottom -= 15;
  5325. #ifdef MNLS_VERSION
  5326. m_Print.DrawRect(StrRect);
  5327. #endif
  5328. m_Print.SetFontFace(7, 1, "黑体");
  5329. m_Print.SetColor(0xffffff);
  5330. #ifdef MNLS_VERSION
  5331. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5332. #endif
  5333. m_Print.SetColor(0);
  5334. m_Print.SetFontFace(15, 1, "宋体");
  5335. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5336. StrRect.top -= 15; StrRect.bottom -= 15;
  5337. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同预约订单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5338. CStringArray strarray;
  5339. strarray.Add("NO: " + strOrderNumber);
  5340. CString date;
  5341. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  5342. strarray.Add(date);
  5343. strarray.Add("喜爱");
  5344. strarray.Add("格调");
  5345. if (fgarray.GetSize() == 12)
  5346. {
  5347. for (int i = 0; i < 12; i++)
  5348. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  5349. }
  5350. else
  5351. {
  5352. strarray.Add("复古典雅");
  5353. strarray.Add("温文尔雅");
  5354. strarray.Add("豪华艳丽");
  5355. strarray.Add("传统大方");
  5356. strarray.Add("新潮个性");
  5357. strarray.Add("浪漫奔放");
  5358. strarray.Add("简单素雅");
  5359. strarray.Add("活泼俏丽");
  5360. strarray.Add("妩媚温馨");
  5361. strarray.Add("温柔贤惠");
  5362. strarray.Add("成熟感性");
  5363. strarray.Add("清纯可爱");
  5364. }
  5365. strarray.Add("姓名");
  5366. // strarray.Add("职业");
  5367. strarray.Add("");
  5368. strarray.Add("地址");
  5369. strarray.Add("电话");
  5370. #ifdef CHILD_VERSION
  5371. strarray.Add("家长");
  5372. strarray.Add("宝宝");
  5373. #else
  5374. strarray.Add("先生");
  5375. strarray.Add("女士");
  5376. #endif
  5377. m_Print.SetFontFace(11, 1, "宋体");
  5378. for (i = 0; i < strarray.GetSize(); i++)
  5379. {
  5380. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5381. if (i < 2)
  5382. {
  5383. StrRect.top -= 15; StrRect.bottom -= 15;
  5384. }
  5385. if (i>15)
  5386. m_Print.DrawRect2(StrRect, 1);
  5387. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5388. }
  5389. for (i = 29; i <= 40; i++)
  5390. {
  5391. if (m_style.GetLength() <= (i - 29))continue;
  5392. if (m_style.GetAt(i - 29) != '1')continue;
  5393. StrRect = load.m_rcarray.ElementAt(i - 1);
  5394. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5395. }
  5396. for (i = 27; i <= 48; i++)
  5397. {
  5398. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5399. m_Print.DrawRect2(StrRect, 1);
  5400. }
  5401. #ifdef CHILD_VERSION
  5402. StrRect = load.m_rcarray.ElementAt(45);
  5403. StrRect.right = StrRect.left + 62;
  5404. m_Print.DrawRect2(StrRect, 1);
  5405. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5406. StrRect.left = StrRect.right;
  5407. StrRect.right = StrRect.left + 62;
  5408. m_Print.DrawRect2(StrRect, 1);
  5409. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5410. StrRect.left = StrRect.right;
  5411. StrRect.right = StrRect.left + 62;
  5412. m_Print.DrawRect2(StrRect, 1);
  5413. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5414. StrRect.left = StrRect.right;
  5415. StrRect.right = StrRect.left + 62;
  5416. m_Print.DrawRect2(StrRect, 1);
  5417. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5418. #endif
  5419. /////////////////////////
  5420. strarray.RemoveAll();
  5421. CString temp;
  5422. temp.Format("拍摄多款选 %d 款,其中影", atoi(m_outside) + atoi(m_outside2));
  5423. strarray.Add(temp);
  5424. temp.Format("棚景 %d 款,景点 %d 款.", atoi(m_outside2), atoi(m_outside));
  5425. strarray.Add(temp);
  5426. strarray.Add("化妆");
  5427. strarray.Add("造型");
  5428. #ifdef CHILD_VERSION
  5429. strarray.Add("");
  5430. #else
  5431. strarray.Add("婚纱");
  5432. #endif
  5433. strarray.Add("服饰");
  5434. strarray.Add("配");
  5435. strarray.Add("置");
  5436. strarray.Add("其");
  5437. strarray.Add("它");
  5438. strarray.Add("套系名称");
  5439. strarray.Add("镜款");
  5440. strarray.Add("套系总价");
  5441. strarray.Add("主摄影师");
  5442. strarray.Add("拍摄日期");
  5443. strarray.Add("定金");
  5444. #ifdef CHILD_VERSION
  5445. strarray.Add("主引导师");
  5446. #else
  5447. strarray.Add("主化妆师");
  5448. #endif
  5449. strarray.Add("看样日期");
  5450. strarray.Add("欠款余额");
  5451. strarray.Add("总监");
  5452. strarray.Add("取件日期");
  5453. rcpos = -1;
  5454. for (i = 0; i < strarray.GetSize(); i++)
  5455. {
  5456. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5457. if (i>9)
  5458. m_Print.DrawRect2(StrRect, 1);
  5459. #ifdef CHILD_VERSION
  5460. if (i == 5)
  5461. StrRect.top -= StrRect.Height();
  5462. #endif
  5463. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5464. }
  5465. for (i = 22; i <= 41; i++)
  5466. {
  5467. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5468. m_Print.DrawRect2(StrRect, 1);
  5469. }
  5470. /////////////////////////////
  5471. strarray.RemoveAll();
  5472. #ifdef CHILD_VERSION
  5473. strarray.Add("顾客方 家长:");
  5474. strarray.Add("宝宝:");
  5475. #else
  5476. strarray.Add("顾客方 先生:");
  5477. strarray.Add("女士:");
  5478. #endif
  5479. strarray.Add("电话:");
  5480. strarray.Add("影楼方 店长:");
  5481. strarray.Add("接单人:");
  5482. strarray.Add("电话:");
  5483. rcpos = -1;
  5484. for (i = 0; i < strarray.GetSize(); i++)
  5485. {
  5486. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5487. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5488. }
  5489. for (i = 7; i <= 12; i++)
  5490. {
  5491. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5492. // if(i!=10)
  5493. m_Print.DrawRect2(StrRect, 2);
  5494. }
  5495. //////////////////////////////////////
  5496. //开始打数据
  5497. strarray.RemoveAll();
  5498. strarray.Add(m_name1);
  5499. strarray.Add(m_name2);
  5500. /// strarray.Add (m_occupation1);
  5501. // strarray.Add (m_occupation2);
  5502. strarray.Add("");
  5503. strarray.Add("");
  5504. strarray.Add(m_addr1);
  5505. #ifdef CHILD_VERSION
  5506. strarray.Add("");
  5507. #else
  5508. strarray.Add(m_addr2);
  5509. #endif
  5510. strarray.Add(m_phone1);
  5511. strarray.Add(m_phone2);
  5512. for (i = 41; i <= 48; i++)
  5513. {
  5514. StrRect = load.m_rcarray.ElementAt(i - 1);
  5515. StrRect.left += 4;
  5516. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5517. }
  5518. ///////////////////////////////
  5519. strarray.RemoveAll();
  5520. strarray.Add(m_money1);
  5521. strarray.Add(m_waiter1);
  5522. strarray.Add(m_time2);
  5523. strarray.Add(m_money2);
  5524. strarray.Add(m_waiter2);
  5525. strarray.Add(m_time4);
  5526. strarray.Add(m_money3);
  5527. strarray.Add("");
  5528. strarray.Add(m_time5);
  5529. for (i = 32; i <= 40; i++)
  5530. {
  5531. StrRect = load2.m_rcarray.ElementAt(i - 1);
  5532. StrRect.left += 4;
  5533. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5534. }
  5535. ///////////////////////////////
  5536. strarray.RemoveAll();
  5537. strarray.Add(m_name1);
  5538. strarray.Add(m_name2);
  5539. CString phone;
  5540. if (m_phone1.IsEmpty() == 0)
  5541. phone = m_phone1 + ",";
  5542. phone += m_phone2;
  5543. phone.TrimRight(",");
  5544. strarray.Add(phone);
  5545. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  5546. strarray.Add(m_ren);
  5547. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  5548. for (i = 7; i <= 12; i++)
  5549. {
  5550. StrRect = load3.m_rcarray.ElementAt(i - 1);
  5551. StrRect.left += 4;
  5552. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5553. }
  5554. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  5555. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5556. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  5557. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5558. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  5559. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5560. //////////////////////////////
  5561. //开始画文字
  5562. StrRect = load2.m_rcarray.ElementAt(30);
  5563. StrRect.left += 3;
  5564. StrRect.top += 3;
  5565. StrRect.right -= 2;
  5566. StrRect.bottom -= 2;
  5567. AutoDraw(m_Print, StrRect, m_bz, 1.4f);
  5568. StrRect = load2.m_rcarray.ElementAt(29);
  5569. StrRect.left += 3;
  5570. StrRect.top += 3;
  5571. StrRect.right -= 2;
  5572. StrRect.bottom -= 2;
  5573. str = "";
  5574. for (i = 0; i < sparray.GetSize(); i++)
  5575. {
  5576. str += sparray.ElementAt(i).ElementAt(5);
  5577. str += " 数量:";
  5578. str += sparray.ElementAt(i).ElementAt(3);
  5579. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5580. str += "\r\n";
  5581. }
  5582. str.TrimRight("\r\n");
  5583. AutoDraw(m_Print, StrRect, str, 1.4);
  5584. StrRect = load2.m_rcarray.ElementAt(40);
  5585. StrRect.top += 8;
  5586. m_Print.SetFontFace(12, 1, "黑体");
  5587. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5588. StrRect.left += 3;
  5589. StrRect.top += 30;
  5590. StrRect.right -= 2;
  5591. StrRect.bottom -= 2;
  5592. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5593. if (str.IsEmpty())
  5594. {
  5595. str = "\
  5596. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5597. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5598. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5599. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5600. 持良好的心境.\r\n\
  5601. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5602. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5603. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5604. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5605. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5606. 勿进影室, 以免影响拍摄.\r\n\
  5607. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5608. 师或店长沟通.\r\n\
  5609. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5610. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5611. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5612. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5613. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5614. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5615. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5616. 还.";
  5617. }
  5618. AutoDraw(m_Print, StrRect, str, 1.8);
  5619. }
  5620. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 1)
  5621. {//AfxMessageBox("yyy");
  5622. m_Print.StartPrint();
  5623. m_Print.StartPage();
  5624. LoadRect load;
  5625. load.SetLiaPath("6-2.lia");
  5626. load.SetMargins(0, 0);
  5627. if (!load.Load())return;
  5628. int i;
  5629. //////////////////////////////////////////////////////////////
  5630. CStringArray txarray;
  5631. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  5632. g_sendhead.code[0] = 11;
  5633. g_sendhead.code[1] = 52;
  5634. g_sendhead.code[2] = 50;
  5635. g_sendhead.code[3] = 150;
  5636. g_sendhead.code[4] = 77;
  5637. g_sendhead.code[5] = 4;
  5638. g_sendhead.tabcount = 6;
  5639. g_sendhead.bsql = 0;
  5640. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5641. CArray<CStringArray, CStringArray>sparray;
  5642. CArray<CStringArray, CStringArray>clientarray;
  5643. CArray<CStringArray, CStringArray>phonearray;
  5644. CArray<CStringArray, CStringArray>fgarray;
  5645. CArray<CStringArray, CStringArray>danweiarray;
  5646. CArray<CStringArray, CStringArray>jdarray;
  5647. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5648. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5649. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5650. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5651. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5652. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5653. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  5654. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5655. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5656. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5657. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5658. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5659. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5660. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5661. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5662. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5663. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5664. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5665. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5666. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5667. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5668. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5669. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5670. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5671. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5672. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5673. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5674. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5675. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5676. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5677. if (jdarray.GetSize())
  5678. {
  5679. if (m_bz.IsEmpty() == 0)
  5680. m_bz = "\r\n" + m_bz;
  5681. m_bz += "景点:";
  5682. }
  5683. for (i = 0; i < jdarray.GetSize(); i++)
  5684. {
  5685. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5686. }
  5687. m_bz.TrimRight(";");
  5688. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5689. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5690. if (IsHasRights2new(31) == 0)
  5691. {
  5692. m_phone1 = "***";
  5693. m_phone2 = "***";
  5694. }
  5695. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5696. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5697. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  5698. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  5699. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  5700. CString str;
  5701. filter = "name='" + m_ren + "'";
  5702. g_sendhead.code[0] = 5;
  5703. g_sendhead.tabcount = 1;
  5704. g_sendhead.bsql = 0;
  5705. int g_nYearposTemp = g_nYearpos;
  5706. g_nYearpos = -1;
  5707. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5708. g_nYearpos = g_nYearposTemp;
  5709. if (g_bSendOK == 0)return;
  5710. DataToArray(&phonearray);
  5711. m_money1.Format("%f", atof(m_taoxijiage));
  5712. m_money2.Format("%f", atof(m_payed1));
  5713. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5714. ConvertToPrice(m_money1);
  5715. ConvertToPrice(m_money2);
  5716. ConvertToPrice(m_money3);
  5717. ////////////////////////////////////////////////////////////////
  5718. int rcpos = -1;
  5719. CRect StrRect = load.m_rcarray.ElementAt(0);
  5720. m_Print.SetFontFace(25, 1, "黑体");
  5721. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "预约单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5722. m_Print.SetFontFace(11, 1, "宋体");
  5723. StrRect = load.m_rcarray.ElementAt(1);
  5724. if (m_time1.GetLength() == 10)
  5725. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  5726. else
  5727. str = "开单日期:";
  5728. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5729. StrRect = load.m_rcarray.ElementAt(2);
  5730. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + strOrderNumber), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5731. CStringArray strarray;
  5732. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5733. {
  5734. Image *pImg = NULL;
  5735. g_nSendCode = 31;
  5736. int g_nYearposTemp = g_nYearpos;
  5737. g_nYearpos = -1;
  5738. g_pMainWnd->ProcessChatMessageRequest2(1);
  5739. g_nYearpos = g_nYearposTemp;
  5740. g_nSendCode = 0;
  5741. if (g_bSendOK == 0)return;
  5742. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5743. if (pImg)
  5744. {
  5745. StrRect.left = 47;
  5746. StrRect.top = 12;
  5747. StrRect.right = StrRect.left + 60;
  5748. StrRect.bottom = StrRect.top + 60;
  5749. m_Print.DrawImage(pImg, StrRect);
  5750. delete pImg; pImg = NULL;
  5751. }
  5752. }
  5753. #ifdef CHILD_VERSION
  5754. strarray.Add("家长姓名");
  5755. strarray.Add("宝宝姓名");
  5756. #else
  5757. strarray.Add("先生姓名");
  5758. strarray.Add("女士姓名");
  5759. #endif
  5760. strarray.Add("服装套数");
  5761. // strarray.Add ("拍摄张数");
  5762. #ifdef CHILD_VERSION
  5763. strarray.Add("出生日期");
  5764. #else
  5765. strarray.Add("结婚日期");
  5766. #endif
  5767. strarray.Add("拍摄日期");
  5768. strarray.Add("联系电话");
  5769. strarray.Add("联系电话");
  5770. strarray.Add("造型套数");
  5771. if (m_zs.Find("\\") != -1)
  5772. strarray.Add("入底\\入册");
  5773. else
  5774. strarray.Add("入底张数");
  5775. strarray.Add("选片日期");
  5776. strarray.Add("QQ/邮箱");
  5777. strarray.Add("套系总额");
  5778. strarray.Add("定金");
  5779. strarray.Add("余款金额");
  5780. strarray.Add("取件日期");
  5781. strarray.Add(m_name1);
  5782. strarray.Add(m_name2);
  5783. strarray.Add(m_clothescount);
  5784. // str.Format("%d", atoi(m_zs)*3);
  5785. // strarray.Add (str);
  5786. #ifdef CHILD_VERSION
  5787. strarray.Add(m_birthday1);
  5788. #else
  5789. strarray.Add(m_time3);
  5790. #endif
  5791. strarray.Add(m_time2);
  5792. strarray.Add(m_phone1);
  5793. strarray.Add(m_phone2);
  5794. strarray.Add(m_clothescount2);
  5795. strarray.Add(m_zs);
  5796. strarray.Add(m_time4);
  5797. strarray.Add(m_qq1);
  5798. strarray.Add(m_money1);
  5799. strarray.Add(m_money2);
  5800. strarray.Add(m_money3);
  5801. strarray.Add(m_time5);
  5802. for (i = 4; i <= 33; i++)
  5803. {
  5804. StrRect = load.m_rcarray.ElementAt(i - 1);
  5805. m_Print.DrawRect2(StrRect, 1);
  5806. if (strarray.GetSize() > (i - 4))
  5807. {
  5808. if (i <= 18)
  5809. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5810. else
  5811. {
  5812. StrRect.left += 4;
  5813. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5814. }
  5815. }
  5816. }
  5817. int dt = 413;
  5818. StrRect = load.m_rcarray.ElementAt(36); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5819. m_Print.DrawText((LPTSTR)(LPCTSTR)"门市签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5820. StrRect = load.m_rcarray.ElementAt(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5821. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5822. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5823. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5824. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  5825. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5826. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  5827. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5828. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  5829. m_Print.DrawText((LPTSTR)(LPCTSTR)("网址:" + g_cominfoarray.ElementAt(0).ElementAt(13)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5830. //////////////////////////////
  5831. //开始画文字
  5832. StrRect = load.m_rcarray.ElementAt(7);
  5833. int hei = StrRect.Height();
  5834. StrRect.top += hei;
  5835. StrRect.bottom += hei;
  5836. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5837. StrRect.top += dt;
  5838. StrRect.bottom += dt;
  5839. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5840. StrRect = load.m_rcarray.ElementAt(17);
  5841. StrRect.top += hei;
  5842. StrRect.bottom += hei;
  5843. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5844. StrRect = load.m_rcarray.ElementAt(33);
  5845. StrRect.bottom = StrRect.top + dt; m_Print.DrawRect2(StrRect, 1);
  5846. StrRect.top += hei;
  5847. StrRect.left += 3;
  5848. StrRect.top += 3;
  5849. StrRect.right -= 2;
  5850. StrRect.bottom -= 2;
  5851. str = "";
  5852. for (i = 0; i < sparray.GetSize(); i++)
  5853. {
  5854. str += sparray.ElementAt(i).ElementAt(5);
  5855. str += " 数量:";
  5856. str += sparray.ElementAt(i).ElementAt(3);
  5857. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5858. str += "\r\n";
  5859. }
  5860. str.TrimRight("\r\n");
  5861. AutoDraw(m_Print, StrRect, str, 1.4);
  5862. StrRect = load.m_rcarray.ElementAt(33);
  5863. StrRect.top += dt;
  5864. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5865. StrRect.top += hei;
  5866. StrRect.left += 3;
  5867. StrRect.top += 3;
  5868. StrRect.right -= 2;
  5869. StrRect.bottom -= 2;
  5870. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  5871. StrRect = load.m_rcarray.ElementAt(34);
  5872. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5873. StrRect.top += hei;
  5874. StrRect.left += 3;
  5875. StrRect.top += 3;
  5876. StrRect.right -= 2;
  5877. StrRect.bottom -= 2;
  5878. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5879. if (str.IsEmpty())
  5880. {
  5881. str = "\
  5882. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5883. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5884. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5885. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5886. 持良好的心境.\r\n\
  5887. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5888. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5889. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5890. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5891. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5892. 勿进影室, 以免影响拍摄.\r\n\
  5893. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5894. 师或店长沟通.\r\n\
  5895. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5896. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5897. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5898. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5899. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5900. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5901. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5902. 还.";
  5903. }
  5904. AutoDraw(m_Print, StrRect, str, 1.8);
  5905. StrRect = load.m_rcarray.ElementAt(35);
  5906. StrRect.bottom += 100;
  5907. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  5908. 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∨";
  5909. // AutoDraw(m_Print, StrRect, str, 1.4);
  5910. }
  5911. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 2)
  5912. {
  5913. PrintDinDan5(strOrderNumber);
  5914. return;
  5915. }
  5916. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  5917. {
  5918. PrintDinDan6(strOrderNumber);
  5919. return;
  5920. }
  5921. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  5922. dlg.m_pDC = m_Print.GetPDC();
  5923. dlg.m_mode = 1;
  5924. if (aa == 0)
  5925. {
  5926. if (dlg.DoModal() != IDOK)
  5927. return;
  5928. printcot = dlg.m_num;
  5929. }
  5930. //结束打印
  5931. m_Print.EndPage();
  5932. m_Print.EndPrint();
  5933. }
  5934. }
  5935. void CovertDate2(CString date, CString &date2)
  5936. {
  5937. try
  5938. {
  5939. if (date == "2013-04-09")
  5940. {
  5941. date2 = "2013-02-29";
  5942. return;
  5943. }
  5944. ///////////////////////////////////
  5945. date2 = date;
  5946. GongToLong(date2);
  5947. ////////////////////////////////////
  5948. return;
  5949. CCalendarConvert m_CalendarConvert;
  5950. SYSTEMTIME src = { 0 };
  5951. SYSTEMTIME dst = { 0 };
  5952. COleDateTime m_timeLunar(atoi(date.Mid(0, 4)), atoi(date.Mid(5, 2)), atoi(date.Mid(8, 2)), 0, 0, 0);
  5953. COleDateTime m_timeGregorian;
  5954. m_timeLunar.GetAsSystemTime(src);
  5955. BOOL bEmbolism = 0;
  5956. if (m_CalendarConvert.Gregorian2Lunar(&src, &dst, &bEmbolism))
  5957. {
  5958. m_timeGregorian = m_CalendarConvert.ConvertSysTime2OleDateTime(&dst);
  5959. date2.Format("%04d-%02d-%02d", m_timeGregorian.GetYear(), m_timeGregorian.GetMonth(), m_timeGregorian.GetDay());
  5960. if (m_timeGregorian.GetYear() == -1)date2 = "2000-13-32";
  5961. }
  5962. else
  5963. {
  5964. date2.Empty();
  5965. }
  5966. }
  5967. catch (...)
  5968. {
  5969. }
  5970. }
  5971. void CMainFrame::PrintDinDan5(CString m_id)
  5972. {
  5973. int printcot = 1;
  5974. for (int aa = 0; aa < printcot; aa++)
  5975. {
  5976. PrintPreview dlg;
  5977. CPrintRX m_Print;
  5978. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  5979. {
  5980. m_Print.InitToPrint(NULL, 1);
  5981. }
  5982. else
  5983. {
  5984. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  5985. if (name.IsEmpty())
  5986. m_Print.InitToPrint(NULL, 1);
  5987. else
  5988. {
  5989. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  5990. if (nret == -1 && aa == 0)
  5991. {
  5992. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  5993. }
  5994. }
  5995. }
  5996. {
  5997. m_Print.StartPrint();
  5998. m_Print.StartPage();
  5999. LoadRect load;
  6000. load.SetLiaPath("19.lia");
  6001. load.SetMargins(0, -20);
  6002. if (!load.Load())return;
  6003. int i;
  6004. //////////////////////////////////////////////////////////////
  6005. CStringArray txarray;
  6006. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  6007. g_sendhead.code[0] = 11;
  6008. g_sendhead.code[1] = 52;
  6009. g_sendhead.code[2] = 50;
  6010. g_sendhead.code[3] = 150;
  6011. g_sendhead.code[4] = 77;
  6012. g_sendhead.code[5] = 4;
  6013. g_sendhead.tabcount = 6;
  6014. g_sendhead.bsql = 0;
  6015. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  6016. CArray<CStringArray, CStringArray>sparray;
  6017. CArray<CStringArray, CStringArray>clientarray;
  6018. CArray<CStringArray, CStringArray>phonearray;
  6019. CArray<CStringArray, CStringArray>fgarray;
  6020. CArray<CStringArray, CStringArray>danweiarray;
  6021. CArray<CStringArray, CStringArray>jdarray;
  6022. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  6023. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  6024. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  6025. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  6026. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  6027. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  6028. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  6029. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  6030. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  6031. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  6032. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  6033. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  6034. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  6035. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  6036. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  6037. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  6038. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  6039. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  6040. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  6041. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  6042. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  6043. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  6044. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  6045. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  6046. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  6047. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  6048. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  6049. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  6050. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(36);
  6051. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  6052. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6053. CString m_txtype = g_List1array.ElementAt(0).ElementAt(52);
  6054. CString m_memberno = g_List1array.ElementAt(0).ElementAt(47);
  6055. CString str;
  6056. if (jdarray.GetSize())
  6057. {
  6058. if (m_bz.IsEmpty() == 0)
  6059. m_bz = "\r\n" + m_bz;
  6060. m_bz += "景点:";
  6061. }
  6062. for (i = 0; i < jdarray.GetSize(); i++)
  6063. {
  6064. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  6065. }
  6066. m_bz.TrimRight(";");
  6067. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  6068. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  6069. if (IsHasRights2new(31) == 0)
  6070. {
  6071. m_phone1 = "***";
  6072. m_phone2 = "***";
  6073. }
  6074. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  6075. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  6076. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  6077. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  6078. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  6079. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  6080. BOOL check1 = atoi(clientarray.ElementAt(0).ElementAt(15));
  6081. filter = "name='" + m_ren + "'";
  6082. g_sendhead.code[0] = 5;
  6083. g_sendhead.tabcount = 1;
  6084. g_sendhead.bsql = 0;
  6085. int g_nYearposTemp = g_nYearpos;
  6086. g_nYearpos = -1;
  6087. g_pMainWnd->ProcessChatMessageRequest2(filter);
  6088. g_nYearpos = g_nYearposTemp;
  6089. if (g_bSendOK == 0)return;
  6090. DataToArray(&phonearray);
  6091. m_money1.Format("%f", atof(m_taoxijiage));
  6092. m_money2.Format("%f", atof(m_payed1));
  6093. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  6094. ConvertToPrice(m_money1);
  6095. ConvertToPrice(m_money2);
  6096. ConvertToPrice(m_money3);
  6097. ////////////////////////////////////////////////////////////////
  6098. int rcpos = -1;
  6099. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6100. //Image *pImg=NULL;
  6101. // ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  6102. // m_Print.DrawImage(pImg, StrRect);
  6103. // delete pImg;
  6104. m_Print.SetFontFace(20, 1, "宋体");
  6105. StrRect = load.m_rcarray.ElementAt(1);
  6106. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "定单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6107. m_Print.SetFontFace(12, 1, "宋体");
  6108. StrRect = load.m_rcarray.ElementAt(2);
  6109. m_Print.DrawText((LPTSTR)(LPCTSTR)("NO." + m_id), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6110. StrRect = load.m_rcarray.ElementAt(3);
  6111. str.Format("%s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  6112. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6113. StrRect = load.m_rcarray.ElementAt(4);
  6114. m_Print.DrawText((LPTSTR)(LPCTSTR)("联系人:" + m_name1), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6115. CStringArray strarray;
  6116. strarray.Add("姓名");
  6117. strarray.Add("性别");
  6118. strarray.Add("年龄");
  6119. strarray.Add("出生年月");
  6120. strarray.Add("套系价格");
  6121. strarray.Add("定金");
  6122. strarray.Add("欠款");
  6123. strarray.Add("拍摄类型");
  6124. strarray.Add("会员卡号");
  6125. strarray.Add("定单人");
  6126. strarray.Add("入底\\入册");
  6127. strarray.Add("联系电话");
  6128. for (i = 6; i <= 17; i++)
  6129. {
  6130. StrRect = load.m_rcarray.ElementAt(i - 1);
  6131. m_Print.DrawRect2(StrRect, 1);
  6132. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 6), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6133. }
  6134. strarray.RemoveAll();
  6135. strarray.Add(m_name2);
  6136. strarray.Add(m_sex);
  6137. if (m_birthday.GetLength() != 10)
  6138. strarray.Add("");
  6139. else
  6140. {
  6141. int year = 0;
  6142. if (check1)
  6143. {
  6144. CString date2;
  6145. CovertDate2(g_date, date2);
  6146. year = atoi(date2.Left(4)) - atoi(m_birthday.Left(4));
  6147. if (date2.Right(5) >= m_birthday.Right(5))
  6148. year++;
  6149. }
  6150. else
  6151. {
  6152. year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  6153. if (g_date.Right(5) >= m_birthday.Right(5))
  6154. year++;
  6155. }
  6156. str.Format("%d", year);
  6157. strarray.Add(str);
  6158. }
  6159. strarray.Add(m_birthday);
  6160. strarray.Add(m_money1);
  6161. strarray.Add(m_money2);
  6162. strarray.Add(m_money3);
  6163. strarray.Add(m_txtype);
  6164. strarray.Add(m_memberno);
  6165. strarray.Add(m_ren);
  6166. strarray.Add(m_zs);
  6167. if (!m_phone1.IsEmpty())
  6168. strarray.Add(m_phone1);
  6169. else
  6170. strarray.Add(m_phone2);
  6171. for (i = 18; i <= 29; i++)
  6172. {
  6173. StrRect = load.m_rcarray.ElementAt(i - 1);
  6174. m_Print.DrawRect2(StrRect, 1);
  6175. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6176. }
  6177. strarray.RemoveAll();
  6178. strarray.Add("摄影师");
  6179. strarray.Add("拍照时间");
  6180. strarray.Add("选片人");
  6181. strarray.Add("选片时间");
  6182. strarray.Add("引导师");
  6183. strarray.Add("设计师");
  6184. strarray.Add("取件时间");
  6185. strarray.Add("顾客签字");
  6186. for (i = 34; i <= 41; i++)
  6187. {
  6188. StrRect = load.m_rcarray.ElementAt(i - 1);
  6189. m_Print.DrawRect2(StrRect, 1);
  6190. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 34), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6191. }
  6192. strarray.RemoveAll();
  6193. strarray.Add(m_waiter1);
  6194. strarray.Add(m_time2);
  6195. strarray.Add(m_waiter3);
  6196. strarray.Add(m_time4);
  6197. strarray.Add(m_waiter2);
  6198. strarray.Add(m_waiter4);
  6199. strarray.Add(m_time5);
  6200. strarray.Add("");
  6201. for (i = 42; i <= 49; i++)
  6202. {
  6203. StrRect = load.m_rcarray.ElementAt(i - 1);
  6204. m_Print.DrawRect2(StrRect, 1);
  6205. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6206. }
  6207. m_Print.SetFontFace(15, 1, "宋体");
  6208. StrRect = load.m_rcarray.ElementAt(29);
  6209. m_Print.DrawRect2(StrRect, 1);
  6210. StrRect.top += 45;
  6211. m_Print.DrawText((LPTSTR)(LPCTSTR)"拍", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6212. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6213. m_Print.DrawText((LPTSTR)(LPCTSTR)"内", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6214. m_Print.DrawText((LPTSTR)(LPCTSTR)"容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  6215. StrRect = load.m_rcarray.ElementAt(30);
  6216. m_Print.DrawRect2(StrRect, 1);
  6217. StrRect.top += 45;
  6218. m_Print.DrawText((LPTSTR)(LPCTSTR)"友", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6219. m_Print.DrawText((LPTSTR)(LPCTSTR)"情", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6220. m_Print.DrawText((LPTSTR)(LPCTSTR)"提", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6221. m_Print.DrawText((LPTSTR)(LPCTSTR)"示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  6222. m_Print.SetFontFace(10, 1, "宋体");
  6223. StrRect = load.m_rcarray.ElementAt(37); StrRect.top = StrRect.bottom + 2;
  6224. str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  6225. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  6226. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  6227. StrRect = load.m_rcarray.ElementAt(48); StrRect.top = StrRect.bottom + 2; StrRect.left -= 200;
  6228. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  6229. //开始画文字
  6230. StrRect = load.m_rcarray.ElementAt(31);
  6231. StrRect.left += 3;
  6232. StrRect.top += 3;
  6233. StrRect.right -= 2;
  6234. StrRect.bottom -= 2;
  6235. str = "";
  6236. for (i = 0; i < sparray.GetSize(); i++)
  6237. {
  6238. str += sparray.ElementAt(i).ElementAt(5);
  6239. str += " 数量:";
  6240. str += sparray.ElementAt(i).ElementAt(3);
  6241. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6242. str += "\r\n";
  6243. }
  6244. str.TrimRight("\r\n");
  6245. m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6246. m_bz.TrimLeft();
  6247. if (m_bz != "")
  6248. {
  6249. str += "\r\n"; str += "\r\n";
  6250. str += "备注:" + m_bz;
  6251. }
  6252. AutoDraw(m_Print, StrRect, str, 1.4);
  6253. StrRect = load.m_rcarray.ElementAt(32); m_Print.DrawRect2(StrRect, 1);
  6254. StrRect.left += 3;
  6255. StrRect.top += 3;
  6256. StrRect.right -= 2;
  6257. StrRect.bottom -= 2;
  6258. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6259. if (str.IsEmpty())
  6260. {
  6261. str = "\
  6262. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6263. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6264. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6265. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6266. 持良好的心境.\r\n\
  6267. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6268. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6269. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6270. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6271. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6272. 勿进影室, 以免影响拍摄.\r\n\
  6273. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6274. 师或店长沟通.\r\n\
  6275. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6276. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6277. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6278. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6279. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6280. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6281. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6282. 还.";
  6283. }
  6284. AutoDraw(m_Print, StrRect, str, 1.8);
  6285. }
  6286. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6287. dlg.m_pDC = m_Print.GetPDC();
  6288. dlg.m_mode = 1;
  6289. if (aa == 0)
  6290. {
  6291. if (dlg.DoModal() != IDOK)
  6292. return;
  6293. printcot = dlg.m_num;
  6294. }
  6295. //结束打印
  6296. m_Print.EndPage();
  6297. m_Print.EndPrint();
  6298. }
  6299. }
  6300. void CMainFrame::PrintDinDan4(CString m_id)
  6301. {
  6302. // TODO: Add your control notification handler code here
  6303. CPrintRX m_Print;
  6304. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6305. {
  6306. m_Print.InitToPrint(NULL, 1);
  6307. }
  6308. else
  6309. {
  6310. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  6311. if (name.IsEmpty())
  6312. m_Print.InitToPrint(NULL, 1);
  6313. else
  6314. {
  6315. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6316. if (nret == -1)
  6317. {
  6318. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6319. }
  6320. }
  6321. }
  6322. m_Print.StartPrint();
  6323. m_Print.StartPage();
  6324. LoadRect load;
  6325. load.SetLiaPath("6-2.lia");
  6326. load.SetMargins(0, 0);
  6327. if (!load.Load())return;
  6328. int i;
  6329. //////////////////////////////////////////////////////////////
  6330. CStringArray txarray;
  6331. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  6332. g_sendhead.code[0] = 11;
  6333. g_sendhead.code[1] = 52;
  6334. g_sendhead.code[2] = 50;
  6335. g_sendhead.code[3] = 150;
  6336. g_sendhead.code[4] = 77;
  6337. g_sendhead.code[5] = 4;
  6338. g_sendhead.tabcount = 6;
  6339. g_sendhead.bsql = 0;
  6340. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  6341. CArray<CStringArray, CStringArray>sparray;
  6342. CArray<CStringArray, CStringArray>clientarray;
  6343. CArray<CStringArray, CStringArray>phonearray;
  6344. CArray<CStringArray, CStringArray>fgarray;
  6345. CArray<CStringArray, CStringArray>danweiarray;
  6346. CArray<CStringArray, CStringArray>jdarray;
  6347. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  6348. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  6349. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  6350. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  6351. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  6352. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  6353. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  6354. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  6355. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  6356. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  6357. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  6358. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  6359. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  6360. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  6361. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  6362. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  6363. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  6364. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  6365. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  6366. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  6367. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  6368. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  6369. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  6370. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  6371. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  6372. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  6373. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  6374. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  6375. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  6376. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6377. if (jdarray.GetSize())
  6378. {
  6379. if (m_bz.IsEmpty() == 0)
  6380. m_bz = "\r\n" + m_bz;
  6381. m_bz += "景点:";
  6382. }
  6383. for (i = 0; i < jdarray.GetSize(); i++)
  6384. {
  6385. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  6386. }
  6387. m_bz.TrimRight(";");
  6388. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  6389. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  6390. if (IsHasRights2new(31) == 0)
  6391. {
  6392. m_phone1 = "***";
  6393. m_phone2 = "***";
  6394. }
  6395. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  6396. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  6397. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  6398. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  6399. CString str;
  6400. filter = "name='" + m_ren + "'";
  6401. g_sendhead.code[0] = 5;
  6402. g_sendhead.tabcount = 1;
  6403. g_sendhead.bsql = 0;
  6404. int g_nYearposTemp = g_nYearpos;
  6405. g_nYearpos = -1;
  6406. g_pMainWnd->ProcessChatMessageRequest2(filter);
  6407. g_nYearpos = g_nYearposTemp;
  6408. if (g_bSendOK == 0)return;
  6409. DataToArray(&phonearray);
  6410. m_money1.Format("%f", atof(m_taoxijiage));
  6411. m_money2.Format("%f", atof(m_payed1));
  6412. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  6413. ConvertToPrice(m_money1);
  6414. ConvertToPrice(m_money2);
  6415. ConvertToPrice(m_money3);
  6416. ////////////////////////////////////////////////////////////////
  6417. int rcpos = -1;
  6418. CRect StrRect = load.m_rcarray.ElementAt(0);
  6419. m_Print.SetFontFace(25, 1, "黑体");
  6420. m_Print.DrawText((LPTSTR)(LPCTSTR)"巴黎春天婚纱摄影预约单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6421. m_Print.SetFontFace(11, 1, "宋体");
  6422. StrRect = load.m_rcarray.ElementAt(1);
  6423. if (m_time1.GetLength() == 10)
  6424. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  6425. else
  6426. str = "开单日期:";
  6427. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6428. StrRect = load.m_rcarray.ElementAt(2);
  6429. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + m_id), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6430. CStringArray strarray;
  6431. strarray.Add("先生姓名");
  6432. strarray.Add("女士姓名");
  6433. strarray.Add("服装套数");
  6434. strarray.Add("拍摄张数");
  6435. strarray.Add("拍摄日期");
  6436. strarray.Add("联系电话");
  6437. strarray.Add("联系电话");
  6438. strarray.Add("造型套数");
  6439. strarray.Add("入册张数");
  6440. strarray.Add("选片日期");
  6441. strarray.Add("QQ/邮箱");
  6442. strarray.Add("套系总额");
  6443. strarray.Add("定金");
  6444. strarray.Add("余款金额");
  6445. strarray.Add("取件日期");
  6446. strarray.Add(m_name1);
  6447. strarray.Add(m_name2);
  6448. strarray.Add(m_clothescount);
  6449. str.Format("%d", atoi(m_zs) * 3);
  6450. strarray.Add(str);
  6451. strarray.Add(m_time2);
  6452. strarray.Add(m_phone1);
  6453. strarray.Add(m_phone2);
  6454. strarray.Add(m_clothescount2);
  6455. strarray.Add(m_zs);
  6456. strarray.Add(m_time4);
  6457. strarray.Add(m_qq1);
  6458. strarray.Add(m_money1);
  6459. strarray.Add(m_money2);
  6460. strarray.Add(m_money3);
  6461. strarray.Add(m_time5);
  6462. for (i = 4; i <= 33; i++)
  6463. {
  6464. StrRect = load.m_rcarray.ElementAt(i - 1);
  6465. m_Print.DrawRect2(StrRect, 1);
  6466. if (strarray.GetSize() > (i - 4))
  6467. {
  6468. if (i <= 18)
  6469. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6470. else
  6471. {
  6472. StrRect.left += 4;
  6473. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6474. }
  6475. }
  6476. }
  6477. int dt = 413;
  6478. StrRect = load.m_rcarray.ElementAt(36); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6479. m_Print.DrawText((LPTSTR)(LPCTSTR)"门市签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6480. StrRect = load.m_rcarray.ElementAt(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6481. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6482. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6483. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6484. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  6485. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址:深圳市红岭中路中深国际大厦首层,二十二层", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6486. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  6487. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:0755-61308198 61308199 25860696 25860697", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6488. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  6489. m_Print.DrawText((LPTSTR)(LPCTSTR)"网址:www.paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6490. StrRect = load.m_rcarray.ElementAt(43); StrRect.top += dt; StrRect.bottom += dt;
  6491. m_Print.DrawText((LPTSTR)(LPCTSTR)"邮箱:blct@paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6492. //////////////////////////////
  6493. //开始画文字
  6494. StrRect = load.m_rcarray.ElementAt(7);
  6495. int hei = StrRect.Height();
  6496. StrRect.top += hei;
  6497. StrRect.bottom += hei;
  6498. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6499. StrRect.top += dt;
  6500. StrRect.bottom += dt;
  6501. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6502. StrRect = load.m_rcarray.ElementAt(17);
  6503. StrRect.top += hei;
  6504. StrRect.bottom += hei;
  6505. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6506. StrRect = load.m_rcarray.ElementAt(33);
  6507. StrRect.bottom = StrRect.top + dt; m_Print.DrawRect2(StrRect, 1);
  6508. StrRect.top += hei;
  6509. StrRect.left += 3;
  6510. StrRect.top += 3;
  6511. StrRect.right -= 2;
  6512. StrRect.bottom -= 2;
  6513. str = "";
  6514. for (i = 0; i < sparray.GetSize(); i++)
  6515. {
  6516. str += sparray.ElementAt(i).ElementAt(5);
  6517. str += " 数量:";
  6518. str += sparray.ElementAt(i).ElementAt(3);
  6519. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6520. str += "\r\n";
  6521. }
  6522. str.TrimRight("\r\n");
  6523. AutoDraw(m_Print, StrRect, str, 1.4);
  6524. StrRect = load.m_rcarray.ElementAt(33);
  6525. StrRect.top += dt;
  6526. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6527. StrRect.top += hei;
  6528. StrRect.left += 3;
  6529. StrRect.top += 3;
  6530. StrRect.right -= 2;
  6531. StrRect.bottom -= 2;
  6532. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  6533. StrRect = load.m_rcarray.ElementAt(34);
  6534. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6535. StrRect.top += hei;
  6536. StrRect.left += 3;
  6537. StrRect.top += 3;
  6538. StrRect.right -= 2;
  6539. StrRect.bottom -= 2;
  6540. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6541. if (str.IsEmpty())
  6542. {
  6543. str = "\
  6544. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6545. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6546. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6547. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6548. 持良好的心境.\r\n\
  6549. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6550. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6551. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6552. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6553. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6554. 勿进影室, 以免影响拍摄.\r\n\
  6555. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6556. 师或店长沟通.\r\n\
  6557. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6558. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6559. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6560. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6561. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6562. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6563. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6564. 还.";
  6565. }
  6566. AutoDraw(m_Print, StrRect, str, 1.8);
  6567. StrRect = load.m_rcarray.ElementAt(35);
  6568. StrRect.bottom += 100;
  6569. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  6570. 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∨";
  6571. AutoDraw(m_Print, StrRect, str, 1.4);
  6572. PrintPreview dlg;
  6573. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6574. dlg.m_pDC = m_Print.GetPDC();
  6575. if (dlg.DoModal() != IDOK)return;
  6576. //结束打印
  6577. m_Print.EndPage();
  6578. m_Print.EndPrint();
  6579. }
  6580. int CalHeight_01(CRect &rc, CStringArray *saContent, CPrintRX *Print, int FORMAT)
  6581. {
  6582. CSize size;
  6583. int nMaxheight = 0;
  6584. CString strTemp;
  6585. CString strContent;
  6586. int nSize = saContent->GetSize();
  6587. int nRow = 0; // 行数;
  6588. for (int i = 0; i < nSize; i++)
  6589. {
  6590. strTemp = "";
  6591. strContent = saContent->ElementAt(i);
  6592. while (FALSE == strContent.IsEmpty())
  6593. {
  6594. strContent = strContent.Mid(strTemp.GetLength());
  6595. if (strContent.IsEmpty())
  6596. break;
  6597. Print->GetStrSize((LPTSTR)(LPCTSTR)strContent, size);
  6598. if (size.cx <= rc.Width())
  6599. {
  6600. CRect rc2 = rc;
  6601. rc2.top += nRow*(size.cy + 1);
  6602. rc2.bottom = rc2.top + (size.cy + 1);
  6603. Print->DrawText((LPTSTR)(LPCTSTR)strContent, rc2, 0, 0, FORMAT | FORMAT_UP);
  6604. nMaxheight = max(nMaxheight, rc2.bottom);
  6605. nRow++;
  6606. break;
  6607. }
  6608. int right = 0;
  6609. while (size.cx > rc.Width())
  6610. {
  6611. right++;
  6612. strTemp = strContent.Left(strContent.GetLength() - (right));
  6613. if (GIsHalfHZ(strTemp))
  6614. {
  6615. right++;
  6616. strTemp.Delete(strTemp.GetLength() - 1);
  6617. }
  6618. Print->GetStrSize((LPTSTR)(LPCTSTR)strTemp, size);
  6619. }
  6620. CRect rc2 = rc;
  6621. rc2.top += nRow*(size.cy + 1);
  6622. rc2.bottom = rc2.top + (size.cy + 1);
  6623. Print->DrawText((LPTSTR)(LPCTSTR)strTemp, rc2, 0, 0, FORMAT | FORMAT_UP); //printf("Jeff:str=%s\n\n",str);// Jeff Printf;
  6624. nRow++;
  6625. nMaxheight = max(nMaxheight, rc2.bottom);
  6626. }
  6627. }
  6628. return (nMaxheight == 0) ? (rc.bottom + 1) : (nMaxheight + 1);
  6629. }
  6630. /************************************************************************/
  6631. /*
  6632. 多字节字符编码下的CaleHeight函数;
  6633. 函数:CaleHeight
  6634. 描述:计算出一行高度可变,宽度特定的表格(CArray<CRect,CRect>),在输入指定内容时(CStringArray),表格高度变化最大的值。
  6635. 参数:
  6636. aRowRect: 一行表格,CArray::GetSize()表示表格列数;
  6637. aRowStr: 与表格对应的一行字符,CStringArray::GetSize()大小与CArray::GetSize()一致。
  6638. pPrinter: 打印机实例指针;
  6639. nFormat: 字符串的显示格式。
  6640. 返回:返回最大的表格高度;
  6641. 注意:只能多字节下使用,因为函数GIsHalfHZ。
  6642. */
  6643. /************************************************************************/
  6644. INT CalcHeight( IN CArray<CRect, CRect> &aRowRect, IN CStringArray &aRowStr, IN CPrintRX *pPrinter, IN CONST INT& nFormat)
  6645. {
  6646. // 参数有效性;
  6647. if( aRowRect.GetSize() != aRowStr.GetSize() )
  6648. {
  6649. OutputDebugString(_T("表格列数与字符列数不等!\n"));
  6650. return -1;
  6651. }
  6652. if( pPrinter == NULL )
  6653. {
  6654. OutputDebugString(_T("打印机句柄指针无效\n"));
  6655. return -1;
  6656. }
  6657. // 表格字串长度;
  6658. CSize size;
  6659. // 当前表格字体高度;
  6660. INT nGridFontHeight = 0;
  6661. // 当前表格区域;
  6662. CRect curGrid;
  6663. // 当前表格字符串;
  6664. CString strGridContent;
  6665. // 最大值高底;
  6666. INT nMaxHeigth = 0;
  6667. // 当前换行数;
  6668. INT nWrapRows = 0;
  6669. // 当前换行字串;
  6670. CString strWrapRow = _T("");
  6671. // 表格列数;
  6672. INT nColumns = aRowRect.GetSize();
  6673. // 临时表格;
  6674. CRect rcGrid;
  6675. // 循环计算每个表格的高度;
  6676. for( INT i = 0; i < nColumns; i++ )
  6677. {
  6678. nWrapRows = 0;
  6679. strWrapRow.Empty();
  6680. curGrid = aRowRect.ElementAt(i);
  6681. strGridContent = aRowStr.ElementAt(i);
  6682. nMaxHeigth = max(nMaxHeigth, curGrid.bottom);
  6683. while( !strGridContent.IsEmpty() )
  6684. {
  6685. strGridContent = strGridContent.Right(strGridContent.GetLength() - strWrapRow.GetLength());
  6686. if ( strGridContent.IsEmpty() )
  6687. {
  6688. OutputDebugString(_T("表格字符已空\n"));
  6689. break;
  6690. }
  6691. pPrinter->GetStrSize((LPTSTR)(LPCTSTR)strGridContent, size);
  6692. nGridFontHeight = size.cy + 1;
  6693. // 字串长度 <= 表格宽度;
  6694. if( size.cx <= curGrid.Width() )
  6695. {
  6696. rcGrid = curGrid;
  6697. rcGrid.top += nWrapRows*nGridFontHeight;
  6698. rcGrid.bottom = rcGrid.top + nGridFontHeight;
  6699. nMaxHeigth = max(nMaxHeigth, rcGrid.bottom);
  6700. pPrinter->DrawText((LPTSTR)(LPCTSTR)strGridContent, rcGrid, 0, 0, nFormat|FORMAT_UP);
  6701. break;
  6702. }
  6703. else
  6704. {// 字串长度 >= 表格宽度;
  6705. INT nRight = 0; // 字串右位置;
  6706. // 从右边开始逐个字符取出,直到左边字串小于表格宽度;
  6707. while( size.cx > curGrid.Width() )
  6708. {
  6709. nRight++;
  6710. strWrapRow = strGridContent.Left(strGridContent.GetLength() - nRight);
  6711. if( GIsHalfHZ(strWrapRow) )
  6712. {// 判断字串最后一个字符是否是汉字;
  6713. nRight++;
  6714. strWrapRow.Delete(strWrapRow.GetLength() - 1);
  6715. }
  6716. pPrinter->GetStrSize((LPTSTR)(LPCTSTR)strWrapRow, size);
  6717. }
  6718. rcGrid = curGrid;
  6719. rcGrid.top += nWrapRows*nGridFontHeight;
  6720. rcGrid.bottom = rcGrid.top + nGridFontHeight;
  6721. nMaxHeigth = max(nMaxHeigth, rcGrid.bottom);
  6722. pPrinter->DrawText((LPTSTR)(LPCTSTR)strWrapRow, rcGrid, 0, 0, nFormat|FORMAT_UP);
  6723. // 换行加+1;
  6724. nWrapRows++;
  6725. }
  6726. }
  6727. }
  6728. return nMaxHeigth + 1;
  6729. }
  6730. void CMainFrame::PrintReceipt(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  6731. {
  6732. //AfxMessageBox("abce");
  6733. int i = 0;
  6734. int printcot = 1;
  6735. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  6736. {
  6737. g_sendhead.bsql = 0;
  6738. g_sendhead.code[0] = 24;
  6739. g_sendhead.tabcount = 1;
  6740. int g_nYearposTemp = g_nYearpos;
  6741. g_nYearpos = -1;
  6742. g_pMainWnd->ProcessChatMessageRequest2(1);
  6743. g_nYearpos = g_nYearposTemp;
  6744. if (0 == g_bSendOK)return;
  6745. DataToArray(&g_cominfoarray);
  6746. CString SerialNo;
  6747. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6748. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  6749. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6750. CString sql;
  6751. sql.Format("update version set [serialno]='%s'", SerialNo);
  6752. g_sendhead.bsql=1;
  6753. g_nYearposTemp=g_nYearpos;
  6754. g_nYearpos=-1;
  6755. g_pMainWnd->ProcessChatMessageRequest2(sql);
  6756. g_nYearpos=g_nYearposTemp;
  6757. #endif
  6758. // 1.创建打印对象
  6759. CPrintRX m_Print;
  6760. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6761. {
  6762. m_Print.InitToPrint(NULL, 1);
  6763. }
  6764. else
  6765. {
  6766. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  6767. if (name.IsEmpty())
  6768. m_Print.InitToPrint(NULL, 1);
  6769. else
  6770. {
  6771. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6772. if (nret == -1 && aa == 0)
  6773. {
  6774. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6775. }
  6776. }
  6777. }
  6778. // 2.开始打印
  6779. m_Print.StartPrint();
  6780. m_Print.StartPage();
  6781. LoadRect load;
  6782. BOOL bSmall = 0;
  6783. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  6784. {
  6785. bSmall = 1;
  6786. load.SetLiaPath("20.lia");
  6787. }
  6788. else
  6789. load.SetLiaPath("10.lia");
  6790. if (bSmall)
  6791. load.SetMargins(0, 0);
  6792. else
  6793. load.SetMargins(10, 0);
  6794. if (!load.Load())return;
  6795. int rcpos = -1;
  6796. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6797. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  6798. {
  6799. Image *pImg = NULL;
  6800. g_nSendCode = 31;
  6801. int g_nYearposTemp = g_nYearpos;
  6802. g_nYearpos = -1;
  6803. g_pMainWnd->ProcessChatMessageRequest2(1);
  6804. g_nYearpos = g_nYearposTemp;
  6805. g_nSendCode = 0;
  6806. if (g_bSendOK == 0)return;
  6807. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  6808. if (pImg)
  6809. {
  6810. StrRect.left = 65;
  6811. if (bSmall) StrRect.left = 55;
  6812. StrRect.top = 10;
  6813. StrRect.right = StrRect.left + 58;
  6814. StrRect.bottom = StrRect.top + 58;
  6815. // 3.打印2维码图像;
  6816. m_Print.DrawImage(pImg, StrRect);
  6817. delete pImg;
  6818. pImg = NULL;
  6819. }
  6820. }
  6821. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  6822. if (bSmall)
  6823. {
  6824. m_Print.SetFontFace(18, 1, "黑体");
  6825. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6826. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6827. m_Print.SetFontFace(9, 1, "宋体");
  6828. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6829. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6830. m_Print.SetFontFace(6, 1, "宋体");
  6831. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6832. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6833. m_Print.SetFontFace(9, 1, "宋体");
  6834. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6835. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6836. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6837. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6838. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6839. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6840. int hei = StrRect.Height();
  6841. StrRect.bottom = StrRect.top;
  6842. StrRect.top -= 8;
  6843. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6844. m_Print.SetFontFace(11, 1, "宋体");
  6845. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6846. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6847. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6848. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6849. m_Print.SetFontFace(8, 1, "宋体");
  6850. for (i = 7; i < 24; i++)
  6851. {
  6852. StrRect = load.m_rcarray.ElementAt(i);
  6853. m_Print.DrawRect2(StrRect, 1);
  6854. }
  6855. for (i = 9; i < 24; i++)
  6856. {
  6857. StrRect = load.m_rcarray.ElementAt(i);
  6858. StrRect.left += 2;
  6859. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6860. }
  6861. m_Print.SetFontFace(6, 1, "宋体");
  6862. for (i = 24; i < 26; i++)
  6863. {
  6864. StrRect = load.m_rcarray.ElementAt(i);
  6865. StrRect.left += 2;
  6866. if (i == 24)
  6867. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6868. else
  6869. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6870. }
  6871. // StrRect=load.m_rcarray .ElementAt (27);
  6872. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  6873. }
  6874. else//大单
  6875. {
  6876. // 1.打印表头(蒙娜丽莎收款单)
  6877. m_Print.SetFontFace(20, 1, "黑体");
  6878. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6879. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6880. m_Print.SetFontFace(11, 1, "宋体");
  6881. // 2.打印订单号(NO.20140608-001)
  6882. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6883. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6884. // 3.打印SerialNo(SerialNo.01062)
  6885. int hei = StrRect.Height();
  6886. StrRect.bottom = StrRect.top;
  6887. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6888. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6889. // 4.打印影楼地址信息、电话;
  6890. m_Print.SetFontFace(8, 1, "宋体");
  6891. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6892. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6893. #ifdef LYFZ_VERSION
  6894. m_Print.SetFontFace(9, 1, "宋体");
  6895. #else
  6896. m_Print.SetFontFace(11, 1, "宋体");
  6897. #endif
  6898. // 5.打印客户姓名
  6899. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6900. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6901. // 6.打印客户联系电话
  6902. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6903. #ifdef LYFZ_VERSION
  6904. StrRect.left += 30;
  6905. StrRect.right += 30;
  6906. #endif
  6907. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6908. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6909. // 7.打印开单日期
  6910. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6911. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6912. // 8.打印列字段:收款项目
  6913. m_Print.SetFontFace(13, 1, "宋体");
  6914. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6915. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6916. //printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6917. // 9.打印列字段:金额
  6918. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6919. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6920. //printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6921. // 10.打印列字段:开单人
  6922. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6923. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6924. //printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6925. // 11.画表格-画3列;
  6926. m_Print.SetFontFace(11, 1, "宋体");
  6927. for (i = 7; i < 10; i++)
  6928. {
  6929. StrRect = load.m_rcarray.ElementAt(i);
  6930. m_Print.DrawRect2(StrRect, 1);
  6931. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6932. }
  6933. // 12.打印详细内容
  6934. int dty = 0;
  6935. int dtytemp = 0;
  6936. // for( i=10; i<14; i+=3)
  6937. for (i = 10; i<22; i += 3) // 循环4次,再画
  6938. {
  6939. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  6940. CArray<CRect, CRect>rcarray;
  6941. CStringArray strarray2;
  6942. StrRect = load.m_rcarray.ElementAt(i);
  6943. StrRect.top += dty;
  6944. StrRect.bottom += dty;
  6945. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  6946. {
  6947. StrRect = load.m_rcarray.ElementAt(i - 1);
  6948. StrRect.top += dty;
  6949. StrRect.bottom += dty;
  6950. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  6951. break;
  6952. }
  6953. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  6954. StrRect.left += 2;
  6955. StrRect.right -= 2;
  6956. StrRect.top += 4;
  6957. rcarray.Add(StrRect);
  6958. strarray2.Add(pArray->ElementAt(i));
  6959. // 指定格子宽度,计算字符串占几行(高度).
  6960. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  6961. dtytemp = bottom - StrRect.bottom;
  6962. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  6963. // 重新获取表格大小,并画出表格;
  6964. StrRect = load.m_rcarray.ElementAt(i);
  6965. StrRect.bottom += dtytemp;
  6966. StrRect.top += dty;
  6967. StrRect.bottom += dty;
  6968. m_Print.DrawRect2(StrRect, 1);
  6969. // 获取下一表格大小,并画出表格;
  6970. StrRect = load.m_rcarray.ElementAt(i + 1);
  6971. StrRect.top += dty;
  6972. StrRect.bottom += dty;
  6973. StrRect.bottom += dtytemp;
  6974. m_Print.DrawRect2(StrRect, 1);
  6975. StrRect.left += 2;
  6976. // 打印出金额字段内容
  6977. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6978. //printf("Jeff:%d:%s\n\n",i+1,pArray->ElementAt(i+1));//Jeff Printf;
  6979. StrRect = load.m_rcarray.ElementAt(i + 2);
  6980. StrRect.top += dty;
  6981. StrRect.bottom += dty;
  6982. StrRect.bottom += dtytemp;
  6983. m_Print.DrawRect2(StrRect, 1);
  6984. StrRect.left += 2;
  6985. // 打印开单人字段内容
  6986. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6987. //printf("Jeff:%d:%s\n\n",i+2,pArray->ElementAt(i+2));//Jeff Printf;
  6988. dty += dtytemp;
  6989. }
  6990. //.打印->付款情况 应付 实付 欠款.
  6991. i = 22;
  6992. StrRect = load.m_rcarray.ElementAt(i);
  6993. StrRect.top += dty;
  6994. StrRect.bottom += dty;
  6995. m_Print.DrawRect2(StrRect, 1);
  6996. StrRect.left += 2;
  6997. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6998. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  6999. //.打印->合计人民币(大写):.......
  7000. i = 23;
  7001. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  7002. m_Print.DrawRect2(StrRect, 1);
  7003. StrRect.left += 2;
  7004. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7005. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7006. #ifdef LYFZ_VERSION
  7007. m_Print.SetFontFace(7, 1, "宋体");
  7008. for (i = 24; i < 25; i++)
  7009. {
  7010. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  7011. StrRect.left +=2;
  7012. m_Print.DrawText((LPTSTR)(LPCTSTR)"声明:1.此单作为收据凭证。2.软件免费升级一年服务。3.以上无正当理由定金不退。4.软件加密锁为核心技术,请妥善保管,遗失不补。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7013. }
  7014. #else
  7015. m_Print.SetFontFace(7, 1, "宋体");
  7016. for (i = 24; i < 27; i++)
  7017. {
  7018. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  7019. StrRect.left += 2;
  7020. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7021. }
  7022. #endif
  7023. StrRect = load.m_rcarray.ElementAt(24); StrRect.top += dty; StrRect.bottom += dty;
  7024. hei = StrRect.Height();
  7025. StrRect.top += hei;
  7026. StrRect.bottom += hei;
  7027. StrRect.right += 100;
  7028. StrRect.left += 2;
  7029. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  7030. AutoDraw(m_Print, StrRect, pArray->ElementAt(27), 1.0);
  7031. }
  7032. PrintPreview dlg;
  7033. dlg.m_mode = 3;
  7034. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  7035. dlg.m_pDC = m_Print.GetPDC();
  7036. if (aa == 0)
  7037. {
  7038. if (dlg.DoModal() != IDOK)
  7039. return;
  7040. printcot = dlg.m_num;
  7041. }
  7042. //结束打印
  7043. m_Print.EndPage();
  7044. m_Print.EndPrint();
  7045. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7046. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7047. CString sql;
  7048. sql.Format("update version set [serialno]='%s'", SerialNo);
  7049. g_sendhead.bsql = 1;
  7050. g_nYearposTemp = g_nYearpos;
  7051. g_nYearpos = -1;
  7052. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7053. g_nYearpos = g_nYearposTemp;
  7054. #endif
  7055. }
  7056. }
  7057. /************************************************************************/
  7058. /*
  7059. 函数:PrintRechargeRecord
  7060. 描述:打印会员卡充值记录;
  7061. 参数:
  7062. pArryRechargeRecod[IN]:要打印的数据;
  7063. 返回:
  7064. 注意:
  7065. 示例:
  7066. */
  7067. /************************************************************************/
  7068. void CMainFrame::PrintRechargeRecord(CStringArray *pArryRechargeRecod)
  7069. {
  7070. }
  7071. void CMainFrame::PrintReceipt_01(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  7072. {
  7073. //AfxMessageBox("abce");
  7074. int i = 0;
  7075. int printcot = 1;
  7076. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  7077. {
  7078. g_sendhead.bsql = 0;
  7079. g_sendhead.code[0] = 24;
  7080. g_sendhead.tabcount = 1;
  7081. int g_nYearposTemp = g_nYearpos;
  7082. g_nYearpos = -1;
  7083. g_pMainWnd->ProcessChatMessageRequest2(1);
  7084. g_nYearpos = g_nYearposTemp;
  7085. if (0 == g_bSendOK)return;
  7086. DataToArray(&g_cominfoarray);
  7087. CString SerialNo;
  7088. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7089. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7090. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7091. CString sql;
  7092. sql.Format("update version set [serialno]='%s'", SerialNo);
  7093. g_sendhead.bsql=1;
  7094. g_nYearposTemp=g_nYearpos;
  7095. g_nYearpos=-1;
  7096. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7097. g_nYearpos=g_nYearposTemp;
  7098. #endif
  7099. // 1.创建打印对象
  7100. CPrintRX m_Print;
  7101. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7102. {
  7103. m_Print.InitToPrint(NULL, 1);
  7104. }
  7105. else
  7106. {
  7107. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  7108. if (name.IsEmpty())
  7109. m_Print.InitToPrint(NULL, 1);
  7110. else
  7111. {
  7112. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  7113. if (nret == -1 && aa == 0)
  7114. {
  7115. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  7116. m_Print.InitToPrint(NULL, 1);
  7117. }
  7118. }
  7119. }
  7120. // 2.开始打印
  7121. m_Print.StartPrint();
  7122. m_Print.StartPage();
  7123. LoadRect load;
  7124. BOOL bSmall = 0;
  7125. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  7126. {
  7127. bSmall = 1;
  7128. load.SetLiaPath("20.lia");
  7129. }
  7130. else
  7131. load.SetLiaPath("10.lia");
  7132. if (bSmall)
  7133. load.SetMargins(0, 0);
  7134. else
  7135. load.SetMargins(10, 0);
  7136. if (!load.Load())return;
  7137. int rcpos = -1;
  7138. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7139. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  7140. {
  7141. Image *pImg = NULL;
  7142. g_nSendCode = 31;
  7143. int g_nYearposTemp = g_nYearpos;
  7144. g_nYearpos = -1;
  7145. g_pMainWnd->ProcessChatMessageRequest2(1);
  7146. g_nYearpos = g_nYearposTemp;
  7147. g_nSendCode = 0;
  7148. if (g_bSendOK == 0)return;
  7149. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7150. if (pImg)
  7151. {
  7152. StrRect.left = 65;
  7153. if (bSmall) StrRect.left = 55;
  7154. StrRect.top = 10;
  7155. StrRect.right = StrRect.left + 58;
  7156. StrRect.bottom = StrRect.top + 58;
  7157. // 3.打印2维码图像;
  7158. m_Print.DrawImage(pImg, StrRect);
  7159. delete pImg;
  7160. pImg = NULL;
  7161. }
  7162. }
  7163. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  7164. if (bSmall)
  7165. {
  7166. m_Print.SetFontFace(18, 1, "黑体");
  7167. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7168. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7169. m_Print.SetFontFace(9, 1, "宋体");
  7170. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7171. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7172. m_Print.SetFontFace(6, 1, "宋体");
  7173. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7174. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7175. m_Print.SetFontFace(9, 1, "宋体");
  7176. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7177. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7178. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7179. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7180. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7181. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7182. int hei = StrRect.Height();
  7183. StrRect.bottom = StrRect.top;
  7184. StrRect.top -= 8;
  7185. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7186. m_Print.SetFontFace(11, 1, "宋体");
  7187. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7188. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7189. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7190. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7191. m_Print.SetFontFace(8, 1, "宋体");
  7192. for ( i = 7; i < 24; i++)
  7193. {
  7194. StrRect = load.m_rcarray.ElementAt(i);
  7195. m_Print.DrawRect2(StrRect, 1);
  7196. }
  7197. for (i = 9; i < 24; i++)
  7198. {
  7199. StrRect = load.m_rcarray.ElementAt(i);
  7200. StrRect.left += 2;
  7201. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7202. }
  7203. m_Print.SetFontFace(6, 1, "宋体");
  7204. for (i = 24; i < 26; i++)
  7205. {
  7206. StrRect = load.m_rcarray.ElementAt(i);
  7207. StrRect.left += 2;
  7208. if (i == 24)
  7209. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7210. else
  7211. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7212. }
  7213. // StrRect=load.m_rcarray .ElementAt (27);
  7214. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  7215. }
  7216. else//大单
  7217. {
  7218. // 1.打印表头(蒙娜丽莎收款单)
  7219. m_Print.SetFontFace(20, 1, "黑体");
  7220. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7221. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7222. m_Print.SetFontFace(11, 1, "宋体");
  7223. // 2.打印订单号(NO.20140608-001)
  7224. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7225. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7226. // 3.打印SerialNo(SerialNo.01062)
  7227. int hei = StrRect.Height();
  7228. StrRect.bottom = StrRect.top;
  7229. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7230. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7231. // 4.打印影楼地址信息、电话;
  7232. m_Print.SetFontFace(8, 1, "宋体");
  7233. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7234. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7235. #ifdef LYFZ_VERSION
  7236. m_Print.SetFontFace(9, 1, "宋体");
  7237. #else
  7238. m_Print.SetFontFace(11, 1, "宋体");
  7239. #endif
  7240. // 5.打印客户姓名
  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_LEFT | FORMAT_VCENTER);
  7243. // 6.打印客户联系电话
  7244. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7245. #ifdef LYFZ_VERSION
  7246. StrRect.left += 30;
  7247. StrRect.right += 30;
  7248. #endif
  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. #ifdef LYFZ_VERSION
  7432. m_Print.SetFontFace(7, 1, "宋体");
  7433. for (i = 24; i < 25; i++)
  7434. {
  7435. StrRect = load.m_rcarray.ElementAt(i);
  7436. StrRect.top +=dty;
  7437. StrRect.bottom +=dty;
  7438. StrRect.left +=2;
  7439. m_Print.DrawText((LPTSTR)(LPCTSTR)"声明:1.此单作为收据凭证。2.软件免费升级一年服务。3.以上无正当理由定金不退。4.软件加密锁为核心技术,请妥善保管,遗失不补。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7440. }
  7441. #else
  7442. m_Print.SetFontFace(7, 1, "宋体");
  7443. for (i = 24, j = 29; i < 27; i++, j++)
  7444. {
  7445. StrRect = load.m_rcarray.ElementAt(i);
  7446. StrRect.top += dty;
  7447. StrRect.bottom += dty;
  7448. StrRect.left += 2;
  7449. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7450. }
  7451. #endif
  7452. StrRect = load.m_rcarray.ElementAt(24);
  7453. StrRect.top += dty;
  7454. StrRect.bottom += dty;
  7455. hei = StrRect.Height();
  7456. StrRect.top += hei;
  7457. StrRect.bottom += hei;
  7458. StrRect.right += 100;
  7459. StrRect.left += 2;
  7460. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  7461. AutoDraw(m_Print, StrRect, pArray->ElementAt(32), 1.0);
  7462. }
  7463. PrintPreview dlg;
  7464. dlg.m_mode = 3;
  7465. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  7466. dlg.m_pDC = m_Print.GetPDC();
  7467. if (aa == 0)
  7468. {
  7469. if (dlg.DoModal() != IDOK)
  7470. {
  7471. return;
  7472. }
  7473. printcot = dlg.m_num;
  7474. }
  7475. //结束打印
  7476. m_Print.EndPage();
  7477. m_Print.EndPrint();
  7478. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7479. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7480. CString sql;
  7481. sql.Format("update version set [serialno]='%s'", SerialNo);
  7482. g_sendhead.bsql = 1;
  7483. g_nYearposTemp = g_nYearpos;
  7484. g_nYearpos = -1;
  7485. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7486. g_nYearpos = g_nYearposTemp;
  7487. #endif
  7488. }
  7489. }
  7490. void CMainFrame::PrintReceipt_02(CStringArray *pArray, CPrintRX *pPrinter, const int &nCount, const BOOL bPrintImmediately) // 打印订单*预约收款、预约补款*
  7491. {
  7492. //AfxMessageBox("abce");
  7493. int printcot = 1;
  7494. // for(int aa=0; aa<printcot; aa++) // Jeff, printcot=1....
  7495. // {
  7496. g_sendhead.bsql = 0;
  7497. g_sendhead.code[0] = 24;
  7498. g_sendhead.tabcount = 1;
  7499. int g_nYearposTemp = g_nYearpos;
  7500. g_nYearpos = -1;
  7501. g_pMainWnd->ProcessChatMessageRequest2(1);
  7502. g_nYearpos = g_nYearposTemp;
  7503. if (0 == g_bSendOK)return;
  7504. DataToArray(&g_cominfoarray);
  7505. CString SerialNo;
  7506. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7507. CPrintRX *tagPrinter = NULL;
  7508. if (pPrinter == NULL)
  7509. {
  7510. // 1.创建打印对象
  7511. tagPrinter = new CPrintRX;
  7512. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7513. {
  7514. tagPrinter->InitToPrint(NULL, 1);
  7515. }
  7516. else
  7517. {
  7518. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  7519. if (name.IsEmpty())
  7520. {
  7521. tagPrinter->InitToPrint(NULL, 1);
  7522. }
  7523. else
  7524. {
  7525. int nret = tagPrinter->InitToPrint((char*)(LPCTSTR)name, 1);
  7526. ///if(nret==-1 && aa==0)
  7527. if (nret == -1)
  7528. {
  7529. if (bPrintImmediately == FALSE)
  7530. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  7531. tagPrinter->InitToPrint(NULL, 1);
  7532. }
  7533. }
  7534. }
  7535. // 2.开始打印
  7536. tagPrinter->StartPrint();
  7537. tagPrinter->StartPage();
  7538. }
  7539. else
  7540. {
  7541. //SerialNo.Format ("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126))+1);
  7542. tagPrinter = pPrinter;
  7543. }
  7544. LoadRect load;
  7545. BOOL bSmall = 0;
  7546. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  7547. {
  7548. bSmall = 1;
  7549. load.SetLiaPath("20.lia");
  7550. }
  7551. else
  7552. load.SetLiaPath("10.lia");
  7553. if (bSmall)
  7554. load.SetMargins(0, 0);
  7555. else
  7556. load.SetMargins(10, 0);
  7557. if (!load.Load())return;
  7558. int rcpos = -1;
  7559. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7560. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  7561. {
  7562. Image *pImg = NULL;
  7563. g_nSendCode = 31;
  7564. int g_nYearposTemp = g_nYearpos;
  7565. g_nYearpos = -1;
  7566. g_pMainWnd->ProcessChatMessageRequest2(1);
  7567. g_nYearpos = g_nYearposTemp;
  7568. g_nSendCode = 0;
  7569. if (g_bSendOK == 0)return;
  7570. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7571. if (pImg)
  7572. {
  7573. StrRect.left = 65;
  7574. if (bSmall) StrRect.left = 55;
  7575. StrRect.top = 10;
  7576. StrRect.right = StrRect.left + 58;
  7577. StrRect.bottom = StrRect.top + 58;
  7578. // 3.打印2维码图像;
  7579. tagPrinter->DrawImage(pImg, StrRect);
  7580. delete pImg;
  7581. pImg = NULL;
  7582. }
  7583. }
  7584. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  7585. if (bSmall)
  7586. {
  7587. tagPrinter->SetFontFace(18, 1, "黑体");
  7588. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7589. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7590. tagPrinter->SetFontFace(9, 1, "宋体");
  7591. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7592. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7593. tagPrinter->SetFontFace(6, 1, "宋体");
  7594. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7595. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7596. tagPrinter->SetFontFace(9, 1, "宋体");
  7597. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7598. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7599. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7600. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7601. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7602. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7603. int hei = StrRect.Height();
  7604. StrRect.bottom = StrRect.top;
  7605. StrRect.top -= 8;
  7606. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7607. tagPrinter->SetFontFace(11, 1, "宋体");
  7608. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7609. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7610. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7611. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7612. tagPrinter->SetFontFace(8, 1, "宋体");
  7613. int i = 0;
  7614. for (i = 7; i < 24; i++)
  7615. {
  7616. StrRect = load.m_rcarray.ElementAt(i);
  7617. tagPrinter->DrawRect2(StrRect, 1);
  7618. }
  7619. for (i = 9; i < 24; i++)
  7620. {
  7621. StrRect = load.m_rcarray.ElementAt(i);
  7622. StrRect.left += 2;
  7623. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7624. }
  7625. tagPrinter->SetFontFace(6, 1, "宋体");
  7626. for (i = 24; i < 26; i++)
  7627. {
  7628. StrRect = load.m_rcarray.ElementAt(i);
  7629. StrRect.left += 2;
  7630. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7631. }
  7632. StrRect = load.m_rcarray.ElementAt(22);
  7633. int nH = StrRect.Height();
  7634. int nW = StrRect.Width();
  7635. int nlen = load.m_rcarray.GetSize();
  7636. int nLeft = StrRect.left;
  7637. int j = 0;
  7638. for (i = 27; i<32; i++)
  7639. {
  7640. CRect rct = StrRect;
  7641. if(i == 31)
  7642. {
  7643. rct.top = rct.top + (nH*(j - 1));
  7644. rct.bottom = rct.top + nH;
  7645. rct.left = rct.left + 200;
  7646. rct.right = rct.left + 200;
  7647. }
  7648. else
  7649. {
  7650. rct.top = rct.top + (nH*j);
  7651. rct.bottom = rct.top + nH;
  7652. rct.left = rct.left + 2;
  7653. rct.right = rct.left + 200;
  7654. }
  7655. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), rct, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7656. j++;
  7657. }
  7658. }
  7659. else//大单
  7660. {
  7661. // 1.打印表头(蒙娜丽莎收款单)
  7662. tagPrinter->SetFontFace(20, 1, "黑体");
  7663. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7664. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7665. tagPrinter->SetFontFace(11, 1, "宋体");
  7666. // 2.打印订单号(NO.20140608-001)
  7667. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7668. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7669. // 3.打印SerialNo(SerialNo.01062)
  7670. int hei = StrRect.Height();
  7671. StrRect.bottom = StrRect.top;
  7672. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7673. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7674. // 4.打印影楼地址信息、电话;
  7675. tagPrinter->SetFontFace(8, 1, "宋体");
  7676. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7677. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7678. #ifdef LYFZ_VERSION
  7679. tagPrinter->SetFontFace(9, 1, "宋体");
  7680. #else
  7681. tagPrinter->SetFontFace(11, 1, "宋体");
  7682. #endif
  7683. // 5.打印客户姓名
  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. // 6.打印客户联系电话
  7687. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7688. #ifdef LYFZ_VERSION
  7689. StrRect.left += 30;
  7690. StrRect.right += 30;
  7691. #endif
  7692. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7693. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7694. // 7.打印开单日期
  7695. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7696. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7697. #if 0 // Original Edition
  7698. // 8.打印列字段:收款项目
  7699. tagPrinter->SetFontFace(13, 1, "宋体");
  7700. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7701. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7702. printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7703. // 9.打印列字段:金额
  7704. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7705. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7706. printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7707. // 10.打印列字段:开单人
  7708. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7709. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7710. printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7711. #else
  7712. // 8.打印列字段:收款项目
  7713. tagPrinter->SetFontFace(13, 1, "宋体");
  7714. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7715. StrRect = CRect(66, 85, 280, 105);
  7716. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7717. //m_Print.DrawText("收款项目",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7718. // 8.1 Jeff add:支付方式
  7719. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7720. StrRect = CRect(280, 85, 350, 105);
  7721. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7722. //m_Print.DrawText("支付方式",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7723. // 9.打印列字段:金额
  7724. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7725. StrRect = CRect(350, 85, 442, 105);
  7726. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7727. //m_Print.DrawText("金额",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7728. // 10.打印列字段:开单人
  7729. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7730. StrRect = CRect(442, 85, 535, 105);
  7731. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7732. //m_Print.DrawText("开单人",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7733. //rcpos += 3;
  7734. #endif
  7735. // 11.画表格-画3列;old
  7736. // 11.draw 4 column
  7737. tagPrinter->SetFontFace(11, 1, "宋体");
  7738. int i;
  7739. //for( i=7; i<10; i++)
  7740. //{
  7741. // StrRect=load.m_rcarray.ElementAt(i);
  7742. // m_Print.DrawRect2(StrRect, 1);
  7743. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7744. //}
  7745. tagPrinter->DrawRect2(CRect(66, 85, 280, 105), 1);
  7746. tagPrinter->DrawRect2(CRect(280, 85, 350, 105), 1);
  7747. tagPrinter->DrawRect2(CRect(350, 85, 442, 105), 1);
  7748. tagPrinter->DrawRect2(CRect(442, 85, 535, 105), 1);
  7749. // 12.打印详细内容
  7750. int dty = 0;
  7751. int dtytemp = 0;
  7752. // for( i=10; i<14; i+=3)
  7753. //for( i=10; i<22; i+=3) // 循环4次,再画
  7754. int j = 0;
  7755. for (i = 10, j = 11; i<22; i += 3, j += 4) // 循环4次,再画
  7756. {
  7757. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  7758. CArray<CRect, CRect>rcarray;
  7759. CStringArray strarray2;
  7760. StrRect = load.m_rcarray.ElementAt(i);
  7761. StrRect.top += dty;
  7762. StrRect.bottom += dty;
  7763. StrRect.right -= 70; // Jeff add
  7764. //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;
  7765. /*
  7766. 4次的CRect
  7767. 66,105,350,125
  7768. 66,126,350,146
  7769. 66,147,350,167
  7770. 66,168,350,188
  7771. */
  7772. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  7773. {
  7774. StrRect = load.m_rcarray.ElementAt(i - 1);
  7775. StrRect.top += dty;
  7776. StrRect.bottom += dty;
  7777. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  7778. break;
  7779. }
  7780. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  7781. StrRect.left += 2;
  7782. StrRect.right -= 2;
  7783. StrRect.top += 4;
  7784. rcarray.Add(StrRect);
  7785. //strarray2.Add(pArray->ElementAt(i+1));
  7786. strarray2.Add(pArray->ElementAt(j));
  7787. //printf("Jeff:%d:%s\n\n",j,pArray->ElementAt(j));//Jeff Printf;
  7788. // 指定格子宽度,计算字符串占几行(高度).
  7789. INT bottom = CalcHeight(rcarray, strarray2, tagPrinter, FORMAT_LEFT);
  7790. dtytemp = bottom - StrRect.bottom;
  7791. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7792. // 重新获取表格大小,并画出表格;
  7793. /*
  7794. CRect(66,85,280,105),
  7795. CRect(280,85,350,105)
  7796. CRect(350,85,442,105)
  7797. CRect(442,85,535,105)
  7798. CRect(66,105,350,125),
  7799. CRect(66,126,350,146)
  7800. CRect(66,147,350,167)
  7801. CRect(66,168,350,188)
  7802. */
  7803. // 画收款项目框及打印内容;
  7804. StrRect = load.m_rcarray.ElementAt(i);
  7805. //StrRect=CRect(66,85,280,105);
  7806. StrRect.bottom += dtytemp;
  7807. StrRect.top += dty;
  7808. StrRect.bottom += dty;
  7809. //StrRect.left -= 70; // Jeff add
  7810. StrRect.right -= 70; // Jeff add
  7811. //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;
  7812. tagPrinter->DrawRect2(StrRect, 1);
  7813. // 画支付方式框及打印内容;
  7814. StrRect = load.m_rcarray.ElementAt(i);
  7815. //StrRect=CRect(280,85,350,105);
  7816. StrRect.bottom += dtytemp;
  7817. StrRect.top += dty;
  7818. StrRect.bottom += dty;
  7819. StrRect.left += StrRect.Width() - 70;
  7820. //StrRect.right += 70; // Jeff add
  7821. //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;
  7822. tagPrinter->DrawRect2(StrRect, 1);
  7823. StrRect.left += 2;
  7824. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7825. //printf("Jeff:%d:%s\n\n",j+1,pArray->ElementAt(j+1));//Jeff Printf;
  7826. // 画金额框及打印内容;
  7827. StrRect = load.m_rcarray.ElementAt(i + 1);
  7828. //StrRect=CRect(350,85,442,105);
  7829. StrRect.top += dty;
  7830. StrRect.bottom += dty;
  7831. StrRect.bottom += dtytemp;
  7832. //StrRect.right -= 70; // Jeff add
  7833. //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;
  7834. tagPrinter->DrawRect2(StrRect, 1);
  7835. StrRect.left += 2;
  7836. // 打印出金额字段内容
  7837. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7838. //printf("Jeff:%d:%s\n\n",j+2,pArray->ElementAt(j+2));//Jeff Printf;
  7839. // 画开单人框及打印内容;
  7840. StrRect = load.m_rcarray.ElementAt(i + 2);
  7841. //StrRect=CRect(442,85,535,105);
  7842. StrRect.top += dty;
  7843. StrRect.bottom += dty;
  7844. StrRect.bottom += dtytemp;
  7845. //StrRect.right -= 70; // Jeff add
  7846. //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;
  7847. tagPrinter->DrawRect2(StrRect, 1);
  7848. StrRect.left += 2;
  7849. // 打印开单人字段内容
  7850. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 3), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7851. //printf("Jeff:%d:%s\n\n",j+3,pArray->ElementAt(j+3));//Jeff Printf;
  7852. dty += dtytemp;
  7853. }
  7854. //.打印->付款情况 应付 实付 欠款.
  7855. i = 22;
  7856. j = 27;
  7857. StrRect = load.m_rcarray.ElementAt(i);
  7858. StrRect.top += dty;
  7859. StrRect.bottom += dty;
  7860. tagPrinter->DrawRect2(StrRect, 1);
  7861. StrRect.left += 2;
  7862. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7863. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7864. //.打印->合计人民币(大写):.......
  7865. i = 23;
  7866. j = 28;
  7867. StrRect = load.m_rcarray.ElementAt(i);
  7868. StrRect.top += dty;
  7869. StrRect.bottom += dty;
  7870. tagPrinter->DrawRect2(StrRect, 1);
  7871. StrRect.left += 2;
  7872. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7873. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7874. // 打印总金额;
  7875. #ifdef LYFZ_VERSION
  7876. tagPrinter->SetFontFace(7, 1, "宋体");
  7877. for (i = 24; i < 25; i++)
  7878. {
  7879. StrRect = load.m_rcarray.ElementAt(i);
  7880. StrRect.top +=dty;
  7881. StrRect.bottom +=dty;
  7882. StrRect.left +=2;
  7883. tagPrinter->DrawText((LPTSTR)(LPCTSTR)"声明:1.此单作为收据凭证。2.软件免费升级一年服务。3.以上无正当理由定金不退。4.软件加密锁为核心技术,请妥善保管,遗失不补。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7884. }
  7885. #else
  7886. tagPrinter->SetFontFace(7, 1, "宋体");
  7887. for (i = 24, j = 29; i < 27; i++, j++)
  7888. {
  7889. StrRect = load.m_rcarray.ElementAt(i);
  7890. StrRect.top += dty;
  7891. StrRect.bottom += dty;
  7892. StrRect.left += 2;
  7893. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7894. }
  7895. #endif
  7896. StrRect = load.m_rcarray.ElementAt(24);
  7897. StrRect.top += dty;
  7898. StrRect.bottom += dty;
  7899. hei = StrRect.Height();
  7900. StrRect.top += hei;
  7901. StrRect.bottom += hei;
  7902. StrRect.right += 100;
  7903. StrRect.left += 2;
  7904. StrRect = load.m_rcarray.ElementAt(27);
  7905. StrRect.top += dty;
  7906. StrRect.bottom += dty;
  7907. AutoDraw(*tagPrinter, StrRect, pArray->ElementAt(32), 1.0);
  7908. }
  7909. if (bPrintImmediately == TRUE)
  7910. {
  7911. printcot = nCount;
  7912. ////结束打印
  7913. tagPrinter->EndPage();
  7914. tagPrinter->EndPrint();
  7915. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7916. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7917. CString sql;
  7918. sql.Format("update version set [serialno]='%s'", SerialNo);
  7919. g_sendhead.bsql = 1;
  7920. g_nYearposTemp = g_nYearpos;
  7921. g_nYearpos = -1;
  7922. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7923. g_nYearpos = g_nYearposTemp;
  7924. #endif
  7925. }
  7926. else
  7927. {
  7928. PrintPreview dlg;
  7929. dlg.m_mode = 3;
  7930. tagPrinter->GetWidHei(dlg.m_w, dlg.m_h);
  7931. dlg.m_pDC = tagPrinter->GetPDC();
  7932. //if(aa==0)
  7933. //{
  7934. if (dlg.DoModal() != IDOK)
  7935. {
  7936. return;
  7937. }
  7938. else
  7939. {
  7940. printcot = dlg.m_num;
  7941. //m_Print.deletePrinter();
  7942. for (int i = 0; i < printcot; i++)
  7943. {
  7944. //tagPrinter->EndPage();
  7945. //tagPrinter->m_DC.AbortDoc(); // 结束清空由StartDoc写入的内容;2014-09-15;
  7946. //tagPrinter->m_DC.EndDoc();
  7947. //Sleep(10000);
  7948. //tagPrinter->StartPrint();
  7949. //tagPrinter->NewPage();
  7950. //PrintReceipt_02(pArray,/*tagPrinter*/NULL,printcot,TRUE);
  7951. PrintReceipt_02(pArray, tagPrinter, printcot, TRUE);
  7952. }
  7953. }
  7954. if (tagPrinter) delete tagPrinter;
  7955. //}
  7956. }
  7957. //}
  7958. }
  7959. void CMainFrame::PrintFlowChart(CString strOrderNumber) // 选片打单;
  7960. {
  7961. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(75)))
  7962. {
  7963. // Jeff 使用风格2打印;
  7964. //PrintFlowChart3_20151116(strOrderNumber);
  7965. PrintFlowChart3(strOrderNumber);
  7966. return;
  7967. }
  7968. #ifdef ZHIAI_VERSION
  7969. PrintFlowChart2(strOrderNumber);
  7970. return;
  7971. #endif
  7972. int i = 0;
  7973. int printcot = 1;
  7974. for (int aa = 0; aa < printcot; aa++)
  7975. {
  7976. CPrintRX m_Print;
  7977. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7978. {
  7979. m_Print.InitToPrint(NULL, 1);
  7980. }
  7981. else
  7982. {
  7983. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  7984. if (name.IsEmpty())
  7985. m_Print.InitToPrint(NULL, 1);
  7986. else
  7987. {
  7988. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  7989. if (nret == -1 && aa == 0)
  7990. {
  7991. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  7992. }
  7993. }
  7994. }
  7995. m_Print.StartPrint();
  7996. m_Print.StartPage();
  7997. // CRect StrRect(0,0,560,818);
  7998. LoadRect load;
  7999. load.SetLiaPath("4.lia");
  8000. load.SetMargins(-14, -14);
  8001. if (!load.Load())return;
  8002. LoadRect load2;
  8003. load2.SetMargins(-14, 472 + 27 - 14);
  8004. load2.SetLiaPath("5.lia");
  8005. if (!load2.Load())return;
  8006. //////////////////////////////////////////////////////////////
  8007. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2'";
  8008. g_sendhead.code[0] = 54;
  8009. g_sendhead.code[1] = 223;
  8010. g_sendhead.tabcount = 2;
  8011. g_sendhead.bsql = 0;
  8012. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  8013. CArray<CStringArray, CStringArray>sparray;
  8014. DataToArray(&g_List1array, &sparray);
  8015. CString spno;
  8016. for ( i = 0; i < sparray.GetSize(); i++)
  8017. {
  8018. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8019. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8020. if (sparray.ElementAt(i).ElementAt(5) == "入册" && sparray.ElementAt(i).ElementAt(5) == "入底" && sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8021. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8022. spno += sparray.ElementAt(i).ElementAt(5);
  8023. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  8024. spno += "; ";
  8025. else
  8026. {
  8027. spno += ":";
  8028. spno += sparray.ElementAt(i).ElementAt(6);
  8029. spno += "; ";
  8030. }
  8031. }
  8032. spno += " 加挑:";
  8033. for (i = 0; i < sparray.GetSize(); i++)
  8034. {
  8035. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8036. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8037. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8038. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8039. spno += sparray.ElementAt(i).ElementAt(5);
  8040. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  8041. spno += "; ";
  8042. else
  8043. {
  8044. spno += ":";
  8045. spno += sparray.ElementAt(i).ElementAt(6);
  8046. spno += "; ";
  8047. }
  8048. }
  8049. if (spno.Right(6) == " 加挑:")
  8050. {
  8051. spno = spno.Left(spno.GetLength() - 6);
  8052. }
  8053. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8054. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8055. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8056. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8057. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8058. if (m_urgent.IsEmpty())m_urgent = "否";
  8059. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8060. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8061. // CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  8062. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8063. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8064. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8065. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8066. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8067. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8068. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8069. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8070. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(17) + g_List1array.ElementAt(0).ElementAt(29);
  8071. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8072. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8073. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8074. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8075. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8076. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8077. CString m_sum3;
  8078. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8079. ::ConvertToPrice(m_sum3);
  8080. if (m_money3.IsEmpty())m_money3 = "0";
  8081. // m_money3=m_money3+"/"+m_sum3;
  8082. CString name;
  8083. if (!m_name1.IsEmpty())
  8084. name = m_name1 + ",";
  8085. name += m_name2;
  8086. name.TrimRight(",");
  8087. CString phone;
  8088. if (!m_phone1.IsEmpty())
  8089. phone = m_phone1 + ",";
  8090. phone += m_phone2; phone.TrimRight(",");
  8091. if (IsHasRights2new(31) == 0)
  8092. phone = "***";
  8093. CStringArray strarray;
  8094. strarray.Add(m_urgent);
  8095. strarray.Add(m_ren);
  8096. strarray.Add(m_waiter3);
  8097. strarray.Add(name);
  8098. strarray.Add(m_time2);
  8099. strarray.Add(m_time4);
  8100. strarray.Add(m_money3);
  8101. strarray.Add(m_sum3);
  8102. strarray.Add(m_takezs);
  8103. strarray.Add(m_taoxizs);
  8104. strarray.Add(m_choosezs);
  8105. strarray.Add(strOrderNumber);
  8106. strarray.Add(phone);
  8107. ////////////////////////////////////////////////////////////////
  8108. int rcpos = -1;
  8109. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8110. Image *pImg = NULL;
  8111. #ifdef MNLS_VERSION
  8112. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  8113. #else
  8114. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  8115. #endif
  8116. m_Print.DrawImage(pImg, StrRect);
  8117. delete pImg;
  8118. m_Print.SetFontFace(11, 1, "宋体");
  8119. StrRect = load2.m_rcarray.ElementAt(7);
  8120. StrRect.top = load2.m_rcarray.ElementAt(15).top - 15;
  8121. StrRect.bottom = load2.m_rcarray.ElementAt(15).bottom - 15;
  8122. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  8123. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8124. StrRect.top += 15;
  8125. StrRect.bottom += 15;
  8126. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  8127. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8128. m_Print.SetFontFace(15, 1, "宋体");
  8129. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8130. #ifdef MNLS_VERSION
  8131. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8132. #endif
  8133. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8134. #ifdef MNLS_VERSION
  8135. m_Print.DrawRect(StrRect);
  8136. #endif
  8137. m_Print.SetFontFace(7, 1, "黑体");
  8138. m_Print.SetColor(0xffffff);
  8139. #ifdef MNLS_VERSION
  8140. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8141. #endif
  8142. m_Print.SetColor(0);
  8143. m_Print.SetFontFace(25, 1, "黑体");
  8144. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8145. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8146. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  8147. {
  8148. Image *pImg = NULL;
  8149. g_nSendCode = 31;
  8150. int g_nYearposTemp = g_nYearpos;
  8151. g_nYearpos = -1;
  8152. g_pMainWnd->ProcessChatMessageRequest2(1);
  8153. g_nYearpos = g_nYearposTemp;
  8154. g_nSendCode = 0;
  8155. if (g_bSendOK == 0)return;
  8156. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8157. if (pImg)
  8158. {
  8159. StrRect.left = 450;
  8160. StrRect.top = 22;
  8161. StrRect.right = StrRect.left + 60;
  8162. StrRect.bottom = StrRect.top + 60;
  8163. m_Print.DrawImage(pImg, StrRect);
  8164. delete pImg; pImg = NULL;
  8165. }
  8166. }
  8167. #ifdef CHILD_VERSION
  8168. CString title[13] = { "是否加急:", "接单门市:", \
  8169. "选样人员:", "客人姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  8170. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:"
  8171. };
  8172. #else
  8173. CString title[13] = { "是否加急:", "接单门市:", \
  8174. "选样人员:", "新郎新娘姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  8175. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:" };
  8176. #endif
  8177. m_Print.SetFontFace(12, 1, "宋体");
  8178. for (i = 0; i < 13; i++)
  8179. {
  8180. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8181. if (i < 3)
  8182. m_Print.DrawRect2(StrRect, 0);
  8183. else
  8184. m_Print.DrawRect2(StrRect, 1);
  8185. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8186. }
  8187. for (i = 18; i <= 37; i++)
  8188. {
  8189. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8190. if (i >= 19 && i <= 21)
  8191. m_Print.DrawRect2(StrRect, 2);
  8192. /* else if(i==26)
  8193. {
  8194. CRect rc=StrRect;
  8195. CRect rc2=rc;
  8196. rc.right -=rc2.Width ()/2;
  8197. m_Print.DrawRect2(rc, 1);
  8198. rc2.left +=rc.Width ();
  8199. m_Print.DrawRect2(rc2, 1);
  8200. }*/
  8201. else
  8202. m_Print.DrawRect2(StrRect, 1);
  8203. if (i == 18)
  8204. {
  8205. StrRect.left += 5;
  8206. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8207. }
  8208. }
  8209. //////////////////////////////////////
  8210. rcpos = -1;
  8211. for (i = 0; i < 8; i++)
  8212. {
  8213. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8214. m_Print.DrawRect2(StrRect, 1);
  8215. }
  8216. #ifdef CHILD_VERSION
  8217. CString title2[4] = { "引导师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  8218. #else
  8219. CString title2[4] = { "化妆师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  8220. #endif
  8221. for (i = 0; i < 4; i++)
  8222. {
  8223. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8224. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8225. }
  8226. for (i = 0; i < 4; i++)
  8227. {
  8228. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8229. m_Print.DrawRect2(StrRect, 2);
  8230. }
  8231. StrRect = load2.m_rcarray.ElementAt(11);
  8232. StrRect.top -= 15;
  8233. StrRect.bottom -= 15;
  8234. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客选片签名:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8235. StrRect = load2.m_rcarray.ElementAt(15);
  8236. StrRect.top -= 15;
  8237. StrRect.bottom -= 15;
  8238. m_Print.DrawRect2(StrRect, 2);
  8239. ///////////////////////////////////////////
  8240. for (i = 19; i <= 31; i++)
  8241. {
  8242. StrRect = load.m_rcarray.ElementAt(i - 1);
  8243. StrRect.left += 4;
  8244. if (i == 31)
  8245. {
  8246. if (m_phone1.IsEmpty() == 0 && m_phone2.IsEmpty() == 0)
  8247. {
  8248. StrRect.top += 2;
  8249. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  8250. StrRect.top += 8;
  8251. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8252. }
  8253. else
  8254. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8255. }
  8256. /* else if((i-19)==7)
  8257. {
  8258. CRect rc=StrRect;
  8259. CRect rc2=rc;
  8260. rc.right -=rc2.Width ()/2;
  8261. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8262. rc2.left +=rc.Width ()+3;
  8263. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8264. }*/
  8265. else
  8266. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8267. }
  8268. strarray.RemoveAll();
  8269. strarray.Add(m_waiter2);
  8270. strarray.Add(m_waiter1);
  8271. strarray.Add(m_waiter4);
  8272. for (i = 13; i <= 15; i++)
  8273. {
  8274. StrRect = load2.m_rcarray.ElementAt(i - 1);
  8275. StrRect.left += 4;
  8276. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8277. }
  8278. ///////////spno
  8279. CRect sprc[14];
  8280. for (i = 0; i < 14; i++)
  8281. {
  8282. if (i < 7)
  8283. {
  8284. if (i == 0)
  8285. {
  8286. StrRect = load.m_rcarray.ElementAt(17); StrRect.left += 94; StrRect.right -= 3;
  8287. }
  8288. else
  8289. {
  8290. StrRect = load.m_rcarray.ElementAt(30 + i); StrRect.left += 4; StrRect.right -= 3;
  8291. }
  8292. }
  8293. else
  8294. {
  8295. StrRect = load2.m_rcarray.ElementAt(i - 7); StrRect.left += 4; StrRect.right -= 3;
  8296. }
  8297. sprc[i] = StrRect;
  8298. }
  8299. CString temp, tempspno, tempbz;
  8300. CSize size;
  8301. BOOL bRun = 0;
  8302. int fontsize = 12;
  8303. ll: tempspno = spno;
  8304. tempbz = m_bz;
  8305. m_Print.SetFontFace(fontsize, 1, "宋体");
  8306. for (i = 0; i<14; i++)
  8307. {
  8308. if (!tempspno.IsEmpty())
  8309. {
  8310. temp = tempspno;
  8311. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8312. int right = 0;
  8313. CRect temprc = sprc[i];
  8314. while (size.cx>temprc.Width())
  8315. {
  8316. right++;
  8317. temp = tempspno.Left(tempspno.GetLength() - (right));
  8318. if (GIsHalfHZ(temp))
  8319. {
  8320. right++;
  8321. temp.Delete(temp.GetLength() - 1);
  8322. }
  8323. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8324. }
  8325. if (bRun)
  8326. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8327. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  8328. if (tempspno.IsEmpty())i++;
  8329. }
  8330. else if (!tempbz.IsEmpty())
  8331. {
  8332. temp = tempbz;
  8333. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8334. int right = 0;
  8335. CRect temprc = sprc[i];
  8336. while (size.cx > temprc.Width())
  8337. {
  8338. right++;
  8339. temp = tempbz.Left(tempbz.GetLength() - (right));
  8340. if (GIsHalfHZ(temp))
  8341. {
  8342. right++;
  8343. temp.Delete(temp.GetLength() - 1);
  8344. }
  8345. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8346. }
  8347. if (bRun)
  8348. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8349. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  8350. }
  8351. }
  8352. if (tempspno.IsEmpty() == 0 || tempbz.IsEmpty() == 0)
  8353. {
  8354. fontsize--;
  8355. goto ll;
  8356. }
  8357. if (bRun == 0)
  8358. {
  8359. bRun = 1;
  8360. goto ll;
  8361. }
  8362. PrintPreview dlg;
  8363. dlg.m_mode = 2;
  8364. dlg.m_name = name;
  8365. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8366. dlg.m_pDC = m_Print.GetPDC();
  8367. if (aa == 0)
  8368. {
  8369. if (dlg.DoModal() != IDOK)
  8370. return;
  8371. printcot = dlg.m_num;
  8372. }
  8373. //结束打印
  8374. m_Print.EndPage();
  8375. m_Print.EndPrint();
  8376. }
  8377. }
  8378. void CMainFrame::PrintFlowChart3LKAY(CString strOrderNumber)
  8379. {
  8380. int i = 0;
  8381. int printcot = 1;
  8382. for (int aa = 0; aa < printcot; aa++)
  8383. {
  8384. CPrintRX m_Print;
  8385. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  8386. {
  8387. m_Print.InitToPrint(NULL, 1);
  8388. }
  8389. else
  8390. {
  8391. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  8392. if (name.IsEmpty())
  8393. m_Print.InitToPrint(NULL, 1);
  8394. else
  8395. {
  8396. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8397. if (nret == -1 && aa == 0)
  8398. {
  8399. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8400. }
  8401. }
  8402. }
  8403. m_Print.StartPrint();
  8404. m_Print.StartPage();
  8405. LoadRect load;
  8406. load.SetLiaPath("18.lia");
  8407. load.SetMargins(10, 0);
  8408. if (!load.Load())return;
  8409. CString str;
  8410. int rcpos = -1;
  8411. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8412. m_Print.SetFontFace(25, 1, "宋体");
  8413. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8414. m_Print.SetFontFace(15, 1, "宋体");
  8415. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8416. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8417. m_Print.SetFontFace(9, 1, "宋体");
  8418. //////////////////////////////////////////////////////////////
  8419. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8420. g_sendhead.code[0] = 54;
  8421. g_sendhead.code[1] = 223;
  8422. g_sendhead.code[2] = 52;
  8423. g_sendhead.tabcount = 3;
  8424. g_sendhead.bsql = 0;
  8425. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  8426. CArray<CStringArray, CStringArray>sparray;
  8427. CArray<CStringArray, CStringArray>clientarray;
  8428. DataToArray(&g_List1array, &sparray, &clientarray);
  8429. CString spno;
  8430. CStringArray sparray2;
  8431. for ( i = 0; i < sparray.GetSize(); i++)
  8432. {
  8433. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8434. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8435. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8436. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8437. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8438. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8439. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8440. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8441. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8442. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8443. }
  8444. for (i = 0; i < sparray.GetSize(); i++)
  8445. {
  8446. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8447. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8448. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8449. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8450. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8451. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8452. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8453. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8454. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8455. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8456. }
  8457. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8458. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8459. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8460. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8461. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8462. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8463. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8464. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8465. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8466. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8467. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8468. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8469. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8470. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8471. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8472. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8473. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8474. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8475. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8476. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8477. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8478. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8479. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8480. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8481. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8482. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8483. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8484. CString m_sum3;
  8485. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8486. ::ConvertToPrice(m_sum3);
  8487. if (m_money3.IsEmpty())m_money3 = "0";
  8488. int dty = 0;
  8489. CString name;
  8490. if (!m_name1.IsEmpty())
  8491. name = m_name1 + ",";
  8492. name += m_name2;
  8493. name.TrimRight(",");
  8494. CString phone;
  8495. if (!m_phone1.IsEmpty())
  8496. phone = m_phone1 + ",";
  8497. phone += m_phone2; phone.TrimRight(",");
  8498. if (IsHasRights2new(31) == 0)
  8499. phone = "***";
  8500. CStringArray strarray;
  8501. #ifdef CHILD_VERSION
  8502. if (m_birthday.IsEmpty())
  8503. strarray.Add("姓名/性别");
  8504. else
  8505. strarray.Add("姓名/性别/年龄");
  8506. #else
  8507. strarray.Add("客人姓名");
  8508. #endif
  8509. strarray.Add("电话");
  8510. strarray.Add("单号");
  8511. strarray.Add("套系");
  8512. strarray.Add("选样");
  8513. strarray.Add("余款/加挑");
  8514. strarray.Add("选片/日期");
  8515. #ifdef CHILD_VERSION
  8516. if (m_birthday.IsEmpty())
  8517. strarray.Add(name + "/" + m_sex);
  8518. else
  8519. {
  8520. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8521. m_birthday.Format("%d", year + 1);
  8522. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8523. }
  8524. #else
  8525. strarray.Add(name);
  8526. #endif
  8527. strarray.Add(phone);
  8528. strarray.Add(strOrderNumber);
  8529. strarray.Add(m_taoxiname);
  8530. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8531. strarray.Add(str);
  8532. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8533. strarray.Add(str);
  8534. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8535. for (i = 3; i <= 16; i++)
  8536. {
  8537. StrRect = load.m_rcarray.ElementAt(i - 1);
  8538. if (i < 10)
  8539. {
  8540. m_Print.DrawRect2(StrRect, 1);
  8541. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8542. }
  8543. }
  8544. StrRect = load.m_rcarray.ElementAt(29);
  8545. m_Print.DrawRect2(StrRect, 1);
  8546. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8547. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  8548. {
  8549. Image *pImg = NULL;
  8550. g_nSendCode = 31;
  8551. int g_nYearposTemp = g_nYearpos;
  8552. g_nYearpos = -1;
  8553. g_pMainWnd->ProcessChatMessageRequest2(1);
  8554. g_nYearpos = g_nYearposTemp;
  8555. g_nSendCode = 0;
  8556. if (g_bSendOK == 0)return;
  8557. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8558. if (pImg)
  8559. {
  8560. StrRect.left = 485;
  8561. StrRect.top = 12;
  8562. StrRect.right = StrRect.left + 60;
  8563. StrRect.bottom = StrRect.top + 60;
  8564. m_Print.DrawImage(pImg, StrRect);
  8565. delete pImg; pImg = NULL;
  8566. }
  8567. }
  8568. CArray<CRect, CRect>rcarray;
  8569. CStringArray strarray2;
  8570. for (i = 10; i <= 16; i++)
  8571. {
  8572. StrRect = load.m_rcarray.ElementAt(i - 1);
  8573. StrRect.left += 2;
  8574. StrRect.right -= 2;
  8575. StrRect.top += 2;
  8576. rcarray.Add(StrRect);
  8577. strarray2.Add(strarray.ElementAt(7 + i - 10));
  8578. }
  8579. if (1)
  8580. {
  8581. StrRect = load.m_rcarray.ElementAt(30);
  8582. StrRect.left += 2;
  8583. StrRect.right -= 2;
  8584. StrRect.top += 2;
  8585. rcarray.Add(StrRect);
  8586. strarray2.Add(m_time6 + "/" + m_time5);
  8587. }
  8588. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8589. for (i = 10; i <= 16; i++)
  8590. {
  8591. StrRect = load.m_rcarray.ElementAt(i - 1);
  8592. if (i == 10)
  8593. {
  8594. dty += bottom - StrRect.bottom;
  8595. }
  8596. StrRect.bottom = bottom;
  8597. m_Print.DrawRect2(StrRect, 1);
  8598. }
  8599. if (1)
  8600. {
  8601. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  8602. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  8603. // m_Print.DrawText((LPTSTR)(LPCTSTR)(m_time6+"/"+m_time5), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER );
  8604. }
  8605. m_Print.SetFontFace(15, 1, "宋体");
  8606. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  8607. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8608. m_Print.SetFontFace(9, 1, "宋体");
  8609. strarray.RemoveAll();
  8610. strarray.Add("产品名称");
  8611. strarray.Add("数量");
  8612. strarray.Add("P数");
  8613. strarray.Add("张数");
  8614. strarray.Add("照片编号");
  8615. CArray<CRect, CRect>rc2array;
  8616. int wid = 25;
  8617. for (i = 18; i <= 22; i++)
  8618. {
  8619. StrRect = load.m_rcarray.ElementAt(i - 1);
  8620. if (i == 19)
  8621. {
  8622. StrRect.right = StrRect.left + wid;
  8623. }
  8624. if (i == 20)
  8625. {
  8626. StrRect = load.m_rcarray.ElementAt(i - 2);
  8627. StrRect.left += wid; StrRect.right = StrRect.left;
  8628. StrRect.right += wid;
  8629. }
  8630. if (i == 21)
  8631. {
  8632. StrRect = load.m_rcarray.ElementAt(i - 3);
  8633. StrRect.left += wid * 2; StrRect.right = StrRect.left;
  8634. StrRect.right += wid;
  8635. wid = StrRect.right;
  8636. }
  8637. if (i == 22)
  8638. {
  8639. StrRect = load.m_rcarray.ElementAt(i - 3);
  8640. StrRect.left = wid;
  8641. }
  8642. StrRect.top += dty; StrRect.bottom += dty;
  8643. m_Print.DrawRect2(StrRect, 1);
  8644. StrRect.left += 2;
  8645. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8646. StrRect.left -= 2;
  8647. StrRect.top = StrRect.bottom;
  8648. StrRect.bottom += 18;
  8649. rc2array.Add(StrRect);
  8650. }
  8651. int curypos = 0;
  8652. for (i = 0; i < sparray2.GetSize(); i += 5)
  8653. {
  8654. rcarray.RemoveAll();
  8655. strarray2.RemoveAll();
  8656. int j = 0;
  8657. for ( j = 0; j < 5; j++)
  8658. {
  8659. StrRect = rc2array.ElementAt(j);
  8660. StrRect.left += 2;
  8661. StrRect.right -= 2;
  8662. StrRect.top += 2;
  8663. rcarray.Add(StrRect);
  8664. strarray2.Add(sparray2.ElementAt(i + j));
  8665. }
  8666. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8667. rcarray.RemoveAll();
  8668. for (j = 0; j < 5; j++)
  8669. {
  8670. StrRect = rc2array.ElementAt(j);
  8671. if (j == 0)
  8672. {
  8673. dty += bottom - StrRect.bottom;
  8674. }
  8675. StrRect.bottom = bottom;
  8676. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8677. StrRect.top = StrRect.bottom;
  8678. StrRect.bottom += 18;
  8679. rcarray.Add(StrRect);
  8680. }
  8681. rc2array.RemoveAll();
  8682. rc2array.Copy(rcarray);
  8683. }
  8684. m_Print.SetFontFace(15, 1, "宋体");
  8685. StrRect = load.m_rcarray.ElementAt(20);
  8686. dty = curypos - StrRect.bottom + 35;
  8687. StrRect.top += dty; StrRect.bottom += dty;
  8688. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8689. m_Print.SetFontFace(9, 1, "宋体");
  8690. rcarray.RemoveAll();
  8691. strarray2.RemoveAll();
  8692. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8693. StrRect.left += 2;
  8694. StrRect.right -= 2;
  8695. StrRect.top += 2;
  8696. rcarray.Add(StrRect);
  8697. strarray2.Add(m_bz);
  8698. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8699. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8700. dty += bottom - StrRect.bottom;
  8701. StrRect.bottom = bottom;
  8702. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8703. m_Print.SetFontFace(10, 1, "宋体");
  8704. StrRect = load.m_rcarray.ElementAt(22);
  8705. dty = curypos - StrRect.bottom + 25;
  8706. StrRect.top += dty; StrRect.bottom += dty;
  8707. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  8708. if (m_edit9.IsEmpty())
  8709. {
  8710. m_edit9 = "\
  8711. 经确认后的照片均排入制作流程,\r\n\
  8712. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  8713. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  8714. }
  8715. CString info1, info2, info3;
  8716. int newlinepos = m_edit9.Find("\r\n");
  8717. if (newlinepos != -1)
  8718. {
  8719. info1 = m_edit9.Left(newlinepos);
  8720. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8721. }
  8722. newlinepos = m_edit9.Find("\r\n");
  8723. if (newlinepos != -1)
  8724. {
  8725. info2 = m_edit9.Left(newlinepos);
  8726. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8727. info3 = m_edit9;
  8728. }
  8729. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8730. StrRect = load.m_rcarray.ElementAt(23);
  8731. StrRect.top += dty; StrRect.bottom += dty;
  8732. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8733. StrRect = load.m_rcarray.ElementAt(24);
  8734. StrRect.top += dty; StrRect.bottom += dty;
  8735. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8736. StrRect.top += 15;
  8737. StrRect.bottom += 15;
  8738. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8739. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  8740. StrRect = load.m_rcarray.ElementAt(25);
  8741. StrRect.top += dty - dy;
  8742. StrRect.bottom += dty - dy;
  8743. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8744. StrRect = load.m_rcarray.ElementAt(26);
  8745. StrRect.top += dty - dy;
  8746. StrRect.bottom += dty - dy;
  8747. m_Print.DrawRect2(StrRect, 2);
  8748. StrRect = load.m_rcarray.ElementAt(25);
  8749. StrRect.top += dty + 15 - dy;
  8750. StrRect.bottom += dty + 15 - dy;
  8751. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8752. StrRect = load.m_rcarray.ElementAt(26);
  8753. StrRect.top += dty + 15 - dy;
  8754. StrRect.bottom += dty + 15 - dy;
  8755. m_Print.DrawRect2(StrRect, 2);
  8756. StrRect = load.m_rcarray.ElementAt(25);
  8757. StrRect.top += dty + 15 * 2 - dy;
  8758. StrRect.bottom += dty + 15 * 2 - dy;
  8759. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8760. StrRect = load.m_rcarray.ElementAt(26);
  8761. StrRect.top += dty + 15 * 2 - dy;
  8762. StrRect.bottom += dty + 15 * 2 - dy;
  8763. m_Print.DrawRect2(StrRect, 2);
  8764. PrintPreview dlg; dlg.m_mode = 2;
  8765. dlg.m_name = name;
  8766. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8767. dlg.m_pDC = m_Print.GetPDC();
  8768. if (aa == 0)
  8769. {
  8770. if (dlg.DoModal() != IDOK)
  8771. return;
  8772. printcot = dlg.m_num;
  8773. }
  8774. //结束打印
  8775. m_Print.EndPage();
  8776. m_Print.EndPrint();
  8777. }
  8778. }
  8779. void CMainFrame::PrintFlowChart3(CString strOrderNumber) // 选片打单 风格2;
  8780. {
  8781. #ifdef LKAY_VERSION
  8782. PrintFlowChart3LKAY(strOrderNumber);
  8783. return;
  8784. #endif
  8785. int i = 0;
  8786. int j = 0;
  8787. int printcot = 1;
  8788. for (int aa = 0; aa < printcot; aa++)
  8789. {
  8790. BOOL bSecondPage = 0;
  8791. int nPrintedPos = 0;
  8792. for (int bb = 0; bb < 2; bb++)
  8793. {
  8794. if (bb && bSecondPage == 0)break;
  8795. CPrintRX m_Print;
  8796. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58))) // 58-[version].[setcheck1] ==1,使用默认打印机;
  8797. {
  8798. m_Print.InitToPrint(NULL, 1);
  8799. }
  8800. else // 否则使用指定的打印机;
  8801. {
  8802. CString name = g_cominfoarray.ElementAt(0).ElementAt(64); // 64-[version].[printer2] 制作单打印机;
  8803. if (name.IsEmpty())
  8804. m_Print.InitToPrint(NULL, 1);
  8805. else
  8806. {
  8807. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8808. if (nret == -1 && aa == 0)
  8809. {
  8810. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8811. }
  8812. }
  8813. }
  8814. m_Print.StartPrint();
  8815. m_Print.StartPage();
  8816. LoadRect load;
  8817. load.SetLiaPath("18.lia");
  8818. load.SetMargins(10, 0);
  8819. if (!load.Load())return;
  8820. CString str;
  8821. int rcpos = -1;
  8822. // ■■■■■■从18.lia获取到第一个区域大小 - 1.显示店名;
  8823. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8824. if ((bb == 0 && bSecondPage == 0))
  8825. {
  8826. m_Print.SetFontFace(25, 1, "宋体");
  8827. // 10-[version].[info1] 店名;
  8828. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8829. m_Print.SetFontFace(15, 1, "宋体");
  8830. // ■■■■■■从18.lia获取第二个区域大小 - 2.显示"基本资料";
  8831. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8832. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8833. m_Print.SetFontFace(9, 1, "宋体");
  8834. }
  8835. //////////////////////////////////////////////////////////////
  8836. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8837. g_sendhead.code[0] = 54; // dindan;
  8838. g_sendhead.code[1] = 223; // dindanspview2; shangpin+dindansp;
  8839. g_sendhead.code[2] = 52; // client;
  8840. g_sendhead.tabcount = 3;
  8841. g_sendhead.bsql = 0;
  8842. g_pMainWnd->ProcessChatMessageRequest2(filter);
  8843. if (g_bSendOK == 0)return;
  8844. CArray<CStringArray, CStringArray>sparray;
  8845. CArray<CStringArray, CStringArray>clientarray;
  8846. DataToArray(&g_List1array, &sparray, &clientarray);
  8847. CString spno;
  8848. CStringArray sparray2;
  8849. for ( i = 0; i < sparray.GetSize(); i++)
  8850. {
  8851. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8852. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8853. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8854. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8855. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8856. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8857. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8858. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8859. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8860. }
  8861. for (i = 0; i < sparray.GetSize(); i++)
  8862. {
  8863. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8864. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8865. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8866. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8867. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8868. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8869. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8870. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8871. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8872. }
  8873. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8874. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8875. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8876. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8877. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8878. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8879. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8880. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8881. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8882. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8883. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8884. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8885. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8886. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8887. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8888. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8889. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8890. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8891. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  8892. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8893. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8894. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8895. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8896. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8897. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8898. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8899. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8900. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8901. CString m_sum3;
  8902. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8903. ::ConvertToPrice(m_sum3);
  8904. if (m_money3.IsEmpty())m_money3 = "0";
  8905. int dty = 0;
  8906. CString name;
  8907. if (!m_name1.IsEmpty())
  8908. name = m_name1 + ",";
  8909. name += m_name2;
  8910. name.TrimRight(",");
  8911. CString phone;
  8912. if (!m_phone1.IsEmpty())
  8913. phone = m_phone1 + ",";
  8914. phone += m_phone2; phone.TrimRight(",");
  8915. if (IsHasRights2new(31) == 0)
  8916. phone = "***";
  8917. CStringArray strarray;
  8918. CArray<CRect, CRect>rcarray;
  8919. CStringArray strarray2; CArray<CRect, CRect>rc2array;
  8920. int bottom;
  8921. if ((bb == 0 && bSecondPage == 0))
  8922. {
  8923. #ifdef CHILD_VERSION
  8924. if (m_birthday.IsEmpty())
  8925. strarray.Add("姓名/性别");
  8926. else
  8927. strarray.Add("姓名/性别/年龄");
  8928. #else
  8929. strarray.Add("客人姓名"); // 第3.1区域 -3.显示客人姓名;
  8930. #endif
  8931. strarray.Add("电话");
  8932. strarray.Add("单号");
  8933. strarray.Add("套系");
  8934. strarray.Add("选样");
  8935. strarray.Add("余款/加挑");
  8936. strarray.Add("选片/日期");
  8937. #ifdef CHILD_VERSION
  8938. if (m_birthday.IsEmpty())
  8939. strarray.Add(name + "/" + m_sex);
  8940. else
  8941. {
  8942. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8943. m_birthday.Format("%d", year + 1);
  8944. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8945. }
  8946. #else
  8947. strarray.Add(name); // 第4.1区域 -3.显示客人姓名;
  8948. #endif
  8949. strarray.Add(phone);
  8950. strarray.Add(strOrderNumber);
  8951. strarray.Add(m_taoxiname);
  8952. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8953. strarray.Add(str);
  8954. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8955. strarray.Add(str);
  8956. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8957. for (i = 3; i <= 16; i++)
  8958. {
  8959. // ■■■■■■从18.lia中获取第3~16的区域大小;
  8960. StrRect = load.m_rcarray.ElementAt(i - 1);
  8961. if (i < 10)
  8962. {
  8963. m_Print.DrawRect2(StrRect, 1);
  8964. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8965. }
  8966. }
  8967. // ■■■■■■从18.lia中获取第30的区域大小;
  8968. StrRect = load.m_rcarray.ElementAt(29);
  8969. m_Print.DrawRect2(StrRect, 1);
  8970. BOOL bPrintDate = 1;
  8971. #ifdef DDF_VERSION
  8972. // bPrintDate=0;
  8973. #else
  8974. if (m_time5 == "" && m_time6 == "")
  8975. bPrintDate = 0;
  8976. #endif
  8977. if (bPrintDate)
  8978. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8979. else
  8980. {
  8981. #ifdef CHILD_VERSION
  8982. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/引导", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8983. #else
  8984. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/化妆", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8985. #endif
  8986. }
  8987. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138))) // [version].[reverse3]
  8988. {
  8989. Image *pImg = NULL;
  8990. g_nSendCode = 31;
  8991. int g_nYearposTemp = g_nYearpos;
  8992. g_nYearpos = -1;
  8993. g_pMainWnd->ProcessChatMessageRequest2(1);
  8994. g_nYearpos = g_nYearposTemp;
  8995. g_nSendCode = 0;
  8996. if (g_bSendOK == 0)return;
  8997. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8998. // Jeff二维码的区域不是从18.lia里获取的,是固定在右上角指定区域;
  8999. if (pImg)
  9000. {
  9001. StrRect.left = 485;
  9002. StrRect.top = 12;
  9003. StrRect.right = StrRect.left + 60;
  9004. StrRect.bottom = StrRect.top + 60;
  9005. m_Print.DrawImage(pImg, StrRect);
  9006. delete pImg; pImg = NULL;
  9007. }
  9008. }
  9009. // CArray<CRect,CRect>rcarray;
  9010. // CStringArray strarray2;
  9011. // ■■■■■■从18.lia中获取第10的区域大小;
  9012. for (i = 10; i <= 16; i++)
  9013. {
  9014. StrRect = load.m_rcarray.ElementAt(i - 1);
  9015. StrRect.left += 2;
  9016. StrRect.right -= 2;
  9017. StrRect.top += 2;
  9018. rcarray.Add(StrRect);
  9019. strarray2.Add(strarray.ElementAt(7 + i - 10));
  9020. }
  9021. if (1)
  9022. {
  9023. // ■■■■■■从18.lia中获取第31的区域大小;
  9024. StrRect = load.m_rcarray.ElementAt(30);
  9025. StrRect.left += 2;
  9026. StrRect.right -= 2;
  9027. StrRect.top += 2;
  9028. rcarray.Add(StrRect);
  9029. if (bPrintDate)
  9030. strarray2.Add(m_time6 + "/" + m_time5);
  9031. else
  9032. {
  9033. strarray2.Add(m_waiter1 + "/" + m_waiter2);
  9034. }
  9035. }
  9036. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  9037. for (i = 10; i <= 16; i++)
  9038. {
  9039. StrRect = load.m_rcarray.ElementAt(i - 1);
  9040. if (i == 10)
  9041. {
  9042. dty += bottom - StrRect.bottom;
  9043. }
  9044. StrRect.bottom = bottom;
  9045. m_Print.DrawRect2(StrRect, 1);
  9046. }
  9047. if (1)
  9048. {
  9049. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  9050. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  9051. }
  9052. m_Print.SetFontFace(15, 1, "宋体");
  9053. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  9054. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9055. }
  9056. int curypos = 0;
  9057. int oldpos = 0;
  9058. if (bb == 1)
  9059. {
  9060. dty = -100;
  9061. oldpos = nPrintedPos;
  9062. if (oldpos == 0)oldpos = 10000;
  9063. }
  9064. m_Print.SetFontFace(9, 1, "宋体");
  9065. strarray.RemoveAll();
  9066. if ((oldpos != 10000 && oldpos < sparray2.GetSize()) || bb == 0)
  9067. {
  9068. strarray.Add("产品名称");
  9069. strarray.Add("数量");
  9070. strarray.Add("照片编号");
  9071. for (i = 18; i <= 20; i++)
  9072. {
  9073. StrRect = load.m_rcarray.ElementAt(i - 1);
  9074. StrRect.top += dty;
  9075. StrRect.bottom += dty;
  9076. m_Print.DrawRect2(StrRect, 1);
  9077. StrRect.left += 2;
  9078. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9079. StrRect.left -= 2;
  9080. StrRect.top = StrRect.bottom;
  9081. StrRect.bottom += 18;
  9082. rc2array.Add(StrRect);
  9083. }
  9084. }
  9085. for (i = oldpos; i < sparray2.GetSize(); i += 3)
  9086. {
  9087. rcarray.RemoveAll();
  9088. strarray2.RemoveAll();
  9089. for ( j = 0; j < 3; j++)
  9090. {
  9091. StrRect = rc2array.ElementAt(j);
  9092. StrRect.left += 2;
  9093. StrRect.right -= 2;
  9094. StrRect.top += 2;
  9095. rcarray.Add(StrRect);
  9096. #if JEFF_TEST_ON
  9097. if (2 == j)
  9098. {
  9099. CString strImg = sparray2.ElementAt(i + 2);
  9100. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  9101. if (nImgCount != 0)
  9102. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  9103. else if (!strImg.IsEmpty())
  9104. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  9105. strarray2.Add(strImg);
  9106. }
  9107. else
  9108. strarray2.Add(sparray2.ElementAt(i + j));
  9109. #else
  9110. strarray2.Add(sparray2.ElementAt(i + j));
  9111. #endif
  9112. }
  9113. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9114. rcarray.RemoveAll();
  9115. for (j = 0; j < 3; j++)
  9116. {
  9117. StrRect = rc2array.ElementAt(j);
  9118. if (j == 0)
  9119. {
  9120. dty += bottom - StrRect.bottom;
  9121. }
  9122. StrRect.bottom = bottom;
  9123. m_Print.DrawRect2(StrRect, 1);
  9124. curypos = StrRect.bottom;
  9125. StrRect.top = StrRect.bottom;
  9126. StrRect.bottom += 18;
  9127. rcarray.Add(StrRect);
  9128. }
  9129. rc2array.RemoveAll();
  9130. rc2array.Copy(rcarray);
  9131. if (bottom > 750)
  9132. {
  9133. bSecondPage = 1;
  9134. nPrintedPos = i + 3;
  9135. break;
  9136. }
  9137. }
  9138. if ((bb == 0 && bSecondPage == 0) || (bb == 1 && bSecondPage == 1))
  9139. {
  9140. m_Print.SetFontFace(15, 1, "宋体");
  9141. StrRect = load.m_rcarray.ElementAt(20);
  9142. dty = curypos - StrRect.bottom + 35;
  9143. StrRect.top += dty;
  9144. StrRect.bottom += dty;
  9145. if (StrRect.bottom > 700 && bb == 0)
  9146. {
  9147. bSecondPage = 1;
  9148. }
  9149. else
  9150. {
  9151. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9152. m_Print.SetFontFace(9, 1, "宋体");
  9153. rcarray.RemoveAll();
  9154. strarray2.RemoveAll();
  9155. StrRect = load.m_rcarray.ElementAt(21);
  9156. StrRect.top += dty;
  9157. StrRect.bottom += dty;
  9158. StrRect.left += 2;
  9159. StrRect.right -= 2;
  9160. StrRect.top += 2;
  9161. rcarray.Add(StrRect);
  9162. #if JEFF_TEST_ON
  9163. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9164. strarray2.RemoveAll();
  9165. CString strFind = "要求:";
  9166. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  9167. do
  9168. {
  9169. int nIndex = strbz3.Find(strFind, 1);
  9170. if (nIndex != -1)
  9171. {
  9172. CString strbz = strbz3.Left(nIndex);
  9173. strbz3 = strbz3.Mid(nIndex);
  9174. strarray2.Add(strbz);
  9175. }
  9176. else
  9177. {
  9178. strarray2.Add(strbz3);
  9179. strbz3 = "";
  9180. }
  9181. } while (strbz3.Find(strFind) != -1);
  9182. strarray2.Add(g_List1array.ElementAt(0).ElementAt(29));
  9183. strarray2.Add(g_List1array.ElementAt(0).ElementAt(23));
  9184. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  9185. #else
  9186. strarray2.Add(m_bz);
  9187. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9188. #endif
  9189. StrRect = load.m_rcarray.ElementAt(21);
  9190. StrRect.top += dty;
  9191. StrRect.bottom += dty;
  9192. dty += bottom - StrRect.bottom;
  9193. StrRect.bottom = bottom;
  9194. m_Print.DrawRect2(StrRect, 1);
  9195. curypos = StrRect.bottom;
  9196. m_Print.SetFontFace(10, 1, "宋体");
  9197. StrRect = load.m_rcarray.ElementAt(22);
  9198. dty = curypos - StrRect.bottom + 25;
  9199. StrRect.top += dty;
  9200. StrRect.bottom += dty;
  9201. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  9202. if (m_edit9.IsEmpty())
  9203. {
  9204. m_edit9 = "\
  9205. 经确认后的照片均排入制作流程,\r\n\
  9206. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9207. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9208. }
  9209. CString info1, info2, info3;
  9210. int newlinepos = m_edit9.Find("\r\n");
  9211. if (newlinepos != -1)
  9212. {
  9213. info1 = m_edit9.Left(newlinepos);
  9214. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9215. }
  9216. newlinepos = m_edit9.Find("\r\n");
  9217. if (newlinepos != -1)
  9218. {
  9219. info2 = m_edit9.Left(newlinepos);
  9220. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9221. info3 = m_edit9;
  9222. }
  9223. #ifdef QCH_VERSION
  9224. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9225. StrRect = load.m_rcarray.ElementAt(23);
  9226. StrRect.top += dty; StrRect.bottom += dty;
  9227. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9228. StrRect=load.m_rcarray .ElementAt (24);
  9229. StrRect.top +=dty;StrRect.bottom +=dty;
  9230. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9231. StrRect.top +=15;
  9232. StrRect.bottom +=15;
  9233. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9234. #else
  9235. if (1)
  9236. {
  9237. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9238. StrRect = load.m_rcarray.ElementAt(23);
  9239. StrRect.top += dty; StrRect.bottom += dty;
  9240. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9241. StrRect = load.m_rcarray.ElementAt(24);
  9242. StrRect.top += dty; StrRect.bottom += dty;
  9243. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9244. }
  9245. else
  9246. {
  9247. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9248. StrRect = load.m_rcarray.ElementAt(23);
  9249. StrRect.top += dty; StrRect.bottom += dty;
  9250. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9251. StrRect = load.m_rcarray.ElementAt(24);
  9252. StrRect.top += dty; StrRect.bottom += dty;
  9253. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9254. }
  9255. StrRect.top += 15;
  9256. StrRect.bottom += 15;
  9257. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9258. #endif
  9259. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  9260. StrRect = load.m_rcarray.ElementAt(25);
  9261. StrRect.top += dty - dy;
  9262. StrRect.bottom += dty - dy;
  9263. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9264. StrRect = load.m_rcarray.ElementAt(26);
  9265. StrRect.top += dty - dy;
  9266. StrRect.bottom += dty - dy;
  9267. m_Print.DrawRect2(StrRect, 2);
  9268. StrRect = load.m_rcarray.ElementAt(25);
  9269. StrRect.top += dty + 15 - dy;
  9270. StrRect.bottom += dty + 15 - dy;
  9271. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9272. StrRect = load.m_rcarray.ElementAt(26);
  9273. StrRect.top += dty + 15 - dy;
  9274. StrRect.bottom += dty + 15 - dy;
  9275. m_Print.DrawRect2(StrRect, 2);
  9276. StrRect = load.m_rcarray.ElementAt(25);
  9277. StrRect.top += dty + 15 * 2 - dy;
  9278. StrRect.bottom += dty + 15 * 2 - dy;
  9279. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9280. StrRect = load.m_rcarray.ElementAt(26);
  9281. StrRect.top += dty + 15 * 2 - dy;
  9282. StrRect.bottom += dty + 15 * 2 - dy;
  9283. m_Print.DrawRect2(StrRect, 2);
  9284. }
  9285. }
  9286. PrintPreview dlg; dlg.m_mode = 2;
  9287. dlg.m_name = name;
  9288. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  9289. dlg.m_pDC = m_Print.GetPDC();
  9290. if (aa == 0)
  9291. {
  9292. if (dlg.DoModal() != IDOK)
  9293. return;
  9294. printcot = dlg.m_num;
  9295. }
  9296. //结束打印
  9297. m_Print.EndPage();
  9298. m_Print.EndPrint();
  9299. }
  9300. }
  9301. }
  9302. void CMainFrame::PrintFlowChart3_20151116(CString strOrderNumber) // 选片打单 风格2;
  9303. {
  9304. #ifdef LKAY_VERSION
  9305. PrintFlowChart3LKAY(strOrderNumber);
  9306. return;
  9307. #endif
  9308. int i = 0;
  9309. int j = 0;
  9310. int printcot = 1;
  9311. for (int aa = 0; aa < printcot; aa++)
  9312. {
  9313. BOOL bSecondPage = 0;
  9314. int nPrintedPos = 0;
  9315. for (int bb = 0; bb < 3; bb++)
  9316. {
  9317. if (bb && bSecondPage == 0)break;
  9318. CPrintRX m_Print;
  9319. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58))) // 58-[version].[setcheck1] ==1,使用默认打印机;
  9320. {
  9321. m_Print.InitToPrint(NULL, 1);
  9322. }
  9323. else // 否则使用指定的打印机;
  9324. {
  9325. CString name = g_cominfoarray.ElementAt(0).ElementAt(64); // 64-[version].[printer2] 制作单打印机;
  9326. if (name.IsEmpty())
  9327. m_Print.InitToPrint(NULL, 1);
  9328. else
  9329. {
  9330. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9331. if (nret == -1 && aa == 0)
  9332. {
  9333. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9334. }
  9335. }
  9336. }
  9337. m_Print.StartPrint();
  9338. m_Print.StartPage();
  9339. LoadRect load;
  9340. load.SetLiaPath("18.lia");
  9341. load.SetMargins(10, 0);
  9342. if (!load.Load())return;
  9343. CString str;
  9344. int rcpos = -1;
  9345. // ■■■■■■从18.lia获取到第一个区域大小 - 1.显示店名;
  9346. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  9347. if ((bb == 0 && bSecondPage == 0))
  9348. {
  9349. m_Print.SetFontFace(25, 1, "宋体");
  9350. // 10-[version].[info1] 店名;
  9351. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9352. m_Print.SetFontFace(15, 1, "宋体");
  9353. // ■■■■■■从18.lia获取第二个区域大小 - 2.显示"基本资料";
  9354. StrRect = load.m_rcarray.ElementAt(++rcpos);
  9355. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9356. m_Print.SetFontFace(9, 1, "宋体");
  9357. }
  9358. //////////////////////////////////////////////////////////////////////////
  9359. // 获取打印所需要的数据,并布局好;
  9360. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  9361. g_sendhead.code[0] = 54; // dindan;
  9362. g_sendhead.code[1] = 223; // dindanspview2; shangpin+dindansp;
  9363. g_sendhead.code[2] = 52; // client;
  9364. g_sendhead.tabcount = 3;
  9365. g_sendhead.bsql = 0;
  9366. g_pMainWnd->ProcessChatMessageRequest2(filter);
  9367. if (g_bSendOK == 0)return;
  9368. CArray<CStringArray, CStringArray>sparray;
  9369. CArray<CStringArray, CStringArray>clientarray;
  9370. DataToArray(&g_List1array, &sparray, &clientarray);
  9371. CString spno;
  9372. CStringArray sparray2;
  9373. for ( i = 0; i < sparray.GetSize(); i++)
  9374. {
  9375. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  9376. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  9377. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  9378. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9379. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  9380. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9381. sparray2.Add(sparray.ElementAt(i).ElementAt(5)); // 商品名称;
  9382. sparray2.Add(sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  9383. sparray2.Add(sparray.ElementAt(i).ElementAt(6)); // 选中的相片串;
  9384. sparray2.Add(sparray.ElementAt(i).ElementAt(10)); // 商品备注;
  9385. }
  9386. for (i = 0; i < sparray.GetSize(); i++)
  9387. {
  9388. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  9389. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  9390. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  9391. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9392. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  9393. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9394. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+"); // 商品名称;
  9395. sparray2.Add(sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  9396. sparray2.Add(sparray.ElementAt(i).ElementAt(6)); // 选中的相片串;
  9397. sparray2.Add(sparray.ElementAt(i).ElementAt(10)); // 商品备注;
  9398. }
  9399. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  9400. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  9401. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  9402. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  9403. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  9404. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  9405. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  9406. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  9407. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  9408. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  9409. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  9410. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  9411. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  9412. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  9413. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  9414. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  9415. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  9416. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  9417. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9418. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  9419. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  9420. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  9421. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  9422. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  9423. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  9424. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  9425. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  9426. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  9427. CString m_sum3;
  9428. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  9429. ::ConvertToPrice(m_sum3);
  9430. if (m_money3.IsEmpty())m_money3 = "0";
  9431. int dty = 0;
  9432. CString name;
  9433. if (!m_name1.IsEmpty())
  9434. name = m_name1 + ",";
  9435. name += m_name2;
  9436. name.TrimRight(",");
  9437. CString phone;
  9438. if (!m_phone1.IsEmpty())
  9439. phone = m_phone1 + ",";
  9440. phone += m_phone2; phone.TrimRight(",");
  9441. if (IsHasRights2new(31) == 0)
  9442. phone = "***";
  9443. CStringArray strarray;
  9444. CArray<CRect, CRect>rcarray;
  9445. CStringArray strarray2; CArray<CRect, CRect>rc2array;
  9446. int bottom;
  9447. //////////////////////////////////////////////////////////////////////////
  9448. // 开始画打印DC;
  9449. if ((bb == 0 && bSecondPage == 0))
  9450. {
  9451. #ifdef CHILD_VERSION
  9452. if (m_birthday.IsEmpty())
  9453. strarray.Add("姓名/性别");
  9454. else
  9455. strarray.Add("姓名/性别/年龄");
  9456. #else
  9457. strarray.Add("客人姓名"); // 第3.1区域 -3.显示客人姓名;
  9458. #endif
  9459. strarray.Add("电话");
  9460. strarray.Add("单号");
  9461. strarray.Add("套系");
  9462. strarray.Add("选样");
  9463. strarray.Add("余款/加挑");
  9464. strarray.Add("选片/日期");
  9465. #ifdef CHILD_VERSION
  9466. if (m_birthday.IsEmpty())
  9467. strarray.Add(name + "/" + m_sex);
  9468. else
  9469. {
  9470. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  9471. m_birthday.Format("%d", year + 1);
  9472. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  9473. }
  9474. #else
  9475. strarray.Add(name); // 第4.1区域 -3.显示客人姓名;
  9476. #endif
  9477. strarray.Add(phone);
  9478. strarray.Add(strOrderNumber);
  9479. strarray.Add(m_taoxiname);
  9480. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9481. strarray.Add(str);
  9482. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  9483. strarray.Add(str);
  9484. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  9485. for (i = 3; i <= 16; i++)
  9486. {
  9487. // ■■■■■■从18.lia中获取第3~16的区域大小;
  9488. StrRect = load.m_rcarray.ElementAt(i - 1);
  9489. if (i < 10)
  9490. {
  9491. m_Print.DrawRect2(StrRect, 1);
  9492. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9493. }
  9494. }
  9495. // ■■■■■■从18.lia中获取第30的区域大小;
  9496. StrRect = load.m_rcarray.ElementAt(29);
  9497. m_Print.DrawRect2(StrRect, 1);
  9498. BOOL bPrintDate = 1;
  9499. #ifdef DDF_VERSION
  9500. // bPrintDate=0;
  9501. #else
  9502. if (m_time5 == "" && m_time6 == "")
  9503. bPrintDate = 0;
  9504. #endif
  9505. if (bPrintDate)
  9506. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9507. else
  9508. {
  9509. #ifdef CHILD_VERSION
  9510. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/引导", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9511. #else
  9512. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/化妆", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9513. #endif
  9514. }
  9515. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138))) // [version].[reverse3]
  9516. {
  9517. Image *pImg = NULL;
  9518. g_nSendCode = 31;
  9519. int g_nYearposTemp = g_nYearpos;
  9520. g_nYearpos = -1;
  9521. g_pMainWnd->ProcessChatMessageRequest2(1);
  9522. g_nYearpos = g_nYearposTemp;
  9523. g_nSendCode = 0;
  9524. if (g_bSendOK == 0)return;
  9525. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  9526. // Jeff二维码的区域不是从18.lia里获取的,是固定在右上角指定区域;
  9527. if (pImg)
  9528. {
  9529. StrRect.left = 485;
  9530. StrRect.top = 12;
  9531. StrRect.right = StrRect.left + 60;
  9532. StrRect.bottom = StrRect.top + 60;
  9533. m_Print.DrawImage(pImg, StrRect);
  9534. delete pImg; pImg = NULL;
  9535. }
  9536. }
  9537. // CArray<CRect,CRect>rcarray;
  9538. // CStringArray strarray2;
  9539. // ■■■■■■从18.lia中获取第10的区域大小;
  9540. for (i = 10; i <= 16; i++)
  9541. {
  9542. StrRect = load.m_rcarray.ElementAt(i - 1);
  9543. StrRect.left += 2;
  9544. StrRect.right -= 2;
  9545. StrRect.top += 2;
  9546. rcarray.Add(StrRect);
  9547. strarray2.Add(strarray.ElementAt(7 + i - 10));
  9548. }
  9549. if (1)
  9550. {
  9551. // ■■■■■■从18.lia中获取第31的区域大小;
  9552. StrRect = load.m_rcarray.ElementAt(30);
  9553. StrRect.left += 2;
  9554. StrRect.right -= 2;
  9555. StrRect.top += 2;
  9556. rcarray.Add(StrRect);
  9557. if (bPrintDate)
  9558. strarray2.Add(m_time6 + "/" + m_time5);
  9559. else
  9560. {
  9561. strarray2.Add(m_waiter1 + "/" + m_waiter2);
  9562. }
  9563. }
  9564. int bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  9565. for (i = 10; i <= 16; i++)
  9566. {
  9567. StrRect = load.m_rcarray.ElementAt(i - 1);
  9568. if (i == 10)
  9569. {
  9570. dty += bottom - StrRect.bottom;
  9571. }
  9572. StrRect.bottom = bottom;
  9573. m_Print.DrawRect2(StrRect, 1);
  9574. }
  9575. if (1)
  9576. {
  9577. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  9578. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  9579. }
  9580. m_Print.SetFontFace(15, 1, "宋体");
  9581. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  9582. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9583. }
  9584. int curypos = 0;
  9585. int oldpos = 0;
  9586. if (bb == 1)
  9587. {
  9588. dty = -100;
  9589. oldpos = nPrintedPos;
  9590. if (oldpos == 0)oldpos = 10000;
  9591. }
  9592. m_Print.SetFontFace(9, 1, "宋体");
  9593. strarray.RemoveAll();
  9594. if ((oldpos != 10000 && oldpos < sparray2.GetSize()) || bb == 0)
  9595. {
  9596. strarray.Add("产品名称");
  9597. strarray.Add("数量");
  9598. strarray.Add("照片编号");
  9599. strarray.Add(_T("备注"));
  9600. CRect mycr[4] = {
  9601. CRect(39,172,130,189), // 产品名称;
  9602. CRect(130,172,157,189), // 产品数量;
  9603. CRect(157,172,407,189), // 相片;
  9604. CRect(407,172,546,189) // 备注;
  9605. };
  9606. for (i = 0; i <= 3; i++)
  9607. {
  9608. StrRect = mycr[i];
  9609. StrRect.top += dty;
  9610. StrRect.bottom += dty;
  9611. m_Print.DrawRect2(StrRect, 1);
  9612. StrRect.left += 2;
  9613. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9614. StrRect.left -= 2;
  9615. StrRect.top = StrRect.bottom;
  9616. StrRect.bottom += 18;
  9617. rc2array.Add(StrRect);
  9618. }
  9619. }
  9620. for (i = oldpos; i < sparray2.GetSize(); i += 4)
  9621. {
  9622. rcarray.RemoveAll();
  9623. strarray2.RemoveAll();
  9624. for ( j = 0; j < 4; j++)
  9625. {
  9626. StrRect = rc2array.ElementAt(j);
  9627. StrRect.left += 2;
  9628. StrRect.right -= 2;
  9629. StrRect.top += 2;
  9630. rcarray.Add(StrRect);
  9631. #if JEFF_TEST_ON
  9632. if (2 == j)
  9633. {
  9634. CString strImg = sparray2.ElementAt(i + 2);
  9635. //int nImgCount = strImg.Replace(",", ",");
  9636. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  9637. if (nImgCount != 0)
  9638. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  9639. else if (!strImg.IsEmpty())
  9640. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  9641. strarray2.Add(strImg);
  9642. }
  9643. else
  9644. strarray2.Add(sparray2.ElementAt(i + j));
  9645. #else
  9646. strarray2.Add(sparray2.ElementAt(i + j));
  9647. #endif
  9648. }
  9649. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9650. rcarray.RemoveAll();
  9651. for (j = 0; j < 4; j++)
  9652. {
  9653. StrRect = rc2array.ElementAt(j);
  9654. if (j == 0)
  9655. {
  9656. dty += bottom - StrRect.bottom;
  9657. }
  9658. StrRect.bottom = bottom;
  9659. m_Print.DrawRect2(StrRect, 1);
  9660. curypos = StrRect.bottom;
  9661. StrRect.top = StrRect.bottom;
  9662. StrRect.bottom += 18;
  9663. rcarray.Add(StrRect);
  9664. }
  9665. rc2array.RemoveAll();
  9666. rc2array.Copy(rcarray);
  9667. if (bottom > 750)
  9668. {
  9669. bSecondPage = 1;
  9670. nPrintedPos = i + 3;
  9671. break;
  9672. }
  9673. }
  9674. if ((bb == 0 && bSecondPage == 0) || (bb == 1 && bSecondPage == 1))
  9675. {
  9676. m_Print.SetFontFace(15, 1, "宋体");
  9677. StrRect = load.m_rcarray.ElementAt(20);
  9678. dty = curypos - StrRect.bottom + 35;
  9679. StrRect.top += dty;
  9680. StrRect.bottom += dty;
  9681. if (StrRect.bottom > 700 && bb == 0)
  9682. {
  9683. bSecondPage = 1;
  9684. }
  9685. else
  9686. {
  9687. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9688. m_Print.SetFontFace(9, 1, "宋体");
  9689. rcarray.RemoveAll();
  9690. strarray2.RemoveAll();
  9691. StrRect = load.m_rcarray.ElementAt(21);
  9692. StrRect.top += dty;
  9693. StrRect.bottom += dty;
  9694. StrRect.left += 2;
  9695. StrRect.right -= 2;
  9696. StrRect.top += 2;
  9697. rcarray.Add(StrRect);
  9698. #if JEFF_TEST_ON
  9699. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9700. strarray2.RemoveAll();
  9701. CString strFind = "要求:";
  9702. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  9703. do
  9704. {
  9705. int nIndex = strbz3.Find(strFind, 1);
  9706. if (nIndex != -1)
  9707. {
  9708. CString strbz = strbz3.Left(nIndex);
  9709. strbz3 = strbz3.Mid(nIndex);
  9710. strarray2.Add(strbz);
  9711. }
  9712. else
  9713. {
  9714. strarray2.Add(strbz3);
  9715. strbz3 = "";
  9716. }
  9717. } while (strbz3.Find(strFind) != -1);
  9718. strarray2.Add(g_List1array.ElementAt(0).ElementAt(29));
  9719. strarray2.Add(g_List1array.ElementAt(0).ElementAt(23));
  9720. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  9721. #else
  9722. strarray2.Add(m_bz);
  9723. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9724. #endif
  9725. StrRect = load.m_rcarray.ElementAt(21);
  9726. StrRect.top += dty;
  9727. StrRect.bottom += dty;
  9728. dty += bottom - StrRect.bottom;
  9729. StrRect.bottom = bottom;
  9730. m_Print.DrawRect2(StrRect, 1);
  9731. curypos = StrRect.bottom;
  9732. m_Print.SetFontFace(10, 1, "宋体");
  9733. StrRect = load.m_rcarray.ElementAt(22);
  9734. dty = curypos - StrRect.bottom + 25;
  9735. StrRect.top += dty;
  9736. StrRect.bottom += dty;
  9737. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  9738. if (m_edit9.IsEmpty())
  9739. {
  9740. m_edit9 = "\
  9741. 经确认后的照片均排入制作流程,\r\n\
  9742. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9743. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9744. }
  9745. CString info1, info2, info3;
  9746. int newlinepos = m_edit9.Find("\r\n");
  9747. if (newlinepos != -1)
  9748. {
  9749. info1 = m_edit9.Left(newlinepos);
  9750. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9751. }
  9752. newlinepos = m_edit9.Find("\r\n");
  9753. if (newlinepos != -1)
  9754. {
  9755. info2 = m_edit9.Left(newlinepos);
  9756. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9757. info3 = m_edit9;
  9758. }
  9759. #ifdef QCH_VERSION
  9760. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9761. StrRect = load.m_rcarray.ElementAt(23);
  9762. StrRect.top += dty; StrRect.bottom += dty;
  9763. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9764. StrRect=load.m_rcarray .ElementAt (24);
  9765. StrRect.top +=dty;StrRect.bottom +=dty;
  9766. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9767. StrRect.top +=15;
  9768. StrRect.bottom +=15;
  9769. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9770. #else
  9771. if (1)
  9772. {
  9773. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9774. StrRect = load.m_rcarray.ElementAt(23);
  9775. StrRect.top += dty; StrRect.bottom += dty;
  9776. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9777. StrRect = load.m_rcarray.ElementAt(24);
  9778. StrRect.top += dty; StrRect.bottom += dty;
  9779. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9780. }
  9781. else
  9782. {
  9783. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9784. StrRect = load.m_rcarray.ElementAt(23);
  9785. StrRect.top += dty; StrRect.bottom += dty;
  9786. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9787. StrRect = load.m_rcarray.ElementAt(24);
  9788. StrRect.top += dty; StrRect.bottom += dty;
  9789. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9790. }
  9791. StrRect.top += 15;
  9792. StrRect.bottom += 15;
  9793. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9794. #endif
  9795. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  9796. StrRect = load.m_rcarray.ElementAt(25);
  9797. StrRect.top += dty - dy;
  9798. StrRect.bottom += dty - dy;
  9799. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9800. StrRect = load.m_rcarray.ElementAt(26);
  9801. StrRect.top += dty - dy;
  9802. StrRect.bottom += dty - dy;
  9803. m_Print.DrawRect2(StrRect, 2);
  9804. StrRect = load.m_rcarray.ElementAt(25);
  9805. StrRect.top += dty + 15 - dy;
  9806. StrRect.bottom += dty + 15 - dy;
  9807. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9808. StrRect = load.m_rcarray.ElementAt(26);
  9809. StrRect.top += dty + 15 - dy;
  9810. StrRect.bottom += dty + 15 - dy;
  9811. m_Print.DrawRect2(StrRect, 2);
  9812. StrRect = load.m_rcarray.ElementAt(25);
  9813. StrRect.top += dty + 15 * 2 - dy;
  9814. StrRect.bottom += dty + 15 * 2 - dy;
  9815. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9816. StrRect = load.m_rcarray.ElementAt(26);
  9817. StrRect.top += dty + 15 * 2 - dy;
  9818. StrRect.bottom += dty + 15 * 2 - dy;
  9819. m_Print.DrawRect2(StrRect, 2);
  9820. }
  9821. }
  9822. PrintPreview dlg; dlg.m_mode = 2;
  9823. dlg.m_name = name;
  9824. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  9825. dlg.m_pDC = m_Print.GetPDC();
  9826. if (aa == 0)
  9827. {
  9828. if (dlg.DoModal() != IDOK)
  9829. return;
  9830. printcot = dlg.m_num;
  9831. }
  9832. //结束打印
  9833. m_Print.EndPage();
  9834. m_Print.EndPrint();
  9835. }
  9836. }
  9837. }
  9838. //void CMainFrame::PrintFlowChart4(CString m_id) // 选设计打单函数;
  9839. void CMainFrame::PrintFlowChart4(CString strOrderNumber) // 选设计打单函数,使用18.lia文件;
  9840. {
  9841. int i = 0;
  9842. int j = 0;
  9843. int printcot = 1;
  9844. for (int aa = 0; aa < printcot; aa++)
  9845. {
  9846. CPrintRX m_Print;
  9847. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  9848. {
  9849. m_Print.InitToPrint(NULL, 1);
  9850. }
  9851. else
  9852. {
  9853. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  9854. if (name.IsEmpty())
  9855. m_Print.InitToPrint(NULL, 1);
  9856. else
  9857. {
  9858. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9859. if (nret == -1 && aa == 0)
  9860. {
  9861. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9862. }
  9863. }
  9864. }
  9865. m_Print.StartPrint();
  9866. m_Print.StartPage();
  9867. LoadRect load;
  9868. load.SetLiaPath("18.lia");
  9869. load.SetMargins(10, 0);
  9870. if (!load.Load())return;
  9871. CString str;
  9872. int rcpos = -1;
  9873. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  9874. m_Print.SetFontFace(25, 1, "宋体");
  9875. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9876. m_Print.SetFontFace(15, 1, "宋体");
  9877. StrRect = load.m_rcarray.ElementAt(++rcpos);
  9878. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9879. m_Print.SetFontFace(9, 1, "宋体");
  9880. //////////////////////////////////////////////////////////////
  9881. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  9882. g_sendhead.code[0] = 54;
  9883. g_sendhead.code[1] = 223;
  9884. g_sendhead.code[2] = 52;
  9885. g_sendhead.tabcount = 3;
  9886. g_sendhead.bsql = 0;
  9887. g_pMainWnd->ProcessChatMessageRequest2(filter);
  9888. if (g_bSendOK == 0)return;
  9889. CArray<CStringArray, CStringArray>sparray;
  9890. CArray<CStringArray, CStringArray>clientarray;
  9891. DataToArray(&g_List1array, &sparray, &clientarray);
  9892. CString spno;
  9893. CStringArray sparray2;
  9894. for ( i = 0; i < sparray.GetSize(); i++)
  9895. {
  9896. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  9897. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(8).IsEmpty())continue;
  9898. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9899. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9900. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  9901. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9902. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9903. }
  9904. for (i = 0; i < sparray.GetSize(); i++)
  9905. {
  9906. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  9907. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  9908. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  9909. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9910. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9911. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  9912. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9913. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9914. }
  9915. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  9916. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  9917. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  9918. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  9919. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  9920. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  9921. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  9922. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  9923. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  9924. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  9925. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  9926. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  9927. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  9928. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  9929. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  9930. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  9931. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  9932. CString m_bz = g_List1array.ElementAt(0).ElementAt(17);
  9933. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(25);
  9934. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  9935. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  9936. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  9937. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  9938. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  9939. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  9940. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  9941. CString m_waiter8 = g_List1array.ElementAt(0).ElementAt(27);
  9942. CString m_replace = g_List1array.ElementAt(0).ElementAt(28);
  9943. if (!m_replace.IsEmpty())
  9944. {
  9945. m_replace = "设计替换照片:" + m_replace;
  9946. m_replace.Replace("$", ";");
  9947. m_replace.TrimLeft(";");
  9948. m_bz += ";";
  9949. m_bz += m_replace;
  9950. }
  9951. CString m_sum3;
  9952. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  9953. ::ConvertToPrice(m_sum3);
  9954. if (m_money3.IsEmpty())m_money3 = "0";
  9955. int dty = 0;
  9956. CString name;
  9957. if (!m_name1.IsEmpty())
  9958. name = m_name1 + ",";
  9959. name += m_name2;
  9960. name.TrimRight(",");
  9961. CString phone;
  9962. if (!m_phone1.IsEmpty())
  9963. phone = m_phone1 + ",";
  9964. phone += m_phone2; phone.TrimRight(",");
  9965. if (IsHasRights2new(31) == 0)
  9966. phone = "***";
  9967. CStringArray strarray;
  9968. #ifdef CHILD_VERSION
  9969. if (m_birthday.IsEmpty())
  9970. strarray.Add("姓名/性别");
  9971. else
  9972. strarray.Add("姓名/性别/年龄");
  9973. #else
  9974. strarray.Add("客人姓名");
  9975. #endif
  9976. strarray.Add("电话");
  9977. strarray.Add("单号");
  9978. strarray.Add("套系");
  9979. strarray.Add("");
  9980. strarray.Add("余款/加挑");
  9981. strarray.Add("看设计/日期");
  9982. #ifdef CHILD_VERSION
  9983. if (m_birthday.IsEmpty())
  9984. strarray.Add(name + "/" + m_sex);
  9985. else
  9986. {
  9987. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  9988. m_birthday.Format("%d", year + 1);
  9989. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  9990. }
  9991. #else
  9992. strarray.Add(name);
  9993. #endif
  9994. strarray.Add(phone);
  9995. strarray.Add(strOrderNumber);
  9996. strarray.Add(m_taoxiname);
  9997. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9998. strarray.Add("");
  9999. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  10000. strarray.Add(str);
  10001. strarray.Add(m_waiter8 + "/" + m_time6);
  10002. //////////////////////////////////////////////
  10003. if (1)
  10004. {
  10005. StrRect = load.m_rcarray.ElementAt(6);
  10006. int addwid = StrRect.Width() / 6;
  10007. for (i = 3; i <= 6; i++)
  10008. {
  10009. StrRect = load.m_rcarray.ElementAt(i - 1);
  10010. StrRect.left += (i - 3)*addwid;
  10011. StrRect.right += (i - 2)*addwid;
  10012. load.m_rcarray.SetAt(i - 1, StrRect);
  10013. }
  10014. StrRect.left = StrRect.right = -1;
  10015. load.m_rcarray.SetAt(6, StrRect);
  10016. for (i = 10; i <= 13; i++)
  10017. {
  10018. StrRect = load.m_rcarray.ElementAt(i - 1);
  10019. StrRect.left += (i - 10)*addwid;
  10020. StrRect.right += (i - 9)*addwid;
  10021. load.m_rcarray.SetAt(i - 1, StrRect);
  10022. }
  10023. StrRect.left = StrRect.right = -1;
  10024. load.m_rcarray.SetAt(13, StrRect);
  10025. StrRect = load.m_rcarray.ElementAt(7);
  10026. int rcwid = StrRect.Width();
  10027. StrRect.left = load.m_rcarray.ElementAt(5).right;
  10028. StrRect.right = StrRect.left + rcwid + addwid;
  10029. load.m_rcarray.SetAt(7, StrRect);
  10030. StrRect = load.m_rcarray.ElementAt(8);
  10031. StrRect.left = load.m_rcarray.ElementAt(7).right;
  10032. StrRect.right = load.m_rcarray.ElementAt(29).left;
  10033. load.m_rcarray.SetAt(8, StrRect);
  10034. StrRect = load.m_rcarray.ElementAt(14);
  10035. rcwid = StrRect.Width();
  10036. StrRect.left = load.m_rcarray.ElementAt(12).right;
  10037. StrRect.right = StrRect.left + rcwid + addwid;
  10038. load.m_rcarray.SetAt(14, StrRect);
  10039. StrRect = load.m_rcarray.ElementAt(15);
  10040. StrRect.left = load.m_rcarray.ElementAt(14).right;
  10041. StrRect.right = load.m_rcarray.ElementAt(29).left;
  10042. load.m_rcarray.SetAt(15, StrRect);
  10043. }
  10044. ////////////////////////////////////////////////
  10045. for (i = 3; i <= 16; i++)
  10046. {
  10047. StrRect = load.m_rcarray.ElementAt(i - 1);
  10048. if (i < 10)
  10049. {
  10050. m_Print.DrawRect2(StrRect, 1);
  10051. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10052. }
  10053. }
  10054. StrRect = load.m_rcarray.ElementAt(29);
  10055. m_Print.DrawRect2(StrRect, 1);
  10056. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10057. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  10058. {
  10059. Image *pImg = NULL;
  10060. g_nSendCode = 31;
  10061. int g_nYearposTemp = g_nYearpos;
  10062. g_nYearpos = -1;
  10063. g_pMainWnd->ProcessChatMessageRequest2(1);
  10064. g_nYearpos = g_nYearposTemp;
  10065. g_nSendCode = 0;
  10066. if (g_bSendOK == 0)return;
  10067. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  10068. if (pImg)
  10069. {
  10070. StrRect.left = 485;
  10071. StrRect.top = 12;
  10072. StrRect.right = StrRect.left + 60;
  10073. StrRect.bottom = StrRect.top + 60;
  10074. m_Print.DrawImage(pImg, StrRect);
  10075. delete pImg; pImg = NULL;
  10076. }
  10077. }
  10078. CArray<CRect, CRect>rcarray;
  10079. CStringArray strarray2;
  10080. for (i = 10; i <= 16; i++)
  10081. {
  10082. StrRect = load.m_rcarray.ElementAt(i - 1);
  10083. StrRect.left += 2;
  10084. StrRect.right -= 2;
  10085. StrRect.top += 2;
  10086. rcarray.Add(StrRect);
  10087. strarray2.Add(strarray.ElementAt(7 + i - 10));
  10088. }
  10089. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  10090. for (i = 10; i <= 16; i++)
  10091. {
  10092. StrRect = load.m_rcarray.ElementAt(i - 1);
  10093. if (i == 10)
  10094. {
  10095. dty += bottom - StrRect.bottom;
  10096. }
  10097. StrRect.bottom = bottom;
  10098. m_Print.DrawRect2(StrRect, 1);
  10099. }
  10100. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  10101. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  10102. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time5, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  10103. m_Print.SetFontFace(15, 1, "宋体");
  10104. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  10105. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10106. m_Print.SetFontFace(9, 1, "宋体");
  10107. strarray.RemoveAll();
  10108. strarray.Add("产品名称");
  10109. strarray.Add("数量");
  10110. strarray.Add("照片编号");
  10111. CArray<CRect, CRect>rc2array;
  10112. for (i = 18; i <= 20; i++)
  10113. {
  10114. StrRect = load.m_rcarray.ElementAt(i - 1); StrRect.top += dty; StrRect.bottom += dty;
  10115. m_Print.DrawRect2(StrRect, 1);
  10116. StrRect.left += 2;
  10117. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10118. StrRect.left -= 2;
  10119. StrRect.top = StrRect.bottom;
  10120. StrRect.bottom += 18;
  10121. rc2array.Add(StrRect);
  10122. }
  10123. int curypos = 0;
  10124. for (i = 0; i < sparray2.GetSize(); i += 3)
  10125. {
  10126. rcarray.RemoveAll();
  10127. strarray2.RemoveAll();
  10128. for ( j = 0; j < 3; j++)
  10129. {
  10130. StrRect = rc2array.ElementAt(j);
  10131. StrRect.left += 2;
  10132. StrRect.right -= 2;
  10133. StrRect.top += 2;
  10134. rcarray.Add(StrRect);
  10135. #if JEFF_TEST_ON
  10136. if (2 == j)
  10137. {
  10138. CString strImg = sparray2.ElementAt(i + 2);
  10139. //int nImgCount = strImg.Replace(",", ",");
  10140. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  10141. if (nImgCount != 0)
  10142. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  10143. else if (!strImg.IsEmpty())
  10144. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  10145. strarray2.Add(strImg);
  10146. }
  10147. else
  10148. strarray2.Add(sparray2.ElementAt(i + j));
  10149. #else
  10150. strarray2.Add(sparray2.ElementAt(i + j));
  10151. #endif
  10152. }
  10153. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  10154. rcarray.RemoveAll();
  10155. for (j = 0; j < 3; j++)
  10156. {
  10157. StrRect = rc2array.ElementAt(j);
  10158. if (j == 0)
  10159. {
  10160. dty += bottom - StrRect.bottom;
  10161. }
  10162. StrRect.bottom = bottom;
  10163. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  10164. StrRect.top = StrRect.bottom;
  10165. StrRect.bottom += 18;
  10166. rcarray.Add(StrRect);
  10167. }
  10168. rc2array.RemoveAll();
  10169. rc2array.Copy(rcarray);
  10170. }
  10171. m_Print.SetFontFace(15, 1, "宋体");
  10172. StrRect = load.m_rcarray.ElementAt(20);
  10173. dty = curypos - StrRect.bottom + 35;
  10174. StrRect.top += dty; StrRect.bottom += dty;
  10175. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10176. m_Print.SetFontFace(9, 1, "宋体");
  10177. rcarray.RemoveAll();
  10178. strarray2.RemoveAll();
  10179. StrRect = load.m_rcarray.ElementAt(21);
  10180. StrRect.top += dty;
  10181. StrRect.bottom += dty;
  10182. StrRect.left += 2;
  10183. StrRect.right -= 2;
  10184. StrRect.top += 2;
  10185. rcarray.Add(StrRect);
  10186. #if JEFF_TEST_ON
  10187. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  10188. strarray2.RemoveAll();
  10189. CString strFind = "要求:";
  10190. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  10191. do
  10192. {
  10193. int nIndex = strbz3.Find(strFind, 1);
  10194. if (nIndex != -1)
  10195. {
  10196. CString strbz = strbz3.Left(nIndex);
  10197. strbz3 = strbz3.Mid(nIndex);
  10198. strarray2.Add(strbz);
  10199. }
  10200. else
  10201. {
  10202. strarray2.Add(strbz3);
  10203. strbz3 = "";
  10204. }
  10205. } while (strbz3.Find(strFind) != -1);
  10206. strarray2.Add(g_List1array.ElementAt(0).ElementAt(25));
  10207. if (!m_replace.IsEmpty())
  10208. {
  10209. m_replace = "设计替换照片:" + m_replace;
  10210. m_replace.Replace("$", ";");
  10211. m_replace.TrimLeft(";");
  10212. }
  10213. strarray2.Add(m_replace);
  10214. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  10215. #else
  10216. strarray2.Add(m_bz);
  10217. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  10218. #endif
  10219. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  10220. dty += bottom - StrRect.bottom;
  10221. StrRect.bottom = bottom;
  10222. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  10223. m_Print.SetFontFace(10, 1, "宋体");
  10224. StrRect = load.m_rcarray.ElementAt(22);
  10225. dty = curypos - StrRect.bottom + 25;
  10226. StrRect.top += dty; StrRect.bottom += dty;
  10227. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  10228. if (m_edit9.IsEmpty())
  10229. {
  10230. m_edit9 = "\
  10231. 经确认后的照片均排入制作流程,\r\n\
  10232. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  10233. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  10234. }
  10235. CString info1, info2, info3;
  10236. int newlinepos = m_edit9.Find("\r\n");
  10237. if (newlinepos != -1)
  10238. {
  10239. info1 = m_edit9.Left(newlinepos);
  10240. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  10241. }
  10242. newlinepos = m_edit9.Find("\r\n");
  10243. if (newlinepos != -1)
  10244. {
  10245. info2 = m_edit9.Left(newlinepos);
  10246. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  10247. info3 = m_edit9;
  10248. }
  10249. if (1)
  10250. {
  10251. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10252. StrRect = load.m_rcarray.ElementAt(23);
  10253. StrRect.top += dty; StrRect.bottom += dty;
  10254. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10255. StrRect = load.m_rcarray.ElementAt(24);
  10256. StrRect.top += dty; StrRect.bottom += dty;
  10257. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10258. }
  10259. else
  10260. {
  10261. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10262. StrRect = load.m_rcarray.ElementAt(23);
  10263. StrRect.top += dty; StrRect.bottom += dty;
  10264. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10265. StrRect = load.m_rcarray.ElementAt(24);
  10266. StrRect.top += dty; StrRect.bottom += dty;
  10267. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10268. }
  10269. StrRect = load.m_rcarray.ElementAt(25);
  10270. StrRect.top += dty; StrRect.bottom += dty;
  10271. m_Print.DrawText((LPTSTR)(LPCTSTR)"贵宾签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10272. StrRect = load.m_rcarray.ElementAt(26);
  10273. StrRect.top += dty; StrRect.bottom += dty;
  10274. m_Print.DrawRect2(StrRect, 2);
  10275. m_Print.SetFontFace(9, 1, "宋体");
  10276. StrRect = load.m_rcarray.ElementAt(27);
  10277. StrRect.top += dty; StrRect.bottom += dty;
  10278. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10279. StrRect = load.m_rcarray.ElementAt(28);
  10280. StrRect.top += dty; StrRect.bottom += dty;
  10281. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10282. PrintPreview dlg;//dlg.m_mode=2;
  10283. dlg.m_name = name;
  10284. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  10285. dlg.m_pDC = m_Print.GetPDC();
  10286. if (aa == 0)
  10287. {
  10288. if (dlg.DoModal() != IDOK)
  10289. return;
  10290. printcot = dlg.m_num;
  10291. }
  10292. //结束打印
  10293. m_Print.EndPage();
  10294. m_Print.EndPrint();
  10295. }
  10296. }
  10297. /*
  10298. void CMainFrame::PrintFlowChart(CString m_id)
  10299. {
  10300. CPrintRX m_Print;
  10301. m_Print.InitToPrint(NULL, 1);
  10302. m_Print.StartPrint();
  10303. m_Print.StartPage();
  10304. // CRect StrRect(0,0,560,818);
  10305. LoadRect load;
  10306. load.SetLiaPath ("4.lia");
  10307. load.SetMargins(-14,-14);
  10308. if(!load.Load ())return;
  10309. LoadRect load2;
  10310. load2.SetMargins(-14,472+27-14);
  10311. load2.SetLiaPath ("5.lia");
  10312. if(!load2.Load ())return;
  10313. //////////////////////////////////////////////////////////////
  10314. CString filter="id='"+m_id+"';id='"+m_id+"'";
  10315. g_sendhead.code[0]=54;
  10316. g_sendhead.code[1]=50;
  10317. g_sendhead.tabcount=2;
  10318. g_sendhead.bsql=0;
  10319. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  10320. CArray<CStringArray, CStringArray>sparray;
  10321. DataToArray(&g_List1array,&sparray);
  10322. CString spno;
  10323. for(int i=0; i<sparray.GetSize (); i++)
  10324. {
  10325. if(sparray.ElementAt (i).ElementAt (4)=="4" && sparray.ElementAt (i).ElementAt (5)!="入册")continue;
  10326. if(sparray.ElementAt (i).ElementAt (5)=="入册"&&sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  10327. spno+=sparray.ElementAt (i).ElementAt (5);
  10328. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  10329. spno+=";";
  10330. else
  10331. {
  10332. spno+=":";
  10333. spno+=sparray.ElementAt (i).ElementAt (6);
  10334. spno+=";";
  10335. }
  10336. }
  10337. spno+=" 加挑:";
  10338. for( i=0; i<sparray.GetSize (); i++)
  10339. {
  10340. if(sparray.ElementAt (i).ElementAt (4)!="4")continue;
  10341. if(sparray.ElementAt (i).ElementAt (5)=="入册")continue;
  10342. spno+=sparray.ElementAt (i).ElementAt (5);
  10343. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  10344. spno+=";";
  10345. else
  10346. {
  10347. spno+=":";
  10348. spno+=sparray.ElementAt (i).ElementAt (6);
  10349. spno+=";";
  10350. }
  10351. }
  10352. if(spno.Right (6)==" 加挑:")
  10353. {
  10354. spno=spno.Left (spno.GetLength ()-6);
  10355. }
  10356. CString m_name1 = g_List1array.ElementAt (0).ElementAt (1);
  10357. CString m_name2 = g_List1array.ElementAt (0).ElementAt (2);
  10358. CString m_phone1=g_List1array.ElementAt (0).ElementAt (3);
  10359. CString m_phone2=g_List1array.ElementAt (0).ElementAt (4);
  10360. CString m_urgent=g_List1array.ElementAt (0).ElementAt (5);
  10361. if(m_urgent.IsEmpty ())m_urgent="否";
  10362. CString m_time2 = g_List1array.ElementAt (0).ElementAt (6);
  10363. CString m_time4 = g_List1array.ElementAt (0).ElementAt (7);
  10364. CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  10365. CString m_takezs = g_List1array.ElementAt (0).ElementAt (9);
  10366. CString m_taoxizs = g_List1array.ElementAt (0).ElementAt (10);
  10367. CString m_choosezs = g_List1array.ElementAt (0).ElementAt (11);
  10368. CString m_ren = g_List1array.ElementAt (0).ElementAt (12);
  10369. CString m_waiter3 = g_List1array.ElementAt (0).ElementAt (13);
  10370. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (14);
  10371. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (15);
  10372. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (16);
  10373. CString m_bz = "客人要求: "+g_List1array.ElementAt (0).ElementAt (17);
  10374. CString m_money3 = g_List1array.ElementAt (0).ElementAt (18);
  10375. CString m_money1 = g_List1array.ElementAt (0).ElementAt (19);
  10376. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (20);
  10377. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (21);
  10378. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (22);
  10379. CString m_sum3;
  10380. m_sum3.Format ("%0.2f", atof(m_taoxijiage)+atof(m_payed4)-(atof(m_payed5)+atof(m_money1)));
  10381. ::ConvertToPrice (m_sum3);
  10382. if(m_money3.IsEmpty ())m_money3="0";
  10383. // m_money3=m_money3+"/"+m_sum3;
  10384. CString name;
  10385. if(!m_name1.IsEmpty ())
  10386. name=m_name1+",";
  10387. name+=m_name2;
  10388. name.TrimRight (",");
  10389. CString phone;
  10390. if(!m_phone1.IsEmpty ())
  10391. phone=m_phone1+",";
  10392. phone+=m_phone2;phone.TrimRight (",");
  10393. CStringArray strarray;
  10394. strarray.Add (m_urgent);
  10395. strarray.Add (m_ren);
  10396. strarray.Add (m_waiter3);
  10397. strarray.Add (name);
  10398. strarray.Add (m_time2);
  10399. strarray.Add (m_time4);
  10400. strarray.Add (m_time5);
  10401. strarray.Add (m_money3);
  10402. strarray.Add (m_takezs);
  10403. strarray.Add (m_taoxizs);
  10404. strarray.Add (m_choosezs);
  10405. strarray.Add (m_id);
  10406. strarray.Add (phone);
  10407. ////////////////////////////////////////////////////////////////
  10408. int rcpos=-1;
  10409. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  10410. Image *pImg=NULL;
  10411. #ifdef MNLS_VERSION
  10412. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG") );
  10413. #else
  10414. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  10415. #endif
  10416. m_Print.DrawImage(pImg, StrRect);
  10417. delete pImg;
  10418. m_Print.SetFontFace(15, 1, "宋体");
  10419. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10420. #ifdef MNLS_VERSION
  10421. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10422. #endif
  10423. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10424. #ifdef MNLS_VERSION
  10425. m_Print.DrawRect(StrRect);
  10426. #endif
  10427. m_Print.SetFontFace(7, 1, "黑体");
  10428. m_Print.SetColor(0xffffff);
  10429. #ifdef MNLS_VERSION
  10430. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10431. #endif
  10432. m_Print.SetColor(0);
  10433. m_Print.SetFontFace(25, 1, "黑体");
  10434. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10435. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10436. CString title[13]={"是否加急:","接单门市:","选样人员:","新郎新娘姓名:","拍照日期:","选片日期:","取件日期:","加挑/余款:","拍摄总张数:","应挑选张数:","额外加挑张数:","票号:","客户联系电话:"};
  10437. m_Print.SetFontFace(12, 1, "宋体");
  10438. for( i=0; i<13; i++)
  10439. {
  10440. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10441. if(i<3)
  10442. m_Print.DrawRect2(StrRect, 0);
  10443. else
  10444. m_Print.DrawRect2(StrRect, 1);
  10445. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10446. }
  10447. for( i=18; i<=37; i++)
  10448. {
  10449. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10450. if(i>=19&&i<=21)
  10451. m_Print.DrawRect2(StrRect, 2);
  10452. else if(i==26)
  10453. {
  10454. CRect rc=StrRect;
  10455. CRect rc2=rc;
  10456. rc.right -=rc2.Width ()/2;
  10457. m_Print.DrawRect2(rc, 1);
  10458. rc2.left +=rc.Width ();
  10459. m_Print.DrawRect2(rc2, 1);
  10460. }
  10461. else
  10462. m_Print.DrawRect2(StrRect, 1);
  10463. if(i==18)
  10464. {
  10465. StrRect.left +=5;
  10466. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10467. }
  10468. }
  10469. //////////////////////////////////////
  10470. rcpos=-1;
  10471. for( i=0; i<8; i++)
  10472. {
  10473. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10474. m_Print.DrawRect2(StrRect, 1);
  10475. }
  10476. CString title2[4]={"化妆师:","摄影师:","数码设计师:","顾客签名:"};
  10477. for( i=0; i<4; i++)
  10478. {
  10479. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10480. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10481. }
  10482. for( i=0; i<4; i++)
  10483. {
  10484. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10485. m_Print.DrawRect2(StrRect, 2);
  10486. }
  10487. ///////////////////////////////////////////
  10488. for( i=19; i<=31; i++)
  10489. {
  10490. StrRect=load.m_rcarray .ElementAt (i-1);
  10491. StrRect.left +=4;
  10492. if(i==31)
  10493. {
  10494. if(m_phone1.IsEmpty ()==0 && m_phone2.IsEmpty ()==0)
  10495. {
  10496. StrRect.top +=2;
  10497. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  10498. StrRect.top +=8;
  10499. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10500. }
  10501. else
  10502. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10503. }
  10504. else if((i-19)==7)
  10505. {
  10506. CRect rc=StrRect;
  10507. CRect rc2=rc;
  10508. rc.right -=rc2.Width ()/2;
  10509. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10510. rc2.left +=rc.Width ()+3;
  10511. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10512. }
  10513. else
  10514. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10515. }
  10516. strarray.RemoveAll ();
  10517. strarray.Add (m_waiter2);
  10518. strarray.Add (m_waiter1);
  10519. strarray.Add (m_waiter4);
  10520. for( i=13; i<=15; i++)
  10521. {
  10522. StrRect=load2.m_rcarray .ElementAt (i-1);
  10523. StrRect.left +=4;
  10524. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10525. }
  10526. ///////////spno
  10527. CRect sprc[14];
  10528. for(i=0; i<14; i++)
  10529. {
  10530. if(i<7)
  10531. {
  10532. if(i==0)
  10533. {
  10534. StrRect=load.m_rcarray .ElementAt (17);StrRect.left +=94;StrRect.right -=3;
  10535. }
  10536. else
  10537. {
  10538. StrRect=load.m_rcarray .ElementAt (30+i);StrRect.left +=4;StrRect.right -=3;
  10539. }
  10540. }
  10541. else
  10542. {
  10543. StrRect=load2.m_rcarray .ElementAt (i-7);StrRect.left +=4;StrRect.right -=3;
  10544. }
  10545. sprc[i]=StrRect;
  10546. // m_Print.DrawText((LPTSTR)(LPCTSTR)"xxx", sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10547. }
  10548. CString temp,tempspno,tempbz;
  10549. CSize size;
  10550. BOOL bRun=0;
  10551. int fontsize=12;
  10552. ll: tempspno=spno;
  10553. tempbz=m_bz;
  10554. m_Print.SetFontFace(fontsize, 1, "宋体");
  10555. for( i=0; i<14; i++)
  10556. {
  10557. if(!tempspno.IsEmpty ())
  10558. {
  10559. temp=tempspno;
  10560. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10561. int right=0;
  10562. CRect temprc=sprc[i];
  10563. while(size.cx>temprc.Width ())
  10564. {
  10565. right++;
  10566. temp=tempspno.Left (tempspno.GetLength ()-(right));
  10567. if(GIsHalfHZ(temp))
  10568. {
  10569. right++;
  10570. temp.Delete (temp.GetLength ()-1);
  10571. }
  10572. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10573. }
  10574. if(bRun)
  10575. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10576. tempspno=tempspno.Right (tempspno.GetLength ()-temp.GetLength ());
  10577. if(tempspno.IsEmpty ())i++;
  10578. }
  10579. else if(!tempbz.IsEmpty ())
  10580. {
  10581. temp=tempbz;
  10582. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10583. int right=0;
  10584. CRect temprc=sprc[i];
  10585. while(size.cx>temprc.Width ())
  10586. {
  10587. right++;
  10588. temp=tempbz.Left (tempbz.GetLength ()-(right));
  10589. if(GIsHalfHZ(temp))
  10590. {
  10591. right++;
  10592. temp.Delete (temp.GetLength ()-1);
  10593. }
  10594. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10595. }
  10596. if(bRun)
  10597. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10598. tempbz=tempbz.Right (tempbz.GetLength ()-temp.GetLength ());
  10599. }
  10600. }
  10601. if(tempspno.IsEmpty ()==0 || tempbz.IsEmpty ()==0)
  10602. {
  10603. fontsize--;
  10604. goto ll;
  10605. }
  10606. if(bRun==0)
  10607. {
  10608. bRun=1;
  10609. goto ll;
  10610. }
  10611. PrintPreview dlg;
  10612. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  10613. dlg.m_pDC =m_Print.GetPDC() ;
  10614. if(dlg.DoModal ()!=IDOK)return;
  10615. //结束打印
  10616. m_Print.EndPage();
  10617. m_Print.EndPrint();
  10618. }
  10619. void CMainFrame::SetSelFolder(int pos)
  10620. {
  10621. m_wndToolBar2.SetSelFolder(pos);
  10622. }*/
  10623. void CMainFrame::ToPhotoPrint()
  10624. {
  10625. UINT nID = 1;
  10626. LPSTR pName;
  10627. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  10628. OPEN_MENU(PhotoPrintFrom);
  10629. }
  10630. void CMainFrame::GetOcx()
  10631. {
  10632. char path[MAX_PATH];
  10633. ::GetSystemDirectory(path, MAX_PATH);
  10634. CString syspath = path;
  10635. try
  10636. {
  10637. if (!::PathFileExists(syspath + "\\MSCHRT20.OCX"))
  10638. {
  10639. g_sendhead.bsql = 0;
  10640. g_sendhead.code[0] = 103;
  10641. g_sendhead.tabcount = 1;
  10642. g_pMainWnd->ProcessChatMessageRequest2(1); if (g_bSendOK == 0)return;
  10643. CFile fp;
  10644. if (fp.Open(syspath + "\\MSCHRT20.OCX", CFile::modeWrite | CFile::modeCreate))
  10645. {
  10646. fp.Write(g_pData, g_nLeng);
  10647. fp.Close();
  10648. ::Sleep(1000);
  10649. }
  10650. }
  10651. CString temp;
  10652. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10653. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10654. }
  10655. catch (...)
  10656. {
  10657. }
  10658. try
  10659. {
  10660. CString temp;
  10661. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10662. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10663. }
  10664. catch (...)
  10665. {
  10666. }
  10667. }
  10668. void CMainFrame::OnServer()
  10669. {
  10670. // TODO: Add your command handler code here
  10671. DBConfig dlg;
  10672. dlg.DoModal();
  10673. }
  10674. void CMainFrame::OnPath()
  10675. {
  10676. // TODO: Add your command handler code here
  10677. if (g_user.bLongin == 0)
  10678. {
  10679. if (g_bNoLoginLia)
  10680. {
  10681. Login dlg;
  10682. dlg.SetLiaPath("5.lia");
  10683. dlg.DoModal();
  10684. }
  10685. else
  10686. {
  10687. Login3 dlg;
  10688. dlg.SetLiaPath("5.lia");
  10689. dlg.DoModal();
  10690. }
  10691. if (g_user.bLongin == 0)return;
  10692. }
  10693. if (IsHasRightsnew(49) == 0)return;
  10694. SetPathDlg2 dlg;
  10695. dlg.DoModal();
  10696. }
  10697. void CMainFrame::OnShowhis()
  10698. {
  10699. // TODO: Add your command handler code here
  10700. if (g_user.bLongin == 0)
  10701. {
  10702. if (g_bNoLoginLia)
  10703. {
  10704. Login dlg;
  10705. dlg.SetLiaPath("5.lia");
  10706. dlg.DoModal();
  10707. }
  10708. else
  10709. {
  10710. Login3 dlg;
  10711. dlg.SetLiaPath("5.lia");
  10712. dlg.DoModal();
  10713. }
  10714. if (g_user.bLongin == 0)return;
  10715. }
  10716. if (IsHasRightsnew(52) == 0)return;
  10717. CMenu *pMenu = GetMenu();
  10718. CMenu* submenu = pMenu->GetSubMenu(2);
  10719. UINT status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10720. if (status&MF_CHECKED)
  10721. {
  10722. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_UNCHECKED);
  10723. g_bShowOK = 1;
  10724. }
  10725. else
  10726. {
  10727. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  10728. g_bShowOK = 0;
  10729. } m_Mdi.CloseAll();
  10730. }
  10731. void CMainFrame::AddHistoryMenu(CArray<CStringArray, CStringArray>*hisyeararray) // 添加历史数据库菜单;
  10732. {
  10733. #ifdef NEW_SKIN
  10734. CMenu* m_menuXP = GetMenu();
  10735. CMenu* submenu = m_menuXP->GetSubMenu(2);
  10736. // 删除原有菜单;
  10737. int i = 0;
  10738. for ( i = 0; i < 100; i++)
  10739. {
  10740. submenu->DeleteMenu(1000 + i, MF_BYCOMMAND);
  10741. }
  10742. // 重创菜单,从资源ID1000开始;
  10743. for (i = 0; i < hisyeararray->GetSize(); i++)
  10744. {
  10745. submenu->AppendMenu(MF_STRING, 1000 + i, "查看历史数据:" + hisyeararray->ElementAt(i).ElementAt(0)); // 第一项菜单项;
  10746. }
  10747. g_nYearpos = -1;
  10748. #else
  10749. HMENU hMenu = ::GetMenu(m_hWnd);
  10750. m_menuXP.Attach(hMenu);
  10751. BCMenu* submenu = (BCMenu*)m_menuXP.GetSubMenu(2);
  10752. for (int i = 0; i < 100; i++)
  10753. {
  10754. submenu->DeleteMenu (1000+i, MF_BYCOMMAND);
  10755. }
  10756. for( i=0; i<hisyeararray->GetSize (); i++)
  10757. {
  10758. submenu->AppendMenu(MF_STRING, 1000+i, "查看历史数据:"+hisyeararray->ElementAt (i).ElementAt (0)); // 第一项菜单项
  10759. }
  10760. m_menuXP.Detach ();
  10761. g_nYearpos = -1;
  10762. #endif
  10763. }
  10764. /************************************************************************/
  10765. /*
  10766. Jeff
  10767. 函数:AddBranchMenu()
  10768. 参数:CArray<CStringArray, CStringArray> *branchArray
  10769. 返回:void
  10770. 注意:
  10771. 调用关系:
  10772. */
  10773. /************************************************************************/
  10774. void CMainFrame::AddBranchMenu(CArray<CStringArray, CStringArray>*branchArray)
  10775. {
  10776. //WriteClientLog("AddBranchMenu,添加集团版菜单");
  10777. #ifdef ENTERPRISE_VERSION
  10778. CMenu *m_menuXP = GetMenu();
  10779. CMenu* submenu = m_menuXP->GetSubMenu(0);
  10780. int i = 0;
  10781. for ( i = 0; i < 100; i++)
  10782. {
  10783. submenu->DeleteMenu(2000 + i, MF_BYCOMMAND);
  10784. }
  10785. g_menubranchname.RemoveAll();
  10786. CString name;
  10787. int a = 0;
  10788. #if 0 // Jeff.add for test
  10789. CString strCount;
  10790. strCount.Format("历史数据库个数=%d", branchArray->GetSize());
  10791. WriteClientLog(strCount);
  10792. #endif
  10793. for (i = 0; i < branchArray->GetSize() - 1; i++)
  10794. {
  10795. //WriteClientLog("111");
  10796. //WriteClientLog(hisyeararray->ElementAt(i).ElementAt(0));
  10797. //WriteClientLog(name);
  10798. if (name == "")
  10799. {
  10800. name = branchArray->ElementAt(i).ElementAt(0);
  10801. #ifndef SQLSERVER_VERSION
  10802. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10803. a++;
  10804. #endif
  10805. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10806. a++;
  10807. g_menubranchname.Add(name);
  10808. continue;
  10809. }
  10810. else if (branchArray->ElementAt(i).ElementAt(0).Find(name) != -1 && ((branchArray->ElementAt(i).ElementAt(0).GetLength() - name.GetLength()) == 4))
  10811. {
  10812. continue;
  10813. }
  10814. name = branchArray->ElementAt(i).ElementAt(0);
  10815. #ifndef SQLSERVER_VERSION
  10816. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10817. a++;
  10818. #endif
  10819. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10820. g_menubranchname.Add(name);
  10821. a++;
  10822. //WriteClientLog("222");
  10823. }
  10824. if ((branchArray->GetSize() - 1) > 0)
  10825. {
  10826. if (branchArray->ElementAt(0).ElementAt(3) == "总店")
  10827. submenu->AppendMenu(MF_STRING, 2000 + a, "多店数据汇总");
  10828. }
  10829. #endif
  10830. }
  10831. // Jeff:如果选择了历史数据库,则开单的数据会录入到该历史数据库中,而非当前数据库;
  10832. // g_nYearpos==-1,表示当前主数据库,其他>=0的值表示历史数据库在g_historydb中的索引值;
  10833. void CMainFrame::OnHistory(UINT nID) // 选择历史数据库菜单响应;
  10834. {
  10835. CMenu* pMenu = GetMenu();
  10836. CMenu* submenu = pMenu->GetSubMenu(2);
  10837. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10838. if (g_user.bLongin == 0)
  10839. {
  10840. if (g_bNoLoginLia)
  10841. {
  10842. Login dlg;
  10843. dlg.SetLiaPath("5.lia");
  10844. dlg.DoModal();
  10845. }
  10846. else
  10847. {
  10848. Login3 dlg;
  10849. dlg.SetLiaPath("5.lia");
  10850. dlg.DoModal();
  10851. }
  10852. if (g_user.bLongin == 0)return;
  10853. }
  10854. if (IsHasRightsnew(52) == 0)return;
  10855. m_Mdi.CloseAll();
  10856. for (int i = 0; i < 100; i++)
  10857. {
  10858. submenu->CheckMenuItem(1000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10859. }
  10860. if (status&MF_CHECKED)
  10861. {
  10862. g_nYearpos = -1;
  10863. status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10864. if (status&MF_CHECKED)
  10865. g_bShowOK = 0;
  10866. else
  10867. g_bShowOK = 1;
  10868. }
  10869. else
  10870. {
  10871. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10872. g_nYearpos = nID - 1000;
  10873. g_bShowOK = 1;
  10874. }
  10875. }
  10876. void CMainFrame::OnBranchData(UINT nID)
  10877. {
  10878. #ifdef ENTERPRISE_VERSION
  10879. #ifdef SQLSERVER_VERSION
  10880. OnBranchData2(nID);
  10881. return;
  10882. #endif
  10883. #endif
  10884. }
  10885. void CMainFrame::OnBranchData2(UINT nID)
  10886. {
  10887. #ifdef ENTERPRISE_VERSION
  10888. g_bAllBranch = 0;
  10889. m_Mdi.CloseAll();
  10890. OnDisconnect();
  10891. CMenu *pMenu = GetMenu();
  10892. CMenu* submenu = pMenu->GetSubMenu(0);
  10893. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10894. for (int i = 0; i < 100; i++)
  10895. {
  10896. submenu->CheckMenuItem(2000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10897. }
  10898. if (status&MF_CHECKED)
  10899. {
  10900. g_branchname.Empty();
  10901. g_branchip.Empty();
  10902. g_bBranchModify = 0;
  10903. g_user.bLongin = 0;
  10904. if (g_bNoLoginLia)
  10905. {
  10906. Login dlg;
  10907. dlg.SetLiaPath("5.lia");
  10908. dlg.DoModal();
  10909. }
  10910. else
  10911. {
  10912. Login3 dlg;
  10913. dlg.SetLiaPath("5.lia");
  10914. dlg.DoModal();
  10915. }
  10916. g_pMainWnd2->RefreshOutlookBar();
  10917. g_pMainWnd2->DrawLogin();
  10918. g_path1 = g_path1bak;
  10919. g_path2 = g_path2bak;
  10920. g_path3 = g_path3bak;
  10921. g_path4 = g_path4bak;
  10922. g_path5 = g_path5bak;
  10923. g_path6 = g_path6bak;
  10924. g_path7 = g_path7bak;
  10925. g_pMainWnd2->EnableBtns(1);
  10926. }
  10927. else
  10928. {
  10929. BOOL bNeedCheckRights = 1;
  10930. if (g_user.bLongin && g_branchname == "")//无需登陆本店判断其访问分店权限
  10931. {
  10932. bNeedCheckRights = 0;
  10933. }
  10934. #ifndef SQLSERVER_VERSION
  10935. if ((g_menubranchname.GetSize() * 2) == nID - 2000)//多店数据汇总
  10936. #else
  10937. if ((g_menubranchname.GetSize()) == nID - 2000)//多店数据汇总
  10938. #endif
  10939. {
  10940. g_branchname.Empty();
  10941. g_branchip.Empty();
  10942. g_bBranchModify = 0;
  10943. if (bNeedCheckRights)
  10944. {
  10945. g_user.bLongin = 0;
  10946. if (g_user.bLongin == 0)
  10947. {
  10948. if (g_bNoLoginLia)
  10949. {
  10950. Login dlg;
  10951. dlg.SetLiaPath("5.lia");
  10952. dlg.DoModal();
  10953. }
  10954. else
  10955. {
  10956. Login3 dlg;
  10957. dlg.SetLiaPath("5.lia");
  10958. dlg.DoModal();
  10959. }
  10960. if (g_user.bLongin == 0)return;
  10961. }
  10962. }
  10963. if (IsHasRightsnew(28) == 0)
  10964. {
  10965. return;
  10966. }
  10967. g_bAllBranch = 1; g_pMainWnd2->ShowBar(0);
  10968. g_pMainWnd2->RefreshOutlookBar2();
  10969. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10970. g_branchname.Empty();
  10971. g_branchip.Empty();
  10972. g_bBranchModify = 0;
  10973. g_pMainWnd2->DrawLogin();
  10974. g_pMainWnd2->EnableBtns(0);
  10975. g_path1 = g_path1bak;
  10976. g_path2 = g_path2bak;
  10977. g_path3 = g_path3bak;
  10978. g_path4 = g_path4bak;
  10979. g_path5 = g_path5bak;
  10980. g_path6 = g_path6bak;
  10981. g_path7 = g_path7bak;
  10982. }
  10983. else
  10984. {
  10985. if (bNeedCheckRights)
  10986. {
  10987. g_branchname.Empty();
  10988. g_branchip.Empty();
  10989. g_bBranchModify = 0;
  10990. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_UNCHECKED);
  10991. g_user.bLongin = 0;
  10992. if (g_pMainWnd2)
  10993. {
  10994. g_pMainWnd2->DrawLogin();
  10995. g_pMainWnd2->ShowBar(0);
  10996. }
  10997. if (g_bNoLoginLia)
  10998. {
  10999. Login dlg;
  11000. dlg.SetLiaPath("5.lia");
  11001. dlg.DoModal();
  11002. }
  11003. else
  11004. {
  11005. Login3 dlg;
  11006. dlg.SetLiaPath("5.lia");
  11007. dlg.DoModal();
  11008. }
  11009. if (g_user.bLongin == 0)return;
  11010. }
  11011. if (IsHasRightsnew(28) == 0)
  11012. {
  11013. return;
  11014. }
  11015. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  11016. #ifndef SQLSERVER_VERSION
  11017. if (nID % 2 == 0)
  11018. g_branchname = g_menubranchname.ElementAt((nID - 2000) / 2);
  11019. else
  11020. g_branchname = g_menubranchname.ElementAt((nID - 2001) / 2);
  11021. #else
  11022. g_branchname = g_menubranchname.ElementAt(nID - 2000);
  11023. #endif
  11024. //printf("选择分店:%s\n", g_branchname);
  11025. g_branchip.Empty();
  11026. CString domainname = "";
  11027. for (int i = 0; i < g_brancharray.GetSize(); i++)
  11028. {
  11029. /*
  11030. for(int j=0; j<g_brancharray.GetSize(); j++)
  11031. printf("%s\n", g_brancharray.ElementAt(i).ElementAt(j));
  11032. */
  11033. if (g_branchname == g_brancharray.ElementAt(i).ElementAt(0))
  11034. {
  11035. g_branchip = g_brancharray.ElementAt(i).ElementAt(1);
  11036. g_branchip2 = g_brancharray.ElementAt(i).ElementAt(4);
  11037. domainname = g_brancharray.ElementAt(i).ElementAt(2);
  11038. }
  11039. }
  11040. g_path1 = g_path1bak;
  11041. g_path2 = g_path2bak;
  11042. g_path3 = g_path3bak;
  11043. g_path4 = g_path4bak;
  11044. g_path5 = g_path5bak;
  11045. g_path6 = g_path6bak;
  11046. g_path7 = g_path7bak;
  11047. if (domainname.IsEmpty())
  11048. {
  11049. g_path1 = g_path2 = g_path3 = g_path4 = g_path5 = g_path6 = g_path7 = "xxx";
  11050. }
  11051. else
  11052. {
  11053. g_path1 += "\\" + domainname;
  11054. g_path2 += "\\" + domainname;
  11055. g_path3 += "\\" + domainname;
  11056. g_path4 += "\\" + domainname;
  11057. g_path5 += "\\" + domainname;
  11058. g_path6 += "\\" + domainname;
  11059. g_path7 += "\\" + domainname;
  11060. }
  11061. g_bBranchModify = 1;
  11062. /* CArray<CStringArray, CStringArray>yeararray;
  11063. for( i=0; i<g_brancharray.GetSize (); i++)
  11064. {
  11065. if(g_brancharray.ElementAt (i).ElementAt (0).Find (g_branchname)!=-1 && g_branchname!=g_brancharray.ElementAt (i).ElementAt (0))
  11066. {
  11067. int size=yeararray.GetSize ();
  11068. yeararray.SetSize(size+1,1);
  11069. CString str=g_brancharray.ElementAt (i).ElementAt (0);
  11070. str.Delete (0, g_branchname.GetLength ());
  11071. yeararray.ElementAt (size).Add (str);
  11072. }
  11073. }
  11074. AddHistoryMenu(&yeararray);*/
  11075. if (g_bBranchModify)OnDisconnect();
  11076. if (1)
  11077. {
  11078. g_user.bLongin = 0;
  11079. g_user.name.Empty();
  11080. g_user.rights.Empty();
  11081. g_user.account.Empty();
  11082. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  11083. g_pMainWnd2->RefreshOutlookBar();
  11084. m_Mdi.CloseAll();
  11085. if (g_pMainWnd2)
  11086. {
  11087. g_pMainWnd2->DrawLogin();
  11088. g_pMainWnd2->ShowBar(0);
  11089. }
  11090. if (g_bNoLoginLia)
  11091. {
  11092. Login dlg;
  11093. dlg.SetLiaPath("5.lia");
  11094. dlg.DoModal();
  11095. }
  11096. else
  11097. {
  11098. Login3 dlg;
  11099. dlg.SetLiaPath("5.lia");
  11100. dlg.DoModal();
  11101. }
  11102. if (g_user.bLongin == 0)return;
  11103. if (g_pMainWnd2)g_pMainWnd2->ShowBar(1);
  11104. }
  11105. g_pMainWnd2->DrawLogin();
  11106. g_pMainWnd2->EnableBtns(1);
  11107. }
  11108. g_nYearpos = -1;
  11109. }
  11110. #endif
  11111. }
  11112. void CMainFrame::OnStaffAchievementShow() //Jeff:此机只用于员工看业绩;
  11113. {
  11114. // TODO: Add your command handler code here
  11115. if (g_user.bLongin == 0) // 是否登陆系统;
  11116. {
  11117. if (g_bNoLoginLia)
  11118. {
  11119. Login dlg;
  11120. dlg.SetLiaPath("5.lia");
  11121. dlg.DoModal();
  11122. }
  11123. else
  11124. {
  11125. Login3 dlg;
  11126. dlg.SetLiaPath("5.lia");
  11127. dlg.DoModal();
  11128. }
  11129. if (g_user.bLongin == 0)return;
  11130. }
  11131. if (IsHasRightsnew(49) == 0)return;// 是否有权限进行设置;
  11132. CString version = _T("Version 1.0");
  11133. CMenu *pMenu = GetMenu();
  11134. CMenu* submenu = pMenu->GetSubMenu(1);
  11135. UINT status = submenu->GetMenuState(IDM_StaffAchievementShow, MF_BYCOMMAND);
  11136. if (status&MF_CHECKED)
  11137. {
  11138. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_UNCHECKED);
  11139. AfxGetApp()->WriteProfileInt(version, "status2", 0);
  11140. g_bStaffAchievementShow = 0;
  11141. TCHAR szKey[MAX_PATH];
  11142. TCHAR szDir[MAX_PATH];
  11143. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  11144. HKEY hKey = 0;
  11145. DWORD disp = 0;
  11146. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  11147. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  11148. if (lResult == ERROR_SUCCESS)
  11149. {
  11150. RegDeleteValue(hKey, "YLGLMAINAUTORUN");
  11151. RegDeleteKey(hKey, "YLGLMAINAUTORUN");
  11152. RegCloseKey(hKey);
  11153. }
  11154. }
  11155. else
  11156. {
  11157. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  11158. AfxGetApp()->WriteProfileInt(version, "status2", 1);
  11159. g_bStaffAchievementShow = 1;
  11160. TCHAR szKey[MAX_PATH];
  11161. TCHAR szDir[MAX_PATH];
  11162. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  11163. HKEY hKey = 0;
  11164. DWORD disp = 0;
  11165. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  11166. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  11167. if (lResult == ERROR_SUCCESS)
  11168. {
  11169. lResult = RegSetValueEx(hKey, "YLGLMAINAUTORUN", 0, REG_SZ, (const unsigned char*)szDir, lstrlen(szDir));
  11170. RegCloseKey(hKey);
  11171. }
  11172. StaffAchievementSet dlg;
  11173. dlg.DoModal();
  11174. }
  11175. }
  11176. void CMainFrame::PrintDinDan2(CString m_id)
  11177. {
  11178. #ifdef MODERN_VERSION
  11179. SelContent seldlg;
  11180. if (seldlg.DoModal() != IDOK)return;
  11181. CPrintRX m_Print;
  11182. m_Print.InitToPrint(NULL, 1);
  11183. m_Print.StartPrint();
  11184. m_Print.StartPage();
  11185. // CRect StrRect(0,0,560,818);
  11186. LoadRect load;
  11187. LoadRect load2;
  11188. LoadRect load3;
  11189. load.SetLiaPath ("9.lia");
  11190. load.SetMargins(-14,0);
  11191. if(!load.Load ())return;
  11192. int i;
  11193. //////////////////////////////////////////////////////////////
  11194. CStringArray txarray;
  11195. CString filter="id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"'";
  11196. g_sendhead.code[0]=11;
  11197. g_sendhead.code[1]=52;
  11198. g_sendhead.code[2]=50;
  11199. g_sendhead.code[3]=38;
  11200. g_sendhead.code[4]=27;
  11201. g_sendhead.tabcount=5;
  11202. g_sendhead.bsql=0;
  11203. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  11204. CArray<CStringArray, CStringArray>sparray;
  11205. CArray<CStringArray, CStringArray>clientarray;
  11206. CArray<CStringArray, CStringArray>phonearray;
  11207. CArray<CStringArray, CStringArray>bukuan2array;
  11208. CArray<CStringArray, CStringArray>bukuanarray;
  11209. DataToArray(&g_List1array, &clientarray, &sparray, &bukuan2array, &bukuanarray);
  11210. CTime tm=CTime::GetCurrentTime ();
  11211. CString str;
  11212. CString m_money1 = g_List1array.ElementAt (0).ElementAt (1);
  11213. CString m_money2 = g_List1array.ElementAt (0).ElementAt (2);
  11214. CString m_money3 = g_List1array.ElementAt (0).ElementAt (3);
  11215. CString m_name1 = g_List1array.ElementAt (0).ElementAt (4);
  11216. CString m_name2 = g_List1array.ElementAt (0).ElementAt (5);
  11217. CString m_taoxiname= g_List1array.ElementAt (0).ElementAt (7);
  11218. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (8);
  11219. CString m_zs = g_List1array.ElementAt (0).ElementAt (9);
  11220. CString m_time1 = g_List1array.ElementAt (0).ElementAt (10);
  11221. CString m_time2 = g_List1array.ElementAt (0).ElementAt (11);
  11222. CString m_time3 = g_List1array.ElementAt (0).ElementAt (12);
  11223. CString m_ren = g_List1array.ElementAt (0).ElementAt (14);
  11224. CString m_discount = g_List1array.ElementAt (0).ElementAt (15);
  11225. CString m_payed1 = g_List1array.ElementAt (0).ElementAt (16);
  11226. CString m_payed2 = g_List1array.ElementAt (0).ElementAt (17);
  11227. CString m_payed3 = g_List1array.ElementAt (0).ElementAt (18);
  11228. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (19);
  11229. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (20);
  11230. CString m_time4 = g_List1array.ElementAt (0).ElementAt (21);
  11231. CString m_time5 = g_List1array.ElementAt (0).ElementAt (22);
  11232. CString m_clothescount = g_List1array.ElementAt (0).ElementAt (26);
  11233. CString m_clothescount2 = g_List1array.ElementAt (0).ElementAt (27);
  11234. CString m_outside = g_List1array.ElementAt (0).ElementAt (28);
  11235. CString m_outside2 = g_List1array.ElementAt (0).ElementAt (29);
  11236. CString m_style = g_List1array.ElementAt (0).ElementAt (30);
  11237. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (34);
  11238. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (35);
  11239. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (37);
  11240. CString m_bz = g_List1array.ElementAt (0).ElementAt (38);
  11241. CString m_phone1=clientarray.ElementAt (0).ElementAt (3);
  11242. CString m_phone2=clientarray.ElementAt (0).ElementAt (4);
  11243. CString m_addr1=clientarray.ElementAt (0).ElementAt (7);
  11244. CString m_addr2=clientarray.ElementAt (0).ElementAt (8);
  11245. CString m_occupation1=clientarray.ElementAt (0).ElementAt (9);
  11246. CString m_occupation2=clientarray.ElementAt (0).ElementAt (10);
  11247. filter="name='"+m_ren+"'";
  11248. g_sendhead.code[0]=5;
  11249. g_sendhead.tabcount=1;
  11250. g_sendhead.bsql=0;
  11251. int g_nYearposTemp=g_nYearpos;
  11252. g_nYearpos=-1;
  11253. g_pMainWnd->ProcessChatMessageRequest2(filter);
  11254. g_nYearpos=g_nYearposTemp;
  11255. if(g_bSendOK==0)return;
  11256. DataToArray(&phonearray);
  11257. m_money2.Format ("%f", atof(m_payed5)+atof(m_money1));
  11258. m_money1.Format ("%f", atof(m_taoxijiage)+atof(m_payed4));
  11259. m_money3.Format ("%f", atof(m_money1)-atof(m_money2));
  11260. ConvertToPrice(m_money1);
  11261. ConvertToPrice(m_money2);
  11262. ConvertToPrice(m_money3);
  11263. ////////////////////////////////////////////////////////////////
  11264. int rcpos=-1;
  11265. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  11266. Image *pImg=NULL;
  11267. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo2.jpg");
  11268. if(seldlg.m_bFrame)
  11269. m_Print.DrawImage(pImg, StrRect);
  11270. delete pImg;
  11271. m_Print.SetFontFace(16, 1, "黑体");
  11272. StrRect=load.m_rcarray .ElementAt (++rcpos);
  11273. if(seldlg.m_bFrame)
  11274. ///////////////////////////////不用改
  11275. m_Print.DrawText((LPTSTR)(LPCTSTR)"摩登新娘工作流程单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11276. m_Print.SetFontFace(10, 1, "宋体");
  11277. for( i=3; i<=6; i++)
  11278. {
  11279. StrRect=load.m_rcarray .ElementAt (i-1);
  11280. if(seldlg.m_bFrame)
  11281. m_Print.DrawRect2(StrRect, 1);
  11282. }
  11283. CStringArray strarray;
  11284. if(seldlg.m_bBooking==0)
  11285. {
  11286. m_name1.Empty ();
  11287. m_name2.Empty ();
  11288. m_phone1.Empty ();
  11289. m_phone2.Empty ();
  11290. m_addr1.Empty ();
  11291. m_addr2.Empty ();
  11292. m_taoxiname.Empty ();
  11293. m_taoxijiage.Empty ();
  11294. }
  11295. if(seldlg.m_bFrame )
  11296. {
  11297. strarray.Add("新郎:"+m_name1);
  11298. strarray.Add("H");
  11299. strarray.Add("O");
  11300. strarray.Add("手机:"+m_phone1);
  11301. strarray.Add("新娘:"+m_name2);
  11302. strarray.Add("H");
  11303. strarray.Add("O");
  11304. strarray.Add("手机:"+m_phone2);
  11305. }
  11306. else
  11307. {
  11308. strarray.Add(" "+m_name1);
  11309. strarray.Add("");
  11310. strarray.Add("");
  11311. strarray.Add(" "+m_phone1);
  11312. strarray.Add(" "+m_name2);
  11313. strarray.Add("");
  11314. strarray.Add("");
  11315. strarray.Add(" "+m_phone2);
  11316. }
  11317. for( i=7; i<=14; i++)
  11318. {
  11319. StrRect=load.m_rcarray .ElementAt (i-1);
  11320. StrRect.left +=2;
  11321. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11322. }
  11323. StrRect=load.m_rcarray .ElementAt (3);
  11324. StrRect.left +=2;
  11325. if(seldlg.m_bFrame)
  11326. str="地址:"+m_addr1;
  11327. else
  11328. str=" "+m_addr1;
  11329. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11330. StrRect=load.m_rcarray .ElementAt (5);
  11331. StrRect.left +=2;
  11332. if(seldlg.m_bFrame)
  11333. str="地址:"+m_addr2;
  11334. else
  11335. str=" "+m_addr2;
  11336. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11337. //////////////////////////////////////////////////////
  11338. StrRect=load.m_rcarray .ElementAt (14);
  11339. str="预\r\n约";
  11340. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11341. StrRect.top +=46;
  11342. StrRect.left +=2;
  11343. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11344. m_Print.SetFontFace(10, 1, "宋体");
  11345. StrRect=load.m_rcarray .ElementAt (15);
  11346. if(seldlg.m_bFrame)
  11347. str="套系名称:"+m_taoxiname;
  11348. else
  11349. str=" "+m_taoxiname;
  11350. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11351. StrRect.left +=4;
  11352. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11353. StrRect=load.m_rcarray .ElementAt (16);
  11354. if(seldlg.m_bFrame)
  11355. str="单价:"+m_taoxijiage;
  11356. else
  11357. str=" "+m_taoxijiage;
  11358. StrRect.left +=2;
  11359. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11360. StrRect=load.m_rcarray .ElementAt (21);
  11361. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11362. str="新人签名:";
  11363. StrRect.left +=2;
  11364. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11365. StrRect=load.m_rcarray .ElementAt (22);
  11366. if(seldlg.m_bBooking==0)
  11367. {
  11368. if(seldlg.m_bFrame)
  11369. str="未付款:";
  11370. else
  11371. str=" ";
  11372. }
  11373. else
  11374. {
  11375. if(seldlg.m_bFrame)
  11376. str="未付款:"+m_money3;
  11377. else
  11378. str=" "+m_money3;
  11379. }
  11380. StrRect.left +=2;
  11381. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11382. StrRect=load.m_rcarray .ElementAt (23);
  11383. str="结婚秘书:";
  11384. StrRect.left +=2;
  11385. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11386. StrRect=load.m_rcarray .ElementAt (24);
  11387. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11388. StrRect.left +=3;
  11389. StrRect.top +=3;
  11390. StrRect.right -=2;
  11391. StrRect.bottom -=2;
  11392. int realpos=0;str="";
  11393. for(i=0; i<sparray.GetSize (); i++)
  11394. {
  11395. if(atoi(sparray.ElementAt (i).ElementAt (4))!=1)continue;
  11396. str+=sparray.ElementAt (i).ElementAt (5);
  11397. str+=" 数量:";
  11398. str+=sparray.ElementAt (i).ElementAt (3);
  11399. if(realpos%2)
  11400. str+="\r\n";
  11401. else
  11402. str+=" ";
  11403. realpos++;
  11404. }
  11405. str.TrimRight ("\r\n");
  11406. str.TrimRight (" ");
  11407. if(seldlg.m_bBooking)AutoDraw(m_Print, StrRect, str, 1.4);
  11408. ///////////////////////////////////////////////////////////
  11409. StrRect=load.m_rcarray .ElementAt (14);
  11410. StrRect.top +=1*122;
  11411. StrRect.bottom +=1*122;
  11412. str="拍\r\n照";
  11413. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11414. StrRect.top +=46;
  11415. StrRect.left +=2;
  11416. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11417. m_Print.SetFontFace(10, 1, "宋体");
  11418. StrRect=load.m_rcarray .ElementAt (15);
  11419. StrRect.top +=1*122;
  11420. StrRect.bottom +=1*122;
  11421. str="拍照内容: 白 晚 特 便";
  11422. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11423. StrRect.left +=4;
  11424. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11425. StrRect=load.m_rcarray .ElementAt (21);
  11426. StrRect.top +=1*122;
  11427. StrRect.bottom +=1*122;
  11428. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11429. str=" 新人签名:";
  11430. StrRect.left +=2;
  11431. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11432. StrRect=load.m_rcarray .ElementAt (22);
  11433. StrRect.top +=1*122;
  11434. StrRect.bottom +=1*122;
  11435. if(seldlg.m_bTake)
  11436. {
  11437. if(seldlg.m_bFrame)
  11438. str="未付款:"+m_money3;
  11439. else
  11440. str=" "+m_money3;
  11441. }
  11442. else
  11443. {
  11444. if(seldlg.m_bFrame)
  11445. str="未付款:";
  11446. else
  11447. str=" ";
  11448. }
  11449. StrRect.left +=2;
  11450. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11451. StrRect=load.m_rcarray .ElementAt (23);
  11452. StrRect.top +=1*122;
  11453. StrRect.bottom +=1*122;
  11454. str="结婚秘书:";
  11455. StrRect.left +=2;
  11456. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11457. StrRect=load.m_rcarray .ElementAt (24);
  11458. StrRect.top +=1*122;
  11459. StrRect.bottom +=1*122;
  11460. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11461. StrRect.left +=3;
  11462. StrRect.top +=3;
  11463. StrRect.right -=2;
  11464. StrRect.bottom -=2;
  11465. if(seldlg.m_bTake)
  11466. {
  11467. str="";
  11468. for(i=0; i<bukuan2array.GetSize (); i++)
  11469. {
  11470. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=1)continue;
  11471. str+="加挑: ";
  11472. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11473. str+="\r\n";
  11474. }
  11475. str.TrimRight ("\r\n");
  11476. str.TrimRight (" ");
  11477. AutoDraw(m_Print, StrRect, str, 1.4);
  11478. }
  11479. ///////////////////////////////////////////////////////////
  11480. StrRect=load.m_rcarray .ElementAt (14);
  11481. StrRect.top +=2*122;
  11482. StrRect.bottom +=2*122;
  11483. str="选\r\n样";
  11484. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11485. StrRect.top +=46;
  11486. StrRect.left +=2;
  11487. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11488. m_Print.SetFontFace(10, 1, "宋体");
  11489. StrRect=load.m_rcarray .ElementAt (15);
  11490. StrRect.top +=2*122;
  11491. StrRect.bottom +=2*122;
  11492. str="选片内容:";
  11493. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11494. StrRect.left +=4;
  11495. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11496. StrRect=load.m_rcarray .ElementAt (21);
  11497. StrRect.top +=2*122;
  11498. StrRect.bottom +=2*122;
  11499. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11500. str=" 新人签名:";
  11501. StrRect.left +=2;
  11502. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11503. StrRect=load.m_rcarray .ElementAt (22);
  11504. StrRect.top +=2*122;
  11505. StrRect.bottom +=2*122;
  11506. if(seldlg.m_bChoose)
  11507. {
  11508. if(seldlg.m_bFrame)
  11509. str="未付款:"+m_money3;
  11510. else
  11511. str=" "+m_money3;
  11512. }
  11513. else
  11514. {
  11515. if(seldlg.m_bFrame)
  11516. str="未付款:";
  11517. else
  11518. str=" ";
  11519. }
  11520. StrRect.left +=2;
  11521. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11522. StrRect=load.m_rcarray .ElementAt (23);
  11523. StrRect.top +=2*122;
  11524. StrRect.bottom +=2*122;
  11525. str="结婚秘书:";
  11526. StrRect.left +=2;
  11527. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11528. StrRect=load.m_rcarray .ElementAt (24);
  11529. StrRect.top +=2*122;
  11530. StrRect.bottom +=2*122;
  11531. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11532. if(seldlg.m_bChoose)
  11533. {
  11534. StrRect.left +=3;
  11535. StrRect.top +=3;
  11536. StrRect.right -=2;
  11537. StrRect.bottom -=2;
  11538. str="";
  11539. for(i=0; i<bukuan2array.GetSize (); i++)
  11540. {
  11541. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=2)continue;
  11542. str+="加挑: ";
  11543. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11544. str+="\r\n";
  11545. }
  11546. str.TrimRight ("\r\n");
  11547. str.TrimRight (" ");
  11548. AutoDraw(m_Print, StrRect, str, 1.4);
  11549. }
  11550. ///////////////////////////////////////////////////////////
  11551. StrRect=load.m_rcarray .ElementAt (14);
  11552. StrRect.top +=3*122;
  11553. StrRect.bottom +=3*122;
  11554. str="结\r\n婚";
  11555. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11556. StrRect.top +=46;
  11557. StrRect.left +=2;
  11558. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11559. m_Print.SetFontFace(10, 1, "宋体");
  11560. StrRect=load.m_rcarray .ElementAt (15);
  11561. StrRect.top +=3*122;
  11562. StrRect.bottom +=3*122;
  11563. str="结婚内容: 区 白 晚 押金:";
  11564. if(seldlg.m_bFrame) m_Print.DrawRect2(StrRect, 1);
  11565. StrRect.left +=4;
  11566. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11567. StrRect=load.m_rcarray .ElementAt (21);
  11568. StrRect.top +=3*122;
  11569. StrRect.bottom +=3*122;
  11570. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11571. str=" 新人签名:";
  11572. StrRect.left +=2;
  11573. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11574. StrRect=load.m_rcarray .ElementAt (22);
  11575. StrRect.top +=3*122;
  11576. StrRect.bottom +=3*122;
  11577. if(seldlg.m_bBooking)
  11578. {
  11579. if(seldlg.m_bFrame)
  11580. str="未付款:"+m_money3;
  11581. else
  11582. str=" "+m_money3;
  11583. }
  11584. else
  11585. {
  11586. if(seldlg.m_bFrame)
  11587. str="未付款:";
  11588. else
  11589. str=" ";
  11590. }
  11591. StrRect.left +=2;
  11592. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11593. StrRect=load.m_rcarray .ElementAt (23);
  11594. StrRect.top +=3*122;
  11595. StrRect.bottom +=3*122;
  11596. str="结婚秘书:";
  11597. StrRect.left +=2;
  11598. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11599. StrRect=load.m_rcarray .ElementAt (24);
  11600. StrRect.top +=3*122;
  11601. StrRect.bottom +=3*122;
  11602. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11603. if(seldlg.m_bBooking)
  11604. {
  11605. StrRect.left +=3;
  11606. StrRect.top +=3;
  11607. StrRect.right -=2;
  11608. StrRect.bottom -=2;
  11609. realpos=0;str="";
  11610. for(i=0; i<sparray.GetSize (); i++)
  11611. {
  11612. if(atoi(sparray.ElementAt (i).ElementAt (4))!=2)continue;
  11613. str+=sparray.ElementAt (i).ElementAt (5);
  11614. str+=" 数量:";
  11615. str+=sparray.ElementAt (i).ElementAt (3);
  11616. if(realpos%2)
  11617. str+="\r\n";
  11618. else
  11619. str+=" ";
  11620. realpos++;
  11621. }
  11622. str.TrimRight ("\r\n");
  11623. str.TrimRight (" ");
  11624. AutoDraw(m_Print, StrRect, str, 1.4);
  11625. }
  11626. ///////////////////////////////////////
  11627. strarray.RemoveAll ();
  11628. if(seldlg.m_bFrame)
  11629. {
  11630. strarray.Add ("项目");
  11631. strarray.Add ("万");
  11632. strarray.Add ("千");
  11633. strarray.Add ("百");
  11634. strarray.Add ("十");
  11635. strarray.Add ("个");
  11636. strarray.Add ("收 银");
  11637. }
  11638. else
  11639. {
  11640. strarray.Add ("");
  11641. strarray.Add ("");
  11642. strarray.Add ("");
  11643. strarray.Add ("");
  11644. strarray.Add ("");
  11645. strarray.Add ("");
  11646. strarray.Add ("");
  11647. }
  11648. CStringArray strarray2;
  11649. float ftotal=0;
  11650. int realcount=0;
  11651. if(seldlg.m_bBooking)
  11652. {
  11653. for(i=0; i<bukuanarray.GetSize (); i++)
  11654. {
  11655. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=3 && atoi(bukuanarray.ElementAt (i).ElementAt (6))!=4)continue;
  11656. realcount++;
  11657. if(realcount>6)break;
  11658. str=bukuanarray.ElementAt (i).ElementAt (1);
  11659. ftotal+=atof(str);
  11660. strarray2.Add (GetW(str));
  11661. strarray2.Add (GetK(str));
  11662. strarray2.Add (GetB(str));
  11663. strarray2.Add (GetS(str));
  11664. strarray2.Add (GetG(str));
  11665. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11666. }
  11667. }
  11668. while(strarray2.GetSize ()<36)
  11669. strarray2.Add ("");
  11670. str.Format ("%f", ftotal);
  11671. strarray2.Add (GetW(str));
  11672. strarray2.Add (GetK(str));
  11673. strarray2.Add (GetB(str));
  11674. strarray2.Add (GetS(str));
  11675. strarray2.Add (GetG(str));
  11676. strarray2.Add ("");
  11677. //拍照
  11678. ftotal=0;
  11679. realcount=0;
  11680. if(seldlg.m_bTake)
  11681. {
  11682. for(i=0; i<bukuanarray.GetSize (); i++)
  11683. {
  11684. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=1)continue;
  11685. realcount++;
  11686. if(realcount>6)break;
  11687. str=bukuanarray.ElementAt (i).ElementAt (1);
  11688. ftotal+=atof(str);
  11689. strarray2.Add (GetW(str));
  11690. strarray2.Add (GetK(str));
  11691. strarray2.Add (GetB(str));
  11692. strarray2.Add (GetS(str));
  11693. strarray2.Add (GetG(str));
  11694. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11695. }
  11696. }
  11697. while(strarray2.GetSize ()<42+36)
  11698. strarray2.Add ("");
  11699. str.Format ("%f", ftotal);
  11700. strarray2.Add (GetW(str));
  11701. strarray2.Add (GetK(str));
  11702. strarray2.Add (GetB(str));
  11703. strarray2.Add (GetS(str));
  11704. strarray2.Add (GetG(str));
  11705. strarray2.Add ("");
  11706. //选片
  11707. ftotal=0;
  11708. realcount=0;
  11709. if(seldlg.m_bChoose)
  11710. {
  11711. for(i=0; i<bukuanarray.GetSize (); i++)
  11712. {
  11713. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=2)continue;
  11714. realcount++;
  11715. if(realcount>6)break;
  11716. str=bukuanarray.ElementAt (i).ElementAt (1);
  11717. ftotal+=atof(str);
  11718. strarray2.Add (GetW(str));
  11719. strarray2.Add (GetK(str));
  11720. strarray2.Add (GetB(str));
  11721. strarray2.Add (GetS(str));
  11722. strarray2.Add (GetG(str));
  11723. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11724. }
  11725. }
  11726. while(strarray2.GetSize ()<42*2+36)
  11727. strarray2.Add ("");
  11728. str.Format ("%f", ftotal);
  11729. strarray2.Add (GetW(str));
  11730. strarray2.Add (GetK(str));
  11731. strarray2.Add (GetB(str));
  11732. strarray2.Add (GetS(str));
  11733. strarray2.Add (GetG(str));
  11734. strarray2.Add ("");
  11735. /////////////////////////////
  11736. CRect temprc;
  11737. for(int n=0; n<4; n++)
  11738. {
  11739. StrRect=load.m_rcarray .ElementAt (17);
  11740. StrRect.top +=n*122;
  11741. StrRect.bottom +=n*122;
  11742. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11743. StrRect=load.m_rcarray .ElementAt (18);
  11744. if(n)
  11745. {
  11746. StrRect.left +=36;
  11747. StrRect.right +=36;
  11748. }
  11749. StrRect.top +=n*122;
  11750. StrRect.bottom +=n*122;
  11751. if(seldlg.m_bFrame)
  11752. str.Format("%d年", tm.GetYear ());
  11753. else
  11754. str.Format("%d ", tm.GetYear ());
  11755. 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))
  11756. {
  11757. if(seldlg.m_bFrame)
  11758. str=" 年";
  11759. else
  11760. str=" ";
  11761. }
  11762. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11763. StrRect=load.m_rcarray .ElementAt (19);
  11764. if(n)
  11765. {
  11766. StrRect.left +=38;
  11767. StrRect.right +=38;
  11768. }
  11769. StrRect.top +=n*122;
  11770. StrRect.bottom +=n*122;
  11771. if(seldlg.m_bFrame)
  11772. str.Format("%02d月", tm.GetMonth ());
  11773. else
  11774. str.Format("%02d ", tm.GetMonth ());
  11775. 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))
  11776. {
  11777. if(seldlg.m_bFrame)
  11778. str=" 月";
  11779. else
  11780. str=" ";
  11781. }
  11782. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11783. StrRect=load.m_rcarray .ElementAt (20);
  11784. if(n)
  11785. {
  11786. StrRect.left +=36;
  11787. StrRect.right +=36;
  11788. }
  11789. StrRect.top +=n*122;
  11790. StrRect.bottom +=n*122;
  11791. if(seldlg.m_bFrame)
  11792. str.Format("%02d日", tm.GetDay ());
  11793. else
  11794. str.Format("%02d ", tm.GetDay ());
  11795. 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))
  11796. {
  11797. if(seldlg.m_bFrame)
  11798. str=" 日";
  11799. else
  11800. str=" ";
  11801. }
  11802. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11803. for(i=26; i<=32; i++)
  11804. {
  11805. StrRect=load.m_rcarray .ElementAt (i-1);
  11806. StrRect.bottom -=14;
  11807. for(int j=0; j<8; j++)
  11808. {
  11809. StrRect.top=StrRect.bottom;
  11810. if(j>2)
  11811. {
  11812. StrRect.bottom =StrRect.top+14;
  11813. }
  11814. else
  11815. {
  11816. StrRect.bottom =StrRect.top+13;
  11817. }
  11818. temprc=StrRect;
  11819. StrRect.top +=n*122;
  11820. StrRect.bottom +=n*122;
  11821. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11822. if(i==26 && j==4 && seldlg.m_bFrame)
  11823. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11824. else if(i==26 && j==5 && seldlg.m_bFrame)
  11825. m_Print.DrawText((LPTSTR)(LPCTSTR)"付款", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11826. else if(i==26 && j==7 && seldlg.m_bFrame)
  11827. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11828. else if(j==0)
  11829. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-26), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11830. else if(j && i>26 && n<3)
  11831. {
  11832. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray2.ElementAt ((j-1)*6+(i-27)+n*42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11833. }
  11834. StrRect=temprc;
  11835. }
  11836. }
  11837. }
  11838. if(seldlg.m_bFrame)
  11839. {
  11840. StrRect=load.m_rcarray .ElementAt (32);
  11841. str="注\r\n意\r\n事\r\n项";
  11842. StrRect.top +=367;
  11843. StrRect.bottom +=367;
  11844. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11845. StrRect.top +=17;
  11846. StrRect.left +=2;
  11847. AutoDraw(m_Print, StrRect, str, 1.4);
  11848. StrRect=load.m_rcarray .ElementAt (33);
  11849. str="1: 本预约单自预定日期起一年内有效.定金在拍照套系金额中扣出.预定金一概不退\r\n\
  11850. 2: 多拍照片只供筛选.恕不奉送.版权所有.不得私自拷贝\r\n\
  11851. 3: 拍照款请于拍照时一次付清\r\n\
  11852. 4: 新娘装AM8:00前钟点费另计.婚纱礼服出租押金500-2000元\r\n\
  11853. 5: 本公司设有豪华VIP礼服区.及皇家御用礼服展区.但需另外加价.详情请咨本店人员\r\n\
  11854. 6: 安瓶, 美甲一次性化妆用具等均属增值服务部分,则需另外加价,详情咨询本店工作人员\r\n\
  11855. 7: 本电脑机械故障导致文件资料丢失.本公司只提供补拍服务\r\n\
  11856. 8: 每次前来请务必携带本单交给工作人员.本单是您在摩登新娘拍照的凭证.办理有关手续凭本单办理盖\r\n\
  11857. 章后方可生效";
  11858. StrRect.top +=367;
  11859. StrRect.bottom +=367;
  11860. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11861. StrRect.top +=4;
  11862. StrRect.left +=2;
  11863. AutoDraw(m_Print, StrRect, str, 1.0);
  11864. StrRect=load.m_rcarray .ElementAt (34);
  11865. 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)";
  11866. AutoDraw(m_Print, StrRect, str, 1.0);
  11867. m_Print.SetFontFace(13, 1, "宋体");
  11868. StrRect=load.m_rcarray .ElementAt (35);
  11869. str="地 址: 汉口 . 解放大道 . 头道街东部购物公园C栋二,三层";
  11870. StrRect.top +=367;
  11871. StrRect.bottom +=367;
  11872. StrRect.left +=2;
  11873. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11874. StrRect=load.m_rcarray .ElementAt (36);
  11875. str="喜讯热线: 027-81888799 81888599 81888699";
  11876. StrRect.top +=367;
  11877. StrRect.bottom +=367;
  11878. StrRect.left +=2;
  11879. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11880. }
  11881. PrintPreview dlg;
  11882. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  11883. dlg.m_pDC =m_Print.GetPDC() ;
  11884. if(dlg.DoModal ()!=IDOK)return;
  11885. //结束打印
  11886. m_Print.EndPage();
  11887. m_Print.EndPrint();
  11888. #endif
  11889. }
  11890. extern CString GetHMoney(CString str);
  11891. void CMainFrame::PrintReceipt3(CString strOrderNumber, CStringArray *pArray, float money)
  11892. {
  11893. int printcot = 1;
  11894. for (int aa = 0; aa < printcot; aa++)
  11895. {
  11896. g_sendhead.bsql = 0;
  11897. g_sendhead.code[0] = 24;
  11898. g_sendhead.tabcount = 1;
  11899. int g_nYearposTemp = g_nYearpos;
  11900. g_nYearpos = -1;
  11901. g_pMainWnd->ProcessChatMessageRequest2(1);
  11902. g_nYearpos = g_nYearposTemp;
  11903. if (0 == g_bSendOK)return;
  11904. DataToArray(&g_cominfoarray);
  11905. CString SerialNo;
  11906. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  11907. CPrintRX m_Print;
  11908. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  11909. {
  11910. m_Print.InitToPrint(NULL, 1);
  11911. }
  11912. else
  11913. {
  11914. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  11915. if (name.IsEmpty())
  11916. m_Print.InitToPrint(NULL, 1);
  11917. else
  11918. {
  11919. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  11920. if (nret == -1 && aa == 0)
  11921. {
  11922. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  11923. }
  11924. }
  11925. }
  11926. m_Print.StartPrint();
  11927. m_Print.StartPage();
  11928. LoadRect load;
  11929. load.SetLiaPath("15.lia");
  11930. load.SetMargins(0, 0);
  11931. if (!load.Load())return;
  11932. int i;
  11933. //////////////////////////////////////////////////////////////
  11934. CStringArray txarray;
  11935. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  11936. g_sendhead.code[0] = 11;
  11937. g_sendhead.code[1] = 52;
  11938. g_sendhead.tabcount = 2;
  11939. g_sendhead.bsql = 0;
  11940. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  11941. CArray<CStringArray, CStringArray>sparray;
  11942. CArray<CStringArray, CStringArray>clientarray;
  11943. DataToArray(&g_List1array, &clientarray);
  11944. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  11945. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  11946. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  11947. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  11948. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  11949. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  11950. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  11951. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  11952. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  11953. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  11954. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  11955. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  11956. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  11957. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  11958. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  11959. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  11960. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  11961. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  11962. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  11963. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  11964. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  11965. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  11966. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  11967. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  11968. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  11969. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  11970. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  11971. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  11972. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  11973. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  11974. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  11975. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  11976. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  11977. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  11978. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  11979. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  11980. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  11981. CString m_addr = m_addr1 + ";";
  11982. m_addr.TrimLeft(";");
  11983. m_addr += m_addr2;
  11984. CString m_qq = m_qq1 + ";";
  11985. m_qq.TrimLeft(";");
  11986. m_qq += m_qq2;
  11987. m_money1.Format("%f", atof(m_taoxijiage));
  11988. m_money2.Format("%f", atof(m_payed1));
  11989. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  11990. ConvertToPrice(m_money1);
  11991. ConvertToPrice(m_money2);
  11992. ConvertToPrice(m_money3);
  11993. ////////////////////////////////////////////////////////////////
  11994. int rcpos = -1;
  11995. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  11996. m_Print.SetFontFace(17, 1, "宋体");
  11997. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11998. StrRect.top -= 0;
  11999. StrRect.bottom -= 10;
  12000. StrRect.left -= 140;
  12001. StrRect.right = StrRect.left + 48;
  12002. m_Print.SetFontFace(15, 1, "宋体");
  12003. m_Print.SetColor(0xffffff);
  12004. m_Print.DrawRect(StrRect, 0);
  12005. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12006. StrRect.left = StrRect.right;
  12007. StrRect.right = StrRect.left + 48;
  12008. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12009. m_Print.SetColor(0, RGB(255, 0, 0));
  12010. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12011. m_Print.SetColor(0);
  12012. m_Print.SetFontFace(12, 1, "宋体");
  12013. StrRect.left -= 48;
  12014. int hei = StrRect.Height();
  12015. StrRect.top = StrRect.bottom + 2;
  12016. StrRect.bottom += hei + 2;
  12017. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12018. StrRect.top = StrRect.bottom - 2;
  12019. StrRect.bottom += hei - 5;
  12020. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12021. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12022. m_Print.SetFontFace(12, 1, "宋体");
  12023. m_Print.DrawText((LPTSTR)(LPCTSTR)"收款单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12024. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12025. m_Print.SetFontFace(9, 1, "宋体");
  12026. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12027. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12028. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12029. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12030. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12031. m_Print.DrawRect2(StrRect, 2);
  12032. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12033. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12034. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12035. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12036. m_Print.DrawRect2(StrRect, 2);
  12037. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12038. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12039. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12040. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12041. m_Print.DrawRect2(StrRect, 2);
  12042. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12043. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约地点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12044. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12045. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12046. m_Print.DrawRect2(StrRect, 2);
  12047. ////////////
  12048. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12049. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12050. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12051. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12052. m_Print.DrawRect2(StrRect, 2);
  12053. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12054. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12055. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12056. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12057. m_Print.DrawRect2(StrRect, 2);
  12058. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12059. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12060. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12061. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12062. m_Print.DrawRect2(StrRect, 2);
  12063. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12064. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12065. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12066. m_Print.DrawText((LPTSTR)(LPCTSTR)g_date, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12067. m_Print.DrawRect2(StrRect, 2);
  12068. for (i = 19; i < 49; i++)
  12069. {
  12070. if (i >= 44)
  12071. {
  12072. StrRect = load.m_rcarray.ElementAt(i - 5);
  12073. int hei = StrRect.Height();
  12074. StrRect.top += hei;
  12075. StrRect.bottom += hei;
  12076. }
  12077. else
  12078. StrRect = load.m_rcarray.ElementAt(i);
  12079. m_Print.DrawRect2(StrRect, 1);
  12080. }
  12081. float fmoney = 0;
  12082. for (i = 19; i < 49; i++)
  12083. {
  12084. if (i >= 44)
  12085. {
  12086. StrRect = load.m_rcarray.ElementAt(i - 5);
  12087. int hei = StrRect.Height();
  12088. StrRect.top += hei;
  12089. StrRect.bottom += hei;
  12090. }
  12091. else
  12092. StrRect = load.m_rcarray.ElementAt(i);
  12093. StrRect.left += 2;
  12094. /* if((i-19)%5==2)
  12095. {
  12096. fmoney+=atof(pArray->ElementAt (i-19));
  12097. }*/
  12098. m_Print.DrawText((LPTSTR)(LPCTSTR)(pArray->ElementAt(i - 19)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12099. }
  12100. m_money2.Format("%f", money);
  12101. ConvertToPrice(m_money2);
  12102. StrRect = load.m_rcarray.ElementAt(44);
  12103. CString str;
  12104. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 实收¥: %s 元 收银员: %s", \
  12105. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  12106. m_money2, g_user.name);
  12107. m_Print.DrawRect2(StrRect, 1);
  12108. StrRect.left += 3;
  12109. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12110. StrRect = load.m_rcarray.ElementAt(46);
  12111. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12112. StrRect = load.m_rcarray.ElementAt(47);
  12113. m_Print.DrawRect2(StrRect, 2);
  12114. StrRect = load.m_rcarray.ElementAt(48);
  12115. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12116. StrRect = load.m_rcarray.ElementAt(45);
  12117. str = "\
  12118. 顾客须知\r\n\
  12119. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  12120. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  12121. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  12122. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  12123. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  12124. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  12125. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  12126. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12127. AutoDraw(m_Print, StrRect, str, 1.8);
  12128. PrintPreview dlg;
  12129. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12130. dlg.m_pDC = m_Print.GetPDC();
  12131. if (aa == 0)
  12132. {
  12133. if (dlg.DoModal() != IDOK)
  12134. return;
  12135. printcot = dlg.m_num;
  12136. }
  12137. //结束打印
  12138. m_Print.EndPage();
  12139. m_Print.EndPrint();
  12140. }
  12141. }
  12142. void CMainFrame::PrintReceipt2(CString strOrderNumber)
  12143. {
  12144. int printcot = 1;
  12145. for (int aa = 0; aa < printcot; aa++)
  12146. {
  12147. g_sendhead.bsql = 0;
  12148. g_sendhead.code[0] = 24;
  12149. g_sendhead.tabcount = 1;
  12150. int g_nYearposTemp = g_nYearpos;
  12151. g_nYearpos = -1;
  12152. g_pMainWnd->ProcessChatMessageRequest2(1);
  12153. g_nYearpos = g_nYearposTemp;
  12154. if (0 == g_bSendOK)return;
  12155. DataToArray(&g_cominfoarray);
  12156. CString SerialNo;
  12157. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  12158. CPrintRX m_Print;
  12159. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12160. {
  12161. m_Print.InitToPrint(NULL, 1);
  12162. }
  12163. else
  12164. {
  12165. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  12166. if (name.IsEmpty())
  12167. m_Print.InitToPrint(NULL, 1);
  12168. else
  12169. {
  12170. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12171. if (nret == -1 && aa == 0)
  12172. {
  12173. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12174. }
  12175. }
  12176. }
  12177. m_Print.StartPrint();
  12178. m_Print.StartPage();
  12179. LoadRect load;
  12180. load.SetLiaPath("14.lia");
  12181. load.SetMargins(0, 0);
  12182. if (!load.Load())return;
  12183. int i;
  12184. //////////////////////////////////////////////////////////////
  12185. CStringArray txarray;
  12186. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  12187. g_sendhead.code[0] = 11;
  12188. g_sendhead.code[1] = 52;
  12189. g_sendhead.code[2] = 93;
  12190. g_sendhead.tabcount = 3;
  12191. g_sendhead.bsql = 0;
  12192. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12193. CArray<CStringArray, CStringArray>sparray;
  12194. CArray<CStringArray, CStringArray>clientarray;
  12195. CArray<CStringArray, CStringArray>moneyarray;
  12196. DataToArray(&g_List1array, &clientarray, &moneyarray);
  12197. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12198. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12199. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12200. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12201. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12202. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  12203. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12204. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12205. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12206. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12207. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12208. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12209. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12210. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12211. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12212. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12213. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12214. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12215. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12216. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12217. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12218. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12219. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12220. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12221. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12222. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12223. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12224. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12225. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  12226. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12227. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12228. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  12229. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  12230. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  12231. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  12232. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  12233. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  12234. CString m_addr = m_addr1 + ";";
  12235. m_addr.TrimLeft(";");
  12236. m_addr += m_addr2;
  12237. CString m_qq = m_qq1 + ";";
  12238. m_qq.TrimLeft(";");
  12239. m_qq += m_qq2;
  12240. m_money1.Format("%f", atof(m_taoxijiage));
  12241. m_money2 = "0";
  12242. for (i = 0; i < moneyarray.GetSize(); i++)
  12243. {
  12244. if (moneyarray.ElementAt(i).ElementAt(5) == "预约收款")
  12245. m_money2 = moneyarray.ElementAt(i).ElementAt(1);
  12246. }
  12247. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  12248. ConvertToPrice(m_money1);
  12249. ConvertToPrice(m_money2);
  12250. ConvertToPrice(m_money3);
  12251. ////////////////////////////////////////////////////////////////
  12252. int rcpos = -1;
  12253. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12254. m_Print.SetFontFace(17, 1, "宋体");
  12255. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12256. StrRect.top -= 0;
  12257. StrRect.bottom -= 10;
  12258. StrRect.left -= 140;
  12259. StrRect.right = StrRect.left + 48;
  12260. m_Print.SetFontFace(15, 1, "宋体");
  12261. m_Print.SetColor(0xffffff);
  12262. m_Print.DrawRect(StrRect, 0);
  12263. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12264. StrRect.left = StrRect.right;
  12265. StrRect.right = StrRect.left + 48;
  12266. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12267. m_Print.SetColor(0, RGB(255, 0, 0));
  12268. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12269. m_Print.SetColor(0);
  12270. m_Print.SetFontFace(12, 1, "宋体");
  12271. StrRect.left -= 48;
  12272. int hei = StrRect.Height();
  12273. StrRect.top = StrRect.bottom + 2;
  12274. StrRect.bottom += hei + 2;
  12275. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12276. StrRect.top = StrRect.bottom - 2;
  12277. StrRect.bottom += hei - 5;
  12278. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12279. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12280. m_Print.SetFontFace(12, 1, "宋体");
  12281. m_Print.DrawText((LPTSTR)(LPCTSTR)"定金单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12282. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12283. m_Print.SetFontFace(9, 1, "宋体");
  12284. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12285. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12286. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12287. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12288. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12289. m_Print.DrawRect2(StrRect, 2);
  12290. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12291. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12292. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12293. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12294. m_Print.DrawRect2(StrRect, 2);
  12295. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12296. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12297. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12298. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12299. m_Print.DrawRect2(StrRect, 2);
  12300. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12301. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约地点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12302. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12303. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12304. m_Print.DrawRect2(StrRect, 2);
  12305. ////////////
  12306. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12307. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12308. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12309. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12310. m_Print.DrawRect2(StrRect, 2);
  12311. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12312. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12313. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12314. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12315. m_Print.DrawRect2(StrRect, 2);
  12316. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12317. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12318. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12319. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12320. m_Print.DrawRect2(StrRect, 2);
  12321. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12322. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12323. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12324. m_Print.DrawText((LPTSTR)(LPCTSTR)g_date, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12325. m_Print.DrawRect2(StrRect, 2);
  12326. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12327. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客地址:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12328. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12329. m_Print.DrawText((LPTSTR)(LPCTSTR)m_addr, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12330. m_Print.DrawRect2(StrRect, 2);
  12331. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12332. m_Print.DrawText((LPTSTR)(LPCTSTR)"大婚时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12333. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12334. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12335. m_Print.DrawRect2(StrRect, 2);
  12336. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12337. m_Print.DrawText((LPTSTR)(LPCTSTR)"QQ/MSN:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12338. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12339. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12340. m_Print.DrawRect2(StrRect, 2);
  12341. CStringArray strarray;
  12342. strarray.Add("套系名称");
  12343. strarray.Add("总 额");
  12344. strarray.Add("定 金");
  12345. strarray.Add("余 款");
  12346. strarray.Add("摄影日期");
  12347. strarray.Add(m_taoxiname);
  12348. strarray.Add(m_money1);
  12349. strarray.Add(m_money2);
  12350. strarray.Add(m_money3);
  12351. strarray.Add(m_time2);
  12352. for (i = 25; i < 37; i++)
  12353. {
  12354. StrRect = load.m_rcarray.ElementAt(i);
  12355. m_Print.DrawRect2(StrRect, 1);
  12356. }
  12357. for (i = 25; i < 35; i++)
  12358. {
  12359. StrRect = load.m_rcarray.ElementAt(i);
  12360. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 25), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12361. }
  12362. StrRect = load.m_rcarray.ElementAt(35);
  12363. StrRect.left += 5;
  12364. StrRect.top += 5;
  12365. m_Print.DrawText((LPTSTR)(LPCTSTR)" 备 注:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  12366. StrRect = load.m_rcarray.ElementAt(36);
  12367. CString str;
  12368. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 ¥: %s 元 收银员: %s", \
  12369. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  12370. m_money2, g_user.name);
  12371. StrRect.left += 3;
  12372. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12373. StrRect = load.m_rcarray.ElementAt(38);
  12374. m_Print.DrawText((LPTSTR)(LPCTSTR)"营业员:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12375. StrRect = load.m_rcarray.ElementAt(39);
  12376. m_Print.DrawText((LPTSTR)(LPCTSTR)m_ren, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12377. m_Print.DrawRect2(StrRect, 2);
  12378. StrRect = load.m_rcarray.ElementAt(40);
  12379. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12380. StrRect = load.m_rcarray.ElementAt(41);
  12381. m_Print.DrawRect2(StrRect, 2);
  12382. StrRect = load.m_rcarray.ElementAt(42);
  12383. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12384. StrRect = load.m_rcarray.ElementAt(37);
  12385. str = "\
  12386. 顾客须知\r\n\
  12387. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  12388. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  12389. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  12390. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  12391. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  12392. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  12393. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  12394. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12395. AutoDraw(m_Print, StrRect, str, 1.8);
  12396. PrintPreview dlg;
  12397. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12398. dlg.m_pDC = m_Print.GetPDC();
  12399. if (aa == 0)
  12400. {
  12401. if (dlg.DoModal() != IDOK)
  12402. return;
  12403. printcot = dlg.m_num;
  12404. }
  12405. //结束打印
  12406. m_Print.EndPage();
  12407. m_Print.EndPrint();
  12408. }
  12409. }
  12410. void CMainFrame::OnAutodelphoto()
  12411. {
  12412. // TODO: Add your command handler code here
  12413. if (g_user.bLongin == 0)
  12414. {
  12415. if (g_bNoLoginLia)
  12416. {
  12417. Login dlg;
  12418. dlg.SetLiaPath("5.lia");
  12419. dlg.DoModal();
  12420. }
  12421. else
  12422. {
  12423. Login3 dlg;
  12424. dlg.SetLiaPath("5.lia");
  12425. dlg.DoModal();
  12426. }
  12427. if (g_user.bLongin == 0)return;
  12428. }
  12429. if (IsHasRightsnew(49) == 0)return;
  12430. DelPhotoSet dlg;
  12431. dlg.DoModal();
  12432. }
  12433. void CMainFrame::Onphotomanage() // 客照管理中心;
  12434. {
  12435. if (g_user.bLongin == 0)
  12436. {
  12437. if (g_bNoLoginLia)
  12438. {
  12439. Login dlg;
  12440. dlg.SetLiaPath("5.lia");
  12441. dlg.DoModal();
  12442. }
  12443. else
  12444. {
  12445. Login3 dlg;
  12446. dlg.SetLiaPath("5.lia");
  12447. dlg.DoModal();
  12448. }
  12449. if (g_user.bLongin == 0)return;
  12450. }
  12451. if (IsHasRightsnew(49) == 0)return;
  12452. ShowPic3 dlg;
  12453. dlg.DoModal();
  12454. }
  12455. void CMainFrame::OnCompanyinfo()
  12456. {
  12457. // TODO: Add your command handler code here
  12458. if (g_user.bLongin == 0)
  12459. {
  12460. if (g_bNoLoginLia)
  12461. {
  12462. Login dlg;
  12463. dlg.SetLiaPath("5.lia");
  12464. dlg.DoModal();
  12465. }
  12466. else
  12467. {
  12468. Login3 dlg;
  12469. dlg.SetLiaPath("5.lia");
  12470. dlg.DoModal();
  12471. }
  12472. if (g_user.bLongin == 0)return;
  12473. }
  12474. if (IsHasRightsnew(49) == 0)return;
  12475. CompanyInfo dlg;
  12476. dlg.DoModal();
  12477. }
  12478. void CMainFrame::OnTaoxifg()
  12479. {
  12480. // TODO: Add your command handler code here
  12481. if (g_user.bLongin == 0)
  12482. {
  12483. if (g_bNoLoginLia)
  12484. {
  12485. Login dlg;
  12486. dlg.SetLiaPath("5.lia");
  12487. dlg.DoModal();
  12488. }
  12489. else
  12490. {
  12491. Login3 dlg;
  12492. dlg.SetLiaPath("5.lia");
  12493. dlg.DoModal();
  12494. }
  12495. if (g_user.bLongin == 0)return;
  12496. }
  12497. if (IsHasRightsnew(49) == 0)return;
  12498. TXFG dlg;
  12499. dlg.DoModal();
  12500. }
  12501. void CMainFrame::OnHelpfile()
  12502. {
  12503. // TODO: Add your command handler code here
  12504. // ShellExecute(NULL, _T("open"), _T(g_mainpath+"\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  12505. // if(::PathFileExists (g_mainpath+"\\zx.dll"))
  12506. // ShellExecute(NULL, _T("open"), _T("www.zcsmkj.com"), "", NULL, SW_SHOWNORMAL);
  12507. // else
  12508. ShellExecute(NULL, _T("open"), _T("www.lyfz.net"), "", NULL, SW_SHOWNORMAL);
  12509. }
  12510. void CMainFrame::OnPhotobak()
  12511. {
  12512. // TODO: Add your command handler code here
  12513. if (g_user.bLongin == 0)
  12514. {
  12515. if (g_bNoLoginLia)
  12516. {
  12517. Login dlg;
  12518. dlg.SetLiaPath("5.lia");
  12519. dlg.DoModal();
  12520. }
  12521. else
  12522. {
  12523. Login3 dlg;
  12524. dlg.SetLiaPath("5.lia");
  12525. dlg.DoModal();
  12526. }
  12527. if (g_user.bLongin == 0)return;
  12528. }
  12529. if (IsHasRightsnew(49) == 0)return;
  12530. PhotoBak dlg;
  12531. dlg.DoModal();
  12532. }
  12533. //客户报表
  12534. void CMainFrame::OnClose2()
  12535. { // TODO: Add your message handler code here and/or call default
  12536. if (AfxMessageBox("是否退出系统?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  12537. if(g_user.bLongin)
  12538. WriteLog("退出系统!", "退出系统!");
  12539. g_bShowBar = 0;
  12540. if (m_Mdi.MainClose())
  12541. CMDIFrameWnd::OnClose();
  12542. }
  12543. //
  12544. void CMainFrame::ResetTimer()
  12545. {
  12546. }
  12547. void CMainFrame::LinkClick(CString str, int nParent)
  12548. {
  12549. g_pMainWnd2->m_bar.LinkClick(str);
  12550. }
  12551. void CMainFrame::PrintFlowChart2(CString m_id)
  12552. {
  12553. CPrintRX m_Print;
  12554. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12555. {
  12556. m_Print.InitToPrint(NULL, 1);
  12557. }
  12558. else
  12559. {
  12560. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  12561. if (name.IsEmpty())
  12562. m_Print.InitToPrint(NULL, 1);
  12563. else
  12564. {
  12565. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12566. if (nret == -1)
  12567. {
  12568. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12569. }
  12570. }
  12571. }
  12572. m_Print.StartPrint();
  12573. m_Print.StartPage();
  12574. LoadRect load;
  12575. load.SetLiaPath("16.lia");
  12576. load.SetMargins(0, 0);
  12577. if (!load.Load())return;
  12578. LoadRect load2;
  12579. load2.SetLiaPath("17.lia");
  12580. load2.SetMargins(0, 660);
  12581. if (!load2.Load())return;
  12582. int i;
  12583. //////////////////////////////////////////////////////////////
  12584. CStringArray txarray;
  12585. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and kind<>'2'";
  12586. g_sendhead.code[0] = 11;
  12587. g_sendhead.code[1] = 52;
  12588. g_sendhead.code[2] = 223;
  12589. g_sendhead.tabcount = 3;
  12590. g_sendhead.bsql = 0;
  12591. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12592. CArray<CStringArray, CStringArray>sparray;
  12593. CArray<CStringArray, CStringArray>clientarray;
  12594. DataToArray(&g_List1array, &clientarray, &sparray);
  12595. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12596. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12597. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12598. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12599. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12600. CString m_photocount = g_List1array.ElementAt(0).ElementAt(9);
  12601. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12602. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12603. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12604. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12605. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12606. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12607. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12608. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12609. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12610. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12611. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12612. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12613. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12614. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12615. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12616. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12617. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12618. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12619. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12620. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12621. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12622. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12623. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(39) + g_List1array.ElementAt(0).ElementAt(75);
  12624. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12625. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12626. CString spno;
  12627. for (i = 0; i < sparray.GetSize(); i++)
  12628. {
  12629. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  12630. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  12631. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  12632. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12633. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12634. spno += sparray.ElementAt(i).ElementAt(5);
  12635. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12636. spno += "; ";
  12637. else
  12638. {
  12639. spno += ":";
  12640. spno += sparray.ElementAt(i).ElementAt(6);
  12641. spno += "; ";
  12642. }
  12643. }
  12644. spno += " 加挑:";
  12645. for (i = 0; i < sparray.GetSize(); i++)
  12646. {
  12647. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  12648. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  12649. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  12650. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12651. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12652. spno += sparray.ElementAt(i).ElementAt(5);
  12653. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12654. spno += "; ";
  12655. else
  12656. {
  12657. spno += ":";
  12658. spno += sparray.ElementAt(i).ElementAt(6);
  12659. spno += "; ";
  12660. }
  12661. }
  12662. if (spno.Right(6) == " 加挑:")
  12663. {
  12664. spno = spno.Left(spno.GetLength() - 6);
  12665. }
  12666. ////////////////////////////////////////////////////////////////
  12667. int rcpos = -1;
  12668. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12669. m_Print.SetFontFace(17, 1, "宋体");
  12670. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12671. StrRect.top -= 0;
  12672. StrRect.bottom -= 10;
  12673. StrRect.left -= 140;
  12674. StrRect.right = StrRect.left + 48;
  12675. m_Print.SetFontFace(15, 1, "宋体");
  12676. m_Print.SetColor(0xffffff);
  12677. m_Print.DrawRect(StrRect, 0);
  12678. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12679. StrRect.left = StrRect.right;
  12680. StrRect.right = StrRect.left + 48;
  12681. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12682. m_Print.SetColor(0, RGB(255, 0, 0));
  12683. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12684. m_Print.SetColor(0);
  12685. m_Print.SetFontFace(12, 1, "宋体");
  12686. StrRect.left -= 48;
  12687. int hei = StrRect.Height();
  12688. StrRect.top = StrRect.bottom + 2;
  12689. StrRect.bottom += hei + 2;
  12690. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12691. StrRect.top = StrRect.bottom - 2;
  12692. StrRect.bottom += hei - 5;
  12693. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12694. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12695. m_Print.SetFontFace(12, 1, "宋体");
  12696. m_Print.DrawText((LPTSTR)(LPCTSTR)"加做取件单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12697. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12698. m_Print.SetFontFace(11, 1, "宋体");
  12699. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + m_id), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12700. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12701. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12702. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12703. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12704. m_Print.DrawRect2(StrRect, 2);
  12705. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12706. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12707. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12708. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12709. m_Print.DrawRect2(StrRect, 2);
  12710. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12711. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12712. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12713. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time4, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12714. m_Print.DrawRect2(StrRect, 2);
  12715. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12716. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12717. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12718. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time5, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12719. m_Print.DrawRect2(StrRect, 2);
  12720. ////////////
  12721. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12722. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12723. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12724. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12725. m_Print.DrawRect2(StrRect, 2);
  12726. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12727. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12728. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12729. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12730. m_Print.DrawRect2(StrRect, 2);
  12731. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12732. m_Print.DrawText((LPTSTR)(LPCTSTR)"赠送张数:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12733. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12734. m_Print.DrawText((LPTSTR)(LPCTSTR)m_photocount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12735. m_Print.DrawRect2(StrRect, 2);
  12736. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12737. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12738. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12739. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12740. m_Print.DrawRect2(StrRect, 2);
  12741. ////////////
  12742. ///////////spno
  12743. CRect sprc[22];
  12744. StrRect = load.m_rcarray.ElementAt(19);
  12745. StrRect.left += 4; StrRect.right -= 3;
  12746. hei = StrRect.Height();
  12747. for (i = 0; i < 22; i++)
  12748. {
  12749. sprc[i] = StrRect;
  12750. m_Print.DrawRect2(StrRect, 1);
  12751. if (i == 0)
  12752. {
  12753. StrRect.left += 5;
  12754. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12755. StrRect.left -= 5;
  12756. }
  12757. StrRect.top = StrRect.bottom;
  12758. StrRect.bottom = StrRect.top + hei;
  12759. sprc[i].left += 4; sprc[i].right -= 3;
  12760. }
  12761. StrRect.bottom = StrRect.top + 60;
  12762. m_Print.DrawRect2(StrRect, 1);
  12763. StrRect.left += 3; StrRect.top += 3;
  12764. StrRect.right -= 3; StrRect.bottom -= 3;
  12765. AutoDraw(m_Print, StrRect, m_bz, 1.8);
  12766. CString temp, tempspno, tempbz;
  12767. CSize size;
  12768. BOOL bRun = 0;
  12769. int fontsize = 12;
  12770. ll: tempspno = spno;
  12771. m_Print.SetFontFace(fontsize, 1, "宋体");
  12772. for (i = 1; i<22; i++)
  12773. {
  12774. if (!tempspno.IsEmpty())
  12775. {
  12776. temp = tempspno;
  12777. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12778. int right = 0;
  12779. CRect temprc = sprc[i];
  12780. while (size.cx>temprc.Width())
  12781. {
  12782. right++;
  12783. temp = tempspno.Left(tempspno.GetLength() - (right));
  12784. if (GIsHalfHZ(temp))
  12785. {
  12786. right++;
  12787. temp.Delete(temp.GetLength() - 1);
  12788. }
  12789. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12790. }
  12791. if (bRun)
  12792. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12793. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  12794. if (tempspno.IsEmpty())i++;
  12795. }
  12796. }
  12797. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  12798. {
  12799. fontsize--;
  12800. goto ll;
  12801. }
  12802. if (bRun == 0)
  12803. {
  12804. bRun = 1;
  12805. goto ll;
  12806. }
  12807. m_Print.SetFontFace(12, 1, "宋体");
  12808. StrRect = load2.m_rcarray.ElementAt(1);
  12809. m_Print.DrawText((LPTSTR)(LPCTSTR)"喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12810. StrRect = load2.m_rcarray.ElementAt(2);
  12811. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12812. StrRect = load2.m_rcarray.ElementAt(3);
  12813. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12814. StrRect = load2.m_rcarray.ElementAt(4);
  12815. m_Print.DrawRect2(StrRect, 2);
  12816. StrRect = load2.m_rcarray.ElementAt(0);
  12817. CString str = "\
  12818. 爱心提示:如对制作有任何要求请清楚列出,所有制作内容一经确认将按要求制作。\r\n\
  12819. 选样文件从拍摄日期计算将保留二个月;套相成品按取件日期保留三个月,逾期不做保留。\r\n\
  12820. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12821. AutoDraw(m_Print, StrRect, str, 1.8);
  12822. PrintPreview dlg; dlg.m_mode = 2;
  12823. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12824. dlg.m_pDC = m_Print.GetPDC();
  12825. if (dlg.DoModal() != IDOK)return;
  12826. //结束打印
  12827. m_Print.EndPage();
  12828. m_Print.EndPrint();
  12829. }
  12830. //分店
  12831. CString CMainFrame::GetDanWei(CString name, CArray<CStringArray, CStringArray>*array)
  12832. {
  12833. for (int i = 0; i < array->GetSize(); i++)
  12834. {
  12835. if (name == array->ElementAt(i).ElementAt(1))
  12836. return array->ElementAt(i).ElementAt(2);
  12837. }
  12838. return "";
  12839. }
  12840. //g_sendhead
  12841. int CMainFrame::GetPort()
  12842. {
  12843. static int aaa = -1;
  12844. if (aaa == -1)
  12845. {
  12846. aaa = CTime::GetCurrentTime().GetSecond() % 7;
  12847. }
  12848. aaa++;
  12849. if (aaa >= 7)aaa = 0;
  12850. return 8387 + aaa;
  12851. }
  12852. void CMainFrame::OnShowBakState()
  12853. {
  12854. // TODO: Add your command handler code here
  12855. g_sendhead.bsql = 0;
  12856. g_sendhead.code[0] = 171;
  12857. g_sendhead.tabcount = 1;
  12858. g_pMainWnd->ProcessChatMessageRequest2(1);
  12859. if (g_bSendOK == 0)
  12860. {
  12861. return;
  12862. }
  12863. CArray<CStringArray, CStringArray>g_bakstatearray;
  12864. DataToArray(&g_bakstatearray);
  12865. while (g_bakstatearray.GetSize() > 7)
  12866. {
  12867. g_bakstatearray.RemoveAt(0);
  12868. }
  12869. int photocount = 0;
  12870. int infocount = 0;
  12871. for (int i = 0; i < g_bakstatearray.GetSize(); i++)
  12872. {
  12873. if (g_bakstatearray.ElementAt(i).ElementAt(1) != "1")photocount++;
  12874. if (g_bakstatearray.ElementAt(i).ElementAt(2) != "1")infocount++;
  12875. }
  12876. ShowBakState dlg;
  12877. dlg.m_pArray = &g_bakstatearray;
  12878. dlg.DoModal();
  12879. }
  12880. void CMainFrame::PrintReceipt2(CStringArray *pArray)
  12881. {
  12882. int i = 0;
  12883. int printcot = 1;
  12884. for (int aa = 0; aa < printcot; aa++)
  12885. {
  12886. g_sendhead.bsql = 0;
  12887. g_sendhead.code[0] = 24;
  12888. g_sendhead.tabcount = 1;
  12889. int g_nYearposTemp = g_nYearpos;
  12890. g_nYearpos = -1;
  12891. g_pMainWnd->ProcessChatMessageRequest2(1);
  12892. g_nYearpos = g_nYearposTemp;
  12893. if (0 == g_bSendOK)return;
  12894. DataToArray(&g_cominfoarray);
  12895. CString SerialNo;
  12896. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  12897. CPrintRX m_Print;
  12898. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12899. {
  12900. m_Print.InitToPrint(NULL, 1);
  12901. }
  12902. else
  12903. {
  12904. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  12905. if (name.IsEmpty())
  12906. m_Print.InitToPrint(NULL, 1);
  12907. else
  12908. {
  12909. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12910. if (nret == -1 && aa == 0)
  12911. {
  12912. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12913. }
  12914. }
  12915. }
  12916. m_Print.StartPrint();
  12917. m_Print.StartPage();
  12918. LoadRect load;
  12919. BOOL bSmall = 0;
  12920. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  12921. {
  12922. bSmall = 1;
  12923. load.SetLiaPath("20.lia");
  12924. }
  12925. else
  12926. load.SetLiaPath("10.lia");
  12927. if (bSmall)
  12928. load.SetMargins(-10, 0);
  12929. else
  12930. load.SetMargins(10, 0);
  12931. if (!load.Load())return;
  12932. int rcpos = -1;
  12933. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12934. Image *pImg = NULL;
  12935. #ifdef MNLS_VERSION
  12936. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  12937. #else
  12938. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  12939. #endif
  12940. // m_Print.DrawImage(pImg, StrRect);
  12941. delete pImg;
  12942. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  12943. {
  12944. Image *pImg = NULL;
  12945. g_nSendCode = 31;
  12946. int g_nYearposTemp = g_nYearpos;
  12947. g_nYearpos = -1;
  12948. g_pMainWnd->ProcessChatMessageRequest2(1);
  12949. g_nYearpos = g_nYearposTemp;
  12950. g_nSendCode = 0;
  12951. if (g_bSendOK == 0)return;
  12952. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  12953. if (pImg)
  12954. {
  12955. StrRect.left = 65;
  12956. if (bSmall)StrRect.left = 55;
  12957. StrRect.top = 10;
  12958. StrRect.right = StrRect.left + 58;
  12959. StrRect.bottom = StrRect.top + 58;
  12960. m_Print.DrawImage(pImg, StrRect);
  12961. delete pImg; pImg = NULL;
  12962. }
  12963. }
  12964. if (bSmall)
  12965. {
  12966. m_Print.SetFontFace(18, 1, "黑体");
  12967. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12968. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12969. m_Print.SetFontFace(9, 1, "宋体");
  12970. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12971. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12972. m_Print.SetFontFace(6, 1, "宋体");
  12973. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12974. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12975. m_Print.SetFontFace(9, 1, "宋体");
  12976. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12977. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12978. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12979. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12980. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12981. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12982. int hei = StrRect.Height();
  12983. StrRect.bottom = StrRect.top;
  12984. StrRect.top -= 8;
  12985. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  12986. m_Print.SetFontFace(10, 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);
  12990. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12991. m_Print.SetFontFace(9, 1, "宋体");
  12992. for ( i = 7; i < 24; i++)
  12993. {
  12994. StrRect = load.m_rcarray.ElementAt(i);
  12995. m_Print.DrawRect2(StrRect, 1);
  12996. }
  12997. for (i = 9; i < 24; i++)
  12998. {
  12999. StrRect = load.m_rcarray.ElementAt(i);
  13000. StrRect.left += 2;
  13001. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13002. }
  13003. m_Print.SetFontFace(6, 1, "宋体");
  13004. for (i = 24; i < 26; i++)
  13005. {
  13006. StrRect = load.m_rcarray.ElementAt(i);
  13007. StrRect.left += 2;
  13008. if (i == 24)
  13009. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13010. else
  13011. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13012. }
  13013. }
  13014. else//大单
  13015. {
  13016. m_Print.SetFontFace(20, 1, "黑体");
  13017. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13018. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13019. m_Print.SetFontFace(11, 1, "宋体");
  13020. // StrRect=load.m_rcarray .ElementAt (++rcpos);
  13021. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13022. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15;
  13023. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13024. int hei = StrRect.Height();
  13025. StrRect.bottom = StrRect.top;
  13026. StrRect.top -= 10;
  13027. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  13028. m_Print.SetFontFace(8, 1, "宋体");
  13029. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13030. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13031. m_Print.SetFontFace(11, 1, "宋体");
  13032. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13033. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13034. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13035. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13036. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13037. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13038. m_Print.SetFontFace(13, 1, "宋体");
  13039. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13040. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13041. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13042. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13043. m_Print.SetFontFace(11, 1, "宋体");
  13044. for ( i = 7; i < 24; i++)
  13045. {
  13046. StrRect = load.m_rcarray.ElementAt(i);
  13047. m_Print.DrawRect2(StrRect, 1);
  13048. }
  13049. for (i = 9; i < 24; i++)
  13050. {
  13051. StrRect = load.m_rcarray.ElementAt(i);
  13052. StrRect.left += 2;
  13053. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13054. }
  13055. m_Print.SetFontFace(8, 1, "宋体");
  13056. for (i = 24; i < 27; i++)
  13057. {
  13058. StrRect = load.m_rcarray.ElementAt(i);
  13059. StrRect.left += 2;
  13060. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13061. }
  13062. }
  13063. PrintPreview dlg;
  13064. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13065. dlg.m_pDC = m_Print.GetPDC();
  13066. if (aa == 0)
  13067. {
  13068. if (dlg.DoModal() != IDOK)
  13069. return;
  13070. printcot = dlg.m_num;
  13071. }
  13072. //结束打印
  13073. m_Print.EndPage();
  13074. m_Print.EndPrint();
  13075. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  13076. CString sql;
  13077. sql.Format("update version set [serialno2]='%s'", SerialNo);
  13078. g_sendhead.bsql = 1;
  13079. g_nYearposTemp = g_nYearpos;
  13080. g_nYearpos = -1;
  13081. g_pMainWnd->ProcessChatMessageRequest2(sql);
  13082. g_nYearpos = g_nYearposTemp;
  13083. }
  13084. }
  13085. //出生年月
  13086. //第一联
  13087. void CMainFrame::OnLog()
  13088. {
  13089. // TODO: Add your command handler code here OnShowBakState
  13090. if (IsHasRightsnew(49) == 0)return;
  13091. ShowLOg dlg;
  13092. dlg.DoModal();
  13093. }
  13094. // www.lyfz.net 8888
  13095. void CMainFrame::PrintDinDan6(CString m_id)
  13096. {
  13097. // TODO: Add your control notification handler code here 预约订单
  13098. int printcot = 1;
  13099. for (int aa = 0; aa < printcot; aa++)
  13100. {
  13101. PrintPreview dlg;
  13102. CPrintRX m_Print;
  13103. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13104. {
  13105. m_Print.InitToPrint(NULL, 1);
  13106. }
  13107. else
  13108. {
  13109. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  13110. if (name.IsEmpty())
  13111. m_Print.InitToPrint(NULL, 1);
  13112. else
  13113. {
  13114. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13115. if (nret == -1 && aa == 0)
  13116. {
  13117. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  13118. }
  13119. }
  13120. }
  13121. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  13122. {
  13123. m_Print.StartPrint();
  13124. m_Print.StartPage();
  13125. LoadRect load;
  13126. load.SetLiaPath("6.lia");
  13127. load.SetMargins(-14, 15);
  13128. if (!load.Load())return;
  13129. LoadRect load2;
  13130. load2.SetLiaPath("7.lia");
  13131. load2.SetMargins(-14, 216 + 15);
  13132. if (!load2.Load())return;
  13133. LoadRect load3;
  13134. load3.SetLiaPath("8.lia");
  13135. load3.SetMargins(-14, 705 + 15);
  13136. if (!load3.Load())return;
  13137. int i;
  13138. //////////////////////////////////////////////////////////////
  13139. CStringArray txarray;
  13140. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  13141. g_sendhead.code[0] = 11;
  13142. g_sendhead.code[1] = 52;
  13143. g_sendhead.code[2] = 50;
  13144. g_sendhead.code[3] = 150;
  13145. g_sendhead.code[4] = 77;
  13146. g_sendhead.code[5] = 4;
  13147. g_sendhead.tabcount = 6;
  13148. g_sendhead.bsql = 0;
  13149. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  13150. CArray<CStringArray, CStringArray>sparray;
  13151. CArray<CStringArray, CStringArray>clientarray;
  13152. CArray<CStringArray, CStringArray>phonearray;
  13153. CArray<CStringArray, CStringArray>fgarray;
  13154. CArray<CStringArray, CStringArray>danweiarray;
  13155. CArray<CStringArray, CStringArray>jdarray;
  13156. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  13157. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  13158. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  13159. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  13160. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  13161. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  13162. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  13163. CString m_taoxiname;
  13164. if (m_zs.Find("\\") != -1)
  13165. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  13166. else
  13167. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  13168. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  13169. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  13170. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  13171. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  13172. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  13173. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  13174. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  13175. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  13176. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  13177. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  13178. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  13179. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  13180. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  13181. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  13182. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  13183. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  13184. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  13185. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  13186. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  13187. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  13188. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  13189. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  13190. if (jdarray.GetSize())
  13191. {
  13192. if (m_bz.IsEmpty() == 0)
  13193. m_bz = "\r\n" + m_bz;
  13194. m_bz += "景点:";
  13195. }
  13196. for (i = 0; i < jdarray.GetSize(); i++)
  13197. {
  13198. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  13199. }
  13200. m_bz.TrimRight(";");
  13201. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  13202. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13203. if (IsHasRights2new(31) == 0)
  13204. {
  13205. m_phone1 = "***";
  13206. m_phone2 = "***";
  13207. }
  13208. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  13209. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13210. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  13211. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  13212. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  13213. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  13214. filter = "name='" + m_ren + "'";
  13215. g_sendhead.code[0] = 5;
  13216. g_sendhead.tabcount = 1;
  13217. g_sendhead.bsql = 0;
  13218. int g_nYearposTemp = g_nYearpos;
  13219. g_nYearpos = -1;
  13220. g_pMainWnd->ProcessChatMessageRequest2(filter);
  13221. g_nYearpos = g_nYearposTemp;
  13222. if (g_bSendOK == 0)return;
  13223. DataToArray(&phonearray);
  13224. m_money1.Format("%f", atof(m_taoxijiage));
  13225. m_money2.Format("%f", atof(m_payed1));
  13226. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  13227. ConvertToPrice(m_money1);
  13228. ConvertToPrice(m_money2);
  13229. ConvertToPrice(m_money3);
  13230. ////////////////////////////////////////////////////////////////
  13231. int rcpos = -1;
  13232. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13233. StrRect.top -= 15; StrRect.bottom -= 15;
  13234. Image *pImg = NULL;
  13235. #ifdef MNLS_VERSION
  13236. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  13237. #else
  13238. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  13239. #endif
  13240. m_Print.DrawImage(pImg, StrRect);
  13241. delete pImg;
  13242. m_Print.SetFontFace(11, 1, "宋体");
  13243. StrRect = load.m_rcarray.ElementAt(20);
  13244. StrRect.right = load.m_rcarray.ElementAt(23).right;
  13245. StrRect.top -= 18; StrRect.bottom -= 18;
  13246. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  13247. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13248. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  13249. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13250. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13251. StrRect.top -= 15; StrRect.bottom -= 15;
  13252. #ifdef MNLS_VERSION
  13253. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13254. #endif
  13255. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13256. StrRect.top -= 15; StrRect.bottom -= 15;
  13257. #ifdef MNLS_VERSION
  13258. m_Print.DrawRect(StrRect);
  13259. #endif
  13260. m_Print.SetFontFace(7, 1, "黑体");
  13261. m_Print.SetColor(0xffffff);
  13262. #ifdef MNLS_VERSION
  13263. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13264. #endif
  13265. m_Print.SetColor(0);
  13266. m_Print.SetFontFace(15, 1, "宋体");
  13267. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13268. StrRect.top -= 15; StrRect.bottom -= 15;
  13269. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同拍摄单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13270. CStringArray strarray;
  13271. strarray.Add("NO: " + m_id);
  13272. CString date;
  13273. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  13274. strarray.Add(date);
  13275. strarray.Add("喜爱");
  13276. strarray.Add("格调");
  13277. if (fgarray.GetSize() == 12)
  13278. {
  13279. for (int i = 0; i < 12; i++)
  13280. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  13281. }
  13282. else
  13283. {
  13284. strarray.Add("复古典雅");
  13285. strarray.Add("温文尔雅");
  13286. strarray.Add("豪华艳丽");
  13287. strarray.Add("传统大方");
  13288. strarray.Add("新潮个性");
  13289. strarray.Add("浪漫奔放");
  13290. strarray.Add("简单素雅");
  13291. strarray.Add("活泼俏丽");
  13292. strarray.Add("妩媚温馨");
  13293. strarray.Add("温柔贤惠");
  13294. strarray.Add("成熟感性");
  13295. strarray.Add("清纯可爱");
  13296. }
  13297. strarray.Add("姓名");
  13298. // strarray.Add("职业");
  13299. strarray.Add("");
  13300. strarray.Add("地址");
  13301. strarray.Add("电话");
  13302. #ifdef CHILD_VERSION
  13303. strarray.Add("家长");
  13304. strarray.Add("宝宝");
  13305. #else
  13306. strarray.Add("先生");
  13307. strarray.Add("女士");
  13308. #endif
  13309. m_Print.SetFontFace(11, 1, "宋体");
  13310. for (i = 0; i < strarray.GetSize(); i++)
  13311. {
  13312. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13313. if (i < 2)
  13314. {
  13315. StrRect.top -= 15; StrRect.bottom -= 15;
  13316. }
  13317. if (i>15)
  13318. m_Print.DrawRect2(StrRect, 1);
  13319. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13320. }
  13321. for (i = 29; i <= 40; i++)
  13322. {
  13323. if (m_style.GetLength() <= (i - 29))continue;
  13324. if (m_style.GetAt(i - 29) != '1')continue;
  13325. StrRect = load.m_rcarray.ElementAt(i - 1);
  13326. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13327. }
  13328. for (i = 27; i <= 48; i++)
  13329. {
  13330. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13331. m_Print.DrawRect2(StrRect, 1);
  13332. }
  13333. #ifdef CHILD_VERSION
  13334. StrRect = load.m_rcarray.ElementAt(45);
  13335. StrRect.right = StrRect.left + 62;
  13336. m_Print.DrawRect2(StrRect, 1);
  13337. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13338. StrRect.left = StrRect.right;
  13339. StrRect.right = StrRect.left + 62;
  13340. m_Print.DrawRect2(StrRect, 1);
  13341. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13342. StrRect.left = StrRect.right;
  13343. StrRect.right = StrRect.left + 62;
  13344. m_Print.DrawRect2(StrRect, 1);
  13345. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13346. StrRect.left = StrRect.right;
  13347. StrRect.right = StrRect.left + 62;
  13348. m_Print.DrawRect2(StrRect, 1);
  13349. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13350. #endif
  13351. /////////////////////////
  13352. strarray.RemoveAll();
  13353. CString temp;
  13354. temp.Format("拍摄 选 %d 款,其中", atoi(m_outside) + atoi(m_outside2));
  13355. strarray.Add(temp);
  13356. temp.Format("内景 %d 款,外景 %d 款.", atoi(m_outside2), atoi(m_outside));
  13357. strarray.Add(temp);
  13358. strarray.Add("化妆");
  13359. strarray.Add("造型");
  13360. #ifdef CHILD_VERSION
  13361. strarray.Add("");
  13362. #else
  13363. strarray.Add("婚纱");
  13364. #endif
  13365. strarray.Add("服饰");
  13366. strarray.Add("配");
  13367. strarray.Add("置");
  13368. strarray.Add("其");
  13369. strarray.Add("它");
  13370. strarray.Add("套系名称");
  13371. strarray.Add("镜款");
  13372. strarray.Add("套系总价");
  13373. strarray.Add("主摄影师");
  13374. strarray.Add("拍摄日期");
  13375. strarray.Add("定金");
  13376. #ifdef CHILD_VERSION
  13377. strarray.Add("主引导师");
  13378. #else
  13379. strarray.Add("主化妆师");
  13380. #endif
  13381. strarray.Add("看样日期");
  13382. strarray.Add("补 余 款");
  13383. strarray.Add("总监");
  13384. strarray.Add("取件日期");
  13385. rcpos = -1;
  13386. for (i = 0; i < strarray.GetSize(); i++)
  13387. {
  13388. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13389. if (i>9)
  13390. m_Print.DrawRect2(StrRect, 1);
  13391. #ifdef CHILD_VERSION
  13392. if (i == 5)
  13393. StrRect.top -= StrRect.Height();
  13394. #endif
  13395. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13396. }
  13397. for (i = 22; i <= 41; i++)
  13398. {
  13399. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13400. m_Print.DrawRect2(StrRect, 1);
  13401. }
  13402. /////////////////////////////
  13403. strarray.RemoveAll();
  13404. #ifdef CHILD_VERSION
  13405. strarray.Add("顾客方 家长:");
  13406. strarray.Add("宝宝:");
  13407. #else
  13408. strarray.Add("顾客方 先生:");
  13409. strarray.Add("女士:");
  13410. #endif
  13411. strarray.Add("电话:");
  13412. strarray.Add("影楼方 店长:");
  13413. strarray.Add("接单人:");
  13414. strarray.Add("电话:");
  13415. rcpos = -1;
  13416. for (i = 0; i < strarray.GetSize(); i++)
  13417. {
  13418. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13419. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13420. }
  13421. for (i = 7; i <= 12; i++)
  13422. {
  13423. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13424. // if(i!=10)
  13425. m_Print.DrawRect2(StrRect, 2);
  13426. }
  13427. //////////////////////////////////////
  13428. //开始打数据
  13429. strarray.RemoveAll();
  13430. strarray.Add(m_name1);
  13431. strarray.Add(m_name2);
  13432. strarray.Add("");
  13433. strarray.Add("");
  13434. strarray.Add(m_addr1);
  13435. #ifdef CHILD_VERSION
  13436. strarray.Add("");
  13437. #else
  13438. strarray.Add(m_addr2);
  13439. #endif
  13440. strarray.Add(m_phone1);
  13441. strarray.Add(m_phone2);
  13442. for (i = 41; i <= 48; i++)
  13443. {
  13444. StrRect = load.m_rcarray.ElementAt(i - 1);
  13445. StrRect.left += 4;
  13446. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13447. }
  13448. ///////////////////////////////
  13449. strarray.RemoveAll();
  13450. strarray.Add(m_money1);
  13451. strarray.Add(m_waiter1);
  13452. strarray.Add(m_time2);
  13453. strarray.Add(m_money2);
  13454. strarray.Add(m_waiter2);
  13455. strarray.Add(m_time4);
  13456. strarray.Add(m_money3);
  13457. strarray.Add("");
  13458. strarray.Add(m_time5);
  13459. for (i = 32; i <= 40; i++)
  13460. {
  13461. StrRect = load2.m_rcarray.ElementAt(i - 1);
  13462. StrRect.left += 4;
  13463. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13464. }
  13465. ///////////////////////////////
  13466. strarray.RemoveAll();
  13467. strarray.Add("");//m_name1);
  13468. strarray.Add("");//m_name2);
  13469. CString phone;
  13470. if (m_phone1.IsEmpty() == 0)
  13471. phone = m_phone1 + ",";
  13472. phone += m_phone2;
  13473. phone.TrimRight(",");
  13474. strarray.Add("");//phone);
  13475. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  13476. strarray.Add(m_ren);
  13477. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13478. for (i = 7; i <= 12; i++)
  13479. {
  13480. StrRect = load3.m_rcarray.ElementAt(i - 1);
  13481. StrRect.left += 4;
  13482. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13483. }
  13484. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  13485. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13486. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  13487. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13488. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  13489. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13490. //////////////////////////////
  13491. //开始画文字
  13492. StrRect = load2.m_rcarray.ElementAt(30);
  13493. StrRect.left += 3;
  13494. StrRect.top += 3;
  13495. StrRect.right -= 2;
  13496. StrRect.bottom -= 2;
  13497. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  13498. StrRect = load2.m_rcarray.ElementAt(29);
  13499. StrRect.left += 3;
  13500. StrRect.top += 3;
  13501. StrRect.right -= 2;
  13502. StrRect.bottom -= 2;
  13503. str = "";
  13504. for (i = 0; i < sparray.GetSize(); i++)
  13505. {
  13506. str += sparray.ElementAt(i).ElementAt(5);
  13507. str += " 数量:";
  13508. str += sparray.ElementAt(i).ElementAt(3);
  13509. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  13510. str += "\r\n";
  13511. }
  13512. str.TrimRight("\r\n");
  13513. AutoDraw(m_Print, StrRect, str, 1.4);
  13514. StrRect = load2.m_rcarray.ElementAt(40);
  13515. StrRect.top += 8;
  13516. m_Print.SetFontFace(12, 1, "黑体");
  13517. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  13518. StrRect.left += 3;
  13519. StrRect.top += 30;
  13520. StrRect.right -= 2;
  13521. StrRect.bottom -= 2;
  13522. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  13523. if (str.IsEmpty())
  13524. {
  13525. str = "\
  13526. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  13527. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  13528. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  13529. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  13530. 持良好的心境.\r\n\
  13531. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  13532. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  13533. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  13534. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  13535. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  13536. 勿进影室, 以免影响拍摄.\r\n\
  13537. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  13538. 师或店长沟通.\r\n\
  13539. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  13540. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  13541. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  13542. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  13543. 9. 本合同余额欠款须在拍照前付清.\r\n\
  13544. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  13545. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  13546. 还.";
  13547. }
  13548. AutoDraw(m_Print, StrRect, str, 1.8);
  13549. }
  13550. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13551. dlg.m_pDC = m_Print.GetPDC();
  13552. dlg.m_mode = 1;
  13553. if (aa == 0)
  13554. {
  13555. if (dlg.DoModal() != IDOK)
  13556. return;
  13557. printcot = dlg.m_num;
  13558. }
  13559. //结束打印
  13560. m_Print.EndPage();
  13561. m_Print.EndPrint();
  13562. }
  13563. }
  13564. void CMainFrame::InsideMsg()
  13565. {
  13566. ///内部消息
  13567. CString str;
  13568. g_sendhead.bsql = 0;
  13569. g_sendhead.code[0] = 126;
  13570. g_sendhead.tabcount = 1;
  13571. g_bNoConnDlg = 1;
  13572. g_pMainWnd->ProcessChatMessageRequest2(1); g_bNoConnDlg = 0;
  13573. if (g_bSendOK == 0)return;
  13574. CArray<CStringArray, CStringArray>m_List1array;
  13575. DataToArray(&g_List1array);//, &m_List1array);
  13576. int i = 0;
  13577. m_List1array.SetSize(g_List1array.GetSize());
  13578. for ( i = 0; i < g_List1array.GetSize(); i++)
  13579. {
  13580. m_List1array.ElementAt(i).Copy(g_List1array.ElementAt(i));
  13581. }
  13582. str = "," + g_user.name + ",";
  13583. for (i = g_List1array.GetSize() - 1; i >= 0; i--)
  13584. {
  13585. CString receivers2 = g_List1array.ElementAt(i).ElementAt(4);
  13586. receivers2.TrimLeft(",");
  13587. receivers2.TrimRight(",");
  13588. receivers2 = "," + receivers2 + ",";
  13589. CString receivers = g_List1array.ElementAt(i).ElementAt(3);
  13590. receivers.TrimLeft(",");
  13591. receivers.TrimRight(",");
  13592. receivers = "," + receivers + ",";
  13593. if (receivers.Find(str) == -1)
  13594. g_List1array.RemoveAt(i);
  13595. else if (receivers2.Find(str) != -1)
  13596. g_List1array.RemoveAt(i);
  13597. }
  13598. if (g_List1array.GetSize())
  13599. {
  13600. ShowMsg dlg;
  13601. dlg.DoModal();
  13602. }
  13603. for (i = m_List1array.GetSize() - 1; i >= 0; i--)
  13604. {
  13605. CString receivers2 = m_List1array.ElementAt(i).ElementAt(4);
  13606. receivers2.TrimLeft(",");
  13607. receivers2.TrimRight(",");
  13608. receivers2 = "," + receivers2 + ",";
  13609. CString receivers = m_List1array.ElementAt(i).ElementAt(3);
  13610. if (receivers != "")
  13611. m_List1array.RemoveAt(i);
  13612. else if (receivers2.Find(str) != -1)
  13613. m_List1array.RemoveAt(i);
  13614. }
  13615. if (m_List1array.GetSize())
  13616. {
  13617. SendInsideMsg2 dlg;
  13618. dlg.m_bShow = 1;
  13619. dlg.m_pArray = &m_List1array;
  13620. dlg.DoModal();
  13621. }
  13622. }
  13623. //定金
  13624. /************************************************************************/
  13625. /*
  13626. 函数:PrintHireDress
  13627. 描述:打印礼服出租单;
  13628. 参数:
  13629. strOrderNumber 礼服订单号;
  13630. 注意:
  13631. */
  13632. /************************************************************************/
  13633. void CMainFrame::PrintHireDress(CString strOrderNumber) // 打印礼服出租单;
  13634. {
  13635. int printcot = 1;
  13636. for (int aa = 0; aa < printcot; aa++)
  13637. {
  13638. CPrintRX m_Print;
  13639. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13640. {
  13641. m_Print.InitToPrint(NULL, 1);
  13642. }
  13643. else
  13644. {
  13645. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13646. if (name.IsEmpty())
  13647. m_Print.InitToPrint(NULL, 1);
  13648. else
  13649. {
  13650. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13651. if (nret == -1 && aa == 0)
  13652. {
  13653. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  13654. }
  13655. }
  13656. }
  13657. m_Print.StartPrint();
  13658. m_Print.StartPage();
  13659. LoadRect load;
  13660. load.SetLiaPath("21.lia");
  13661. load.SetMargins(0, 0);
  13662. if (!load.Load())
  13663. {
  13664. return;
  13665. }
  13666. int i;
  13667. //////////////////////////////////////////////////////////////
  13668. //CString filter="id='"+strOrderNumber+"';id='"+strOrderNumber+"';id='"+strOrderNumber+"'";
  13669. CString strFilter;
  13670. strFilter.Format("id='%s';id='%s';id='%s'", strOrderNumber, strOrderNumber, strOrderNumber);
  13671. g_sendhead.bsql = 0;
  13672. g_sendhead.code[0] = 73;
  13673. g_sendhead.code[1] = 74;
  13674. g_sendhead.code[2] = 52;
  13675. g_sendhead.tabcount = 3;
  13676. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  13677. if (g_bSendOK == 0)
  13678. {
  13679. return;
  13680. }
  13681. CArray<CStringArray, CStringArray>dresshirearray;
  13682. CArray<CStringArray, CStringArray>dresshiredataarray;
  13683. CArray<CStringArray, CStringArray>clientarray;
  13684. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13685. if (dresshirearray.GetSize() == 0)
  13686. {
  13687. return;
  13688. }
  13689. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10);
  13690. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7);
  13691. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8);
  13692. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6);
  13693. if (clientarray.GetSize() == 0)
  13694. {
  13695. return;
  13696. }
  13697. //AfxMessageBox("打印礼服出租单-()");
  13698. CString m_name2 = clientarray.ElementAt(0).ElementAt(2);
  13699. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13700. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13701. CString m_time3 = clientarray.ElementAt(0).ElementAt(20);
  13702. //#if JEFF_TEST
  13703. // if ( dresshiredataarray.GetSize() == 0 )
  13704. // {
  13705. // AfxMessageBox("没衣服");
  13706. // }
  13707. //#endif
  13708. CString sItem;
  13709. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13710. {
  13711. sItem += "编号:";
  13712. sItem += dresshiredataarray.ElementAt(i).ElementAt(1);
  13713. sItem += " ";
  13714. sItem += " 名称:";
  13715. sItem += dresshiredataarray.ElementAt(i).ElementAt(2);
  13716. sItem += " 数量:";
  13717. sItem += dresshiredataarray.ElementAt(i).ElementAt(3) + "\r\n";
  13718. }
  13719. sItem += "金额:";
  13720. sItem += dresshirearray.ElementAt(0).ElementAt(1);
  13721. sItem += " ";
  13722. sItem += " 押金:";
  13723. sItem += dresshirearray.ElementAt(0).ElementAt(2) + "\r\n";
  13724. ////////////////////////////////////////////////////////////////
  13725. int rcpos = -1;
  13726. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13727. m_Print.SetFontFace(17, 1, "宋体");
  13728. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13729. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13730. m_Print.SetFontFace(10, 1, "宋体");
  13731. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13732. CStringArray strarray;
  13733. strarray.Add("客户姓名");
  13734. strarray.Add("客户电话");
  13735. strarray.Add("预定日期");
  13736. strarray.Add("结婚日期");
  13737. strarray.Add("取件日期");
  13738. strarray.Add("归还日期");
  13739. strarray.Add("本店地址");
  13740. strarray.Add("电 话");
  13741. strarray.Add("客户地址");
  13742. strarray.Add("客户签名");
  13743. for (i = 2; i < 12; i++)
  13744. {
  13745. StrRect = load.m_rcarray.ElementAt(i);
  13746. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13747. }
  13748. strarray.RemoveAll();
  13749. strarray.Add(m_name2);
  13750. strarray.Add(m_phone2);
  13751. strarray.Add(m_inputdate);
  13752. strarray.Add(m_time3);
  13753. strarray.Add(m_date1);
  13754. strarray.Add(m_date2);
  13755. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13756. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13757. strarray.Add(m_addr2);
  13758. strarray.Add("");
  13759. for (i = 12; i < 22; i++)
  13760. {
  13761. StrRect = load.m_rcarray.ElementAt(i);
  13762. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13763. m_Print.DrawRect2(StrRect, 2);
  13764. }
  13765. for (i = 25; i < 30; i++)
  13766. {
  13767. StrRect = load.m_rcarray.ElementAt(i);
  13768. m_Print.DrawRect2(StrRect, 1);
  13769. }
  13770. StrRect = load.m_rcarray.ElementAt(22);
  13771. StrRect.top += 7;
  13772. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13773. StrRect = load.m_rcarray.ElementAt(23);
  13774. StrRect.top += 7;
  13775. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13776. StrRect = load.m_rcarray.ElementAt(24);
  13777. StrRect.top += 7;
  13778. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13779. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13780. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13781. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13782. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13783. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13784. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13785. if (str.IsEmpty())
  13786. {
  13787. str = "\
  13788. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13789. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13790. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13791. 4. 如有破损酌情赔偿.";
  13792. }
  13793. AutoDraw(m_Print, StrRect, str, 1.5);
  13794. PrintPreview dlg;
  13795. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13796. dlg.m_pDC = m_Print.GetPDC();
  13797. if (aa == 0)
  13798. {
  13799. if (dlg.DoModal() != IDOK)
  13800. return;
  13801. printcot = dlg.m_num;
  13802. }
  13803. //结束打印
  13804. m_Print.EndPage();
  13805. m_Print.EndPrint();
  13806. }
  13807. }
  13808. void CMainFrame::PrintHireDress_01(CString strOrderNumber) // 打印礼服出租单,无法改变结构,需要修改21.lia才能改变打印的布局;
  13809. {
  13810. int printcot = 1;
  13811. for (int aa = 0; aa < printcot; aa++)
  13812. {
  13813. CPrintRX m_Print;
  13814. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13815. {
  13816. m_Print.InitToPrint(NULL, 1);
  13817. }
  13818. else
  13819. {
  13820. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13821. if (name.IsEmpty())
  13822. m_Print.InitToPrint(NULL, 1);
  13823. else
  13824. {
  13825. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13826. if (nret == -1 && aa == 0)
  13827. {
  13828. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  13829. m_Print.InitToPrint(NULL, 1);
  13830. }
  13831. }
  13832. }
  13833. m_Print.StartPrint();
  13834. m_Print.StartPage();
  13835. LoadRect load;
  13836. load.SetLiaPath("21.lia");
  13837. load.SetMargins(0, 0);
  13838. if (!load.Load())return;
  13839. int i;
  13840. //////////////////////////////////////////////////////////////
  13841. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  13842. g_sendhead.bsql = 0;
  13843. g_sendhead.code[0] = 73; // dresshire表;
  13844. g_sendhead.code[1] = 74; // dresshiredata表;
  13845. g_sendhead.code[2] = 52; // client表;
  13846. g_sendhead.tabcount = 3;
  13847. g_pMainWnd->ProcessChatMessageRequest2(filter);
  13848. if (g_bSendOK == 0)
  13849. {
  13850. return;
  13851. }
  13852. CArray<CStringArray, CStringArray>dresshirearray;
  13853. CArray<CStringArray, CStringArray>dresshiredataarray;
  13854. CArray<CStringArray, CStringArray>clientarray;
  13855. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13856. if (dresshirearray.GetSize() == 0)return;
  13857. // dresshire;
  13858. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10); // 备注;
  13859. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7); // 取衣日期;
  13860. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8); // 还衣日期;
  13861. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6); // 记录日期;
  13862. CString strPrice = dresshirearray.ElementAt(0).ElementAt(1); // 金额;
  13863. CString strDeposit = dresshirearray.ElementAt(0).ElementAt(2); // 押金;
  13864. // client表;
  13865. if (clientarray.GetSize() == 0)return;
  13866. CString m_name2 = clientarray.ElementAt(0).ElementAt(2); // 女宾姓名;
  13867. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4); // 女宾手机;
  13868. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8); // 女宾地址;
  13869. CString m_time3 = clientarray.ElementAt(0).ElementAt(20); // 婚期;
  13870. // dresshiredata表;
  13871. CString sItem;
  13872. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13873. {
  13874. sItem += dresshiredataarray.ElementAt(i).ElementAt(1); // 礼服编号;
  13875. sItem += " ";
  13876. sItem += dresshiredataarray.ElementAt(i).ElementAt(2); // 礼服名称;
  13877. sItem += " 数量:";
  13878. sItem += dresshiredataarray.ElementAt(i).ElementAt(3) + "\r\n"; // 礼服数量;
  13879. }
  13880. sItem += " 金额:";
  13881. sItem += dresshirearray.ElementAt(0).ElementAt(1); // 出租金额;
  13882. sItem += " 押金:";
  13883. sItem += dresshirearray.ElementAt(0).ElementAt(2) + "\r\n"; // 押金;
  13884. ////////////////////////////////////////////////////////////////
  13885. int rcpos = -1;
  13886. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13887. m_Print.SetFontFace(17, 1, "宋体");
  13888. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13889. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13890. m_Print.SetFontFace(10, 1, "宋体");
  13891. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13892. CStringArray strarray;
  13893. strarray.Add("客户姓名"); // 1.
  13894. strarray.Add("客户电话");
  13895. strarray.Add("预定日期");
  13896. strarray.Add("结婚日期");
  13897. strarray.Add("取件日期"); // 5.
  13898. strarray.Add("归还日期");
  13899. strarray.Add("本店地址");
  13900. strarray.Add("电 话");
  13901. strarray.Add("客户地址");
  13902. strarray.Add("客户签名"); // 10.
  13903. //strarray.Add("金额");
  13904. //strarray.Add("押金");
  13905. for( i=2; i<12; i++)
  13906. //for (i = 2; i < 14; i++)
  13907. {
  13908. StrRect = load.m_rcarray.ElementAt(i);
  13909. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13910. }
  13911. strarray.RemoveAll();
  13912. strarray.Add(m_name2);
  13913. strarray.Add(m_phone2);
  13914. strarray.Add(m_inputdate);
  13915. strarray.Add(m_time3);
  13916. strarray.Add(m_date1);
  13917. strarray.Add(m_date2);
  13918. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13919. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13920. strarray.Add(m_addr2);
  13921. strarray.Add("");
  13922. strarray.Add(strPrice); // 金额;
  13923. strarray.Add(strDeposit); // 押金;
  13924. for( i=12; i<22; i++)
  13925. //for (i = 14; i < 24; i++)
  13926. {
  13927. StrRect = load.m_rcarray.ElementAt(i);
  13928. //m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i-12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13929. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 14), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13930. m_Print.DrawRect2(StrRect, 2);
  13931. }
  13932. for (i = 25; i < 30; i++)
  13933. {
  13934. StrRect = load.m_rcarray.ElementAt(i);
  13935. m_Print.DrawRect2(StrRect, 1);
  13936. }
  13937. StrRect = load.m_rcarray.ElementAt(22);
  13938. StrRect.top += 7;
  13939. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13940. StrRect = load.m_rcarray.ElementAt(23);
  13941. StrRect.top += 7;
  13942. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13943. StrRect = load.m_rcarray.ElementAt(24);
  13944. StrRect.top += 7;
  13945. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13946. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13947. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13948. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13949. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13950. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13951. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13952. if (str.IsEmpty())
  13953. {
  13954. str = "\
  13955. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13956. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13957. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13958. 4. 如有破损酌情赔偿.";
  13959. }
  13960. AutoDraw(m_Print, StrRect, str, 1.5);
  13961. PrintPreview dlg;
  13962. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13963. dlg.m_pDC = m_Print.GetPDC();
  13964. if (aa == 0)
  13965. {
  13966. if (dlg.DoModal() != IDOK)
  13967. return;
  13968. printcot = dlg.m_num;
  13969. }
  13970. //结束打印
  13971. m_Print.EndPage();
  13972. m_Print.EndPrint();
  13973. }
  13974. }
  13975. // ****************************************************************************
  13976. // Jeff:
  13977. // 函数:PrintHireDress2
  13978. // 无参;
  13979. // 调用者:DinDanFrom.cpp
  13980. // void DinDanFrom::GetData(),订单报表调用时,判断订单数是否大于1000
  13981. // 当订单数大于1000,设置连接公司服务器开关量为真;
  13982. // -----------------------------------------------------------------------------
  13983. // 修改:Jeff
  13984. // 时间:2014.10.18
  13985. // 内容:将 g_ncot 比较值改为100;
  13986. // ****************************************************************************
  13987. void CMainFrame::PrintHireDress2()
  13988. {
  13989. if (g_ncot > 100) g_bSendLYFZ = 1;
  13990. // g_pMainWnd->SetTimer (7, 3000, NULL);
  13991. }
  13992. void CMainFrame::PrintTakeForm2(CArray<CStringArray, CStringArray>*Listarray)
  13993. {
  13994. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "选片客人明细表";
  13995. int pages = Listarray->GetSize() / 46;
  13996. if (Listarray->GetSize() % 46)pages++;
  13997. for (int aa = 0; aa < pages; aa++)
  13998. {
  13999. PrintPreview dlg;
  14000. CPrintRX m_Print;
  14001. m_Print.InitToPrint(NULL, 1);
  14002. m_Print.StartPrint();
  14003. m_Print.StartPage();
  14004. CRect mainrc(0, 0, 560, 793);
  14005. float fscale;
  14006. {
  14007. int w, h;
  14008. m_Print.GetWidHei(w, h);
  14009. fscale = (float)w / (float)h;
  14010. }
  14011. mainrc.DeflateRect(25, 40, 10, 0);
  14012. CRect rc, rc2;
  14013. rc = mainrc;
  14014. rc.bottom = rc.top;
  14015. rc.top -= 20;
  14016. m_Print.SetFontFace(16, 1, "黑体");
  14017. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14018. m_Print.SetFontFace(9, 1, "宋体");
  14019. CString str;
  14020. int wid[5] = { 200, 110, 70, 85, 62 };
  14021. int hei = 16;
  14022. if (fscale > 0.71)hei = 15;
  14023. rc = mainrc;
  14024. rc.bottom = rc.top + hei;
  14025. for (int i = 0; i < 47; i++)
  14026. {
  14027. rc2.top = rc.top + i*hei;
  14028. rc2.bottom = rc.bottom + i*hei;
  14029. rc2.left = rc.left;
  14030. rc2.right = rc.left + wid[0];
  14031. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14032. for (int j = 0; j<5; j++)
  14033. {
  14034. m_Print.DrawRect2(rc2, 1);
  14035. if (Listarray->GetSize()>aa * 46 + i)
  14036. {
  14037. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14038. rc2.left += 3;
  14039. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14040. rc2.left -= 3;
  14041. }
  14042. rc2.left += wid[j];
  14043. rc2.right = rc2.left + wid[j + 1];
  14044. }
  14045. }
  14046. rc2.top += 2;
  14047. rc2.left += 2; rc2.right = mainrc.right + 4;
  14048. m_Print.SetFontFace(8, 1, "宋体");
  14049. str.Format(" 页:%d/%d", aa + 1, pages);
  14050. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14051. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14052. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14053. dlg.m_pDC = m_Print.GetPDC();
  14054. // dlg.m_mode=1;
  14055. if (aa == 0)
  14056. {
  14057. if (dlg.DoModal() != IDOK)
  14058. return;
  14059. }
  14060. //结束打印
  14061. m_Print.EndPage();
  14062. m_Print.EndPrint();
  14063. }
  14064. }
  14065. void CMainFrame::PrintTakeForm3(CArray<CStringArray, CStringArray>*Listarray)
  14066. {
  14067. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "看设计客人明细表";
  14068. int pages = Listarray->GetSize() / 46;
  14069. if (Listarray->GetSize() % 46)pages++;
  14070. for (int aa = 0; aa < pages; aa++)
  14071. {
  14072. PrintPreview dlg;
  14073. CPrintRX m_Print;
  14074. m_Print.InitToPrint(NULL, 1);
  14075. m_Print.StartPrint();
  14076. m_Print.StartPage();
  14077. CRect mainrc(0, 0, 560, 793);
  14078. float fscale;
  14079. {
  14080. int w, h;
  14081. m_Print.GetWidHei(w, h);
  14082. fscale = (float)w / (float)h;
  14083. }
  14084. mainrc.DeflateRect(25, 40, 10, 0);
  14085. CRect rc, rc2;
  14086. rc = mainrc;
  14087. rc.bottom = rc.top;
  14088. rc.top -= 20;
  14089. m_Print.SetFontFace(16, 1, "黑体");
  14090. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14091. m_Print.SetFontFace(9, 1, "宋体");
  14092. CString str;
  14093. int wid[5] = { 200, 110, 70, 85, 62 };
  14094. int hei = 16;
  14095. if (fscale > 0.71)hei = 15;
  14096. rc = mainrc;
  14097. rc.bottom = rc.top + hei;
  14098. for (int i = 0; i < 47; i++)
  14099. {
  14100. rc2.top = rc.top + i*hei;
  14101. rc2.bottom = rc.bottom + i*hei;
  14102. rc2.left = rc.left;
  14103. rc2.right = rc.left + wid[0];
  14104. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14105. for (int j = 0; j<5; j++)
  14106. {
  14107. m_Print.DrawRect2(rc2, 1);
  14108. if (Listarray->GetSize()>aa * 46 + i)
  14109. {
  14110. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14111. rc2.left += 3;
  14112. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14113. rc2.left -= 3;
  14114. }
  14115. rc2.left += wid[j];
  14116. rc2.right = rc2.left + wid[j + 1];
  14117. }
  14118. }
  14119. rc2.top += 2;
  14120. rc2.left += 2; rc2.right = mainrc.right + 4;
  14121. m_Print.SetFontFace(8, 1, "宋体");
  14122. str.Format(" 页:%d/%d", aa + 1, pages);
  14123. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14124. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14125. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14126. dlg.m_pDC = m_Print.GetPDC();
  14127. // dlg.m_mode=1;
  14128. if (aa == 0)
  14129. {
  14130. if (dlg.DoModal() != IDOK)
  14131. return;
  14132. }
  14133. //结束打印
  14134. m_Print.EndPage();
  14135. m_Print.EndPrint();
  14136. }
  14137. }
  14138. void CMainFrame::PrintTakeForm4(CArray<CStringArray, CStringArray>*Listarray)
  14139. {
  14140. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "取件客人明细表";
  14141. int pages = Listarray->GetSize() / 46;
  14142. if (Listarray->GetSize() % 46)pages++;
  14143. for (int aa = 0; aa < pages; aa++)
  14144. {
  14145. PrintPreview dlg;
  14146. CPrintRX m_Print;
  14147. m_Print.InitToPrint(NULL, 1);
  14148. m_Print.StartPrint();
  14149. m_Print.StartPage();
  14150. CRect mainrc(0, 0, 560, 793);
  14151. float fscale;
  14152. {
  14153. int w, h;
  14154. m_Print.GetWidHei(w, h);
  14155. fscale = (float)w / (float)h;
  14156. }
  14157. mainrc.DeflateRect(25, 40, 10, 0);
  14158. CRect rc, rc2;
  14159. rc = mainrc;
  14160. rc.bottom = rc.top;
  14161. rc.top -= 20;
  14162. m_Print.SetFontFace(16, 1, "黑体");
  14163. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14164. m_Print.SetFontFace(9, 1, "宋体");
  14165. CString str;
  14166. int wid[5] = { 200, 110, 70, 85, 62 };
  14167. int hei = 16;
  14168. if (fscale > 0.71)hei = 15;
  14169. rc = mainrc;
  14170. rc.bottom = rc.top + hei;
  14171. for (int i = 0; i < 47; i++)
  14172. {
  14173. rc2.top = rc.top + i*hei;
  14174. rc2.bottom = rc.bottom + i*hei;
  14175. rc2.left = rc.left;
  14176. rc2.right = rc.left + wid[0];
  14177. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14178. for (int j = 0; j<5; j++)
  14179. {
  14180. m_Print.DrawRect2(rc2, 1);
  14181. if (Listarray->GetSize()>aa * 46 + i)
  14182. {
  14183. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14184. rc2.left += 3;
  14185. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14186. rc2.left -= 3;
  14187. }
  14188. rc2.left += wid[j];
  14189. rc2.right = rc2.left + wid[j + 1];
  14190. }
  14191. }
  14192. rc2.top += 2;
  14193. rc2.left += 2; rc2.right = mainrc.right + 4;
  14194. m_Print.SetFontFace(8, 1, "宋体");
  14195. str.Format(" 页:%d/%d", aa + 1, pages);
  14196. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14197. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14198. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14199. dlg.m_pDC = m_Print.GetPDC();
  14200. // dlg.m_mode=1;
  14201. if (aa == 0)
  14202. {
  14203. if (dlg.DoModal() != IDOK)
  14204. return;
  14205. }
  14206. //结束打印
  14207. m_Print.EndPage();
  14208. m_Print.EndPrint();
  14209. }
  14210. }
  14211. void CMainFrame::PrintTakeForm5(CArray<CStringArray, CStringArray>*Listarray)
  14212. {
  14213. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "婚庆客人明细表";
  14214. int pages = Listarray->GetSize() / 46;
  14215. if (Listarray->GetSize() % 46)pages++;
  14216. for (int aa = 0; aa < pages; aa++)
  14217. {
  14218. PrintPreview dlg;
  14219. CPrintRX m_Print;
  14220. m_Print.InitToPrint(NULL, 1);
  14221. m_Print.StartPrint();
  14222. m_Print.StartPage();
  14223. CRect mainrc(0, 0, 560, 793);
  14224. float fscale;
  14225. {
  14226. int w, h;
  14227. m_Print.GetWidHei(w, h);
  14228. fscale = (float)w / (float)h;
  14229. }
  14230. mainrc.DeflateRect(25, 40, 10, 0);
  14231. CRect rc, rc2;
  14232. rc = mainrc;
  14233. rc.bottom = rc.top;
  14234. rc.top -= 20;
  14235. m_Print.SetFontFace(16, 1, "黑体");
  14236. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14237. m_Print.SetFontFace(8, 1, "宋体");
  14238. CString str;
  14239. int wid[7] = { 165, 90, 90, 45, 45, 60, 35 };
  14240. int hei = 16;
  14241. if (fscale > 0.71)hei = 15;
  14242. rc = mainrc;
  14243. rc.bottom = rc.top + hei;
  14244. for (int i = 0; i < 47; i++)
  14245. {
  14246. rc2.top = rc.top + i*hei;
  14247. rc2.bottom = rc.bottom + i*hei;
  14248. rc2.left = rc.left;
  14249. rc2.right = rc.left + wid[0];
  14250. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14251. for (int j = 0; j<7; j++)
  14252. {
  14253. m_Print.DrawRect2(rc2, 1);
  14254. if (Listarray->GetSize()>aa * 46 + i)
  14255. {
  14256. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14257. rc2.left += 3;
  14258. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14259. rc2.left -= 3;
  14260. }
  14261. rc2.left += wid[j];
  14262. rc2.right = rc2.left + wid[j + 1];
  14263. }
  14264. }
  14265. rc2.top += 2;
  14266. rc2.left += 2; rc2.right = mainrc.right + 4;
  14267. m_Print.SetFontFace(8, 1, "宋体");
  14268. str.Format(" 页:%d/%d", aa + 1, pages);
  14269. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14270. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14271. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14272. dlg.m_pDC = m_Print.GetPDC();
  14273. // dlg.m_mode=1;
  14274. if (aa == 0)
  14275. {
  14276. if (dlg.DoModal() != IDOK)
  14277. return;
  14278. }
  14279. //结束打印
  14280. m_Print.EndPage();
  14281. m_Print.EndPrint();
  14282. }
  14283. }
  14284. void CMainFrame::PrintTakeForm1(CArray<CStringArray, CStringArray>*Listarray)
  14285. {
  14286. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "拍照客人明细表";
  14287. int pages = Listarray->GetSize() / 46;
  14288. if (Listarray->GetSize() % 46)pages++;
  14289. for (int aa = 0; aa < pages; aa++)
  14290. {
  14291. PrintPreview dlg;
  14292. CPrintRX m_Print;
  14293. m_Print.InitToPrint(NULL, 1);
  14294. m_Print.StartPrint();
  14295. m_Print.StartPage();
  14296. CRect mainrc(0, 0, 560, 793);
  14297. float fscale;
  14298. {
  14299. int w, h;
  14300. m_Print.GetWidHei(w, h);
  14301. fscale = (float)w / (float)h;
  14302. }
  14303. mainrc.DeflateRect(25, 40, 10, 0);
  14304. CRect rc, rc2;
  14305. rc = mainrc;
  14306. rc.bottom = rc.top;
  14307. rc.top -= 20;
  14308. m_Print.SetFontFace(16, 1, "黑体");
  14309. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14310. m_Print.SetFontFace(8, 1, "宋体");
  14311. CString str;
  14312. int wid[7] = { 165, 60, 90, 60, 60, 60, 35 };
  14313. int hei = 16;
  14314. if (fscale > 0.71)hei = 15;
  14315. rc = mainrc;
  14316. rc.bottom = rc.top + hei;
  14317. for (int i = 0; i < 47; i++)
  14318. {
  14319. rc2.top = rc.top + i*hei;
  14320. rc2.bottom = rc.bottom + i*hei;
  14321. rc2.left = rc.left;
  14322. rc2.right = rc.left + wid[0];
  14323. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14324. for (int j = 0; j<7; j++)
  14325. {
  14326. m_Print.DrawRect2(rc2, 1);
  14327. if (Listarray->GetSize()>aa * 46 + i)
  14328. {
  14329. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14330. rc2.left += 3;
  14331. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14332. rc2.left -= 3;
  14333. }
  14334. rc2.left += wid[j];
  14335. rc2.right = rc2.left + wid[j + 1];
  14336. }
  14337. }
  14338. rc2.top += 2;
  14339. rc2.left += 2; rc2.right = mainrc.right + 4;
  14340. m_Print.SetFontFace(8, 1, "宋体");
  14341. str.Format(" 页:%d/%d", aa + 1, pages);
  14342. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14343. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14344. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14345. dlg.m_pDC = m_Print.GetPDC();
  14346. // dlg.m_mode=1;
  14347. if (aa == 0)
  14348. {
  14349. if (dlg.DoModal() != IDOK)
  14350. return;
  14351. }
  14352. //结束打印
  14353. m_Print.EndPage();
  14354. m_Print.EndPrint();
  14355. }
  14356. }
  14357. void CMainFrame::ShowMonthForm2()
  14358. {
  14359. }
  14360. // dlg;