MainFrm.cpp 455 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566
  1. // MainFrm.cpp : implementation of the CMainFrame class 员工工作
  2. #include "stdafx.h"
  3. #include "YLGL.h"
  4. #include "resource.h"
  5. #include "MainFrm.h"
  6. #include <afxinet.h>
  7. #include "ConnectDlg.h"
  8. #include "SendDataDlg.h"
  9. #include "DinDanHistroy.h"
  10. #include "ShangPin.h"
  11. #include "SPLBDlg.h"
  12. #include "BuMenDlg.h"
  13. #include "Worker.h"
  14. #include "ShowPic3.h"
  15. #include "TXDlg.h"
  16. #include "TXSPDlg.h"
  17. #include "MsgReg2.h"
  18. #include "ProviderDlg.h"
  19. #include "Booking2.h"
  20. #include "PayOutSet.h"
  21. #include "PayOutInput.h"
  22. #include "IncomeInput.h"
  23. #include "IncomeInput2.h"
  24. #include "IncomeInput3.h"
  25. #include "IncomeInput4.h"
  26. #include "DressEarlyWarning.h"
  27. #include "DailyForm.h"
  28. #include "MonthForm.h"
  29. #include "ProcessAlarm.h"
  30. #include "MonthForm2.h"
  31. #include "YearForm.h"
  32. #include "ClientForm.h"
  33. #include "ClientForm2.h"
  34. #include "ClientForm3.h"
  35. #include "DinDanFrom.h"
  36. #include "Satisfaction.h"
  37. //#include "SatisfactionForm.h"
  38. #include "SatisfactionReportForm.h"
  39. #include "TodayForm.h"
  40. #include "TodayForm2.h"
  41. #include "SendInsideMsg2.h"
  42. #include "StoreInfoChart.h"
  43. #include "FixedAssets.h"
  44. #include "SPForm.h"
  45. #include "ShowMsg.h"
  46. #include "Account.h"
  47. #include "Login.h"
  48. #include "Login3.h"
  49. #include "Psw.h"
  50. #include "AreaDlg.h"
  51. #include "TakeFrom.h"
  52. #include "ChoosePhotoForm.h"
  53. #include "BeautifySkinFrom.h"
  54. #include "DesignFrom.h"
  55. #include "outsourcing.h"
  56. #include "ChoosePhotoSkin.h"
  57. #include "SalarySet.h"
  58. #include "SalarySet2.h"
  59. #include "MySalary.h"
  60. #include "PrintRX.h"
  61. #include "LoadRect.h"
  62. #include "PrintPreview.h"
  63. #include "SearchClient.h"
  64. #include "BeautifySkinFrom2.h"
  65. #include "FinanceForm.h"
  66. #include "PhotoPrintFrom.h"
  67. //#include "SqlDlg.h"
  68. #include "YearForm2.h"
  69. #include "AreaClient.h"
  70. #include "DBConfig.h"
  71. #include "SetPathDlg2.h"
  72. #include "StaffAchievement.h"
  73. #include "BurnCD.h"
  74. #include "StaffAchievementSet.h"
  75. #include "StaffAchievementShowAll.h"
  76. #include "SelContent.h"
  77. #include "ClientMoney.h"
  78. #include "DelPhotoSet.h"
  79. #include "ompanyInfo.h"
  80. #include "ClientForm.h"
  81. #include "PhotoBak.h"
  82. #include "MsgReg.h"
  83. #include "SendMsg.h"
  84. #include "MsgSet.h"
  85. #include "ShowMember.h"
  86. #include "ShowMember2.h"
  87. #include "MemberSet.h"
  88. #include "DressManage.h"
  89. #include "ShowDress.h"
  90. #include "ShowPic.h"
  91. #include "ShowHireReg.h"
  92. #include "InputGoods.h"
  93. #include "ShowGoods.h"
  94. #include "CostCal.h"
  95. #include "Welcome.h"
  96. #include "EmployeeMsg.h"
  97. #include "TXFG.h"
  98. #include "EmployeeForm.h"
  99. #include "EmployeeForm2.h"
  100. #include "Client2Form.h"
  101. #include "Client2FormLYFZ.h"
  102. #include "OldClient.h"
  103. #include "ClientReasonChart.h"
  104. #include "ClientFromChart.h"
  105. #include "WorkMsg.h"
  106. #include "SetLoginTime.h"
  107. #include "SetLoginBan.h"
  108. #include "LoginReg.h"
  109. #include "LoginReg2.h"
  110. #include "PhoneRecord.h"
  111. #include "PhoneRecordOut.h"
  112. #include "MissCall.h"
  113. #include "InsideMsg.h"
  114. #include "Card2Reg.h"
  115. #include "Card2RegChart.h"
  116. #include "ShowMemberBlue.h"
  117. #include "Card2RegBlue.h"
  118. #include "Card2RegChartBlue.h"
  119. #include "DigitalWork.h"
  120. #include "HideWindow.h"
  121. #include "SalarySet3.h"
  122. #include "YearFormBranch.h"
  123. #include "YearFormBranch2.h"
  124. #include "Set.h"
  125. #include "DinDanFromBranch.h"
  126. #include "MemberChart.h"
  127. #include "ShowMemberMsg.h"
  128. #include "ShowBakState.h"
  129. #include "DinDanForm.h"
  130. #include "CalendarConvert.h"
  131. #include "ShowLOg.h"
  132. #include "HospitalClient.h"
  133. #include "HospitalClientAlarm.h"
  134. #include "HospitalInfoSet.h"
  135. #include "AddHospitalClient.h"
  136. #include "HospitalClientMsg.h"
  137. // 防盗模块;
  138. //#include "AntiTheft.h"
  139. #ifndef VC60
  140. #include "msgId_def.h"
  141. #include "struct_def.h"
  142. #endif //#ifndef VC60
  143. #ifdef _DEBUG
  144. #define new DEBUG_NEW
  145. #undef THIS_FILE
  146. static char THIS_FILE[] = __FILE__;
  147. #endif
  148. #ifndef WINVER
  149. #define WINVER 0x0400
  150. #endif
  151. #ifndef _WIN32_WINNT
  152. #define _WIN32_WINNT 0x0400
  153. #endif
  154. #ifndef _WIN32_WINDOWS
  155. #define _WIN32_WINDOWS 0x0410
  156. #endif
  157. #ifndef _WIN32_IE
  158. #define _WIN32_IE 0x0400
  159. #endif
  160. #include "uxtheme.h "
  161. typedef HTHEME(__stdcall * POPENTHEMEDATA)(HWND hwnd, LPCWSTR pszClassList);
  162. typedef HRESULT(__stdcall * PCLOSETHEMEDATA)(HTHEME hTheme);
  163. HHOOK g_hmouse = NULL; //g_sendhead zx.dll
  164. //extern void WriteTextLog(CString str); // Jeff写客户端日志;
  165. // Jeff.remark;
  166. // 函数:MouseProc
  167. // 参数:
  168. // nCode hook code
  169. // wParam message identifier
  170. // lParam mouse coordinates
  171. // 返回:
  172. //
  173. LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam)
  174. {
  175. if (g_pMainWnd)
  176. {
  177. if(g_cominfoarray.GetSize() > 0)
  178. {
  179. // 133:version.setcheck24是否启用无操作时自动注销软件;
  180. // 134:version.outtime无操作多少时间自动注销软件;
  181. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(133)) && atoi(g_cominfoarray.ElementAt(0).ElementAt(134)) > 0)
  182. {
  183. g_pMainWnd->KillTimer(5);
  184. g_pMainWnd->SetTimer(5, atoi(g_cominfoarray.ElementAt(0).ElementAt(134)) * 60 * 1000, NULL);
  185. }
  186. }
  187. // 是否记录信息;
  188. if (g_bSendLYFZ)
  189. {
  190. g_pMainWnd->KillTimer(7);
  191. #ifdef _DEBUG
  192. g_pMainWnd->SetTimer(7, 2000, NULL);
  193. #else
  194. g_pMainWnd->SetTimer(7, 5 * 60 * 1000, NULL);
  195. #endif
  196. }
  197. }
  198. return CallNextHookEx(g_hmouse, nCode, wParam, lParam);
  199. }
  200. CRect g_rc; // 屏幕坐标值,区域是放置对话框。
  201. CMainFrame *g_pMainWnd = NULL;
  202. extern HWND g_hSendWnd;
  203. extern HWND g_hConnectWnd;
  204. //extern CString newGUID();
  205. #ifdef USE_KERNEL_DLL
  206. /************************************************************************/
  207. /*
  208. 函数:kernelCallback
  209. 描述:kernel.dll的回调函数;
  210. 参数:
  211. lpStrBranchId: 域名;
  212. lpStrOrder: 订单号;
  213. dwImgType: 相片类型;
  214. dwImgNum: 重命名使用,返回的相片编号;
  215. lpStrImg: IncrementalBack表使用的content字段内容,指定备份文件名的相片;
  216. lpStrImgExt: IncrementalBack表使用的backupExt字段内容,指定要备份的扩展名相片;
  217. 返回:void
  218. */
  219. /************************************************************************/
  220. // 导入原片、初修、精修、设计结束后的回调函数(三合一);
  221. void CALLBACK ImgImportMergeCallback(IN LPCTSTR lpStrBranchId, IN LPCTSTR lpStrOrderNum, IN CONST INT& dwImgType, IN CONST DWORD& dwImgNum, IN LPCTSTR lpStrImgs, IN LPCTSTR lpStrImgExt)
  222. {
  223. AfxSetResourceHandle(g_Instance);
  224. // 1.判断参数有效性;
  225. if (lpStrBranchId == NULL || !strstr(lpStrBranchId, _T(".ly.com")) || lpStrOrderNum == NULL || _tcscmp(lpStrOrderNum, _T("")) == 0)
  226. {
  227. OutputDebugString(_T("回调函数参数(域名、订单号)无效\n"));
  228. return;
  229. }
  230. // 2.是否需要备份分店相片;
  231. BOOL bIsNeedBranchImg = FALSE;
  232. switch (dwImgType)
  233. {
  234. case 1://是否备份分店原片;
  235. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck1;
  236. break;
  237. case 2://是否备份分店修片;
  238. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck2;
  239. break;
  240. case 3://是否备份分店精修;
  241. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck3;
  242. break;
  243. case 4://是否备份分店设计;
  244. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck4;
  245. break;
  246. default:
  247. OutputDebugString(_T("未知相片类型!\n"));
  248. break;
  249. }
  250. // 3.同时更新IncrementalBack表;
  251. CString strSQLInsert = _T("");
  252. strSQLInsert.Format(INSERT_INCREMENT, 0, lpStrBranchId, CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S"), lpStrOrderNum, dwImgType, lpStrImgs, g_user.account, g_user.name);
  253. // 4.连接服务器,更新dindan和IncrementalBackup;
  254. g_sendhead.bsql = 1;
  255. if (g_bAllBranch)
  256. {// 多店汇总时;
  257. g_branchip = GetBranchIPbyId(lpStrBranchId);
  258. g_pMainWnd->OnDisconnect();
  259. g_branchname = GetBranchNamebyId(lpStrBranchId);
  260. g_bBranchModify = 1;
  261. if (dwImgType == OImgtype)
  262. {// 如果导入的是原片;
  263. CString strSQL = _T("");
  264. strSQL.Format(_T("update dindan set curno = '%d' where id = '%s' ***%s"), dwImgNum, lpStrOrderNum, strSQLInsert);
  265. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  266. }
  267. else
  268. {//导入的不是原片;
  269. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  270. }
  271. // 如果连接服务器失败,要记录下来;
  272. // if () .........
  273. g_pMainWnd->OnDisconnect();
  274. g_bBranchModify = 0;
  275. g_branchip = g_branchname = _T("");
  276. if (g_domain.CompareNoCase(lpStrBranchId) != 0 && bIsNeedBranchImg)
  277. {// 如果不是本店,且本店设置中需要备份分店相片,需要向本店添加导入相片记录;
  278. g_sendhead.bsql = 1;
  279. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  280. g_pMainWnd->OnDisconnect();
  281. g_bBranchModify = 0;
  282. }
  283. }
  284. else
  285. {// 连接本店或分店时;
  286. if (dwImgType == OImgtype)
  287. {// 如果导入的是原片;
  288. CString strSQL = _T("");
  289. strSQL.Format(_T("update dindan set curno = '%d' where id = '%s' ***%s"), dwImgNum, lpStrOrderNum, strSQLInsert);
  290. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  291. }
  292. else
  293. {//导入的不是原片;
  294. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  295. }
  296. if (g_domain.CompareNoCase(lpStrBranchId) != 0 && bIsNeedBranchImg)
  297. {// 如果不是本店,且本店设置中需要备份分店相片,需要向本店添加导入相片记录;
  298. #if 1
  299. ::SendMessage(g_pMainWnd->m_hWnd, MSG_KERNEL_SENDMSG, (WPARAM)lpStrBranchId, (LPARAM)&strSQLInsert);
  300. #else // 可能是VC6.0与VC9.0间DLL调用产生的问题,下面代码执行时会出错;
  301. // 如果连接的是分店,断开分店,回连本店;
  302. g_bBranchModify = FALSE;
  303. g_pMainWnd->OnDisconnect();
  304. g_branchname = g_branchip = _T("");
  305. g_sendhead.bsql = 1;
  306. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  307. g_pMainWnd->OnDisconnect();
  308. // 设置回分店连接;
  309. g_branchip = GetBranchIPbyId(lpStrBranchId);
  310. g_branchname = GetBranchNamebyId(lpStrBranchId);
  311. g_bBranchModify = TRUE;
  312. #endif
  313. }
  314. }
  315. if ( dwImgType == OImgtype )
  316. {// 最后一步,更新完了数据库,刷新TakFrom类所对应的对话框;
  317. HWND hWnd = ::FindWindowEx(g_pMainWnd->GetSafeHwnd(), NULL, _T("MDIClient"), NULL);
  318. if (hWnd)
  319. {
  320. hWnd = ::FindWindowEx(hWnd, NULL, NULL, _T("拍照"));
  321. if (hWnd)
  322. {
  323. hWnd = ::FindWindowEx(hWnd, NULL, _T("#32770"), NULL);
  324. if (hWnd)
  325. {
  326. ::SendMessage(hWnd, MSG_KERNEL_CALLBACK, 0, 0);
  327. }
  328. }
  329. }
  330. }
  331. }
  332. #endif
  333. /////////////////////////////////////////////////////////////////////////////
  334. // CMainFrame客人付款
  335. /////////////////////////////////////////////////////////////////////////////
  336. /////////////////////////////////////////////////////////////////////////////
  337. static void HandleClientNetEvent(IN SOCKET hSocket,
  338. IN ETransportEvent eEvent,
  339. IN void *pDataBuf,
  340. IN unsigned long nDataLen,
  341. IN int nError,
  342. IN void *pContext)
  343. {
  344. if (nError != TRANSPORT_OK)
  345. return;
  346. CMainFrame *pDlg = (CMainFrame *)pContext;
  347. if (NULL == pDlg)
  348. return;
  349. pDlg->ProcessNetEvent(eEvent, pDataBuf, nDataLen);
  350. }
  351. BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam)
  352. {
  353. CRect rtCtrl, rtWnd; // 子窗口,父窗口;
  354. if (hwnd)
  355. {
  356. ::GetWindowRect(hwnd, &rtCtrl); // 获取控件大小;
  357. ::GetWindowRect(GetParent(hwnd), &rtWnd); // 获取父窗口大小;
  358. rtCtrl.OffsetRect(-rtWnd.left, -rtWnd.top);
  359. float temp;
  360. temp = (float)rtCtrl.left*g_WidthScale;
  361. rtCtrl.left = (int)temp + g_dx;
  362. temp = (float)rtCtrl.top*g_HeightScale;
  363. rtCtrl.top = (int)temp + g_dy;
  364. temp = (float)rtCtrl.right*g_WidthScale;
  365. rtCtrl.right = (int)temp + g_dx;
  366. temp = (float)rtCtrl.bottom*g_HeightScale;
  367. rtCtrl.bottom = (int)temp + g_dy;
  368. ::MoveWindow(hwnd, rtCtrl.left, rtCtrl.top, rtCtrl.Width(), rtCtrl.Height(), TRUE);
  369. return TRUE;
  370. }
  371. else
  372. {
  373. return FALSE;
  374. }
  375. }
  376. IMPLEMENT_DYNCREATE(CMainFrame, CMDIFrameWnd)
  377. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  378. //{{AFX_MSG_MAP(CMainFrame)
  379. ON_WM_CREATE()
  380. ON_WM_DESTROY()
  381. ON_WM_CLOSE()
  382. ON_WM_TIMER()
  383. ON_COMMAND(IDM_choosephotoskin, Onchoosephotoskin)
  384. ON_COMMAND(IDM_PATH, OnPath)
  385. ON_COMMAND(IDM_SERVER, OnServer)
  386. ON_COMMAND(IDM_SHOWHIS, OnShowhis)
  387. ON_COMMAND(IDM_StaffAchievementShow, OnStaffAchievementShow)
  388. ON_COMMAND(IDM_AUTODELPHOTO, OnAutodelphoto)
  389. ON_COMMAND(IDM_PHOTOMANAGE, Onphotomanage)
  390. ON_COMMAND(IDM_COMPANYINFO, OnCompanyinfo)
  391. ON_COMMAND(IDM_HELPFILE, OnHelpfile)
  392. ON_COMMAND(IDM_PHOTOBAK, OnPhotobak)
  393. ON_COMMAND(IDM_TAOXIFG, OnTaoxifg)
  394. ON_COMMAND(IDM_ShowBakState, OnShowBakState)
  395. ON_WM_NCLBUTTONDBLCLK()
  396. ON_WM_NCHITTEST()
  397. ON_COMMAND(IDM_LOG, OnLog)
  398. //}}AFX_MSG_MAP
  399. ON_COMMAND_RANGE(0, 50000, OnCommandMenu)
  400. ON_MESSAGE(MSG_KERNEL_SENDMSG, OnKernelSendMessaage)
  401. END_MESSAGE_MAP()
  402. static UINT indicators[] =
  403. {
  404. ID_SEPARATOR, // status line indicator
  405. ID_INDICATOR_CAPS,
  406. ID_INDICATOR_NUM,
  407. ID_INDICATOR_SCRL,
  408. };
  409. /////////////////////////////////////////////////////////////////////////////
  410. // CMainFrame construction/destruction
  411. #if defined(VC70) || defined(VC60)
  412. UINT CMainFrame::OnNcHitTest(CPoint point)
  413. {
  414. if (CWnd::OnNcHitTest(point) == HTRIGHT || CWnd::OnNcHitTest(point) == HTLEFT || CWnd::OnNcHitTest(point) == HTTOP || CWnd::OnNcHitTest(point) == HTBOTTOM)
  415. return HTCLIENT;
  416. return CWnd::OnNcHitTest(point);
  417. }
  418. #else
  419. LRESULT CMainFrame::OnNcHitTest(CPoint point)
  420. {
  421. if (CWnd::OnNcHitTest(point) == HTRIGHT || CWnd::OnNcHitTest(point) == HTLEFT || CWnd::OnNcHitTest(point) == HTTOP || CWnd::OnNcHitTest(point) == HTBOTTOM)
  422. return HTCLIENT;
  423. return CWnd::OnNcHitTest(point);
  424. }
  425. #endif
  426. void CMainFrame::OnNcLButtonDblClk(UINT nFlags, CPoint point)
  427. {
  428. if (nFlags != HTCAPTION)
  429. CMDIFrameWnd::OnNcLButtonDblClk(nFlags, point);
  430. }
  431. // 回调使用;
  432. LRESULT CMainFrame::OnKernelSendMessaage(WPARAM wp, LPARAM lp)
  433. {
  434. CString strBranchId = (LPCTSTR)wp;
  435. CString strSQLInsert = *(CString*)lp;
  436. // 如果连接的是分店,断开分店,回连本店;
  437. g_bBranchModify = FALSE;
  438. g_pMainWnd->OnDisconnect();
  439. g_branchname = g_branchip = _T("");
  440. g_sendhead.bsql = 1;
  441. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  442. g_pMainWnd->OnDisconnect();
  443. // 设置回分店连接;
  444. g_branchip = GetBranchIPbyId(strBranchId);
  445. g_branchname = GetBranchNamebyId(strBranchId);
  446. g_bBranchModify = TRUE;
  447. g_pMainWnd->OnConnect();
  448. return 0;
  449. }
  450. CMainFrame::CMainFrame()
  451. {
  452. // TODO: add member initialization code here
  453. SetConnectionID(INVALID_SOCKET);
  454. m_pMainFrimDlg2 = NULL;
  455. m_bCheckF2F3 = AfxGetApp()->GetProfileInt(LYFZVERSION, "f2f3", 0);
  456. if (0 == ::PathFileExists(g_mainpath + "\\skin\\5.lia"))
  457. {
  458. g_bNoLoginLia = 1;
  459. }
  460. }
  461. CMainFrame::~CMainFrame()
  462. {
  463. if (m_pMainFrimDlg2)
  464. {
  465. m_pMainFrimDlg2->DestroyWindow();
  466. delete m_pMainFrimDlg2;
  467. }
  468. }
  469. void InTheMe(HWND m_hWnd)
  470. {
  471. BOOL bXpVisualStyle = FALSE;
  472. OSVERSIONINFO osvi;
  473. osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  474. ::GetVersionEx(&osvi);
  475. if ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) && (osvi.dwMajorVersion >= 5) && (osvi.dwMinorVersion >= 1))
  476. {
  477. HMODULE hUxTheme = ::LoadLibrary(_T("UxTheme.dll"));
  478. POPENTHEMEDATA pOpenThemeData;
  479. PCLOSETHEMEDATA pCloseThemeData;
  480. if (hUxTheme != NULL)
  481. {
  482. pOpenThemeData = (POPENTHEMEDATA)::GetProcAddress(hUxTheme, "OpenThemeData");
  483. pCloseThemeData = (PCLOSETHEMEDATA)::GetProcAddress(hUxTheme, "CloseThemeData");
  484. HTHEME hButtonTheme = (*pOpenThemeData)(m_hWnd, L"BUTTON");
  485. if (hButtonTheme != NULL)
  486. bXpVisualStyle = TRUE;
  487. (*pCloseThemeData)(hButtonTheme);
  488. }
  489. ::FreeLibrary(hUxTheme);
  490. }
  491. if (bXpVisualStyle)
  492. AfxMessageBox(_T("正在使用视觉主题 "));
  493. else
  494. AfxMessageBox(_T("没有使用视觉主题 "));
  495. }
  496. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  497. {
  498. if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  499. {
  500. // Jeff.创建失败的可能性小,加日志输出;
  501. return -1;
  502. }
  503. if (::PathFileExists(g_mainpath + "\\logo.ico"))
  504. {
  505. Bitmap *bmp = NULL;
  506. LoadImageFromFile((Image**)&bmp, g_mainpath + "\\logo.ico");
  507. // m_hIcon = AfxGetApp()->LoadIcon(g_mainpath+"\\logo.ico");
  508. bmp->GetHICON(&m_hIcon);
  509. delete bmp;
  510. SetIcon(m_hIcon, TRUE); // Set big icon
  511. SetIcon(m_hIcon, FALSE); // Set small icon
  512. }
  513. if (!m_wndClient.SubclassWindow(m_hWndMDIClient))
  514. {
  515. return -1;
  516. }
  517. if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  518. | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  519. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  520. {
  521. TRACE0("Failed to create toolbar\n");
  522. return -1; // fail to create
  523. }
  524. m_wndToolBar.LoadTrueColorToolBar(90, IDB_NORMAL, 0, IDB_DISABLE);
  525. // second toolbar must have different ID
  526. if (!m_wndToolBar2.Create(this, WS_CHILD | WS_VISIBLE | CBRS_LEFT | CBRS_NOALIGN,
  527. AFX_IDW_CONTROLBAR_FIRST + 32) ||
  528. !m_wndToolBar2.LoadToolBar(IDR_TOOLBAR1))
  529. {
  530. TRACE0("Failed to create toolbar\n");
  531. return -1; // fail to create
  532. }
  533. #ifndef NEW_SKIN
  534. if (!m_wndStatusBar.Create(this) ||
  535. !m_wndStatusBar.SetIndicators(indicators,
  536. sizeof(indicators)/sizeof(UINT)))
  537. {
  538. // Jeff.创建失败的可能性小,加日志输出;
  539. TRACE0("Failed to create status bar\n");
  540. return -1; // fail to create
  541. }
  542. m_wndStatusBar.SetPaneInfo(1,ID_INDICATOR_USER,SBPS_NORMAL,200);
  543. m_wndStatusBar.SetPaneText(1,"未登录",TRUE);
  544. #endif
  545. // TODO: Delete these three lines if you don't want the toolbar to
  546. // be dockable
  547. NewMenu2();
  548. ::GetWindowRect(this->m_hWndMDIClient, g_rc);
  549. g_pMainWnd = this;
  550. m_wndToolBar2.Init();
  551. g_rc.top += 38;
  552. g_rc.left += 160;
  553. /* m_WidthScale = (float)g_rc.Width ()/722;
  554. m_HeightScale = (float)g_rc.Height ()/533;*/
  555. g_user.bLongin = 0;
  556. SetTimer(1, 100, NULL);
  557. #ifdef USE_KERNEL_DLL
  558. if ( g_pIMGProcess )
  559. g_pIMGProcess->SetCallBack(ImgImportMergeCallback);
  560. #endif
  561. return 0;
  562. }
  563. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  564. {
  565. if (!CMDIFrameWnd::PreCreateWindow(cs))
  566. return FALSE;
  567. // TODO: Modify the Window class or styles here by modifying
  568. // the CREATESTRUCT cs
  569. cs.style &= ~WS_MAXIMIZEBOX;
  570. cs.style &= ~WS_THICKFRAME;
  571. cs.lpszName = g_title + "影楼管理系统";
  572. cs.style &= ~FWS_ADDTOTITLE;
  573. RECT rect;
  574. HWND hWnd = ::FindWindow("Shell_TrayWnd", 0);
  575. ::GetWindowRect(hWnd, &rect);
  576. cs.x = 0;
  577. cs.y = 0;
  578. cs.cx = GetSystemMetrics(SM_CXSCREEN);
  579. cs.cy = GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top) + 3;
  580. return TRUE;
  581. }
  582. /////////////////////////////////////////////////////////////////////////////
  583. // CMainFrame diagnostics
  584. #ifdef _DEBUG
  585. void CMainFrame::AssertValid() const
  586. {
  587. CMDIFrameWnd::AssertValid();
  588. }
  589. void CMainFrame::Dump(CDumpContext& dc) const
  590. {
  591. CMDIFrameWnd::Dump(dc);
  592. }
  593. #endif //_DEBUG
  594. /////////////////////////////////////////////////////////////////////////////
  595. // CMainFrame message handlers
  596. void CMainFrame::OnDestroy()
  597. {
  598. OnDisconnect();
  599. Transport_UnInit();
  600. m_Mdi.DeleteAll();
  601. if (g_hmouse)UnhookWindowsHookEx(g_hmouse);
  602. CMDIFrameWnd::OnDestroy();
  603. }
  604. void CMainFrame::OnClose()
  605. {
  606. g_bShowBar = 0;
  607. if (m_Mdi.MainClose())
  608. CMDIFrameWnd::OnClose();
  609. }//连接
  610. void CMainFrame::NewMenu2()
  611. {
  612. CMenu *pMemu = GetMenu();
  613. #ifdef BASIC_VERSION
  614. CMenu* submenu = pMemu->GetSubMenu(1);
  615. //submenu->RemoveMenu (IDM_StaffAchievementShow, MF_BYCOMMAND );//Jeff del 2014.06.16
  616. submenu->RemoveMenu (IDM_salaryset, MF_BYCOMMAND );
  617. #endif
  618. #if 0 // 此机用选片菜单项,去掉不用;
  619. {
  620. BOOL checked=AfxGetApp()->GetProfileInt (LYFZVERSION, "status", 0);
  621. if(checked)
  622. {
  623. CMenu* submenu = pMemu->GetSubMenu(1);
  624. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  625. }
  626. }
  627. #endif
  628. #ifndef BASIC_VERSION
  629. {
  630. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status2", 0);
  631. if (checked)
  632. {
  633. #if 0 // Jeff:去掉菜单,此机用于员工业绩查看的菜单选项;
  634. CMenu* submenu = pMemu->GetSubMenu(1);
  635. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  636. #endif
  637. g_bStaffAchievementShow = 1;
  638. SetTimer(3, 100, NULL);
  639. }
  640. }
  641. #endif
  642. if (g_bShowOK == 0)
  643. {
  644. CMenu* submenu = pMemu->GetSubMenu(2);
  645. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  646. }
  647. }
  648. HMENU CMainFrame::NewMenu()
  649. {
  650. //设置菜单为XP风格 IDM_SHOWHIS
  651. BCMenu::SetMenuDrawMode(1);
  652. //若取消下面这句注释,则可看到菜单的图标栏和文字栏背景颜色为白色,
  653. //文字颜色为蓝色,选中项的前景色为紫红色
  654. //m_menuXP.SetMenuXPItemColor(0x00FFFFFF,0x00FFFFFF,0x00FF0000,0x00FF00FF);
  655. // 设置菜单中图标大小为32×32
  656. // m_menuXP.SetIconSize(32,32);
  657. // 加载菜单资源
  658. m_menuXP.LoadMenu(IDR_MAINFRAME);
  659. // 加载菜单对应的工具栏资源
  660. // m_menuXP.LoadToolbar(IDR_MAINFRAME);
  661. /*由于菜单左边栏中默认的图标大小为16×16,而与之对应的Toolbar中图标大小为32×32,
  662. 因此菜单中图标不能正确显示,只显示出工具栏中图标的左上角部分,所以修改菜单中各
  663. 项对应的图标为24b色位图资源IDB_***,或者在LoadMenu之前调用SetIconSize,设置菜单
  664. 中图标大小为32×32*/
  665. // m_menuXP.SetIconSize(24,24);
  666. // m_menuXP.ModifyODMenu(NULL,IDM_YWBU,IDB_YW); //
  667. /* m_menuXP.ModifyODMenu(NULL,ID_FILE_OPEN,IDB_BITMAP5);
  668. m_menuXP.ModifyODMenu(NULL,ID_FILE_SAVE,IDB_BITMAP7);
  669. m_menuXP.ModifyODMenu(NULL,ID_FILE_PRINT,IDB_BITMAP6);
  670. m_menuXP.ModifyODMenu(NULL,ID_APP_ABOUT,IDB_BITMAP3);
  671. m_menuXP.ModifyODMenu(NULL,ID_APP_EXIT,IDB_BITMAP2);*/
  672. // m_menuXP.EnableMenuItem (0, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  673. // m_menuXP.EnableMenuItem (2, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  674. // m_menuXP.EnableMenuItem (3, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  675. // m_menuXP.EnableMenuItem (4, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  676. // m_menuXP.EnableMenuItem (5, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  677. // m_menuXP.EnableMenuItem (8, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  678. #if 0 // Jeff此机用选片菜单项不用;
  679. {
  680. BOOL checked=AfxGetApp()->GetProfileInt (LYFZVERSION, "status", 0);
  681. if(checked)
  682. {
  683. CMenu* submenu = m_menuXP.GetSubMenu(1);
  684. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  685. }
  686. }
  687. #endif
  688. {
  689. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status2", 0);
  690. if (checked)
  691. {
  692. #if 0 // Jeff:去掉此机用于员工业绩查看的菜单选项;
  693. CMenu* submenu = m_menuXP.GetSubMenu(1);
  694. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  695. #endif
  696. g_bStaffAchievementShow = 1;
  697. SetTimer(3, 100, NULL);
  698. }
  699. }
  700. if (g_bShowOK == 0)
  701. {
  702. CMenu* submenu = m_menuXP.GetSubMenu(2);
  703. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  704. }
  705. return(m_menuXP.Detach());
  706. }
  707. ///////////////////////////////////////////////////////
  708. //减少代码
  709. #define OPEN_MENU(x) m_Mdi.Append(pName, RUNTIME_CLASS(x), IDR_MAINFRAME, this, nID)
  710. //响应菜单命令
  711. void CMainFrame::OnCommandMenu(UINT nID) // 所有菜单命令都在这里处理;
  712. {
  713. if (nID >= 2000 && nID <= 2100)
  714. {
  715. OnBranchData(nID);
  716. return;
  717. }
  718. if (g_user.bLongin == 0)
  719. {
  720. if (g_bNoLoginLia)
  721. {
  722. Login dlg;
  723. dlg.SetLiaPath("5.lia");
  724. dlg.DoModal();
  725. }
  726. else
  727. {
  728. Login3 dlg;
  729. dlg.SetLiaPath("5.lia");
  730. dlg.DoModal();
  731. }
  732. return;
  733. if (g_user.bLongin == 0)return;
  734. }
  735. else
  736. {
  737. InsideMsg();
  738. }
  739. ResetTimer();
  740. if (nID >= 1000 && nID <= 1100)
  741. {
  742. OnHistory(nID);
  743. return;
  744. }
  745. LPSTR pName;
  746. //打开窗口
  747. switch (nID)
  748. {
  749. case IDM_PayOutSet:
  750. {
  751. if (IsHasRights(16) == 0)return;
  752. PayOutSet dlg;
  753. dlg.DoModal();
  754. return;
  755. }
  756. case IDM_SPLB:
  757. {
  758. if (IsHasRightsnew(29) == 0)return;
  759. SPLBDlg dlg;
  760. dlg.DoModal();
  761. return;
  762. }
  763. case IDM_JD:
  764. {
  765. if (IsHasRightsnew(49) == 0)return;
  766. SPLBDlg dlg;
  767. dlg.m_mode = 1;
  768. dlg.DoModal();
  769. return;
  770. }
  771. case IDM_AREA:
  772. {
  773. if (IsHasRightsnew(47) == 0)return;
  774. AreaDlg dlg;
  775. dlg.DoModal();
  776. return;
  777. }
  778. case IDM_Psw:
  779. {
  780. Psw dlg;
  781. dlg.DoModal();
  782. return;
  783. }
  784. case IDM_Set:
  785. {
  786. if (IsHasRightsnew(49) == 0)return;
  787. Set dlg;
  788. dlg.DoModal();
  789. return;
  790. }
  791. case IDM_HIDEWINDOW:
  792. {
  793. HideWindow dlg;
  794. dlg.DoModal();
  795. return;
  796. }
  797. case IDM_Logout:// Jeff.注销;
  798. {
  799. if(g_user.bLongin)
  800. WriteLog("退出系统!", "退出系统!");
  801. g_user.bLongin = 0;
  802. g_user.name.Empty();
  803. g_user.rights.Empty();
  804. g_user.account.Empty();
  805. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  806. g_pMainWnd2->RefreshOutlookBar();
  807. #ifndef NEW_SKIN
  808. m_wndStatusBar.SetPaneText(1, "未登录", TRUE);
  809. #endif
  810. m_Mdi.CloseAll();
  811. #ifdef ENTERPRISE_VERSION
  812. g_branchname.Empty();
  813. g_branchip.Empty();
  814. g_pMainWnd->OnDisconnect();
  815. g_bBranchModify = 0;
  816. #endif
  817. if (g_pMainWnd2)
  818. {
  819. g_pMainWnd2->DrawLogin();
  820. g_pMainWnd2->ShowBar(0);
  821. }
  822. g_hisyeararray.RemoveAll();
  823. g_pMainWnd->AddHistoryMenu(&g_hisyeararray);
  824. g_brancharray.RemoveAll();
  825. g_pMainWnd->AddBranchMenu(&g_brancharray);
  826. if (g_bNoLoginLia)
  827. {
  828. Login dlg;
  829. dlg.SetLiaPath("5.lia");
  830. dlg.DoModal();
  831. }
  832. else
  833. {
  834. Login3 dlg;
  835. dlg.SetLiaPath("5.lia");
  836. dlg.DoModal();
  837. }
  838. if (g_user.bLongin == 1)
  839. {
  840. if (g_pMainWnd2)
  841. {
  842. g_pMainWnd2->ShowBar(TRUE,TRUE);
  843. }
  844. }
  845. return;
  846. }
  847. case IDM_TODAY:
  848. pName = (LPSTR)(LPCSTR)"历史订单";
  849. // OPEN_MENU(SalarySet3);
  850. OPEN_MENU(DinDanHistroy);
  851. break;
  852. case IDM_TAKECONTROL:
  853. pName = (LPSTR)(LPCSTR)"摄控表";
  854. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(117)))
  855. OPEN_MENU(TodayForm2);
  856. else
  857. OPEN_MENU(TodayForm);
  858. break;
  859. case IDM_CLIENTMONEY:
  860. pName = (LPSTR)(LPCSTR)"客人付款";
  861. OPEN_MENU(ClientMoney);
  862. break;
  863. case IDM_TAKEAWAYBOOK:
  864. pName = (LPSTR)(LPCSTR)"发片/取件";
  865. OPEN_MENU(outsourcing);
  866. break;
  867. case IDM_CODE:
  868. pName = (LPSTR)(LPCSTR)"商品报表";
  869. OPEN_MENU(SPForm);
  870. break;
  871. case IDM_Daily:
  872. // if(IsHasRightsnew(22)==0)return;
  873. // pName = (LPSTR)(LPCSTR)"日财务表";
  874. // OPEN_MENU(DailyForm);
  875. pName = (LPSTR)(LPCSTR)"沟通助手";
  876. OPEN_MENU(InsideMsg);
  877. break;
  878. case IDM_ProcessAlarm:
  879. pName = (LPSTR)(LPCSTR)"流程监控";
  880. OPEN_MENU(ProcessAlarm);
  881. break;
  882. case IDM_DINDAN:
  883. // if(IsHasRights(7)==0)return;
  884. pName = (LPSTR)(LPCSTR)"订单报表";
  885. OPEN_MENU(DinDanFrom);
  886. break;
  887. case IDM_CLIENT:
  888. //if(IsHasRights(8)==0)return;
  889. pName = (LPSTR)(LPCSTR)"客户报表";
  890. OPEN_MENU(CClientForm);
  891. break;
  892. case IDM_PayOutInput:
  893. if (IsHasRightsnew(20) == 0)return;
  894. pName = (LPSTR)(LPCSTR)"现金支出";
  895. OPEN_MENU(PayOutInput);
  896. break;
  897. case IDM_salaryset:
  898. if (IsHasRightsnew(25) == 0)return;
  899. pName = (LPSTR)(LPCSTR)"工资设置";
  900. OPEN_MENU(SalarySet);
  901. break;
  902. case IDM_mysalary:
  903. if (IsHasRights(16) == 0)return;
  904. pName = (LPSTR)(LPCSTR)"我的工资";
  905. OPEN_MENU(MySalary);
  906. break;
  907. case IDM_SP:
  908. // if(IsHasRightsnew(29)==0)return;
  909. pName = (LPSTR)(LPCSTR)"商品设置";
  910. OPEN_MENU(ShangPin);
  911. break;
  912. case IDM_WORKER:
  913. if (IsHasRightsnew(27) == 0)return;
  914. pName = (LPSTR)(LPCSTR)"员工设置";
  915. OPEN_MENU(Worker);
  916. break;
  917. case IDM_TAOXI:
  918. if (IsHasRightsnew(30) == 0)return;
  919. pName = (LPSTR)(LPCSTR)"套系设置";
  920. OPEN_MENU(TXDlg);
  921. break;
  922. case IDM_TAOXISP:
  923. if (IsHasRightsnew(30) == 0)return;
  924. pName = (LPSTR)(LPCSTR)"套系赠送商品设置";
  925. OPEN_MENU(TXSPDlg);
  926. break;
  927. case IDM_Provider:
  928. if (IsHasRightsnew(32) == 0)return;
  929. pName = (LPSTR)(LPCSTR)"供应商设置";
  930. OPEN_MENU(ProviderDlg);
  931. break;
  932. case IDM_BUMEN:
  933. {
  934. if (IsHasRightsnew(49) == 0)return;
  935. BuMenDlg dlg;
  936. dlg.DoModal();
  937. return;
  938. }
  939. case IDM_Account:
  940. if (IsHasRightsnew(49) == 0)return;
  941. pName = (LPSTR)(LPCSTR)"账号管理";
  942. OPEN_MENU(Account);
  943. break;
  944. case IDM_YLCD:
  945. {
  946. //AfxMessageBox("IDM_YLCD");
  947. ::CopyFile(_T(g_path7 + "\\接单系统\\Regsvr32.exe"), _T(g_mainpath + "\\Regsvr32.exe"), 0);
  948. ::CopyFile(_T(g_path7 + "\\接单系统\\Flash9f.ocx"), _T(g_mainpath + "\\Flash9f.ocx"), 0);
  949. CString temp;
  950. temp.Format("%s\\regsvr32.exe /s %s\\Flash9f.OCX", g_mainpath, g_mainpath);
  951. WinExec(temp, SW_HIDE);
  952. ::CopyFile(_T(g_path7 + "\\接单系统\\接单系统.exe"), _T(g_mainpath + "\\接单系统.exe"), 0);
  953. ::CopyFile(_T(g_path7 + "\\接单系统\\my32.dll"), _T(g_mainpath + "\\my32.dll"), 0);
  954. ::CopyFile(_T(g_path7 + "\\接单系统\\server.dat"), _T(g_mainpath + "\\server.dat"), 0);
  955. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\接单系统.exe"), g_server, NULL, SW_SHOWNORMAL);
  956. }
  957. break;
  958. case IDM_YLCDMANAGE:
  959. ::CopyFile(_T(g_path7 + "\\接单系统\\资源管理器.exe"), _T(g_mainpath + "\\资源管理器.exe"), 0);
  960. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\资源管理器.exe"), g_server, NULL, SW_SHOWNORMAL);
  961. break;
  962. }
  963. }
  964. //减少代码
  965. ///////////////////////////////////////////////////////////////////////////////
  966. void CMainFrame::OnDisconnect()
  967. {
  968. printf("断开TCP连接\n");
  969. //CClientTunnel::GetInstance()->net_CloseSocket();
  970. m_tClientTunnel.net_CloseSocket();
  971. SetConnectionID(INVALID_SOCKET);
  972. }
  973. void CMainFrame::ProcessLoginResponse(void *pLoginResult)
  974. {
  975. if (NULL == pLoginResult) return;
  976. LOGIN_RESULT_STRU *ptLoginResult = (LOGIN_RESULT_STRU *)pLoginResult;
  977. DWORD dwConnectionID = ptLoginResult->tCommonMsg.dwConnectionID;
  978. SetConnectionID(dwConnectionID);
  979. BYTE byResult = ptLoginResult->byResult;
  980. if (LOGIN_RESULT_SUC == byResult)
  981. {
  982. //AfxMessageBox("登录成功"); // Jeff test;
  983. }
  984. else
  985. {
  986. OnDisconnect();
  987. }
  988. }
  989. /************************************************************************/
  990. /* 函数:ProcessLoginRequest[3/3/2016 IT];
  991. /* 描述:登陆服务器;
  992. /* 参数:;
  993. /* [IN] :;
  994. /* [OUT] :;
  995. /* [IN/OUT] :;
  996. /* 返回:登陆成功返回TRUE;
  997. /* 注意:;
  998. /* 示例:;
  999. /*
  1000. /* 修改:;
  1001. /* 日期:;
  1002. /* 内容:;
  1003. /************************************************************************/
  1004. BOOL CMainFrame::ProcessLoginRequest()
  1005. {
  1006. // 1.设置通信类型MSG_LOGIN_REQ,为登陆请求;
  1007. WORD wMessageId = 0;
  1008. if (g_conntype == 0 && !g_bConnLYFZ)
  1009. wMessageId = (MSG_LOGIN_REQ + 0X1FFF);
  1010. else// if (g_bConnLYFZ )
  1011. wMessageId = MSG_LOGIN_REQ;
  1012. // 2.填充发送数据;
  1013. TLOGIN_STRU tLogonInfo = { 0 };
  1014. tLogonInfo.tCommonMsg.dwConnectionID = GetConnectionID();//此时m_dwConnectionID为INVALIDE_SOCKET;
  1015. tLogonInfo.tCommonMsg.wMessageId = wMessageId;
  1016. CString strUserName = newGUID();// 以随机数作为登陆时的用户名称;
  1017. strUserName.TrimLeft();
  1018. strUserName.TrimRight();
  1019. #if defined(VC80) || defined(VC70) || defined(VC60)
  1020. strcpy(tLogonInfo.tUserInfo.szUserName, strUserName);
  1021. #else
  1022. strcpy_s(tLogonInfo.tUserInfo.szUserName, 31, strUserName);
  1023. #endif
  1024. DWORD dwDataLen = sizeof(TLOGIN_STRU);
  1025. // 3.填充数据头;
  1026. TMessageHeader tHeader = { 0 };
  1027. tHeader.wMessageId = wMessageId;
  1028. tHeader.dwDataLen = dwDataLen;
  1029. // 4.发送数据;
  1030. //unsigned long ulSendLen = CClientTunnel::GetInstance()->net_Send(&tHeader, (void *)&tLogonInfo, dwDataLen);
  1031. unsigned long ulSendLen = m_tClientTunnel.net_Send(&tHeader, (void *)&tLogonInfo, dwDataLen);
  1032. if (ulSendLen == SOCKET_ERROR)
  1033. {
  1034. return 0;
  1035. }
  1036. return 1;
  1037. }
  1038. DWORD CMainFrame::GetConnectionID()
  1039. {
  1040. return m_dwConnectionID;
  1041. }
  1042. void CMainFrame::SetConnectionID(DWORD dwConnection)
  1043. {
  1044. m_dwConnectionID = dwConnection;
  1045. }
  1046. /************************************************************************/
  1047. /* 函数:ProcessChatMessageRequest2[3/3/2016 IT];
  1048. /* 描述:;
  1049. /* 参数:;
  1050. /* [IN] code:;
  1051. /* 返回:void;
  1052. /* 注意:
  1053. OnConnect() -> ProcessChatMessageRequest()
  1054. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1055. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1056. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1057. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1058. 5.关闭对话框和断开连接;;
  1059. /* 示例:;
  1060. /*
  1061. /* 修改:;
  1062. /* 日期:;
  1063. /* 内容:;
  1064. /************************************************************************/
  1065. void CMainFrame::ProcessChatMessageRequest2(BYTE code)
  1066. {
  1067. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1068. SendDataDlg dlg;
  1069. dlg.m_bycode = code;
  1070. dlg.DoModal();
  1071. }
  1072. //*********************************************//
  1073. /*
  1074. 函数:ProcessChatMessageRequest2
  1075. 参数:CString sql [IN]
  1076. 返回:无
  1077. 过程:OnConnect() -> ProcessChatMessageRequest()
  1078. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1079. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1080. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1081. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1082. 5.关闭对话框和断开连接;
  1083. */
  1084. //*********************************************//
  1085. void CMainFrame::ProcessChatMessageRequest2(CString sql)
  1086. {
  1087. if ((sql.Find("insert") != -1 || sql.Find("update") != -1 || sql.Find("delete") != -1) && g_branchname != "" && g_bBranchModify == 0)
  1088. {
  1089. AfxMessageBox("当前为分店数据查看状态,不能更改分店数据!", MB_ICONSTOP);
  1090. g_bSendOK = 0;
  1091. return;
  1092. }
  1093. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1094. SendDataDlg dlg;
  1095. dlg.m_strSQL = sql;
  1096. dlg.DoModal();
  1097. }
  1098. //*********************************************//
  1099. /*
  1100. 函数:ProcessChatMessageRequest2
  1101. 参数:BYTE *pData [IN], int length [IN]
  1102. 返回:无
  1103. 过程:OnConnect() -> ProcessChatMessageRequest()
  1104. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1105. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1106. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1107. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1108. 5.关闭对话框和断开连接;
  1109. */
  1110. //*********************************************//
  1111. void CMainFrame::ProcessChatMessageRequest2(BYTE *pData, int length)
  1112. {
  1113. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1114. SendDataDlg dlg;
  1115. dlg.m_pData = pData;
  1116. dlg.m_nlength = length;
  1117. dlg.DoModal(); // DoModal未执行完时,就被其他函数销毁,导致局部函数dlg无效;
  1118. }
  1119. /************************************************************************/
  1120. /*
  1121. 函数:ProcessChatMessageRequest
  1122. 描述:对服务发送数据;
  1123. 参数:void *szDataBuf[IN], int nDataLen[IN]
  1124. 返回:发送成功与否;
  1125. */
  1126. /************************************************************************/
  1127. BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)
  1128. {
  1129. // 1.获取当前与服务器连接的id;
  1130. DWORD dwFromUserID = GetConnectionID();
  1131. // 2.设置通信类型为MSG_CHATMESSAGE_REQ;
  1132. WORD wMessageId = 0;
  1133. if (g_conntype == 0 && !g_bConnLYFZ)
  1134. wMessageId = (MSG_CHATMESSAGE_REQ + 0X3FFF);
  1135. else
  1136. wMessageId = MSG_CHATMESSAGE_REQ;
  1137. // 3.计算出欲发送的数据的长度 dwDataLen;
  1138. DWORD dwDataLen = sizeof(TCHAT_MESSAGE_STRU) + nDataLen;
  1139. BYTE *pSendData = new BYTE[dwDataLen];
  1140. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU*)pSendData;
  1141. memset(pChatMessage, 0x00, dwDataLen);
  1142. // 3.1.g_nYearpos==-1,表示连接是当前主数据库,其他值表示历史数据库;
  1143. if (g_nYearpos == -1)
  1144. g_sendhead.length[99] = g_nYearpos;
  1145. else
  1146. g_sendhead.length[99] = g_nYearpos * 32142953 + 10966236;
  1147. g_sendhead.length[98] = 987123768;
  1148. memcpy(pSendData, &g_sendhead, sizeof(g_sendhead));
  1149. #ifdef ENTERPRISE_VERSION
  1150. if (g_bBranchModify == 0)
  1151. #if defined(VC60) || defined(VC70)
  1152. strcpy(pChatMessage->szFromUserName, g_branchname);
  1153. #else
  1154. strcpy_s(pChatMessage->szFromUserName, 30, g_branchname);
  1155. #endif
  1156. #endif
  1157. // 4.填充发送的数据结构;
  1158. pChatMessage->tCommonMsg.dwConnectionID = GetConnectionID();
  1159. pChatMessage->tCommonMsg.wMessageId = wMessageId;
  1160. pChatMessage->dwFromUserID = dwFromUserID;
  1161. pChatMessage->dwToUserID = g_nSendCode;//▲▲g_nSendCode在服务端同为dwToUserID;
  1162. pChatMessage->wMessageLen = nDataLen;
  1163. memcpy(pChatMessage->byFileContent, szDataBuf, nDataLen);
  1164. // 5.填充数据头;
  1165. TMessageHeader tHeader = { 0 };
  1166. tHeader.wMessageId = wMessageId;
  1167. tHeader.dwDataLen = dwDataLen;
  1168. // 6.发送数据;
  1169. BOOL bRet = 0;
  1170. //unsigned long ulSendLen = CClientTunnel::GetInstance()->net_Send(&tHeader, (void *)pChatMessage, dwDataLen);
  1171. unsigned long ulSendLen = m_tClientTunnel.net_Send(&tHeader, (void *)pChatMessage, dwDataLen);
  1172. if (ulSendLen != SOCKET_ERROR)
  1173. {
  1174. bRet = 1;
  1175. }
  1176. // 7.发送完毕,释放内存;
  1177. delete[] pSendData;
  1178. return bRet;
  1179. }
  1180. /************************************************************************/
  1181. /*
  1182. 函数:ProcessChatMessageResponse
  1183. 描述:接收服务返回的数据;
  1184. 参数:void *pResponse[IN]
  1185. 返回:无;
  1186. 调用关系:
  1187. 1.由 void CMainFrame::ProcessNetEvent(...)调用
  1188. */
  1189. /************************************************************************/
  1190. void CMainFrame::ProcessChatMessageResponse(void *pResponse)
  1191. {
  1192. // 1.数据空,直接返回;
  1193. if (NULL == pResponse)
  1194. return;
  1195. // 2.数据解析过程;
  1196. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pResponse;
  1197. int nMessageLen = pChatMessage->wMessageLen;
  1198. int nMessageLen2 = pChatMessage->dwToUserID; // 在服务器中被处理了,一般使dwToUserID=wMessageLen;
  1199. // Jeff.dwFromUserID==8888表示的内容是更新客户端skin界面数据,只有两处dwToUserID==211和dwToUserID==21;
  1200. // Jeff.其余的大多数都是 dwFromUserID = wMessageLen = dwToUserID 三者相等;
  1201. if (nMessageLen == nMessageLen2 && pChatMessage->dwFromUserID != 8888)
  1202. {
  1203. // 2.1.清除全局变量g_pData数据,用于保存接收的实际数据;
  1204. if (g_pData)
  1205. delete[]g_pData;
  1206. g_pData = NULL;
  1207. g_pData = new BYTE[nMessageLen];
  1208. memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
  1209. memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
  1210. g_nLeng = nMessageLen;
  1211. if (nMessageLen <= sizeof(DWORD))
  1212. {
  1213. memcpy(&g_ncount, pChatMessage->byFileContent, sizeof(DWORD));
  1214. }
  1215. KillTimer(2);
  1216. if (g_hSendWnd)
  1217. {
  1218. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);//关闭发送对话框;
  1219. }
  1220. }
  1221. else if (nMessageLen == nMessageLen2 && pChatMessage->dwFromUserID == 8888)
  1222. {
  1223. if (g_pData2)
  1224. delete[]g_pData2;
  1225. g_pData2 = NULL;
  1226. g_pData2 = new BYTE[nMessageLen2];
  1227. memcpy(g_pData2, pChatMessage->byFileContent, nMessageLen2);
  1228. g_nLeng2 = nMessageLen2;
  1229. KillTimer(2);
  1230. if (g_hSendWnd)
  1231. {
  1232. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1233. }
  1234. }
  1235. else if (nMessageLen2 == 42 )
  1236. {
  1237. if (g_pData)
  1238. delete[]g_pData;
  1239. g_pData = NULL;
  1240. g_pData = new BYTE[nMessageLen];
  1241. memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
  1242. memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
  1243. g_nLeng = nMessageLen;
  1244. g_bSendOK = TRUE;
  1245. }
  1246. else if ( nMessageLen2 == 43)
  1247. {
  1248. if (g_pData)
  1249. delete[]g_pData;
  1250. g_pData = NULL;
  1251. KillTimer(2);
  1252. if (g_hSendWnd)
  1253. {
  1254. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1255. }
  1256. return;
  1257. }
  1258. else // 登陆返回;
  1259. {
  1260. if (g_bConnLYFZ)
  1261. {
  1262. if (g_pData)
  1263. delete[]g_pData;
  1264. g_pData = NULL;
  1265. g_pData = new BYTE[nMessageLen];
  1266. memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
  1267. memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
  1268. g_nLeng = nMessageLen;
  1269. if (nMessageLen <= sizeof(DWORD))
  1270. {
  1271. memcpy(&g_ncount, pChatMessage->byFileContent, sizeof(DWORD));
  1272. }
  1273. KillTimer(2);
  1274. if (g_hSendWnd)
  1275. {
  1276. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1277. }
  1278. return;
  1279. }
  1280. if (g_conntype) // Jeff.g_conntype == 1,表示连接公司服务器的返回,用于集团版解析*.ly.com的IP地址;
  1281. {
  1282. // KillTimer(2);
  1283. char *szChatMessage = new char[nMessageLen + 1];
  1284. memset(szChatMessage, 0x00, nMessageLen + 1);
  1285. memcpy(szChatMessage, pChatMessage->byFileContent, nMessageLen);
  1286. g_server = szChatMessage;
  1287. delete[]szChatMessage;
  1288. CStdioFile fp;
  1289. CString path = g_mainpath + "\\ip.txt";
  1290. ::DeleteFile(path); // 删除ip.txt;
  1291. fp.Open(path, CFile::modeCreate | CFile::modeWrite);
  1292. fp.WriteString(g_server);
  1293. fp.Close();
  1294. g_conntype = 0;
  1295. // g_serverip=g_server;
  1296. return;
  1297. }
  1298. if (g_pData2 == NULL)
  1299. {
  1300. g_pData2 = new BYTE[nMessageLen2];
  1301. g_nLeng2 = 0;
  1302. }
  1303. memcpy(g_pData2 + g_nLeng2, pChatMessage->byFileContent, nMessageLen);
  1304. g_nLeng2 += nMessageLen;
  1305. if (g_nLeng2 == nMessageLen2)//已收完
  1306. {
  1307. KillTimer(2);
  1308. if (g_hSendWnd)
  1309. {
  1310. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1311. }
  1312. }
  1313. else
  1314. {
  1315. KillTimer(2);
  1316. SetTimer(2, g_ntimeout, NULL);
  1317. }
  1318. }
  1319. }
  1320. #if USE_SHARE_FLORD
  1321. /************************************************************************/
  1322. /*
  1323. Date: 2015-04-11
  1324. Author: Jeff
  1325. 函数:GetSharePathInfo
  1326. 描述:获取共享目录表的所有信息;
  1327. 参数:
  1328. 返回:成功返回TRUE;
  1329. 注意:获取的表记录存储在全局变量g_aryOfSharePathInfo中;
  1330. 调用约定:在登陆软件时调用,且必须连接的服务器是本店的;
  1331. */
  1332. /************************************************************************/
  1333. BOOL CMainFrame::GetSharePathInfo()
  1334. {
  1335. // 1.连接的数据库必须是本局域网的服务器;
  1336. if ( g_bAllBranch || !g_branchname.IsEmpty() || !g_branchip.IsEmpty() )
  1337. {
  1338. // 非当前局域网服务器;
  1339. return FALSE;
  1340. }
  1341. // 2.获取当前连接的分店域名是否与g_domain一致;
  1342. g_sendhead.bsql = 0;
  1343. g_sendhead.code[0] = 29;
  1344. g_sendhead.tabcount = 1;
  1345. g_pMainWnd->ProcessChatMessageRequest2(23);
  1346. if ( !g_bSendOK )
  1347. {
  1348. // 连接服务器失败;
  1349. return FALSE;
  1350. }
  1351. CArray<CStringArray,CStringArray> strArray;
  1352. DataToArray(&strArray);
  1353. CString strCurBranchDomain = _T("");
  1354. if ( strArray.GetSize() )
  1355. {
  1356. strCurBranchDomain = strArray.ElementAt(0).ElementAt(0);
  1357. if ( strCurBranchDomain.Find(_T(".ly.com")) == -1)
  1358. {
  1359. // 当前获取的域名有错;
  1360. return FALSE;
  1361. }
  1362. }
  1363. if ( g_domain.CompareNoCase(strCurBranchDomain) != 0)
  1364. {
  1365. // 当前连接的分店域名与局域网服务器域名不一致;
  1366. return FALSE;
  1367. }
  1368. // 3.获取可用的共享信息;//select * from NetShareInfo where enable = 1;
  1369. CString strFilter = _T("");
  1370. strFilter.Format(_T("enable = 1"));
  1371. int g_nYearposTemp=g_nYearpos;
  1372. g_nYearpos=-1;
  1373. g_bSendOK = 0;
  1374. g_sendhead.bsql = 0;
  1375. g_sendhead.code[0] = 236;
  1376. g_sendhead.tabcount = 1;
  1377. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  1378. g_nYearpos = g_nYearposTemp;
  1379. if ( !g_bSendOK )
  1380. {
  1381. // 获取共享信息失败;
  1382. return FALSE;
  1383. }
  1384. g_aryOfSharePathInfo.RemoveAll();
  1385. DataToArray(&g_aryOfSharePathInfo);
  1386. return g_aryOfSharePathInfo.GetSize() ? TRUE : FALSE;
  1387. }
  1388. #endif
  1389. BOOL CMainFrame::OnConnectBranch()
  1390. {
  1391. if (g_branchip == "")
  1392. {
  1393. return 0;
  1394. }
  1395. if ( 0 == GetSysIniInfo(g_szModulePath, g_branchname + _T(".ini")) )
  1396. {
  1397. //WriteTextLog("分店配置存在:%s, ip:%s, 端口号:%d", g_branchname, g_branchip, g_dwCSPort);
  1398. if ( g_szHostComputerIP[0] != '\0') // 如果分店配置文件不填ip,则使用公司记录的ip;
  1399. g_branchip = g_szHostComputerIP;
  1400. MyGetIPByName2(g_branchip);
  1401. }
  1402. else
  1403. {
  1404. // 调用过一次GetSysIniInfo, g_dwCSPort会被清空;
  1405. GetSysIniInfo();
  1406. }
  1407. g_conntype = 0;
  1408. CString strServerAddress = g_branchip;
  1409. char *szServerAddress = strServerAddress.GetBuffer(0);
  1410. strServerAddress.ReleaseBuffer();
  1411. /*for Client, IP and Port can be 0,
  1412. and for Server, IP is LocalIP, and Port is Listening Port*/
  1413. //int nResult = CClientTunnel::GetInstance()->net_OpenSocket(
  1414. int nResult = m_tClientTunnel.net_OpenSocket(
  1415. Transport_Client,
  1416. 0,
  1417. HandleClientNetEvent,
  1418. this);
  1419. if (TRANSPORT_OK != nResult)
  1420. {
  1421. // AfxMessageBox("网络初始化失败!");
  1422. return 0;
  1423. }
  1424. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1425. DWORD wPort = g_dwCSPort;
  1426. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1427. if (TRANSPORT_OK != nResult)
  1428. {
  1429. m_tClientTunnel.net_CloseSocket();
  1430. return OnConnectBranch2();
  1431. }
  1432. return ProcessLoginRequest();
  1433. }
  1434. BOOL CMainFrame::OnConnectBranch2()
  1435. {
  1436. if (g_branchip2 == "")
  1437. {
  1438. return 0;
  1439. }
  1440. g_conntype = 0;
  1441. CString strServerAddress = g_branchip2;
  1442. char *szServerAddress = strServerAddress.GetBuffer(0);
  1443. strServerAddress.ReleaseBuffer();
  1444. /*for Client, IP and Port can be 0,
  1445. and for Server, IP is LocalIP, and Port is Listening Port*/
  1446. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1447. 0,
  1448. HandleClientNetEvent,
  1449. this);
  1450. if (TRANSPORT_OK != nResult)
  1451. {
  1452. // AfxMessageBox("网络初始化失败!");
  1453. return 0;
  1454. }
  1455. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1456. DWORD wPort = SERVER_PORT; // 5678
  1457. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1458. if (TRANSPORT_OK != nResult)
  1459. {
  1460. m_tClientTunnel.net_CloseSocket();
  1461. return 0;
  1462. }
  1463. return ProcessLoginRequest();
  1464. }
  1465. BOOL CMainFrame::OnConnectIP()
  1466. {
  1467. CString strServerAddress = g_server;
  1468. char *szServerAddress = strServerAddress.GetBuffer(0);
  1469. strServerAddress.ReleaseBuffer();
  1470. /*for Client, IP and Port can be 0,
  1471. and for Server, IP is LocalIP, and Port is Listening Port*/
  1472. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1473. 0,
  1474. HandleClientNetEvent,
  1475. this);
  1476. if (TRANSPORT_OK != nResult)
  1477. {
  1478. // AfxMessageBox("网络初始化失败!");
  1479. return 0;
  1480. }
  1481. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1482. DWORD wPort = SERVER_PORT; // 5678
  1483. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1484. if (TRANSPORT_OK != nResult)
  1485. {
  1486. m_tClientTunnel.net_CloseSocket();
  1487. return 0;
  1488. }
  1489. return ProcessLoginRequest();
  1490. }
  1491. //ip.txt
  1492. BOOL CMainFrame::OnConnectLYFZ()
  1493. {
  1494. #ifdef _DEBUG
  1495. CString strBranchIP = "192.168.1.66";
  1496. #else
  1497. CString strBranchIP = "lijiafz.vicp.net";
  1498. #endif
  1499. MyGetIPByName2(strBranchIP);
  1500. if (strBranchIP == "")
  1501. {
  1502. return 0;
  1503. }
  1504. g_conntype = 0; // Jeff.Delete at 2014.10.18
  1505. //g_conntype = 1;
  1506. CString strServerAddress = strBranchIP;
  1507. char *szServerAddress = strServerAddress.GetBuffer(0);
  1508. strServerAddress.ReleaseBuffer();
  1509. /*for Client, IP and Port can be 0,
  1510. and for Server, IP is LocalIP, and Port is Listening Port*/
  1511. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1512. 0,
  1513. HandleClientNetEvent,
  1514. this);
  1515. if (TRANSPORT_OK != nResult)
  1516. {
  1517. return 0;
  1518. }
  1519. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1520. DWORD wPort = GetPort();
  1521. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1522. if (TRANSPORT_OK != nResult)
  1523. {
  1524. m_tClientTunnel.net_CloseSocket();
  1525. return 0;
  1526. }
  1527. return ProcessLoginRequest();
  1528. }
  1529. BOOL CMainFrame::OnConnect()
  1530. {
  1531. // 1.Jeff 断开(如果有在在未关的连接)之前的连接;
  1532. OnDisconnect();
  1533. // 2.根据需要连接指定的服务器;
  1534. if (g_bBranchModify)
  1535. {
  1536. // Jeff.g_bBranchModify在g_bGenBranchData=1时,在welcome::OnTimer里被设置为1;
  1537. return OnConnectBranch();// 连接集团版分店;
  1538. }
  1539. if (g_bConnLYFZ)
  1540. {
  1541. return OnConnectLYFZ();// 连接公司服务端程序;
  1542. }
  1543. g_conntype = 0;
  1544. CString strServerAddress = g_server;
  1545. // 3.如果dbconfig.dat里保存的是*.ly.com的信息,就要读取ip.txt里的IP地址;
  1546. if (g_serverbak.Find(".ly.com") != -1)
  1547. {
  1548. strServerAddress = g_serverbak;
  1549. CStdioFile fp;
  1550. CString path = g_mainpath + "\\ip.txt";
  1551. if (::PathFileExists(path))
  1552. {
  1553. fp.Open(path, CFile::modeRead);
  1554. fp.ReadString(g_server);
  1555. fp.Close();
  1556. if (OnConnectIP())
  1557. {
  1558. // g_serverip=g_server;
  1559. return 1;
  1560. }
  1561. g_server = strServerAddress;
  1562. OnDisconnect();//MessageBox("ip失败");
  1563. }
  1564. g_conntype = 1; // Jeff.连接公司服务器,用于获取集团版*.ly.com的解析IP结果;
  1565. strServerAddress = "lijiafz.vicp.net";
  1566. MyGetIPByName2(strServerAddress);
  1567. if (strServerAddress.IsEmpty())
  1568. {
  1569. return 0;//OnConnect2();
  1570. }
  1571. }
  1572. else if (g_ntimeout == 29000)//非远程 30000
  1573. {
  1574. strServerAddress = g_serverarray.ElementAt(g_conpos);
  1575. }
  1576. // 4.如果没有IP.txt或dbconfig.dat里的不是ly.com信息,而是一般的计算机名称;
  1577. char *szServerAddress = strServerAddress.GetBuffer(0);
  1578. strServerAddress.ReleaseBuffer();
  1579. // AfxMessageBox("连接:"+strServerAddress);
  1580. /*for Client, IP and Port can be 0,
  1581. and for Server, IP is LocalIP, and Port is Listening Port*/
  1582. // 5.创建通信对象连接;
  1583. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1584. 0,
  1585. HandleClientNetEvent,
  1586. this);
  1587. if (TRANSPORT_OK != nResult)
  1588. {
  1589. return 0;
  1590. }
  1591. GetSysIniInfo();
  1592. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1593. DWORD wPort = g_dwCSPort;
  1594. if (g_conntype) wPort = GetPort();
  1595. // 6.连接公司服务器或影楼服务器;
  1596. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1597. if (TRANSPORT_OK != nResult)
  1598. {
  1599. m_tClientTunnel.net_CloseSocket();
  1600. if (g_conntype)// Jeff.连接公司服务器,用于获取集团版*.ly.com的解析IP结果;
  1601. {
  1602. return 0;//OnConnect2();
  1603. }
  1604. if (g_serverarray.GetSize() > 1)
  1605. {
  1606. if (g_conpos < (g_serverarray.GetSize() - 1))
  1607. {
  1608. g_conpos++;
  1609. return OnConnect();
  1610. }
  1611. else
  1612. {
  1613. g_conpos = 0;
  1614. return 0;
  1615. }
  1616. }
  1617. return 0;
  1618. }
  1619. return ProcessLoginRequest();
  1620. }
  1621. BOOL CMainFrame::OnConnect2()
  1622. {
  1623. g_conntype = 2;
  1624. CString server = "http://www.lyfz.net/download/ip.txt";
  1625. char buf[MAX_PATH];
  1626. ::GetTempPath(sizeof(buf), buf);
  1627. CString m_strTempDir = buf;
  1628. DWORD m_dwHttpRequestFlags = HSR_DOWNLOAD | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
  1629. INTERNET_PORT m_dwPort;
  1630. DWORD dwType;
  1631. CInternetSession m_cis;
  1632. CHttpConnection *m_pHttp;
  1633. CString m_strServer;
  1634. CString m_strIniPath;
  1635. AfxParseURL(server, dwType, m_strServer, m_strIniPath, m_dwPort);
  1636. if (dwType != AFX_INET_SERVICE_HTTP)
  1637. {
  1638. return 0;//OnConnect3();
  1639. }
  1640. m_cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5);
  1641. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1642. try
  1643. {
  1644. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1645. }
  1646. catch (CInternetException* pEx)
  1647. {
  1648. return 0;//OnConnect3();
  1649. }
  1650. CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_GET,
  1651. m_strIniPath, NULL, 1, NULL, NULL, m_dwHttpRequestFlags);
  1652. try
  1653. {
  1654. pFile->SendRequest();
  1655. }
  1656. catch (CInternetException* pEx)
  1657. {
  1658. pFile->Close();
  1659. return 0;//OnConnect3();
  1660. }
  1661. if (pFile)
  1662. {
  1663. CStdioFile csf;
  1664. csf.Open(m_strTempDir + "\\ip.txt", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
  1665. char buf[2048];
  1666. int n;
  1667. while ((n = pFile->Read(buf, 2048)) > 0)
  1668. csf.Write(buf, n);
  1669. csf.Close();
  1670. pFile->Close();
  1671. }
  1672. CString strServerAddress;
  1673. CStdioFile fp;
  1674. fp.Open(m_strTempDir + "\\ip.txt", CFile::modeRead);
  1675. fp.ReadString(strServerAddress);
  1676. fp.Close();
  1677. char *szServerAddress = strServerAddress.GetBuffer(0);
  1678. strServerAddress.ReleaseBuffer();
  1679. /*for Client, IP and Port can be 0,
  1680. and for Server, IP is LocalIP, and Port is Listening Port*/
  1681. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1682. 0,
  1683. HandleClientNetEvent,
  1684. this);
  1685. if (TRANSPORT_OK != nResult)
  1686. {
  1687. return 0;
  1688. }
  1689. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1690. DWORD wPort = SERVER_PORT; // 5678
  1691. if (g_conntype)wPort = GetPort();
  1692. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1693. if (TRANSPORT_OK != nResult)
  1694. {
  1695. m_tClientTunnel.net_CloseSocket();
  1696. return 0;//OnConnect3();
  1697. }
  1698. return ProcessLoginRequest();
  1699. }
  1700. BOOL CMainFrame::OnConnect3()
  1701. {
  1702. g_conntype = 3;
  1703. CString server = "http://photo.bjlyfz.com/download/ip.txt";
  1704. char buf[MAX_PATH];
  1705. ::GetTempPath(sizeof(buf), buf);
  1706. CString m_strTempDir = buf;
  1707. DWORD m_dwHttpRequestFlags = HSR_DOWNLOAD | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
  1708. INTERNET_PORT m_dwPort;
  1709. DWORD dwType;
  1710. CInternetSession m_cis;
  1711. CHttpConnection *m_pHttp;
  1712. CString m_strServer;
  1713. CString m_strIniPath;
  1714. AfxParseURL(server, dwType, m_strServer, m_strIniPath, m_dwPort);
  1715. if (dwType != AFX_INET_SERVICE_HTTP)
  1716. {
  1717. return FALSE;
  1718. }
  1719. m_cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5);
  1720. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1721. try
  1722. {
  1723. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1724. }
  1725. catch (CInternetException* pEx)
  1726. {
  1727. return false;
  1728. }
  1729. CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_GET,
  1730. m_strIniPath, NULL, 1, NULL, NULL, m_dwHttpRequestFlags);
  1731. try
  1732. {
  1733. pFile->SendRequest();
  1734. }
  1735. catch (CInternetException* pEx)
  1736. {
  1737. pFile->Close();
  1738. return false;
  1739. }
  1740. if (pFile)
  1741. {
  1742. CStdioFile csf;
  1743. csf.Open(m_strTempDir + "\\ip.txt", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
  1744. char buf[2048];
  1745. int n;
  1746. while ((n = pFile->Read(buf, 2048)) > 0)
  1747. csf.Write(buf, n);
  1748. csf.Close();
  1749. pFile->Close();
  1750. }
  1751. CString strServerAddress;
  1752. CStdioFile fp;
  1753. fp.Open(m_strTempDir + "\\ip.txt", CFile::modeRead);
  1754. fp.ReadString(strServerAddress);
  1755. fp.Close();
  1756. char *szServerAddress = strServerAddress.GetBuffer(0);
  1757. strServerAddress.ReleaseBuffer();
  1758. /*for Client, IP and Port can be 0,
  1759. and for Server, IP is LocalIP, and Port is Listening Port*/
  1760. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1761. 0,
  1762. HandleClientNetEvent,
  1763. this);
  1764. if (TRANSPORT_OK != nResult)
  1765. {
  1766. return 0;
  1767. }
  1768. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1769. DWORD wPort = SERVER_PORT; // 5678
  1770. if (g_conntype)wPort = GetPort();
  1771. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1772. if (TRANSPORT_OK != nResult)
  1773. {
  1774. m_tClientTunnel.net_CloseSocket();
  1775. return 0;
  1776. }
  1777. return ProcessLoginRequest();
  1778. }
  1779. void CMainFrame::ProcessNetEvent(int nEventType, void *pRecvMsg, DWORD dwDataLen)
  1780. {
  1781. #ifdef _DEBUG
  1782. printf("ProcessNetEvent\n\n");
  1783. #endif
  1784. if (Transport_ReadEv == nEventType)
  1785. {
  1786. if (NULL == pRecvMsg) return;
  1787. TMessageHeader* pHeader = (TMessageHeader *)pRecvMsg;
  1788. char *pDataBuf = (char *)pRecvMsg + MESSAGE_HEADER_LEN;
  1789. WORD dwMessageID = pHeader->wMessageId;
  1790. switch (dwMessageID)
  1791. {
  1792. case MSG_LOGIN_RESP:
  1793. case (MSG_LOGIN_RESP + 0X2FFF) :
  1794. {
  1795. LOGIN_RESULT_STRU tLoginResult = { 0 };
  1796. memcpy(&tLoginResult, pDataBuf, sizeof(LOGIN_RESULT_STRU));
  1797. ProcessLoginResponse(&tLoginResult);
  1798. break;
  1799. }
  1800. case MSG_USERINFO_RESP:
  1801. {
  1802. break;
  1803. }
  1804. case MSG_LOGOUT_RESP:
  1805. {
  1806. break;
  1807. }
  1808. case MSG_CHATMESSAGE_RESP:
  1809. case (MSG_CHATMESSAGE_RESP + 0X4FFF) :
  1810. {
  1811. static int i = 0;
  1812. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pDataBuf;
  1813. ProcessChatMessageResponse((void *)pChatMessage);
  1814. break;
  1815. }
  1816. default:
  1817. {
  1818. break;
  1819. }
  1820. }
  1821. }
  1822. else if (Transport_CloseEv == nEventType)
  1823. {
  1824. OnDisconnect();
  1825. }
  1826. }
  1827. //extern BOOL g_bNeedCoon;
  1828. extern BOOL EncryptFile2(BYTE *buffer, DWORD leng, PCHAR szPassword);
  1829. void CMainFrame::OnTimer(UINT nIDEvent)
  1830. {
  1831. // TODO: Add your message handler code here and/or call default
  1832. if (1 == nIDEvent)
  1833. {
  1834. KillTimer(nIDEvent);
  1835. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status", 0);//status:此机用选片菜单项
  1836. // checked==1:此机用选片菜单项
  1837. // g_bStaffAchievementShow==1:此机用于员工业绩查看
  1838. if (checked && g_bStaffAchievementShow == 0) // .此机用选片菜单项;
  1839. {
  1840. KillTimer(3);
  1841. #ifdef NEW_SKIN
  1842. Welcome weldlg;
  1843. weldlg.DoModal();
  1844. #endif
  1845. ChoosePhotoSkin dlg;
  1846. dlg.SetLiaPath("1.lia");
  1847. if (dlg.DoModal() != IDOK)
  1848. {
  1849. PostMessage(WM_QUIT);
  1850. return;
  1851. }
  1852. if (dlg.m_exitcode == 3)
  1853. {
  1854. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  1855. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  1856. }
  1857. else
  1858. {
  1859. ShowWindow(SW_SHOW);
  1860. #ifdef NEW_SKIN
  1861. if (m_pMainFrimDlg2 == NULL)
  1862. {
  1863. m_pMainFrimDlg2 = new MainFrimDlg2;
  1864. m_pMainFrimDlg2->SetLiaPath("10.lia");
  1865. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  1866. }
  1867. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1868. #endif
  1869. }
  1870. }
  1871. else if (g_bStaffAchievementShow == 0) // .非选片、非查看员工业绩;
  1872. {
  1873. #ifdef NEW_SKIN
  1874. g_bNoConnDlg = 1;
  1875. Welcome weldlg;
  1876. weldlg.DoModal();
  1877. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1878. ShowWindow(SW_SHOW);
  1879. g_bNoConnDlg = 0;
  1880. if (g_bNoLoginLia) // Jeff.OnCreate里判断skin文件有5.lia, g_bNoLoginLia = 0, 无 g_bNoLoginLia = 1;
  1881. {
  1882. Login dlg;
  1883. dlg.SetLiaPath("5.lia");
  1884. dlg.DoModal();
  1885. }
  1886. else
  1887. {
  1888. Login3 dlg;
  1889. dlg.SetLiaPath("5.lia"); // Login3的父类为MyDlg,在BOOL MyDlg::OnInitDialog()里调用了纯虚函数Init();
  1890. dlg.DoModal();
  1891. // 数据库完整性提醒;
  1892. if ( 1 == atoi(g_cominfoarray.ElementAt(0).ElementAt(159)) )
  1893. {
  1894. MessageBox(_T("贵店数据库可能已损坏,请尽快联系售后人员进行确认或维护,联系电话:0752-2398865 或 4006-067-068!"), _T("重要提示:"), MB_OK | MB_TOPMOST /*| MB_SETFOREGROUND*/ | MB_ICONWARNING);
  1895. if ( !g_bRunOnCorruptdb )
  1896. exit(0);
  1897. }
  1898. }
  1899. if (g_user.bLongin && g_pMainWnd2)
  1900. {
  1901. g_pMainWnd2->ShowBar(TRUE,TRUE);
  1902. InsideMsg();
  1903. }
  1904. #else
  1905. ShowWindow(SW_SHOW);
  1906. if (g_bNoLoginLia)
  1907. {
  1908. Login dlg;
  1909. dlg.SetLiaPath ("5.lia");
  1910. dlg.DoModal();
  1911. }
  1912. else
  1913. {
  1914. Login3 dlg;
  1915. dlg.SetLiaPath ("5.lia");
  1916. dlg.DoModal();
  1917. }
  1918. #endif
  1919. }
  1920. if (g_hmouse == NULL)
  1921. {
  1922. g_hmouse = SetWindowsHookEx(WH_MOUSE, MouseProc, 0, ::GetCurrentThreadId());
  1923. }
  1924. }
  1925. else if (2 == nIDEvent) //29秒后,若连接和发送未完成,将关闭连接和发送框;
  1926. {
  1927. KillTimer(2);
  1928. if (g_hConnectWnd)
  1929. ::PostMessage(g_hConnectWnd, WM_CLOSE, 0, 0);
  1930. if (g_hSendWnd)
  1931. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1932. if (g_bStaffAchievementShow == 0 && g_bConnLYFZ == 0)
  1933. {
  1934. if (g_bGenBranchData == 0)
  1935. {
  1936. if (g_branchip != "")
  1937. AfxMessageBox("连接分店:" + g_branchname + "失败!", MB_ICONINFORMATION);
  1938. else
  1939. AfxMessageBox("连接服务器失败!", MB_ICONINFORMATION);
  1940. }
  1941. OnDisconnect();
  1942. }
  1943. g_bSendOK = 0;
  1944. g_bNeedCoon = 1;
  1945. }
  1946. else if (3 == nIDEvent)
  1947. {
  1948. KillTimer(3);
  1949. #ifdef NEW_SKIN
  1950. Welcome weldlg;
  1951. weldlg.DoModal();
  1952. #endif
  1953. ShowWindow(SW_SHOW);
  1954. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1955. g_sendhead.bsql = 0;
  1956. g_sendhead.code[0] = 24;
  1957. g_sendhead.code[1] = 1;
  1958. g_sendhead.tabcount = 2;
  1959. g_pMainWnd->ProcessChatMessageRequest2(1);
  1960. if (g_bSendOK == 0)
  1961. {
  1962. return;
  1963. }
  1964. CArray<CStringArray, CStringArray>patharray;
  1965. CArray<CStringArray, CStringArray>userarray;
  1966. DataToArray(&g_cominfoarray, &g_hisyeararray);
  1967. g_userarray.SetSize(userarray.GetSize(), 1);
  1968. int count = 0;
  1969. for (int ii = 0; ii < userarray.GetSize(); ii++)
  1970. {
  1971. if (userarray.ElementAt(ii).ElementAt(10) == "在职")
  1972. g_userarray.ElementAt(count++).Copy(userarray.ElementAt(ii));
  1973. }
  1974. g_userarray.SetSize(count, 1);
  1975. StaffAchievementShowAll dlg;
  1976. g_pMainWnd->GetOcx();
  1977. dlg.DoModal();
  1978. }
  1979. else if (5 == nIDEvent)
  1980. {
  1981. if (g_bInSkin)
  1982. {
  1983. OutputDebugString("使用皮肤\n");
  1984. return;
  1985. }
  1986. if (g_nAutoShowStaffAchievement == 1){
  1987. OutputDebugString("用于选片\n");
  1988. return;
  1989. }
  1990. if (g_bAllBranch){
  1991. OutputDebugString("多店汇总当中\n");
  1992. return;
  1993. }
  1994. if (g_user.bLongin)
  1995. {
  1996. // m_Mdi.CloseAll();
  1997. g_pMainWnd->OnCommandMenu(IDM_Logout);
  1998. }
  1999. /* g_nAutoShowStaffAchievement=1;
  2000. KillTimer(5);
  2001. StaffAchievementShowAll dlg;
  2002. g_pMainWnd->GetOcx();
  2003. dlg.DoModal ();*/
  2004. }
  2005. else if (6 == nIDEvent)
  2006. {
  2007. static BOOL bDouble = 0;
  2008. bDouble = !bDouble;
  2009. if (bDouble)
  2010. g_pMainWnd->OnCommandMenu(IDM_TAKEAWAYBOOK);
  2011. else
  2012. g_pMainWnd->OnCommandMenu(IDM_CLIENTMONEY);
  2013. }
  2014. else if (7 == nIDEvent)
  2015. {
  2016. // Jeff,当g_bSendLYFZ==TRUE时;
  2017. // 向lijiafz.vicp.net发送影楼信息,防止有盗版用户;
  2018. KillTimer(7);
  2019. if (g_bInSkin)return;
  2020. if (g_nAutoShowStaffAchievement == 1)return;
  2021. if (g_bAllBranch)return;
  2022. CString str = g_strAntiTheftInfo;
  2023. g_bConnLYFZ = 1; // Jeff指示连接的服务器为lijiafz.vicp.net
  2024. // 断开当前连接;
  2025. OnDisconnect();
  2026. BYTE *pData = new BYTE[str.GetLength()];
  2027. memcpy(pData, str.GetBuffer(0), str.GetLength());
  2028. str.ReleaseBuffer();
  2029. EncryptFile2(pData, str.GetLength(), "888666333");
  2030. g_nSendCode = 16;
  2031. g_pMainWnd->ProcessChatMessageRequest2(pData, str.GetLength());
  2032. g_nSendCode = 0;
  2033. delete[]pData;
  2034. OnDisconnect();
  2035. g_bSendLYFZ = 0;
  2036. g_bConnLYFZ = 0;
  2037. if (g_bSendOK)
  2038. {
  2039. char *pStr = new char[g_nLeng + 1];
  2040. memset(pStr, 0, g_nLeng + 1);
  2041. memcpy(pStr, g_pData, g_nLeng);
  2042. CString str = pStr;
  2043. delete[]pStr;
  2044. if (str == "g_bInSkin")
  2045. {
  2046. g_sendhead.bsql = 1;
  2047. g_pMainWnd->ProcessChatMessageRequest2("update version set [setcheck1]='ok'");
  2048. }
  2049. }
  2050. }
  2051. }
  2052. void CMainFrame::OnOutbarNotify(CString strMsg)
  2053. {
  2054. if (g_user.bLongin == 0)
  2055. {
  2056. if (g_bNoLoginLia)
  2057. {
  2058. Login dlg;
  2059. dlg.SetLiaPath("5.lia");
  2060. dlg.DoModal();
  2061. }
  2062. else
  2063. {
  2064. Login3 dlg;
  2065. dlg.SetLiaPath("5.lia");
  2066. dlg.DoModal();
  2067. }
  2068. return;
  2069. if (g_user.bLongin == 0)return;
  2070. }
  2071. else
  2072. {
  2073. InsideMsg();
  2074. }
  2075. ResetTimer();
  2076. if (strMsg == "开单")
  2077. {
  2078. if (IsHasRights(0) == 0)return;
  2079. Booking2 dlg;
  2080. dlg.DoModal();
  2081. return;
  2082. }
  2083. else if (strMsg == "拍照")
  2084. {
  2085. if (IsHasRights(1) == 0)return;
  2086. UINT nID = 1;
  2087. LPSTR pName;
  2088. pName = (LPSTR)(LPCSTR)"拍照";
  2089. OPEN_MENU(TakeFrom);
  2090. return;
  2091. }
  2092. else if (strMsg == "修片")
  2093. {
  2094. if (IsHasRights(1) == 0)return;
  2095. UINT nID = 1;
  2096. LPSTR pName;
  2097. pName = (LPSTR)(LPCSTR)"修片";
  2098. OPEN_MENU(BeautifySkinFrom);
  2099. return;
  2100. }
  2101. else if (strMsg == "选片")
  2102. {
  2103. if (IsHasRights(2) == 0)return;
  2104. UINT nID = 1;
  2105. LPSTR pName;
  2106. pName = (LPSTR)(LPCSTR)"选片";
  2107. OPEN_MENU(ChoosePhotoForm);
  2108. return;
  2109. }
  2110. else if (strMsg == "精修")
  2111. {
  2112. if (IsHasRights(2) == 0)return;
  2113. UINT nID = 1;
  2114. LPSTR pName;
  2115. pName = (LPSTR)(LPCSTR)"精修";
  2116. OPEN_MENU(BeautifySkinFrom2);
  2117. return;
  2118. }
  2119. else if (strMsg == "设计")
  2120. {
  2121. if (IsHasRights(2) == 0)return;
  2122. UINT nID = 1;
  2123. LPSTR pName;
  2124. pName = (LPSTR)(LPCSTR)"设计";
  2125. OPEN_MENU(DesignFrom);
  2126. return;
  2127. }
  2128. else if (strMsg == "数码安排")
  2129. {
  2130. UINT nID = 1;
  2131. LPSTR pName;
  2132. pName = (LPSTR)(LPCSTR)"数码安排";
  2133. OPEN_MENU(DigitalWork);
  2134. return;
  2135. }
  2136. else if (strMsg == "刻盘")
  2137. {
  2138. UINT nID = 1;
  2139. LPSTR pName;
  2140. pName = (LPSTR)(LPCSTR)"刻盘";
  2141. OPEN_MENU(BurnCD);
  2142. return;
  2143. }
  2144. else if (strMsg == "相片冲印")
  2145. {
  2146. UINT nID = 1;
  2147. LPSTR pName;
  2148. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  2149. OPEN_MENU(PhotoPrintFrom);
  2150. return;
  2151. }
  2152. else if (strMsg == "发片/取件")
  2153. {
  2154. if (IsHasRights(3) == 0)return;
  2155. UINT nID = 1;
  2156. LPSTR pName;
  2157. pName = (LPSTR)(LPCSTR)"发片/取件";
  2158. OPEN_MENU(outsourcing);
  2159. return;
  2160. }
  2161. else if (strMsg == "满意度")
  2162. {
  2163. UINT nID = 1;
  2164. LPSTR pName;
  2165. pName = (LPSTR)(LPCSTR)"满意度";
  2166. OPEN_MENU(Satisfaction);
  2167. return;
  2168. }
  2169. else if (strMsg == "满意度汇总")
  2170. {
  2171. UINT nID = 1;
  2172. LPSTR pName;
  2173. pName = (LPSTR)(LPCSTR)"满意度汇总";
  2174. OPEN_MENU(SatisfactionReportForm);
  2175. return;
  2176. }
  2177. #if JEFF_DELETE_ON // 2014.11.14-PM 16:20
  2178. else if (strMsg == "回复统计")
  2179. {
  2180. UINT nID = 1;
  2181. LPSTR pName;
  2182. pName = (LPSTR)(LPCSTR)"回复统计";
  2183. OPEN_MENU(MsgReg2);
  2184. return;
  2185. }
  2186. #endif
  2187. /* else if(strMsg=="取件")
  2188. {
  2189. if(IsHasRights(3)==0)return;
  2190. UINT nID=1;
  2191. LPSTR pName ;
  2192. pName = (LPSTR)(LPCSTR)"取件";
  2193. OPEN_MENU(TakeAwayFrom);
  2194. return;
  2195. }*/
  2196. else if (strMsg == "其它收入")
  2197. {
  2198. if (IsHasRightsnew(16) == 0)return;
  2199. // if(IsHasRightsnew(48)==0)return;
  2200. UINT nID = 1;
  2201. LPSTR pName;
  2202. pName = (LPSTR)(LPCSTR)"其它收入";
  2203. OPEN_MENU(IncomeInput);
  2204. return;
  2205. }
  2206. else if (strMsg == "散客消费")
  2207. {
  2208. if (IsHasRightsnew(16) == 0)return;
  2209. UINT nID = 1;
  2210. LPSTR pName;
  2211. pName = (LPSTR)(LPCSTR)"散客消费";
  2212. OPEN_MENU(IncomeInput2);
  2213. return;
  2214. }
  2215. else if (strMsg == "员工奖罚")
  2216. {
  2217. if (IsHasRightsnew(16) == 0)return;
  2218. UINT nID = 1;
  2219. LPSTR pName;
  2220. pName = (LPSTR)(LPCSTR)"员工奖罚";
  2221. OPEN_MENU(IncomeInput3);
  2222. return;
  2223. }
  2224. else if (strMsg == "员工奖惩")
  2225. {
  2226. if (IsHasRightsnew(16) == 0)return;
  2227. UINT nID = 1;
  2228. LPSTR pName;
  2229. pName = (LPSTR)(LPCSTR)"员工奖惩";
  2230. OPEN_MENU(IncomeInput4);
  2231. return;
  2232. }
  2233. else if (strMsg == "订单收款")
  2234. {
  2235. if (IsHasRights(17) == 0)return;
  2236. UINT nID = 1;
  2237. LPSTR pName;
  2238. pName = (LPSTR)(LPCSTR)"订单收款";
  2239. OPEN_MENU(FinanceForm);
  2240. return;
  2241. }
  2242. else if (strMsg == "日财务表")
  2243. {
  2244. if (IsHasRightsnew(22) == 0)return;
  2245. UINT nID = 2;
  2246. LPSTR pName;
  2247. pName = (LPSTR)(LPCSTR)"日财务表";
  2248. OPEN_MENU(DailyForm);
  2249. return;
  2250. }
  2251. else if (strMsg == "提成比例")
  2252. {
  2253. #ifndef ENTERPRISE_VERSION
  2254. #ifndef CHILD_VERSION
  2255. #ifdef BASIC_VERSION
  2256. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2257. {
  2258. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2259. exit(0);return;
  2260. }
  2261. #else
  2262. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2263. {
  2264. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2265. exit(0);return;
  2266. }
  2267. #endif
  2268. #else
  2269. #ifdef BASIC_VERSION
  2270. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2271. {
  2272. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2273. exit(0);return;
  2274. }
  2275. #else
  2276. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2277. {
  2278. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2279. exit(0); return;
  2280. }
  2281. #endif
  2282. #endif
  2283. #else
  2284. #ifndef CHILD_VERSION
  2285. #ifdef BASIC_VERSION
  2286. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2287. {
  2288. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2289. exit(0); return;
  2290. }
  2291. #else
  2292. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2293. {
  2294. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2295. exit(0); return;
  2296. }
  2297. #endif
  2298. #else
  2299. #ifdef BASIC_VERSION
  2300. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2301. {
  2302. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2303. exit(0);return;
  2304. }
  2305. #else
  2306. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2307. {
  2308. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2309. exit(0); return;
  2310. }
  2311. #endif
  2312. #endif
  2313. #endif
  2314. UINT nID = 2;
  2315. LPSTR pName;
  2316. pName = (LPSTR)(LPCSTR)"提成比例";
  2317. OPEN_MENU(SalarySet2);
  2318. return;
  2319. }
  2320. //else if(strMsg=="员工工作")
  2321. else if (strMsg == "计件提成")
  2322. {
  2323. UINT nID = 2;
  2324. LPSTR pName;
  2325. //pName = (LPSTR)(LPCSTR)"员工工作";
  2326. pName = (LPSTR)(LPCSTR)"计件提成";
  2327. OPEN_MENU(SalarySet3);
  2328. return;
  2329. }
  2330. else if (strMsg == "工资管理")
  2331. {
  2332. #ifndef ENTERPRISE_VERSION
  2333. #ifndef CHILD_VERSION
  2334. #ifdef BASIC_VERSION
  2335. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2336. {
  2337. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2338. exit(0);return;
  2339. }
  2340. #else
  2341. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2342. {
  2343. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2344. exit(0);return;
  2345. }
  2346. #endif
  2347. #else
  2348. #ifdef BASIC_VERSION
  2349. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2350. {
  2351. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2352. exit(0);return;
  2353. }
  2354. #else
  2355. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2356. {
  2357. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2358. exit(0); return;
  2359. }
  2360. #endif
  2361. #endif
  2362. #else
  2363. #ifndef CHILD_VERSION
  2364. #ifdef BASIC_VERSION
  2365. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2366. {
  2367. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2368. exit(0); return;
  2369. }
  2370. #else
  2371. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2372. {
  2373. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2374. exit(0); return;
  2375. }
  2376. #endif
  2377. #else
  2378. #ifdef BASIC_VERSION
  2379. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2380. {
  2381. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2382. exit(0);return;
  2383. }
  2384. #else
  2385. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2386. {
  2387. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2388. exit(0); return;
  2389. }
  2390. #endif
  2391. #endif
  2392. #endif
  2393. UINT nID = 2;
  2394. LPSTR pName;
  2395. pName = (LPSTR)(LPCSTR)"工资管理";
  2396. OPEN_MENU(MySalary);
  2397. return;
  2398. }
  2399. else if (strMsg == "客人付款")
  2400. {
  2401. UINT nID = 2;
  2402. LPSTR pName;
  2403. pName = (LPSTR)(LPCSTR)"客人付款";
  2404. OPEN_MENU(ClientMoney);
  2405. return;
  2406. }
  2407. else if (strMsg == "工资报表")
  2408. {
  2409. #ifndef ENTERPRISE_VERSION
  2410. #ifndef CHILD_VERSION
  2411. #ifdef BASIC_VERSION
  2412. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2413. {
  2414. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2415. exit(0);return;
  2416. }
  2417. #else
  2418. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2419. {
  2420. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2421. exit(0);return;
  2422. }
  2423. #endif
  2424. #else
  2425. #ifdef BASIC_VERSION
  2426. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2427. {
  2428. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2429. exit(0);return;
  2430. }
  2431. #else
  2432. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2433. {
  2434. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2435. exit(0); return;
  2436. }
  2437. #endif
  2438. #endif
  2439. #else
  2440. #ifndef CHILD_VERSION
  2441. #ifdef BASIC_VERSION
  2442. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2443. {
  2444. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2445. exit(0); return;
  2446. }
  2447. #else
  2448. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2449. {
  2450. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2451. exit(0); return;
  2452. }
  2453. #endif
  2454. #else
  2455. #ifdef BASIC_VERSION
  2456. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2457. {
  2458. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2459. exit(0);return;
  2460. }
  2461. #else
  2462. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2463. {
  2464. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2465. exit(0); return;
  2466. }
  2467. #endif
  2468. #endif
  2469. #endif
  2470. if (IsHasRightsnew(25) == 0)return;
  2471. UINT nID = 2;
  2472. LPSTR pName;
  2473. pName = (LPSTR)(LPCSTR)"工资报表";
  2474. g_ncount = 100;
  2475. OPEN_MENU(MySalary);
  2476. return;
  2477. }
  2478. else if (strMsg == "员工业绩")
  2479. {
  2480. #ifndef ENTERPRISE_VERSION
  2481. #ifndef CHILD_VERSION
  2482. #ifdef BASIC_VERSION
  2483. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2484. {
  2485. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2486. exit(0);return;
  2487. }
  2488. #else
  2489. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2490. {
  2491. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2492. exit(0);return;
  2493. }
  2494. #endif
  2495. #else
  2496. #ifdef BASIC_VERSION
  2497. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2498. {
  2499. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2500. exit(0);return;
  2501. }
  2502. #else
  2503. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2504. {
  2505. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2506. exit(0); return;
  2507. }
  2508. #endif
  2509. #endif
  2510. #else
  2511. #ifndef CHILD_VERSION
  2512. #ifdef BASIC_VERSION
  2513. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2514. {
  2515. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2516. exit(0); return;
  2517. }
  2518. #else
  2519. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2520. {
  2521. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2522. exit(0); return;
  2523. }
  2524. #endif
  2525. #else
  2526. #ifdef BASIC_VERSION
  2527. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2528. {
  2529. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2530. exit(0);return;
  2531. }
  2532. #else
  2533. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2534. {
  2535. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2536. exit(0); return;
  2537. }
  2538. #endif
  2539. #endif
  2540. #endif
  2541. if (IsHasRightsnew(33) == 0)return;
  2542. UINT nID = 2;
  2543. LPSTR pName;
  2544. pName = (LPSTR)(LPCSTR)"员工业绩";
  2545. OPEN_MENU(StaffAchievement);
  2546. return;
  2547. }
  2548. else if (strMsg == "订单客户")
  2549. {
  2550. UINT nID = 2;
  2551. LPSTR pName;
  2552. pName = (LPSTR)(LPCSTR)"订单客户";
  2553. g_dx += 10000;
  2554. OPEN_MENU(CClientForm);
  2555. if (g_dx >= 10000)g_dx -= 10000;
  2556. return;
  2557. }
  2558. else if (strMsg == "意向客户")
  2559. {
  2560. UINT nID = 2;
  2561. LPSTR pName;
  2562. pName = (LPSTR)(LPCSTR)"意向客户";
  2563. OPEN_MENU(Client2Form);
  2564. return;
  2565. }
  2566. else if (strMsg == "老客户")
  2567. {
  2568. UINT nID = 2;
  2569. LPSTR pName;
  2570. pName = (LPSTR)(LPCSTR)"老客户";
  2571. OPEN_MENU(OldClient);
  2572. return;
  2573. }
  2574. else if (strMsg == "客户来电")
  2575. {
  2576. UINT nID = 2;
  2577. LPSTR pName;
  2578. pName = (LPSTR)(LPCSTR)"客户来电";
  2579. OPEN_MENU(PhoneRecord);
  2580. return;
  2581. }
  2582. else if (strMsg == "拨出电话")
  2583. {
  2584. UINT nID = 2;
  2585. LPSTR pName;
  2586. pName = (LPSTR)(LPCSTR)"拨出电话";
  2587. OPEN_MENU(PhoneRecordOut);
  2588. return;
  2589. }
  2590. else if (strMsg == "未接来电")
  2591. {
  2592. UINT nID = 2;
  2593. LPSTR pName;
  2594. pName = (LPSTR)(LPCSTR)"未接来电";
  2595. OPEN_MENU(MissCall);
  2596. return;
  2597. }
  2598. else if (strMsg == "客户流失")
  2599. {
  2600. UINT nID = 2;
  2601. LPSTR pName;
  2602. pName = (LPSTR)(LPCSTR)"客户流失";
  2603. OPEN_MENU(ClientReasonChart);
  2604. return;
  2605. }
  2606. else if (strMsg == "客户来源")
  2607. {
  2608. UINT nID = 2;
  2609. LPSTR pName;
  2610. pName = (LPSTR)(LPCSTR)"客户来源";
  2611. OPEN_MENU(ClientFromChart);
  2612. return;
  2613. }
  2614. else if (strMsg == "月财务表")
  2615. {
  2616. if (IsHasRightsnew(23) == 0)return;
  2617. UINT nID = 2;
  2618. LPSTR pName;
  2619. pName = (LPSTR)(LPCSTR)"月财务表";
  2620. OPEN_MENU(MonthForm);
  2621. return;
  2622. }
  2623. else if (strMsg == "支出报表")
  2624. {
  2625. if (IsHasRightsnew(23) == 0)return;
  2626. UINT nID = 2;
  2627. LPSTR pName;
  2628. pName = (LPSTR)(LPCSTR)"支出报表";
  2629. OPEN_MENU(MonthForm2);
  2630. return;
  2631. }
  2632. else if (strMsg == "年财务表")
  2633. {
  2634. if (IsHasRightsnew(24) == 0)return;
  2635. UINT nID = 2;
  2636. LPSTR pName;
  2637. pName = (LPSTR)(LPCSTR)"年财务表";
  2638. OPEN_MENU(YearForm);
  2639. return;
  2640. }
  2641. else if (strMsg == "年财务图表")
  2642. {
  2643. if (IsHasRightsnew(24) == 0)return;
  2644. GetOcx();
  2645. UINT nID = 2;
  2646. LPSTR pName;
  2647. pName = (LPSTR)(LPCSTR)"年财务图表";
  2648. OPEN_MENU(YearForm2);
  2649. return;
  2650. }
  2651. else if (strMsg == "订单图表")
  2652. {
  2653. GetOcx();
  2654. UINT nID = 2;
  2655. LPSTR pName;
  2656. pName = (LPSTR)(LPCSTR)"订单图表";
  2657. OPEN_MENU(DinDanForm);
  2658. return;
  2659. }
  2660. #ifdef ENTERPRISE_VERSION
  2661. else if (strMsg == "订单报表")
  2662. {
  2663. GetOcx();
  2664. UINT nID = 2;
  2665. LPSTR pName;
  2666. pName = (LPSTR)(LPCSTR)"订单报表2";
  2667. OPEN_MENU(DinDanFromBranch);
  2668. return;
  2669. }
  2670. else if (strMsg == "财务图表")
  2671. {
  2672. GetOcx();
  2673. UINT nID = 2;
  2674. LPSTR pName;
  2675. pName = (LPSTR)(LPCSTR)"财务图表";
  2676. OPEN_MENU(YearFormBranch);
  2677. return;
  2678. }
  2679. else if (strMsg == "订单图表")
  2680. {
  2681. GetOcx();
  2682. UINT nID = 2;
  2683. LPSTR pName;
  2684. pName = (LPSTR)(LPCSTR)"订单图表";
  2685. OPEN_MENU(YearFormBranch2);
  2686. return;
  2687. }
  2688. else if (strMsg == "摄控安排")
  2689. {
  2690. UINT nID = 2;
  2691. LPSTR pName;
  2692. pName = (LPSTR)(LPCSTR)"摄控安排";
  2693. g_bookingtype = 0;
  2694. OPEN_MENU(TodayForm);
  2695. return;
  2696. }
  2697. else if (strMsg == "选片预约")
  2698. {
  2699. UINT nID = 2;
  2700. LPSTR pName;
  2701. pName = (LPSTR)(LPCSTR)"选片预约";
  2702. g_bookingtype = 1;
  2703. OPEN_MENU(TodayForm);
  2704. return;
  2705. }
  2706. else if (strMsg == "看样预约")
  2707. {
  2708. UINT nID = 2;
  2709. LPSTR pName;
  2710. pName = (LPSTR)(LPCSTR)"看样预约";
  2711. g_bookingtype = 2;
  2712. OPEN_MENU(TodayForm);
  2713. return;
  2714. }
  2715. else if (strMsg == "取件预约")
  2716. {
  2717. UINT nID = 2;
  2718. LPSTR pName;
  2719. pName = (LPSTR)(LPCSTR)"取件预约";
  2720. g_bookingtype = 3;
  2721. OPEN_MENU(TodayForm);
  2722. return;
  2723. }
  2724. else if (strMsg == "婚庆安排")
  2725. {
  2726. UINT nID = 2;
  2727. LPSTR pName;
  2728. pName = (LPSTR)(LPCSTR)"婚庆安排";
  2729. g_bookingtype = 4;
  2730. OPEN_MENU(TodayForm);
  2731. return;
  2732. }
  2733. #endif
  2734. else if (strMsg == "员工资料")
  2735. {
  2736. UINT nID = 2;
  2737. LPSTR pName;
  2738. pName = (LPSTR)(LPCSTR)"员工资料";
  2739. if (g_bAllBranch)
  2740. OPEN_MENU(EmployeeForm2);
  2741. else
  2742. OPEN_MENU(EmployeeForm);
  2743. return;
  2744. }
  2745. else if (strMsg == "客户区域")
  2746. {
  2747. // if(IsHasRightsnew(48)==0)return;
  2748. GetOcx();
  2749. UINT nID = 2;
  2750. LPSTR pName;
  2751. pName = (LPSTR)(LPCSTR)"客户区域";
  2752. OPEN_MENU(AreaClient);
  2753. return;
  2754. }
  2755. else if (strMsg == "客户报表")
  2756. {
  2757. UINT nID = 3;
  2758. LPSTR pName;
  2759. pName = (LPSTR)(LPCSTR)"客户报表";
  2760. OPEN_MENU(CClientForm);
  2761. return;
  2762. }
  2763. else if (strMsg == "现金支出")
  2764. {
  2765. if (IsHasRightsnew(16) == 0)return;
  2766. UINT nID = 3;
  2767. LPSTR pName;
  2768. pName = (LPSTR)(LPCSTR)"现金支出";
  2769. OPEN_MENU(PayOutInput);
  2770. return;
  2771. }
  2772. else if (strMsg == "短信群发")
  2773. {
  2774. UINT nID = 3;
  2775. LPSTR pName;
  2776. pName = (LPSTR)(LPCSTR)"短信群发";
  2777. OPEN_MENU(SendMsg);
  2778. return;
  2779. }
  2780. else if (strMsg == "短信发送")
  2781. {
  2782. UINT nID = 3;
  2783. LPSTR pName;
  2784. pName = (LPSTR)(LPCSTR)"客户报表";
  2785. OPEN_MENU(CClientForm);
  2786. return;
  2787. }
  2788. else if (strMsg == "流程短信")
  2789. {
  2790. UINT nID = 3;
  2791. LPSTR pName;
  2792. pName = (LPSTR)(LPCSTR)"流程短信";
  2793. OPEN_MENU(WorkMsg);
  2794. return;
  2795. }
  2796. else if (strMsg == "员工短信")
  2797. {
  2798. UINT nID = 3;
  2799. LPSTR pName;
  2800. pName = (LPSTR)(LPCSTR)"员工短信";
  2801. OPEN_MENU(EmployeeMsg);
  2802. return;
  2803. }
  2804. else if (strMsg == "发送记录")
  2805. {
  2806. UINT nID = 3;
  2807. LPSTR pName;
  2808. pName = (LPSTR)(LPCSTR)"发送记录";
  2809. OPEN_MENU(MsgReg);
  2810. return;
  2811. }
  2812. else if (strMsg == "短信设置")
  2813. {
  2814. if (IsHasRightsnew(49) == 0)return;
  2815. MsgSet dlg;
  2816. dlg.DoModal();
  2817. return;
  2818. }
  2819. else if (strMsg == "金卡会员")
  2820. {
  2821. #ifndef ENTERPRISE_VERSION
  2822. #ifndef CHILD_VERSION
  2823. #ifdef BASIC_VERSION
  2824. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2825. {
  2826. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2827. exit(0);return;
  2828. }
  2829. #else
  2830. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2831. {
  2832. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2833. exit(0);return;
  2834. }
  2835. #endif
  2836. #else
  2837. #ifdef BASIC_VERSION
  2838. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2839. {
  2840. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2841. exit(0);return;
  2842. }
  2843. #else
  2844. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2845. {
  2846. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2847. exit(0); return;
  2848. }
  2849. #endif
  2850. #endif
  2851. #else
  2852. #ifndef CHILD_VERSION
  2853. #ifdef BASIC_VERSION
  2854. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2855. {
  2856. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2857. exit(0); return;
  2858. }
  2859. #else
  2860. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2861. {
  2862. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2863. exit(0); return;
  2864. }
  2865. #endif
  2866. #else
  2867. #ifdef BASIC_VERSION
  2868. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2869. {
  2870. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2871. exit(0);return;
  2872. }
  2873. #else
  2874. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2875. {
  2876. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2877. exit(0); return;
  2878. }
  2879. #endif
  2880. #endif
  2881. #endif
  2882. UINT nID = 3;
  2883. LPSTR pName;
  2884. pName = (LPSTR)(LPCSTR)"金卡会员";
  2885. OPEN_MENU(ShowMember);
  2886. return;
  2887. }
  2888. else if (strMsg == "现金子卡")
  2889. {
  2890. UINT nID = 3;
  2891. LPSTR pName;
  2892. pName = (LPSTR)(LPCSTR)"现金子卡";
  2893. OPEN_MENU(ShowMember2);
  2894. return;
  2895. }
  2896. else if (strMsg == "蓝钻会员")
  2897. {
  2898. #ifndef ENTERPRISE_VERSION
  2899. #ifndef CHILD_VERSION
  2900. #ifdef BASIC_VERSION
  2901. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2902. {
  2903. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2904. exit(0);return;
  2905. }
  2906. #else
  2907. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2908. {
  2909. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2910. exit(0);return;
  2911. }
  2912. #endif
  2913. #else
  2914. #ifdef BASIC_VERSION
  2915. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2916. {
  2917. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2918. exit(0);return;
  2919. }
  2920. #else
  2921. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2922. {
  2923. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2924. exit(0); return;
  2925. }
  2926. #endif
  2927. #endif
  2928. #else
  2929. #ifndef CHILD_VERSION
  2930. #ifdef BASIC_VERSION
  2931. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2932. {
  2933. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2934. exit(0); return;
  2935. }
  2936. #else
  2937. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2938. {
  2939. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2940. exit(0); return;
  2941. }
  2942. #endif
  2943. #else
  2944. #ifdef BASIC_VERSION
  2945. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2946. {
  2947. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2948. exit(0);return;
  2949. }
  2950. #else
  2951. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2952. {
  2953. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2954. exit(0); return;
  2955. }
  2956. #endif
  2957. #endif
  2958. #endif
  2959. UINT nID = 3;
  2960. LPSTR pName;
  2961. pName = (LPSTR)(LPCSTR)"蓝钻会员";
  2962. OPEN_MENU(ShowMemberBlue);
  2963. return;
  2964. }
  2965. else if (strMsg == "转介绍积分")
  2966. {
  2967. #ifndef ENTERPRISE_VERSION
  2968. #ifndef CHILD_VERSION
  2969. #ifdef BASIC_VERSION
  2970. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2971. {
  2972. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2973. exit(0);return;
  2974. }
  2975. #else
  2976. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2977. {
  2978. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2979. exit(0);return;
  2980. }
  2981. #endif
  2982. #else
  2983. #ifdef BASIC_VERSION
  2984. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2985. {
  2986. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2987. exit(0);return;
  2988. }
  2989. #else
  2990. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2991. {
  2992. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2993. exit(0); return;
  2994. }
  2995. #endif
  2996. #endif
  2997. #else
  2998. #ifndef CHILD_VERSION
  2999. #ifdef BASIC_VERSION
  3000. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3001. {
  3002. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3003. exit(0); return;
  3004. }
  3005. #else
  3006. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3007. {
  3008. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3009. exit(0); return;
  3010. }
  3011. #endif
  3012. #else
  3013. #ifdef BASIC_VERSION
  3014. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3015. {
  3016. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3017. exit(0);return;
  3018. }
  3019. #else
  3020. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3021. {
  3022. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3023. exit(0); return;
  3024. }
  3025. #endif
  3026. #endif
  3027. #endif
  3028. UINT nID = 3;
  3029. LPSTR pName;
  3030. pName = (LPSTR)(LPCSTR)"转介绍积分";
  3031. OPEN_MENU(Card2Reg);
  3032. return;
  3033. }
  3034. /* else if(strMsg=="转介绍图表")
  3035. {
  3036. #ifndef ENTERPRISE_VERSION
  3037. #ifndef CHILD_VERSION
  3038. #ifdef BASIC_VERSION
  3039. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="0")
  3040. {
  3041. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3042. exit(0);return;
  3043. }
  3044. #else
  3045. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3046. {
  3047. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3048. exit(0);return;
  3049. }
  3050. #endif
  3051. #else
  3052. #ifdef BASIC_VERSION
  3053. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3054. {
  3055. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3056. exit(0);return;
  3057. }
  3058. #else
  3059. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  3060. {
  3061. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3062. exit(0);return;
  3063. }
  3064. #endif
  3065. #endif
  3066. #else
  3067. #ifndef CHILD_VERSION
  3068. #ifdef BASIC_VERSION
  3069. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3070. {
  3071. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3072. exit(0);return;
  3073. }
  3074. #else
  3075. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="5")
  3076. {
  3077. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3078. exit(0);return;
  3079. }
  3080. #endif
  3081. #else
  3082. #ifdef BASIC_VERSION
  3083. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="6")
  3084. {
  3085. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3086. exit(0);return;
  3087. }
  3088. #else
  3089. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="7")
  3090. {
  3091. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3092. exit(0);return;
  3093. }
  3094. #endif
  3095. #endif
  3096. #endif
  3097. UINT nID=3;
  3098. LPSTR pName ;
  3099. pName = (LPSTR)(LPCSTR)"转介绍图表";
  3100. OPEN_MENU(Card2RegChart);
  3101. return;
  3102. }*/
  3103. else if (strMsg == "金卡图表")
  3104. {
  3105. UINT nID = 3;
  3106. LPSTR pName;
  3107. pName = (LPSTR)(LPCSTR)"金卡图表";
  3108. OPEN_MENU(MemberChart);
  3109. return;
  3110. }
  3111. else if (strMsg == "积分短信")
  3112. {
  3113. UINT nID = 3;
  3114. LPSTR pName;
  3115. pName = (LPSTR)(LPCSTR)"积分短信";
  3116. OPEN_MENU(ShowMemberMsg);
  3117. return;
  3118. }
  3119. else if (strMsg == "转介绍返现")
  3120. {
  3121. #ifndef ENTERPRISE_VERSION
  3122. #ifndef CHILD_VERSION
  3123. #ifdef BASIC_VERSION
  3124. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3125. {
  3126. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3127. exit(0);return;
  3128. }
  3129. #else
  3130. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3131. {
  3132. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3133. exit(0);return;
  3134. }
  3135. #endif
  3136. #else
  3137. #ifdef BASIC_VERSION
  3138. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3139. {
  3140. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3141. exit(0);return;
  3142. }
  3143. #else
  3144. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3145. {
  3146. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3147. exit(0); return;
  3148. }
  3149. #endif
  3150. #endif
  3151. #else
  3152. #ifndef CHILD_VERSION
  3153. #ifdef BASIC_VERSION
  3154. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3155. {
  3156. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3157. exit(0); return;
  3158. }
  3159. #else
  3160. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3161. {
  3162. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3163. exit(0); return;
  3164. }
  3165. #endif
  3166. #else
  3167. #ifdef BASIC_VERSION
  3168. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3169. {
  3170. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3171. exit(0);return;
  3172. }
  3173. #else
  3174. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3175. {
  3176. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3177. exit(0); return;
  3178. }
  3179. #endif
  3180. #endif
  3181. #endif
  3182. UINT nID = 3;
  3183. LPSTR pName;
  3184. pName = (LPSTR)(LPCSTR)"转介绍返现";
  3185. OPEN_MENU(Card2RegBlue);
  3186. return;
  3187. }
  3188. else if (strMsg == "转介绍图表")
  3189. {
  3190. #ifndef ENTERPRISE_VERSION
  3191. #ifndef CHILD_VERSION
  3192. #ifdef BASIC_VERSION
  3193. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3194. {
  3195. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3196. exit(0);return;
  3197. }
  3198. #else
  3199. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3200. {
  3201. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3202. exit(0);return;
  3203. }
  3204. #endif
  3205. #else
  3206. #ifdef BASIC_VERSION
  3207. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3208. {
  3209. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3210. exit(0);return;
  3211. }
  3212. #else
  3213. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3214. {
  3215. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3216. exit(0); return;
  3217. }
  3218. #endif
  3219. #endif
  3220. #else
  3221. #ifndef CHILD_VERSION
  3222. #ifdef BASIC_VERSION
  3223. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3224. {
  3225. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3226. exit(0); return;
  3227. }
  3228. #else
  3229. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3230. {
  3231. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3232. exit(0); return;
  3233. }
  3234. #endif
  3235. #else
  3236. #ifdef BASIC_VERSION
  3237. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3238. {
  3239. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3240. exit(0);return;
  3241. }
  3242. #else
  3243. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3244. {
  3245. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3246. exit(0); return;
  3247. }
  3248. #endif
  3249. #endif
  3250. #endif
  3251. UINT nID = 3;
  3252. LPSTR pName;
  3253. pName = (LPSTR)(LPCSTR)"转介绍图表";
  3254. OPEN_MENU(Card2RegChartBlue);
  3255. return;
  3256. }
  3257. else if (strMsg == "积分设置")
  3258. {
  3259. if (IsHasRightsnew(49) == 0)return;
  3260. MemberSet dlg;
  3261. dlg.DoModal();
  3262. return;
  3263. }
  3264. else if (strMsg == "礼服录入")
  3265. {
  3266. if (IsHasRightsnew(39) == 0)return;
  3267. UINT nID = 3;
  3268. LPSTR pName;
  3269. pName = (LPSTR)(LPCSTR)"礼服录入";
  3270. OPEN_MENU(DressManage);
  3271. return;
  3272. }
  3273. else if (strMsg == "礼服查看")
  3274. {
  3275. #ifndef ENTERPRISE_VERSION
  3276. #ifndef CHILD_VERSION
  3277. #ifdef BASIC_VERSION
  3278. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3279. {
  3280. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3281. exit(0);return;
  3282. }
  3283. #else
  3284. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3285. {
  3286. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3287. exit(0);return;
  3288. }
  3289. #endif
  3290. #else
  3291. #ifdef BASIC_VERSION
  3292. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3293. {
  3294. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3295. exit(0);return;
  3296. }
  3297. #else
  3298. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3299. {
  3300. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3301. exit(0); return;
  3302. }
  3303. #endif
  3304. #endif
  3305. #else
  3306. #ifndef CHILD_VERSION
  3307. #ifdef BASIC_VERSION
  3308. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3309. {
  3310. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3311. exit(0); return;
  3312. }
  3313. #else
  3314. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3315. {
  3316. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3317. exit(0); return;
  3318. }
  3319. #endif
  3320. #else
  3321. #ifdef BASIC_VERSION
  3322. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3323. {
  3324. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3325. exit(0);return;
  3326. }
  3327. #else
  3328. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3329. {
  3330. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3331. exit(0); return;
  3332. }
  3333. #endif
  3334. #endif
  3335. #endif
  3336. if (IsHasRightsnew(40) == 0)return;
  3337. UINT nID = 3;
  3338. LPSTR pName;
  3339. pName = (LPSTR)(LPCSTR)"礼服查看";
  3340. OPEN_MENU(ShowDress);
  3341. return;
  3342. }
  3343. else if (strMsg == "撞期预警")
  3344. {
  3345. UINT nID = 3;
  3346. LPSTR pName;
  3347. pName = (LPSTR)(LPCSTR)"撞期预警";
  3348. OPEN_MENU(DressEarlyWarning);
  3349. return;
  3350. }
  3351. else if (strMsg == "礼服出租")
  3352. {
  3353. UINT nID = 3;
  3354. LPSTR pName;
  3355. pName = (LPSTR)(LPCSTR)"礼服出租";
  3356. OPEN_MENU(ShowHireReg);
  3357. return;
  3358. }
  3359. else if (strMsg == "礼服图片")
  3360. {
  3361. ShowPic dlg;
  3362. dlg.m_mode = 4;
  3363. //dlg.m_path = g_path5 + "\\";
  3364. dlg.m_id = g_path5 + "\\";
  3365. dlg.DoModal();
  3366. return;
  3367. }
  3368. else if (strMsg == "商品类别设置")
  3369. {
  3370. if (IsHasRightsnew(29) == 0)return;
  3371. SPLBDlg dlg;
  3372. dlg.DoModal();
  3373. return;
  3374. }
  3375. else if (strMsg == "商品名称设置")
  3376. {
  3377. if (IsHasRightsnew(29) == 0)return;
  3378. UINT nID = 3;
  3379. LPSTR pName;
  3380. pName = (LPSTR)(LPCSTR)"商品设置";
  3381. OPEN_MENU(ShangPin);
  3382. return;
  3383. }
  3384. else if (strMsg == "固定资产管理")
  3385. {
  3386. UINT nID = 3;
  3387. LPSTR pName;
  3388. pName = (LPSTR)(LPCSTR)"固定资产管理";
  3389. OPEN_MENU(FixedAssets);
  3390. return;
  3391. }
  3392. else if (strMsg == "入库单")
  3393. {
  3394. if (IsHasRightsnew(44) == 0)return;
  3395. InputGoods dlg;
  3396. dlg.DoModal();
  3397. return;
  3398. }
  3399. else if (strMsg == "出库单")
  3400. {
  3401. #ifndef ENTERPRISE_VERSION
  3402. #ifndef CHILD_VERSION
  3403. #ifdef BASIC_VERSION
  3404. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3405. {
  3406. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3407. exit(0);return;
  3408. }
  3409. #else
  3410. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3411. {
  3412. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3413. exit(0);return;
  3414. }
  3415. #endif
  3416. #else
  3417. #ifdef BASIC_VERSION
  3418. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3419. {
  3420. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3421. exit(0);return;
  3422. }
  3423. #else
  3424. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3425. {
  3426. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3427. exit(0); return;
  3428. }
  3429. #endif
  3430. #endif
  3431. #else
  3432. #ifndef CHILD_VERSION
  3433. #ifdef BASIC_VERSION
  3434. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3435. {
  3436. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3437. exit(0); return;
  3438. }
  3439. #else
  3440. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3441. {
  3442. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3443. exit(0); return;
  3444. }
  3445. #endif
  3446. #else
  3447. #ifdef BASIC_VERSION
  3448. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3449. {
  3450. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3451. exit(0);return;
  3452. }
  3453. #else
  3454. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3455. {
  3456. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3457. exit(0); return;
  3458. }
  3459. #endif
  3460. #endif
  3461. #endif
  3462. if (IsHasRightsnew(45) == 0)return;
  3463. InputGoods dlg;
  3464. dlg.m_mode = 1;
  3465. dlg.DoModal();
  3466. return;
  3467. }
  3468. else if (strMsg == "库存查询")
  3469. {
  3470. #ifndef ENTERPRISE_VERSION
  3471. #ifndef CHILD_VERSION
  3472. #ifdef BASIC_VERSION
  3473. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3474. {
  3475. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3476. exit(0);return;
  3477. }
  3478. #else
  3479. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3480. {
  3481. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3482. exit(0);return;
  3483. }
  3484. #endif
  3485. #else
  3486. #ifdef BASIC_VERSION
  3487. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3488. {
  3489. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3490. exit(0);return;
  3491. }
  3492. #else
  3493. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3494. {
  3495. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3496. exit(0); return;
  3497. }
  3498. #endif
  3499. #endif
  3500. #else
  3501. #ifndef CHILD_VERSION
  3502. #ifdef BASIC_VERSION
  3503. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3504. {
  3505. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3506. exit(0); return;
  3507. }
  3508. #else
  3509. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3510. {
  3511. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3512. exit(0); return;
  3513. }
  3514. #endif
  3515. #else
  3516. #ifdef BASIC_VERSION
  3517. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3518. {
  3519. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3520. exit(0);return;
  3521. }
  3522. #else
  3523. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3524. {
  3525. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3526. exit(0); return;
  3527. }
  3528. #endif
  3529. #endif
  3530. #endif
  3531. UINT nID = 3;
  3532. LPSTR pName;
  3533. pName = (LPSTR)(LPCSTR)"库存查询";
  3534. OPEN_MENU(ShowGoods);
  3535. return;
  3536. }
  3537. else if (strMsg == "商品图表")
  3538. {
  3539. UINT nID = 3;
  3540. LPSTR pName;
  3541. pName = (LPSTR)(LPCSTR)"商品图表";
  3542. OPEN_MENU(StoreInfoChart);
  3543. return;
  3544. }
  3545. else if (strMsg == "成本核算")
  3546. {
  3547. UINT nID = 3;
  3548. LPSTR pName;
  3549. pName = (LPSTR)(LPCSTR)"成本核算";
  3550. OPEN_MENU(CostCal);
  3551. return;
  3552. }
  3553. else if (strMsg == "考勤记录")
  3554. {
  3555. UINT nID = 3;
  3556. LPSTR pName;
  3557. pName = (LPSTR)(LPCSTR)"考勤记录";
  3558. OPEN_MENU(LoginReg);
  3559. return;
  3560. }
  3561. else if (strMsg == "月统计")
  3562. {
  3563. UINT nID = 3;
  3564. LPSTR pName;
  3565. pName = (LPSTR)(LPCSTR)"月统计";
  3566. OPEN_MENU(LoginReg2);
  3567. return;
  3568. }
  3569. else if (strMsg == "时间设置")
  3570. {
  3571. if (IsHasRightsnew(21) == 0)return;
  3572. SetLoginTime dlg;
  3573. dlg.DoModal();
  3574. return;
  3575. }
  3576. else if (strMsg == "排班设置")
  3577. {
  3578. if (IsHasRightsnew(21) == 0)return;
  3579. SetLoginBan dlg;
  3580. dlg.DoModal();
  3581. return;
  3582. }
  3583. else if (strMsg == "意向查询")
  3584. {
  3585. UINT nID = 3;
  3586. LPSTR pName;
  3587. pName = (LPSTR)(LPCSTR)"意向查询";
  3588. OPEN_MENU(HospitalClient);
  3589. return;
  3590. }
  3591. else if (strMsg == "今日提醒")
  3592. {
  3593. UINT nID = 3;
  3594. LPSTR pName;
  3595. pName = (LPSTR)(LPCSTR)"今日提醒";
  3596. OPEN_MENU(HospitalClientAlarm);
  3597. return;
  3598. }
  3599. else if (strMsg == "跟踪短信")
  3600. {
  3601. UINT nID = 3;
  3602. LPSTR pName;
  3603. pName = (LPSTR)(LPCSTR)"跟踪短信";
  3604. OPEN_MENU(HospitalClientMsg);
  3605. return;
  3606. }
  3607. else if (strMsg == "意向单录入")
  3608. {
  3609. AddHospitalClient dlg;
  3610. dlg.DoModal();
  3611. return;
  3612. }
  3613. else if (strMsg == "资料设置")
  3614. {
  3615. HospitalInfoSet dlg;
  3616. dlg.DoModal();
  3617. return;
  3618. }
  3619. else if ( strMsg == _T("公众号设置"))
  3620. {
  3621. if (IsHasRightsnew(62) == 0)return;
  3622. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3623. {
  3624. lyfzLibrary::g_PtrShowWeiXinDialog(g_rc, g_bkcol);
  3625. lyfzLibrary::FreeWeiXinLibaray();
  3626. }
  3627. return;
  3628. }
  3629. else if ( strMsg == _T("模板消息设置"))
  3630. {
  3631. if (IsHasRightsnew(63) == 0)return;
  3632. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3633. {
  3634. lyfzLibrary::g_PtrShowWXMsgconfigDialog(g_rc, g_bkcol);
  3635. lyfzLibrary::FreeWeiXinLibaray();
  3636. }
  3637. return;
  3638. }
  3639. else if ( strMsg == _T("推送记录") )
  3640. {
  3641. if (IsHasRightsnew(64) == 0)return;
  3642. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3643. {
  3644. lyfzLibrary::g_PtrShowWXMsgRcordDialog(g_rc, g_bkcol);
  3645. lyfzLibrary::FreeWeiXinLibaray();
  3646. }
  3647. return;
  3648. }
  3649. AfxMessageBox(strMsg + ",开发中...");
  3650. }
  3651. // Jeff.当版本号不一致时,调用AutoUpdate.exe来升级YLGL.exe
  3652. void CMainFrame::AutoUpdate()
  3653. {
  3654. if (g_bBranchModify)
  3655. {
  3656. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3657. return;
  3658. }
  3659. else if (g_branchname != "")
  3660. {
  3661. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3662. return;
  3663. }
  3664. g_ntimeout = 30000;
  3665. if (!::PathFileExists(g_mainpath + "\\AutoUpdate.exe"))
  3666. {
  3667. g_sendhead.bsql = 0;
  3668. g_sendhead.code[0] = 99;
  3669. g_sendhead.tabcount = 1;
  3670. g_pMainWnd->ProcessChatMessageRequest2(99);
  3671. if (g_bSendOK == 0)
  3672. goto failed;
  3673. CFile fp;
  3674. fp.Open(g_mainpath + "\\AutoUpdate.exe", CFile::modeWrite | CFile::modeCreate);
  3675. fp.Write(g_pData, g_nLeng);
  3676. fp.Close();
  3677. }
  3678. {
  3679. ::DeleteFile(g_mainpath + "\\YLGL2.exe"); // 删除ylgl.exe;
  3680. g_sendhead.bsql = 0;
  3681. g_sendhead.code[0] = 98;
  3682. g_sendhead.tabcount = 1;
  3683. g_pMainWnd->ProcessChatMessageRequest2(99); if (g_bSendOK == 0)goto failed;
  3684. CFile fp;
  3685. fp.Open(g_mainpath + "\\YLGL2.exe", CFile::modeWrite | CFile::modeCreate);
  3686. fp.Write(g_pData, g_nLeng);
  3687. fp.Close();
  3688. }
  3689. AfxMessageBox("自动升级成功!", MB_ICONINFORMATION);
  3690. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\AutoUpdate.exe"), "12345", NULL, SW_SHOWNORMAL);
  3691. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3692. exit(0);
  3693. return;
  3694. failed:
  3695. AfxMessageBox("自动升级失败!", MB_ICONINFORMATION);
  3696. if (g_ntimeout == 30000)//非远程
  3697. {
  3698. AfxMessageBox("提醒:升级过程中需要传输较多的数据,如果网速慢可能导致远程升级失败!\r\n\
  3699. 可拷贝店内客户端用QQ传过来覆盖除dbconfig.dat的文件即可。", MB_ICONINFORMATION);
  3700. }
  3701. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3702. }
  3703. void CMainFrame::Onchoosephotoskin() //Jeff:此机用于选片菜单项;不在使用2014.06.16
  3704. {
  3705. if (g_user.bLongin == 0)
  3706. {
  3707. if (g_bNoLoginLia)
  3708. {
  3709. Login dlg;
  3710. dlg.SetLiaPath("5.lia");
  3711. dlg.DoModal();
  3712. }
  3713. else
  3714. {
  3715. Login3 dlg;
  3716. dlg.SetLiaPath("5.lia");
  3717. dlg.DoModal();
  3718. }
  3719. if (g_user.bLongin == 0)return;
  3720. }
  3721. // TODO: Add your command handler code here
  3722. CMenu *pMenu = GetMenu();
  3723. CMenu* submenu = pMenu->GetSubMenu(1);
  3724. UINT status = submenu->GetMenuState(IDM_choosephotoskin, MF_BYCOMMAND);
  3725. if (status&MF_CHECKED)
  3726. {
  3727. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_UNCHECKED);
  3728. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status", 0);
  3729. }
  3730. else
  3731. {
  3732. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  3733. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status", 1);
  3734. }
  3735. }
  3736. /*BOOL g_bInSkin = 0;*/
  3737. BOOL CMainFrame::IsCtrlDown()
  3738. {
  3739. short state = GetKeyState(VK_LCONTROL);
  3740. BYTE sta = (BYTE)(state >> 8);
  3741. state = GetKeyState(VK_RCONTROL);
  3742. BYTE sta2 = (BYTE)(state >> 8);
  3743. if (sta || sta2)
  3744. return 1;
  3745. else
  3746. return 0;
  3747. }//IsShiftDown
  3748. BOOL CMainFrame::IsShiftDown()
  3749. {
  3750. short state = GetKeyState(VK_LSHIFT);
  3751. BYTE sta = (BYTE)(state >> 8);
  3752. state = GetKeyState(VK_RSHIFT);
  3753. BYTE sta2 = (BYTE)(state >> 8);
  3754. if (sta || sta2)
  3755. return 1;
  3756. else
  3757. return 0;
  3758. }
  3759. BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
  3760. {
  3761. // TODO: Add your specialized code here and/or call the base class IDM_Logout
  3762. if (pMsg->message == WM_KEYDOWN)
  3763. {
  3764. switch (pMsg->wParam)
  3765. {
  3766. case VK_F12:
  3767. g_pMainWnd->OnCommandMenu(IDM_Logout);
  3768. return 1;
  3769. case VK_F1:
  3770. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  3771. return 1;
  3772. case VK_F2: // 此机用于选片和选设计;
  3773. {
  3774. if (g_pMainWnd->m_bCheckF2F3 && (IsShiftDown() == 0 || IsCtrlDown() == 0))return 1;
  3775. m_Mdi.MainClose();
  3776. if (g_user.bLongin)
  3777. {
  3778. SearchClient dlg;
  3779. dlg.SetLiaPath("2.lia");
  3780. if (dlg.DoModal() != IDOK)
  3781. {
  3782. if (dlg.m_bLogout)
  3783. {
  3784. g_user.bLongin = 0;
  3785. g_user.name.Empty();
  3786. g_user.rights.Empty();
  3787. g_user.account.Empty();
  3788. goto ll;
  3789. }
  3790. PostMessage(WM_QUIT);
  3791. return 1;
  3792. }
  3793. if (dlg.m_exitcode == 3)
  3794. {
  3795. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3796. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3797. }
  3798. else
  3799. {
  3800. ShowWindow(SW_SHOW);
  3801. #ifdef NEW_SKIN
  3802. if (m_pMainFrimDlg2 == NULL)
  3803. {
  3804. m_pMainFrimDlg2 = new MainFrimDlg2;
  3805. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3806. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3807. }
  3808. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3809. g_bInSkin = 0;
  3810. #endif
  3811. }
  3812. }
  3813. else
  3814. {
  3815. ll:
  3816. ChoosePhotoSkin dlg;
  3817. dlg.SetLiaPath("1.lia");
  3818. if (dlg.DoModal() != IDOK)
  3819. {
  3820. PostMessage(WM_QUIT);
  3821. return 1;
  3822. }
  3823. if (dlg.m_exitcode == 3)
  3824. {
  3825. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3826. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3827. }
  3828. else
  3829. {
  3830. ShowWindow(SW_SHOW);
  3831. #ifdef NEW_SKIN
  3832. if (m_pMainFrimDlg2 == NULL)
  3833. {
  3834. m_pMainFrimDlg2 = new MainFrimDlg2;
  3835. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3836. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3837. }
  3838. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3839. g_bInSkin = 0;
  3840. #endif
  3841. }
  3842. }
  3843. }
  3844. return 1;
  3845. case VK_F3: // 此机用于选片和选设计;
  3846. {
  3847. if (g_pMainWnd->m_bCheckF2F3 && (g_pMainWnd->IsShiftDown() == 0 || g_pMainWnd->IsCtrlDown() == 0))return 1;
  3848. m_Mdi.MainClose();
  3849. if (g_user.bLongin)
  3850. {
  3851. SearchClient dlg;
  3852. dlg.m_mode = 1;
  3853. dlg.SetLiaPath("2.lia");
  3854. if (dlg.DoModal() != IDOK)
  3855. {
  3856. if (dlg.m_bLogout)
  3857. {
  3858. g_user.bLongin = 0;
  3859. g_user.name.Empty();
  3860. g_user.rights.Empty();
  3861. g_user.account.Empty();
  3862. goto mm;
  3863. }
  3864. PostMessage(WM_QUIT);
  3865. return 1;
  3866. }
  3867. if (dlg.m_exitcode == 2)
  3868. {
  3869. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3870. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3871. }
  3872. else
  3873. {
  3874. ShowWindow(SW_SHOW);
  3875. #ifdef NEW_SKIN
  3876. if (m_pMainFrimDlg2 == NULL)
  3877. {
  3878. m_pMainFrimDlg2 = new MainFrimDlg2;
  3879. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3880. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3881. }
  3882. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3883. g_bInSkin = 0;
  3884. #endif
  3885. }
  3886. }
  3887. else
  3888. {
  3889. mm:
  3890. ChoosePhotoSkin dlg;
  3891. dlg.m_mode = 1;
  3892. dlg.SetLiaPath("1.lia");
  3893. if (dlg.DoModal() != IDOK)
  3894. {
  3895. PostMessage(WM_QUIT);
  3896. return 1;
  3897. }
  3898. if (dlg.m_exitcode == 2)
  3899. {
  3900. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3901. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3902. }
  3903. else
  3904. {
  3905. ShowWindow(SW_SHOW);
  3906. #ifdef NEW_SKIN
  3907. if (m_pMainFrimDlg2 == NULL)
  3908. {
  3909. m_pMainFrimDlg2 = new MainFrimDlg2;
  3910. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3911. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3912. }
  3913. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3914. g_bInSkin = 0;
  3915. #endif
  3916. }
  3917. }
  3918. }
  3919. return 1;
  3920. //#if 0 // 2015-05-30 禁用F11功能;
  3921. // case VK_F11:
  3922. // if (g_bInSkin)return 1;
  3923. // if (g_user.bLongin)
  3924. // {
  3925. // SqlDlg dlg;
  3926. // dlg.DoModal();
  3927. // }
  3928. // break;
  3929. //#endif
  3930. }
  3931. }
  3932. return CMDIFrameWnd::PreTranslateMessage(pMsg);
  3933. }
  3934. void CMainFrame::GetSkin()
  3935. {
  3936. return;
  3937. #ifdef MNLS_VERSION
  3938. if (::PathFileExists(g_mainpath + "\\skin\\4.lia"))
  3939. {
  3940. CFile fp;
  3941. fp.Open(g_mainpath + "\\skin\\4.lia", CFile::modeRead);
  3942. DWORD leng=fp.GetLength ();
  3943. fp.Close ();
  3944. if(leng!=194987)
  3945. ::DeleteFile (g_mainpath+"\\skin\\4.lia"); // 删除4.lia
  3946. }
  3947. if(!::PathFileExists (g_mainpath+"\\skin\\4.lia"))
  3948. {
  3949. ::CreateDirectory (g_mainpath+"\\skin", NULL);
  3950. g_sendhead.bsql=0;
  3951. g_sendhead.code[0]=100;
  3952. g_sendhead.tabcount=1;
  3953. g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return;
  3954. CFile fp;
  3955. fp.Open (g_mainpath+"\\skin\\4.lia", CFile::modeWrite|CFile::modeCreate);
  3956. fp.Write (g_pData, g_nLeng);
  3957. fp.Close ();
  3958. }
  3959. #endif
  3960. }
  3961. void AutoDraw(CPrintRX &m_Print, CRect &StrRect, CString &str, float fscale)
  3962. {
  3963. CString tempbz =_T(""), temp = _T("");
  3964. BOOL bRun = 0;
  3965. CSize size;
  3966. int fontsize = 12;
  3967. int i = 0;
  3968. ll: tempbz = str;
  3969. i = 0;
  3970. m_Print.SetFontFace(fontsize, 1, "宋体");
  3971. while (1)
  3972. {
  3973. if (!tempbz.IsEmpty())
  3974. {
  3975. temp = tempbz;
  3976. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  3977. int right = 0;
  3978. CRect temprc = StrRect;
  3979. temprc.top += i*(fontsize*fscale); i++;
  3980. temprc.bottom = temprc.top + fontsize;
  3981. if (temprc.bottom > StrRect.bottom)break;
  3982. while (size.cx > temprc.Width())
  3983. {
  3984. right++;
  3985. temp = tempbz.Left(tempbz.GetLength() - (right));
  3986. if (GIsHalfHZ(temp))
  3987. {
  3988. right++;
  3989. temp.Delete(temp.GetLength() - 1);
  3990. }
  3991. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  3992. }
  3993. // 判断最后的字符是否还含有半个汉字;
  3994. if ( GIsHalfHZ(temp) )
  3995. {
  3996. right++;
  3997. temp.Delete(temp.GetLength() -1);
  3998. temp = tempbz.Left(tempbz.GetLength() - (right));
  3999. }
  4000. if (temp.Find("\r\n") != -1)
  4001. {
  4002. temp = temp.Left(temp.Find("\r\n"));//i++;
  4003. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength() - 2);
  4004. }
  4005. else
  4006. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  4007. if (bRun)
  4008. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, temprc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4009. }
  4010. else
  4011. break;
  4012. }
  4013. if (tempbz.IsEmpty() == 0)
  4014. {
  4015. fontsize--;
  4016. goto ll;
  4017. }
  4018. if (bRun == 0)
  4019. {
  4020. bRun = 1;
  4021. goto ll;
  4022. }
  4023. }
  4024. void CMainFrame::PrintDinDan3(CString strOrderNumber)
  4025. {
  4026. // TODO: Add your control notification handler code here
  4027. CPrintRX m_Print;
  4028. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  4029. {
  4030. m_Print.InitToPrint(NULL, 1);
  4031. }
  4032. else
  4033. {
  4034. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  4035. if (name.IsEmpty())
  4036. m_Print.InitToPrint(NULL, 1);
  4037. else
  4038. {
  4039. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  4040. if (nret == -1)
  4041. {
  4042. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  4043. }
  4044. }
  4045. }
  4046. m_Print.StartPrint();
  4047. m_Print.StartPage();
  4048. LoadRect load;
  4049. load.SetLiaPath("11.lia");
  4050. load.SetMargins(0, 0);
  4051. if (!load.Load())return;
  4052. LoadRect load2;
  4053. load2.SetLiaPath("12.lia");
  4054. load2.SetMargins(0, 0);
  4055. if (!load2.Load())return;
  4056. LoadRect load3;
  4057. load3.SetLiaPath("13.lia");
  4058. load3.SetMargins(-6, 520);
  4059. if (!load3.Load())return;
  4060. int i;
  4061. //////////////////////////////////////////////////////////////
  4062. CStringArray txarray;
  4063. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "'";
  4064. g_sendhead.code[0] = 11;
  4065. g_sendhead.code[1] = 52;
  4066. g_sendhead.code[2] = 50;
  4067. g_sendhead.code[3] = 150;
  4068. g_sendhead.tabcount = 4;
  4069. g_sendhead.bsql = 0;
  4070. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  4071. CArray<CStringArray, CStringArray>sparray;
  4072. CArray<CStringArray, CStringArray>clientarray;
  4073. CArray<CStringArray, CStringArray>jdarray;
  4074. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray);
  4075. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  4076. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  4077. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  4078. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  4079. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  4080. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  4081. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  4082. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  4083. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  4084. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  4085. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  4086. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  4087. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  4088. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  4089. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  4090. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  4091. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  4092. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  4093. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  4094. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  4095. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  4096. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  4097. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  4098. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  4099. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  4100. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  4101. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  4102. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  4103. CString m_bz = "其它要求: " + g_List1array.ElementAt(0).ElementAt(38);
  4104. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  4105. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  4106. if (IsHasRights2new(31) == 0)
  4107. {
  4108. m_phone1 = "***";
  4109. m_phone2 = "***";
  4110. }
  4111. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  4112. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  4113. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  4114. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  4115. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  4116. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  4117. CString m_addr = m_addr1 + ";";
  4118. m_addr.TrimLeft(";");
  4119. m_addr += m_addr2;
  4120. CString m_qq = m_qq1 + ";";
  4121. m_qq.TrimLeft(";");
  4122. m_qq += m_qq2;
  4123. CString m_jd;
  4124. for (i = 0; i < jdarray.GetSize(); i++)
  4125. {
  4126. m_jd += jdarray.ElementAt(i).ElementAt(1);
  4127. m_jd += ";";
  4128. }
  4129. m_jd.TrimRight(";");
  4130. m_money1.Format("%f", atof(m_taoxijiage));
  4131. m_money2.Format("%f", atof(m_payed1));
  4132. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  4133. ConvertToPrice(m_money1);
  4134. ConvertToPrice(m_money2);
  4135. ConvertToPrice(m_money3);
  4136. ////////////////////////////////////////////////////////////////
  4137. int rcpos = -1;
  4138. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  4139. m_Print.SetFontFace(17, 1, "宋体");
  4140. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4141. StrRect.top -= 0;
  4142. StrRect.bottom -= 10;
  4143. StrRect.left -= 140;
  4144. StrRect.right = StrRect.left + 48;
  4145. m_Print.SetFontFace(15, 1, "宋体");
  4146. m_Print.SetColor(0xffffff);
  4147. m_Print.DrawRect(StrRect, 0);
  4148. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4149. StrRect.left = StrRect.right;
  4150. StrRect.right = StrRect.left + 48;
  4151. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  4152. m_Print.SetColor(0, RGB(255, 0, 0));
  4153. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4154. m_Print.SetColor(0);
  4155. m_Print.SetFontFace(12, 1, "宋体");
  4156. StrRect.left -= 48;
  4157. int hei = StrRect.Height();
  4158. StrRect.top = StrRect.bottom + 2;
  4159. StrRect.bottom += hei + 2;
  4160. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4161. StrRect.top = StrRect.bottom - 2;
  4162. StrRect.bottom += hei - 5;
  4163. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  4164. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4165. m_Print.SetFontFace(12, 1, "宋体");
  4166. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4167. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4168. m_Print.SetFontFace(11, 1, "宋体");
  4169. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4170. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4171. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4172. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4173. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4174. m_Print.DrawRect2(StrRect, 2);
  4175. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4176. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4177. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4178. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4179. m_Print.DrawRect2(StrRect, 2);
  4180. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4181. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4182. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4183. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4184. m_Print.DrawRect2(StrRect, 2);
  4185. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4186. m_Print.DrawText((LPTSTR)(LPCTSTR)"约单时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4187. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4188. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4189. m_Print.DrawRect2(StrRect, 2);
  4190. ////////////
  4191. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4192. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4193. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4194. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4195. m_Print.DrawRect2(StrRect, 2);
  4196. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4197. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4198. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4199. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4200. m_Print.DrawRect2(StrRect, 2);
  4201. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4202. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4203. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4204. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4205. m_Print.DrawRect2(StrRect, 2);
  4206. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4207. m_Print.DrawText((LPTSTR)(LPCTSTR)"大婚时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4208. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4209. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4210. m_Print.DrawRect2(StrRect, 2);
  4211. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4212. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客地址:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4213. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4214. m_Print.DrawText((LPTSTR)(LPCTSTR)m_addr, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4215. m_Print.DrawRect2(StrRect, 2);
  4216. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4217. m_Print.DrawText((LPTSTR)(LPCTSTR)"QQ/邮箱:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4218. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4219. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4220. m_Print.DrawRect2(StrRect, 2);
  4221. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4222. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系金额:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4223. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4224. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4225. m_Print.DrawRect2(StrRect, 2);
  4226. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4227. m_Print.DrawText((LPTSTR)(LPCTSTR)"定金:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4228. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4229. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4230. m_Print.DrawRect2(StrRect, 2);
  4231. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4232. m_Print.DrawText((LPTSTR)(LPCTSTR)"余额:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4233. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4234. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4235. m_Print.DrawRect2(StrRect, 2);
  4236. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4237. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4238. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4239. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4240. m_Print.DrawRect2(StrRect, 2);
  4241. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4242. m_Print.DrawText((LPTSTR)(LPCTSTR)"拍摄景点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4243. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4244. m_Print.DrawText((LPTSTR)(LPCTSTR)m_jd, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4245. m_Print.DrawRect2(StrRect, 2);
  4246. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4247. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内容提供: 男士服装:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4248. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4249. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4250. m_Print.DrawRect2(StrRect, 2);
  4251. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4252. m_Print.DrawText((LPTSTR)(LPCTSTR)"套", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4253. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4254. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4255. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4256. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4257. m_Print.DrawRect2(StrRect, 2);
  4258. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4259. m_Print.DrawText((LPTSTR)(LPCTSTR)"套", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  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)"其它:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4264. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4265. m_Print.DrawText((LPTSTR)(LPCTSTR)" ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4266. m_Print.DrawRect2(StrRect, 2);
  4267. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4268. m_Print.DrawText((LPTSTR)(LPCTSTR)"专业数码拍摄:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4269. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4270. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4271. m_Print.DrawRect2(StrRect, 2);
  4272. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4273. m_Print.DrawText((LPTSTR)(LPCTSTR)"张", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4274. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4275. m_Print.DrawText((LPTSTR)(LPCTSTR)"(JPG格式数据)", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4276. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4277. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内赠送:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4278. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4279. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_List1array.ElementAt(0).ElementAt(9)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4280. m_Print.DrawRect2(StrRect, 2);
  4281. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4282. m_Print.DrawText((LPTSTR)(LPCTSTR)"张设计排版精修入册", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4283. //////////////////////load2
  4284. rcpos = -1;
  4285. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4286. m_Print.DrawText((LPTSTR)(LPCTSTR)"原始数据套系内张数JPG格式光盘壹只", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4287. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4288. m_Print.DrawText((LPTSTR)(LPCTSTR)"其它:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4289. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4290. // m_Print.DrawText((LPTSTR)(LPCTSTR)"", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4291. // AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4292. m_Print.DrawRect2(StrRect, 2);
  4293. m_Print.SetFontFace(11, 1, "宋体");
  4294. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4295. m_Print.DrawText((LPTSTR)(LPCTSTR)"客人产品:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4296. int rowcount = sparray.GetSize() / 8;
  4297. int needaddrow = 0;
  4298. while (sparray.GetSize() > rowcount * 8 + needaddrow)
  4299. needaddrow++;
  4300. int pos = 0;
  4301. CString str = "";
  4302. int addcount = 0;
  4303. if (needaddrow > 0)
  4304. addcount = 1;
  4305. else
  4306. addcount = 0;
  4307. needaddrow--;
  4308. str.Empty();
  4309. for (i = 0; i < rowcount + addcount; i++)
  4310. {
  4311. str += sparray.ElementAt(pos).ElementAt(5);
  4312. str += " 数量:";
  4313. str += sparray.ElementAt(pos).ElementAt(3);
  4314. str += ";";
  4315. pos++;
  4316. }
  4317. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4318. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4319. m_Print.DrawRect2(StrRect, 2);
  4320. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4321. if (needaddrow > 0)
  4322. addcount = 1;
  4323. else
  4324. addcount = 0;
  4325. needaddrow--;
  4326. str.Empty();
  4327. for (i = 0; i < rowcount + addcount; i++)
  4328. {
  4329. str += sparray.ElementAt(pos).ElementAt(5);
  4330. str += " 数量:";
  4331. str += sparray.ElementAt(pos).ElementAt(3);
  4332. str += ";";
  4333. pos++;
  4334. }
  4335. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4336. m_Print.DrawRect2(StrRect, 2);
  4337. StrRect = load2.m_rcarray.ElementAt(++rcpos);//7
  4338. if (needaddrow > 0)
  4339. addcount = 1;
  4340. else
  4341. addcount = 0;
  4342. needaddrow--;
  4343. str.Empty();
  4344. for (i = 0; i < rowcount + addcount; i++)
  4345. {
  4346. str += sparray.ElementAt(pos).ElementAt(5);
  4347. str += " 数量:";
  4348. str += sparray.ElementAt(pos).ElementAt(3);
  4349. str += ";";
  4350. pos++;
  4351. }
  4352. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4353. m_Print.DrawRect2(StrRect, 2);
  4354. StrRect = load2.m_rcarray.ElementAt(++rcpos);//8
  4355. if (needaddrow > 0)
  4356. addcount = 1;
  4357. else
  4358. addcount = 0;
  4359. needaddrow--;
  4360. str.Empty();
  4361. for (i = 0; i < rowcount + addcount; i++)
  4362. {
  4363. str += sparray.ElementAt(pos).ElementAt(5);
  4364. str += " 数量:";
  4365. str += sparray.ElementAt(pos).ElementAt(3);
  4366. str += ";";
  4367. pos++;
  4368. }
  4369. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4370. m_Print.DrawRect2(StrRect, 2);
  4371. StrRect = load2.m_rcarray.ElementAt(++rcpos);//9
  4372. if (needaddrow > 0)
  4373. addcount = 1;
  4374. else
  4375. addcount = 0;
  4376. needaddrow--;
  4377. str.Empty();
  4378. for (i = 0; i < rowcount + addcount; i++)
  4379. {
  4380. str += sparray.ElementAt(pos).ElementAt(5);
  4381. str += " 数量:";
  4382. str += sparray.ElementAt(pos).ElementAt(3);
  4383. str += ";";
  4384. pos++;
  4385. }
  4386. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4387. m_Print.DrawRect2(StrRect, 2);
  4388. StrRect = load2.m_rcarray.ElementAt(++rcpos);//10
  4389. if (needaddrow > 0)
  4390. addcount = 1;
  4391. else
  4392. addcount = 0;
  4393. needaddrow--;
  4394. str.Empty();
  4395. for (i = 0; i < rowcount + addcount; i++)
  4396. {
  4397. str += sparray.ElementAt(pos).ElementAt(5);
  4398. str += " 数量:";
  4399. str += sparray.ElementAt(pos).ElementAt(3);
  4400. str += ";";
  4401. pos++;
  4402. }
  4403. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4404. m_Print.DrawRect2(StrRect, 2);
  4405. StrRect = load2.m_rcarray.ElementAt(++rcpos);//11
  4406. if (needaddrow > 0)
  4407. addcount = 1;
  4408. else
  4409. addcount = 0;
  4410. needaddrow--;
  4411. str.Empty();
  4412. for (i = 0; i < rowcount + addcount; i++)
  4413. {
  4414. str += sparray.ElementAt(pos).ElementAt(5);
  4415. str += " 数量:";
  4416. str += sparray.ElementAt(pos).ElementAt(3);
  4417. str += ";";
  4418. pos++;
  4419. }
  4420. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4421. m_Print.DrawRect2(StrRect, 2);
  4422. StrRect = load2.m_rcarray.ElementAt(++rcpos);//12
  4423. if (needaddrow > 0)
  4424. addcount = 1;
  4425. else
  4426. addcount = 0;
  4427. needaddrow--;
  4428. str.Empty();
  4429. for (i = 0; i < rowcount + addcount; i++)
  4430. {
  4431. str += sparray.ElementAt(pos).ElementAt(5);
  4432. str += " 数量:";
  4433. str += sparray.ElementAt(pos).ElementAt(3);
  4434. str += ";";
  4435. pos++;
  4436. }
  4437. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4438. m_Print.DrawRect2(StrRect, 2);
  4439. /* StrRect=load2.m_rcarray .ElementAt (++rcpos);//12
  4440. if(needaddrow>0)
  4441. addcount=1;
  4442. else
  4443. addcount=0;
  4444. needaddrow--;
  4445. str.Empty ();
  4446. for( i=0; i<rowcount+addcount; i++)
  4447. {
  4448. str+=sparray.ElementAt (pos).ElementAt (5);
  4449. str+=" 数量:";
  4450. str+=sparray.ElementAt (pos).ElementAt (3);
  4451. str+=";";
  4452. pos++;
  4453. }
  4454. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4455. m_Print.DrawRect2(StrRect, 2);
  4456. StrRect=load2.m_rcarray .ElementAt (++rcpos);//14
  4457. if(needaddrow>0)
  4458. addcount=1;
  4459. else
  4460. addcount=0;
  4461. needaddrow--;
  4462. str.Empty ();
  4463. for( i=0; i<rowcount+addcount; i++)
  4464. {
  4465. str+=sparray.ElementAt (pos).ElementAt (5);
  4466. str+=" 数量:";
  4467. str+=sparray.ElementAt (pos).ElementAt (3);
  4468. str+=";";
  4469. pos++;
  4470. }
  4471. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4472. m_Print.DrawRect2(StrRect, 2);*/
  4473. CRect sprc[2];
  4474. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4475. // AutoDraw(m_Print, StrRect, m_bz.Left (leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4476. m_Print.DrawRect2(StrRect, 2);
  4477. sprc[0] = StrRect;
  4478. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4479. // AutoDraw(m_Print, StrRect, m_bz.Right (leng-leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4480. m_Print.DrawRect2(StrRect, 2);
  4481. sprc[1] = StrRect;
  4482. //AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4483. {
  4484. CString temp, tempspno, tempbz;
  4485. CSize size;
  4486. BOOL bRun = 0;
  4487. int fontsize = 12;
  4488. ll: tempspno = m_bz;
  4489. m_Print.SetFontFace(fontsize, 1, "宋体");
  4490. for (i = 0; i<2; i++)
  4491. {
  4492. if (!tempspno.IsEmpty())
  4493. {
  4494. temp = tempspno;
  4495. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4496. int right = 0;
  4497. CRect temprc = sprc[i];
  4498. while (size.cx>temprc.Width())
  4499. {
  4500. right++;
  4501. temp = tempspno.Left(tempspno.GetLength() - (right));
  4502. if (GIsHalfHZ(temp))
  4503. {
  4504. right++;
  4505. temp.Delete(temp.GetLength() - 1);
  4506. }
  4507. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4508. }
  4509. if (bRun)
  4510. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4511. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  4512. if (tempspno.IsEmpty())i++;
  4513. }
  4514. }
  4515. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  4516. {
  4517. fontsize--;
  4518. goto ll;
  4519. }
  4520. if (bRun == 0)
  4521. {
  4522. bRun = 1;
  4523. goto ll;
  4524. }
  4525. }
  4526. m_Print.SetFontFace(11, 1, "宋体");
  4527. //////////////////////load3
  4528. rcpos = -1;
  4529. for (i = 0; i < 24; i++)
  4530. {
  4531. StrRect = load3.m_rcarray.ElementAt(i);
  4532. m_Print.DrawRect2(StrRect, 1);
  4533. }
  4534. CStringArray strarray;
  4535. strarray.Add("营业员");
  4536. strarray.Add("前台接待");
  4537. strarray.Add("化妆师");
  4538. strarray.Add("礼服师");
  4539. strarray.Add("摄影师");
  4540. strarray.Add("摄影助理");
  4541. strarray.Add("美工师");
  4542. strarray.Add("设计师");
  4543. for (i = 0; i < 8; i++)
  4544. {
  4545. StrRect = load3.m_rcarray.ElementAt(i);
  4546. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4547. }
  4548. strarray.RemoveAll();
  4549. strarray.Add(m_ren);
  4550. strarray.Add(g_List1array.ElementAt(0).ElementAt(49));
  4551. strarray.Add(m_waiter2);
  4552. strarray.Add(g_List1array.ElementAt(0).ElementAt(51));
  4553. strarray.Add(m_waiter1);
  4554. strarray.Add(g_List1array.ElementAt(0).ElementAt(50));
  4555. strarray.Add("");
  4556. strarray.Add(m_waiter4);
  4557. for (i = 8; i < 16; i++)
  4558. {
  4559. StrRect = load3.m_rcarray.ElementAt(i);
  4560. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 8), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4561. }
  4562. StrRect = load3.m_rcarray.ElementAt(27);
  4563. m_Print.DrawText((LPTSTR)(LPCTSTR)"客户电话: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4564. StrRect = load3.m_rcarray.ElementAt(28);
  4565. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4566. m_Print.SetFontFace(13, 1, "宋体");
  4567. StrRect = load3.m_rcarray.ElementAt(25);
  4568. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4569. StrRect = load3.m_rcarray.ElementAt(26);
  4570. m_Print.DrawRect2(StrRect, 2);
  4571. StrRect = load3.m_rcarray.ElementAt(24);
  4572. str = "\
  4573. 顾客须知\r\n\
  4574. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  4575. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  4576. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  4577. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  4578. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  4579. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  4580. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  4581. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  4582. AutoDraw(m_Print, StrRect, str, 1.8f);
  4583. PrintPreview dlg;
  4584. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4585. dlg.m_pDC = m_Print.GetPDC();
  4586. if (dlg.DoModal() != IDOK)return;
  4587. //结束打印
  4588. m_Print.EndPage();
  4589. m_Print.EndPrint();
  4590. }
  4591. void CMainFrame::PrintDailyForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4592. {
  4593. // TODO: Add your control notification handler code here
  4594. int pages = Listarray->GetSize() / 46;
  4595. if (Listarray->GetSize() % 46)pages++;
  4596. for (int aa = 0; aa < pages; aa++)
  4597. {
  4598. PrintPreview dlg;
  4599. CPrintRX m_Print;
  4600. m_Print.InitToPrint(NULL, 1);
  4601. m_Print.StartPrint();
  4602. m_Print.StartPage();
  4603. CRect mainrc(0, 0, 560, 793);
  4604. float fscale;
  4605. {
  4606. int w, h;
  4607. m_Print.GetWidHei(w, h);
  4608. fscale = (float)w / (float)h;
  4609. }
  4610. mainrc.DeflateRect(25, 40, 10, 0);
  4611. CRect rc, rc2;
  4612. rc = mainrc;
  4613. rc.bottom = rc.top;
  4614. rc.top -= 20;
  4615. m_Print.SetFontFace(16, 1, "黑体");
  4616. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4617. m_Print.SetFontFace(9, 1, "宋体");
  4618. CString str;
  4619. int wid[4] = { 320, 60, 60, 90 };
  4620. int hei = 16;
  4621. if (fscale > 0.71)hei = 15;
  4622. rc = mainrc;
  4623. rc.bottom = rc.top + hei;
  4624. for (int i = 0; i < 47; i++)
  4625. {
  4626. rc2.top = rc.top + i*hei;
  4627. rc2.bottom = rc.bottom + i*hei;
  4628. rc2.left = rc.left;
  4629. rc2.right = rc.left + wid[0];
  4630. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  4631. for (int j = 0; j<4; j++)
  4632. {
  4633. m_Print.DrawRect2(rc2, 1);
  4634. if (Listarray->GetSize()>aa * 46 + i)
  4635. {
  4636. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  4637. rc2.left += 3;
  4638. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4639. rc2.left -= 3;
  4640. }
  4641. rc2.left += wid[j];
  4642. rc2.right = rc2.left + wid[j + 1];
  4643. }
  4644. }
  4645. rc2.top += 2;
  4646. rc2.left += 2; rc2.right = mainrc.right + 4;
  4647. m_Print.SetFontFace(8, 1, "宋体");
  4648. int infopos = info.Find("***");
  4649. if (infopos != -1)
  4650. {
  4651. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Left(infopos), rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4652. CRect rc3 = rc2;
  4653. rc3.top = rc2.bottom - 4;
  4654. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Right(info.GetLength() - infopos - 3), rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4655. }
  4656. else
  4657. m_Print.DrawText((LPTSTR)(LPCTSTR)info, rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4658. str.Format(" 页:%d/%d", aa + 1, pages);
  4659. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4660. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  4661. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4662. dlg.m_pDC = m_Print.GetPDC();
  4663. // dlg.m_mode=1;
  4664. if (aa == 0)
  4665. {
  4666. if (dlg.DoModal() != IDOK)
  4667. return;
  4668. }
  4669. //结束打印
  4670. m_Print.EndPage();
  4671. m_Print.EndPrint();
  4672. }
  4673. }
  4674. void CMainFrame::PrintLoginForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4675. {
  4676. // TODO: Add your control notification handler code here
  4677. int sinlecount = 33 * 6;
  4678. int pages = Listarray->GetSize() / sinlecount;
  4679. if (Listarray->GetSize() % sinlecount)pages++;
  4680. for (int aa = 0; aa < pages; aa++)
  4681. {
  4682. PrintPreview dlg;
  4683. CPrintRX m_Print;
  4684. m_Print.InitToPrint(NULL, 1);
  4685. m_Print.StartPrint();
  4686. m_Print.StartPage();
  4687. CRect mainrc(0, 0, 560, 793);
  4688. float fscale;
  4689. {
  4690. int w, h;
  4691. m_Print.GetWidHei(w, h);
  4692. fscale = (float)w / (float)h;
  4693. }
  4694. mainrc.DeflateRect(25, 40, 10, 0);
  4695. CString str;
  4696. CRect rc, rc2;
  4697. rc = mainrc;
  4698. rc.bottom = rc.top;
  4699. rc.top -= 20;
  4700. rc.left -= 20;
  4701. m_Print.SetFontFace(12, 1, "黑体");
  4702. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4703. m_Print.SetFontFace(6, 1, "宋体");
  4704. str.Format(" 页:%d/%d", aa + 1, pages);
  4705. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4706. rc.right = mainrc.right + 20;
  4707. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4708. int wid[2] = { 50, 110 };
  4709. int hei = 11;
  4710. rc = mainrc;
  4711. rc.bottom = rc.top + hei;
  4712. rc.top += 10;
  4713. rc.bottom += 10;
  4714. int dtx = rc.Width() / 3 + 18;
  4715. int dty = 380;
  4716. for (int j = 0; j < 6; j++)
  4717. {
  4718. if (Listarray->GetSize() < aa*sinlecount + 33 * (j + 1))continue;
  4719. for (int i = 0; i < 33; i++)
  4720. {
  4721. rc2.top = rc.top + i*hei;
  4722. rc2.bottom = rc.bottom + i*hei;
  4723. rc2.left = rc.left;
  4724. rc2.right = rc.left + wid[0];
  4725. if (i == 0)
  4726. {
  4727. // rc2.left +=wid[1];
  4728. rc2.right += wid[1];
  4729. }
  4730. if (j == 1 || j == 4)
  4731. {
  4732. rc2.left += dtx;
  4733. rc2.right += dtx;
  4734. }
  4735. if (j == 2 || j == 5)
  4736. {
  4737. rc2.left += dtx * 2;
  4738. rc2.right += dtx * 2;
  4739. }
  4740. if (j == 3 || j == 4 || j == 5)
  4741. {
  4742. rc2.top += dty;
  4743. rc2.bottom += dty;
  4744. }
  4745. m_Print.DrawRect2(rc2, 1);
  4746. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4747. {
  4748. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(0);
  4749. rc2.left += 3;
  4750. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4751. rc2.left -= 3;
  4752. }
  4753. if (i == 0)continue;
  4754. rc2.left = rc2.right;
  4755. rc2.right += wid[1];
  4756. m_Print.DrawRect2(rc2, 1);
  4757. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4758. {
  4759. if (Listarray->ElementAt(aa*sinlecount + 33 * j + i).GetSize() > 1)
  4760. {
  4761. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(1);
  4762. rc2.left += 3;
  4763. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4764. rc2.left -= 3;
  4765. }
  4766. }
  4767. /* if(Listarray->GetSize ()>aa*46+i)
  4768. {
  4769. str=Listarray->ElementAt (aa*46+i).ElementAt (j);
  4770. rc2.left +=3;
  4771. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4772. rc2.left -=3;
  4773. }
  4774. rc2.left +=wid[j];
  4775. rc2.right =rc2.left+wid[j+1];*/
  4776. }
  4777. }
  4778. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4779. dlg.m_pDC = m_Print.GetPDC();
  4780. if (aa == 0)
  4781. {
  4782. if (dlg.DoModal() != IDOK)
  4783. return;
  4784. }
  4785. //结束打印
  4786. m_Print.EndPage();
  4787. m_Print.EndPrint();
  4788. }
  4789. }
  4790. void CMainFrame::PrintTakeForm(CArray<CStringArray, CStringArray>*Listarray)
  4791. {
  4792. CString title;
  4793. CString info;
  4794. // TODO: Add your control notification handler code here
  4795. int sinlecount = 4;
  4796. int pages = Listarray->GetSize() / sinlecount;
  4797. if (Listarray->GetSize() % sinlecount)pages++;
  4798. for (int aa = 0; aa < pages; aa++)
  4799. {
  4800. PrintPreview dlg;
  4801. CPrintRX m_Print;
  4802. m_Print.InitToPrint(NULL, 1);
  4803. m_Print.StartPrint();
  4804. m_Print.StartPage();
  4805. CRect mainrc(0, 0, 560, 793);
  4806. float fscale;
  4807. {
  4808. int w, h;
  4809. m_Print.GetWidHei(w, h);
  4810. fscale = (float)w / (float)h;
  4811. }
  4812. mainrc.DeflateRect(25, 40, 10, 0);
  4813. CString str;
  4814. CRect rc, rc2;
  4815. rc = mainrc;
  4816. rc.bottom = rc.top;
  4817. rc.top -= 20;
  4818. rc.left -= 20;
  4819. m_Print.SetFontFace(6, 1, "宋体");
  4820. str.Format(" 页:%d/%d", aa + 1, pages);
  4821. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4822. rc.right = mainrc.right + 10;
  4823. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4824. m_Print.SetFontFace(12, 1, "宋体");
  4825. int wid[2] = { 70, 190 };
  4826. int hei = 22;
  4827. rc = mainrc;
  4828. rc.bottom = rc.top + hei;
  4829. rc.top += 10;
  4830. rc.bottom += 10;
  4831. int dtx = rc.Width() / 2 + 18;
  4832. int dty = 380;
  4833. int arraysize = Listarray->ElementAt(0).GetSize();
  4834. for (int j = 0; j < 4; j++)
  4835. {
  4836. if (Listarray->GetSize() <= aa*sinlecount + j)continue;
  4837. for (int i = 0; i < arraysize; i++)
  4838. {
  4839. rc2.top = rc.top + i / 2 * hei;
  4840. rc2.bottom = rc.bottom + i / 2 * hei;
  4841. rc2.left = rc.left;
  4842. rc2.right = rc.left + wid[0];
  4843. if (i % 2)
  4844. {
  4845. rc2.left = rc2.right;
  4846. rc2.right += wid[1];
  4847. }
  4848. if (j == 1 || j == 3)
  4849. {
  4850. rc2.left += dtx;
  4851. rc2.right += dtx;
  4852. }
  4853. if (j == 2 || j == 3)
  4854. {
  4855. rc2.top += dty;
  4856. rc2.bottom += dty;
  4857. }
  4858. if (i == arraysize - 1 || i == arraysize - 2)
  4859. {
  4860. rc2.bottom += hei * 2;
  4861. }
  4862. m_Print.DrawRect2(rc2, 1);
  4863. {
  4864. str = Listarray->ElementAt(aa*sinlecount + j).ElementAt(i);
  4865. if (i == arraysize - 1)
  4866. {
  4867. CRect rc3 = rc2;
  4868. rc3.left += 3;
  4869. rc3.top += 3;
  4870. AutoDraw(m_Print, rc3, str, 1.4f);
  4871. }
  4872. else if (i == arraysize - 2)
  4873. {
  4874. CRect rc3 = rc2;
  4875. rc3.left += 3;
  4876. rc3.top += 3;
  4877. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4878. }
  4879. else
  4880. {
  4881. rc2.left += 3;
  4882. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4883. rc2.left -= 3;
  4884. }
  4885. }
  4886. }
  4887. }
  4888. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4889. dlg.m_pDC = m_Print.GetPDC();
  4890. if (aa == 0)
  4891. {
  4892. if (dlg.DoModal() != IDOK)
  4893. return;
  4894. }
  4895. //结束打印
  4896. m_Print.EndPage();
  4897. m_Print.EndPrint();
  4898. }
  4899. }
  4900. void CMainFrame::PrintThumbNail(CStringArray *array, CString client, BOOL bDir, CString m_size)
  4901. {
  4902. // TODO: Add your control notification handler code here
  4903. CStringArray titlearray;
  4904. CStringArray namearray;
  4905. CStringArray noarray;
  4906. CArray<CRect, CRect>rcarray;
  4907. CArray<CRect, CRect>widtharray;
  4908. if (m_size != "")
  4909. {
  4910. int pos = m_size.Find(";");
  4911. while (pos != -1)
  4912. {
  4913. CString size = m_size.Left(pos);
  4914. int pos2 = size.Find(":");
  4915. if (pos2 != -1)
  4916. {
  4917. CString str;
  4918. CRect rc;
  4919. str = size.Left(pos2);
  4920. noarray.Add(str);
  4921. str = size.Right(size.GetLength() - pos2 - 1);
  4922. pos2 = str.Find(",");
  4923. namearray.Add(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4924. pos2 = str.Find(",");
  4925. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4926. pos2 = str.Find(",");
  4927. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4928. widtharray.Add(rc);
  4929. pos2 = str.Find(",");
  4930. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4931. pos2 = str.Find(",");
  4932. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4933. pos2 = str.Find(",");
  4934. rc.right = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4935. rc.bottom = atoi(str);
  4936. rcarray.Add(rc);
  4937. }
  4938. m_size = m_size.Right(m_size.GetLength() - pos - 1);
  4939. pos = m_size.Find(";");
  4940. }
  4941. }
  4942. PrintPreview dlg;
  4943. CPrintRX m_Print;
  4944. m_Print.InitToPrint(NULL, 1);
  4945. m_Print.StartPrint();
  4946. m_Print.StartPage();
  4947. CRect mainrc(0, 0, 560, 793);
  4948. mainrc.DeflateRect(25, 50, 10, 0);
  4949. m_Print.SetFontFace(10, 1, "宋体");
  4950. CRect rc, rc2;
  4951. rc = mainrc;
  4952. rc.bottom = rc.top;
  4953. rc.top -= 20;
  4954. m_Print.DrawText((LPTSTR)(LPCTSTR)client, rc, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4955. rc.bottom -= 5;
  4956. m_Print.DrawRect2(rc, 2);
  4957. if (array->GetSize() > 130)m_Print.SetFontFace(8, 1, "宋体");
  4958. if (bDir)m_Print.SetFontFace(6, 1, "宋体");
  4959. ////////////////////////////////////////////////////////////////
  4960. int imgcount = array->GetSize();
  4961. int dtx = 5;
  4962. int dty = 15;
  4963. int cx, cy;
  4964. int countx = 5;
  4965. int county = 1;
  4966. while (1)
  4967. {
  4968. if (countx*county >= imgcount)
  4969. {
  4970. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  4971. cy = cx * 4 / 3;
  4972. break;
  4973. }
  4974. else
  4975. {
  4976. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  4977. cy = cx * 4 / 3;
  4978. if (cy*(county + 1) + dty*county < mainrc.Height())//Y方向可以增加一个
  4979. {
  4980. county++;
  4981. }
  4982. else//Y方向不能加,X方向加
  4983. {
  4984. countx++;
  4985. county = 1;
  4986. }
  4987. }
  4988. }
  4989. int imgpos = 0;
  4990. CString stemp;
  4991. CPen pen(PS_SOLID, 1, RGB(255, 0, 0));
  4992. CPen *oldpen = m_Print.m_DC.SelectObject(&pen);
  4993. CPen *oldpen2 = m_Print.m_memdc.SelectObject(&pen);
  4994. for (int i = 0; i < county; i++)
  4995. {
  4996. for (int j = 0; j < countx; j++)
  4997. {
  4998. rc = mainrc;
  4999. rc.top += i*(cy + dty);
  5000. rc.left += j*(cx + dtx);
  5001. rc.right = rc.left + cx;
  5002. rc.bottom = rc.top + cy;
  5003. Image *pImg = NULL;
  5004. if (imgpos >= array->GetSize())break;
  5005. CString str = array->ElementAt(imgpos);
  5006. CString spath = str.Left(str.ReverseFind('\\') + 1);
  5007. spath += "m";
  5008. spath += str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5009. if (PathFileExists(spath))
  5010. ::LoadImageFromBuf(&pImg, spath);
  5011. else
  5012. {
  5013. ::LoadImageFromBuf(&pImg, str);
  5014. if (pImg == NULL)continue;
  5015. int orientation = GetOrientation(pImg);
  5016. if (orientation == 8)
  5017. pImg->RotateFlip(Rotate270FlipNone);
  5018. else if (orientation == 6)
  5019. pImg->RotateFlip(Rotate90FlipNone);
  5020. }
  5021. if (pImg == NULL)continue;
  5022. rc2 = rc;
  5023. RectFitDes(pImg->GetWidth(), pImg->GetHeight(), rc);
  5024. imgpos++;
  5025. m_Print.DrawImage(pImg, rc);
  5026. int imgwidth = pImg->GetWidth();
  5027. delete pImg;
  5028. rc2.top = rc2.bottom + 3;
  5029. rc2.bottom += 10;
  5030. if (bDir == 0)
  5031. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5032. else
  5033. {
  5034. stemp = str.Left(str.ReverseFind('\\'));
  5035. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5036. if (stemp.ReverseFind('\\') != -1)
  5037. {
  5038. stemp = stemp.Right(stemp.GetLength() - stemp.ReverseFind('\\') - 1);
  5039. str = stemp + "\\" + str;
  5040. }
  5041. }
  5042. if (str.Find(".") != -1)
  5043. str = str.Left(str.Find("."));
  5044. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5045. if (noarray.GetSize())
  5046. {
  5047. rc2 = rc;
  5048. for (int aa = 0; aa < noarray.GetSize(); aa++)
  5049. {
  5050. float scale = (float)rc2.Width() / (float)imgwidth;
  5051. if (noarray.ElementAt(aa) == str)
  5052. {
  5053. int nIndex = aa;
  5054. CRect rc = rcarray.ElementAt(nIndex);
  5055. int wid = widtharray.ElementAt(nIndex).left;
  5056. int hei = widtharray.ElementAt(nIndex).top;
  5057. scale *= (float)imgwidth / (float)wid;
  5058. rc.left *= scale;
  5059. rc.right *= scale;
  5060. rc.top *= scale;
  5061. rc.bottom *= scale;
  5062. rc.left += rc2.left;
  5063. rc.right += rc2.left;
  5064. rc.top += rc2.top;
  5065. rc.bottom += rc2.top;
  5066. if (rc.left < rc2.left)rc.left = rc2.left;
  5067. if (rc.right > rc2.right)rc.right = rc2.right;
  5068. if (rc.top < rc2.top)rc.top = rc2.top;
  5069. if (rc.bottom > rc2.bottom)rc.bottom = rc2.bottom;
  5070. m_Print.DrawRect2(rc, 1);
  5071. }
  5072. }
  5073. }
  5074. }
  5075. }
  5076. m_Print.m_DC.SelectObject(oldpen);
  5077. m_Print.m_memdc.SelectObject(oldpen2);
  5078. /* CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  5079. StrRect.top -=15;StrRect.bottom -=15;
  5080. Image *pImg=NULL;
  5081. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  5082. m_Print.DrawImage(pImg, StrRect);
  5083. delete pImg;
  5084. m_Print.SetFontFace(10, 1, "宋体");
  5085. StrRect=load.m_rcarray .ElementAt (20);
  5086. StrRect.right=load.m_rcarray .ElementAt (23).right;
  5087. StrRect.top -=18;StrRect.bottom -=18;
  5088. CString str="地址:"+g_cominfoarray.ElementAt (0).ElementAt (12);
  5089. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5090. */
  5091. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  5092. dlg.m_pDC = m_Print.GetPDC();
  5093. if (dlg.DoModal() != IDOK)
  5094. return;
  5095. //结束打印
  5096. m_Print.EndPage();
  5097. m_Print.EndPrint();
  5098. }
  5099. // remark by Jeff
  5100. // 函数:PrintDinDan
  5101. // 参数:
  5102. // strOrderNumber:订单单号;(Order number)
  5103. // 返回:void
  5104. // 注意:#
  5105. void CMainFrame::PrintDinDan(CString strOrderNumber)//打印订单报表;
  5106. {
  5107. int printcot = 1;
  5108. for (int aa = 0; aa < printcot; aa++)
  5109. {
  5110. PrintPreview dlg;
  5111. CPrintRX m_Print;
  5112. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  5113. {
  5114. m_Print.InitToPrint(NULL, 1);
  5115. }
  5116. else
  5117. {
  5118. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  5119. if (name.IsEmpty())
  5120. m_Print.InitToPrint(NULL, 1);
  5121. else
  5122. {
  5123. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  5124. if (nret == -1 && aa == 0)
  5125. {
  5126. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  5127. }
  5128. }
  5129. }
  5130. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 0)
  5131. {
  5132. #ifdef ZHIAI_VERSION
  5133. PrintDinDan3(strOrderNumber);
  5134. return;
  5135. #endif
  5136. #ifdef SZBLCT_VERSION
  5137. PrintDinDan4(strOrderNumber);
  5138. return;
  5139. #endif
  5140. m_Print.StartPrint();
  5141. m_Print.StartPage();
  5142. LoadRect load;
  5143. load.SetLiaPath("6.lia");
  5144. load.SetMargins(-14, 15);
  5145. if (!load.Load())return;
  5146. LoadRect load2;
  5147. load2.SetLiaPath("7.lia");
  5148. load2.SetMargins(-14, 216 + 15);
  5149. if (!load2.Load())return;
  5150. LoadRect load3;
  5151. load3.SetLiaPath("8.lia");
  5152. load3.SetMargins(-14, 705 + 15);
  5153. if (!load3.Load())return;
  5154. int i;
  5155. //////////////////////////////////////////////////////////////
  5156. CStringArray txarray;
  5157. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  5158. g_sendhead.code[0] = 11;
  5159. g_sendhead.code[1] = 52;
  5160. g_sendhead.code[2] = 50;
  5161. g_sendhead.code[3] = 150;
  5162. g_sendhead.code[4] = 77;
  5163. g_sendhead.code[5] = 4;
  5164. g_sendhead.tabcount = 6;
  5165. g_sendhead.bsql = 0;
  5166. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5167. CArray<CStringArray, CStringArray>sparray;
  5168. CArray<CStringArray, CStringArray>clientarray;
  5169. CArray<CStringArray, CStringArray>phonearray;
  5170. CArray<CStringArray, CStringArray>fgarray;
  5171. CArray<CStringArray, CStringArray>danweiarray;
  5172. CArray<CStringArray, CStringArray>jdarray;
  5173. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5174. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5175. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5176. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5177. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5178. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5179. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5180. CString m_taoxiname;
  5181. if (m_zs.Find("\\") != -1)
  5182. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  5183. else
  5184. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  5185. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5186. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5187. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5188. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5189. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5190. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5191. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5192. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5193. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5194. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5195. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5196. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5197. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5198. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5199. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5200. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5201. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5202. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5203. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5204. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5205. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5206. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5207. if (jdarray.GetSize())
  5208. {
  5209. if (m_bz.IsEmpty() == 0)
  5210. m_bz = "\r\n" + m_bz;
  5211. m_bz += "景点:";
  5212. }
  5213. #ifdef DDF_VERSION
  5214. m_bz += "219店:219路馨园小区对面\r\n";
  5215. m_bz += "金色店:万科金色家园小区东门南走20米荣光社区一楼\r\n";
  5216. m_bz += "万泰店:万泰锦绣华城小区正门\r\n";
  5217. #else
  5218. for (i = 0; i < jdarray.GetSize(); i++)
  5219. {
  5220. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5221. }
  5222. m_bz.TrimRight(";");
  5223. #endif
  5224. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5225. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5226. if (IsHasRights2new(31) == 0)
  5227. {
  5228. m_phone1 = "***";
  5229. m_phone2 = "***";
  5230. }
  5231. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5232. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5233. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  5234. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  5235. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  5236. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  5237. filter = "name='" + m_ren + "'";
  5238. g_sendhead.code[0] = 5;
  5239. g_sendhead.tabcount = 1;
  5240. g_sendhead.bsql = 0;
  5241. int g_nYearposTemp = g_nYearpos;
  5242. g_nYearpos = -1;
  5243. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5244. g_nYearpos = g_nYearposTemp;
  5245. if (g_bSendOK == 0)return;
  5246. DataToArray(&phonearray);
  5247. m_money1.Format("%f", atof(m_taoxijiage));
  5248. m_money2.Format("%f", atof(m_payed1));
  5249. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5250. ConvertToPrice(m_money1);
  5251. ConvertToPrice(m_money2);
  5252. ConvertToPrice(m_money3);
  5253. ////////////////////////////////////////////////////////////////
  5254. int rcpos = -1;
  5255. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  5256. StrRect.top -= 15; StrRect.bottom -= 15;
  5257. Image *pImg = NULL;
  5258. #ifdef MNLS_VERSION
  5259. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  5260. #else
  5261. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  5262. #endif
  5263. m_Print.DrawImage(pImg, StrRect);
  5264. delete pImg;
  5265. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5266. {
  5267. Image *pImg = NULL;
  5268. g_nSendCode = 31;
  5269. int g_nYearposTemp = g_nYearpos;
  5270. g_nYearpos = -1;
  5271. g_pMainWnd->ProcessChatMessageRequest2(1);
  5272. g_nYearpos = g_nYearposTemp;
  5273. g_nSendCode = 0;
  5274. if (g_bSendOK == 0)return;
  5275. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5276. if (pImg)
  5277. {
  5278. StrRect.left = 30;
  5279. StrRect.top = 12;
  5280. StrRect.right = StrRect.left + 60;
  5281. StrRect.bottom = StrRect.top + 60;
  5282. m_Print.DrawImage(pImg, StrRect);
  5283. delete pImg; pImg = NULL;
  5284. }
  5285. }
  5286. m_Print.SetFontFace(11, 1, "宋体");
  5287. StrRect = load.m_rcarray.ElementAt(20);
  5288. StrRect.right = load.m_rcarray.ElementAt(23).right;
  5289. StrRect.top -= 18; StrRect.bottom -= 18;
  5290. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  5291. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5292. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  5293. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5294. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5295. StrRect.top -= 15; StrRect.bottom -= 15;
  5296. #ifdef MNLS_VERSION
  5297. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5298. #endif
  5299. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5300. StrRect.top -= 15; StrRect.bottom -= 15;
  5301. #ifdef MNLS_VERSION
  5302. m_Print.DrawRect(StrRect);
  5303. #endif
  5304. m_Print.SetFontFace(7, 1, "黑体");
  5305. m_Print.SetColor(0xffffff);
  5306. #ifdef MNLS_VERSION
  5307. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5308. #endif
  5309. m_Print.SetColor(0);
  5310. m_Print.SetFontFace(15, 1, "宋体");
  5311. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5312. StrRect.top -= 15; StrRect.bottom -= 15;
  5313. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同预约订单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5314. CStringArray strarray;
  5315. strarray.Add("NO: " + strOrderNumber);
  5316. CString date;
  5317. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  5318. strarray.Add(date);
  5319. strarray.Add("喜爱");
  5320. strarray.Add("格调");
  5321. if (fgarray.GetSize() == 12)
  5322. {
  5323. for (int i = 0; i < 12; i++)
  5324. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  5325. }
  5326. else
  5327. {
  5328. strarray.Add("复古典雅");
  5329. strarray.Add("温文尔雅");
  5330. strarray.Add("豪华艳丽");
  5331. strarray.Add("传统大方");
  5332. strarray.Add("新潮个性");
  5333. strarray.Add("浪漫奔放");
  5334. strarray.Add("简单素雅");
  5335. strarray.Add("活泼俏丽");
  5336. strarray.Add("妩媚温馨");
  5337. strarray.Add("温柔贤惠");
  5338. strarray.Add("成熟感性");
  5339. strarray.Add("清纯可爱");
  5340. }
  5341. strarray.Add("姓名");
  5342. // strarray.Add("职业");
  5343. strarray.Add("");
  5344. strarray.Add("地址");
  5345. strarray.Add("电话");
  5346. #ifdef CHILD_VERSION
  5347. strarray.Add("家长");
  5348. strarray.Add("宝宝");
  5349. #else
  5350. strarray.Add("先生");
  5351. strarray.Add("女士");
  5352. #endif
  5353. m_Print.SetFontFace(11, 1, "宋体");
  5354. for (i = 0; i < strarray.GetSize(); i++)
  5355. {
  5356. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5357. if (i < 2)
  5358. {
  5359. StrRect.top -= 15; StrRect.bottom -= 15;
  5360. }
  5361. if (i>15)
  5362. m_Print.DrawRect2(StrRect, 1);
  5363. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5364. }
  5365. for (i = 29; i <= 40; i++)
  5366. {
  5367. if (m_style.GetLength() <= (i - 29))continue;
  5368. if (m_style.GetAt(i - 29) != '1')continue;
  5369. StrRect = load.m_rcarray.ElementAt(i - 1);
  5370. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5371. }
  5372. for (i = 27; i <= 48; i++)
  5373. {
  5374. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5375. m_Print.DrawRect2(StrRect, 1);
  5376. }
  5377. #ifdef CHILD_VERSION
  5378. StrRect = load.m_rcarray.ElementAt(45);
  5379. StrRect.right = StrRect.left + 62;
  5380. m_Print.DrawRect2(StrRect, 1);
  5381. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5382. StrRect.left = StrRect.right;
  5383. StrRect.right = StrRect.left + 62;
  5384. m_Print.DrawRect2(StrRect, 1);
  5385. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5386. StrRect.left = StrRect.right;
  5387. StrRect.right = StrRect.left + 62;
  5388. m_Print.DrawRect2(StrRect, 1);
  5389. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5390. StrRect.left = StrRect.right;
  5391. StrRect.right = StrRect.left + 62;
  5392. m_Print.DrawRect2(StrRect, 1);
  5393. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5394. #endif
  5395. /////////////////////////
  5396. strarray.RemoveAll();
  5397. CString temp;
  5398. temp.Format("拍摄多款选 %d 款,其中影", atoi(m_outside) + atoi(m_outside2));
  5399. strarray.Add(temp);
  5400. temp.Format("棚景 %d 款,景点 %d 款.", atoi(m_outside2), atoi(m_outside));
  5401. strarray.Add(temp);
  5402. strarray.Add("化妆");
  5403. strarray.Add("造型");
  5404. #ifdef CHILD_VERSION
  5405. strarray.Add("");
  5406. #else
  5407. strarray.Add("婚纱");
  5408. #endif
  5409. strarray.Add("服饰");
  5410. strarray.Add("配");
  5411. strarray.Add("置");
  5412. strarray.Add("其");
  5413. strarray.Add("它");
  5414. strarray.Add("套系名称");
  5415. strarray.Add("镜款");
  5416. strarray.Add("套系总价");
  5417. strarray.Add("主摄影师");
  5418. strarray.Add("拍摄日期");
  5419. strarray.Add("定金");
  5420. #ifdef CHILD_VERSION
  5421. strarray.Add("主引导师");
  5422. #else
  5423. strarray.Add("主化妆师");
  5424. #endif
  5425. strarray.Add("看样日期");
  5426. strarray.Add("欠款余额");
  5427. strarray.Add("总监");
  5428. strarray.Add("取件日期");
  5429. rcpos = -1;
  5430. for (i = 0; i < strarray.GetSize(); i++)
  5431. {
  5432. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5433. if (i>9)
  5434. m_Print.DrawRect2(StrRect, 1);
  5435. #ifdef CHILD_VERSION
  5436. if (i == 5)
  5437. StrRect.top -= StrRect.Height();
  5438. #endif
  5439. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5440. }
  5441. for (i = 22; i <= 41; i++)
  5442. {
  5443. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5444. m_Print.DrawRect2(StrRect, 1);
  5445. }
  5446. /////////////////////////////
  5447. strarray.RemoveAll();
  5448. #ifdef CHILD_VERSION
  5449. strarray.Add("顾客方 家长:");
  5450. strarray.Add("宝宝:");
  5451. #else
  5452. strarray.Add("顾客方 先生:");
  5453. strarray.Add("女士:");
  5454. #endif
  5455. strarray.Add("电话:");
  5456. strarray.Add("影楼方 店长:");
  5457. strarray.Add("接单人:");
  5458. strarray.Add("电话:");
  5459. rcpos = -1;
  5460. for (i = 0; i < strarray.GetSize(); i++)
  5461. {
  5462. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5463. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5464. }
  5465. for (i = 7; i <= 12; i++)
  5466. {
  5467. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5468. // if(i!=10)
  5469. m_Print.DrawRect2(StrRect, 2);
  5470. }
  5471. //////////////////////////////////////
  5472. //开始打数据
  5473. strarray.RemoveAll();
  5474. strarray.Add(m_name1);
  5475. strarray.Add(m_name2);
  5476. /// strarray.Add (m_occupation1);
  5477. // strarray.Add (m_occupation2);
  5478. strarray.Add("");
  5479. strarray.Add("");
  5480. strarray.Add(m_addr1);
  5481. #ifdef CHILD_VERSION
  5482. strarray.Add("");
  5483. #else
  5484. strarray.Add(m_addr2);
  5485. #endif
  5486. strarray.Add(m_phone1);
  5487. strarray.Add(m_phone2);
  5488. for (i = 41; i <= 48; i++)
  5489. {
  5490. StrRect = load.m_rcarray.ElementAt(i - 1);
  5491. StrRect.left += 4;
  5492. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5493. }
  5494. ///////////////////////////////
  5495. strarray.RemoveAll();
  5496. strarray.Add(m_money1);
  5497. strarray.Add(m_waiter1);
  5498. strarray.Add(m_time2);
  5499. strarray.Add(m_money2);
  5500. strarray.Add(m_waiter2);
  5501. strarray.Add(m_time4);
  5502. strarray.Add(m_money3);
  5503. strarray.Add("");
  5504. strarray.Add(m_time5);
  5505. for (i = 32; i <= 40; i++)
  5506. {
  5507. StrRect = load2.m_rcarray.ElementAt(i - 1);
  5508. StrRect.left += 4;
  5509. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5510. }
  5511. ///////////////////////////////
  5512. strarray.RemoveAll();
  5513. strarray.Add(m_name1);
  5514. strarray.Add(m_name2);
  5515. CString phone;
  5516. if (m_phone1.IsEmpty() == 0)
  5517. phone = m_phone1 + ",";
  5518. phone += m_phone2;
  5519. phone.TrimRight(",");
  5520. strarray.Add(phone);
  5521. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  5522. strarray.Add(m_ren);
  5523. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  5524. for (i = 7; i <= 12; i++)
  5525. {
  5526. StrRect = load3.m_rcarray.ElementAt(i - 1);
  5527. StrRect.left += 4;
  5528. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5529. }
  5530. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  5531. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5532. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  5533. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5534. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  5535. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5536. //////////////////////////////
  5537. //开始画文字
  5538. StrRect = load2.m_rcarray.ElementAt(30);
  5539. StrRect.left += 3;
  5540. StrRect.top += 3;
  5541. StrRect.right -= 2;
  5542. StrRect.bottom -= 2;
  5543. AutoDraw(m_Print, StrRect, m_bz, 1.4f);
  5544. StrRect = load2.m_rcarray.ElementAt(29);
  5545. StrRect.left += 3;
  5546. StrRect.top += 3;
  5547. StrRect.right -= 2;
  5548. StrRect.bottom -= 2;
  5549. str = "";
  5550. for (i = 0; i < sparray.GetSize(); i++)
  5551. {
  5552. str += sparray.ElementAt(i).ElementAt(5);
  5553. str += " 数量:";
  5554. str += sparray.ElementAt(i).ElementAt(3);
  5555. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5556. str += "\r\n";
  5557. }
  5558. str.TrimRight("\r\n");
  5559. AutoDraw(m_Print, StrRect, str, 1.4);
  5560. StrRect = load2.m_rcarray.ElementAt(40);
  5561. StrRect.top += 8;
  5562. m_Print.SetFontFace(12, 1, "黑体");
  5563. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5564. StrRect.left += 3;
  5565. StrRect.top += 30;
  5566. StrRect.right -= 2;
  5567. StrRect.bottom -= 2;
  5568. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5569. if (str.IsEmpty())
  5570. {
  5571. str = "\
  5572. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5573. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5574. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5575. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5576. 持良好的心境.\r\n\
  5577. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5578. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5579. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5580. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5581. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5582. 勿进影室, 以免影响拍摄.\r\n\
  5583. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5584. 师或店长沟通.\r\n\
  5585. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5586. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5587. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5588. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5589. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5590. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5591. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5592. 还.";
  5593. }
  5594. AutoDraw(m_Print, StrRect, str, 1.8);
  5595. }
  5596. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 1)
  5597. {//AfxMessageBox("yyy");
  5598. m_Print.StartPrint();
  5599. m_Print.StartPage();
  5600. LoadRect load;
  5601. load.SetLiaPath("6-2.lia");
  5602. load.SetMargins(0, 0);
  5603. if (!load.Load())return;
  5604. int i;
  5605. //////////////////////////////////////////////////////////////
  5606. CStringArray txarray;
  5607. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  5608. g_sendhead.code[0] = 11;
  5609. g_sendhead.code[1] = 52;
  5610. g_sendhead.code[2] = 50;
  5611. g_sendhead.code[3] = 150;
  5612. g_sendhead.code[4] = 77;
  5613. g_sendhead.code[5] = 4;
  5614. g_sendhead.tabcount = 6;
  5615. g_sendhead.bsql = 0;
  5616. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5617. CArray<CStringArray, CStringArray>sparray;
  5618. CArray<CStringArray, CStringArray>clientarray;
  5619. CArray<CStringArray, CStringArray>phonearray;
  5620. CArray<CStringArray, CStringArray>fgarray;
  5621. CArray<CStringArray, CStringArray>danweiarray;
  5622. CArray<CStringArray, CStringArray>jdarray;
  5623. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5624. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5625. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5626. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5627. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5628. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5629. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  5630. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5631. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5632. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5633. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5634. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5635. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5636. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5637. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5638. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5639. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5640. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5641. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5642. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5643. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5644. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5645. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5646. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5647. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5648. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5649. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5650. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5651. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5652. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5653. if (jdarray.GetSize())
  5654. {
  5655. if (m_bz.IsEmpty() == 0)
  5656. m_bz = "\r\n" + m_bz;
  5657. m_bz += "景点:";
  5658. }
  5659. for (i = 0; i < jdarray.GetSize(); i++)
  5660. {
  5661. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5662. }
  5663. m_bz.TrimRight(";");
  5664. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5665. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5666. if (IsHasRights2new(31) == 0)
  5667. {
  5668. m_phone1 = "***";
  5669. m_phone2 = "***";
  5670. }
  5671. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5672. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5673. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  5674. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  5675. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  5676. CString str;
  5677. filter = "name='" + m_ren + "'";
  5678. g_sendhead.code[0] = 5;
  5679. g_sendhead.tabcount = 1;
  5680. g_sendhead.bsql = 0;
  5681. int g_nYearposTemp = g_nYearpos;
  5682. g_nYearpos = -1;
  5683. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5684. g_nYearpos = g_nYearposTemp;
  5685. if (g_bSendOK == 0)return;
  5686. DataToArray(&phonearray);
  5687. m_money1.Format("%f", atof(m_taoxijiage));
  5688. m_money2.Format("%f", atof(m_payed1));
  5689. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5690. ConvertToPrice(m_money1);
  5691. ConvertToPrice(m_money2);
  5692. ConvertToPrice(m_money3);
  5693. ////////////////////////////////////////////////////////////////
  5694. int rcpos = -1;
  5695. CRect StrRect = load.m_rcarray.ElementAt(0);
  5696. m_Print.SetFontFace(25, 1, "黑体");
  5697. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "预约单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5698. m_Print.SetFontFace(11, 1, "宋体");
  5699. StrRect = load.m_rcarray.ElementAt(1);
  5700. if (m_time1.GetLength() == 10)
  5701. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  5702. else
  5703. str = "开单日期:";
  5704. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5705. StrRect = load.m_rcarray.ElementAt(2);
  5706. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + strOrderNumber), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5707. CStringArray strarray;
  5708. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5709. {
  5710. Image *pImg = NULL;
  5711. g_nSendCode = 31;
  5712. int g_nYearposTemp = g_nYearpos;
  5713. g_nYearpos = -1;
  5714. g_pMainWnd->ProcessChatMessageRequest2(1);
  5715. g_nYearpos = g_nYearposTemp;
  5716. g_nSendCode = 0;
  5717. if (g_bSendOK == 0)return;
  5718. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5719. if (pImg)
  5720. {
  5721. StrRect.left = 47;
  5722. StrRect.top = 12;
  5723. StrRect.right = StrRect.left + 60;
  5724. StrRect.bottom = StrRect.top + 60;
  5725. m_Print.DrawImage(pImg, StrRect);
  5726. delete pImg; pImg = NULL;
  5727. }
  5728. }
  5729. #ifdef CHILD_VERSION
  5730. strarray.Add("家长姓名");
  5731. strarray.Add("宝宝姓名");
  5732. #else
  5733. strarray.Add("先生姓名");
  5734. strarray.Add("女士姓名");
  5735. #endif
  5736. strarray.Add("服装套数");
  5737. // strarray.Add ("拍摄张数");
  5738. #ifdef CHILD_VERSION
  5739. strarray.Add("出生日期");
  5740. #else
  5741. strarray.Add("结婚日期");
  5742. #endif
  5743. strarray.Add("拍摄日期");
  5744. strarray.Add("联系电话");
  5745. strarray.Add("联系电话");
  5746. strarray.Add("造型套数");
  5747. if (m_zs.Find("\\") != -1)
  5748. strarray.Add("入底\\入册");
  5749. else
  5750. strarray.Add("入底张数");
  5751. strarray.Add("选片日期");
  5752. strarray.Add("QQ/邮箱");
  5753. strarray.Add("套系总额");
  5754. strarray.Add("定金");
  5755. strarray.Add("余款金额");
  5756. strarray.Add("取件日期");
  5757. strarray.Add(m_name1);
  5758. strarray.Add(m_name2);
  5759. strarray.Add(m_clothescount);
  5760. // str.Format("%d", atoi(m_zs)*3);
  5761. // strarray.Add (str);
  5762. #ifdef CHILD_VERSION
  5763. strarray.Add(m_birthday1);
  5764. #else
  5765. strarray.Add(m_time3);
  5766. #endif
  5767. strarray.Add(m_time2);
  5768. strarray.Add(m_phone1);
  5769. strarray.Add(m_phone2);
  5770. strarray.Add(m_clothescount2);
  5771. strarray.Add(m_zs);
  5772. strarray.Add(m_time4);
  5773. strarray.Add(m_qq1);
  5774. strarray.Add(m_money1);
  5775. strarray.Add(m_money2);
  5776. strarray.Add(m_money3);
  5777. strarray.Add(m_time5);
  5778. for (i = 4; i <= 33; i++)
  5779. {
  5780. StrRect = load.m_rcarray.ElementAt(i - 1);
  5781. m_Print.DrawRect2(StrRect, 1);
  5782. if (strarray.GetSize() > (i - 4))
  5783. {
  5784. if (i <= 18)
  5785. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5786. else
  5787. {
  5788. StrRect.left += 4;
  5789. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5790. }
  5791. }
  5792. }
  5793. int dt = 413;
  5794. StrRect = load.m_rcarray.ElementAt(36); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5795. m_Print.DrawText((LPTSTR)(LPCTSTR)"门市签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5796. StrRect = load.m_rcarray.ElementAt(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5797. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5798. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5799. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5800. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  5801. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5802. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  5803. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5804. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  5805. m_Print.DrawText((LPTSTR)(LPCTSTR)("网址:" + g_cominfoarray.ElementAt(0).ElementAt(13)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5806. //////////////////////////////
  5807. //开始画文字
  5808. StrRect = load.m_rcarray.ElementAt(7);
  5809. int hei = StrRect.Height();
  5810. StrRect.top += hei;
  5811. StrRect.bottom += hei;
  5812. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5813. StrRect.top += dt;
  5814. StrRect.bottom += dt;
  5815. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5816. StrRect = load.m_rcarray.ElementAt(17);
  5817. StrRect.top += hei;
  5818. StrRect.bottom += hei;
  5819. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5820. StrRect = load.m_rcarray.ElementAt(33);
  5821. StrRect.bottom = StrRect.top + dt; m_Print.DrawRect2(StrRect, 1);
  5822. StrRect.top += hei;
  5823. StrRect.left += 3;
  5824. StrRect.top += 3;
  5825. StrRect.right -= 2;
  5826. StrRect.bottom -= 2;
  5827. str = "";
  5828. for (i = 0; i < sparray.GetSize(); i++)
  5829. {
  5830. str += sparray.ElementAt(i).ElementAt(5);
  5831. str += " 数量:";
  5832. str += sparray.ElementAt(i).ElementAt(3);
  5833. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5834. str += "\r\n";
  5835. }
  5836. str.TrimRight("\r\n");
  5837. AutoDraw(m_Print, StrRect, str, 1.4);
  5838. StrRect = load.m_rcarray.ElementAt(33);
  5839. StrRect.top += dt;
  5840. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5841. StrRect.top += hei;
  5842. StrRect.left += 3;
  5843. StrRect.top += 3;
  5844. StrRect.right -= 2;
  5845. StrRect.bottom -= 2;
  5846. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  5847. StrRect = load.m_rcarray.ElementAt(34);
  5848. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5849. StrRect.top += hei;
  5850. StrRect.left += 3;
  5851. StrRect.top += 3;
  5852. StrRect.right -= 2;
  5853. StrRect.bottom -= 2;
  5854. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5855. if (str.IsEmpty())
  5856. {
  5857. str = "\
  5858. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5859. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5860. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5861. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5862. 持良好的心境.\r\n\
  5863. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5864. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5865. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5866. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5867. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5868. 勿进影室, 以免影响拍摄.\r\n\
  5869. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5870. 师或店长沟通.\r\n\
  5871. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5872. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5873. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5874. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5875. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5876. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5877. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5878. 还.";
  5879. }
  5880. AutoDraw(m_Print, StrRect, str, 1.8);
  5881. StrRect = load.m_rcarray.ElementAt(35);
  5882. StrRect.bottom += 100;
  5883. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  5884. 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∨";
  5885. // AutoDraw(m_Print, StrRect, str, 1.4);
  5886. }
  5887. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 2)
  5888. {
  5889. PrintDinDan5(strOrderNumber);
  5890. return;
  5891. }
  5892. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  5893. {
  5894. PrintDinDan6(strOrderNumber);
  5895. return;
  5896. }
  5897. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  5898. dlg.m_pDC = m_Print.GetPDC();
  5899. dlg.m_mode = 1;
  5900. if (aa == 0)
  5901. {
  5902. if (dlg.DoModal() != IDOK)
  5903. return;
  5904. printcot = dlg.m_num;
  5905. }
  5906. //结束打印
  5907. m_Print.EndPage();
  5908. m_Print.EndPrint();
  5909. }
  5910. }
  5911. void CovertDate2(CString date, CString &date2)
  5912. {
  5913. try
  5914. {
  5915. if (date == "2013-04-09")
  5916. {
  5917. date2 = "2013-02-29";
  5918. return;
  5919. }
  5920. ///////////////////////////////////
  5921. date2 = date;
  5922. GongToLong(date2);
  5923. ////////////////////////////////////
  5924. return;
  5925. CCalendarConvert m_CalendarConvert;
  5926. SYSTEMTIME src = { 0 };
  5927. SYSTEMTIME dst = { 0 };
  5928. COleDateTime m_timeLunar(atoi(date.Mid(0, 4)), atoi(date.Mid(5, 2)), atoi(date.Mid(8, 2)), 0, 0, 0);
  5929. COleDateTime m_timeGregorian;
  5930. m_timeLunar.GetAsSystemTime(src);
  5931. BOOL bEmbolism = 0;
  5932. if (m_CalendarConvert.Gregorian2Lunar(&src, &dst, &bEmbolism))
  5933. {
  5934. m_timeGregorian = m_CalendarConvert.ConvertSysTime2OleDateTime(&dst);
  5935. date2.Format("%04d-%02d-%02d", m_timeGregorian.GetYear(), m_timeGregorian.GetMonth(), m_timeGregorian.GetDay());
  5936. if (m_timeGregorian.GetYear() == -1)date2 = "2000-13-32";
  5937. }
  5938. else
  5939. {
  5940. date2.Empty();
  5941. }
  5942. }
  5943. catch (...)
  5944. {
  5945. }
  5946. }
  5947. void CMainFrame::PrintDinDan5(CString m_id)
  5948. {
  5949. int printcot = 1;
  5950. for (int aa = 0; aa < printcot; aa++)
  5951. {
  5952. PrintPreview dlg;
  5953. CPrintRX m_Print;
  5954. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  5955. {
  5956. m_Print.InitToPrint(NULL, 1);
  5957. }
  5958. else
  5959. {
  5960. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  5961. if (name.IsEmpty())
  5962. m_Print.InitToPrint(NULL, 1);
  5963. else
  5964. {
  5965. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  5966. if (nret == -1 && aa == 0)
  5967. {
  5968. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  5969. }
  5970. }
  5971. }
  5972. {
  5973. m_Print.StartPrint();
  5974. m_Print.StartPage();
  5975. LoadRect load;
  5976. load.SetLiaPath("19.lia");
  5977. load.SetMargins(0, -20);
  5978. if (!load.Load())return;
  5979. int i;
  5980. //////////////////////////////////////////////////////////////
  5981. CStringArray txarray;
  5982. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  5983. g_sendhead.code[0] = 11;
  5984. g_sendhead.code[1] = 52;
  5985. g_sendhead.code[2] = 50;
  5986. g_sendhead.code[3] = 150;
  5987. g_sendhead.code[4] = 77;
  5988. g_sendhead.code[5] = 4;
  5989. g_sendhead.tabcount = 6;
  5990. g_sendhead.bsql = 0;
  5991. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5992. CArray<CStringArray, CStringArray>sparray;
  5993. CArray<CStringArray, CStringArray>clientarray;
  5994. CArray<CStringArray, CStringArray>phonearray;
  5995. CArray<CStringArray, CStringArray>fgarray;
  5996. CArray<CStringArray, CStringArray>danweiarray;
  5997. CArray<CStringArray, CStringArray>jdarray;
  5998. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5999. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  6000. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  6001. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  6002. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  6003. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  6004. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  6005. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  6006. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  6007. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  6008. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  6009. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  6010. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  6011. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  6012. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  6013. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  6014. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  6015. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  6016. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  6017. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  6018. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  6019. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  6020. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  6021. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  6022. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  6023. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  6024. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  6025. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  6026. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(36);
  6027. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  6028. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6029. CString m_txtype = g_List1array.ElementAt(0).ElementAt(52);
  6030. CString m_memberno = g_List1array.ElementAt(0).ElementAt(47);
  6031. CString str;
  6032. if (jdarray.GetSize())
  6033. {
  6034. if (m_bz.IsEmpty() == 0)
  6035. m_bz = "\r\n" + m_bz;
  6036. m_bz += "景点:";
  6037. }
  6038. for (i = 0; i < jdarray.GetSize(); i++)
  6039. {
  6040. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  6041. }
  6042. m_bz.TrimRight(";");
  6043. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  6044. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  6045. if (IsHasRights2new(31) == 0)
  6046. {
  6047. m_phone1 = "***";
  6048. m_phone2 = "***";
  6049. }
  6050. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  6051. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  6052. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  6053. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  6054. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  6055. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  6056. BOOL check1 = atoi(clientarray.ElementAt(0).ElementAt(15));
  6057. filter = "name='" + m_ren + "'";
  6058. g_sendhead.code[0] = 5;
  6059. g_sendhead.tabcount = 1;
  6060. g_sendhead.bsql = 0;
  6061. int g_nYearposTemp = g_nYearpos;
  6062. g_nYearpos = -1;
  6063. g_pMainWnd->ProcessChatMessageRequest2(filter);
  6064. g_nYearpos = g_nYearposTemp;
  6065. if (g_bSendOK == 0)return;
  6066. DataToArray(&phonearray);
  6067. m_money1.Format("%f", atof(m_taoxijiage));
  6068. m_money2.Format("%f", atof(m_payed1));
  6069. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  6070. ConvertToPrice(m_money1);
  6071. ConvertToPrice(m_money2);
  6072. ConvertToPrice(m_money3);
  6073. ////////////////////////////////////////////////////////////////
  6074. int rcpos = -1;
  6075. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6076. //Image *pImg=NULL;
  6077. // ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  6078. // m_Print.DrawImage(pImg, StrRect);
  6079. // delete pImg;
  6080. m_Print.SetFontFace(20, 1, "宋体");
  6081. StrRect = load.m_rcarray.ElementAt(1);
  6082. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "定单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6083. m_Print.SetFontFace(12, 1, "宋体");
  6084. StrRect = load.m_rcarray.ElementAt(2);
  6085. m_Print.DrawText((LPTSTR)(LPCTSTR)("NO." + m_id), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6086. StrRect = load.m_rcarray.ElementAt(3);
  6087. str.Format("%s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  6088. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6089. StrRect = load.m_rcarray.ElementAt(4);
  6090. m_Print.DrawText((LPTSTR)(LPCTSTR)("联系人:" + m_name1), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6091. CStringArray strarray;
  6092. strarray.Add("姓名");
  6093. strarray.Add("性别");
  6094. strarray.Add("年龄");
  6095. strarray.Add("出生年月");
  6096. strarray.Add("套系价格");
  6097. strarray.Add("定金");
  6098. strarray.Add("欠款");
  6099. strarray.Add("拍摄类型");
  6100. strarray.Add("会员卡号");
  6101. strarray.Add("定单人");
  6102. strarray.Add("入底\\入册");
  6103. strarray.Add("联系电话");
  6104. for (i = 6; i <= 17; i++)
  6105. {
  6106. StrRect = load.m_rcarray.ElementAt(i - 1);
  6107. m_Print.DrawRect2(StrRect, 1);
  6108. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 6), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6109. }
  6110. strarray.RemoveAll();
  6111. strarray.Add(m_name2);
  6112. strarray.Add(m_sex);
  6113. if (m_birthday.GetLength() != 10)
  6114. strarray.Add("");
  6115. else
  6116. {
  6117. int year = 0;
  6118. if (check1)
  6119. {
  6120. CString date2;
  6121. CovertDate2(g_date, date2);
  6122. year = atoi(date2.Left(4)) - atoi(m_birthday.Left(4));
  6123. if (date2.Right(5) >= m_birthday.Right(5))
  6124. year++;
  6125. }
  6126. else
  6127. {
  6128. year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  6129. if (g_date.Right(5) >= m_birthday.Right(5))
  6130. year++;
  6131. }
  6132. str.Format("%d", year);
  6133. strarray.Add(str);
  6134. }
  6135. strarray.Add(m_birthday);
  6136. strarray.Add(m_money1);
  6137. strarray.Add(m_money2);
  6138. strarray.Add(m_money3);
  6139. strarray.Add(m_txtype);
  6140. strarray.Add(m_memberno);
  6141. strarray.Add(m_ren);
  6142. strarray.Add(m_zs);
  6143. if (!m_phone1.IsEmpty())
  6144. strarray.Add(m_phone1);
  6145. else
  6146. strarray.Add(m_phone2);
  6147. for (i = 18; i <= 29; i++)
  6148. {
  6149. StrRect = load.m_rcarray.ElementAt(i - 1);
  6150. m_Print.DrawRect2(StrRect, 1);
  6151. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6152. }
  6153. strarray.RemoveAll();
  6154. strarray.Add("摄影师");
  6155. strarray.Add("拍照时间");
  6156. strarray.Add("选片人");
  6157. strarray.Add("选片时间");
  6158. strarray.Add("引导师");
  6159. strarray.Add("设计师");
  6160. strarray.Add("取件时间");
  6161. strarray.Add("顾客签字");
  6162. for (i = 34; i <= 41; i++)
  6163. {
  6164. StrRect = load.m_rcarray.ElementAt(i - 1);
  6165. m_Print.DrawRect2(StrRect, 1);
  6166. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 34), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6167. }
  6168. strarray.RemoveAll();
  6169. strarray.Add(m_waiter1);
  6170. strarray.Add(m_time2);
  6171. strarray.Add(m_waiter3);
  6172. strarray.Add(m_time4);
  6173. strarray.Add(m_waiter2);
  6174. strarray.Add(m_waiter4);
  6175. strarray.Add(m_time5);
  6176. strarray.Add("");
  6177. for (i = 42; i <= 49; i++)
  6178. {
  6179. StrRect = load.m_rcarray.ElementAt(i - 1);
  6180. m_Print.DrawRect2(StrRect, 1);
  6181. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6182. }
  6183. m_Print.SetFontFace(15, 1, "宋体");
  6184. StrRect = load.m_rcarray.ElementAt(29);
  6185. m_Print.DrawRect2(StrRect, 1);
  6186. StrRect.top += 45;
  6187. m_Print.DrawText((LPTSTR)(LPCTSTR)"拍", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6188. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6189. m_Print.DrawText((LPTSTR)(LPCTSTR)"内", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6190. m_Print.DrawText((LPTSTR)(LPCTSTR)"容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  6191. StrRect = load.m_rcarray.ElementAt(30);
  6192. m_Print.DrawRect2(StrRect, 1);
  6193. StrRect.top += 45;
  6194. m_Print.DrawText((LPTSTR)(LPCTSTR)"友", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6195. m_Print.DrawText((LPTSTR)(LPCTSTR)"情", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6196. m_Print.DrawText((LPTSTR)(LPCTSTR)"提", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6197. m_Print.DrawText((LPTSTR)(LPCTSTR)"示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  6198. m_Print.SetFontFace(10, 1, "宋体");
  6199. StrRect = load.m_rcarray.ElementAt(37); StrRect.top = StrRect.bottom + 2;
  6200. str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  6201. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  6202. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  6203. StrRect = load.m_rcarray.ElementAt(48); StrRect.top = StrRect.bottom + 2; StrRect.left -= 200;
  6204. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  6205. //开始画文字
  6206. StrRect = load.m_rcarray.ElementAt(31);
  6207. StrRect.left += 3;
  6208. StrRect.top += 3;
  6209. StrRect.right -= 2;
  6210. StrRect.bottom -= 2;
  6211. str = "";
  6212. for (i = 0; i < sparray.GetSize(); i++)
  6213. {
  6214. str += sparray.ElementAt(i).ElementAt(5);
  6215. str += " 数量:";
  6216. str += sparray.ElementAt(i).ElementAt(3);
  6217. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6218. str += "\r\n";
  6219. }
  6220. str.TrimRight("\r\n");
  6221. m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6222. m_bz.TrimLeft();
  6223. if (m_bz != "")
  6224. {
  6225. str += "\r\n"; str += "\r\n";
  6226. str += "备注:" + m_bz;
  6227. }
  6228. AutoDraw(m_Print, StrRect, str, 1.4);
  6229. StrRect = load.m_rcarray.ElementAt(32); m_Print.DrawRect2(StrRect, 1);
  6230. StrRect.left += 3;
  6231. StrRect.top += 3;
  6232. StrRect.right -= 2;
  6233. StrRect.bottom -= 2;
  6234. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6235. if (str.IsEmpty())
  6236. {
  6237. str = "\
  6238. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6239. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6240. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6241. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6242. 持良好的心境.\r\n\
  6243. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6244. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6245. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6246. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6247. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6248. 勿进影室, 以免影响拍摄.\r\n\
  6249. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6250. 师或店长沟通.\r\n\
  6251. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6252. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6253. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6254. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6255. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6256. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6257. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6258. 还.";
  6259. }
  6260. AutoDraw(m_Print, StrRect, str, 1.8);
  6261. }
  6262. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6263. dlg.m_pDC = m_Print.GetPDC();
  6264. dlg.m_mode = 1;
  6265. if (aa == 0)
  6266. {
  6267. if (dlg.DoModal() != IDOK)
  6268. return;
  6269. printcot = dlg.m_num;
  6270. }
  6271. //结束打印
  6272. m_Print.EndPage();
  6273. m_Print.EndPrint();
  6274. }
  6275. }
  6276. void CMainFrame::PrintDinDan4(CString m_id)
  6277. {
  6278. // TODO: Add your control notification handler code here
  6279. CPrintRX m_Print;
  6280. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6281. {
  6282. m_Print.InitToPrint(NULL, 1);
  6283. }
  6284. else
  6285. {
  6286. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  6287. if (name.IsEmpty())
  6288. m_Print.InitToPrint(NULL, 1);
  6289. else
  6290. {
  6291. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6292. if (nret == -1)
  6293. {
  6294. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6295. }
  6296. }
  6297. }
  6298. m_Print.StartPrint();
  6299. m_Print.StartPage();
  6300. LoadRect load;
  6301. load.SetLiaPath("6-2.lia");
  6302. load.SetMargins(0, 0);
  6303. if (!load.Load())return;
  6304. int i;
  6305. //////////////////////////////////////////////////////////////
  6306. CStringArray txarray;
  6307. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  6308. g_sendhead.code[0] = 11;
  6309. g_sendhead.code[1] = 52;
  6310. g_sendhead.code[2] = 50;
  6311. g_sendhead.code[3] = 150;
  6312. g_sendhead.code[4] = 77;
  6313. g_sendhead.code[5] = 4;
  6314. g_sendhead.tabcount = 6;
  6315. g_sendhead.bsql = 0;
  6316. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  6317. CArray<CStringArray, CStringArray>sparray;
  6318. CArray<CStringArray, CStringArray>clientarray;
  6319. CArray<CStringArray, CStringArray>phonearray;
  6320. CArray<CStringArray, CStringArray>fgarray;
  6321. CArray<CStringArray, CStringArray>danweiarray;
  6322. CArray<CStringArray, CStringArray>jdarray;
  6323. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  6324. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  6325. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  6326. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  6327. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  6328. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  6329. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  6330. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  6331. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  6332. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  6333. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  6334. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  6335. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  6336. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  6337. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  6338. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  6339. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  6340. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  6341. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  6342. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  6343. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  6344. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  6345. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  6346. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  6347. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  6348. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  6349. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  6350. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  6351. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  6352. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6353. if (jdarray.GetSize())
  6354. {
  6355. if (m_bz.IsEmpty() == 0)
  6356. m_bz = "\r\n" + m_bz;
  6357. m_bz += "景点:";
  6358. }
  6359. for (i = 0; i < jdarray.GetSize(); i++)
  6360. {
  6361. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  6362. }
  6363. m_bz.TrimRight(";");
  6364. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  6365. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  6366. if (IsHasRights2new(31) == 0)
  6367. {
  6368. m_phone1 = "***";
  6369. m_phone2 = "***";
  6370. }
  6371. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  6372. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  6373. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  6374. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  6375. CString str;
  6376. filter = "name='" + m_ren + "'";
  6377. g_sendhead.code[0] = 5;
  6378. g_sendhead.tabcount = 1;
  6379. g_sendhead.bsql = 0;
  6380. int g_nYearposTemp = g_nYearpos;
  6381. g_nYearpos = -1;
  6382. g_pMainWnd->ProcessChatMessageRequest2(filter);
  6383. g_nYearpos = g_nYearposTemp;
  6384. if (g_bSendOK == 0)return;
  6385. DataToArray(&phonearray);
  6386. m_money1.Format("%f", atof(m_taoxijiage));
  6387. m_money2.Format("%f", atof(m_payed1));
  6388. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  6389. ConvertToPrice(m_money1);
  6390. ConvertToPrice(m_money2);
  6391. ConvertToPrice(m_money3);
  6392. ////////////////////////////////////////////////////////////////
  6393. int rcpos = -1;
  6394. CRect StrRect = load.m_rcarray.ElementAt(0);
  6395. m_Print.SetFontFace(25, 1, "黑体");
  6396. m_Print.DrawText((LPTSTR)(LPCTSTR)"巴黎春天婚纱摄影预约单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6397. m_Print.SetFontFace(11, 1, "宋体");
  6398. StrRect = load.m_rcarray.ElementAt(1);
  6399. if (m_time1.GetLength() == 10)
  6400. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  6401. else
  6402. str = "开单日期:";
  6403. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6404. StrRect = load.m_rcarray.ElementAt(2);
  6405. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + m_id), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6406. CStringArray strarray;
  6407. strarray.Add("先生姓名");
  6408. strarray.Add("女士姓名");
  6409. strarray.Add("服装套数");
  6410. strarray.Add("拍摄张数");
  6411. strarray.Add("拍摄日期");
  6412. strarray.Add("联系电话");
  6413. strarray.Add("联系电话");
  6414. strarray.Add("造型套数");
  6415. strarray.Add("入册张数");
  6416. strarray.Add("选片日期");
  6417. strarray.Add("QQ/邮箱");
  6418. strarray.Add("套系总额");
  6419. strarray.Add("定金");
  6420. strarray.Add("余款金额");
  6421. strarray.Add("取件日期");
  6422. strarray.Add(m_name1);
  6423. strarray.Add(m_name2);
  6424. strarray.Add(m_clothescount);
  6425. str.Format("%d", atoi(m_zs) * 3);
  6426. strarray.Add(str);
  6427. strarray.Add(m_time2);
  6428. strarray.Add(m_phone1);
  6429. strarray.Add(m_phone2);
  6430. strarray.Add(m_clothescount2);
  6431. strarray.Add(m_zs);
  6432. strarray.Add(m_time4);
  6433. strarray.Add(m_qq1);
  6434. strarray.Add(m_money1);
  6435. strarray.Add(m_money2);
  6436. strarray.Add(m_money3);
  6437. strarray.Add(m_time5);
  6438. for (i = 4; i <= 33; i++)
  6439. {
  6440. StrRect = load.m_rcarray.ElementAt(i - 1);
  6441. m_Print.DrawRect2(StrRect, 1);
  6442. if (strarray.GetSize() > (i - 4))
  6443. {
  6444. if (i <= 18)
  6445. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6446. else
  6447. {
  6448. StrRect.left += 4;
  6449. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6450. }
  6451. }
  6452. }
  6453. int dt = 413;
  6454. StrRect = load.m_rcarray.ElementAt(36); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6455. m_Print.DrawText((LPTSTR)(LPCTSTR)"门市签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6456. StrRect = load.m_rcarray.ElementAt(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6457. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6458. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6459. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6460. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  6461. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址:深圳市红岭中路中深国际大厦首层,二十二层", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6462. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  6463. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:0755-61308198 61308199 25860696 25860697", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6464. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  6465. m_Print.DrawText((LPTSTR)(LPCTSTR)"网址:www.paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6466. StrRect = load.m_rcarray.ElementAt(43); StrRect.top += dt; StrRect.bottom += dt;
  6467. m_Print.DrawText((LPTSTR)(LPCTSTR)"邮箱:blct@paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6468. //////////////////////////////
  6469. //开始画文字
  6470. StrRect = load.m_rcarray.ElementAt(7);
  6471. int hei = StrRect.Height();
  6472. StrRect.top += hei;
  6473. StrRect.bottom += hei;
  6474. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6475. StrRect.top += dt;
  6476. StrRect.bottom += dt;
  6477. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6478. StrRect = load.m_rcarray.ElementAt(17);
  6479. StrRect.top += hei;
  6480. StrRect.bottom += hei;
  6481. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6482. StrRect = load.m_rcarray.ElementAt(33);
  6483. StrRect.bottom = StrRect.top + dt; m_Print.DrawRect2(StrRect, 1);
  6484. StrRect.top += hei;
  6485. StrRect.left += 3;
  6486. StrRect.top += 3;
  6487. StrRect.right -= 2;
  6488. StrRect.bottom -= 2;
  6489. str = "";
  6490. for (i = 0; i < sparray.GetSize(); i++)
  6491. {
  6492. str += sparray.ElementAt(i).ElementAt(5);
  6493. str += " 数量:";
  6494. str += sparray.ElementAt(i).ElementAt(3);
  6495. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6496. str += "\r\n";
  6497. }
  6498. str.TrimRight("\r\n");
  6499. AutoDraw(m_Print, StrRect, str, 1.4);
  6500. StrRect = load.m_rcarray.ElementAt(33);
  6501. StrRect.top += dt;
  6502. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6503. StrRect.top += hei;
  6504. StrRect.left += 3;
  6505. StrRect.top += 3;
  6506. StrRect.right -= 2;
  6507. StrRect.bottom -= 2;
  6508. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  6509. StrRect = load.m_rcarray.ElementAt(34);
  6510. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6511. StrRect.top += hei;
  6512. StrRect.left += 3;
  6513. StrRect.top += 3;
  6514. StrRect.right -= 2;
  6515. StrRect.bottom -= 2;
  6516. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6517. if (str.IsEmpty())
  6518. {
  6519. str = "\
  6520. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6521. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6522. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6523. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6524. 持良好的心境.\r\n\
  6525. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6526. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6527. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6528. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6529. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6530. 勿进影室, 以免影响拍摄.\r\n\
  6531. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6532. 师或店长沟通.\r\n\
  6533. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6534. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6535. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6536. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6537. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6538. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6539. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6540. 还.";
  6541. }
  6542. AutoDraw(m_Print, StrRect, str, 1.8);
  6543. StrRect = load.m_rcarray.ElementAt(35);
  6544. StrRect.bottom += 100;
  6545. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  6546. 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∨";
  6547. AutoDraw(m_Print, StrRect, str, 1.4);
  6548. PrintPreview dlg;
  6549. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6550. dlg.m_pDC = m_Print.GetPDC();
  6551. if (dlg.DoModal() != IDOK)return;
  6552. //结束打印
  6553. m_Print.EndPage();
  6554. m_Print.EndPrint();
  6555. }
  6556. int CalHeight_01(CRect &rc, CStringArray *saContent, CPrintRX *Print, int FORMAT)
  6557. {
  6558. CSize size;
  6559. int nMaxheight = 0;
  6560. CString strTemp;
  6561. CString strContent;
  6562. int nSize = saContent->GetSize();
  6563. int nRow = 0; // 行数;
  6564. for (int i = 0; i < nSize; i++)
  6565. {
  6566. strTemp = "";
  6567. strContent = saContent->ElementAt(i);
  6568. while (FALSE == strContent.IsEmpty())
  6569. {
  6570. strContent = strContent.Mid(strTemp.GetLength());
  6571. if (strContent.IsEmpty())
  6572. break;
  6573. Print->GetStrSize((LPTSTR)(LPCTSTR)strContent, size);
  6574. if (size.cx <= rc.Width())
  6575. {
  6576. CRect rc2 = rc;
  6577. rc2.top += nRow*(size.cy + 1);
  6578. rc2.bottom = rc2.top + (size.cy + 1);
  6579. Print->DrawText((LPTSTR)(LPCTSTR)strContent, rc2, 0, 0, FORMAT | FORMAT_UP);
  6580. nMaxheight = max(nMaxheight, rc2.bottom);
  6581. nRow++;
  6582. break;
  6583. }
  6584. int right = 0;
  6585. while (size.cx > rc.Width())
  6586. {
  6587. right++;
  6588. strTemp = strContent.Left(strContent.GetLength() - (right));
  6589. if (GIsHalfHZ(strTemp))
  6590. {
  6591. right++;
  6592. strTemp.Delete(strTemp.GetLength() - 1);
  6593. }
  6594. Print->GetStrSize((LPTSTR)(LPCTSTR)strTemp, size);
  6595. }
  6596. CRect rc2 = rc;
  6597. rc2.top += nRow*(size.cy + 1);
  6598. rc2.bottom = rc2.top + (size.cy + 1);
  6599. Print->DrawText((LPTSTR)(LPCTSTR)strTemp, rc2, 0, 0, FORMAT | FORMAT_UP); //printf("Jeff:str=%s\n\n",str);// Jeff Printf;
  6600. nRow++;
  6601. nMaxheight = max(nMaxheight, rc2.bottom);
  6602. }
  6603. }
  6604. return (nMaxheight == 0) ? (rc.bottom + 1) : (nMaxheight + 1);
  6605. }
  6606. /************************************************************************/
  6607. /*
  6608. 多字节字符编码下的CaleHeight函数;
  6609. 函数:CaleHeight
  6610. 描述:计算出一行高度可变,宽度特定的表格(CArray<CRect,CRect>),在输入指定内容时(CStringArray),表格高度变化最大的值。
  6611. 参数:
  6612. aRowRect: 一行表格,CArray::GetSize()表示表格列数;
  6613. aRowStr: 与表格对应的一行字符,CStringArray::GetSize()大小与CArray::GetSize()一致。
  6614. pPrinter: 打印机实例指针;
  6615. nFormat: 字符串的显示格式。
  6616. 返回:返回最大的表格高度;
  6617. 注意:只能多字节下使用,因为函数GIsHalfHZ。
  6618. */
  6619. /************************************************************************/
  6620. INT CalcHeight( IN CArray<CRect, CRect> &aRowRect, IN CStringArray &aRowStr, IN CPrintRX *pPrinter, IN CONST INT& nFormat)
  6621. {
  6622. // 参数有效性;
  6623. if( aRowRect.GetSize() != aRowStr.GetSize() )
  6624. {
  6625. OutputDebugString(_T("表格列数与字符列数不等!\n"));
  6626. return -1;
  6627. }
  6628. if( pPrinter == NULL )
  6629. {
  6630. OutputDebugString(_T("打印机句柄指针无效\n"));
  6631. return -1;
  6632. }
  6633. // 表格字串长度;
  6634. CSize size;
  6635. // 当前表格字体高度;
  6636. INT nGridFontHeight = 0;
  6637. // 当前表格区域;
  6638. CRect curGrid;
  6639. // 当前表格字符串;
  6640. CString strGridContent;
  6641. // 最大值高底;
  6642. INT nMaxHeigth = 0;
  6643. // 当前换行数;
  6644. INT nWrapRows = 0;
  6645. // 当前换行字串;
  6646. CString strWrapRow = _T("");
  6647. // 表格列数;
  6648. INT nColumns = aRowRect.GetSize();
  6649. // 临时表格;
  6650. CRect rcGrid;
  6651. // 循环计算每个表格的高度;
  6652. for( INT i = 0; i < nColumns; i++ )
  6653. {
  6654. nWrapRows = 0;
  6655. strWrapRow.Empty();
  6656. curGrid = aRowRect.ElementAt(i);
  6657. strGridContent = aRowStr.ElementAt(i);
  6658. nMaxHeigth = max(nMaxHeigth, curGrid.bottom);
  6659. while( !strGridContent.IsEmpty() )
  6660. {
  6661. strGridContent = strGridContent.Right(strGridContent.GetLength() - strWrapRow.GetLength());
  6662. if ( strGridContent.IsEmpty() )
  6663. {
  6664. OutputDebugString(_T("表格字符已空\n"));
  6665. break;
  6666. }
  6667. pPrinter->GetStrSize((LPTSTR)(LPCTSTR)strGridContent, size);
  6668. nGridFontHeight = size.cy + 1;
  6669. // 字串长度 <= 表格宽度;
  6670. if( size.cx <= curGrid.Width() )
  6671. {
  6672. rcGrid = curGrid;
  6673. rcGrid.top += nWrapRows*nGridFontHeight;
  6674. rcGrid.bottom = rcGrid.top + nGridFontHeight;
  6675. nMaxHeigth = max(nMaxHeigth, rcGrid.bottom);
  6676. pPrinter->DrawText((LPTSTR)(LPCTSTR)strGridContent, rcGrid, 0, 0, nFormat|FORMAT_UP);
  6677. break;
  6678. }
  6679. else
  6680. {// 字串长度 >= 表格宽度;
  6681. INT nRight = 0; // 字串右位置;
  6682. // 从右边开始逐个字符取出,直到左边字串小于表格宽度;
  6683. while( size.cx > curGrid.Width() )
  6684. {
  6685. nRight++;
  6686. strWrapRow = strGridContent.Left(strGridContent.GetLength() - nRight);
  6687. if( GIsHalfHZ(strWrapRow) )
  6688. {// 判断字串最后一个字符是否是汉字;
  6689. nRight++;
  6690. strWrapRow.Delete(strWrapRow.GetLength() - 1);
  6691. }
  6692. pPrinter->GetStrSize((LPTSTR)(LPCTSTR)strWrapRow, size);
  6693. }
  6694. rcGrid = curGrid;
  6695. rcGrid.top += nWrapRows*nGridFontHeight;
  6696. rcGrid.bottom = rcGrid.top + nGridFontHeight;
  6697. nMaxHeigth = max(nMaxHeigth, rcGrid.bottom);
  6698. pPrinter->DrawText((LPTSTR)(LPCTSTR)strWrapRow, rcGrid, 0, 0, nFormat|FORMAT_UP);
  6699. // 换行加+1;
  6700. nWrapRows++;
  6701. }
  6702. }
  6703. }
  6704. return nMaxHeigth + 1;
  6705. }
  6706. void CMainFrame::PrintReceipt(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  6707. {
  6708. //AfxMessageBox("abce");
  6709. int i = 0;
  6710. int printcot = 1;
  6711. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  6712. {
  6713. g_sendhead.bsql = 0;
  6714. g_sendhead.code[0] = 24;
  6715. g_sendhead.tabcount = 1;
  6716. int g_nYearposTemp = g_nYearpos;
  6717. g_nYearpos = -1;
  6718. g_pMainWnd->ProcessChatMessageRequest2(1);
  6719. g_nYearpos = g_nYearposTemp;
  6720. if (0 == g_bSendOK)return;
  6721. DataToArray(&g_cominfoarray);
  6722. CString SerialNo;
  6723. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6724. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  6725. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6726. CString sql;
  6727. sql.Format("update version set [serialno]='%s'", SerialNo);
  6728. g_sendhead.bsql=1;
  6729. g_nYearposTemp=g_nYearpos;
  6730. g_nYearpos=-1;
  6731. g_pMainWnd->ProcessChatMessageRequest2(sql);
  6732. g_nYearpos=g_nYearposTemp;
  6733. #endif
  6734. // 1.创建打印对象
  6735. CPrintRX m_Print;
  6736. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6737. {
  6738. m_Print.InitToPrint(NULL, 1);
  6739. }
  6740. else
  6741. {
  6742. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  6743. if (name.IsEmpty())
  6744. m_Print.InitToPrint(NULL, 1);
  6745. else
  6746. {
  6747. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6748. if (nret == -1 && aa == 0)
  6749. {
  6750. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6751. }
  6752. }
  6753. }
  6754. // 2.开始打印
  6755. m_Print.StartPrint();
  6756. m_Print.StartPage();
  6757. LoadRect load;
  6758. BOOL bSmall = 0;
  6759. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  6760. {
  6761. bSmall = 1;
  6762. load.SetLiaPath("20.lia");
  6763. }
  6764. else
  6765. load.SetLiaPath("10.lia");
  6766. if (bSmall)
  6767. load.SetMargins(0, 0);
  6768. else
  6769. load.SetMargins(10, 0);
  6770. if (!load.Load())return;
  6771. int rcpos = -1;
  6772. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6773. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  6774. {
  6775. Image *pImg = NULL;
  6776. g_nSendCode = 31;
  6777. int g_nYearposTemp = g_nYearpos;
  6778. g_nYearpos = -1;
  6779. g_pMainWnd->ProcessChatMessageRequest2(1);
  6780. g_nYearpos = g_nYearposTemp;
  6781. g_nSendCode = 0;
  6782. if (g_bSendOK == 0)return;
  6783. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  6784. if (pImg)
  6785. {
  6786. StrRect.left = 65;
  6787. if (bSmall) StrRect.left = 55;
  6788. StrRect.top = 10;
  6789. StrRect.right = StrRect.left + 58;
  6790. StrRect.bottom = StrRect.top + 58;
  6791. // 3.打印2维码图像;
  6792. m_Print.DrawImage(pImg, StrRect);
  6793. delete pImg;
  6794. pImg = NULL;
  6795. }
  6796. }
  6797. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  6798. if (bSmall)
  6799. {
  6800. m_Print.SetFontFace(18, 1, "黑体");
  6801. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6802. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6803. m_Print.SetFontFace(9, 1, "宋体");
  6804. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6805. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6806. m_Print.SetFontFace(6, 1, "宋体");
  6807. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6808. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6809. m_Print.SetFontFace(9, 1, "宋体");
  6810. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6811. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6812. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6813. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6814. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6815. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6816. int hei = StrRect.Height();
  6817. StrRect.bottom = StrRect.top;
  6818. StrRect.top -= 8;
  6819. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6820. m_Print.SetFontFace(11, 1, "宋体");
  6821. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6822. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6823. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6824. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6825. m_Print.SetFontFace(8, 1, "宋体");
  6826. for (i = 7; i < 24; i++)
  6827. {
  6828. StrRect = load.m_rcarray.ElementAt(i);
  6829. m_Print.DrawRect2(StrRect, 1);
  6830. }
  6831. for (i = 9; i < 24; i++)
  6832. {
  6833. StrRect = load.m_rcarray.ElementAt(i);
  6834. StrRect.left += 2;
  6835. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6836. }
  6837. m_Print.SetFontFace(6, 1, "宋体");
  6838. for (i = 24; i < 26; i++)
  6839. {
  6840. StrRect = load.m_rcarray.ElementAt(i);
  6841. StrRect.left += 2;
  6842. if (i == 24)
  6843. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6844. else
  6845. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6846. }
  6847. // StrRect=load.m_rcarray .ElementAt (27);
  6848. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  6849. }
  6850. else//大单
  6851. {
  6852. // 1.打印表头(蒙娜丽莎收款单)
  6853. m_Print.SetFontFace(20, 1, "黑体");
  6854. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6855. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6856. m_Print.SetFontFace(11, 1, "宋体");
  6857. // 2.打印订单号(NO.20140608-001)
  6858. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6859. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6860. // 3.打印SerialNo(SerialNo.01062)
  6861. int hei = StrRect.Height();
  6862. StrRect.bottom = StrRect.top;
  6863. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6864. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6865. // 4.打印影楼地址信息、电话;
  6866. m_Print.SetFontFace(8, 1, "宋体");
  6867. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6868. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6869. m_Print.SetFontFace(11, 1, "宋体");
  6870. // 5.打印客户姓名
  6871. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6872. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6873. // 6.打印客户联系电话
  6874. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6875. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6876. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6877. // 7.打印开单日期
  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_RIGHT | FORMAT_VCENTER);
  6880. // 8.打印列字段:收款项目
  6881. m_Print.SetFontFace(13, 1, "宋体");
  6882. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6883. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6884. //printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6885. // 9.打印列字段:金额
  6886. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6887. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6888. //printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6889. // 10.打印列字段:开单人
  6890. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6891. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6892. //printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6893. // 11.画表格-画3列;
  6894. m_Print.SetFontFace(11, 1, "宋体");
  6895. for (i = 7; i < 10; i++)
  6896. {
  6897. StrRect = load.m_rcarray.ElementAt(i);
  6898. m_Print.DrawRect2(StrRect, 1);
  6899. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6900. }
  6901. // 12.打印详细内容
  6902. int dty = 0;
  6903. int dtytemp = 0;
  6904. // for( i=10; i<14; i+=3)
  6905. for (i = 10; i<22; i += 3) // 循环4次,再画
  6906. {
  6907. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  6908. CArray<CRect, CRect>rcarray;
  6909. CStringArray strarray2;
  6910. StrRect = load.m_rcarray.ElementAt(i);
  6911. StrRect.top += dty;
  6912. StrRect.bottom += dty;
  6913. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  6914. {
  6915. StrRect = load.m_rcarray.ElementAt(i - 1);
  6916. StrRect.top += dty;
  6917. StrRect.bottom += dty;
  6918. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  6919. break;
  6920. }
  6921. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  6922. StrRect.left += 2;
  6923. StrRect.right -= 2;
  6924. StrRect.top += 4;
  6925. rcarray.Add(StrRect);
  6926. strarray2.Add(pArray->ElementAt(i));
  6927. // 指定格子宽度,计算字符串占几行(高度).
  6928. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  6929. dtytemp = bottom - StrRect.bottom;
  6930. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  6931. // 重新获取表格大小,并画出表格;
  6932. StrRect = load.m_rcarray.ElementAt(i);
  6933. StrRect.bottom += dtytemp;
  6934. StrRect.top += dty;
  6935. StrRect.bottom += dty;
  6936. m_Print.DrawRect2(StrRect, 1);
  6937. // 获取下一表格大小,并画出表格;
  6938. StrRect = load.m_rcarray.ElementAt(i + 1);
  6939. StrRect.top += dty;
  6940. StrRect.bottom += dty;
  6941. StrRect.bottom += dtytemp;
  6942. m_Print.DrawRect2(StrRect, 1);
  6943. StrRect.left += 2;
  6944. // 打印出金额字段内容
  6945. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6946. //printf("Jeff:%d:%s\n\n",i+1,pArray->ElementAt(i+1));//Jeff Printf;
  6947. StrRect = load.m_rcarray.ElementAt(i + 2);
  6948. StrRect.top += dty;
  6949. StrRect.bottom += dty;
  6950. StrRect.bottom += dtytemp;
  6951. m_Print.DrawRect2(StrRect, 1);
  6952. StrRect.left += 2;
  6953. // 打印开单人字段内容
  6954. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6955. //printf("Jeff:%d:%s\n\n",i+2,pArray->ElementAt(i+2));//Jeff Printf;
  6956. dty += dtytemp;
  6957. }
  6958. //.打印->付款情况 应付 实付 欠款.
  6959. i = 22;
  6960. StrRect = load.m_rcarray.ElementAt(i);
  6961. StrRect.top += dty;
  6962. StrRect.bottom += dty;
  6963. m_Print.DrawRect2(StrRect, 1);
  6964. StrRect.left += 2;
  6965. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6966. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  6967. //.打印->合计人民币(大写):.......
  6968. i = 23;
  6969. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  6970. m_Print.DrawRect2(StrRect, 1);
  6971. StrRect.left += 2;
  6972. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6973. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  6974. m_Print.SetFontFace(7, 1, "宋体");
  6975. for (i = 24; i < 27; i++)
  6976. {
  6977. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  6978. StrRect.left += 2;
  6979. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6980. }
  6981. StrRect = load.m_rcarray.ElementAt(24); StrRect.top += dty; StrRect.bottom += dty;
  6982. hei = StrRect.Height();
  6983. StrRect.top += hei;
  6984. StrRect.bottom += hei;
  6985. StrRect.right += 100;
  6986. StrRect.left += 2;
  6987. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  6988. AutoDraw(m_Print, StrRect, pArray->ElementAt(27), 1.0);
  6989. }
  6990. PrintPreview dlg;
  6991. dlg.m_mode = 3;
  6992. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6993. dlg.m_pDC = m_Print.GetPDC();
  6994. if (aa == 0)
  6995. {
  6996. if (dlg.DoModal() != IDOK)
  6997. return;
  6998. printcot = dlg.m_num;
  6999. }
  7000. //结束打印
  7001. m_Print.EndPage();
  7002. m_Print.EndPrint();
  7003. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7004. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7005. CString sql;
  7006. sql.Format("update version set [serialno]='%s'", SerialNo);
  7007. g_sendhead.bsql = 1;
  7008. g_nYearposTemp = g_nYearpos;
  7009. g_nYearpos = -1;
  7010. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7011. g_nYearpos = g_nYearposTemp;
  7012. #endif
  7013. }
  7014. }
  7015. /************************************************************************/
  7016. /*
  7017. 函数:PrintRechargeRecord
  7018. 描述:打印会员卡充值记录;
  7019. 参数:
  7020. pArryRechargeRecod[IN]:要打印的数据;
  7021. 返回:
  7022. 注意:
  7023. 示例:
  7024. */
  7025. /************************************************************************/
  7026. void CMainFrame::PrintRechargeRecord(CStringArray *pArryRechargeRecod)
  7027. {
  7028. }
  7029. void CMainFrame::PrintReceipt_01(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  7030. {
  7031. //AfxMessageBox("abce");
  7032. int i = 0;
  7033. int printcot = 1;
  7034. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  7035. {
  7036. g_sendhead.bsql = 0;
  7037. g_sendhead.code[0] = 24;
  7038. g_sendhead.tabcount = 1;
  7039. int g_nYearposTemp = g_nYearpos;
  7040. g_nYearpos = -1;
  7041. g_pMainWnd->ProcessChatMessageRequest2(1);
  7042. g_nYearpos = g_nYearposTemp;
  7043. if (0 == g_bSendOK)return;
  7044. DataToArray(&g_cominfoarray);
  7045. CString SerialNo;
  7046. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7047. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7048. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7049. CString sql;
  7050. sql.Format("update version set [serialno]='%s'", SerialNo);
  7051. g_sendhead.bsql=1;
  7052. g_nYearposTemp=g_nYearpos;
  7053. g_nYearpos=-1;
  7054. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7055. g_nYearpos=g_nYearposTemp;
  7056. #endif
  7057. // 1.创建打印对象
  7058. CPrintRX m_Print;
  7059. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7060. {
  7061. m_Print.InitToPrint(NULL, 1);
  7062. }
  7063. else
  7064. {
  7065. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  7066. if (name.IsEmpty())
  7067. m_Print.InitToPrint(NULL, 1);
  7068. else
  7069. {
  7070. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  7071. if (nret == -1 && aa == 0)
  7072. {
  7073. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  7074. m_Print.InitToPrint(NULL, 1);
  7075. }
  7076. }
  7077. }
  7078. // 2.开始打印
  7079. m_Print.StartPrint();
  7080. m_Print.StartPage();
  7081. LoadRect load;
  7082. BOOL bSmall = 0;
  7083. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  7084. {
  7085. bSmall = 1;
  7086. load.SetLiaPath("20.lia");
  7087. }
  7088. else
  7089. load.SetLiaPath("10.lia");
  7090. if (bSmall)
  7091. load.SetMargins(0, 0);
  7092. else
  7093. load.SetMargins(10, 0);
  7094. if (!load.Load())return;
  7095. int rcpos = -1;
  7096. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7097. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  7098. {
  7099. Image *pImg = NULL;
  7100. g_nSendCode = 31;
  7101. int g_nYearposTemp = g_nYearpos;
  7102. g_nYearpos = -1;
  7103. g_pMainWnd->ProcessChatMessageRequest2(1);
  7104. g_nYearpos = g_nYearposTemp;
  7105. g_nSendCode = 0;
  7106. if (g_bSendOK == 0)return;
  7107. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7108. if (pImg)
  7109. {
  7110. StrRect.left = 65;
  7111. if (bSmall) StrRect.left = 55;
  7112. StrRect.top = 10;
  7113. StrRect.right = StrRect.left + 58;
  7114. StrRect.bottom = StrRect.top + 58;
  7115. // 3.打印2维码图像;
  7116. m_Print.DrawImage(pImg, StrRect);
  7117. delete pImg;
  7118. pImg = NULL;
  7119. }
  7120. }
  7121. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  7122. if (bSmall)
  7123. {
  7124. m_Print.SetFontFace(18, 1, "黑体");
  7125. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7126. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7127. m_Print.SetFontFace(9, 1, "宋体");
  7128. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7129. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7130. m_Print.SetFontFace(6, 1, "宋体");
  7131. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7132. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7133. m_Print.SetFontFace(9, 1, "宋体");
  7134. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7135. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7136. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7137. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7138. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7139. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7140. int hei = StrRect.Height();
  7141. StrRect.bottom = StrRect.top;
  7142. StrRect.top -= 8;
  7143. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7144. m_Print.SetFontFace(11, 1, "宋体");
  7145. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7146. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7147. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7148. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7149. m_Print.SetFontFace(8, 1, "宋体");
  7150. for ( i = 7; i < 24; i++)
  7151. {
  7152. StrRect = load.m_rcarray.ElementAt(i);
  7153. m_Print.DrawRect2(StrRect, 1);
  7154. }
  7155. for (i = 9; i < 24; i++)
  7156. {
  7157. StrRect = load.m_rcarray.ElementAt(i);
  7158. StrRect.left += 2;
  7159. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7160. }
  7161. m_Print.SetFontFace(6, 1, "宋体");
  7162. for (i = 24; i < 26; i++)
  7163. {
  7164. StrRect = load.m_rcarray.ElementAt(i);
  7165. StrRect.left += 2;
  7166. if (i == 24)
  7167. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7168. else
  7169. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7170. }
  7171. // StrRect=load.m_rcarray .ElementAt (27);
  7172. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  7173. }
  7174. else//大单
  7175. {
  7176. // 1.打印表头(蒙娜丽莎收款单)
  7177. m_Print.SetFontFace(20, 1, "黑体");
  7178. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7179. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7180. m_Print.SetFontFace(11, 1, "宋体");
  7181. // 2.打印订单号(NO.20140608-001)
  7182. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7183. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7184. // 3.打印SerialNo(SerialNo.01062)
  7185. int hei = StrRect.Height();
  7186. StrRect.bottom = StrRect.top;
  7187. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7188. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7189. // 4.打印影楼地址信息、电话;
  7190. m_Print.SetFontFace(8, 1, "宋体");
  7191. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7192. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7193. m_Print.SetFontFace(11, 1, "宋体");
  7194. // 5.打印客户姓名
  7195. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7196. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7197. // 6.打印客户联系电话
  7198. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7199. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7200. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7201. // 7.打印开单日期
  7202. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7203. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7204. #if 0 // Original Edition
  7205. // 8.打印列字段:收款项目
  7206. m_Print.SetFontFace(13, 1, "宋体");
  7207. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7208. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7209. printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7210. // 9.打印列字段:金额
  7211. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7212. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7213. printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7214. // 10.打印列字段:开单人
  7215. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7216. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7217. printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7218. #else
  7219. // 8.打印列字段:收款项目
  7220. m_Print.SetFontFace(13, 1, "宋体");
  7221. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7222. StrRect = CRect(66, 85, 280, 105);
  7223. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7224. //m_Print.DrawText("收款项目",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7225. // 8.1 Jeff add:支付方式
  7226. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7227. StrRect = CRect(280, 85, 350, 105);
  7228. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7229. //m_Print.DrawText("支付方式",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7230. // 9.打印列字段:金额
  7231. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7232. StrRect = CRect(350, 85, 442, 105);
  7233. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7234. //m_Print.DrawText("金额",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7235. // 10.打印列字段:开单人
  7236. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7237. StrRect = CRect(442, 85, 535, 105);
  7238. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7239. //m_Print.DrawText("开单人",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7240. //rcpos += 3;
  7241. #endif
  7242. // 11.画表格-画3列;old
  7243. // 11.draw 4 column
  7244. m_Print.SetFontFace(11, 1, "宋体");
  7245. //for( i=7; i<10; i++)
  7246. //{
  7247. // StrRect=load.m_rcarray.ElementAt(i);
  7248. // m_Print.DrawRect2(StrRect, 1);
  7249. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7250. //}
  7251. m_Print.DrawRect2(CRect(66, 85, 280, 105), 1);
  7252. m_Print.DrawRect2(CRect(280, 85, 350, 105), 1);
  7253. m_Print.DrawRect2(CRect(350, 85, 442, 105), 1);
  7254. m_Print.DrawRect2(CRect(442, 85, 535, 105), 1);
  7255. // 12.打印详细内容
  7256. int dty = 0;
  7257. int dtytemp = 0;
  7258. // for( i=10; i<14; i+=3)
  7259. //for( i=10; i<22; i+=3) // 循环4次,再画
  7260. int j = 0;
  7261. for (i = 10, j = 11; i<22; i += 3, j += 4) // 循环4次,再画
  7262. {
  7263. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  7264. CArray<CRect, CRect>rcarray;
  7265. CStringArray strarray2;
  7266. StrRect = load.m_rcarray.ElementAt(i);
  7267. StrRect.top += dty;
  7268. StrRect.bottom += dty;
  7269. StrRect.right -= 70; // Jeff add
  7270. //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;
  7271. /*
  7272. 4次的CRect
  7273. 66,105,350,125
  7274. 66,126,350,146
  7275. 66,147,350,167
  7276. 66,168,350,188
  7277. */
  7278. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  7279. {
  7280. StrRect = load.m_rcarray.ElementAt(i - 1);
  7281. StrRect.top += dty;
  7282. StrRect.bottom += dty;
  7283. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  7284. break;
  7285. }
  7286. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  7287. StrRect.left += 2;
  7288. StrRect.right -= 2;
  7289. StrRect.top += 4;
  7290. rcarray.Add(StrRect);
  7291. //strarray2.Add(pArray->ElementAt(i+1));
  7292. strarray2.Add(pArray->ElementAt(j));
  7293. //printf("Jeff:%d:%s\n\n",j,pArray->ElementAt(j));//Jeff Printf;
  7294. // 指定格子宽度,计算字符串占几行(高度).
  7295. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  7296. dtytemp = bottom - StrRect.bottom;
  7297. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7298. // 重新获取表格大小,并画出表格;
  7299. /*
  7300. CRect(66,85,280,105),
  7301. CRect(280,85,350,105)
  7302. CRect(350,85,442,105)
  7303. CRect(442,85,535,105)
  7304. CRect(66,105,350,125),
  7305. CRect(66,126,350,146)
  7306. CRect(66,147,350,167)
  7307. CRect(66,168,350,188)
  7308. */
  7309. // 画收款项目框及打印内容;
  7310. StrRect = load.m_rcarray.ElementAt(i);
  7311. //StrRect=CRect(66,85,280,105);
  7312. StrRect.bottom += dtytemp;
  7313. StrRect.top += dty;
  7314. StrRect.bottom += dty;
  7315. //StrRect.left -= 70; // Jeff add
  7316. StrRect.right -= 70; // Jeff add
  7317. //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;
  7318. m_Print.DrawRect2(StrRect, 1);
  7319. // 画支付方式框及打印内容;
  7320. StrRect = load.m_rcarray.ElementAt(i);
  7321. //StrRect=CRect(280,85,350,105);
  7322. StrRect.bottom += dtytemp;
  7323. StrRect.top += dty;
  7324. StrRect.bottom += dty;
  7325. StrRect.left += StrRect.Width() - 70;
  7326. //StrRect.right += 70; // Jeff add
  7327. //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;
  7328. m_Print.DrawRect2(StrRect, 1);
  7329. StrRect.left += 2;
  7330. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7331. //printf("Jeff:%d:%s\n\n",j+1,pArray->ElementAt(j+1));//Jeff Printf;
  7332. // 画金额框及打印内容;
  7333. StrRect = load.m_rcarray.ElementAt(i + 1);
  7334. //StrRect=CRect(350,85,442,105);
  7335. StrRect.top += dty;
  7336. StrRect.bottom += dty;
  7337. StrRect.bottom += dtytemp;
  7338. //StrRect.right -= 70; // Jeff add
  7339. //printf("Jeff:i=%d:left=%d,top=%d,right=%d,bottom=%d.\n\n",i,StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7340. m_Print.DrawRect2(StrRect, 1);
  7341. StrRect.left += 2;
  7342. // 打印出金额字段内容
  7343. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7344. //printf("Jeff:%d:%s\n\n",j+2,pArray->ElementAt(j+2));//Jeff Printf;
  7345. // 画开单人框及打印内容;
  7346. StrRect = load.m_rcarray.ElementAt(i + 2);
  7347. //StrRect=CRect(442,85,535,105);
  7348. StrRect.top += dty;
  7349. StrRect.bottom += dty;
  7350. StrRect.bottom += dtytemp;
  7351. //StrRect.right -= 70; // Jeff add
  7352. //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;
  7353. m_Print.DrawRect2(StrRect, 1);
  7354. StrRect.left += 2;
  7355. // 打印开单人字段内容
  7356. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 3), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7357. //printf("Jeff:%d:%s\n\n",j+3,pArray->ElementAt(j+3));//Jeff Printf;
  7358. dty += dtytemp;
  7359. }
  7360. //.打印->付款情况 应付 实付 欠款.
  7361. i = 22;
  7362. j = 27;
  7363. StrRect = load.m_rcarray.ElementAt(i);
  7364. StrRect.top += dty;
  7365. StrRect.bottom += dty;
  7366. m_Print.DrawRect2(StrRect, 1);
  7367. StrRect.left += 2;
  7368. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7369. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7370. //.打印->合计人民币(大写):.......
  7371. i = 23;
  7372. j = 28;
  7373. StrRect = load.m_rcarray.ElementAt(i);
  7374. StrRect.top += dty;
  7375. StrRect.bottom += dty;
  7376. m_Print.DrawRect2(StrRect, 1);
  7377. StrRect.left += 2;
  7378. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7379. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7380. // 打印总金额;
  7381. m_Print.SetFontFace(7, 1, "宋体");
  7382. for (i = 24, j = 29; i < 27; i++, j++)
  7383. {
  7384. StrRect = load.m_rcarray.ElementAt(i);
  7385. StrRect.top += dty;
  7386. StrRect.bottom += dty;
  7387. StrRect.left += 2;
  7388. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7389. }
  7390. StrRect = load.m_rcarray.ElementAt(24);
  7391. StrRect.top += dty;
  7392. StrRect.bottom += dty;
  7393. hei = StrRect.Height();
  7394. StrRect.top += hei;
  7395. StrRect.bottom += hei;
  7396. StrRect.right += 100;
  7397. StrRect.left += 2;
  7398. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  7399. AutoDraw(m_Print, StrRect, pArray->ElementAt(32), 1.0);
  7400. }
  7401. PrintPreview dlg;
  7402. dlg.m_mode = 3;
  7403. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  7404. dlg.m_pDC = m_Print.GetPDC();
  7405. if (aa == 0)
  7406. {
  7407. if (dlg.DoModal() != IDOK)
  7408. {
  7409. return;
  7410. }
  7411. printcot = dlg.m_num;
  7412. }
  7413. //结束打印
  7414. m_Print.EndPage();
  7415. m_Print.EndPrint();
  7416. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7417. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7418. CString sql;
  7419. sql.Format("update version set [serialno]='%s'", SerialNo);
  7420. g_sendhead.bsql = 1;
  7421. g_nYearposTemp = g_nYearpos;
  7422. g_nYearpos = -1;
  7423. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7424. g_nYearpos = g_nYearposTemp;
  7425. #endif
  7426. }
  7427. }
  7428. void CMainFrame::PrintReceipt_02(CStringArray *pArray, CPrintRX *pPrinter, const int &nCount, const BOOL bPrintImmediately) // 打印订单*预约收款、预约补款*
  7429. {
  7430. //AfxMessageBox("abce");
  7431. int printcot = 1;
  7432. // for(int aa=0; aa<printcot; aa++) // Jeff, printcot=1....
  7433. // {
  7434. g_sendhead.bsql = 0;
  7435. g_sendhead.code[0] = 24;
  7436. g_sendhead.tabcount = 1;
  7437. int g_nYearposTemp = g_nYearpos;
  7438. g_nYearpos = -1;
  7439. g_pMainWnd->ProcessChatMessageRequest2(1);
  7440. g_nYearpos = g_nYearposTemp;
  7441. if (0 == g_bSendOK)return;
  7442. DataToArray(&g_cominfoarray);
  7443. CString SerialNo;
  7444. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7445. CPrintRX *tagPrinter = NULL;
  7446. if (pPrinter == NULL)
  7447. {
  7448. // 1.创建打印对象
  7449. tagPrinter = new CPrintRX;
  7450. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7451. {
  7452. tagPrinter->InitToPrint(NULL, 1);
  7453. }
  7454. else
  7455. {
  7456. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  7457. if (name.IsEmpty())
  7458. {
  7459. tagPrinter->InitToPrint(NULL, 1);
  7460. }
  7461. else
  7462. {
  7463. int nret = tagPrinter->InitToPrint((char*)(LPCTSTR)name, 1);
  7464. ///if(nret==-1 && aa==0)
  7465. if (nret == -1)
  7466. {
  7467. if (bPrintImmediately == FALSE)
  7468. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  7469. tagPrinter->InitToPrint(NULL, 1);
  7470. }
  7471. }
  7472. }
  7473. // 2.开始打印
  7474. tagPrinter->StartPrint();
  7475. tagPrinter->StartPage();
  7476. }
  7477. else
  7478. {
  7479. //SerialNo.Format ("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126))+1);
  7480. tagPrinter = pPrinter;
  7481. }
  7482. LoadRect load;
  7483. BOOL bSmall = 0;
  7484. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  7485. {
  7486. bSmall = 1;
  7487. load.SetLiaPath("20.lia");
  7488. }
  7489. else
  7490. load.SetLiaPath("10.lia");
  7491. if (bSmall)
  7492. load.SetMargins(0, 0);
  7493. else
  7494. load.SetMargins(10, 0);
  7495. if (!load.Load())return;
  7496. int rcpos = -1;
  7497. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7498. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  7499. {
  7500. Image *pImg = NULL;
  7501. g_nSendCode = 31;
  7502. int g_nYearposTemp = g_nYearpos;
  7503. g_nYearpos = -1;
  7504. g_pMainWnd->ProcessChatMessageRequest2(1);
  7505. g_nYearpos = g_nYearposTemp;
  7506. g_nSendCode = 0;
  7507. if (g_bSendOK == 0)return;
  7508. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7509. if (pImg)
  7510. {
  7511. StrRect.left = 65;
  7512. if (bSmall) StrRect.left = 55;
  7513. StrRect.top = 10;
  7514. StrRect.right = StrRect.left + 58;
  7515. StrRect.bottom = StrRect.top + 58;
  7516. // 3.打印2维码图像;
  7517. tagPrinter->DrawImage(pImg, StrRect);
  7518. delete pImg;
  7519. pImg = NULL;
  7520. }
  7521. }
  7522. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  7523. if (bSmall)
  7524. {
  7525. tagPrinter->SetFontFace(18, 1, "黑体");
  7526. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7527. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7528. tagPrinter->SetFontFace(9, 1, "宋体");
  7529. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7530. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7531. tagPrinter->SetFontFace(6, 1, "宋体");
  7532. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7533. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7534. tagPrinter->SetFontFace(9, 1, "宋体");
  7535. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7536. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7537. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7538. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7539. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7540. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7541. int hei = StrRect.Height();
  7542. StrRect.bottom = StrRect.top;
  7543. StrRect.top -= 8;
  7544. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7545. tagPrinter->SetFontFace(11, 1, "宋体");
  7546. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7547. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7548. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7549. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7550. tagPrinter->SetFontFace(8, 1, "宋体");
  7551. int i = 0;
  7552. for (i = 7; i < 24; i++)
  7553. {
  7554. StrRect = load.m_rcarray.ElementAt(i);
  7555. tagPrinter->DrawRect2(StrRect, 1);
  7556. }
  7557. for (i = 9; i < 24; i++)
  7558. {
  7559. StrRect = load.m_rcarray.ElementAt(i);
  7560. StrRect.left += 2;
  7561. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7562. }
  7563. tagPrinter->SetFontFace(6, 1, "宋体");
  7564. for (i = 24; i < 26; i++)
  7565. {
  7566. StrRect = load.m_rcarray.ElementAt(i);
  7567. StrRect.left += 2;
  7568. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7569. }
  7570. StrRect = load.m_rcarray.ElementAt(22);
  7571. int nH = StrRect.Height();
  7572. int nW = StrRect.Width();
  7573. int nlen = load.m_rcarray.GetSize();
  7574. int nLeft = StrRect.left;
  7575. int j = 0;
  7576. for (i = 27; i<32; i++)
  7577. {
  7578. CRect rct = StrRect;
  7579. if(i == 31)
  7580. {
  7581. rct.top = rct.top + (nH*(j - 1));
  7582. rct.bottom = rct.top + nH;
  7583. rct.left = rct.left + 200;
  7584. rct.right = rct.left + 200;
  7585. }
  7586. else
  7587. {
  7588. rct.top = rct.top + (nH*j);
  7589. rct.bottom = rct.top + nH;
  7590. rct.left = rct.left + 2;
  7591. rct.right = rct.left + 200;
  7592. }
  7593. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), rct, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7594. j++;
  7595. }
  7596. }
  7597. else//大单
  7598. {
  7599. // 1.打印表头(蒙娜丽莎收款单)
  7600. tagPrinter->SetFontFace(20, 1, "黑体");
  7601. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7602. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7603. tagPrinter->SetFontFace(11, 1, "宋体");
  7604. // 2.打印订单号(NO.20140608-001)
  7605. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7606. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7607. // 3.打印SerialNo(SerialNo.01062)
  7608. int hei = StrRect.Height();
  7609. StrRect.bottom = StrRect.top;
  7610. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7611. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7612. // 4.打印影楼地址信息、电话;
  7613. tagPrinter->SetFontFace(8, 1, "宋体");
  7614. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7615. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7616. tagPrinter->SetFontFace(11, 1, "宋体");
  7617. // 5.打印客户姓名
  7618. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7619. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7620. // 6.打印客户联系电话
  7621. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7622. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7623. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7624. // 7.打印开单日期
  7625. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7626. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7627. #if 0 // Original Edition
  7628. // 8.打印列字段:收款项目
  7629. tagPrinter->SetFontFace(13, 1, "宋体");
  7630. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7631. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7632. printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7633. // 9.打印列字段:金额
  7634. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7635. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7636. printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7637. // 10.打印列字段:开单人
  7638. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7639. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7640. printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7641. #else
  7642. // 8.打印列字段:收款项目
  7643. tagPrinter->SetFontFace(13, 1, "宋体");
  7644. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7645. StrRect = CRect(66, 85, 280, 105);
  7646. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7647. //m_Print.DrawText("收款项目",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7648. // 8.1 Jeff add:支付方式
  7649. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7650. StrRect = CRect(280, 85, 350, 105);
  7651. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7652. //m_Print.DrawText("支付方式",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7653. // 9.打印列字段:金额
  7654. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7655. StrRect = CRect(350, 85, 442, 105);
  7656. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7657. //m_Print.DrawText("金额",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7658. // 10.打印列字段:开单人
  7659. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7660. StrRect = CRect(442, 85, 535, 105);
  7661. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7662. //m_Print.DrawText("开单人",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7663. //rcpos += 3;
  7664. #endif
  7665. // 11.画表格-画3列;old
  7666. // 11.draw 4 column
  7667. tagPrinter->SetFontFace(11, 1, "宋体");
  7668. int i;
  7669. //for( i=7; i<10; i++)
  7670. //{
  7671. // StrRect=load.m_rcarray.ElementAt(i);
  7672. // m_Print.DrawRect2(StrRect, 1);
  7673. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7674. //}
  7675. tagPrinter->DrawRect2(CRect(66, 85, 280, 105), 1);
  7676. tagPrinter->DrawRect2(CRect(280, 85, 350, 105), 1);
  7677. tagPrinter->DrawRect2(CRect(350, 85, 442, 105), 1);
  7678. tagPrinter->DrawRect2(CRect(442, 85, 535, 105), 1);
  7679. // 12.打印详细内容
  7680. int dty = 0;
  7681. int dtytemp = 0;
  7682. // for( i=10; i<14; i+=3)
  7683. //for( i=10; i<22; i+=3) // 循环4次,再画
  7684. int j = 0;
  7685. for (i = 10, j = 11; i<22; i += 3, j += 4) // 循环4次,再画
  7686. {
  7687. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  7688. CArray<CRect, CRect>rcarray;
  7689. CStringArray strarray2;
  7690. StrRect = load.m_rcarray.ElementAt(i);
  7691. StrRect.top += dty;
  7692. StrRect.bottom += dty;
  7693. StrRect.right -= 70; // Jeff add
  7694. //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;
  7695. /*
  7696. 4次的CRect
  7697. 66,105,350,125
  7698. 66,126,350,146
  7699. 66,147,350,167
  7700. 66,168,350,188
  7701. */
  7702. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  7703. {
  7704. StrRect = load.m_rcarray.ElementAt(i - 1);
  7705. StrRect.top += dty;
  7706. StrRect.bottom += dty;
  7707. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  7708. break;
  7709. }
  7710. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  7711. StrRect.left += 2;
  7712. StrRect.right -= 2;
  7713. StrRect.top += 4;
  7714. rcarray.Add(StrRect);
  7715. //strarray2.Add(pArray->ElementAt(i+1));
  7716. strarray2.Add(pArray->ElementAt(j));
  7717. //printf("Jeff:%d:%s\n\n",j,pArray->ElementAt(j));//Jeff Printf;
  7718. // 指定格子宽度,计算字符串占几行(高度).
  7719. INT bottom = CalcHeight(rcarray, strarray2, tagPrinter, FORMAT_LEFT);
  7720. dtytemp = bottom - StrRect.bottom;
  7721. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7722. // 重新获取表格大小,并画出表格;
  7723. /*
  7724. CRect(66,85,280,105),
  7725. CRect(280,85,350,105)
  7726. CRect(350,85,442,105)
  7727. CRect(442,85,535,105)
  7728. CRect(66,105,350,125),
  7729. CRect(66,126,350,146)
  7730. CRect(66,147,350,167)
  7731. CRect(66,168,350,188)
  7732. */
  7733. // 画收款项目框及打印内容;
  7734. StrRect = load.m_rcarray.ElementAt(i);
  7735. //StrRect=CRect(66,85,280,105);
  7736. StrRect.bottom += dtytemp;
  7737. StrRect.top += dty;
  7738. StrRect.bottom += dty;
  7739. //StrRect.left -= 70; // Jeff add
  7740. StrRect.right -= 70; // Jeff add
  7741. //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;
  7742. tagPrinter->DrawRect2(StrRect, 1);
  7743. // 画支付方式框及打印内容;
  7744. StrRect = load.m_rcarray.ElementAt(i);
  7745. //StrRect=CRect(280,85,350,105);
  7746. StrRect.bottom += dtytemp;
  7747. StrRect.top += dty;
  7748. StrRect.bottom += dty;
  7749. StrRect.left += StrRect.Width() - 70;
  7750. //StrRect.right += 70; // Jeff add
  7751. //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;
  7752. tagPrinter->DrawRect2(StrRect, 1);
  7753. StrRect.left += 2;
  7754. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7755. //printf("Jeff:%d:%s\n\n",j+1,pArray->ElementAt(j+1));//Jeff Printf;
  7756. // 画金额框及打印内容;
  7757. StrRect = load.m_rcarray.ElementAt(i + 1);
  7758. //StrRect=CRect(350,85,442,105);
  7759. StrRect.top += dty;
  7760. StrRect.bottom += dty;
  7761. StrRect.bottom += dtytemp;
  7762. //StrRect.right -= 70; // Jeff add
  7763. //printf("Jeff:i=%d:left=%d,top=%d,right=%d,bottom=%d.\n\n",i,StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7764. tagPrinter->DrawRect2(StrRect, 1);
  7765. StrRect.left += 2;
  7766. // 打印出金额字段内容
  7767. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7768. //printf("Jeff:%d:%s\n\n",j+2,pArray->ElementAt(j+2));//Jeff Printf;
  7769. // 画开单人框及打印内容;
  7770. StrRect = load.m_rcarray.ElementAt(i + 2);
  7771. //StrRect=CRect(442,85,535,105);
  7772. StrRect.top += dty;
  7773. StrRect.bottom += dty;
  7774. StrRect.bottom += dtytemp;
  7775. //StrRect.right -= 70; // Jeff add
  7776. //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;
  7777. tagPrinter->DrawRect2(StrRect, 1);
  7778. StrRect.left += 2;
  7779. // 打印开单人字段内容
  7780. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 3), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7781. //printf("Jeff:%d:%s\n\n",j+3,pArray->ElementAt(j+3));//Jeff Printf;
  7782. dty += dtytemp;
  7783. }
  7784. //.打印->付款情况 应付 实付 欠款.
  7785. i = 22;
  7786. j = 27;
  7787. StrRect = load.m_rcarray.ElementAt(i);
  7788. StrRect.top += dty;
  7789. StrRect.bottom += dty;
  7790. tagPrinter->DrawRect2(StrRect, 1);
  7791. StrRect.left += 2;
  7792. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7793. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7794. //.打印->合计人民币(大写):.......
  7795. i = 23;
  7796. j = 28;
  7797. StrRect = load.m_rcarray.ElementAt(i);
  7798. StrRect.top += dty;
  7799. StrRect.bottom += dty;
  7800. tagPrinter->DrawRect2(StrRect, 1);
  7801. StrRect.left += 2;
  7802. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7803. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7804. // 打印总金额;
  7805. tagPrinter->SetFontFace(7, 1, "宋体");
  7806. for (i = 24, j = 29; i < 27; i++, j++)
  7807. {
  7808. StrRect = load.m_rcarray.ElementAt(i);
  7809. StrRect.top += dty;
  7810. StrRect.bottom += dty;
  7811. StrRect.left += 2;
  7812. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7813. }
  7814. StrRect = load.m_rcarray.ElementAt(24);
  7815. StrRect.top += dty;
  7816. StrRect.bottom += dty;
  7817. hei = StrRect.Height();
  7818. StrRect.top += hei;
  7819. StrRect.bottom += hei;
  7820. StrRect.right += 100;
  7821. StrRect.left += 2;
  7822. StrRect = load.m_rcarray.ElementAt(27);
  7823. StrRect.top += dty;
  7824. StrRect.bottom += dty;
  7825. AutoDraw(*tagPrinter, StrRect, pArray->ElementAt(32), 1.0);
  7826. }
  7827. if (bPrintImmediately == TRUE)
  7828. {
  7829. printcot = nCount;
  7830. ////结束打印
  7831. tagPrinter->EndPage();
  7832. tagPrinter->EndPrint();
  7833. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7834. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7835. CString sql;
  7836. sql.Format("update version set [serialno]='%s'", SerialNo);
  7837. g_sendhead.bsql = 1;
  7838. g_nYearposTemp = g_nYearpos;
  7839. g_nYearpos = -1;
  7840. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7841. g_nYearpos = g_nYearposTemp;
  7842. #endif
  7843. }
  7844. else
  7845. {
  7846. PrintPreview dlg;
  7847. dlg.m_mode = 3;
  7848. tagPrinter->GetWidHei(dlg.m_w, dlg.m_h);
  7849. dlg.m_pDC = tagPrinter->GetPDC();
  7850. //if(aa==0)
  7851. //{
  7852. if (dlg.DoModal() != IDOK)
  7853. {
  7854. return;
  7855. }
  7856. else
  7857. {
  7858. printcot = dlg.m_num;
  7859. //m_Print.deletePrinter();
  7860. for (int i = 0; i < printcot; i++)
  7861. {
  7862. //tagPrinter->EndPage();
  7863. //tagPrinter->m_DC.AbortDoc(); // 结束清空由StartDoc写入的内容;2014-09-15;
  7864. //tagPrinter->m_DC.EndDoc();
  7865. //Sleep(10000);
  7866. //tagPrinter->StartPrint();
  7867. //tagPrinter->NewPage();
  7868. //PrintReceipt_02(pArray,/*tagPrinter*/NULL,printcot,TRUE);
  7869. PrintReceipt_02(pArray, tagPrinter, printcot, TRUE);
  7870. }
  7871. }
  7872. if (tagPrinter) delete tagPrinter;
  7873. //}
  7874. }
  7875. //}
  7876. }
  7877. void CMainFrame::PrintFlowChart(CString strOrderNumber) // 选片打单;
  7878. {
  7879. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(75)))
  7880. {
  7881. // Jeff 使用风格2打印;
  7882. //PrintFlowChart3_20151116(strOrderNumber);
  7883. PrintFlowChart3(strOrderNumber);
  7884. return;
  7885. }
  7886. #ifdef ZHIAI_VERSION
  7887. PrintFlowChart2(strOrderNumber);
  7888. return;
  7889. #endif
  7890. int i = 0;
  7891. int printcot = 1;
  7892. for (int aa = 0; aa < printcot; aa++)
  7893. {
  7894. CPrintRX m_Print;
  7895. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7896. {
  7897. m_Print.InitToPrint(NULL, 1);
  7898. }
  7899. else
  7900. {
  7901. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  7902. if (name.IsEmpty())
  7903. m_Print.InitToPrint(NULL, 1);
  7904. else
  7905. {
  7906. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  7907. if (nret == -1 && aa == 0)
  7908. {
  7909. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  7910. }
  7911. }
  7912. }
  7913. m_Print.StartPrint();
  7914. m_Print.StartPage();
  7915. // CRect StrRect(0,0,560,818);
  7916. LoadRect load;
  7917. load.SetLiaPath("4.lia");
  7918. load.SetMargins(-14, -14);
  7919. if (!load.Load())return;
  7920. LoadRect load2;
  7921. load2.SetMargins(-14, 472 + 27 - 14);
  7922. load2.SetLiaPath("5.lia");
  7923. if (!load2.Load())return;
  7924. //////////////////////////////////////////////////////////////
  7925. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2'";
  7926. g_sendhead.code[0] = 54;
  7927. g_sendhead.code[1] = 223;
  7928. g_sendhead.tabcount = 2;
  7929. g_sendhead.bsql = 0;
  7930. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  7931. CArray<CStringArray, CStringArray>sparray;
  7932. DataToArray(&g_List1array, &sparray);
  7933. CString spno;
  7934. for ( i = 0; i < sparray.GetSize(); i++)
  7935. {
  7936. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  7937. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  7938. if (sparray.ElementAt(i).ElementAt(5) == "入册" && sparray.ElementAt(i).ElementAt(5) == "入底" && sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  7939. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  7940. spno += sparray.ElementAt(i).ElementAt(5);
  7941. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  7942. spno += "; ";
  7943. else
  7944. {
  7945. spno += ":";
  7946. spno += sparray.ElementAt(i).ElementAt(6);
  7947. spno += "; ";
  7948. }
  7949. }
  7950. spno += " 加挑:";
  7951. for (i = 0; i < sparray.GetSize(); i++)
  7952. {
  7953. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  7954. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  7955. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  7956. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  7957. spno += sparray.ElementAt(i).ElementAt(5);
  7958. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  7959. spno += "; ";
  7960. else
  7961. {
  7962. spno += ":";
  7963. spno += sparray.ElementAt(i).ElementAt(6);
  7964. spno += "; ";
  7965. }
  7966. }
  7967. if (spno.Right(6) == " 加挑:")
  7968. {
  7969. spno = spno.Left(spno.GetLength() - 6);
  7970. }
  7971. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  7972. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  7973. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  7974. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  7975. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  7976. if (m_urgent.IsEmpty())m_urgent = "否";
  7977. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  7978. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  7979. // CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  7980. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  7981. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  7982. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  7983. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  7984. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  7985. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  7986. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  7987. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  7988. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(17) + g_List1array.ElementAt(0).ElementAt(29);
  7989. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  7990. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  7991. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  7992. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  7993. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  7994. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  7995. CString m_sum3;
  7996. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  7997. ::ConvertToPrice(m_sum3);
  7998. if (m_money3.IsEmpty())m_money3 = "0";
  7999. // m_money3=m_money3+"/"+m_sum3;
  8000. CString name;
  8001. if (!m_name1.IsEmpty())
  8002. name = m_name1 + ",";
  8003. name += m_name2;
  8004. name.TrimRight(",");
  8005. CString phone;
  8006. if (!m_phone1.IsEmpty())
  8007. phone = m_phone1 + ",";
  8008. phone += m_phone2; phone.TrimRight(",");
  8009. if (IsHasRights2new(31) == 0)
  8010. phone = "***";
  8011. CStringArray strarray;
  8012. strarray.Add(m_urgent);
  8013. strarray.Add(m_ren);
  8014. strarray.Add(m_waiter3);
  8015. strarray.Add(name);
  8016. strarray.Add(m_time2);
  8017. strarray.Add(m_time4);
  8018. strarray.Add(m_money3);
  8019. strarray.Add(m_sum3);
  8020. strarray.Add(m_takezs);
  8021. strarray.Add(m_taoxizs);
  8022. strarray.Add(m_choosezs);
  8023. strarray.Add(strOrderNumber);
  8024. strarray.Add(phone);
  8025. ////////////////////////////////////////////////////////////////
  8026. int rcpos = -1;
  8027. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8028. Image *pImg = NULL;
  8029. #ifdef MNLS_VERSION
  8030. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  8031. #else
  8032. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  8033. #endif
  8034. m_Print.DrawImage(pImg, StrRect);
  8035. delete pImg;
  8036. m_Print.SetFontFace(11, 1, "宋体");
  8037. StrRect = load2.m_rcarray.ElementAt(7);
  8038. StrRect.top = load2.m_rcarray.ElementAt(15).top - 15;
  8039. StrRect.bottom = load2.m_rcarray.ElementAt(15).bottom - 15;
  8040. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  8041. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8042. StrRect.top += 15;
  8043. StrRect.bottom += 15;
  8044. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  8045. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8046. m_Print.SetFontFace(15, 1, "宋体");
  8047. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8048. #ifdef MNLS_VERSION
  8049. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8050. #endif
  8051. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8052. #ifdef MNLS_VERSION
  8053. m_Print.DrawRect(StrRect);
  8054. #endif
  8055. m_Print.SetFontFace(7, 1, "黑体");
  8056. m_Print.SetColor(0xffffff);
  8057. #ifdef MNLS_VERSION
  8058. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8059. #endif
  8060. m_Print.SetColor(0);
  8061. m_Print.SetFontFace(25, 1, "黑体");
  8062. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8063. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8064. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  8065. {
  8066. Image *pImg = NULL;
  8067. g_nSendCode = 31;
  8068. int g_nYearposTemp = g_nYearpos;
  8069. g_nYearpos = -1;
  8070. g_pMainWnd->ProcessChatMessageRequest2(1);
  8071. g_nYearpos = g_nYearposTemp;
  8072. g_nSendCode = 0;
  8073. if (g_bSendOK == 0)return;
  8074. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8075. if (pImg)
  8076. {
  8077. StrRect.left = 450;
  8078. StrRect.top = 22;
  8079. StrRect.right = StrRect.left + 60;
  8080. StrRect.bottom = StrRect.top + 60;
  8081. m_Print.DrawImage(pImg, StrRect);
  8082. delete pImg; pImg = NULL;
  8083. }
  8084. }
  8085. #ifdef CHILD_VERSION
  8086. CString title[13] = { "是否加急:", "接单门市:", \
  8087. "选样人员:", "客人姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  8088. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:"
  8089. };
  8090. #else
  8091. CString title[13] = { "是否加急:", "接单门市:", \
  8092. "选样人员:", "新郎新娘姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  8093. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:" };
  8094. #endif
  8095. m_Print.SetFontFace(12, 1, "宋体");
  8096. for (i = 0; i < 13; i++)
  8097. {
  8098. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8099. if (i < 3)
  8100. m_Print.DrawRect2(StrRect, 0);
  8101. else
  8102. m_Print.DrawRect2(StrRect, 1);
  8103. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8104. }
  8105. for (i = 18; i <= 37; i++)
  8106. {
  8107. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8108. if (i >= 19 && i <= 21)
  8109. m_Print.DrawRect2(StrRect, 2);
  8110. /* else if(i==26)
  8111. {
  8112. CRect rc=StrRect;
  8113. CRect rc2=rc;
  8114. rc.right -=rc2.Width ()/2;
  8115. m_Print.DrawRect2(rc, 1);
  8116. rc2.left +=rc.Width ();
  8117. m_Print.DrawRect2(rc2, 1);
  8118. }*/
  8119. else
  8120. m_Print.DrawRect2(StrRect, 1);
  8121. if (i == 18)
  8122. {
  8123. StrRect.left += 5;
  8124. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8125. }
  8126. }
  8127. //////////////////////////////////////
  8128. rcpos = -1;
  8129. for (i = 0; i < 8; i++)
  8130. {
  8131. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8132. m_Print.DrawRect2(StrRect, 1);
  8133. }
  8134. #ifdef CHILD_VERSION
  8135. CString title2[4] = { "引导师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  8136. #else
  8137. CString title2[4] = { "化妆师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  8138. #endif
  8139. for (i = 0; i < 4; i++)
  8140. {
  8141. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8142. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8143. }
  8144. for (i = 0; i < 4; i++)
  8145. {
  8146. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8147. m_Print.DrawRect2(StrRect, 2);
  8148. }
  8149. StrRect = load2.m_rcarray.ElementAt(11);
  8150. StrRect.top -= 15;
  8151. StrRect.bottom -= 15;
  8152. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客选片签名:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8153. StrRect = load2.m_rcarray.ElementAt(15);
  8154. StrRect.top -= 15;
  8155. StrRect.bottom -= 15;
  8156. m_Print.DrawRect2(StrRect, 2);
  8157. ///////////////////////////////////////////
  8158. for (i = 19; i <= 31; i++)
  8159. {
  8160. StrRect = load.m_rcarray.ElementAt(i - 1);
  8161. StrRect.left += 4;
  8162. if (i == 31)
  8163. {
  8164. if (m_phone1.IsEmpty() == 0 && m_phone2.IsEmpty() == 0)
  8165. {
  8166. StrRect.top += 2;
  8167. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  8168. StrRect.top += 8;
  8169. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8170. }
  8171. else
  8172. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8173. }
  8174. /* else if((i-19)==7)
  8175. {
  8176. CRect rc=StrRect;
  8177. CRect rc2=rc;
  8178. rc.right -=rc2.Width ()/2;
  8179. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8180. rc2.left +=rc.Width ()+3;
  8181. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8182. }*/
  8183. else
  8184. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8185. }
  8186. strarray.RemoveAll();
  8187. strarray.Add(m_waiter2);
  8188. strarray.Add(m_waiter1);
  8189. strarray.Add(m_waiter4);
  8190. for (i = 13; i <= 15; i++)
  8191. {
  8192. StrRect = load2.m_rcarray.ElementAt(i - 1);
  8193. StrRect.left += 4;
  8194. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8195. }
  8196. ///////////spno
  8197. CRect sprc[14];
  8198. for (i = 0; i < 14; i++)
  8199. {
  8200. if (i < 7)
  8201. {
  8202. if (i == 0)
  8203. {
  8204. StrRect = load.m_rcarray.ElementAt(17); StrRect.left += 94; StrRect.right -= 3;
  8205. }
  8206. else
  8207. {
  8208. StrRect = load.m_rcarray.ElementAt(30 + i); StrRect.left += 4; StrRect.right -= 3;
  8209. }
  8210. }
  8211. else
  8212. {
  8213. StrRect = load2.m_rcarray.ElementAt(i - 7); StrRect.left += 4; StrRect.right -= 3;
  8214. }
  8215. sprc[i] = StrRect;
  8216. }
  8217. CString temp, tempspno, tempbz;
  8218. CSize size;
  8219. BOOL bRun = 0;
  8220. int fontsize = 12;
  8221. ll: tempspno = spno;
  8222. tempbz = m_bz;
  8223. m_Print.SetFontFace(fontsize, 1, "宋体");
  8224. for (i = 0; i<14; i++)
  8225. {
  8226. if (!tempspno.IsEmpty())
  8227. {
  8228. temp = tempspno;
  8229. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8230. int right = 0;
  8231. CRect temprc = sprc[i];
  8232. while (size.cx>temprc.Width())
  8233. {
  8234. right++;
  8235. temp = tempspno.Left(tempspno.GetLength() - (right));
  8236. if (GIsHalfHZ(temp))
  8237. {
  8238. right++;
  8239. temp.Delete(temp.GetLength() - 1);
  8240. }
  8241. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8242. }
  8243. if (bRun)
  8244. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8245. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  8246. if (tempspno.IsEmpty())i++;
  8247. }
  8248. else if (!tempbz.IsEmpty())
  8249. {
  8250. temp = tempbz;
  8251. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8252. int right = 0;
  8253. CRect temprc = sprc[i];
  8254. while (size.cx > temprc.Width())
  8255. {
  8256. right++;
  8257. temp = tempbz.Left(tempbz.GetLength() - (right));
  8258. if (GIsHalfHZ(temp))
  8259. {
  8260. right++;
  8261. temp.Delete(temp.GetLength() - 1);
  8262. }
  8263. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8264. }
  8265. if (bRun)
  8266. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8267. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  8268. }
  8269. }
  8270. if (tempspno.IsEmpty() == 0 || tempbz.IsEmpty() == 0)
  8271. {
  8272. fontsize--;
  8273. goto ll;
  8274. }
  8275. if (bRun == 0)
  8276. {
  8277. bRun = 1;
  8278. goto ll;
  8279. }
  8280. PrintPreview dlg;
  8281. dlg.m_mode = 2;
  8282. dlg.m_name = name;
  8283. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8284. dlg.m_pDC = m_Print.GetPDC();
  8285. if (aa == 0)
  8286. {
  8287. if (dlg.DoModal() != IDOK)
  8288. return;
  8289. printcot = dlg.m_num;
  8290. }
  8291. //结束打印
  8292. m_Print.EndPage();
  8293. m_Print.EndPrint();
  8294. }
  8295. }
  8296. void CMainFrame::PrintFlowChart3LKAY(CString strOrderNumber)
  8297. {
  8298. int i = 0;
  8299. int printcot = 1;
  8300. for (int aa = 0; aa < printcot; aa++)
  8301. {
  8302. CPrintRX m_Print;
  8303. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  8304. {
  8305. m_Print.InitToPrint(NULL, 1);
  8306. }
  8307. else
  8308. {
  8309. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  8310. if (name.IsEmpty())
  8311. m_Print.InitToPrint(NULL, 1);
  8312. else
  8313. {
  8314. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8315. if (nret == -1 && aa == 0)
  8316. {
  8317. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8318. }
  8319. }
  8320. }
  8321. m_Print.StartPrint();
  8322. m_Print.StartPage();
  8323. LoadRect load;
  8324. load.SetLiaPath("18.lia");
  8325. load.SetMargins(10, 0);
  8326. if (!load.Load())return;
  8327. CString str;
  8328. int rcpos = -1;
  8329. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8330. m_Print.SetFontFace(25, 1, "宋体");
  8331. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8332. m_Print.SetFontFace(15, 1, "宋体");
  8333. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8334. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8335. m_Print.SetFontFace(9, 1, "宋体");
  8336. //////////////////////////////////////////////////////////////
  8337. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8338. g_sendhead.code[0] = 54;
  8339. g_sendhead.code[1] = 223;
  8340. g_sendhead.code[2] = 52;
  8341. g_sendhead.tabcount = 3;
  8342. g_sendhead.bsql = 0;
  8343. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  8344. CArray<CStringArray, CStringArray>sparray;
  8345. CArray<CStringArray, CStringArray>clientarray;
  8346. DataToArray(&g_List1array, &sparray, &clientarray);
  8347. CString spno;
  8348. CStringArray sparray2;
  8349. for ( i = 0; i < sparray.GetSize(); i++)
  8350. {
  8351. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8352. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8353. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8354. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8355. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8356. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8357. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8358. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8359. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8360. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8361. }
  8362. for (i = 0; i < sparray.GetSize(); i++)
  8363. {
  8364. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8365. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8366. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8367. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8368. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8369. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8370. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8371. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8372. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8373. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8374. }
  8375. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8376. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8377. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8378. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8379. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8380. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8381. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8382. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8383. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8384. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8385. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8386. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8387. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8388. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8389. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8390. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8391. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8392. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8393. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8394. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8395. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8396. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8397. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8398. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8399. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8400. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8401. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8402. CString m_sum3;
  8403. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8404. ::ConvertToPrice(m_sum3);
  8405. if (m_money3.IsEmpty())m_money3 = "0";
  8406. int dty = 0;
  8407. CString name;
  8408. if (!m_name1.IsEmpty())
  8409. name = m_name1 + ",";
  8410. name += m_name2;
  8411. name.TrimRight(",");
  8412. CString phone;
  8413. if (!m_phone1.IsEmpty())
  8414. phone = m_phone1 + ",";
  8415. phone += m_phone2; phone.TrimRight(",");
  8416. if (IsHasRights2new(31) == 0)
  8417. phone = "***";
  8418. CStringArray strarray;
  8419. #ifdef CHILD_VERSION
  8420. if (m_birthday.IsEmpty())
  8421. strarray.Add("姓名/性别");
  8422. else
  8423. strarray.Add("姓名/性别/年龄");
  8424. #else
  8425. strarray.Add("客人姓名");
  8426. #endif
  8427. strarray.Add("电话");
  8428. strarray.Add("单号");
  8429. strarray.Add("套系");
  8430. strarray.Add("选样");
  8431. strarray.Add("余款/加挑");
  8432. strarray.Add("选片/日期");
  8433. #ifdef CHILD_VERSION
  8434. if (m_birthday.IsEmpty())
  8435. strarray.Add(name + "/" + m_sex);
  8436. else
  8437. {
  8438. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8439. m_birthday.Format("%d", year + 1);
  8440. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8441. }
  8442. #else
  8443. strarray.Add(name);
  8444. #endif
  8445. strarray.Add(phone);
  8446. strarray.Add(strOrderNumber);
  8447. strarray.Add(m_taoxiname);
  8448. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8449. strarray.Add(str);
  8450. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8451. strarray.Add(str);
  8452. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8453. for (i = 3; i <= 16; i++)
  8454. {
  8455. StrRect = load.m_rcarray.ElementAt(i - 1);
  8456. if (i < 10)
  8457. {
  8458. m_Print.DrawRect2(StrRect, 1);
  8459. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8460. }
  8461. }
  8462. StrRect = load.m_rcarray.ElementAt(29);
  8463. m_Print.DrawRect2(StrRect, 1);
  8464. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8465. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  8466. {
  8467. Image *pImg = NULL;
  8468. g_nSendCode = 31;
  8469. int g_nYearposTemp = g_nYearpos;
  8470. g_nYearpos = -1;
  8471. g_pMainWnd->ProcessChatMessageRequest2(1);
  8472. g_nYearpos = g_nYearposTemp;
  8473. g_nSendCode = 0;
  8474. if (g_bSendOK == 0)return;
  8475. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8476. if (pImg)
  8477. {
  8478. StrRect.left = 485;
  8479. StrRect.top = 12;
  8480. StrRect.right = StrRect.left + 60;
  8481. StrRect.bottom = StrRect.top + 60;
  8482. m_Print.DrawImage(pImg, StrRect);
  8483. delete pImg; pImg = NULL;
  8484. }
  8485. }
  8486. CArray<CRect, CRect>rcarray;
  8487. CStringArray strarray2;
  8488. for (i = 10; i <= 16; i++)
  8489. {
  8490. StrRect = load.m_rcarray.ElementAt(i - 1);
  8491. StrRect.left += 2;
  8492. StrRect.right -= 2;
  8493. StrRect.top += 2;
  8494. rcarray.Add(StrRect);
  8495. strarray2.Add(strarray.ElementAt(7 + i - 10));
  8496. }
  8497. if (1)
  8498. {
  8499. StrRect = load.m_rcarray.ElementAt(30);
  8500. StrRect.left += 2;
  8501. StrRect.right -= 2;
  8502. StrRect.top += 2;
  8503. rcarray.Add(StrRect);
  8504. strarray2.Add(m_time6 + "/" + m_time5);
  8505. }
  8506. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8507. for (i = 10; i <= 16; i++)
  8508. {
  8509. StrRect = load.m_rcarray.ElementAt(i - 1);
  8510. if (i == 10)
  8511. {
  8512. dty += bottom - StrRect.bottom;
  8513. }
  8514. StrRect.bottom = bottom;
  8515. m_Print.DrawRect2(StrRect, 1);
  8516. }
  8517. if (1)
  8518. {
  8519. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  8520. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  8521. // m_Print.DrawText((LPTSTR)(LPCTSTR)(m_time6+"/"+m_time5), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER );
  8522. }
  8523. m_Print.SetFontFace(15, 1, "宋体");
  8524. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  8525. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8526. m_Print.SetFontFace(9, 1, "宋体");
  8527. strarray.RemoveAll();
  8528. strarray.Add("产品名称");
  8529. strarray.Add("数量");
  8530. strarray.Add("P数");
  8531. strarray.Add("张数");
  8532. strarray.Add("照片编号");
  8533. CArray<CRect, CRect>rc2array;
  8534. int wid = 25;
  8535. for (i = 18; i <= 22; i++)
  8536. {
  8537. StrRect = load.m_rcarray.ElementAt(i - 1);
  8538. if (i == 19)
  8539. {
  8540. StrRect.right = StrRect.left + wid;
  8541. }
  8542. if (i == 20)
  8543. {
  8544. StrRect = load.m_rcarray.ElementAt(i - 2);
  8545. StrRect.left += wid; StrRect.right = StrRect.left;
  8546. StrRect.right += wid;
  8547. }
  8548. if (i == 21)
  8549. {
  8550. StrRect = load.m_rcarray.ElementAt(i - 3);
  8551. StrRect.left += wid * 2; StrRect.right = StrRect.left;
  8552. StrRect.right += wid;
  8553. wid = StrRect.right;
  8554. }
  8555. if (i == 22)
  8556. {
  8557. StrRect = load.m_rcarray.ElementAt(i - 3);
  8558. StrRect.left = wid;
  8559. }
  8560. StrRect.top += dty; StrRect.bottom += dty;
  8561. m_Print.DrawRect2(StrRect, 1);
  8562. StrRect.left += 2;
  8563. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8564. StrRect.left -= 2;
  8565. StrRect.top = StrRect.bottom;
  8566. StrRect.bottom += 18;
  8567. rc2array.Add(StrRect);
  8568. }
  8569. int curypos = 0;
  8570. for (i = 0; i < sparray2.GetSize(); i += 5)
  8571. {
  8572. rcarray.RemoveAll();
  8573. strarray2.RemoveAll();
  8574. int j = 0;
  8575. for ( j = 0; j < 5; j++)
  8576. {
  8577. StrRect = rc2array.ElementAt(j);
  8578. StrRect.left += 2;
  8579. StrRect.right -= 2;
  8580. StrRect.top += 2;
  8581. rcarray.Add(StrRect);
  8582. strarray2.Add(sparray2.ElementAt(i + j));
  8583. }
  8584. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8585. rcarray.RemoveAll();
  8586. for (j = 0; j < 5; j++)
  8587. {
  8588. StrRect = rc2array.ElementAt(j);
  8589. if (j == 0)
  8590. {
  8591. dty += bottom - StrRect.bottom;
  8592. }
  8593. StrRect.bottom = bottom;
  8594. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8595. StrRect.top = StrRect.bottom;
  8596. StrRect.bottom += 18;
  8597. rcarray.Add(StrRect);
  8598. }
  8599. rc2array.RemoveAll();
  8600. rc2array.Copy(rcarray);
  8601. }
  8602. m_Print.SetFontFace(15, 1, "宋体");
  8603. StrRect = load.m_rcarray.ElementAt(20);
  8604. dty = curypos - StrRect.bottom + 35;
  8605. StrRect.top += dty; StrRect.bottom += dty;
  8606. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8607. m_Print.SetFontFace(9, 1, "宋体");
  8608. rcarray.RemoveAll();
  8609. strarray2.RemoveAll();
  8610. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8611. StrRect.left += 2;
  8612. StrRect.right -= 2;
  8613. StrRect.top += 2;
  8614. rcarray.Add(StrRect);
  8615. strarray2.Add(m_bz);
  8616. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8617. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8618. dty += bottom - StrRect.bottom;
  8619. StrRect.bottom = bottom;
  8620. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8621. m_Print.SetFontFace(10, 1, "宋体");
  8622. StrRect = load.m_rcarray.ElementAt(22);
  8623. dty = curypos - StrRect.bottom + 25;
  8624. StrRect.top += dty; StrRect.bottom += dty;
  8625. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  8626. if (m_edit9.IsEmpty())
  8627. {
  8628. m_edit9 = "\
  8629. 经确认后的照片均排入制作流程,\r\n\
  8630. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  8631. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  8632. }
  8633. CString info1, info2, info3;
  8634. int newlinepos = m_edit9.Find("\r\n");
  8635. if (newlinepos != -1)
  8636. {
  8637. info1 = m_edit9.Left(newlinepos);
  8638. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8639. }
  8640. newlinepos = m_edit9.Find("\r\n");
  8641. if (newlinepos != -1)
  8642. {
  8643. info2 = m_edit9.Left(newlinepos);
  8644. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8645. info3 = m_edit9;
  8646. }
  8647. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8648. StrRect = load.m_rcarray.ElementAt(23);
  8649. StrRect.top += dty; StrRect.bottom += dty;
  8650. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8651. StrRect = load.m_rcarray.ElementAt(24);
  8652. StrRect.top += dty; StrRect.bottom += dty;
  8653. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8654. StrRect.top += 15;
  8655. StrRect.bottom += 15;
  8656. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8657. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  8658. StrRect = load.m_rcarray.ElementAt(25);
  8659. StrRect.top += dty - dy;
  8660. StrRect.bottom += dty - dy;
  8661. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8662. StrRect = load.m_rcarray.ElementAt(26);
  8663. StrRect.top += dty - dy;
  8664. StrRect.bottom += dty - dy;
  8665. m_Print.DrawRect2(StrRect, 2);
  8666. StrRect = load.m_rcarray.ElementAt(25);
  8667. StrRect.top += dty + 15 - dy;
  8668. StrRect.bottom += dty + 15 - dy;
  8669. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8670. StrRect = load.m_rcarray.ElementAt(26);
  8671. StrRect.top += dty + 15 - dy;
  8672. StrRect.bottom += dty + 15 - dy;
  8673. m_Print.DrawRect2(StrRect, 2);
  8674. StrRect = load.m_rcarray.ElementAt(25);
  8675. StrRect.top += dty + 15 * 2 - dy;
  8676. StrRect.bottom += dty + 15 * 2 - dy;
  8677. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8678. StrRect = load.m_rcarray.ElementAt(26);
  8679. StrRect.top += dty + 15 * 2 - dy;
  8680. StrRect.bottom += dty + 15 * 2 - dy;
  8681. m_Print.DrawRect2(StrRect, 2);
  8682. PrintPreview dlg; dlg.m_mode = 2;
  8683. dlg.m_name = name;
  8684. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8685. dlg.m_pDC = m_Print.GetPDC();
  8686. if (aa == 0)
  8687. {
  8688. if (dlg.DoModal() != IDOK)
  8689. return;
  8690. printcot = dlg.m_num;
  8691. }
  8692. //结束打印
  8693. m_Print.EndPage();
  8694. m_Print.EndPrint();
  8695. }
  8696. }
  8697. void CMainFrame::PrintFlowChart3(CString strOrderNumber) // 选片打单 风格2;
  8698. {
  8699. #ifdef LKAY_VERSION
  8700. PrintFlowChart3LKAY(strOrderNumber);
  8701. return;
  8702. #endif
  8703. int i = 0;
  8704. int j = 0;
  8705. int printcot = 1;
  8706. for (int aa = 0; aa < printcot; aa++)
  8707. {
  8708. BOOL bSecondPage = 0;
  8709. int nPrintedPos = 0;
  8710. for (int bb = 0; bb < 2; bb++)
  8711. {
  8712. if (bb && bSecondPage == 0)break;
  8713. CPrintRX m_Print;
  8714. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58))) // 58-[version].[setcheck1] ==1,使用默认打印机;
  8715. {
  8716. m_Print.InitToPrint(NULL, 1);
  8717. }
  8718. else // 否则使用指定的打印机;
  8719. {
  8720. CString name = g_cominfoarray.ElementAt(0).ElementAt(64); // 64-[version].[printer2] 制作单打印机;
  8721. if (name.IsEmpty())
  8722. m_Print.InitToPrint(NULL, 1);
  8723. else
  8724. {
  8725. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8726. if (nret == -1 && aa == 0)
  8727. {
  8728. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8729. }
  8730. }
  8731. }
  8732. m_Print.StartPrint();
  8733. m_Print.StartPage();
  8734. LoadRect load;
  8735. load.SetLiaPath("18.lia");
  8736. load.SetMargins(10, 0);
  8737. if (!load.Load())return;
  8738. CString str;
  8739. int rcpos = -1;
  8740. // ■■■■■■从18.lia获取到第一个区域大小 - 1.显示店名;
  8741. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8742. if ((bb == 0 && bSecondPage == 0))
  8743. {
  8744. m_Print.SetFontFace(25, 1, "宋体");
  8745. // 10-[version].[info1] 店名;
  8746. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8747. m_Print.SetFontFace(15, 1, "宋体");
  8748. // ■■■■■■从18.lia获取第二个区域大小 - 2.显示"基本资料";
  8749. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8750. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8751. m_Print.SetFontFace(9, 1, "宋体");
  8752. }
  8753. //////////////////////////////////////////////////////////////
  8754. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8755. g_sendhead.code[0] = 54; // dindan;
  8756. g_sendhead.code[1] = 223; // dindanspview2; shangpin+dindansp;
  8757. g_sendhead.code[2] = 52; // client;
  8758. g_sendhead.tabcount = 3;
  8759. g_sendhead.bsql = 0;
  8760. g_pMainWnd->ProcessChatMessageRequest2(filter);
  8761. if (g_bSendOK == 0)return;
  8762. CArray<CStringArray, CStringArray>sparray;
  8763. CArray<CStringArray, CStringArray>clientarray;
  8764. DataToArray(&g_List1array, &sparray, &clientarray);
  8765. CString spno;
  8766. CStringArray sparray2;
  8767. for ( i = 0; i < sparray.GetSize(); i++)
  8768. {
  8769. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8770. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8771. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8772. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8773. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8774. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8775. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8776. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8777. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8778. }
  8779. for (i = 0; i < sparray.GetSize(); i++)
  8780. {
  8781. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8782. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8783. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8784. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8785. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8786. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8787. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8788. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8789. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8790. }
  8791. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8792. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8793. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8794. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8795. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8796. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8797. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8798. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8799. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8800. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8801. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8802. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8803. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8804. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8805. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8806. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8807. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8808. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8809. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  8810. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8811. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8812. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8813. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8814. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8815. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8816. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8817. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8818. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8819. CString m_sum3;
  8820. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8821. ::ConvertToPrice(m_sum3);
  8822. if (m_money3.IsEmpty())m_money3 = "0";
  8823. int dty = 0;
  8824. CString name;
  8825. if (!m_name1.IsEmpty())
  8826. name = m_name1 + ",";
  8827. name += m_name2;
  8828. name.TrimRight(",");
  8829. CString phone;
  8830. if (!m_phone1.IsEmpty())
  8831. phone = m_phone1 + ",";
  8832. phone += m_phone2; phone.TrimRight(",");
  8833. if (IsHasRights2new(31) == 0)
  8834. phone = "***";
  8835. CStringArray strarray;
  8836. CArray<CRect, CRect>rcarray;
  8837. CStringArray strarray2; CArray<CRect, CRect>rc2array;
  8838. int bottom;
  8839. if ((bb == 0 && bSecondPage == 0))
  8840. {
  8841. #ifdef CHILD_VERSION
  8842. if (m_birthday.IsEmpty())
  8843. strarray.Add("姓名/性别");
  8844. else
  8845. strarray.Add("姓名/性别/年龄");
  8846. #else
  8847. strarray.Add("客人姓名"); // 第3.1区域 -3.显示客人姓名;
  8848. #endif
  8849. strarray.Add("电话");
  8850. strarray.Add("单号");
  8851. strarray.Add("套系");
  8852. strarray.Add("选样");
  8853. strarray.Add("余款/加挑");
  8854. strarray.Add("选片/日期");
  8855. #ifdef CHILD_VERSION
  8856. if (m_birthday.IsEmpty())
  8857. strarray.Add(name + "/" + m_sex);
  8858. else
  8859. {
  8860. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8861. m_birthday.Format("%d", year + 1);
  8862. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8863. }
  8864. #else
  8865. strarray.Add(name); // 第4.1区域 -3.显示客人姓名;
  8866. #endif
  8867. strarray.Add(phone);
  8868. strarray.Add(strOrderNumber);
  8869. strarray.Add(m_taoxiname);
  8870. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8871. strarray.Add(str);
  8872. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8873. strarray.Add(str);
  8874. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8875. for (i = 3; i <= 16; i++)
  8876. {
  8877. // ■■■■■■从18.lia中获取第3~16的区域大小;
  8878. StrRect = load.m_rcarray.ElementAt(i - 1);
  8879. if (i < 10)
  8880. {
  8881. m_Print.DrawRect2(StrRect, 1);
  8882. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8883. }
  8884. }
  8885. // ■■■■■■从18.lia中获取第30的区域大小;
  8886. StrRect = load.m_rcarray.ElementAt(29);
  8887. m_Print.DrawRect2(StrRect, 1);
  8888. BOOL bPrintDate = 1;
  8889. #ifdef DDF_VERSION
  8890. // bPrintDate=0;
  8891. #else
  8892. if (m_time5 == "" && m_time6 == "")
  8893. bPrintDate = 0;
  8894. #endif
  8895. if (bPrintDate)
  8896. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8897. else
  8898. {
  8899. #ifdef CHILD_VERSION
  8900. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/引导", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8901. #else
  8902. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/化妆", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8903. #endif
  8904. }
  8905. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138))) // [version].[reverse3]
  8906. {
  8907. Image *pImg = NULL;
  8908. g_nSendCode = 31;
  8909. int g_nYearposTemp = g_nYearpos;
  8910. g_nYearpos = -1;
  8911. g_pMainWnd->ProcessChatMessageRequest2(1);
  8912. g_nYearpos = g_nYearposTemp;
  8913. g_nSendCode = 0;
  8914. if (g_bSendOK == 0)return;
  8915. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8916. // Jeff二维码的区域不是从18.lia里获取的,是固定在右上角指定区域;
  8917. if (pImg)
  8918. {
  8919. StrRect.left = 485;
  8920. StrRect.top = 12;
  8921. StrRect.right = StrRect.left + 60;
  8922. StrRect.bottom = StrRect.top + 60;
  8923. m_Print.DrawImage(pImg, StrRect);
  8924. delete pImg; pImg = NULL;
  8925. }
  8926. }
  8927. // CArray<CRect,CRect>rcarray;
  8928. // CStringArray strarray2;
  8929. // ■■■■■■从18.lia中获取第10的区域大小;
  8930. for (i = 10; i <= 16; i++)
  8931. {
  8932. StrRect = load.m_rcarray.ElementAt(i - 1);
  8933. StrRect.left += 2;
  8934. StrRect.right -= 2;
  8935. StrRect.top += 2;
  8936. rcarray.Add(StrRect);
  8937. strarray2.Add(strarray.ElementAt(7 + i - 10));
  8938. }
  8939. if (1)
  8940. {
  8941. // ■■■■■■从18.lia中获取第31的区域大小;
  8942. StrRect = load.m_rcarray.ElementAt(30);
  8943. StrRect.left += 2;
  8944. StrRect.right -= 2;
  8945. StrRect.top += 2;
  8946. rcarray.Add(StrRect);
  8947. if (bPrintDate)
  8948. strarray2.Add(m_time6 + "/" + m_time5);
  8949. else
  8950. {
  8951. strarray2.Add(m_waiter1 + "/" + m_waiter2);
  8952. }
  8953. }
  8954. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  8955. for (i = 10; i <= 16; i++)
  8956. {
  8957. StrRect = load.m_rcarray.ElementAt(i - 1);
  8958. if (i == 10)
  8959. {
  8960. dty += bottom - StrRect.bottom;
  8961. }
  8962. StrRect.bottom = bottom;
  8963. m_Print.DrawRect2(StrRect, 1);
  8964. }
  8965. if (1)
  8966. {
  8967. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  8968. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  8969. }
  8970. m_Print.SetFontFace(15, 1, "宋体");
  8971. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  8972. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8973. }
  8974. int curypos = 0;
  8975. int oldpos = 0;
  8976. if (bb == 1)
  8977. {
  8978. dty = -100;
  8979. oldpos = nPrintedPos;
  8980. if (oldpos == 0)oldpos = 10000;
  8981. }
  8982. m_Print.SetFontFace(9, 1, "宋体");
  8983. strarray.RemoveAll();
  8984. if ((oldpos != 10000 && oldpos < sparray2.GetSize()) || bb == 0)
  8985. {
  8986. strarray.Add("产品名称");
  8987. strarray.Add("数量");
  8988. strarray.Add("照片编号");
  8989. for (i = 18; i <= 20; i++)
  8990. {
  8991. StrRect = load.m_rcarray.ElementAt(i - 1);
  8992. StrRect.top += dty;
  8993. StrRect.bottom += dty;
  8994. m_Print.DrawRect2(StrRect, 1);
  8995. StrRect.left += 2;
  8996. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8997. StrRect.left -= 2;
  8998. StrRect.top = StrRect.bottom;
  8999. StrRect.bottom += 18;
  9000. rc2array.Add(StrRect);
  9001. }
  9002. }
  9003. for (i = oldpos; i < sparray2.GetSize(); i += 3)
  9004. {
  9005. rcarray.RemoveAll();
  9006. strarray2.RemoveAll();
  9007. for ( j = 0; j < 3; j++)
  9008. {
  9009. StrRect = rc2array.ElementAt(j);
  9010. StrRect.left += 2;
  9011. StrRect.right -= 2;
  9012. StrRect.top += 2;
  9013. rcarray.Add(StrRect);
  9014. #if JEFF_TEST_ON
  9015. if (2 == j)
  9016. {
  9017. CString strImg = sparray2.ElementAt(i + 2);
  9018. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  9019. if (nImgCount != 0)
  9020. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  9021. else if (!strImg.IsEmpty())
  9022. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  9023. strarray2.Add(strImg);
  9024. }
  9025. else
  9026. strarray2.Add(sparray2.ElementAt(i + j));
  9027. #else
  9028. strarray2.Add(sparray2.ElementAt(i + j));
  9029. #endif
  9030. }
  9031. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9032. rcarray.RemoveAll();
  9033. for (j = 0; j < 3; j++)
  9034. {
  9035. StrRect = rc2array.ElementAt(j);
  9036. if (j == 0)
  9037. {
  9038. dty += bottom - StrRect.bottom;
  9039. }
  9040. StrRect.bottom = bottom;
  9041. m_Print.DrawRect2(StrRect, 1);
  9042. curypos = StrRect.bottom;
  9043. StrRect.top = StrRect.bottom;
  9044. StrRect.bottom += 18;
  9045. rcarray.Add(StrRect);
  9046. }
  9047. rc2array.RemoveAll();
  9048. rc2array.Copy(rcarray);
  9049. if (bottom > 750)
  9050. {
  9051. bSecondPage = 1;
  9052. nPrintedPos = i + 3;
  9053. break;
  9054. }
  9055. }
  9056. if ((bb == 0 && bSecondPage == 0) || (bb == 1 && bSecondPage == 1))
  9057. {
  9058. m_Print.SetFontFace(15, 1, "宋体");
  9059. StrRect = load.m_rcarray.ElementAt(20);
  9060. dty = curypos - StrRect.bottom + 35;
  9061. StrRect.top += dty;
  9062. StrRect.bottom += dty;
  9063. if (StrRect.bottom > 700 && bb == 0)
  9064. {
  9065. bSecondPage = 1;
  9066. }
  9067. else
  9068. {
  9069. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9070. m_Print.SetFontFace(9, 1, "宋体");
  9071. rcarray.RemoveAll();
  9072. strarray2.RemoveAll();
  9073. StrRect = load.m_rcarray.ElementAt(21);
  9074. StrRect.top += dty;
  9075. StrRect.bottom += dty;
  9076. StrRect.left += 2;
  9077. StrRect.right -= 2;
  9078. StrRect.top += 2;
  9079. rcarray.Add(StrRect);
  9080. #if JEFF_TEST_ON
  9081. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9082. strarray2.RemoveAll();
  9083. CString strFind = "要求:";
  9084. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  9085. do
  9086. {
  9087. int nIndex = strbz3.Find(strFind, 1);
  9088. if (nIndex != -1)
  9089. {
  9090. CString strbz = strbz3.Left(nIndex);
  9091. strbz3 = strbz3.Mid(nIndex);
  9092. strarray2.Add(strbz);
  9093. }
  9094. else
  9095. {
  9096. strarray2.Add(strbz3);
  9097. strbz3 = "";
  9098. }
  9099. } while (strbz3.Find(strFind) != -1);
  9100. strarray2.Add(g_List1array.ElementAt(0).ElementAt(29));
  9101. strarray2.Add(g_List1array.ElementAt(0).ElementAt(23));
  9102. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  9103. #else
  9104. strarray2.Add(m_bz);
  9105. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9106. #endif
  9107. StrRect = load.m_rcarray.ElementAt(21);
  9108. StrRect.top += dty;
  9109. StrRect.bottom += dty;
  9110. dty += bottom - StrRect.bottom;
  9111. StrRect.bottom = bottom;
  9112. m_Print.DrawRect2(StrRect, 1);
  9113. curypos = StrRect.bottom;
  9114. m_Print.SetFontFace(10, 1, "宋体");
  9115. StrRect = load.m_rcarray.ElementAt(22);
  9116. dty = curypos - StrRect.bottom + 25;
  9117. StrRect.top += dty;
  9118. StrRect.bottom += dty;
  9119. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  9120. if (m_edit9.IsEmpty())
  9121. {
  9122. m_edit9 = "\
  9123. 经确认后的照片均排入制作流程,\r\n\
  9124. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9125. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9126. }
  9127. CString info1, info2, info3;
  9128. int newlinepos = m_edit9.Find("\r\n");
  9129. if (newlinepos != -1)
  9130. {
  9131. info1 = m_edit9.Left(newlinepos);
  9132. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9133. }
  9134. newlinepos = m_edit9.Find("\r\n");
  9135. if (newlinepos != -1)
  9136. {
  9137. info2 = m_edit9.Left(newlinepos);
  9138. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9139. info3 = m_edit9;
  9140. }
  9141. #ifdef QCH_VERSION
  9142. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9143. StrRect = load.m_rcarray.ElementAt(23);
  9144. StrRect.top += dty; StrRect.bottom += dty;
  9145. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9146. StrRect=load.m_rcarray .ElementAt (24);
  9147. StrRect.top +=dty;StrRect.bottom +=dty;
  9148. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9149. StrRect.top +=15;
  9150. StrRect.bottom +=15;
  9151. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9152. #else
  9153. if (1)
  9154. {
  9155. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9156. StrRect = load.m_rcarray.ElementAt(23);
  9157. StrRect.top += dty; StrRect.bottom += dty;
  9158. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9159. StrRect = load.m_rcarray.ElementAt(24);
  9160. StrRect.top += dty; StrRect.bottom += dty;
  9161. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9162. }
  9163. else
  9164. {
  9165. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9166. StrRect = load.m_rcarray.ElementAt(23);
  9167. StrRect.top += dty; StrRect.bottom += dty;
  9168. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9169. StrRect = load.m_rcarray.ElementAt(24);
  9170. StrRect.top += dty; StrRect.bottom += dty;
  9171. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9172. }
  9173. StrRect.top += 15;
  9174. StrRect.bottom += 15;
  9175. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9176. #endif
  9177. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  9178. StrRect = load.m_rcarray.ElementAt(25);
  9179. StrRect.top += dty - dy;
  9180. StrRect.bottom += dty - dy;
  9181. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9182. StrRect = load.m_rcarray.ElementAt(26);
  9183. StrRect.top += dty - dy;
  9184. StrRect.bottom += dty - dy;
  9185. m_Print.DrawRect2(StrRect, 2);
  9186. StrRect = load.m_rcarray.ElementAt(25);
  9187. StrRect.top += dty + 15 - dy;
  9188. StrRect.bottom += dty + 15 - dy;
  9189. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9190. StrRect = load.m_rcarray.ElementAt(26);
  9191. StrRect.top += dty + 15 - dy;
  9192. StrRect.bottom += dty + 15 - dy;
  9193. m_Print.DrawRect2(StrRect, 2);
  9194. StrRect = load.m_rcarray.ElementAt(25);
  9195. StrRect.top += dty + 15 * 2 - dy;
  9196. StrRect.bottom += dty + 15 * 2 - dy;
  9197. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9198. StrRect = load.m_rcarray.ElementAt(26);
  9199. StrRect.top += dty + 15 * 2 - dy;
  9200. StrRect.bottom += dty + 15 * 2 - dy;
  9201. m_Print.DrawRect2(StrRect, 2);
  9202. }
  9203. }
  9204. PrintPreview dlg; dlg.m_mode = 2;
  9205. dlg.m_name = name;
  9206. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  9207. dlg.m_pDC = m_Print.GetPDC();
  9208. if (aa == 0)
  9209. {
  9210. if (dlg.DoModal() != IDOK)
  9211. return;
  9212. printcot = dlg.m_num;
  9213. }
  9214. //结束打印
  9215. m_Print.EndPage();
  9216. m_Print.EndPrint();
  9217. }
  9218. }
  9219. }
  9220. void CMainFrame::PrintFlowChart3_20151116(CString strOrderNumber) // 选片打单 风格2;
  9221. {
  9222. #ifdef LKAY_VERSION
  9223. PrintFlowChart3LKAY(strOrderNumber);
  9224. return;
  9225. #endif
  9226. int i = 0;
  9227. int j = 0;
  9228. int printcot = 1;
  9229. for (int aa = 0; aa < printcot; aa++)
  9230. {
  9231. BOOL bSecondPage = 0;
  9232. int nPrintedPos = 0;
  9233. for (int bb = 0; bb < 3; bb++)
  9234. {
  9235. if (bb && bSecondPage == 0)break;
  9236. CPrintRX m_Print;
  9237. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58))) // 58-[version].[setcheck1] ==1,使用默认打印机;
  9238. {
  9239. m_Print.InitToPrint(NULL, 1);
  9240. }
  9241. else // 否则使用指定的打印机;
  9242. {
  9243. CString name = g_cominfoarray.ElementAt(0).ElementAt(64); // 64-[version].[printer2] 制作单打印机;
  9244. if (name.IsEmpty())
  9245. m_Print.InitToPrint(NULL, 1);
  9246. else
  9247. {
  9248. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9249. if (nret == -1 && aa == 0)
  9250. {
  9251. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9252. }
  9253. }
  9254. }
  9255. m_Print.StartPrint();
  9256. m_Print.StartPage();
  9257. LoadRect load;
  9258. load.SetLiaPath("18.lia");
  9259. load.SetMargins(10, 0);
  9260. if (!load.Load())return;
  9261. CString str;
  9262. int rcpos = -1;
  9263. // ■■■■■■从18.lia获取到第一个区域大小 - 1.显示店名;
  9264. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  9265. if ((bb == 0 && bSecondPage == 0))
  9266. {
  9267. m_Print.SetFontFace(25, 1, "宋体");
  9268. // 10-[version].[info1] 店名;
  9269. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9270. m_Print.SetFontFace(15, 1, "宋体");
  9271. // ■■■■■■从18.lia获取第二个区域大小 - 2.显示"基本资料";
  9272. StrRect = load.m_rcarray.ElementAt(++rcpos);
  9273. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9274. m_Print.SetFontFace(9, 1, "宋体");
  9275. }
  9276. //////////////////////////////////////////////////////////////////////////
  9277. // 获取打印所需要的数据,并布局好;
  9278. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  9279. g_sendhead.code[0] = 54; // dindan;
  9280. g_sendhead.code[1] = 223; // dindanspview2; shangpin+dindansp;
  9281. g_sendhead.code[2] = 52; // client;
  9282. g_sendhead.tabcount = 3;
  9283. g_sendhead.bsql = 0;
  9284. g_pMainWnd->ProcessChatMessageRequest2(filter);
  9285. if (g_bSendOK == 0)return;
  9286. CArray<CStringArray, CStringArray>sparray;
  9287. CArray<CStringArray, CStringArray>clientarray;
  9288. DataToArray(&g_List1array, &sparray, &clientarray);
  9289. CString spno;
  9290. CStringArray sparray2;
  9291. for ( i = 0; i < sparray.GetSize(); i++)
  9292. {
  9293. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  9294. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  9295. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  9296. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9297. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  9298. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9299. sparray2.Add(sparray.ElementAt(i).ElementAt(5)); // 商品名称;
  9300. sparray2.Add(sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  9301. sparray2.Add(sparray.ElementAt(i).ElementAt(6)); // 选中的相片串;
  9302. sparray2.Add(sparray.ElementAt(i).ElementAt(10)); // 商品备注;
  9303. }
  9304. for (i = 0; i < sparray.GetSize(); i++)
  9305. {
  9306. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  9307. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  9308. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  9309. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9310. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  9311. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9312. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+"); // 商品名称;
  9313. sparray2.Add(sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  9314. sparray2.Add(sparray.ElementAt(i).ElementAt(6)); // 选中的相片串;
  9315. sparray2.Add(sparray.ElementAt(i).ElementAt(10)); // 商品备注;
  9316. }
  9317. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  9318. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  9319. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  9320. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  9321. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  9322. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  9323. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  9324. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  9325. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  9326. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  9327. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  9328. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  9329. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  9330. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  9331. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  9332. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  9333. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  9334. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  9335. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9336. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  9337. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  9338. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  9339. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  9340. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  9341. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  9342. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  9343. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  9344. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  9345. CString m_sum3;
  9346. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  9347. ::ConvertToPrice(m_sum3);
  9348. if (m_money3.IsEmpty())m_money3 = "0";
  9349. int dty = 0;
  9350. CString name;
  9351. if (!m_name1.IsEmpty())
  9352. name = m_name1 + ",";
  9353. name += m_name2;
  9354. name.TrimRight(",");
  9355. CString phone;
  9356. if (!m_phone1.IsEmpty())
  9357. phone = m_phone1 + ",";
  9358. phone += m_phone2; phone.TrimRight(",");
  9359. if (IsHasRights2new(31) == 0)
  9360. phone = "***";
  9361. CStringArray strarray;
  9362. CArray<CRect, CRect>rcarray;
  9363. CStringArray strarray2; CArray<CRect, CRect>rc2array;
  9364. int bottom;
  9365. //////////////////////////////////////////////////////////////////////////
  9366. // 开始画打印DC;
  9367. if ((bb == 0 && bSecondPage == 0))
  9368. {
  9369. #ifdef CHILD_VERSION
  9370. if (m_birthday.IsEmpty())
  9371. strarray.Add("姓名/性别");
  9372. else
  9373. strarray.Add("姓名/性别/年龄");
  9374. #else
  9375. strarray.Add("客人姓名"); // 第3.1区域 -3.显示客人姓名;
  9376. #endif
  9377. strarray.Add("电话");
  9378. strarray.Add("单号");
  9379. strarray.Add("套系");
  9380. strarray.Add("选样");
  9381. strarray.Add("余款/加挑");
  9382. strarray.Add("选片/日期");
  9383. #ifdef CHILD_VERSION
  9384. if (m_birthday.IsEmpty())
  9385. strarray.Add(name + "/" + m_sex);
  9386. else
  9387. {
  9388. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  9389. m_birthday.Format("%d", year + 1);
  9390. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  9391. }
  9392. #else
  9393. strarray.Add(name); // 第4.1区域 -3.显示客人姓名;
  9394. #endif
  9395. strarray.Add(phone);
  9396. strarray.Add(strOrderNumber);
  9397. strarray.Add(m_taoxiname);
  9398. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9399. strarray.Add(str);
  9400. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  9401. strarray.Add(str);
  9402. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  9403. for (i = 3; i <= 16; i++)
  9404. {
  9405. // ■■■■■■从18.lia中获取第3~16的区域大小;
  9406. StrRect = load.m_rcarray.ElementAt(i - 1);
  9407. if (i < 10)
  9408. {
  9409. m_Print.DrawRect2(StrRect, 1);
  9410. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9411. }
  9412. }
  9413. // ■■■■■■从18.lia中获取第30的区域大小;
  9414. StrRect = load.m_rcarray.ElementAt(29);
  9415. m_Print.DrawRect2(StrRect, 1);
  9416. BOOL bPrintDate = 1;
  9417. #ifdef DDF_VERSION
  9418. // bPrintDate=0;
  9419. #else
  9420. if (m_time5 == "" && m_time6 == "")
  9421. bPrintDate = 0;
  9422. #endif
  9423. if (bPrintDate)
  9424. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9425. else
  9426. {
  9427. #ifdef CHILD_VERSION
  9428. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/引导", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9429. #else
  9430. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/化妆", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9431. #endif
  9432. }
  9433. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138))) // [version].[reverse3]
  9434. {
  9435. Image *pImg = NULL;
  9436. g_nSendCode = 31;
  9437. int g_nYearposTemp = g_nYearpos;
  9438. g_nYearpos = -1;
  9439. g_pMainWnd->ProcessChatMessageRequest2(1);
  9440. g_nYearpos = g_nYearposTemp;
  9441. g_nSendCode = 0;
  9442. if (g_bSendOK == 0)return;
  9443. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  9444. // Jeff二维码的区域不是从18.lia里获取的,是固定在右上角指定区域;
  9445. if (pImg)
  9446. {
  9447. StrRect.left = 485;
  9448. StrRect.top = 12;
  9449. StrRect.right = StrRect.left + 60;
  9450. StrRect.bottom = StrRect.top + 60;
  9451. m_Print.DrawImage(pImg, StrRect);
  9452. delete pImg; pImg = NULL;
  9453. }
  9454. }
  9455. // CArray<CRect,CRect>rcarray;
  9456. // CStringArray strarray2;
  9457. // ■■■■■■从18.lia中获取第10的区域大小;
  9458. for (i = 10; i <= 16; i++)
  9459. {
  9460. StrRect = load.m_rcarray.ElementAt(i - 1);
  9461. StrRect.left += 2;
  9462. StrRect.right -= 2;
  9463. StrRect.top += 2;
  9464. rcarray.Add(StrRect);
  9465. strarray2.Add(strarray.ElementAt(7 + i - 10));
  9466. }
  9467. if (1)
  9468. {
  9469. // ■■■■■■从18.lia中获取第31的区域大小;
  9470. StrRect = load.m_rcarray.ElementAt(30);
  9471. StrRect.left += 2;
  9472. StrRect.right -= 2;
  9473. StrRect.top += 2;
  9474. rcarray.Add(StrRect);
  9475. if (bPrintDate)
  9476. strarray2.Add(m_time6 + "/" + m_time5);
  9477. else
  9478. {
  9479. strarray2.Add(m_waiter1 + "/" + m_waiter2);
  9480. }
  9481. }
  9482. int bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  9483. for (i = 10; i <= 16; i++)
  9484. {
  9485. StrRect = load.m_rcarray.ElementAt(i - 1);
  9486. if (i == 10)
  9487. {
  9488. dty += bottom - StrRect.bottom;
  9489. }
  9490. StrRect.bottom = bottom;
  9491. m_Print.DrawRect2(StrRect, 1);
  9492. }
  9493. if (1)
  9494. {
  9495. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  9496. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  9497. }
  9498. m_Print.SetFontFace(15, 1, "宋体");
  9499. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  9500. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9501. }
  9502. int curypos = 0;
  9503. int oldpos = 0;
  9504. if (bb == 1)
  9505. {
  9506. dty = -100;
  9507. oldpos = nPrintedPos;
  9508. if (oldpos == 0)oldpos = 10000;
  9509. }
  9510. m_Print.SetFontFace(9, 1, "宋体");
  9511. strarray.RemoveAll();
  9512. if ((oldpos != 10000 && oldpos < sparray2.GetSize()) || bb == 0)
  9513. {
  9514. strarray.Add("产品名称");
  9515. strarray.Add("数量");
  9516. strarray.Add("照片编号");
  9517. strarray.Add(_T("备注"));
  9518. CRect mycr[4] = {
  9519. CRect(39,172,130,189), // 产品名称;
  9520. CRect(130,172,157,189), // 产品数量;
  9521. CRect(157,172,407,189), // 相片;
  9522. CRect(407,172,546,189) // 备注;
  9523. };
  9524. for (i = 0; i <= 3; i++)
  9525. {
  9526. StrRect = mycr[i];
  9527. StrRect.top += dty;
  9528. StrRect.bottom += dty;
  9529. m_Print.DrawRect2(StrRect, 1);
  9530. StrRect.left += 2;
  9531. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9532. StrRect.left -= 2;
  9533. StrRect.top = StrRect.bottom;
  9534. StrRect.bottom += 18;
  9535. rc2array.Add(StrRect);
  9536. }
  9537. }
  9538. for (i = oldpos; i < sparray2.GetSize(); i += 4)
  9539. {
  9540. rcarray.RemoveAll();
  9541. strarray2.RemoveAll();
  9542. for ( j = 0; j < 4; j++)
  9543. {
  9544. StrRect = rc2array.ElementAt(j);
  9545. StrRect.left += 2;
  9546. StrRect.right -= 2;
  9547. StrRect.top += 2;
  9548. rcarray.Add(StrRect);
  9549. #if JEFF_TEST_ON
  9550. if (2 == j)
  9551. {
  9552. CString strImg = sparray2.ElementAt(i + 2);
  9553. //int nImgCount = strImg.Replace(",", ",");
  9554. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  9555. if (nImgCount != 0)
  9556. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  9557. else if (!strImg.IsEmpty())
  9558. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  9559. strarray2.Add(strImg);
  9560. }
  9561. else
  9562. strarray2.Add(sparray2.ElementAt(i + j));
  9563. #else
  9564. strarray2.Add(sparray2.ElementAt(i + j));
  9565. #endif
  9566. }
  9567. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9568. rcarray.RemoveAll();
  9569. for (j = 0; j < 4; j++)
  9570. {
  9571. StrRect = rc2array.ElementAt(j);
  9572. if (j == 0)
  9573. {
  9574. dty += bottom - StrRect.bottom;
  9575. }
  9576. StrRect.bottom = bottom;
  9577. m_Print.DrawRect2(StrRect, 1);
  9578. curypos = StrRect.bottom;
  9579. StrRect.top = StrRect.bottom;
  9580. StrRect.bottom += 18;
  9581. rcarray.Add(StrRect);
  9582. }
  9583. rc2array.RemoveAll();
  9584. rc2array.Copy(rcarray);
  9585. if (bottom > 750)
  9586. {
  9587. bSecondPage = 1;
  9588. nPrintedPos = i + 3;
  9589. break;
  9590. }
  9591. }
  9592. if ((bb == 0 && bSecondPage == 0) || (bb == 1 && bSecondPage == 1))
  9593. {
  9594. m_Print.SetFontFace(15, 1, "宋体");
  9595. StrRect = load.m_rcarray.ElementAt(20);
  9596. dty = curypos - StrRect.bottom + 35;
  9597. StrRect.top += dty;
  9598. StrRect.bottom += dty;
  9599. if (StrRect.bottom > 700 && bb == 0)
  9600. {
  9601. bSecondPage = 1;
  9602. }
  9603. else
  9604. {
  9605. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9606. m_Print.SetFontFace(9, 1, "宋体");
  9607. rcarray.RemoveAll();
  9608. strarray2.RemoveAll();
  9609. StrRect = load.m_rcarray.ElementAt(21);
  9610. StrRect.top += dty;
  9611. StrRect.bottom += dty;
  9612. StrRect.left += 2;
  9613. StrRect.right -= 2;
  9614. StrRect.top += 2;
  9615. rcarray.Add(StrRect);
  9616. #if JEFF_TEST_ON
  9617. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9618. strarray2.RemoveAll();
  9619. CString strFind = "要求:";
  9620. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  9621. do
  9622. {
  9623. int nIndex = strbz3.Find(strFind, 1);
  9624. if (nIndex != -1)
  9625. {
  9626. CString strbz = strbz3.Left(nIndex);
  9627. strbz3 = strbz3.Mid(nIndex);
  9628. strarray2.Add(strbz);
  9629. }
  9630. else
  9631. {
  9632. strarray2.Add(strbz3);
  9633. strbz3 = "";
  9634. }
  9635. } while (strbz3.Find(strFind) != -1);
  9636. strarray2.Add(g_List1array.ElementAt(0).ElementAt(29));
  9637. strarray2.Add(g_List1array.ElementAt(0).ElementAt(23));
  9638. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  9639. #else
  9640. strarray2.Add(m_bz);
  9641. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9642. #endif
  9643. StrRect = load.m_rcarray.ElementAt(21);
  9644. StrRect.top += dty;
  9645. StrRect.bottom += dty;
  9646. dty += bottom - StrRect.bottom;
  9647. StrRect.bottom = bottom;
  9648. m_Print.DrawRect2(StrRect, 1);
  9649. curypos = StrRect.bottom;
  9650. m_Print.SetFontFace(10, 1, "宋体");
  9651. StrRect = load.m_rcarray.ElementAt(22);
  9652. dty = curypos - StrRect.bottom + 25;
  9653. StrRect.top += dty;
  9654. StrRect.bottom += dty;
  9655. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  9656. if (m_edit9.IsEmpty())
  9657. {
  9658. m_edit9 = "\
  9659. 经确认后的照片均排入制作流程,\r\n\
  9660. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9661. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9662. }
  9663. CString info1, info2, info3;
  9664. int newlinepos = m_edit9.Find("\r\n");
  9665. if (newlinepos != -1)
  9666. {
  9667. info1 = m_edit9.Left(newlinepos);
  9668. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9669. }
  9670. newlinepos = m_edit9.Find("\r\n");
  9671. if (newlinepos != -1)
  9672. {
  9673. info2 = m_edit9.Left(newlinepos);
  9674. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9675. info3 = m_edit9;
  9676. }
  9677. #ifdef QCH_VERSION
  9678. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9679. StrRect = load.m_rcarray.ElementAt(23);
  9680. StrRect.top += dty; StrRect.bottom += dty;
  9681. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9682. StrRect=load.m_rcarray .ElementAt (24);
  9683. StrRect.top +=dty;StrRect.bottom +=dty;
  9684. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9685. StrRect.top +=15;
  9686. StrRect.bottom +=15;
  9687. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9688. #else
  9689. if (1)
  9690. {
  9691. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9692. StrRect = load.m_rcarray.ElementAt(23);
  9693. StrRect.top += dty; StrRect.bottom += dty;
  9694. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9695. StrRect = load.m_rcarray.ElementAt(24);
  9696. StrRect.top += dty; StrRect.bottom += dty;
  9697. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9698. }
  9699. else
  9700. {
  9701. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9702. StrRect = load.m_rcarray.ElementAt(23);
  9703. StrRect.top += dty; StrRect.bottom += dty;
  9704. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9705. StrRect = load.m_rcarray.ElementAt(24);
  9706. StrRect.top += dty; StrRect.bottom += dty;
  9707. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9708. }
  9709. StrRect.top += 15;
  9710. StrRect.bottom += 15;
  9711. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9712. #endif
  9713. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  9714. StrRect = load.m_rcarray.ElementAt(25);
  9715. StrRect.top += dty - dy;
  9716. StrRect.bottom += dty - dy;
  9717. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9718. StrRect = load.m_rcarray.ElementAt(26);
  9719. StrRect.top += dty - dy;
  9720. StrRect.bottom += dty - dy;
  9721. m_Print.DrawRect2(StrRect, 2);
  9722. StrRect = load.m_rcarray.ElementAt(25);
  9723. StrRect.top += dty + 15 - dy;
  9724. StrRect.bottom += dty + 15 - dy;
  9725. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9726. StrRect = load.m_rcarray.ElementAt(26);
  9727. StrRect.top += dty + 15 - dy;
  9728. StrRect.bottom += dty + 15 - dy;
  9729. m_Print.DrawRect2(StrRect, 2);
  9730. StrRect = load.m_rcarray.ElementAt(25);
  9731. StrRect.top += dty + 15 * 2 - dy;
  9732. StrRect.bottom += dty + 15 * 2 - dy;
  9733. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9734. StrRect = load.m_rcarray.ElementAt(26);
  9735. StrRect.top += dty + 15 * 2 - dy;
  9736. StrRect.bottom += dty + 15 * 2 - dy;
  9737. m_Print.DrawRect2(StrRect, 2);
  9738. }
  9739. }
  9740. PrintPreview dlg; dlg.m_mode = 2;
  9741. dlg.m_name = name;
  9742. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  9743. dlg.m_pDC = m_Print.GetPDC();
  9744. if (aa == 0)
  9745. {
  9746. if (dlg.DoModal() != IDOK)
  9747. return;
  9748. printcot = dlg.m_num;
  9749. }
  9750. //结束打印
  9751. m_Print.EndPage();
  9752. m_Print.EndPrint();
  9753. }
  9754. }
  9755. }
  9756. //void CMainFrame::PrintFlowChart4(CString m_id) // 选设计打单函数;
  9757. void CMainFrame::PrintFlowChart4(CString strOrderNumber) // 选设计打单函数,使用18.lia文件;
  9758. {
  9759. int i = 0;
  9760. int j = 0;
  9761. int printcot = 1;
  9762. for (int aa = 0; aa < printcot; aa++)
  9763. {
  9764. CPrintRX m_Print;
  9765. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  9766. {
  9767. m_Print.InitToPrint(NULL, 1);
  9768. }
  9769. else
  9770. {
  9771. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  9772. if (name.IsEmpty())
  9773. m_Print.InitToPrint(NULL, 1);
  9774. else
  9775. {
  9776. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9777. if (nret == -1 && aa == 0)
  9778. {
  9779. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9780. }
  9781. }
  9782. }
  9783. m_Print.StartPrint();
  9784. m_Print.StartPage();
  9785. LoadRect load;
  9786. load.SetLiaPath("18.lia");
  9787. load.SetMargins(10, 0);
  9788. if (!load.Load())return;
  9789. CString str;
  9790. int rcpos = -1;
  9791. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  9792. m_Print.SetFontFace(25, 1, "宋体");
  9793. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9794. m_Print.SetFontFace(15, 1, "宋体");
  9795. StrRect = load.m_rcarray.ElementAt(++rcpos);
  9796. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9797. m_Print.SetFontFace(9, 1, "宋体");
  9798. //////////////////////////////////////////////////////////////
  9799. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  9800. g_sendhead.code[0] = 54;
  9801. g_sendhead.code[1] = 223;
  9802. g_sendhead.code[2] = 52;
  9803. g_sendhead.tabcount = 3;
  9804. g_sendhead.bsql = 0;
  9805. g_pMainWnd->ProcessChatMessageRequest2(filter);
  9806. if (g_bSendOK == 0)return;
  9807. CArray<CStringArray, CStringArray>sparray;
  9808. CArray<CStringArray, CStringArray>clientarray;
  9809. DataToArray(&g_List1array, &sparray, &clientarray);
  9810. CString spno;
  9811. CStringArray sparray2;
  9812. for ( i = 0; i < sparray.GetSize(); i++)
  9813. {
  9814. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  9815. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(8).IsEmpty())continue;
  9816. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9817. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9818. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  9819. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9820. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9821. }
  9822. for (i = 0; i < sparray.GetSize(); i++)
  9823. {
  9824. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  9825. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  9826. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  9827. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9828. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9829. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  9830. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9831. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9832. }
  9833. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  9834. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  9835. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  9836. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  9837. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  9838. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  9839. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  9840. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  9841. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  9842. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  9843. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  9844. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  9845. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  9846. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  9847. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  9848. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  9849. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  9850. CString m_bz = g_List1array.ElementAt(0).ElementAt(17);
  9851. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(25);
  9852. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  9853. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  9854. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  9855. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  9856. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  9857. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  9858. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  9859. CString m_waiter8 = g_List1array.ElementAt(0).ElementAt(27);
  9860. CString m_replace = g_List1array.ElementAt(0).ElementAt(28);
  9861. if (!m_replace.IsEmpty())
  9862. {
  9863. m_replace = "设计替换照片:" + m_replace;
  9864. m_replace.Replace("$", ";");
  9865. m_replace.TrimLeft(";");
  9866. m_bz += ";";
  9867. m_bz += m_replace;
  9868. }
  9869. CString m_sum3;
  9870. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  9871. ::ConvertToPrice(m_sum3);
  9872. if (m_money3.IsEmpty())m_money3 = "0";
  9873. int dty = 0;
  9874. CString name;
  9875. if (!m_name1.IsEmpty())
  9876. name = m_name1 + ",";
  9877. name += m_name2;
  9878. name.TrimRight(",");
  9879. CString phone;
  9880. if (!m_phone1.IsEmpty())
  9881. phone = m_phone1 + ",";
  9882. phone += m_phone2; phone.TrimRight(",");
  9883. if (IsHasRights2new(31) == 0)
  9884. phone = "***";
  9885. CStringArray strarray;
  9886. #ifdef CHILD_VERSION
  9887. if (m_birthday.IsEmpty())
  9888. strarray.Add("姓名/性别");
  9889. else
  9890. strarray.Add("姓名/性别/年龄");
  9891. #else
  9892. strarray.Add("客人姓名");
  9893. #endif
  9894. strarray.Add("电话");
  9895. strarray.Add("单号");
  9896. strarray.Add("套系");
  9897. strarray.Add("");
  9898. strarray.Add("余款/加挑");
  9899. strarray.Add("看设计/日期");
  9900. #ifdef CHILD_VERSION
  9901. if (m_birthday.IsEmpty())
  9902. strarray.Add(name + "/" + m_sex);
  9903. else
  9904. {
  9905. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  9906. m_birthday.Format("%d", year + 1);
  9907. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  9908. }
  9909. #else
  9910. strarray.Add(name);
  9911. #endif
  9912. strarray.Add(phone);
  9913. strarray.Add(strOrderNumber);
  9914. strarray.Add(m_taoxiname);
  9915. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9916. strarray.Add("");
  9917. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  9918. strarray.Add(str);
  9919. strarray.Add(m_waiter8 + "/" + m_time6);
  9920. //////////////////////////////////////////////
  9921. if (1)
  9922. {
  9923. StrRect = load.m_rcarray.ElementAt(6);
  9924. int addwid = StrRect.Width() / 6;
  9925. for (i = 3; i <= 6; i++)
  9926. {
  9927. StrRect = load.m_rcarray.ElementAt(i - 1);
  9928. StrRect.left += (i - 3)*addwid;
  9929. StrRect.right += (i - 2)*addwid;
  9930. load.m_rcarray.SetAt(i - 1, StrRect);
  9931. }
  9932. StrRect.left = StrRect.right = -1;
  9933. load.m_rcarray.SetAt(6, StrRect);
  9934. for (i = 10; i <= 13; i++)
  9935. {
  9936. StrRect = load.m_rcarray.ElementAt(i - 1);
  9937. StrRect.left += (i - 10)*addwid;
  9938. StrRect.right += (i - 9)*addwid;
  9939. load.m_rcarray.SetAt(i - 1, StrRect);
  9940. }
  9941. StrRect.left = StrRect.right = -1;
  9942. load.m_rcarray.SetAt(13, StrRect);
  9943. StrRect = load.m_rcarray.ElementAt(7);
  9944. int rcwid = StrRect.Width();
  9945. StrRect.left = load.m_rcarray.ElementAt(5).right;
  9946. StrRect.right = StrRect.left + rcwid + addwid;
  9947. load.m_rcarray.SetAt(7, StrRect);
  9948. StrRect = load.m_rcarray.ElementAt(8);
  9949. StrRect.left = load.m_rcarray.ElementAt(7).right;
  9950. StrRect.right = load.m_rcarray.ElementAt(29).left;
  9951. load.m_rcarray.SetAt(8, StrRect);
  9952. StrRect = load.m_rcarray.ElementAt(14);
  9953. rcwid = StrRect.Width();
  9954. StrRect.left = load.m_rcarray.ElementAt(12).right;
  9955. StrRect.right = StrRect.left + rcwid + addwid;
  9956. load.m_rcarray.SetAt(14, StrRect);
  9957. StrRect = load.m_rcarray.ElementAt(15);
  9958. StrRect.left = load.m_rcarray.ElementAt(14).right;
  9959. StrRect.right = load.m_rcarray.ElementAt(29).left;
  9960. load.m_rcarray.SetAt(15, StrRect);
  9961. }
  9962. ////////////////////////////////////////////////
  9963. for (i = 3; i <= 16; i++)
  9964. {
  9965. StrRect = load.m_rcarray.ElementAt(i - 1);
  9966. if (i < 10)
  9967. {
  9968. m_Print.DrawRect2(StrRect, 1);
  9969. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9970. }
  9971. }
  9972. StrRect = load.m_rcarray.ElementAt(29);
  9973. m_Print.DrawRect2(StrRect, 1);
  9974. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9975. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  9976. {
  9977. Image *pImg = NULL;
  9978. g_nSendCode = 31;
  9979. int g_nYearposTemp = g_nYearpos;
  9980. g_nYearpos = -1;
  9981. g_pMainWnd->ProcessChatMessageRequest2(1);
  9982. g_nYearpos = g_nYearposTemp;
  9983. g_nSendCode = 0;
  9984. if (g_bSendOK == 0)return;
  9985. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  9986. if (pImg)
  9987. {
  9988. StrRect.left = 485;
  9989. StrRect.top = 12;
  9990. StrRect.right = StrRect.left + 60;
  9991. StrRect.bottom = StrRect.top + 60;
  9992. m_Print.DrawImage(pImg, StrRect);
  9993. delete pImg; pImg = NULL;
  9994. }
  9995. }
  9996. CArray<CRect, CRect>rcarray;
  9997. CStringArray strarray2;
  9998. for (i = 10; i <= 16; i++)
  9999. {
  10000. StrRect = load.m_rcarray.ElementAt(i - 1);
  10001. StrRect.left += 2;
  10002. StrRect.right -= 2;
  10003. StrRect.top += 2;
  10004. rcarray.Add(StrRect);
  10005. strarray2.Add(strarray.ElementAt(7 + i - 10));
  10006. }
  10007. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  10008. for (i = 10; i <= 16; i++)
  10009. {
  10010. StrRect = load.m_rcarray.ElementAt(i - 1);
  10011. if (i == 10)
  10012. {
  10013. dty += bottom - StrRect.bottom;
  10014. }
  10015. StrRect.bottom = bottom;
  10016. m_Print.DrawRect2(StrRect, 1);
  10017. }
  10018. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  10019. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  10020. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time5, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  10021. m_Print.SetFontFace(15, 1, "宋体");
  10022. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  10023. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10024. m_Print.SetFontFace(9, 1, "宋体");
  10025. strarray.RemoveAll();
  10026. strarray.Add("产品名称");
  10027. strarray.Add("数量");
  10028. strarray.Add("照片编号");
  10029. CArray<CRect, CRect>rc2array;
  10030. for (i = 18; i <= 20; i++)
  10031. {
  10032. StrRect = load.m_rcarray.ElementAt(i - 1); StrRect.top += dty; StrRect.bottom += dty;
  10033. m_Print.DrawRect2(StrRect, 1);
  10034. StrRect.left += 2;
  10035. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10036. StrRect.left -= 2;
  10037. StrRect.top = StrRect.bottom;
  10038. StrRect.bottom += 18;
  10039. rc2array.Add(StrRect);
  10040. }
  10041. int curypos = 0;
  10042. for (i = 0; i < sparray2.GetSize(); i += 3)
  10043. {
  10044. rcarray.RemoveAll();
  10045. strarray2.RemoveAll();
  10046. for ( j = 0; j < 3; j++)
  10047. {
  10048. StrRect = rc2array.ElementAt(j);
  10049. StrRect.left += 2;
  10050. StrRect.right -= 2;
  10051. StrRect.top += 2;
  10052. rcarray.Add(StrRect);
  10053. #if JEFF_TEST_ON
  10054. if (2 == j)
  10055. {
  10056. CString strImg = sparray2.ElementAt(i + 2);
  10057. //int nImgCount = strImg.Replace(",", ",");
  10058. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  10059. if (nImgCount != 0)
  10060. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  10061. else if (!strImg.IsEmpty())
  10062. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  10063. strarray2.Add(strImg);
  10064. }
  10065. else
  10066. strarray2.Add(sparray2.ElementAt(i + j));
  10067. #else
  10068. strarray2.Add(sparray2.ElementAt(i + j));
  10069. #endif
  10070. }
  10071. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  10072. rcarray.RemoveAll();
  10073. for (j = 0; j < 3; j++)
  10074. {
  10075. StrRect = rc2array.ElementAt(j);
  10076. if (j == 0)
  10077. {
  10078. dty += bottom - StrRect.bottom;
  10079. }
  10080. StrRect.bottom = bottom;
  10081. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  10082. StrRect.top = StrRect.bottom;
  10083. StrRect.bottom += 18;
  10084. rcarray.Add(StrRect);
  10085. }
  10086. rc2array.RemoveAll();
  10087. rc2array.Copy(rcarray);
  10088. }
  10089. m_Print.SetFontFace(15, 1, "宋体");
  10090. StrRect = load.m_rcarray.ElementAt(20);
  10091. dty = curypos - StrRect.bottom + 35;
  10092. StrRect.top += dty; StrRect.bottom += dty;
  10093. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10094. m_Print.SetFontFace(9, 1, "宋体");
  10095. rcarray.RemoveAll();
  10096. strarray2.RemoveAll();
  10097. StrRect = load.m_rcarray.ElementAt(21);
  10098. StrRect.top += dty;
  10099. StrRect.bottom += dty;
  10100. StrRect.left += 2;
  10101. StrRect.right -= 2;
  10102. StrRect.top += 2;
  10103. rcarray.Add(StrRect);
  10104. #if JEFF_TEST_ON
  10105. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  10106. strarray2.RemoveAll();
  10107. CString strFind = "要求:";
  10108. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  10109. do
  10110. {
  10111. int nIndex = strbz3.Find(strFind, 1);
  10112. if (nIndex != -1)
  10113. {
  10114. CString strbz = strbz3.Left(nIndex);
  10115. strbz3 = strbz3.Mid(nIndex);
  10116. strarray2.Add(strbz);
  10117. }
  10118. else
  10119. {
  10120. strarray2.Add(strbz3);
  10121. strbz3 = "";
  10122. }
  10123. } while (strbz3.Find(strFind) != -1);
  10124. strarray2.Add(g_List1array.ElementAt(0).ElementAt(25));
  10125. if (!m_replace.IsEmpty())
  10126. {
  10127. m_replace = "设计替换照片:" + m_replace;
  10128. m_replace.Replace("$", ";");
  10129. m_replace.TrimLeft(";");
  10130. }
  10131. strarray2.Add(m_replace);
  10132. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  10133. #else
  10134. strarray2.Add(m_bz);
  10135. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  10136. #endif
  10137. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  10138. dty += bottom - StrRect.bottom;
  10139. StrRect.bottom = bottom;
  10140. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  10141. m_Print.SetFontFace(10, 1, "宋体");
  10142. StrRect = load.m_rcarray.ElementAt(22);
  10143. dty = curypos - StrRect.bottom + 25;
  10144. StrRect.top += dty; StrRect.bottom += dty;
  10145. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  10146. if (m_edit9.IsEmpty())
  10147. {
  10148. m_edit9 = "\
  10149. 经确认后的照片均排入制作流程,\r\n\
  10150. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  10151. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  10152. }
  10153. CString info1, info2, info3;
  10154. int newlinepos = m_edit9.Find("\r\n");
  10155. if (newlinepos != -1)
  10156. {
  10157. info1 = m_edit9.Left(newlinepos);
  10158. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  10159. }
  10160. newlinepos = m_edit9.Find("\r\n");
  10161. if (newlinepos != -1)
  10162. {
  10163. info2 = m_edit9.Left(newlinepos);
  10164. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  10165. info3 = m_edit9;
  10166. }
  10167. if (1)
  10168. {
  10169. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10170. StrRect = load.m_rcarray.ElementAt(23);
  10171. StrRect.top += dty; StrRect.bottom += dty;
  10172. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10173. StrRect = load.m_rcarray.ElementAt(24);
  10174. StrRect.top += dty; StrRect.bottom += dty;
  10175. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10176. }
  10177. else
  10178. {
  10179. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10180. StrRect = load.m_rcarray.ElementAt(23);
  10181. StrRect.top += dty; StrRect.bottom += dty;
  10182. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10183. StrRect = load.m_rcarray.ElementAt(24);
  10184. StrRect.top += dty; StrRect.bottom += dty;
  10185. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10186. }
  10187. StrRect = load.m_rcarray.ElementAt(25);
  10188. StrRect.top += dty; StrRect.bottom += dty;
  10189. m_Print.DrawText((LPTSTR)(LPCTSTR)"贵宾签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10190. StrRect = load.m_rcarray.ElementAt(26);
  10191. StrRect.top += dty; StrRect.bottom += dty;
  10192. m_Print.DrawRect2(StrRect, 2);
  10193. m_Print.SetFontFace(9, 1, "宋体");
  10194. StrRect = load.m_rcarray.ElementAt(27);
  10195. StrRect.top += dty; StrRect.bottom += dty;
  10196. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10197. StrRect = load.m_rcarray.ElementAt(28);
  10198. StrRect.top += dty; StrRect.bottom += dty;
  10199. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10200. PrintPreview dlg;//dlg.m_mode=2;
  10201. dlg.m_name = name;
  10202. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  10203. dlg.m_pDC = m_Print.GetPDC();
  10204. if (aa == 0)
  10205. {
  10206. if (dlg.DoModal() != IDOK)
  10207. return;
  10208. printcot = dlg.m_num;
  10209. }
  10210. //结束打印
  10211. m_Print.EndPage();
  10212. m_Print.EndPrint();
  10213. }
  10214. }
  10215. /*
  10216. void CMainFrame::PrintFlowChart(CString m_id)
  10217. {
  10218. CPrintRX m_Print;
  10219. m_Print.InitToPrint(NULL, 1);
  10220. m_Print.StartPrint();
  10221. m_Print.StartPage();
  10222. // CRect StrRect(0,0,560,818);
  10223. LoadRect load;
  10224. load.SetLiaPath ("4.lia");
  10225. load.SetMargins(-14,-14);
  10226. if(!load.Load ())return;
  10227. LoadRect load2;
  10228. load2.SetMargins(-14,472+27-14);
  10229. load2.SetLiaPath ("5.lia");
  10230. if(!load2.Load ())return;
  10231. //////////////////////////////////////////////////////////////
  10232. CString filter="id='"+m_id+"';id='"+m_id+"'";
  10233. g_sendhead.code[0]=54;
  10234. g_sendhead.code[1]=50;
  10235. g_sendhead.tabcount=2;
  10236. g_sendhead.bsql=0;
  10237. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  10238. CArray<CStringArray, CStringArray>sparray;
  10239. DataToArray(&g_List1array,&sparray);
  10240. CString spno;
  10241. for(int i=0; i<sparray.GetSize (); i++)
  10242. {
  10243. if(sparray.ElementAt (i).ElementAt (4)=="4" && sparray.ElementAt (i).ElementAt (5)!="入册")continue;
  10244. if(sparray.ElementAt (i).ElementAt (5)=="入册"&&sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  10245. spno+=sparray.ElementAt (i).ElementAt (5);
  10246. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  10247. spno+=";";
  10248. else
  10249. {
  10250. spno+=":";
  10251. spno+=sparray.ElementAt (i).ElementAt (6);
  10252. spno+=";";
  10253. }
  10254. }
  10255. spno+=" 加挑:";
  10256. for( i=0; i<sparray.GetSize (); i++)
  10257. {
  10258. if(sparray.ElementAt (i).ElementAt (4)!="4")continue;
  10259. if(sparray.ElementAt (i).ElementAt (5)=="入册")continue;
  10260. spno+=sparray.ElementAt (i).ElementAt (5);
  10261. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  10262. spno+=";";
  10263. else
  10264. {
  10265. spno+=":";
  10266. spno+=sparray.ElementAt (i).ElementAt (6);
  10267. spno+=";";
  10268. }
  10269. }
  10270. if(spno.Right (6)==" 加挑:")
  10271. {
  10272. spno=spno.Left (spno.GetLength ()-6);
  10273. }
  10274. CString m_name1 = g_List1array.ElementAt (0).ElementAt (1);
  10275. CString m_name2 = g_List1array.ElementAt (0).ElementAt (2);
  10276. CString m_phone1=g_List1array.ElementAt (0).ElementAt (3);
  10277. CString m_phone2=g_List1array.ElementAt (0).ElementAt (4);
  10278. CString m_urgent=g_List1array.ElementAt (0).ElementAt (5);
  10279. if(m_urgent.IsEmpty ())m_urgent="否";
  10280. CString m_time2 = g_List1array.ElementAt (0).ElementAt (6);
  10281. CString m_time4 = g_List1array.ElementAt (0).ElementAt (7);
  10282. CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  10283. CString m_takezs = g_List1array.ElementAt (0).ElementAt (9);
  10284. CString m_taoxizs = g_List1array.ElementAt (0).ElementAt (10);
  10285. CString m_choosezs = g_List1array.ElementAt (0).ElementAt (11);
  10286. CString m_ren = g_List1array.ElementAt (0).ElementAt (12);
  10287. CString m_waiter3 = g_List1array.ElementAt (0).ElementAt (13);
  10288. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (14);
  10289. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (15);
  10290. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (16);
  10291. CString m_bz = "客人要求: "+g_List1array.ElementAt (0).ElementAt (17);
  10292. CString m_money3 = g_List1array.ElementAt (0).ElementAt (18);
  10293. CString m_money1 = g_List1array.ElementAt (0).ElementAt (19);
  10294. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (20);
  10295. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (21);
  10296. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (22);
  10297. CString m_sum3;
  10298. m_sum3.Format ("%0.2f", atof(m_taoxijiage)+atof(m_payed4)-(atof(m_payed5)+atof(m_money1)));
  10299. ::ConvertToPrice (m_sum3);
  10300. if(m_money3.IsEmpty ())m_money3="0";
  10301. // m_money3=m_money3+"/"+m_sum3;
  10302. CString name;
  10303. if(!m_name1.IsEmpty ())
  10304. name=m_name1+",";
  10305. name+=m_name2;
  10306. name.TrimRight (",");
  10307. CString phone;
  10308. if(!m_phone1.IsEmpty ())
  10309. phone=m_phone1+",";
  10310. phone+=m_phone2;phone.TrimRight (",");
  10311. CStringArray strarray;
  10312. strarray.Add (m_urgent);
  10313. strarray.Add (m_ren);
  10314. strarray.Add (m_waiter3);
  10315. strarray.Add (name);
  10316. strarray.Add (m_time2);
  10317. strarray.Add (m_time4);
  10318. strarray.Add (m_time5);
  10319. strarray.Add (m_money3);
  10320. strarray.Add (m_takezs);
  10321. strarray.Add (m_taoxizs);
  10322. strarray.Add (m_choosezs);
  10323. strarray.Add (m_id);
  10324. strarray.Add (phone);
  10325. ////////////////////////////////////////////////////////////////
  10326. int rcpos=-1;
  10327. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  10328. Image *pImg=NULL;
  10329. #ifdef MNLS_VERSION
  10330. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG") );
  10331. #else
  10332. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  10333. #endif
  10334. m_Print.DrawImage(pImg, StrRect);
  10335. delete pImg;
  10336. m_Print.SetFontFace(15, 1, "宋体");
  10337. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10338. #ifdef MNLS_VERSION
  10339. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10340. #endif
  10341. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10342. #ifdef MNLS_VERSION
  10343. m_Print.DrawRect(StrRect);
  10344. #endif
  10345. m_Print.SetFontFace(7, 1, "黑体");
  10346. m_Print.SetColor(0xffffff);
  10347. #ifdef MNLS_VERSION
  10348. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10349. #endif
  10350. m_Print.SetColor(0);
  10351. m_Print.SetFontFace(25, 1, "黑体");
  10352. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10353. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10354. CString title[13]={"是否加急:","接单门市:","选样人员:","新郎新娘姓名:","拍照日期:","选片日期:","取件日期:","加挑/余款:","拍摄总张数:","应挑选张数:","额外加挑张数:","票号:","客户联系电话:"};
  10355. m_Print.SetFontFace(12, 1, "宋体");
  10356. for( i=0; i<13; i++)
  10357. {
  10358. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10359. if(i<3)
  10360. m_Print.DrawRect2(StrRect, 0);
  10361. else
  10362. m_Print.DrawRect2(StrRect, 1);
  10363. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10364. }
  10365. for( i=18; i<=37; i++)
  10366. {
  10367. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10368. if(i>=19&&i<=21)
  10369. m_Print.DrawRect2(StrRect, 2);
  10370. else if(i==26)
  10371. {
  10372. CRect rc=StrRect;
  10373. CRect rc2=rc;
  10374. rc.right -=rc2.Width ()/2;
  10375. m_Print.DrawRect2(rc, 1);
  10376. rc2.left +=rc.Width ();
  10377. m_Print.DrawRect2(rc2, 1);
  10378. }
  10379. else
  10380. m_Print.DrawRect2(StrRect, 1);
  10381. if(i==18)
  10382. {
  10383. StrRect.left +=5;
  10384. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10385. }
  10386. }
  10387. //////////////////////////////////////
  10388. rcpos=-1;
  10389. for( i=0; i<8; i++)
  10390. {
  10391. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10392. m_Print.DrawRect2(StrRect, 1);
  10393. }
  10394. CString title2[4]={"化妆师:","摄影师:","数码设计师:","顾客签名:"};
  10395. for( i=0; i<4; i++)
  10396. {
  10397. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10398. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10399. }
  10400. for( i=0; i<4; i++)
  10401. {
  10402. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10403. m_Print.DrawRect2(StrRect, 2);
  10404. }
  10405. ///////////////////////////////////////////
  10406. for( i=19; i<=31; i++)
  10407. {
  10408. StrRect=load.m_rcarray .ElementAt (i-1);
  10409. StrRect.left +=4;
  10410. if(i==31)
  10411. {
  10412. if(m_phone1.IsEmpty ()==0 && m_phone2.IsEmpty ()==0)
  10413. {
  10414. StrRect.top +=2;
  10415. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  10416. StrRect.top +=8;
  10417. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10418. }
  10419. else
  10420. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10421. }
  10422. else if((i-19)==7)
  10423. {
  10424. CRect rc=StrRect;
  10425. CRect rc2=rc;
  10426. rc.right -=rc2.Width ()/2;
  10427. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10428. rc2.left +=rc.Width ()+3;
  10429. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10430. }
  10431. else
  10432. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10433. }
  10434. strarray.RemoveAll ();
  10435. strarray.Add (m_waiter2);
  10436. strarray.Add (m_waiter1);
  10437. strarray.Add (m_waiter4);
  10438. for( i=13; i<=15; i++)
  10439. {
  10440. StrRect=load2.m_rcarray .ElementAt (i-1);
  10441. StrRect.left +=4;
  10442. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10443. }
  10444. ///////////spno
  10445. CRect sprc[14];
  10446. for(i=0; i<14; i++)
  10447. {
  10448. if(i<7)
  10449. {
  10450. if(i==0)
  10451. {
  10452. StrRect=load.m_rcarray .ElementAt (17);StrRect.left +=94;StrRect.right -=3;
  10453. }
  10454. else
  10455. {
  10456. StrRect=load.m_rcarray .ElementAt (30+i);StrRect.left +=4;StrRect.right -=3;
  10457. }
  10458. }
  10459. else
  10460. {
  10461. StrRect=load2.m_rcarray .ElementAt (i-7);StrRect.left +=4;StrRect.right -=3;
  10462. }
  10463. sprc[i]=StrRect;
  10464. // m_Print.DrawText((LPTSTR)(LPCTSTR)"xxx", sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10465. }
  10466. CString temp,tempspno,tempbz;
  10467. CSize size;
  10468. BOOL bRun=0;
  10469. int fontsize=12;
  10470. ll: tempspno=spno;
  10471. tempbz=m_bz;
  10472. m_Print.SetFontFace(fontsize, 1, "宋体");
  10473. for( i=0; i<14; i++)
  10474. {
  10475. if(!tempspno.IsEmpty ())
  10476. {
  10477. temp=tempspno;
  10478. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10479. int right=0;
  10480. CRect temprc=sprc[i];
  10481. while(size.cx>temprc.Width ())
  10482. {
  10483. right++;
  10484. temp=tempspno.Left (tempspno.GetLength ()-(right));
  10485. if(GIsHalfHZ(temp))
  10486. {
  10487. right++;
  10488. temp.Delete (temp.GetLength ()-1);
  10489. }
  10490. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10491. }
  10492. if(bRun)
  10493. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10494. tempspno=tempspno.Right (tempspno.GetLength ()-temp.GetLength ());
  10495. if(tempspno.IsEmpty ())i++;
  10496. }
  10497. else if(!tempbz.IsEmpty ())
  10498. {
  10499. temp=tempbz;
  10500. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10501. int right=0;
  10502. CRect temprc=sprc[i];
  10503. while(size.cx>temprc.Width ())
  10504. {
  10505. right++;
  10506. temp=tempbz.Left (tempbz.GetLength ()-(right));
  10507. if(GIsHalfHZ(temp))
  10508. {
  10509. right++;
  10510. temp.Delete (temp.GetLength ()-1);
  10511. }
  10512. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10513. }
  10514. if(bRun)
  10515. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10516. tempbz=tempbz.Right (tempbz.GetLength ()-temp.GetLength ());
  10517. }
  10518. }
  10519. if(tempspno.IsEmpty ()==0 || tempbz.IsEmpty ()==0)
  10520. {
  10521. fontsize--;
  10522. goto ll;
  10523. }
  10524. if(bRun==0)
  10525. {
  10526. bRun=1;
  10527. goto ll;
  10528. }
  10529. PrintPreview dlg;
  10530. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  10531. dlg.m_pDC =m_Print.GetPDC() ;
  10532. if(dlg.DoModal ()!=IDOK)return;
  10533. //结束打印
  10534. m_Print.EndPage();
  10535. m_Print.EndPrint();
  10536. }
  10537. void CMainFrame::SetSelFolder(int pos)
  10538. {
  10539. m_wndToolBar2.SetSelFolder(pos);
  10540. }*/
  10541. void CMainFrame::ToPhotoPrint()
  10542. {
  10543. UINT nID = 1;
  10544. LPSTR pName;
  10545. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  10546. OPEN_MENU(PhotoPrintFrom);
  10547. }
  10548. void CMainFrame::GetOcx()
  10549. {
  10550. char path[MAX_PATH];
  10551. ::GetSystemDirectory(path, MAX_PATH);
  10552. CString syspath = path;
  10553. try
  10554. {
  10555. if (!::PathFileExists(syspath + "\\MSCHRT20.OCX"))
  10556. {
  10557. g_sendhead.bsql = 0;
  10558. g_sendhead.code[0] = 103;
  10559. g_sendhead.tabcount = 1;
  10560. g_pMainWnd->ProcessChatMessageRequest2(1); if (g_bSendOK == 0)return;
  10561. CFile fp;
  10562. if (fp.Open(syspath + "\\MSCHRT20.OCX", CFile::modeWrite | CFile::modeCreate))
  10563. {
  10564. fp.Write(g_pData, g_nLeng);
  10565. fp.Close();
  10566. ::Sleep(1000);
  10567. }
  10568. }
  10569. CString temp;
  10570. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10571. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10572. }
  10573. catch (...)
  10574. {
  10575. }
  10576. try
  10577. {
  10578. CString temp;
  10579. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10580. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10581. }
  10582. catch (...)
  10583. {
  10584. }
  10585. }
  10586. void CMainFrame::OnServer()
  10587. {
  10588. // TODO: Add your command handler code here
  10589. DBConfig dlg;
  10590. dlg.DoModal();
  10591. }
  10592. void CMainFrame::OnPath()
  10593. {
  10594. // TODO: Add your command handler code here
  10595. if (g_user.bLongin == 0)
  10596. {
  10597. if (g_bNoLoginLia)
  10598. {
  10599. Login dlg;
  10600. dlg.SetLiaPath("5.lia");
  10601. dlg.DoModal();
  10602. }
  10603. else
  10604. {
  10605. Login3 dlg;
  10606. dlg.SetLiaPath("5.lia");
  10607. dlg.DoModal();
  10608. }
  10609. if (g_user.bLongin == 0)return;
  10610. }
  10611. if (IsHasRightsnew(49) == 0)return;
  10612. SetPathDlg2 dlg;
  10613. dlg.DoModal();
  10614. }
  10615. void CMainFrame::OnShowhis()
  10616. {
  10617. // TODO: Add your command handler code here
  10618. if (g_user.bLongin == 0)
  10619. {
  10620. if (g_bNoLoginLia)
  10621. {
  10622. Login dlg;
  10623. dlg.SetLiaPath("5.lia");
  10624. dlg.DoModal();
  10625. }
  10626. else
  10627. {
  10628. Login3 dlg;
  10629. dlg.SetLiaPath("5.lia");
  10630. dlg.DoModal();
  10631. }
  10632. if (g_user.bLongin == 0)return;
  10633. }
  10634. if (IsHasRightsnew(52) == 0)return;
  10635. CMenu *pMenu = GetMenu();
  10636. CMenu* submenu = pMenu->GetSubMenu(2);
  10637. UINT status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10638. if (status&MF_CHECKED)
  10639. {
  10640. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_UNCHECKED);
  10641. g_bShowOK = 1;
  10642. }
  10643. else
  10644. {
  10645. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  10646. g_bShowOK = 0;
  10647. } m_Mdi.CloseAll();
  10648. }
  10649. void CMainFrame::AddHistoryMenu(CArray<CStringArray, CStringArray>*hisyeararray) // 添加历史数据库菜单;
  10650. {
  10651. #ifdef NEW_SKIN
  10652. CMenu* m_menuXP = GetMenu();
  10653. CMenu* submenu = m_menuXP->GetSubMenu(2);
  10654. // 删除原有菜单;
  10655. int i = 0;
  10656. for ( i = 0; i < 100; i++)
  10657. {
  10658. submenu->DeleteMenu(1000 + i, MF_BYCOMMAND);
  10659. }
  10660. // 重创菜单,从资源ID1000开始;
  10661. for (i = 0; i < hisyeararray->GetSize(); i++)
  10662. {
  10663. submenu->AppendMenu(MF_STRING, 1000 + i, "查看历史数据:" + hisyeararray->ElementAt(i).ElementAt(0)); // 第一项菜单项;
  10664. }
  10665. g_nYearpos = -1;
  10666. #else
  10667. HMENU hMenu = ::GetMenu(m_hWnd);
  10668. m_menuXP.Attach(hMenu);
  10669. BCMenu* submenu = (BCMenu*)m_menuXP.GetSubMenu(2);
  10670. for (int i = 0; i < 100; i++)
  10671. {
  10672. submenu->DeleteMenu (1000+i, MF_BYCOMMAND);
  10673. }
  10674. for( i=0; i<hisyeararray->GetSize (); i++)
  10675. {
  10676. submenu->AppendMenu(MF_STRING, 1000+i, "查看历史数据:"+hisyeararray->ElementAt (i).ElementAt (0)); // 第一项菜单项
  10677. }
  10678. m_menuXP.Detach ();
  10679. g_nYearpos = -1;
  10680. #endif
  10681. }
  10682. /************************************************************************/
  10683. /*
  10684. Jeff
  10685. 函数:AddBranchMenu()
  10686. 参数:CArray<CStringArray, CStringArray> *branchArray
  10687. 返回:void
  10688. 注意:
  10689. 调用关系:
  10690. */
  10691. /************************************************************************/
  10692. void CMainFrame::AddBranchMenu(CArray<CStringArray, CStringArray>*branchArray)
  10693. {
  10694. //WriteTextLog("AddBranchMenu,添加集团版菜单");
  10695. #ifdef ENTERPRISE_VERSION
  10696. CMenu *m_menuXP = GetMenu();
  10697. CMenu* submenu = m_menuXP->GetSubMenu(0);
  10698. int i = 0;
  10699. for ( i = 0; i < 100; i++)
  10700. {
  10701. submenu->DeleteMenu(2000 + i, MF_BYCOMMAND);
  10702. }
  10703. g_menubranchname.RemoveAll();
  10704. CString name;
  10705. int a = 0;
  10706. #if 0 // Jeff.add for test
  10707. CString strCount;
  10708. strCount.Format("历史数据库个数=%d", branchArray->GetSize());
  10709. WriteTextLog(strCount);
  10710. #endif
  10711. for (i = 0; i < branchArray->GetSize() - 1; i++)
  10712. {
  10713. //WriteTextLog("111");
  10714. //WriteTextLog(hisyeararray->ElementAt(i).ElementAt(0));
  10715. //WriteTextLog(name);
  10716. if (name == "")
  10717. {
  10718. name = branchArray->ElementAt(i).ElementAt(0);
  10719. #ifndef SQLSERVER_VERSION
  10720. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10721. a++;
  10722. #endif
  10723. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10724. a++;
  10725. g_menubranchname.Add(name);
  10726. continue;
  10727. }
  10728. else if (branchArray->ElementAt(i).ElementAt(0).Find(name) != -1 && ((branchArray->ElementAt(i).ElementAt(0).GetLength() - name.GetLength()) == 4))
  10729. {
  10730. continue;
  10731. }
  10732. name = branchArray->ElementAt(i).ElementAt(0);
  10733. #ifndef SQLSERVER_VERSION
  10734. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10735. a++;
  10736. #endif
  10737. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10738. g_menubranchname.Add(name);
  10739. a++;
  10740. //WriteTextLog("222");
  10741. }
  10742. if ((branchArray->GetSize() - 1) > 0)
  10743. {
  10744. if (branchArray->ElementAt(0).ElementAt(3) == "总店")
  10745. submenu->AppendMenu(MF_STRING, 2000 + a, "多店数据汇总");
  10746. }
  10747. #endif
  10748. }
  10749. // Jeff:如果选择了历史数据库,则开单的数据会录入到该历史数据库中,而非当前数据库;
  10750. // g_nYearpos==-1,表示当前主数据库,其他>=0的值表示历史数据库在g_historydb中的索引值;
  10751. void CMainFrame::OnHistory(UINT nID) // 选择历史数据库菜单响应;
  10752. {
  10753. CMenu* pMenu = GetMenu();
  10754. CMenu* submenu = pMenu->GetSubMenu(2);
  10755. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10756. if (g_user.bLongin == 0)
  10757. {
  10758. if (g_bNoLoginLia)
  10759. {
  10760. Login dlg;
  10761. dlg.SetLiaPath("5.lia");
  10762. dlg.DoModal();
  10763. }
  10764. else
  10765. {
  10766. Login3 dlg;
  10767. dlg.SetLiaPath("5.lia");
  10768. dlg.DoModal();
  10769. }
  10770. if (g_user.bLongin == 0)return;
  10771. }
  10772. if (IsHasRightsnew(52) == 0)return;
  10773. m_Mdi.CloseAll();
  10774. for (int i = 0; i < 100; i++)
  10775. {
  10776. submenu->CheckMenuItem(1000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10777. }
  10778. if (status&MF_CHECKED)
  10779. {
  10780. g_nYearpos = -1;
  10781. status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10782. if (status&MF_CHECKED)
  10783. g_bShowOK = 0;
  10784. else
  10785. g_bShowOK = 1;
  10786. }
  10787. else
  10788. {
  10789. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10790. g_nYearpos = nID - 1000;
  10791. g_bShowOK = 1;
  10792. }
  10793. }
  10794. void CMainFrame::OnBranchData(UINT nID)
  10795. {
  10796. #ifdef ENTERPRISE_VERSION
  10797. #ifdef SQLSERVER_VERSION
  10798. OnBranchData2(nID);
  10799. return;
  10800. #endif
  10801. #endif
  10802. }
  10803. void CMainFrame::OnBranchData2(UINT nID)
  10804. {
  10805. #ifdef ENTERPRISE_VERSION
  10806. g_bAllBranch = 0;
  10807. m_Mdi.CloseAll();
  10808. OnDisconnect();
  10809. CMenu *pMenu = GetMenu();
  10810. CMenu* submenu = pMenu->GetSubMenu(0);
  10811. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10812. for (int i = 0; i < 100; i++)
  10813. {
  10814. submenu->CheckMenuItem(2000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10815. }
  10816. if (status&MF_CHECKED)
  10817. {
  10818. g_branchname.Empty();
  10819. g_branchip.Empty();
  10820. g_bBranchModify = 0;
  10821. g_user.bLongin = 0;
  10822. if (g_bNoLoginLia)
  10823. {
  10824. Login dlg;
  10825. dlg.SetLiaPath("5.lia");
  10826. dlg.DoModal();
  10827. }
  10828. else
  10829. {
  10830. Login3 dlg;
  10831. dlg.SetLiaPath("5.lia");
  10832. dlg.DoModal();
  10833. }
  10834. g_pMainWnd2->RefreshOutlookBar();
  10835. g_pMainWnd2->DrawLogin();
  10836. g_path1 = g_path1bak;
  10837. g_path2 = g_path2bak;
  10838. g_path3 = g_path3bak;
  10839. g_path4 = g_path4bak;
  10840. g_path5 = g_path5bak;
  10841. g_path6 = g_path6bak;
  10842. g_path7 = g_path7bak;
  10843. g_pMainWnd2->EnableBtns(1);
  10844. }
  10845. else
  10846. {
  10847. BOOL bNeedCheckRights = 1;
  10848. if (g_user.bLongin && g_branchname == "")//无需登陆本店判断其访问分店权限
  10849. {
  10850. bNeedCheckRights = 0;
  10851. }
  10852. #ifndef SQLSERVER_VERSION
  10853. if ((g_menubranchname.GetSize() * 2) == nID - 2000)//多店数据汇总
  10854. #else
  10855. if ((g_menubranchname.GetSize()) == nID - 2000)//多店数据汇总
  10856. #endif
  10857. {
  10858. g_branchname.Empty();
  10859. g_branchip.Empty();
  10860. g_bBranchModify = 0;
  10861. if (bNeedCheckRights)
  10862. {
  10863. g_user.bLongin = 0;
  10864. if (g_user.bLongin == 0)
  10865. {
  10866. if (g_bNoLoginLia)
  10867. {
  10868. Login dlg;
  10869. dlg.SetLiaPath("5.lia");
  10870. dlg.DoModal();
  10871. }
  10872. else
  10873. {
  10874. Login3 dlg;
  10875. dlg.SetLiaPath("5.lia");
  10876. dlg.DoModal();
  10877. }
  10878. if (g_user.bLongin == 0)return;
  10879. }
  10880. }
  10881. if (IsHasRightsnew(28) == 0)
  10882. {
  10883. return;
  10884. }
  10885. g_bAllBranch = 1; g_pMainWnd2->ShowBar(0);
  10886. g_pMainWnd2->RefreshOutlookBar2();
  10887. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10888. g_branchname.Empty();
  10889. g_branchip.Empty();
  10890. g_bBranchModify = 0;
  10891. g_pMainWnd2->DrawLogin();
  10892. g_pMainWnd2->EnableBtns(0);
  10893. g_path1 = g_path1bak;
  10894. g_path2 = g_path2bak;
  10895. g_path3 = g_path3bak;
  10896. g_path4 = g_path4bak;
  10897. g_path5 = g_path5bak;
  10898. g_path6 = g_path6bak;
  10899. g_path7 = g_path7bak;
  10900. }
  10901. else
  10902. {
  10903. if (bNeedCheckRights)
  10904. {
  10905. g_branchname.Empty();
  10906. g_branchip.Empty();
  10907. g_bBranchModify = 0;
  10908. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_UNCHECKED);
  10909. g_user.bLongin = 0;
  10910. if (g_pMainWnd2)
  10911. {
  10912. g_pMainWnd2->DrawLogin();
  10913. g_pMainWnd2->ShowBar(0);
  10914. }
  10915. if (g_bNoLoginLia)
  10916. {
  10917. Login dlg;
  10918. dlg.SetLiaPath("5.lia");
  10919. dlg.DoModal();
  10920. }
  10921. else
  10922. {
  10923. Login3 dlg;
  10924. dlg.SetLiaPath("5.lia");
  10925. dlg.DoModal();
  10926. }
  10927. if (g_user.bLongin == 0)return;
  10928. }
  10929. if (IsHasRightsnew(28) == 0)
  10930. {
  10931. return;
  10932. }
  10933. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10934. #ifndef SQLSERVER_VERSION
  10935. if (nID % 2 == 0)
  10936. g_branchname = g_menubranchname.ElementAt((nID - 2000) / 2);
  10937. else
  10938. g_branchname = g_menubranchname.ElementAt((nID - 2001) / 2);
  10939. #else
  10940. g_branchname = g_menubranchname.ElementAt(nID - 2000);
  10941. #endif
  10942. //printf("选择分店:%s\n", g_branchname);
  10943. g_branchip.Empty();
  10944. CString domainname = "";
  10945. for (int i = 0; i < g_brancharray.GetSize(); i++)
  10946. {
  10947. /*
  10948. for(int j=0; j<g_brancharray.GetSize(); j++)
  10949. printf("%s\n", g_brancharray.ElementAt(i).ElementAt(j));
  10950. */
  10951. if (g_branchname == g_brancharray.ElementAt(i).ElementAt(0))
  10952. {
  10953. g_branchip = g_brancharray.ElementAt(i).ElementAt(1);
  10954. g_branchip2 = g_brancharray.ElementAt(i).ElementAt(4);
  10955. domainname = g_brancharray.ElementAt(i).ElementAt(2);
  10956. }
  10957. }
  10958. g_path1 = g_path1bak;
  10959. g_path2 = g_path2bak;
  10960. g_path3 = g_path3bak;
  10961. g_path4 = g_path4bak;
  10962. g_path5 = g_path5bak;
  10963. g_path6 = g_path6bak;
  10964. g_path7 = g_path7bak;
  10965. if (domainname.IsEmpty())
  10966. {
  10967. g_path1 = g_path2 = g_path3 = g_path4 = g_path5 = g_path6 = g_path7 = "xxx";
  10968. }
  10969. else
  10970. {
  10971. g_path1 += "\\" + domainname;
  10972. g_path2 += "\\" + domainname;
  10973. g_path3 += "\\" + domainname;
  10974. g_path4 += "\\" + domainname;
  10975. g_path5 += "\\" + domainname;
  10976. g_path6 += "\\" + domainname;
  10977. g_path7 += "\\" + domainname;
  10978. }
  10979. g_bBranchModify = 1;
  10980. /* CArray<CStringArray, CStringArray>yeararray;
  10981. for( i=0; i<g_brancharray.GetSize (); i++)
  10982. {
  10983. if(g_brancharray.ElementAt (i).ElementAt (0).Find (g_branchname)!=-1 && g_branchname!=g_brancharray.ElementAt (i).ElementAt (0))
  10984. {
  10985. int size=yeararray.GetSize ();
  10986. yeararray.SetSize(size+1,1);
  10987. CString str=g_brancharray.ElementAt (i).ElementAt (0);
  10988. str.Delete (0, g_branchname.GetLength ());
  10989. yeararray.ElementAt (size).Add (str);
  10990. }
  10991. }
  10992. AddHistoryMenu(&yeararray);*/
  10993. if (g_bBranchModify)OnDisconnect();
  10994. if (1)
  10995. {
  10996. g_user.bLongin = 0;
  10997. g_user.name.Empty();
  10998. g_user.rights.Empty();
  10999. g_user.account.Empty();
  11000. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  11001. g_pMainWnd2->RefreshOutlookBar();
  11002. m_Mdi.CloseAll();
  11003. if (g_pMainWnd2)
  11004. {
  11005. g_pMainWnd2->DrawLogin();
  11006. g_pMainWnd2->ShowBar(0);
  11007. }
  11008. if (g_bNoLoginLia)
  11009. {
  11010. Login dlg;
  11011. dlg.SetLiaPath("5.lia");
  11012. dlg.DoModal();
  11013. }
  11014. else
  11015. {
  11016. Login3 dlg;
  11017. dlg.SetLiaPath("5.lia");
  11018. dlg.DoModal();
  11019. }
  11020. if (g_user.bLongin == 0)return;
  11021. if (g_pMainWnd2)g_pMainWnd2->ShowBar(1);
  11022. }
  11023. g_pMainWnd2->DrawLogin();
  11024. g_pMainWnd2->EnableBtns(1);
  11025. }
  11026. g_nYearpos = -1;
  11027. }
  11028. #endif
  11029. }
  11030. void CMainFrame::OnStaffAchievementShow() //Jeff:此机只用于员工看业绩;
  11031. {
  11032. // TODO: Add your command handler code here
  11033. if (g_user.bLongin == 0) // 是否登陆系统;
  11034. {
  11035. if (g_bNoLoginLia)
  11036. {
  11037. Login dlg;
  11038. dlg.SetLiaPath("5.lia");
  11039. dlg.DoModal();
  11040. }
  11041. else
  11042. {
  11043. Login3 dlg;
  11044. dlg.SetLiaPath("5.lia");
  11045. dlg.DoModal();
  11046. }
  11047. if (g_user.bLongin == 0)return;
  11048. }
  11049. if (IsHasRightsnew(49) == 0)return;// 是否有权限进行设置;
  11050. CMenu *pMenu = GetMenu();
  11051. CMenu* submenu = pMenu->GetSubMenu(1);
  11052. UINT status = submenu->GetMenuState(IDM_StaffAchievementShow, MF_BYCOMMAND);
  11053. if (status&MF_CHECKED)
  11054. {
  11055. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_UNCHECKED);
  11056. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status2", 0);
  11057. g_bStaffAchievementShow = 0;
  11058. TCHAR szKey[MAX_PATH];
  11059. TCHAR szDir[MAX_PATH];
  11060. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  11061. HKEY hKey = 0;
  11062. DWORD disp = 0;
  11063. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  11064. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  11065. if (lResult == ERROR_SUCCESS)
  11066. {
  11067. RegDeleteValue(hKey, "YLGLMAINAUTORUN");
  11068. RegDeleteKey(hKey, "YLGLMAINAUTORUN");
  11069. RegCloseKey(hKey);
  11070. }
  11071. }
  11072. else
  11073. {
  11074. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  11075. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status2", 1);
  11076. g_bStaffAchievementShow = 1;
  11077. TCHAR szKey[MAX_PATH];
  11078. TCHAR szDir[MAX_PATH];
  11079. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  11080. HKEY hKey = 0;
  11081. DWORD disp = 0;
  11082. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  11083. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  11084. if (lResult == ERROR_SUCCESS)
  11085. {
  11086. lResult = RegSetValueEx(hKey, "YLGLMAINAUTORUN", 0, REG_SZ, (const unsigned char*)szDir, lstrlen(szDir));
  11087. RegCloseKey(hKey);
  11088. }
  11089. StaffAchievementSet dlg;
  11090. dlg.DoModal();
  11091. }
  11092. }
  11093. void CMainFrame::PrintDinDan2(CString m_id)
  11094. {
  11095. #ifdef MODERN_VERSION
  11096. SelContent seldlg;
  11097. if (seldlg.DoModal() != IDOK)return;
  11098. CPrintRX m_Print;
  11099. m_Print.InitToPrint(NULL, 1);
  11100. m_Print.StartPrint();
  11101. m_Print.StartPage();
  11102. // CRect StrRect(0,0,560,818);
  11103. LoadRect load;
  11104. LoadRect load2;
  11105. LoadRect load3;
  11106. load.SetLiaPath ("9.lia");
  11107. load.SetMargins(-14,0);
  11108. if(!load.Load ())return;
  11109. int i;
  11110. //////////////////////////////////////////////////////////////
  11111. CStringArray txarray;
  11112. CString filter="id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"'";
  11113. g_sendhead.code[0]=11;
  11114. g_sendhead.code[1]=52;
  11115. g_sendhead.code[2]=50;
  11116. g_sendhead.code[3]=38;
  11117. g_sendhead.code[4]=27;
  11118. g_sendhead.tabcount=5;
  11119. g_sendhead.bsql=0;
  11120. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  11121. CArray<CStringArray, CStringArray>sparray;
  11122. CArray<CStringArray, CStringArray>clientarray;
  11123. CArray<CStringArray, CStringArray>phonearray;
  11124. CArray<CStringArray, CStringArray>bukuan2array;
  11125. CArray<CStringArray, CStringArray>bukuanarray;
  11126. DataToArray(&g_List1array, &clientarray, &sparray, &bukuan2array, &bukuanarray);
  11127. CTime tm=CTime::GetCurrentTime ();
  11128. CString str;
  11129. CString m_money1 = g_List1array.ElementAt (0).ElementAt (1);
  11130. CString m_money2 = g_List1array.ElementAt (0).ElementAt (2);
  11131. CString m_money3 = g_List1array.ElementAt (0).ElementAt (3);
  11132. CString m_name1 = g_List1array.ElementAt (0).ElementAt (4);
  11133. CString m_name2 = g_List1array.ElementAt (0).ElementAt (5);
  11134. CString m_taoxiname= g_List1array.ElementAt (0).ElementAt (7);
  11135. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (8);
  11136. CString m_zs = g_List1array.ElementAt (0).ElementAt (9);
  11137. CString m_time1 = g_List1array.ElementAt (0).ElementAt (10);
  11138. CString m_time2 = g_List1array.ElementAt (0).ElementAt (11);
  11139. CString m_time3 = g_List1array.ElementAt (0).ElementAt (12);
  11140. CString m_ren = g_List1array.ElementAt (0).ElementAt (14);
  11141. CString m_discount = g_List1array.ElementAt (0).ElementAt (15);
  11142. CString m_payed1 = g_List1array.ElementAt (0).ElementAt (16);
  11143. CString m_payed2 = g_List1array.ElementAt (0).ElementAt (17);
  11144. CString m_payed3 = g_List1array.ElementAt (0).ElementAt (18);
  11145. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (19);
  11146. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (20);
  11147. CString m_time4 = g_List1array.ElementAt (0).ElementAt (21);
  11148. CString m_time5 = g_List1array.ElementAt (0).ElementAt (22);
  11149. CString m_clothescount = g_List1array.ElementAt (0).ElementAt (26);
  11150. CString m_clothescount2 = g_List1array.ElementAt (0).ElementAt (27);
  11151. CString m_outside = g_List1array.ElementAt (0).ElementAt (28);
  11152. CString m_outside2 = g_List1array.ElementAt (0).ElementAt (29);
  11153. CString m_style = g_List1array.ElementAt (0).ElementAt (30);
  11154. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (34);
  11155. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (35);
  11156. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (37);
  11157. CString m_bz = g_List1array.ElementAt (0).ElementAt (38);
  11158. CString m_phone1=clientarray.ElementAt (0).ElementAt (3);
  11159. CString m_phone2=clientarray.ElementAt (0).ElementAt (4);
  11160. CString m_addr1=clientarray.ElementAt (0).ElementAt (7);
  11161. CString m_addr2=clientarray.ElementAt (0).ElementAt (8);
  11162. CString m_occupation1=clientarray.ElementAt (0).ElementAt (9);
  11163. CString m_occupation2=clientarray.ElementAt (0).ElementAt (10);
  11164. filter="name='"+m_ren+"'";
  11165. g_sendhead.code[0]=5;
  11166. g_sendhead.tabcount=1;
  11167. g_sendhead.bsql=0;
  11168. int g_nYearposTemp=g_nYearpos;
  11169. g_nYearpos=-1;
  11170. g_pMainWnd->ProcessChatMessageRequest2(filter);
  11171. g_nYearpos=g_nYearposTemp;
  11172. if(g_bSendOK==0)return;
  11173. DataToArray(&phonearray);
  11174. m_money2.Format ("%f", atof(m_payed5)+atof(m_money1));
  11175. m_money1.Format ("%f", atof(m_taoxijiage)+atof(m_payed4));
  11176. m_money3.Format ("%f", atof(m_money1)-atof(m_money2));
  11177. ConvertToPrice(m_money1);
  11178. ConvertToPrice(m_money2);
  11179. ConvertToPrice(m_money3);
  11180. ////////////////////////////////////////////////////////////////
  11181. int rcpos=-1;
  11182. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  11183. Image *pImg=NULL;
  11184. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo2.jpg");
  11185. if(seldlg.m_bFrame)
  11186. m_Print.DrawImage(pImg, StrRect);
  11187. delete pImg;
  11188. m_Print.SetFontFace(16, 1, "黑体");
  11189. StrRect=load.m_rcarray .ElementAt (++rcpos);
  11190. if(seldlg.m_bFrame)
  11191. ///////////////////////////////不用改
  11192. m_Print.DrawText((LPTSTR)(LPCTSTR)"摩登新娘工作流程单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11193. m_Print.SetFontFace(10, 1, "宋体");
  11194. for( i=3; i<=6; i++)
  11195. {
  11196. StrRect=load.m_rcarray .ElementAt (i-1);
  11197. if(seldlg.m_bFrame)
  11198. m_Print.DrawRect2(StrRect, 1);
  11199. }
  11200. CStringArray strarray;
  11201. if(seldlg.m_bBooking==0)
  11202. {
  11203. m_name1.Empty ();
  11204. m_name2.Empty ();
  11205. m_phone1.Empty ();
  11206. m_phone2.Empty ();
  11207. m_addr1.Empty ();
  11208. m_addr2.Empty ();
  11209. m_taoxiname.Empty ();
  11210. m_taoxijiage.Empty ();
  11211. }
  11212. if(seldlg.m_bFrame )
  11213. {
  11214. strarray.Add("新郎:"+m_name1);
  11215. strarray.Add("H");
  11216. strarray.Add("O");
  11217. strarray.Add("手机:"+m_phone1);
  11218. strarray.Add("新娘:"+m_name2);
  11219. strarray.Add("H");
  11220. strarray.Add("O");
  11221. strarray.Add("手机:"+m_phone2);
  11222. }
  11223. else
  11224. {
  11225. strarray.Add(" "+m_name1);
  11226. strarray.Add("");
  11227. strarray.Add("");
  11228. strarray.Add(" "+m_phone1);
  11229. strarray.Add(" "+m_name2);
  11230. strarray.Add("");
  11231. strarray.Add("");
  11232. strarray.Add(" "+m_phone2);
  11233. }
  11234. for( i=7; i<=14; i++)
  11235. {
  11236. StrRect=load.m_rcarray .ElementAt (i-1);
  11237. StrRect.left +=2;
  11238. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11239. }
  11240. StrRect=load.m_rcarray .ElementAt (3);
  11241. StrRect.left +=2;
  11242. if(seldlg.m_bFrame)
  11243. str="地址:"+m_addr1;
  11244. else
  11245. str=" "+m_addr1;
  11246. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11247. StrRect=load.m_rcarray .ElementAt (5);
  11248. StrRect.left +=2;
  11249. if(seldlg.m_bFrame)
  11250. str="地址:"+m_addr2;
  11251. else
  11252. str=" "+m_addr2;
  11253. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11254. //////////////////////////////////////////////////////
  11255. StrRect=load.m_rcarray .ElementAt (14);
  11256. str="预\r\n约";
  11257. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11258. StrRect.top +=46;
  11259. StrRect.left +=2;
  11260. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11261. m_Print.SetFontFace(10, 1, "宋体");
  11262. StrRect=load.m_rcarray .ElementAt (15);
  11263. if(seldlg.m_bFrame)
  11264. str="套系名称:"+m_taoxiname;
  11265. else
  11266. str=" "+m_taoxiname;
  11267. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11268. StrRect.left +=4;
  11269. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11270. StrRect=load.m_rcarray .ElementAt (16);
  11271. if(seldlg.m_bFrame)
  11272. str="单价:"+m_taoxijiage;
  11273. else
  11274. str=" "+m_taoxijiage;
  11275. StrRect.left +=2;
  11276. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11277. StrRect=load.m_rcarray .ElementAt (21);
  11278. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11279. str="新人签名:";
  11280. StrRect.left +=2;
  11281. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11282. StrRect=load.m_rcarray .ElementAt (22);
  11283. if(seldlg.m_bBooking==0)
  11284. {
  11285. if(seldlg.m_bFrame)
  11286. str="未付款:";
  11287. else
  11288. str=" ";
  11289. }
  11290. else
  11291. {
  11292. if(seldlg.m_bFrame)
  11293. str="未付款:"+m_money3;
  11294. else
  11295. str=" "+m_money3;
  11296. }
  11297. StrRect.left +=2;
  11298. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11299. StrRect=load.m_rcarray .ElementAt (23);
  11300. str="结婚秘书:";
  11301. StrRect.left +=2;
  11302. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11303. StrRect=load.m_rcarray .ElementAt (24);
  11304. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11305. StrRect.left +=3;
  11306. StrRect.top +=3;
  11307. StrRect.right -=2;
  11308. StrRect.bottom -=2;
  11309. int realpos=0;str="";
  11310. for(i=0; i<sparray.GetSize (); i++)
  11311. {
  11312. if(atoi(sparray.ElementAt (i).ElementAt (4))!=1)continue;
  11313. str+=sparray.ElementAt (i).ElementAt (5);
  11314. str+=" 数量:";
  11315. str+=sparray.ElementAt (i).ElementAt (3);
  11316. if(realpos%2)
  11317. str+="\r\n";
  11318. else
  11319. str+=" ";
  11320. realpos++;
  11321. }
  11322. str.TrimRight ("\r\n");
  11323. str.TrimRight (" ");
  11324. if(seldlg.m_bBooking)AutoDraw(m_Print, StrRect, str, 1.4);
  11325. ///////////////////////////////////////////////////////////
  11326. StrRect=load.m_rcarray .ElementAt (14);
  11327. StrRect.top +=1*122;
  11328. StrRect.bottom +=1*122;
  11329. str="拍\r\n照";
  11330. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11331. StrRect.top +=46;
  11332. StrRect.left +=2;
  11333. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11334. m_Print.SetFontFace(10, 1, "宋体");
  11335. StrRect=load.m_rcarray .ElementAt (15);
  11336. StrRect.top +=1*122;
  11337. StrRect.bottom +=1*122;
  11338. str="拍照内容: 白 晚 特 便";
  11339. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11340. StrRect.left +=4;
  11341. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11342. StrRect=load.m_rcarray .ElementAt (21);
  11343. StrRect.top +=1*122;
  11344. StrRect.bottom +=1*122;
  11345. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11346. str=" 新人签名:";
  11347. StrRect.left +=2;
  11348. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11349. StrRect=load.m_rcarray .ElementAt (22);
  11350. StrRect.top +=1*122;
  11351. StrRect.bottom +=1*122;
  11352. if(seldlg.m_bTake)
  11353. {
  11354. if(seldlg.m_bFrame)
  11355. str="未付款:"+m_money3;
  11356. else
  11357. str=" "+m_money3;
  11358. }
  11359. else
  11360. {
  11361. if(seldlg.m_bFrame)
  11362. str="未付款:";
  11363. else
  11364. str=" ";
  11365. }
  11366. StrRect.left +=2;
  11367. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11368. StrRect=load.m_rcarray .ElementAt (23);
  11369. StrRect.top +=1*122;
  11370. StrRect.bottom +=1*122;
  11371. str="结婚秘书:";
  11372. StrRect.left +=2;
  11373. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11374. StrRect=load.m_rcarray .ElementAt (24);
  11375. StrRect.top +=1*122;
  11376. StrRect.bottom +=1*122;
  11377. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11378. StrRect.left +=3;
  11379. StrRect.top +=3;
  11380. StrRect.right -=2;
  11381. StrRect.bottom -=2;
  11382. if(seldlg.m_bTake)
  11383. {
  11384. str="";
  11385. for(i=0; i<bukuan2array.GetSize (); i++)
  11386. {
  11387. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=1)continue;
  11388. str+="加挑: ";
  11389. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11390. str+="\r\n";
  11391. }
  11392. str.TrimRight ("\r\n");
  11393. str.TrimRight (" ");
  11394. AutoDraw(m_Print, StrRect, str, 1.4);
  11395. }
  11396. ///////////////////////////////////////////////////////////
  11397. StrRect=load.m_rcarray .ElementAt (14);
  11398. StrRect.top +=2*122;
  11399. StrRect.bottom +=2*122;
  11400. str="选\r\n样";
  11401. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11402. StrRect.top +=46;
  11403. StrRect.left +=2;
  11404. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11405. m_Print.SetFontFace(10, 1, "宋体");
  11406. StrRect=load.m_rcarray .ElementAt (15);
  11407. StrRect.top +=2*122;
  11408. StrRect.bottom +=2*122;
  11409. str="选片内容:";
  11410. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11411. StrRect.left +=4;
  11412. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11413. StrRect=load.m_rcarray .ElementAt (21);
  11414. StrRect.top +=2*122;
  11415. StrRect.bottom +=2*122;
  11416. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11417. str=" 新人签名:";
  11418. StrRect.left +=2;
  11419. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11420. StrRect=load.m_rcarray .ElementAt (22);
  11421. StrRect.top +=2*122;
  11422. StrRect.bottom +=2*122;
  11423. if(seldlg.m_bChoose)
  11424. {
  11425. if(seldlg.m_bFrame)
  11426. str="未付款:"+m_money3;
  11427. else
  11428. str=" "+m_money3;
  11429. }
  11430. else
  11431. {
  11432. if(seldlg.m_bFrame)
  11433. str="未付款:";
  11434. else
  11435. str=" ";
  11436. }
  11437. StrRect.left +=2;
  11438. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11439. StrRect=load.m_rcarray .ElementAt (23);
  11440. StrRect.top +=2*122;
  11441. StrRect.bottom +=2*122;
  11442. str="结婚秘书:";
  11443. StrRect.left +=2;
  11444. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11445. StrRect=load.m_rcarray .ElementAt (24);
  11446. StrRect.top +=2*122;
  11447. StrRect.bottom +=2*122;
  11448. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11449. if(seldlg.m_bChoose)
  11450. {
  11451. StrRect.left +=3;
  11452. StrRect.top +=3;
  11453. StrRect.right -=2;
  11454. StrRect.bottom -=2;
  11455. str="";
  11456. for(i=0; i<bukuan2array.GetSize (); i++)
  11457. {
  11458. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=2)continue;
  11459. str+="加挑: ";
  11460. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11461. str+="\r\n";
  11462. }
  11463. str.TrimRight ("\r\n");
  11464. str.TrimRight (" ");
  11465. AutoDraw(m_Print, StrRect, str, 1.4);
  11466. }
  11467. ///////////////////////////////////////////////////////////
  11468. StrRect=load.m_rcarray .ElementAt (14);
  11469. StrRect.top +=3*122;
  11470. StrRect.bottom +=3*122;
  11471. str="结\r\n婚";
  11472. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11473. StrRect.top +=46;
  11474. StrRect.left +=2;
  11475. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11476. m_Print.SetFontFace(10, 1, "宋体");
  11477. StrRect=load.m_rcarray .ElementAt (15);
  11478. StrRect.top +=3*122;
  11479. StrRect.bottom +=3*122;
  11480. str="结婚内容: 区 白 晚 押金:";
  11481. if(seldlg.m_bFrame) m_Print.DrawRect2(StrRect, 1);
  11482. StrRect.left +=4;
  11483. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11484. StrRect=load.m_rcarray .ElementAt (21);
  11485. StrRect.top +=3*122;
  11486. StrRect.bottom +=3*122;
  11487. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11488. str=" 新人签名:";
  11489. StrRect.left +=2;
  11490. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11491. StrRect=load.m_rcarray .ElementAt (22);
  11492. StrRect.top +=3*122;
  11493. StrRect.bottom +=3*122;
  11494. if(seldlg.m_bBooking)
  11495. {
  11496. if(seldlg.m_bFrame)
  11497. str="未付款:"+m_money3;
  11498. else
  11499. str=" "+m_money3;
  11500. }
  11501. else
  11502. {
  11503. if(seldlg.m_bFrame)
  11504. str="未付款:";
  11505. else
  11506. str=" ";
  11507. }
  11508. StrRect.left +=2;
  11509. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11510. StrRect=load.m_rcarray .ElementAt (23);
  11511. StrRect.top +=3*122;
  11512. StrRect.bottom +=3*122;
  11513. str="结婚秘书:";
  11514. StrRect.left +=2;
  11515. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11516. StrRect=load.m_rcarray .ElementAt (24);
  11517. StrRect.top +=3*122;
  11518. StrRect.bottom +=3*122;
  11519. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11520. if(seldlg.m_bBooking)
  11521. {
  11522. StrRect.left +=3;
  11523. StrRect.top +=3;
  11524. StrRect.right -=2;
  11525. StrRect.bottom -=2;
  11526. realpos=0;str="";
  11527. for(i=0; i<sparray.GetSize (); i++)
  11528. {
  11529. if(atoi(sparray.ElementAt (i).ElementAt (4))!=2)continue;
  11530. str+=sparray.ElementAt (i).ElementAt (5);
  11531. str+=" 数量:";
  11532. str+=sparray.ElementAt (i).ElementAt (3);
  11533. if(realpos%2)
  11534. str+="\r\n";
  11535. else
  11536. str+=" ";
  11537. realpos++;
  11538. }
  11539. str.TrimRight ("\r\n");
  11540. str.TrimRight (" ");
  11541. AutoDraw(m_Print, StrRect, str, 1.4);
  11542. }
  11543. ///////////////////////////////////////
  11544. strarray.RemoveAll ();
  11545. if(seldlg.m_bFrame)
  11546. {
  11547. strarray.Add ("项目");
  11548. strarray.Add ("万");
  11549. strarray.Add ("千");
  11550. strarray.Add ("百");
  11551. strarray.Add ("十");
  11552. strarray.Add ("个");
  11553. strarray.Add ("收 银");
  11554. }
  11555. else
  11556. {
  11557. strarray.Add ("");
  11558. strarray.Add ("");
  11559. strarray.Add ("");
  11560. strarray.Add ("");
  11561. strarray.Add ("");
  11562. strarray.Add ("");
  11563. strarray.Add ("");
  11564. }
  11565. CStringArray strarray2;
  11566. float ftotal=0;
  11567. int realcount=0;
  11568. if(seldlg.m_bBooking)
  11569. {
  11570. for(i=0; i<bukuanarray.GetSize (); i++)
  11571. {
  11572. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=3 && atoi(bukuanarray.ElementAt (i).ElementAt (6))!=4)continue;
  11573. realcount++;
  11574. if(realcount>6)break;
  11575. str=bukuanarray.ElementAt (i).ElementAt (1);
  11576. ftotal+=atof(str);
  11577. strarray2.Add (GetW(str));
  11578. strarray2.Add (GetK(str));
  11579. strarray2.Add (GetB(str));
  11580. strarray2.Add (GetS(str));
  11581. strarray2.Add (GetG(str));
  11582. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11583. }
  11584. }
  11585. while(strarray2.GetSize ()<36)
  11586. strarray2.Add ("");
  11587. str.Format ("%f", ftotal);
  11588. strarray2.Add (GetW(str));
  11589. strarray2.Add (GetK(str));
  11590. strarray2.Add (GetB(str));
  11591. strarray2.Add (GetS(str));
  11592. strarray2.Add (GetG(str));
  11593. strarray2.Add ("");
  11594. //拍照
  11595. ftotal=0;
  11596. realcount=0;
  11597. if(seldlg.m_bTake)
  11598. {
  11599. for(i=0; i<bukuanarray.GetSize (); i++)
  11600. {
  11601. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=1)continue;
  11602. realcount++;
  11603. if(realcount>6)break;
  11604. str=bukuanarray.ElementAt (i).ElementAt (1);
  11605. ftotal+=atof(str);
  11606. strarray2.Add (GetW(str));
  11607. strarray2.Add (GetK(str));
  11608. strarray2.Add (GetB(str));
  11609. strarray2.Add (GetS(str));
  11610. strarray2.Add (GetG(str));
  11611. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11612. }
  11613. }
  11614. while(strarray2.GetSize ()<42+36)
  11615. strarray2.Add ("");
  11616. str.Format ("%f", ftotal);
  11617. strarray2.Add (GetW(str));
  11618. strarray2.Add (GetK(str));
  11619. strarray2.Add (GetB(str));
  11620. strarray2.Add (GetS(str));
  11621. strarray2.Add (GetG(str));
  11622. strarray2.Add ("");
  11623. //选片
  11624. ftotal=0;
  11625. realcount=0;
  11626. if(seldlg.m_bChoose)
  11627. {
  11628. for(i=0; i<bukuanarray.GetSize (); i++)
  11629. {
  11630. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=2)continue;
  11631. realcount++;
  11632. if(realcount>6)break;
  11633. str=bukuanarray.ElementAt (i).ElementAt (1);
  11634. ftotal+=atof(str);
  11635. strarray2.Add (GetW(str));
  11636. strarray2.Add (GetK(str));
  11637. strarray2.Add (GetB(str));
  11638. strarray2.Add (GetS(str));
  11639. strarray2.Add (GetG(str));
  11640. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11641. }
  11642. }
  11643. while(strarray2.GetSize ()<42*2+36)
  11644. strarray2.Add ("");
  11645. str.Format ("%f", ftotal);
  11646. strarray2.Add (GetW(str));
  11647. strarray2.Add (GetK(str));
  11648. strarray2.Add (GetB(str));
  11649. strarray2.Add (GetS(str));
  11650. strarray2.Add (GetG(str));
  11651. strarray2.Add ("");
  11652. /////////////////////////////
  11653. CRect temprc;
  11654. for(int n=0; n<4; n++)
  11655. {
  11656. StrRect=load.m_rcarray .ElementAt (17);
  11657. StrRect.top +=n*122;
  11658. StrRect.bottom +=n*122;
  11659. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11660. StrRect=load.m_rcarray .ElementAt (18);
  11661. if(n)
  11662. {
  11663. StrRect.left +=36;
  11664. StrRect.right +=36;
  11665. }
  11666. StrRect.top +=n*122;
  11667. StrRect.bottom +=n*122;
  11668. if(seldlg.m_bFrame)
  11669. str.Format("%d年", tm.GetYear ());
  11670. else
  11671. str.Format("%d ", tm.GetYear ());
  11672. 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))
  11673. {
  11674. if(seldlg.m_bFrame)
  11675. str=" 年";
  11676. else
  11677. str=" ";
  11678. }
  11679. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11680. StrRect=load.m_rcarray .ElementAt (19);
  11681. if(n)
  11682. {
  11683. StrRect.left +=38;
  11684. StrRect.right +=38;
  11685. }
  11686. StrRect.top +=n*122;
  11687. StrRect.bottom +=n*122;
  11688. if(seldlg.m_bFrame)
  11689. str.Format("%02d月", tm.GetMonth ());
  11690. else
  11691. str.Format("%02d ", tm.GetMonth ());
  11692. 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))
  11693. {
  11694. if(seldlg.m_bFrame)
  11695. str=" 月";
  11696. else
  11697. str=" ";
  11698. }
  11699. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11700. StrRect=load.m_rcarray .ElementAt (20);
  11701. if(n)
  11702. {
  11703. StrRect.left +=36;
  11704. StrRect.right +=36;
  11705. }
  11706. StrRect.top +=n*122;
  11707. StrRect.bottom +=n*122;
  11708. if(seldlg.m_bFrame)
  11709. str.Format("%02d日", tm.GetDay ());
  11710. else
  11711. str.Format("%02d ", tm.GetDay ());
  11712. 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))
  11713. {
  11714. if(seldlg.m_bFrame)
  11715. str=" 日";
  11716. else
  11717. str=" ";
  11718. }
  11719. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11720. for(i=26; i<=32; i++)
  11721. {
  11722. StrRect=load.m_rcarray .ElementAt (i-1);
  11723. StrRect.bottom -=14;
  11724. for(int j=0; j<8; j++)
  11725. {
  11726. StrRect.top=StrRect.bottom;
  11727. if(j>2)
  11728. {
  11729. StrRect.bottom =StrRect.top+14;
  11730. }
  11731. else
  11732. {
  11733. StrRect.bottom =StrRect.top+13;
  11734. }
  11735. temprc=StrRect;
  11736. StrRect.top +=n*122;
  11737. StrRect.bottom +=n*122;
  11738. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11739. if(i==26 && j==4 && seldlg.m_bFrame)
  11740. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11741. else if(i==26 && j==5 && seldlg.m_bFrame)
  11742. m_Print.DrawText((LPTSTR)(LPCTSTR)"付款", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11743. else if(i==26 && j==7 && seldlg.m_bFrame)
  11744. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11745. else if(j==0)
  11746. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-26), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11747. else if(j && i>26 && n<3)
  11748. {
  11749. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray2.ElementAt ((j-1)*6+(i-27)+n*42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11750. }
  11751. StrRect=temprc;
  11752. }
  11753. }
  11754. }
  11755. if(seldlg.m_bFrame)
  11756. {
  11757. StrRect=load.m_rcarray .ElementAt (32);
  11758. str="注\r\n意\r\n事\r\n项";
  11759. StrRect.top +=367;
  11760. StrRect.bottom +=367;
  11761. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11762. StrRect.top +=17;
  11763. StrRect.left +=2;
  11764. AutoDraw(m_Print, StrRect, str, 1.4);
  11765. StrRect=load.m_rcarray .ElementAt (33);
  11766. str="1: 本预约单自预定日期起一年内有效.定金在拍照套系金额中扣出.预定金一概不退\r\n\
  11767. 2: 多拍照片只供筛选.恕不奉送.版权所有.不得私自拷贝\r\n\
  11768. 3: 拍照款请于拍照时一次付清\r\n\
  11769. 4: 新娘装AM8:00前钟点费另计.婚纱礼服出租押金500-2000元\r\n\
  11770. 5: 本公司设有豪华VIP礼服区.及皇家御用礼服展区.但需另外加价.详情请咨本店人员\r\n\
  11771. 6: 安瓶, 美甲一次性化妆用具等均属增值服务部分,则需另外加价,详情咨询本店工作人员\r\n\
  11772. 7: 本电脑机械故障导致文件资料丢失.本公司只提供补拍服务\r\n\
  11773. 8: 每次前来请务必携带本单交给工作人员.本单是您在摩登新娘拍照的凭证.办理有关手续凭本单办理盖\r\n\
  11774. 章后方可生效";
  11775. StrRect.top +=367;
  11776. StrRect.bottom +=367;
  11777. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11778. StrRect.top +=4;
  11779. StrRect.left +=2;
  11780. AutoDraw(m_Print, StrRect, str, 1.0);
  11781. StrRect=load.m_rcarray .ElementAt (34);
  11782. 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)";
  11783. AutoDraw(m_Print, StrRect, str, 1.0);
  11784. m_Print.SetFontFace(13, 1, "宋体");
  11785. StrRect=load.m_rcarray .ElementAt (35);
  11786. str="地 址: 汉口 . 解放大道 . 头道街东部购物公园C栋二,三层";
  11787. StrRect.top +=367;
  11788. StrRect.bottom +=367;
  11789. StrRect.left +=2;
  11790. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11791. StrRect=load.m_rcarray .ElementAt (36);
  11792. str="喜讯热线: 027-81888799 81888599 81888699";
  11793. StrRect.top +=367;
  11794. StrRect.bottom +=367;
  11795. StrRect.left +=2;
  11796. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11797. }
  11798. PrintPreview dlg;
  11799. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  11800. dlg.m_pDC =m_Print.GetPDC() ;
  11801. if(dlg.DoModal ()!=IDOK)return;
  11802. //结束打印
  11803. m_Print.EndPage();
  11804. m_Print.EndPrint();
  11805. #endif
  11806. }
  11807. extern CString GetHMoney(CString str);
  11808. void CMainFrame::PrintReceipt3(CString strOrderNumber, CStringArray *pArray, float money)
  11809. {
  11810. int printcot = 1;
  11811. for (int aa = 0; aa < printcot; aa++)
  11812. {
  11813. g_sendhead.bsql = 0;
  11814. g_sendhead.code[0] = 24;
  11815. g_sendhead.tabcount = 1;
  11816. int g_nYearposTemp = g_nYearpos;
  11817. g_nYearpos = -1;
  11818. g_pMainWnd->ProcessChatMessageRequest2(1);
  11819. g_nYearpos = g_nYearposTemp;
  11820. if (0 == g_bSendOK)return;
  11821. DataToArray(&g_cominfoarray);
  11822. CString SerialNo;
  11823. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  11824. CPrintRX m_Print;
  11825. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  11826. {
  11827. m_Print.InitToPrint(NULL, 1);
  11828. }
  11829. else
  11830. {
  11831. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  11832. if (name.IsEmpty())
  11833. m_Print.InitToPrint(NULL, 1);
  11834. else
  11835. {
  11836. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  11837. if (nret == -1 && aa == 0)
  11838. {
  11839. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  11840. }
  11841. }
  11842. }
  11843. m_Print.StartPrint();
  11844. m_Print.StartPage();
  11845. LoadRect load;
  11846. load.SetLiaPath("15.lia");
  11847. load.SetMargins(0, 0);
  11848. if (!load.Load())return;
  11849. int i;
  11850. //////////////////////////////////////////////////////////////
  11851. CStringArray txarray;
  11852. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  11853. g_sendhead.code[0] = 11;
  11854. g_sendhead.code[1] = 52;
  11855. g_sendhead.tabcount = 2;
  11856. g_sendhead.bsql = 0;
  11857. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  11858. CArray<CStringArray, CStringArray>sparray;
  11859. CArray<CStringArray, CStringArray>clientarray;
  11860. DataToArray(&g_List1array, &clientarray);
  11861. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  11862. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  11863. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  11864. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  11865. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  11866. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  11867. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  11868. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  11869. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  11870. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  11871. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  11872. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  11873. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  11874. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  11875. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  11876. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  11877. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  11878. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  11879. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  11880. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  11881. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  11882. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  11883. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  11884. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  11885. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  11886. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  11887. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  11888. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  11889. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  11890. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  11891. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  11892. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  11893. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  11894. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  11895. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  11896. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  11897. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  11898. CString m_addr = m_addr1 + ";";
  11899. m_addr.TrimLeft(";");
  11900. m_addr += m_addr2;
  11901. CString m_qq = m_qq1 + ";";
  11902. m_qq.TrimLeft(";");
  11903. m_qq += m_qq2;
  11904. m_money1.Format("%f", atof(m_taoxijiage));
  11905. m_money2.Format("%f", atof(m_payed1));
  11906. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  11907. ConvertToPrice(m_money1);
  11908. ConvertToPrice(m_money2);
  11909. ConvertToPrice(m_money3);
  11910. ////////////////////////////////////////////////////////////////
  11911. int rcpos = -1;
  11912. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  11913. m_Print.SetFontFace(17, 1, "宋体");
  11914. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11915. StrRect.top -= 0;
  11916. StrRect.bottom -= 10;
  11917. StrRect.left -= 140;
  11918. StrRect.right = StrRect.left + 48;
  11919. m_Print.SetFontFace(15, 1, "宋体");
  11920. m_Print.SetColor(0xffffff);
  11921. m_Print.DrawRect(StrRect, 0);
  11922. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11923. StrRect.left = StrRect.right;
  11924. StrRect.right = StrRect.left + 48;
  11925. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  11926. m_Print.SetColor(0, RGB(255, 0, 0));
  11927. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11928. m_Print.SetColor(0);
  11929. m_Print.SetFontFace(12, 1, "宋体");
  11930. StrRect.left -= 48;
  11931. int hei = StrRect.Height();
  11932. StrRect.top = StrRect.bottom + 2;
  11933. StrRect.bottom += hei + 2;
  11934. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11935. StrRect.top = StrRect.bottom - 2;
  11936. StrRect.bottom += hei - 5;
  11937. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  11938. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11939. m_Print.SetFontFace(12, 1, "宋体");
  11940. m_Print.DrawText((LPTSTR)(LPCTSTR)"收款单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11941. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11942. m_Print.SetFontFace(9, 1, "宋体");
  11943. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11944. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11945. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11946. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11947. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11948. m_Print.DrawRect2(StrRect, 2);
  11949. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11950. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11951. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11952. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11953. m_Print.DrawRect2(StrRect, 2);
  11954. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11955. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11956. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11957. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11958. m_Print.DrawRect2(StrRect, 2);
  11959. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11960. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约地点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11961. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11962. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11963. m_Print.DrawRect2(StrRect, 2);
  11964. ////////////
  11965. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11966. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11967. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11968. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11969. m_Print.DrawRect2(StrRect, 2);
  11970. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11971. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11972. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11973. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11974. m_Print.DrawRect2(StrRect, 2);
  11975. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11976. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11977. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11978. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11979. m_Print.DrawRect2(StrRect, 2);
  11980. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11981. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11982. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11983. m_Print.DrawText((LPTSTR)(LPCTSTR)g_date, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11984. m_Print.DrawRect2(StrRect, 2);
  11985. for (i = 19; i < 49; i++)
  11986. {
  11987. if (i >= 44)
  11988. {
  11989. StrRect = load.m_rcarray.ElementAt(i - 5);
  11990. int hei = StrRect.Height();
  11991. StrRect.top += hei;
  11992. StrRect.bottom += hei;
  11993. }
  11994. else
  11995. StrRect = load.m_rcarray.ElementAt(i);
  11996. m_Print.DrawRect2(StrRect, 1);
  11997. }
  11998. float fmoney = 0;
  11999. for (i = 19; i < 49; i++)
  12000. {
  12001. if (i >= 44)
  12002. {
  12003. StrRect = load.m_rcarray.ElementAt(i - 5);
  12004. int hei = StrRect.Height();
  12005. StrRect.top += hei;
  12006. StrRect.bottom += hei;
  12007. }
  12008. else
  12009. StrRect = load.m_rcarray.ElementAt(i);
  12010. StrRect.left += 2;
  12011. /* if((i-19)%5==2)
  12012. {
  12013. fmoney+=atof(pArray->ElementAt (i-19));
  12014. }*/
  12015. m_Print.DrawText((LPTSTR)(LPCTSTR)(pArray->ElementAt(i - 19)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12016. }
  12017. m_money2.Format("%f", money);
  12018. ConvertToPrice(m_money2);
  12019. StrRect = load.m_rcarray.ElementAt(44);
  12020. CString str;
  12021. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 实收¥: %s 元 收银员: %s", \
  12022. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  12023. m_money2, g_user.name);
  12024. m_Print.DrawRect2(StrRect, 1);
  12025. StrRect.left += 3;
  12026. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12027. StrRect = load.m_rcarray.ElementAt(46);
  12028. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12029. StrRect = load.m_rcarray.ElementAt(47);
  12030. m_Print.DrawRect2(StrRect, 2);
  12031. StrRect = load.m_rcarray.ElementAt(48);
  12032. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12033. StrRect = load.m_rcarray.ElementAt(45);
  12034. str = "\
  12035. 顾客须知\r\n\
  12036. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  12037. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  12038. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  12039. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  12040. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  12041. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  12042. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  12043. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12044. AutoDraw(m_Print, StrRect, str, 1.8);
  12045. PrintPreview dlg;
  12046. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12047. dlg.m_pDC = m_Print.GetPDC();
  12048. if (aa == 0)
  12049. {
  12050. if (dlg.DoModal() != IDOK)
  12051. return;
  12052. printcot = dlg.m_num;
  12053. }
  12054. //结束打印
  12055. m_Print.EndPage();
  12056. m_Print.EndPrint();
  12057. }
  12058. }
  12059. void CMainFrame::PrintReceipt2(CString strOrderNumber)
  12060. {
  12061. int printcot = 1;
  12062. for (int aa = 0; aa < printcot; aa++)
  12063. {
  12064. g_sendhead.bsql = 0;
  12065. g_sendhead.code[0] = 24;
  12066. g_sendhead.tabcount = 1;
  12067. int g_nYearposTemp = g_nYearpos;
  12068. g_nYearpos = -1;
  12069. g_pMainWnd->ProcessChatMessageRequest2(1);
  12070. g_nYearpos = g_nYearposTemp;
  12071. if (0 == g_bSendOK)return;
  12072. DataToArray(&g_cominfoarray);
  12073. CString SerialNo;
  12074. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  12075. CPrintRX m_Print;
  12076. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12077. {
  12078. m_Print.InitToPrint(NULL, 1);
  12079. }
  12080. else
  12081. {
  12082. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  12083. if (name.IsEmpty())
  12084. m_Print.InitToPrint(NULL, 1);
  12085. else
  12086. {
  12087. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12088. if (nret == -1 && aa == 0)
  12089. {
  12090. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12091. }
  12092. }
  12093. }
  12094. m_Print.StartPrint();
  12095. m_Print.StartPage();
  12096. LoadRect load;
  12097. load.SetLiaPath("14.lia");
  12098. load.SetMargins(0, 0);
  12099. if (!load.Load())return;
  12100. int i;
  12101. //////////////////////////////////////////////////////////////
  12102. CStringArray txarray;
  12103. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  12104. g_sendhead.code[0] = 11;
  12105. g_sendhead.code[1] = 52;
  12106. g_sendhead.code[2] = 93;
  12107. g_sendhead.tabcount = 3;
  12108. g_sendhead.bsql = 0;
  12109. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12110. CArray<CStringArray, CStringArray>sparray;
  12111. CArray<CStringArray, CStringArray>clientarray;
  12112. CArray<CStringArray, CStringArray>moneyarray;
  12113. DataToArray(&g_List1array, &clientarray, &moneyarray);
  12114. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12115. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12116. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12117. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12118. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12119. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  12120. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12121. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12122. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12123. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12124. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12125. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12126. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12127. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12128. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12129. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12130. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12131. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12132. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12133. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12134. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12135. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12136. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12137. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12138. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12139. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12140. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12141. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12142. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  12143. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12144. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12145. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  12146. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  12147. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  12148. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  12149. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  12150. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  12151. CString m_addr = m_addr1 + ";";
  12152. m_addr.TrimLeft(";");
  12153. m_addr += m_addr2;
  12154. CString m_qq = m_qq1 + ";";
  12155. m_qq.TrimLeft(";");
  12156. m_qq += m_qq2;
  12157. m_money1.Format("%f", atof(m_taoxijiage));
  12158. m_money2 = "0";
  12159. for (i = 0; i < moneyarray.GetSize(); i++)
  12160. {
  12161. if (moneyarray.ElementAt(i).ElementAt(5) == "预约收款")
  12162. m_money2 = moneyarray.ElementAt(i).ElementAt(1);
  12163. }
  12164. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  12165. ConvertToPrice(m_money1);
  12166. ConvertToPrice(m_money2);
  12167. ConvertToPrice(m_money3);
  12168. ////////////////////////////////////////////////////////////////
  12169. int rcpos = -1;
  12170. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12171. m_Print.SetFontFace(17, 1, "宋体");
  12172. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12173. StrRect.top -= 0;
  12174. StrRect.bottom -= 10;
  12175. StrRect.left -= 140;
  12176. StrRect.right = StrRect.left + 48;
  12177. m_Print.SetFontFace(15, 1, "宋体");
  12178. m_Print.SetColor(0xffffff);
  12179. m_Print.DrawRect(StrRect, 0);
  12180. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12181. StrRect.left = StrRect.right;
  12182. StrRect.right = StrRect.left + 48;
  12183. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12184. m_Print.SetColor(0, RGB(255, 0, 0));
  12185. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12186. m_Print.SetColor(0);
  12187. m_Print.SetFontFace(12, 1, "宋体");
  12188. StrRect.left -= 48;
  12189. int hei = StrRect.Height();
  12190. StrRect.top = StrRect.bottom + 2;
  12191. StrRect.bottom += hei + 2;
  12192. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12193. StrRect.top = StrRect.bottom - 2;
  12194. StrRect.bottom += hei - 5;
  12195. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12196. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12197. m_Print.SetFontFace(12, 1, "宋体");
  12198. m_Print.DrawText((LPTSTR)(LPCTSTR)"定金单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12199. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12200. m_Print.SetFontFace(9, 1, "宋体");
  12201. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12202. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12203. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12204. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12205. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12206. m_Print.DrawRect2(StrRect, 2);
  12207. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12208. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12209. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12210. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12211. m_Print.DrawRect2(StrRect, 2);
  12212. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12213. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12214. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12215. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12216. m_Print.DrawRect2(StrRect, 2);
  12217. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12218. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约地点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12219. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12220. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12221. m_Print.DrawRect2(StrRect, 2);
  12222. ////////////
  12223. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12224. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12225. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12226. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12227. m_Print.DrawRect2(StrRect, 2);
  12228. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12229. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12230. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12231. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12232. m_Print.DrawRect2(StrRect, 2);
  12233. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12234. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12235. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12236. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12237. m_Print.DrawRect2(StrRect, 2);
  12238. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12239. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12240. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12241. m_Print.DrawText((LPTSTR)(LPCTSTR)g_date, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12242. m_Print.DrawRect2(StrRect, 2);
  12243. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12244. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客地址:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12245. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12246. m_Print.DrawText((LPTSTR)(LPCTSTR)m_addr, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12247. m_Print.DrawRect2(StrRect, 2);
  12248. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12249. m_Print.DrawText((LPTSTR)(LPCTSTR)"大婚时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12250. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12251. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12252. m_Print.DrawRect2(StrRect, 2);
  12253. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12254. m_Print.DrawText((LPTSTR)(LPCTSTR)"QQ/MSN:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12255. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12256. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12257. m_Print.DrawRect2(StrRect, 2);
  12258. CStringArray strarray;
  12259. strarray.Add("套系名称");
  12260. strarray.Add("总 额");
  12261. strarray.Add("定 金");
  12262. strarray.Add("余 款");
  12263. strarray.Add("摄影日期");
  12264. strarray.Add(m_taoxiname);
  12265. strarray.Add(m_money1);
  12266. strarray.Add(m_money2);
  12267. strarray.Add(m_money3);
  12268. strarray.Add(m_time2);
  12269. for (i = 25; i < 37; i++)
  12270. {
  12271. StrRect = load.m_rcarray.ElementAt(i);
  12272. m_Print.DrawRect2(StrRect, 1);
  12273. }
  12274. for (i = 25; i < 35; i++)
  12275. {
  12276. StrRect = load.m_rcarray.ElementAt(i);
  12277. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 25), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12278. }
  12279. StrRect = load.m_rcarray.ElementAt(35);
  12280. StrRect.left += 5;
  12281. StrRect.top += 5;
  12282. m_Print.DrawText((LPTSTR)(LPCTSTR)" 备 注:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  12283. StrRect = load.m_rcarray.ElementAt(36);
  12284. CString str;
  12285. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 ¥: %s 元 收银员: %s", \
  12286. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  12287. m_money2, g_user.name);
  12288. StrRect.left += 3;
  12289. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12290. StrRect = load.m_rcarray.ElementAt(38);
  12291. m_Print.DrawText((LPTSTR)(LPCTSTR)"营业员:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12292. StrRect = load.m_rcarray.ElementAt(39);
  12293. m_Print.DrawText((LPTSTR)(LPCTSTR)m_ren, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12294. m_Print.DrawRect2(StrRect, 2);
  12295. StrRect = load.m_rcarray.ElementAt(40);
  12296. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12297. StrRect = load.m_rcarray.ElementAt(41);
  12298. m_Print.DrawRect2(StrRect, 2);
  12299. StrRect = load.m_rcarray.ElementAt(42);
  12300. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12301. StrRect = load.m_rcarray.ElementAt(37);
  12302. str = "\
  12303. 顾客须知\r\n\
  12304. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  12305. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  12306. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  12307. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  12308. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  12309. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  12310. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  12311. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12312. AutoDraw(m_Print, StrRect, str, 1.8);
  12313. PrintPreview dlg;
  12314. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12315. dlg.m_pDC = m_Print.GetPDC();
  12316. if (aa == 0)
  12317. {
  12318. if (dlg.DoModal() != IDOK)
  12319. return;
  12320. printcot = dlg.m_num;
  12321. }
  12322. //结束打印
  12323. m_Print.EndPage();
  12324. m_Print.EndPrint();
  12325. }
  12326. }
  12327. void CMainFrame::OnAutodelphoto()
  12328. {
  12329. // TODO: Add your command handler code here
  12330. if (g_user.bLongin == 0)
  12331. {
  12332. if (g_bNoLoginLia)
  12333. {
  12334. Login dlg;
  12335. dlg.SetLiaPath("5.lia");
  12336. dlg.DoModal();
  12337. }
  12338. else
  12339. {
  12340. Login3 dlg;
  12341. dlg.SetLiaPath("5.lia");
  12342. dlg.DoModal();
  12343. }
  12344. if (g_user.bLongin == 0)return;
  12345. }
  12346. if (IsHasRightsnew(49) == 0)return;
  12347. DelPhotoSet dlg;
  12348. dlg.DoModal();
  12349. }
  12350. void CMainFrame::Onphotomanage() // 客照管理中心;
  12351. {
  12352. if (g_user.bLongin == 0)
  12353. {
  12354. if (g_bNoLoginLia)
  12355. {
  12356. Login dlg;
  12357. dlg.SetLiaPath("5.lia");
  12358. dlg.DoModal();
  12359. }
  12360. else
  12361. {
  12362. Login3 dlg;
  12363. dlg.SetLiaPath("5.lia");
  12364. dlg.DoModal();
  12365. }
  12366. if (g_user.bLongin == 0)return;
  12367. }
  12368. if (IsHasRightsnew(49) == 0)return;
  12369. ShowPic3 dlg;
  12370. dlg.DoModal();
  12371. }
  12372. void CMainFrame::OnCompanyinfo()
  12373. {
  12374. // TODO: Add your command handler code here
  12375. if (g_user.bLongin == 0)
  12376. {
  12377. if (g_bNoLoginLia)
  12378. {
  12379. Login dlg;
  12380. dlg.SetLiaPath("5.lia");
  12381. dlg.DoModal();
  12382. }
  12383. else
  12384. {
  12385. Login3 dlg;
  12386. dlg.SetLiaPath("5.lia");
  12387. dlg.DoModal();
  12388. }
  12389. if (g_user.bLongin == 0)return;
  12390. }
  12391. if (IsHasRightsnew(49) == 0)return;
  12392. CompanyInfo dlg;
  12393. dlg.DoModal();
  12394. }
  12395. void CMainFrame::OnTaoxifg()
  12396. {
  12397. // TODO: Add your command handler code here
  12398. if (g_user.bLongin == 0)
  12399. {
  12400. if (g_bNoLoginLia)
  12401. {
  12402. Login dlg;
  12403. dlg.SetLiaPath("5.lia");
  12404. dlg.DoModal();
  12405. }
  12406. else
  12407. {
  12408. Login3 dlg;
  12409. dlg.SetLiaPath("5.lia");
  12410. dlg.DoModal();
  12411. }
  12412. if (g_user.bLongin == 0)return;
  12413. }
  12414. if (IsHasRightsnew(49) == 0)return;
  12415. TXFG dlg;
  12416. dlg.DoModal();
  12417. }
  12418. void CMainFrame::OnHelpfile()
  12419. {
  12420. // TODO: Add your command handler code here
  12421. // ShellExecute(NULL, _T("open"), _T(g_mainpath+"\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  12422. // if(::PathFileExists (g_mainpath+"\\zx.dll"))
  12423. // ShellExecute(NULL, _T("open"), _T("www.zcsmkj.com"), "", NULL, SW_SHOWNORMAL);
  12424. // else
  12425. ShellExecute(NULL, _T("open"), _T("www.lyfz.net"), "", NULL, SW_SHOWNORMAL);
  12426. }
  12427. void CMainFrame::OnPhotobak()
  12428. {
  12429. // TODO: Add your command handler code here
  12430. if (g_user.bLongin == 0)
  12431. {
  12432. if (g_bNoLoginLia)
  12433. {
  12434. Login dlg;
  12435. dlg.SetLiaPath("5.lia");
  12436. dlg.DoModal();
  12437. }
  12438. else
  12439. {
  12440. Login3 dlg;
  12441. dlg.SetLiaPath("5.lia");
  12442. dlg.DoModal();
  12443. }
  12444. if (g_user.bLongin == 0)return;
  12445. }
  12446. if (IsHasRightsnew(49) == 0)return;
  12447. PhotoBak dlg;
  12448. dlg.DoModal();
  12449. }
  12450. //客户报表
  12451. void CMainFrame::OnClose2()
  12452. { // TODO: Add your message handler code here and/or call default
  12453. if (AfxMessageBox("是否退出系统?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  12454. if(g_user.bLongin)
  12455. WriteLog("退出系统!", "退出系统!");
  12456. g_bShowBar = 0;
  12457. if (m_Mdi.MainClose())
  12458. CMDIFrameWnd::OnClose();
  12459. }
  12460. //
  12461. void CMainFrame::ResetTimer()
  12462. {
  12463. }
  12464. void CMainFrame::LinkClick(CString str, int nParent)
  12465. {
  12466. g_pMainWnd2->m_bar.LinkClick(str);
  12467. }
  12468. void CMainFrame::PrintFlowChart2(CString m_id)
  12469. {
  12470. CPrintRX m_Print;
  12471. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12472. {
  12473. m_Print.InitToPrint(NULL, 1);
  12474. }
  12475. else
  12476. {
  12477. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  12478. if (name.IsEmpty())
  12479. m_Print.InitToPrint(NULL, 1);
  12480. else
  12481. {
  12482. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12483. if (nret == -1)
  12484. {
  12485. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12486. }
  12487. }
  12488. }
  12489. m_Print.StartPrint();
  12490. m_Print.StartPage();
  12491. LoadRect load;
  12492. load.SetLiaPath("16.lia");
  12493. load.SetMargins(0, 0);
  12494. if (!load.Load())return;
  12495. LoadRect load2;
  12496. load2.SetLiaPath("17.lia");
  12497. load2.SetMargins(0, 660);
  12498. if (!load2.Load())return;
  12499. int i;
  12500. //////////////////////////////////////////////////////////////
  12501. CStringArray txarray;
  12502. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and kind<>'2'";
  12503. g_sendhead.code[0] = 11;
  12504. g_sendhead.code[1] = 52;
  12505. g_sendhead.code[2] = 223;
  12506. g_sendhead.tabcount = 3;
  12507. g_sendhead.bsql = 0;
  12508. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12509. CArray<CStringArray, CStringArray>sparray;
  12510. CArray<CStringArray, CStringArray>clientarray;
  12511. DataToArray(&g_List1array, &clientarray, &sparray);
  12512. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12513. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12514. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12515. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12516. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12517. CString m_photocount = g_List1array.ElementAt(0).ElementAt(9);
  12518. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12519. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12520. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12521. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12522. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12523. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12524. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12525. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12526. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12527. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12528. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12529. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12530. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12531. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12532. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12533. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12534. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12535. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12536. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12537. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12538. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12539. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12540. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(39) + g_List1array.ElementAt(0).ElementAt(75);
  12541. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12542. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12543. CString spno;
  12544. for (i = 0; i < sparray.GetSize(); i++)
  12545. {
  12546. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  12547. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  12548. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  12549. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12550. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12551. spno += sparray.ElementAt(i).ElementAt(5);
  12552. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12553. spno += "; ";
  12554. else
  12555. {
  12556. spno += ":";
  12557. spno += sparray.ElementAt(i).ElementAt(6);
  12558. spno += "; ";
  12559. }
  12560. }
  12561. spno += " 加挑:";
  12562. for (i = 0; i < sparray.GetSize(); i++)
  12563. {
  12564. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  12565. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  12566. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  12567. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12568. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12569. spno += sparray.ElementAt(i).ElementAt(5);
  12570. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12571. spno += "; ";
  12572. else
  12573. {
  12574. spno += ":";
  12575. spno += sparray.ElementAt(i).ElementAt(6);
  12576. spno += "; ";
  12577. }
  12578. }
  12579. if (spno.Right(6) == " 加挑:")
  12580. {
  12581. spno = spno.Left(spno.GetLength() - 6);
  12582. }
  12583. ////////////////////////////////////////////////////////////////
  12584. int rcpos = -1;
  12585. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12586. m_Print.SetFontFace(17, 1, "宋体");
  12587. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12588. StrRect.top -= 0;
  12589. StrRect.bottom -= 10;
  12590. StrRect.left -= 140;
  12591. StrRect.right = StrRect.left + 48;
  12592. m_Print.SetFontFace(15, 1, "宋体");
  12593. m_Print.SetColor(0xffffff);
  12594. m_Print.DrawRect(StrRect, 0);
  12595. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12596. StrRect.left = StrRect.right;
  12597. StrRect.right = StrRect.left + 48;
  12598. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12599. m_Print.SetColor(0, RGB(255, 0, 0));
  12600. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12601. m_Print.SetColor(0);
  12602. m_Print.SetFontFace(12, 1, "宋体");
  12603. StrRect.left -= 48;
  12604. int hei = StrRect.Height();
  12605. StrRect.top = StrRect.bottom + 2;
  12606. StrRect.bottom += hei + 2;
  12607. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12608. StrRect.top = StrRect.bottom - 2;
  12609. StrRect.bottom += hei - 5;
  12610. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12611. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12612. m_Print.SetFontFace(12, 1, "宋体");
  12613. m_Print.DrawText((LPTSTR)(LPCTSTR)"加做取件单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12614. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12615. m_Print.SetFontFace(11, 1, "宋体");
  12616. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + m_id), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12617. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12618. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12619. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12620. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12621. m_Print.DrawRect2(StrRect, 2);
  12622. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12623. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12624. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12625. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12626. m_Print.DrawRect2(StrRect, 2);
  12627. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12628. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12629. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12630. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time4, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12631. m_Print.DrawRect2(StrRect, 2);
  12632. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12633. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12634. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12635. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time5, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12636. m_Print.DrawRect2(StrRect, 2);
  12637. ////////////
  12638. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12639. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12640. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12641. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12642. m_Print.DrawRect2(StrRect, 2);
  12643. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12644. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12645. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12646. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12647. m_Print.DrawRect2(StrRect, 2);
  12648. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12649. m_Print.DrawText((LPTSTR)(LPCTSTR)"赠送张数:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12650. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12651. m_Print.DrawText((LPTSTR)(LPCTSTR)m_photocount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12652. m_Print.DrawRect2(StrRect, 2);
  12653. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12654. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12655. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12656. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12657. m_Print.DrawRect2(StrRect, 2);
  12658. ////////////
  12659. ///////////spno
  12660. CRect sprc[22];
  12661. StrRect = load.m_rcarray.ElementAt(19);
  12662. StrRect.left += 4; StrRect.right -= 3;
  12663. hei = StrRect.Height();
  12664. for (i = 0; i < 22; i++)
  12665. {
  12666. sprc[i] = StrRect;
  12667. m_Print.DrawRect2(StrRect, 1);
  12668. if (i == 0)
  12669. {
  12670. StrRect.left += 5;
  12671. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12672. StrRect.left -= 5;
  12673. }
  12674. StrRect.top = StrRect.bottom;
  12675. StrRect.bottom = StrRect.top + hei;
  12676. sprc[i].left += 4; sprc[i].right -= 3;
  12677. }
  12678. StrRect.bottom = StrRect.top + 60;
  12679. m_Print.DrawRect2(StrRect, 1);
  12680. StrRect.left += 3; StrRect.top += 3;
  12681. StrRect.right -= 3; StrRect.bottom -= 3;
  12682. AutoDraw(m_Print, StrRect, m_bz, 1.8);
  12683. CString temp, tempspno, tempbz;
  12684. CSize size;
  12685. BOOL bRun = 0;
  12686. int fontsize = 12;
  12687. ll: tempspno = spno;
  12688. m_Print.SetFontFace(fontsize, 1, "宋体");
  12689. for (i = 1; i<22; i++)
  12690. {
  12691. if (!tempspno.IsEmpty())
  12692. {
  12693. temp = tempspno;
  12694. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12695. int right = 0;
  12696. CRect temprc = sprc[i];
  12697. while (size.cx>temprc.Width())
  12698. {
  12699. right++;
  12700. temp = tempspno.Left(tempspno.GetLength() - (right));
  12701. if (GIsHalfHZ(temp))
  12702. {
  12703. right++;
  12704. temp.Delete(temp.GetLength() - 1);
  12705. }
  12706. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12707. }
  12708. if (bRun)
  12709. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12710. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  12711. if (tempspno.IsEmpty())i++;
  12712. }
  12713. }
  12714. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  12715. {
  12716. fontsize--;
  12717. goto ll;
  12718. }
  12719. if (bRun == 0)
  12720. {
  12721. bRun = 1;
  12722. goto ll;
  12723. }
  12724. m_Print.SetFontFace(12, 1, "宋体");
  12725. StrRect = load2.m_rcarray.ElementAt(1);
  12726. m_Print.DrawText((LPTSTR)(LPCTSTR)"喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12727. StrRect = load2.m_rcarray.ElementAt(2);
  12728. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12729. StrRect = load2.m_rcarray.ElementAt(3);
  12730. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12731. StrRect = load2.m_rcarray.ElementAt(4);
  12732. m_Print.DrawRect2(StrRect, 2);
  12733. StrRect = load2.m_rcarray.ElementAt(0);
  12734. CString str = "\
  12735. 爱心提示:如对制作有任何要求请清楚列出,所有制作内容一经确认将按要求制作。\r\n\
  12736. 选样文件从拍摄日期计算将保留二个月;套相成品按取件日期保留三个月,逾期不做保留。\r\n\
  12737. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12738. AutoDraw(m_Print, StrRect, str, 1.8);
  12739. PrintPreview dlg; dlg.m_mode = 2;
  12740. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12741. dlg.m_pDC = m_Print.GetPDC();
  12742. if (dlg.DoModal() != IDOK)return;
  12743. //结束打印
  12744. m_Print.EndPage();
  12745. m_Print.EndPrint();
  12746. }
  12747. //分店
  12748. CString CMainFrame::GetDanWei(CString name, CArray<CStringArray, CStringArray>*array)
  12749. {
  12750. for (int i = 0; i < array->GetSize(); i++)
  12751. {
  12752. if (name == array->ElementAt(i).ElementAt(1))
  12753. return array->ElementAt(i).ElementAt(2);
  12754. }
  12755. return "";
  12756. }
  12757. //g_sendhead
  12758. int CMainFrame::GetPort()
  12759. {
  12760. static int aaa = -1;
  12761. if (aaa == -1)
  12762. {
  12763. aaa = CTime::GetCurrentTime().GetSecond() % 7;
  12764. }
  12765. aaa++;
  12766. if (aaa >= 7)aaa = 0;
  12767. return 8387 + aaa;
  12768. }
  12769. void CMainFrame::OnShowBakState()
  12770. {
  12771. // TODO: Add your command handler code here
  12772. g_sendhead.bsql = 0;
  12773. g_sendhead.code[0] = 171;
  12774. g_sendhead.tabcount = 1;
  12775. g_pMainWnd->ProcessChatMessageRequest2(1);
  12776. if (g_bSendOK == 0)
  12777. {
  12778. return;
  12779. }
  12780. CArray<CStringArray, CStringArray>g_bakstatearray;
  12781. DataToArray(&g_bakstatearray);
  12782. while (g_bakstatearray.GetSize() > 7)
  12783. {
  12784. g_bakstatearray.RemoveAt(0);
  12785. }
  12786. int photocount = 0;
  12787. int infocount = 0;
  12788. for (int i = 0; i < g_bakstatearray.GetSize(); i++)
  12789. {
  12790. if (g_bakstatearray.ElementAt(i).ElementAt(1) != "1")photocount++;
  12791. if (g_bakstatearray.ElementAt(i).ElementAt(2) != "1")infocount++;
  12792. }
  12793. ShowBakState dlg;
  12794. dlg.m_pArray = &g_bakstatearray;
  12795. dlg.DoModal();
  12796. }
  12797. void CMainFrame::PrintReceipt2(CStringArray *pArray)
  12798. {
  12799. int i = 0;
  12800. int printcot = 1;
  12801. for (int aa = 0; aa < printcot; aa++)
  12802. {
  12803. g_sendhead.bsql = 0;
  12804. g_sendhead.code[0] = 24;
  12805. g_sendhead.tabcount = 1;
  12806. int g_nYearposTemp = g_nYearpos;
  12807. g_nYearpos = -1;
  12808. g_pMainWnd->ProcessChatMessageRequest2(1);
  12809. g_nYearpos = g_nYearposTemp;
  12810. if (0 == g_bSendOK)return;
  12811. DataToArray(&g_cominfoarray);
  12812. CString SerialNo;
  12813. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  12814. CPrintRX m_Print;
  12815. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12816. {
  12817. m_Print.InitToPrint(NULL, 1);
  12818. }
  12819. else
  12820. {
  12821. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  12822. if (name.IsEmpty())
  12823. m_Print.InitToPrint(NULL, 1);
  12824. else
  12825. {
  12826. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12827. if (nret == -1 && aa == 0)
  12828. {
  12829. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12830. }
  12831. }
  12832. }
  12833. m_Print.StartPrint();
  12834. m_Print.StartPage();
  12835. LoadRect load;
  12836. BOOL bSmall = 0;
  12837. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  12838. {
  12839. bSmall = 1;
  12840. load.SetLiaPath("20.lia");
  12841. }
  12842. else
  12843. load.SetLiaPath("10.lia");
  12844. if (bSmall)
  12845. load.SetMargins(-10, 0);
  12846. else
  12847. load.SetMargins(10, 0);
  12848. if (!load.Load())return;
  12849. int rcpos = -1;
  12850. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12851. Image *pImg = NULL;
  12852. #ifdef MNLS_VERSION
  12853. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  12854. #else
  12855. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  12856. #endif
  12857. // m_Print.DrawImage(pImg, StrRect);
  12858. delete pImg;
  12859. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  12860. {
  12861. Image *pImg = NULL;
  12862. g_nSendCode = 31;
  12863. int g_nYearposTemp = g_nYearpos;
  12864. g_nYearpos = -1;
  12865. g_pMainWnd->ProcessChatMessageRequest2(1);
  12866. g_nYearpos = g_nYearposTemp;
  12867. g_nSendCode = 0;
  12868. if (g_bSendOK == 0)return;
  12869. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  12870. if (pImg)
  12871. {
  12872. StrRect.left = 65;
  12873. if (bSmall)StrRect.left = 55;
  12874. StrRect.top = 10;
  12875. StrRect.right = StrRect.left + 58;
  12876. StrRect.bottom = StrRect.top + 58;
  12877. m_Print.DrawImage(pImg, StrRect);
  12878. delete pImg; pImg = NULL;
  12879. }
  12880. }
  12881. if (bSmall)
  12882. {
  12883. m_Print.SetFontFace(18, 1, "黑体");
  12884. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12885. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12886. m_Print.SetFontFace(9, 1, "宋体");
  12887. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12888. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12889. m_Print.SetFontFace(6, 1, "宋体");
  12890. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12891. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12892. m_Print.SetFontFace(9, 1, "宋体");
  12893. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12894. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12895. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12896. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12897. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12898. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12899. int hei = StrRect.Height();
  12900. StrRect.bottom = StrRect.top;
  12901. StrRect.top -= 8;
  12902. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  12903. m_Print.SetFontFace(10, 1, "宋体");
  12904. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12905. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12906. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12907. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12908. m_Print.SetFontFace(9, 1, "宋体");
  12909. for ( i = 7; i < 24; i++)
  12910. {
  12911. StrRect = load.m_rcarray.ElementAt(i);
  12912. m_Print.DrawRect2(StrRect, 1);
  12913. }
  12914. for (i = 9; i < 24; i++)
  12915. {
  12916. StrRect = load.m_rcarray.ElementAt(i);
  12917. StrRect.left += 2;
  12918. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12919. }
  12920. m_Print.SetFontFace(6, 1, "宋体");
  12921. for (i = 24; i < 26; i++)
  12922. {
  12923. StrRect = load.m_rcarray.ElementAt(i);
  12924. StrRect.left += 2;
  12925. if (i == 24)
  12926. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12927. else
  12928. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12929. }
  12930. }
  12931. else//大单
  12932. {
  12933. m_Print.SetFontFace(20, 1, "黑体");
  12934. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12935. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12936. m_Print.SetFontFace(11, 1, "宋体");
  12937. // StrRect=load.m_rcarray .ElementAt (++rcpos);
  12938. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12939. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15;
  12940. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12941. int hei = StrRect.Height();
  12942. StrRect.bottom = StrRect.top;
  12943. StrRect.top -= 10;
  12944. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  12945. m_Print.SetFontFace(8, 1, "宋体");
  12946. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12947. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12948. m_Print.SetFontFace(11, 1, "宋体");
  12949. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12950. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12951. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12952. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12953. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12954. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12955. m_Print.SetFontFace(13, 1, "宋体");
  12956. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12957. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12958. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12959. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12960. m_Print.SetFontFace(11, 1, "宋体");
  12961. for ( i = 7; i < 24; i++)
  12962. {
  12963. StrRect = load.m_rcarray.ElementAt(i);
  12964. m_Print.DrawRect2(StrRect, 1);
  12965. }
  12966. for (i = 9; i < 24; i++)
  12967. {
  12968. StrRect = load.m_rcarray.ElementAt(i);
  12969. StrRect.left += 2;
  12970. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12971. }
  12972. m_Print.SetFontFace(8, 1, "宋体");
  12973. for (i = 24; i < 27; i++)
  12974. {
  12975. StrRect = load.m_rcarray.ElementAt(i);
  12976. StrRect.left += 2;
  12977. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12978. }
  12979. }
  12980. PrintPreview dlg;
  12981. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12982. dlg.m_pDC = m_Print.GetPDC();
  12983. if (aa == 0)
  12984. {
  12985. if (dlg.DoModal() != IDOK)
  12986. return;
  12987. printcot = dlg.m_num;
  12988. }
  12989. //结束打印
  12990. m_Print.EndPage();
  12991. m_Print.EndPrint();
  12992. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  12993. CString sql;
  12994. sql.Format("update version set [serialno2]='%s'", SerialNo);
  12995. g_sendhead.bsql = 1;
  12996. g_nYearposTemp = g_nYearpos;
  12997. g_nYearpos = -1;
  12998. g_pMainWnd->ProcessChatMessageRequest2(sql);
  12999. g_nYearpos = g_nYearposTemp;
  13000. }
  13001. }
  13002. //出生年月
  13003. //第一联
  13004. void CMainFrame::OnLog()
  13005. {
  13006. // TODO: Add your command handler code here OnShowBakState
  13007. if (IsHasRightsnew(49) == 0)return;
  13008. ShowLOg dlg;
  13009. dlg.DoModal();
  13010. }
  13011. // www.lyfz.net 8888
  13012. void CMainFrame::PrintDinDan6(CString m_id)
  13013. {
  13014. // TODO: Add your control notification handler code here 预约订单
  13015. int printcot = 1;
  13016. for (int aa = 0; aa < printcot; aa++)
  13017. {
  13018. PrintPreview dlg;
  13019. CPrintRX m_Print;
  13020. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13021. {
  13022. m_Print.InitToPrint(NULL, 1);
  13023. }
  13024. else
  13025. {
  13026. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  13027. if (name.IsEmpty())
  13028. m_Print.InitToPrint(NULL, 1);
  13029. else
  13030. {
  13031. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13032. if (nret == -1 && aa == 0)
  13033. {
  13034. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  13035. }
  13036. }
  13037. }
  13038. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  13039. {
  13040. m_Print.StartPrint();
  13041. m_Print.StartPage();
  13042. LoadRect load;
  13043. load.SetLiaPath("6.lia");
  13044. load.SetMargins(-14, 15);
  13045. if (!load.Load())return;
  13046. LoadRect load2;
  13047. load2.SetLiaPath("7.lia");
  13048. load2.SetMargins(-14, 216 + 15);
  13049. if (!load2.Load())return;
  13050. LoadRect load3;
  13051. load3.SetLiaPath("8.lia");
  13052. load3.SetMargins(-14, 705 + 15);
  13053. if (!load3.Load())return;
  13054. int i;
  13055. //////////////////////////////////////////////////////////////
  13056. CStringArray txarray;
  13057. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  13058. g_sendhead.code[0] = 11;
  13059. g_sendhead.code[1] = 52;
  13060. g_sendhead.code[2] = 50;
  13061. g_sendhead.code[3] = 150;
  13062. g_sendhead.code[4] = 77;
  13063. g_sendhead.code[5] = 4;
  13064. g_sendhead.tabcount = 6;
  13065. g_sendhead.bsql = 0;
  13066. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  13067. CArray<CStringArray, CStringArray>sparray;
  13068. CArray<CStringArray, CStringArray>clientarray;
  13069. CArray<CStringArray, CStringArray>phonearray;
  13070. CArray<CStringArray, CStringArray>fgarray;
  13071. CArray<CStringArray, CStringArray>danweiarray;
  13072. CArray<CStringArray, CStringArray>jdarray;
  13073. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  13074. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  13075. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  13076. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  13077. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  13078. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  13079. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  13080. CString m_taoxiname;
  13081. if (m_zs.Find("\\") != -1)
  13082. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  13083. else
  13084. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  13085. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  13086. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  13087. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  13088. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  13089. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  13090. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  13091. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  13092. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  13093. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  13094. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  13095. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  13096. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  13097. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  13098. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  13099. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  13100. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  13101. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  13102. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  13103. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  13104. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  13105. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  13106. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  13107. if (jdarray.GetSize())
  13108. {
  13109. if (m_bz.IsEmpty() == 0)
  13110. m_bz = "\r\n" + m_bz;
  13111. m_bz += "景点:";
  13112. }
  13113. for (i = 0; i < jdarray.GetSize(); i++)
  13114. {
  13115. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  13116. }
  13117. m_bz.TrimRight(";");
  13118. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  13119. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13120. if (IsHasRights2new(31) == 0)
  13121. {
  13122. m_phone1 = "***";
  13123. m_phone2 = "***";
  13124. }
  13125. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  13126. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13127. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  13128. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  13129. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  13130. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  13131. filter = "name='" + m_ren + "'";
  13132. g_sendhead.code[0] = 5;
  13133. g_sendhead.tabcount = 1;
  13134. g_sendhead.bsql = 0;
  13135. int g_nYearposTemp = g_nYearpos;
  13136. g_nYearpos = -1;
  13137. g_pMainWnd->ProcessChatMessageRequest2(filter);
  13138. g_nYearpos = g_nYearposTemp;
  13139. if (g_bSendOK == 0)return;
  13140. DataToArray(&phonearray);
  13141. m_money1.Format("%f", atof(m_taoxijiage));
  13142. m_money2.Format("%f", atof(m_payed1));
  13143. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  13144. ConvertToPrice(m_money1);
  13145. ConvertToPrice(m_money2);
  13146. ConvertToPrice(m_money3);
  13147. ////////////////////////////////////////////////////////////////
  13148. int rcpos = -1;
  13149. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13150. StrRect.top -= 15; StrRect.bottom -= 15;
  13151. Image *pImg = NULL;
  13152. #ifdef MNLS_VERSION
  13153. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  13154. #else
  13155. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  13156. #endif
  13157. m_Print.DrawImage(pImg, StrRect);
  13158. delete pImg;
  13159. m_Print.SetFontFace(11, 1, "宋体");
  13160. StrRect = load.m_rcarray.ElementAt(20);
  13161. StrRect.right = load.m_rcarray.ElementAt(23).right;
  13162. StrRect.top -= 18; StrRect.bottom -= 18;
  13163. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  13164. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13165. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  13166. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13167. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13168. StrRect.top -= 15; StrRect.bottom -= 15;
  13169. #ifdef MNLS_VERSION
  13170. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13171. #endif
  13172. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13173. StrRect.top -= 15; StrRect.bottom -= 15;
  13174. #ifdef MNLS_VERSION
  13175. m_Print.DrawRect(StrRect);
  13176. #endif
  13177. m_Print.SetFontFace(7, 1, "黑体");
  13178. m_Print.SetColor(0xffffff);
  13179. #ifdef MNLS_VERSION
  13180. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13181. #endif
  13182. m_Print.SetColor(0);
  13183. m_Print.SetFontFace(15, 1, "宋体");
  13184. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13185. StrRect.top -= 15; StrRect.bottom -= 15;
  13186. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同拍摄单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13187. CStringArray strarray;
  13188. strarray.Add("NO: " + m_id);
  13189. CString date;
  13190. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  13191. strarray.Add(date);
  13192. strarray.Add("喜爱");
  13193. strarray.Add("格调");
  13194. if (fgarray.GetSize() == 12)
  13195. {
  13196. for (int i = 0; i < 12; i++)
  13197. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  13198. }
  13199. else
  13200. {
  13201. strarray.Add("复古典雅");
  13202. strarray.Add("温文尔雅");
  13203. strarray.Add("豪华艳丽");
  13204. strarray.Add("传统大方");
  13205. strarray.Add("新潮个性");
  13206. strarray.Add("浪漫奔放");
  13207. strarray.Add("简单素雅");
  13208. strarray.Add("活泼俏丽");
  13209. strarray.Add("妩媚温馨");
  13210. strarray.Add("温柔贤惠");
  13211. strarray.Add("成熟感性");
  13212. strarray.Add("清纯可爱");
  13213. }
  13214. strarray.Add("姓名");
  13215. // strarray.Add("职业");
  13216. strarray.Add("");
  13217. strarray.Add("地址");
  13218. strarray.Add("电话");
  13219. #ifdef CHILD_VERSION
  13220. strarray.Add("家长");
  13221. strarray.Add("宝宝");
  13222. #else
  13223. strarray.Add("先生");
  13224. strarray.Add("女士");
  13225. #endif
  13226. m_Print.SetFontFace(11, 1, "宋体");
  13227. for (i = 0; i < strarray.GetSize(); i++)
  13228. {
  13229. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13230. if (i < 2)
  13231. {
  13232. StrRect.top -= 15; StrRect.bottom -= 15;
  13233. }
  13234. if (i>15)
  13235. m_Print.DrawRect2(StrRect, 1);
  13236. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13237. }
  13238. for (i = 29; i <= 40; i++)
  13239. {
  13240. if (m_style.GetLength() <= (i - 29))continue;
  13241. if (m_style.GetAt(i - 29) != '1')continue;
  13242. StrRect = load.m_rcarray.ElementAt(i - 1);
  13243. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13244. }
  13245. for (i = 27; i <= 48; i++)
  13246. {
  13247. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13248. m_Print.DrawRect2(StrRect, 1);
  13249. }
  13250. #ifdef CHILD_VERSION
  13251. StrRect = load.m_rcarray.ElementAt(45);
  13252. StrRect.right = StrRect.left + 62;
  13253. m_Print.DrawRect2(StrRect, 1);
  13254. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13255. StrRect.left = StrRect.right;
  13256. StrRect.right = StrRect.left + 62;
  13257. m_Print.DrawRect2(StrRect, 1);
  13258. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13259. StrRect.left = StrRect.right;
  13260. StrRect.right = StrRect.left + 62;
  13261. m_Print.DrawRect2(StrRect, 1);
  13262. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13263. StrRect.left = StrRect.right;
  13264. StrRect.right = StrRect.left + 62;
  13265. m_Print.DrawRect2(StrRect, 1);
  13266. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13267. #endif
  13268. /////////////////////////
  13269. strarray.RemoveAll();
  13270. CString temp;
  13271. temp.Format("拍摄 选 %d 款,其中", atoi(m_outside) + atoi(m_outside2));
  13272. strarray.Add(temp);
  13273. temp.Format("内景 %d 款,外景 %d 款.", atoi(m_outside2), atoi(m_outside));
  13274. strarray.Add(temp);
  13275. strarray.Add("化妆");
  13276. strarray.Add("造型");
  13277. #ifdef CHILD_VERSION
  13278. strarray.Add("");
  13279. #else
  13280. strarray.Add("婚纱");
  13281. #endif
  13282. strarray.Add("服饰");
  13283. strarray.Add("配");
  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. #ifdef CHILD_VERSION
  13294. strarray.Add("主引导师");
  13295. #else
  13296. strarray.Add("主化妆师");
  13297. #endif
  13298. strarray.Add("看样日期");
  13299. strarray.Add("补 余 款");
  13300. strarray.Add("总监");
  13301. strarray.Add("取件日期");
  13302. rcpos = -1;
  13303. for (i = 0; i < strarray.GetSize(); i++)
  13304. {
  13305. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13306. if (i>9)
  13307. m_Print.DrawRect2(StrRect, 1);
  13308. #ifdef CHILD_VERSION
  13309. if (i == 5)
  13310. StrRect.top -= StrRect.Height();
  13311. #endif
  13312. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13313. }
  13314. for (i = 22; i <= 41; i++)
  13315. {
  13316. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13317. m_Print.DrawRect2(StrRect, 1);
  13318. }
  13319. /////////////////////////////
  13320. strarray.RemoveAll();
  13321. #ifdef CHILD_VERSION
  13322. strarray.Add("顾客方 家长:");
  13323. strarray.Add("宝宝:");
  13324. #else
  13325. strarray.Add("顾客方 先生:");
  13326. strarray.Add("女士:");
  13327. #endif
  13328. strarray.Add("电话:");
  13329. strarray.Add("影楼方 店长:");
  13330. strarray.Add("接单人:");
  13331. strarray.Add("电话:");
  13332. rcpos = -1;
  13333. for (i = 0; i < strarray.GetSize(); i++)
  13334. {
  13335. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13336. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13337. }
  13338. for (i = 7; i <= 12; i++)
  13339. {
  13340. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13341. // if(i!=10)
  13342. m_Print.DrawRect2(StrRect, 2);
  13343. }
  13344. //////////////////////////////////////
  13345. //开始打数据
  13346. strarray.RemoveAll();
  13347. strarray.Add(m_name1);
  13348. strarray.Add(m_name2);
  13349. strarray.Add("");
  13350. strarray.Add("");
  13351. strarray.Add(m_addr1);
  13352. #ifdef CHILD_VERSION
  13353. strarray.Add("");
  13354. #else
  13355. strarray.Add(m_addr2);
  13356. #endif
  13357. strarray.Add(m_phone1);
  13358. strarray.Add(m_phone2);
  13359. for (i = 41; i <= 48; i++)
  13360. {
  13361. StrRect = load.m_rcarray.ElementAt(i - 1);
  13362. StrRect.left += 4;
  13363. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13364. }
  13365. ///////////////////////////////
  13366. strarray.RemoveAll();
  13367. strarray.Add(m_money1);
  13368. strarray.Add(m_waiter1);
  13369. strarray.Add(m_time2);
  13370. strarray.Add(m_money2);
  13371. strarray.Add(m_waiter2);
  13372. strarray.Add(m_time4);
  13373. strarray.Add(m_money3);
  13374. strarray.Add("");
  13375. strarray.Add(m_time5);
  13376. for (i = 32; i <= 40; i++)
  13377. {
  13378. StrRect = load2.m_rcarray.ElementAt(i - 1);
  13379. StrRect.left += 4;
  13380. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13381. }
  13382. ///////////////////////////////
  13383. strarray.RemoveAll();
  13384. strarray.Add("");//m_name1);
  13385. strarray.Add("");//m_name2);
  13386. CString phone;
  13387. if (m_phone1.IsEmpty() == 0)
  13388. phone = m_phone1 + ",";
  13389. phone += m_phone2;
  13390. phone.TrimRight(",");
  13391. strarray.Add("");//phone);
  13392. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  13393. strarray.Add(m_ren);
  13394. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13395. for (i = 7; i <= 12; i++)
  13396. {
  13397. StrRect = load3.m_rcarray.ElementAt(i - 1);
  13398. StrRect.left += 4;
  13399. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13400. }
  13401. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  13402. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13403. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  13404. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13405. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  13406. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13407. //////////////////////////////
  13408. //开始画文字
  13409. StrRect = load2.m_rcarray.ElementAt(30);
  13410. StrRect.left += 3;
  13411. StrRect.top += 3;
  13412. StrRect.right -= 2;
  13413. StrRect.bottom -= 2;
  13414. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  13415. StrRect = load2.m_rcarray.ElementAt(29);
  13416. StrRect.left += 3;
  13417. StrRect.top += 3;
  13418. StrRect.right -= 2;
  13419. StrRect.bottom -= 2;
  13420. str = "";
  13421. for (i = 0; i < sparray.GetSize(); i++)
  13422. {
  13423. str += sparray.ElementAt(i).ElementAt(5);
  13424. str += " 数量:";
  13425. str += sparray.ElementAt(i).ElementAt(3);
  13426. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  13427. str += "\r\n";
  13428. }
  13429. str.TrimRight("\r\n");
  13430. AutoDraw(m_Print, StrRect, str, 1.4);
  13431. StrRect = load2.m_rcarray.ElementAt(40);
  13432. StrRect.top += 8;
  13433. m_Print.SetFontFace(12, 1, "黑体");
  13434. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  13435. StrRect.left += 3;
  13436. StrRect.top += 30;
  13437. StrRect.right -= 2;
  13438. StrRect.bottom -= 2;
  13439. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  13440. if (str.IsEmpty())
  13441. {
  13442. str = "\
  13443. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  13444. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  13445. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  13446. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  13447. 持良好的心境.\r\n\
  13448. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  13449. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  13450. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  13451. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  13452. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  13453. 勿进影室, 以免影响拍摄.\r\n\
  13454. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  13455. 师或店长沟通.\r\n\
  13456. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  13457. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  13458. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  13459. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  13460. 9. 本合同余额欠款须在拍照前付清.\r\n\
  13461. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  13462. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  13463. 还.";
  13464. }
  13465. AutoDraw(m_Print, StrRect, str, 1.8);
  13466. }
  13467. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13468. dlg.m_pDC = m_Print.GetPDC();
  13469. dlg.m_mode = 1;
  13470. if (aa == 0)
  13471. {
  13472. if (dlg.DoModal() != IDOK)
  13473. return;
  13474. printcot = dlg.m_num;
  13475. }
  13476. //结束打印
  13477. m_Print.EndPage();
  13478. m_Print.EndPrint();
  13479. }
  13480. }
  13481. void CMainFrame::InsideMsg()
  13482. {
  13483. ///内部消息
  13484. CString str;
  13485. g_sendhead.bsql = 0;
  13486. g_sendhead.code[0] = 126;
  13487. g_sendhead.tabcount = 1;
  13488. g_bNoConnDlg = 1;
  13489. g_pMainWnd->ProcessChatMessageRequest2(1); g_bNoConnDlg = 0;
  13490. if (g_bSendOK == 0)return;
  13491. CArray<CStringArray, CStringArray>m_List1array;
  13492. DataToArray(&g_List1array);//, &m_List1array);
  13493. int i = 0;
  13494. m_List1array.SetSize(g_List1array.GetSize());
  13495. for ( i = 0; i < g_List1array.GetSize(); i++)
  13496. {
  13497. m_List1array.ElementAt(i).Copy(g_List1array.ElementAt(i));
  13498. }
  13499. str = "," + g_user.name + ",";
  13500. for (i = g_List1array.GetSize() - 1; i >= 0; i--)
  13501. {
  13502. CString receivers2 = g_List1array.ElementAt(i).ElementAt(4);
  13503. receivers2.TrimLeft(",");
  13504. receivers2.TrimRight(",");
  13505. receivers2 = "," + receivers2 + ",";
  13506. CString receivers = g_List1array.ElementAt(i).ElementAt(3);
  13507. receivers.TrimLeft(",");
  13508. receivers.TrimRight(",");
  13509. receivers = "," + receivers + ",";
  13510. if (receivers.Find(str) == -1)
  13511. g_List1array.RemoveAt(i);
  13512. else if (receivers2.Find(str) != -1)
  13513. g_List1array.RemoveAt(i);
  13514. }
  13515. if (g_List1array.GetSize())
  13516. {
  13517. ShowMsg dlg;
  13518. dlg.DoModal();
  13519. }
  13520. for (i = m_List1array.GetSize() - 1; i >= 0; i--)
  13521. {
  13522. CString receivers2 = m_List1array.ElementAt(i).ElementAt(4);
  13523. receivers2.TrimLeft(",");
  13524. receivers2.TrimRight(",");
  13525. receivers2 = "," + receivers2 + ",";
  13526. CString receivers = m_List1array.ElementAt(i).ElementAt(3);
  13527. if (receivers != "")
  13528. m_List1array.RemoveAt(i);
  13529. else if (receivers2.Find(str) != -1)
  13530. m_List1array.RemoveAt(i);
  13531. }
  13532. if (m_List1array.GetSize())
  13533. {
  13534. SendInsideMsg2 dlg;
  13535. dlg.m_bShow = 1;
  13536. dlg.m_pArray = &m_List1array;
  13537. dlg.DoModal();
  13538. }
  13539. }
  13540. //定金
  13541. /************************************************************************/
  13542. /*
  13543. 函数:PrintHireDress
  13544. 描述:打印礼服出租单;
  13545. 参数:
  13546. strOrderNumber 礼服订单号;
  13547. 注意:
  13548. */
  13549. /************************************************************************/
  13550. void CMainFrame::PrintHireDress(CString strOrderNumber) // 打印礼服出租单;
  13551. {
  13552. int printcot = 1;
  13553. for (int aa = 0; aa < printcot; aa++)
  13554. {
  13555. CPrintRX m_Print;
  13556. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13557. {
  13558. m_Print.InitToPrint(NULL, 1);
  13559. }
  13560. else
  13561. {
  13562. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13563. if (name.IsEmpty())
  13564. m_Print.InitToPrint(NULL, 1);
  13565. else
  13566. {
  13567. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13568. if (nret == -1 && aa == 0)
  13569. {
  13570. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  13571. }
  13572. }
  13573. }
  13574. m_Print.StartPrint();
  13575. m_Print.StartPage();
  13576. LoadRect load;
  13577. load.SetLiaPath("21.lia");
  13578. load.SetMargins(0, 0);
  13579. if (!load.Load())
  13580. {
  13581. return;
  13582. }
  13583. int i;
  13584. //////////////////////////////////////////////////////////////
  13585. //CString filter="id='"+strOrderNumber+"';id='"+strOrderNumber+"';id='"+strOrderNumber+"'";
  13586. CString strFilter;
  13587. strFilter.Format("id='%s';id='%s';id='%s'", strOrderNumber, strOrderNumber, strOrderNumber);
  13588. g_sendhead.bsql = 0;
  13589. g_sendhead.code[0] = 73;
  13590. g_sendhead.code[1] = 74;
  13591. g_sendhead.code[2] = 52;
  13592. g_sendhead.tabcount = 3;
  13593. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  13594. if (g_bSendOK == 0)
  13595. {
  13596. return;
  13597. }
  13598. CArray<CStringArray, CStringArray>dresshirearray;
  13599. CArray<CStringArray, CStringArray>dresshiredataarray;
  13600. CArray<CStringArray, CStringArray>clientarray;
  13601. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13602. if (dresshirearray.GetSize() == 0)
  13603. {
  13604. return;
  13605. }
  13606. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10);
  13607. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7);
  13608. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8);
  13609. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6);
  13610. if (clientarray.GetSize() == 0)
  13611. {
  13612. return;
  13613. }
  13614. //AfxMessageBox("打印礼服出租单-()");
  13615. CString m_name2 = clientarray.ElementAt(0).ElementAt(2);
  13616. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13617. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13618. CString m_time3 = clientarray.ElementAt(0).ElementAt(20);
  13619. //#if JEFF_TEST
  13620. // if ( dresshiredataarray.GetSize() == 0 )
  13621. // {
  13622. // AfxMessageBox("没衣服");
  13623. // }
  13624. //#endif
  13625. CString sItem;
  13626. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13627. {
  13628. sItem += "编号:";
  13629. sItem += dresshiredataarray.ElementAt(i).ElementAt(1);
  13630. sItem += " ";
  13631. sItem += " 名称:";
  13632. sItem += dresshiredataarray.ElementAt(i).ElementAt(2);
  13633. sItem += " 数量:";
  13634. sItem += dresshiredataarray.ElementAt(i).ElementAt(3) + "\r\n";
  13635. }
  13636. sItem += "金额:";
  13637. sItem += dresshirearray.ElementAt(0).ElementAt(1);
  13638. sItem += " ";
  13639. sItem += " 押金:";
  13640. sItem += dresshirearray.ElementAt(0).ElementAt(2) + "\r\n";
  13641. ////////////////////////////////////////////////////////////////
  13642. int rcpos = -1;
  13643. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13644. m_Print.SetFontFace(17, 1, "宋体");
  13645. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13646. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13647. m_Print.SetFontFace(10, 1, "宋体");
  13648. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13649. CStringArray strarray;
  13650. strarray.Add("客户姓名");
  13651. strarray.Add("客户电话");
  13652. strarray.Add("预定日期");
  13653. strarray.Add("结婚日期");
  13654. strarray.Add("取件日期");
  13655. strarray.Add("归还日期");
  13656. strarray.Add("本店地址");
  13657. strarray.Add("电 话");
  13658. strarray.Add("客户地址");
  13659. strarray.Add("客户签名");
  13660. for (i = 2; i < 12; i++)
  13661. {
  13662. StrRect = load.m_rcarray.ElementAt(i);
  13663. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13664. }
  13665. strarray.RemoveAll();
  13666. strarray.Add(m_name2);
  13667. strarray.Add(m_phone2);
  13668. strarray.Add(m_inputdate);
  13669. strarray.Add(m_time3);
  13670. strarray.Add(m_date1);
  13671. strarray.Add(m_date2);
  13672. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13673. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13674. strarray.Add(m_addr2);
  13675. strarray.Add("");
  13676. for (i = 12; i < 22; i++)
  13677. {
  13678. StrRect = load.m_rcarray.ElementAt(i);
  13679. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13680. m_Print.DrawRect2(StrRect, 2);
  13681. }
  13682. for (i = 25; i < 30; i++)
  13683. {
  13684. StrRect = load.m_rcarray.ElementAt(i);
  13685. m_Print.DrawRect2(StrRect, 1);
  13686. }
  13687. StrRect = load.m_rcarray.ElementAt(22);
  13688. StrRect.top += 7;
  13689. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13690. StrRect = load.m_rcarray.ElementAt(23);
  13691. StrRect.top += 7;
  13692. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13693. StrRect = load.m_rcarray.ElementAt(24);
  13694. StrRect.top += 7;
  13695. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13696. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13697. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13698. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13699. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13700. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13701. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13702. if (str.IsEmpty())
  13703. {
  13704. str = "\
  13705. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13706. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13707. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13708. 4. 如有破损酌情赔偿.";
  13709. }
  13710. AutoDraw(m_Print, StrRect, str, 1.5);
  13711. PrintPreview dlg;
  13712. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13713. dlg.m_pDC = m_Print.GetPDC();
  13714. if (aa == 0)
  13715. {
  13716. if (dlg.DoModal() != IDOK)
  13717. return;
  13718. printcot = dlg.m_num;
  13719. }
  13720. //结束打印
  13721. m_Print.EndPage();
  13722. m_Print.EndPrint();
  13723. }
  13724. }
  13725. void CMainFrame::PrintHireDress_01(CString strOrderNumber) // 打印礼服出租单,无法改变结构,需要修改21.lia才能改变打印的布局;
  13726. {
  13727. int printcot = 1;
  13728. for (int aa = 0; aa < printcot; aa++)
  13729. {
  13730. CPrintRX m_Print;
  13731. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13732. {
  13733. m_Print.InitToPrint(NULL, 1);
  13734. }
  13735. else
  13736. {
  13737. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13738. if (name.IsEmpty())
  13739. m_Print.InitToPrint(NULL, 1);
  13740. else
  13741. {
  13742. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13743. if (nret == -1 && aa == 0)
  13744. {
  13745. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  13746. m_Print.InitToPrint(NULL, 1);
  13747. }
  13748. }
  13749. }
  13750. m_Print.StartPrint();
  13751. m_Print.StartPage();
  13752. LoadRect load;
  13753. load.SetLiaPath("21.lia");
  13754. load.SetMargins(0, 0);
  13755. if (!load.Load())return;
  13756. int i;
  13757. //////////////////////////////////////////////////////////////
  13758. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  13759. g_sendhead.bsql = 0;
  13760. g_sendhead.code[0] = 73; // dresshire表;
  13761. g_sendhead.code[1] = 74; // dresshiredata表;
  13762. g_sendhead.code[2] = 52; // client表;
  13763. g_sendhead.tabcount = 3;
  13764. g_pMainWnd->ProcessChatMessageRequest2(filter);
  13765. if (g_bSendOK == 0)
  13766. {
  13767. return;
  13768. }
  13769. CArray<CStringArray, CStringArray>dresshirearray;
  13770. CArray<CStringArray, CStringArray>dresshiredataarray;
  13771. CArray<CStringArray, CStringArray>clientarray;
  13772. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13773. if (dresshirearray.GetSize() == 0)return;
  13774. // dresshire;
  13775. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10); // 备注;
  13776. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7); // 取衣日期;
  13777. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8); // 还衣日期;
  13778. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6); // 记录日期;
  13779. CString strPrice = dresshirearray.ElementAt(0).ElementAt(1); // 金额;
  13780. CString strDeposit = dresshirearray.ElementAt(0).ElementAt(2); // 押金;
  13781. // client表;
  13782. if (clientarray.GetSize() == 0)return;
  13783. CString m_name2 = clientarray.ElementAt(0).ElementAt(2); // 女宾姓名;
  13784. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4); // 女宾手机;
  13785. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8); // 女宾地址;
  13786. CString m_time3 = clientarray.ElementAt(0).ElementAt(20); // 婚期;
  13787. // dresshiredata表;
  13788. CString sItem;
  13789. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13790. {
  13791. sItem += dresshiredataarray.ElementAt(i).ElementAt(1); // 礼服编号;
  13792. sItem += " ";
  13793. sItem += dresshiredataarray.ElementAt(i).ElementAt(2); // 礼服名称;
  13794. sItem += " 数量:";
  13795. sItem += dresshiredataarray.ElementAt(i).ElementAt(3) + "\r\n"; // 礼服数量;
  13796. }
  13797. sItem += " 金额:";
  13798. sItem += dresshirearray.ElementAt(0).ElementAt(1); // 出租金额;
  13799. sItem += " 押金:";
  13800. sItem += dresshirearray.ElementAt(0).ElementAt(2) + "\r\n"; // 押金;
  13801. ////////////////////////////////////////////////////////////////
  13802. int rcpos = -1;
  13803. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13804. m_Print.SetFontFace(17, 1, "宋体");
  13805. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13806. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13807. m_Print.SetFontFace(10, 1, "宋体");
  13808. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13809. CStringArray strarray;
  13810. strarray.Add("客户姓名"); // 1.
  13811. strarray.Add("客户电话");
  13812. strarray.Add("预定日期");
  13813. strarray.Add("结婚日期");
  13814. strarray.Add("取件日期"); // 5.
  13815. strarray.Add("归还日期");
  13816. strarray.Add("本店地址");
  13817. strarray.Add("电 话");
  13818. strarray.Add("客户地址");
  13819. strarray.Add("客户签名"); // 10.
  13820. //strarray.Add("金额");
  13821. //strarray.Add("押金");
  13822. for( i=2; i<12; i++)
  13823. //for (i = 2; i < 14; i++)
  13824. {
  13825. StrRect = load.m_rcarray.ElementAt(i);
  13826. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13827. }
  13828. strarray.RemoveAll();
  13829. strarray.Add(m_name2);
  13830. strarray.Add(m_phone2);
  13831. strarray.Add(m_inputdate);
  13832. strarray.Add(m_time3);
  13833. strarray.Add(m_date1);
  13834. strarray.Add(m_date2);
  13835. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13836. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13837. strarray.Add(m_addr2);
  13838. strarray.Add("");
  13839. strarray.Add(strPrice); // 金额;
  13840. strarray.Add(strDeposit); // 押金;
  13841. for( i=12; i<22; i++)
  13842. //for (i = 14; i < 24; i++)
  13843. {
  13844. StrRect = load.m_rcarray.ElementAt(i);
  13845. //m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i-12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13846. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 14), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13847. m_Print.DrawRect2(StrRect, 2);
  13848. }
  13849. for (i = 25; i < 30; i++)
  13850. {
  13851. StrRect = load.m_rcarray.ElementAt(i);
  13852. m_Print.DrawRect2(StrRect, 1);
  13853. }
  13854. StrRect = load.m_rcarray.ElementAt(22);
  13855. StrRect.top += 7;
  13856. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13857. StrRect = load.m_rcarray.ElementAt(23);
  13858. StrRect.top += 7;
  13859. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13860. StrRect = load.m_rcarray.ElementAt(24);
  13861. StrRect.top += 7;
  13862. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13863. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13864. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13865. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13866. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13867. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13868. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13869. if (str.IsEmpty())
  13870. {
  13871. str = "\
  13872. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13873. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13874. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13875. 4. 如有破损酌情赔偿.";
  13876. }
  13877. AutoDraw(m_Print, StrRect, str, 1.5);
  13878. PrintPreview dlg;
  13879. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13880. dlg.m_pDC = m_Print.GetPDC();
  13881. if (aa == 0)
  13882. {
  13883. if (dlg.DoModal() != IDOK)
  13884. return;
  13885. printcot = dlg.m_num;
  13886. }
  13887. //结束打印
  13888. m_Print.EndPage();
  13889. m_Print.EndPrint();
  13890. }
  13891. }
  13892. // ****************************************************************************
  13893. // Jeff:
  13894. // 函数:PrintHireDress2
  13895. // 无参;
  13896. // 调用者:DinDanFrom.cpp
  13897. // void DinDanFrom::GetData(),订单报表调用时,判断订单数是否大于1000
  13898. // 当订单数大于1000,设置连接公司服务器开关量为真;
  13899. // -----------------------------------------------------------------------------
  13900. // 修改:Jeff
  13901. // 时间:2014.10.18
  13902. // 内容:将 g_ncot 比较值改为100;
  13903. // ****************************************************************************
  13904. void CMainFrame::PrintHireDress2()
  13905. {
  13906. if (g_ncot > 100) g_bSendLYFZ = 1;
  13907. // g_pMainWnd->SetTimer (7, 3000, NULL);
  13908. }
  13909. void CMainFrame::PrintTakeForm2(CArray<CStringArray, CStringArray>*Listarray)
  13910. {
  13911. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "选片客人明细表";
  13912. int pages = Listarray->GetSize() / 46;
  13913. if (Listarray->GetSize() % 46)pages++;
  13914. for (int aa = 0; aa < pages; aa++)
  13915. {
  13916. PrintPreview dlg;
  13917. CPrintRX m_Print;
  13918. m_Print.InitToPrint(NULL, 1);
  13919. m_Print.StartPrint();
  13920. m_Print.StartPage();
  13921. CRect mainrc(0, 0, 560, 793);
  13922. float fscale;
  13923. {
  13924. int w, h;
  13925. m_Print.GetWidHei(w, h);
  13926. fscale = (float)w / (float)h;
  13927. }
  13928. mainrc.DeflateRect(25, 40, 10, 0);
  13929. CRect rc, rc2;
  13930. rc = mainrc;
  13931. rc.bottom = rc.top;
  13932. rc.top -= 20;
  13933. m_Print.SetFontFace(16, 1, "黑体");
  13934. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13935. m_Print.SetFontFace(9, 1, "宋体");
  13936. CString str;
  13937. int wid[5] = { 200, 110, 70, 85, 62 };
  13938. int hei = 16;
  13939. if (fscale > 0.71)hei = 15;
  13940. rc = mainrc;
  13941. rc.bottom = rc.top + hei;
  13942. for (int i = 0; i < 47; i++)
  13943. {
  13944. rc2.top = rc.top + i*hei;
  13945. rc2.bottom = rc.bottom + i*hei;
  13946. rc2.left = rc.left;
  13947. rc2.right = rc.left + wid[0];
  13948. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  13949. for (int j = 0; j<5; j++)
  13950. {
  13951. m_Print.DrawRect2(rc2, 1);
  13952. if (Listarray->GetSize()>aa * 46 + i)
  13953. {
  13954. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  13955. rc2.left += 3;
  13956. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13957. rc2.left -= 3;
  13958. }
  13959. rc2.left += wid[j];
  13960. rc2.right = rc2.left + wid[j + 1];
  13961. }
  13962. }
  13963. rc2.top += 2;
  13964. rc2.left += 2; rc2.right = mainrc.right + 4;
  13965. m_Print.SetFontFace(8, 1, "宋体");
  13966. str.Format(" 页:%d/%d", aa + 1, pages);
  13967. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  13968. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13969. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13970. dlg.m_pDC = m_Print.GetPDC();
  13971. // dlg.m_mode=1;
  13972. if (aa == 0)
  13973. {
  13974. if (dlg.DoModal() != IDOK)
  13975. return;
  13976. }
  13977. //结束打印
  13978. m_Print.EndPage();
  13979. m_Print.EndPrint();
  13980. }
  13981. }
  13982. void CMainFrame::PrintTakeForm3(CArray<CStringArray, CStringArray>*Listarray)
  13983. {
  13984. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "看设计客人明细表";
  13985. int pages = Listarray->GetSize() / 46;
  13986. if (Listarray->GetSize() % 46)pages++;
  13987. for (int aa = 0; aa < pages; aa++)
  13988. {
  13989. PrintPreview dlg;
  13990. CPrintRX m_Print;
  13991. m_Print.InitToPrint(NULL, 1);
  13992. m_Print.StartPrint();
  13993. m_Print.StartPage();
  13994. CRect mainrc(0, 0, 560, 793);
  13995. float fscale;
  13996. {
  13997. int w, h;
  13998. m_Print.GetWidHei(w, h);
  13999. fscale = (float)w / (float)h;
  14000. }
  14001. mainrc.DeflateRect(25, 40, 10, 0);
  14002. CRect rc, rc2;
  14003. rc = mainrc;
  14004. rc.bottom = rc.top;
  14005. rc.top -= 20;
  14006. m_Print.SetFontFace(16, 1, "黑体");
  14007. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14008. m_Print.SetFontFace(9, 1, "宋体");
  14009. CString str;
  14010. int wid[5] = { 200, 110, 70, 85, 62 };
  14011. int hei = 16;
  14012. if (fscale > 0.71)hei = 15;
  14013. rc = mainrc;
  14014. rc.bottom = rc.top + hei;
  14015. for (int i = 0; i < 47; i++)
  14016. {
  14017. rc2.top = rc.top + i*hei;
  14018. rc2.bottom = rc.bottom + i*hei;
  14019. rc2.left = rc.left;
  14020. rc2.right = rc.left + wid[0];
  14021. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14022. for (int j = 0; j<5; j++)
  14023. {
  14024. m_Print.DrawRect2(rc2, 1);
  14025. if (Listarray->GetSize()>aa * 46 + i)
  14026. {
  14027. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14028. rc2.left += 3;
  14029. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14030. rc2.left -= 3;
  14031. }
  14032. rc2.left += wid[j];
  14033. rc2.right = rc2.left + wid[j + 1];
  14034. }
  14035. }
  14036. rc2.top += 2;
  14037. rc2.left += 2; rc2.right = mainrc.right + 4;
  14038. m_Print.SetFontFace(8, 1, "宋体");
  14039. str.Format(" 页:%d/%d", aa + 1, pages);
  14040. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14041. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14042. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14043. dlg.m_pDC = m_Print.GetPDC();
  14044. // dlg.m_mode=1;
  14045. if (aa == 0)
  14046. {
  14047. if (dlg.DoModal() != IDOK)
  14048. return;
  14049. }
  14050. //结束打印
  14051. m_Print.EndPage();
  14052. m_Print.EndPrint();
  14053. }
  14054. }
  14055. void CMainFrame::PrintTakeForm4(CArray<CStringArray, CStringArray>*Listarray)
  14056. {
  14057. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "取件客人明细表";
  14058. int pages = Listarray->GetSize() / 46;
  14059. if (Listarray->GetSize() % 46)pages++;
  14060. for (int aa = 0; aa < pages; aa++)
  14061. {
  14062. PrintPreview dlg;
  14063. CPrintRX m_Print;
  14064. m_Print.InitToPrint(NULL, 1);
  14065. m_Print.StartPrint();
  14066. m_Print.StartPage();
  14067. CRect mainrc(0, 0, 560, 793);
  14068. float fscale;
  14069. {
  14070. int w, h;
  14071. m_Print.GetWidHei(w, h);
  14072. fscale = (float)w / (float)h;
  14073. }
  14074. mainrc.DeflateRect(25, 40, 10, 0);
  14075. CRect rc, rc2;
  14076. rc = mainrc;
  14077. rc.bottom = rc.top;
  14078. rc.top -= 20;
  14079. m_Print.SetFontFace(16, 1, "黑体");
  14080. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14081. m_Print.SetFontFace(9, 1, "宋体");
  14082. CString str;
  14083. int wid[5] = { 200, 110, 70, 85, 62 };
  14084. int hei = 16;
  14085. if (fscale > 0.71)hei = 15;
  14086. rc = mainrc;
  14087. rc.bottom = rc.top + hei;
  14088. for (int i = 0; i < 47; i++)
  14089. {
  14090. rc2.top = rc.top + i*hei;
  14091. rc2.bottom = rc.bottom + i*hei;
  14092. rc2.left = rc.left;
  14093. rc2.right = rc.left + wid[0];
  14094. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14095. for (int j = 0; j<5; j++)
  14096. {
  14097. m_Print.DrawRect2(rc2, 1);
  14098. if (Listarray->GetSize()>aa * 46 + i)
  14099. {
  14100. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14101. rc2.left += 3;
  14102. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14103. rc2.left -= 3;
  14104. }
  14105. rc2.left += wid[j];
  14106. rc2.right = rc2.left + wid[j + 1];
  14107. }
  14108. }
  14109. rc2.top += 2;
  14110. rc2.left += 2; rc2.right = mainrc.right + 4;
  14111. m_Print.SetFontFace(8, 1, "宋体");
  14112. str.Format(" 页:%d/%d", aa + 1, pages);
  14113. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14114. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14115. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14116. dlg.m_pDC = m_Print.GetPDC();
  14117. // dlg.m_mode=1;
  14118. if (aa == 0)
  14119. {
  14120. if (dlg.DoModal() != IDOK)
  14121. return;
  14122. }
  14123. //结束打印
  14124. m_Print.EndPage();
  14125. m_Print.EndPrint();
  14126. }
  14127. }
  14128. void CMainFrame::PrintTakeForm5(CArray<CStringArray, CStringArray>*Listarray)
  14129. {
  14130. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "婚庆客人明细表";
  14131. int pages = Listarray->GetSize() / 46;
  14132. if (Listarray->GetSize() % 46)pages++;
  14133. for (int aa = 0; aa < pages; aa++)
  14134. {
  14135. PrintPreview dlg;
  14136. CPrintRX m_Print;
  14137. m_Print.InitToPrint(NULL, 1);
  14138. m_Print.StartPrint();
  14139. m_Print.StartPage();
  14140. CRect mainrc(0, 0, 560, 793);
  14141. float fscale;
  14142. {
  14143. int w, h;
  14144. m_Print.GetWidHei(w, h);
  14145. fscale = (float)w / (float)h;
  14146. }
  14147. mainrc.DeflateRect(25, 40, 10, 0);
  14148. CRect rc, rc2;
  14149. rc = mainrc;
  14150. rc.bottom = rc.top;
  14151. rc.top -= 20;
  14152. m_Print.SetFontFace(16, 1, "黑体");
  14153. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14154. m_Print.SetFontFace(8, 1, "宋体");
  14155. CString str;
  14156. int wid[7] = { 165, 90, 90, 45, 45, 60, 35 };
  14157. int hei = 16;
  14158. if (fscale > 0.71)hei = 15;
  14159. rc = mainrc;
  14160. rc.bottom = rc.top + hei;
  14161. for (int i = 0; i < 47; i++)
  14162. {
  14163. rc2.top = rc.top + i*hei;
  14164. rc2.bottom = rc.bottom + i*hei;
  14165. rc2.left = rc.left;
  14166. rc2.right = rc.left + wid[0];
  14167. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14168. for (int j = 0; j<7; j++)
  14169. {
  14170. m_Print.DrawRect2(rc2, 1);
  14171. if (Listarray->GetSize()>aa * 46 + i)
  14172. {
  14173. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14174. rc2.left += 3;
  14175. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14176. rc2.left -= 3;
  14177. }
  14178. rc2.left += wid[j];
  14179. rc2.right = rc2.left + wid[j + 1];
  14180. }
  14181. }
  14182. rc2.top += 2;
  14183. rc2.left += 2; rc2.right = mainrc.right + 4;
  14184. m_Print.SetFontFace(8, 1, "宋体");
  14185. str.Format(" 页:%d/%d", aa + 1, pages);
  14186. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14187. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14188. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14189. dlg.m_pDC = m_Print.GetPDC();
  14190. // dlg.m_mode=1;
  14191. if (aa == 0)
  14192. {
  14193. if (dlg.DoModal() != IDOK)
  14194. return;
  14195. }
  14196. //结束打印
  14197. m_Print.EndPage();
  14198. m_Print.EndPrint();
  14199. }
  14200. }
  14201. void CMainFrame::PrintTakeForm1(CArray<CStringArray, CStringArray>*Listarray)
  14202. {
  14203. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "拍照客人明细表";
  14204. int pages = Listarray->GetSize() / 46;
  14205. if (Listarray->GetSize() % 46)pages++;
  14206. for (int aa = 0; aa < pages; aa++)
  14207. {
  14208. PrintPreview dlg;
  14209. CPrintRX m_Print;
  14210. m_Print.InitToPrint(NULL, 1);
  14211. m_Print.StartPrint();
  14212. m_Print.StartPage();
  14213. CRect mainrc(0, 0, 560, 793);
  14214. float fscale;
  14215. {
  14216. int w, h;
  14217. m_Print.GetWidHei(w, h);
  14218. fscale = (float)w / (float)h;
  14219. }
  14220. mainrc.DeflateRect(25, 40, 10, 0);
  14221. CRect rc, rc2;
  14222. rc = mainrc;
  14223. rc.bottom = rc.top;
  14224. rc.top -= 20;
  14225. m_Print.SetFontFace(16, 1, "黑体");
  14226. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14227. m_Print.SetFontFace(8, 1, "宋体");
  14228. CString str;
  14229. int wid[7] = { 165, 60, 90, 60, 60, 60, 35 };
  14230. int hei = 16;
  14231. if (fscale > 0.71)hei = 15;
  14232. rc = mainrc;
  14233. rc.bottom = rc.top + hei;
  14234. for (int i = 0; i < 47; i++)
  14235. {
  14236. rc2.top = rc.top + i*hei;
  14237. rc2.bottom = rc.bottom + i*hei;
  14238. rc2.left = rc.left;
  14239. rc2.right = rc.left + wid[0];
  14240. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14241. for (int j = 0; j<7; j++)
  14242. {
  14243. m_Print.DrawRect2(rc2, 1);
  14244. if (Listarray->GetSize()>aa * 46 + i)
  14245. {
  14246. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14247. rc2.left += 3;
  14248. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14249. rc2.left -= 3;
  14250. }
  14251. rc2.left += wid[j];
  14252. rc2.right = rc2.left + wid[j + 1];
  14253. }
  14254. }
  14255. rc2.top += 2;
  14256. rc2.left += 2; rc2.right = mainrc.right + 4;
  14257. m_Print.SetFontFace(8, 1, "宋体");
  14258. str.Format(" 页:%d/%d", aa + 1, pages);
  14259. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14260. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14261. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14262. dlg.m_pDC = m_Print.GetPDC();
  14263. // dlg.m_mode=1;
  14264. if (aa == 0)
  14265. {
  14266. if (dlg.DoModal() != IDOK)
  14267. return;
  14268. }
  14269. //结束打印
  14270. m_Print.EndPage();
  14271. m_Print.EndPrint();
  14272. }
  14273. }
  14274. void CMainFrame::ShowMonthForm2()
  14275. {
  14276. }
  14277. // dlg;