MainFrm.cpp 456 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548
  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. #ifndef VC60
  138. #include "msgId_def.h"
  139. #include "struct_def.h"
  140. #endif //#ifndef VC60
  141. #ifdef _DEBUG
  142. #define new DEBUG_NEW
  143. #undef THIS_FILE
  144. static char THIS_FILE[] = __FILE__;
  145. #endif
  146. #ifndef WINVER
  147. #define WINVER 0x0400
  148. #endif
  149. #ifndef _WIN32_WINNT
  150. #define _WIN32_WINNT 0x0400
  151. #endif
  152. #ifndef _WIN32_WINDOWS
  153. #define _WIN32_WINDOWS 0x0410
  154. #endif
  155. #ifndef _WIN32_IE
  156. #define _WIN32_IE 0x0400
  157. #endif
  158. #include "uxtheme.h "
  159. typedef HTHEME(__stdcall * POPENTHEMEDATA)(HWND hwnd, LPCWSTR pszClassList);
  160. typedef HRESULT(__stdcall * PCLOSETHEMEDATA)(HTHEME hTheme);
  161. HHOOK g_hmouse = NULL; //g_sendhead zx.dll
  162. //extern void WriteTextLog(CString str); // Jeff写客户端日志;
  163. // Jeff.remark;
  164. // 函数:MouseProc
  165. // 参数:
  166. // nCode hook code
  167. // wParam message identifier
  168. // lParam mouse coordinates
  169. // 返回:
  170. //
  171. LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam)
  172. {
  173. if (g_pMainWnd)
  174. {
  175. if(g_cominfoarray.GetSize() > 0)
  176. {
  177. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(133)) && atoi(g_cominfoarray.ElementAt(0).ElementAt(134)) > 0)
  178. {
  179. g_pMainWnd->KillTimer(5);
  180. g_pMainWnd->SetTimer(5, atoi(g_cominfoarray.ElementAt(0).ElementAt(134)) * 60 * 1000, NULL);
  181. }
  182. }
  183. if (g_bSendLYFZ)
  184. {
  185. g_pMainWnd->KillTimer(7);
  186. g_pMainWnd->SetTimer(7, 5 * 60 * 1000, NULL);
  187. }
  188. }
  189. return CallNextHookEx(g_hmouse, nCode, wParam, lParam);
  190. }
  191. CRect g_rc; // 屏幕坐标值,区域是放置对话框。
  192. CMainFrame *g_pMainWnd = NULL;
  193. extern HWND g_hSendWnd;
  194. extern HWND g_hConnectWnd;
  195. //extern CString newGUID();
  196. #ifdef USE_KERNEL_DLL
  197. /************************************************************************/
  198. /*
  199. 函数:kernelCallback
  200. 描述:kernel.dll的回调函数;
  201. 参数:
  202. lpStrBranchId: 域名;
  203. lpStrOrder: 订单号;
  204. dwImgType: 相片类型;
  205. dwImgNum: 重命名使用,返回的相片编号;
  206. lpStrImg: IncrementalBack表使用的content字段内容,指定备份文件名的相片;
  207. lpStrImgExt: IncrementalBack表使用的backupExt字段内容,指定要备份的扩展名相片;
  208. 返回:void
  209. */
  210. /************************************************************************/
  211. #include "ImportPhoto.h"
  212. // 导入原片、初修、精修、设计结束后的回调函数(三合一);
  213. void CALLBACK ImgImportMergeCallback(IN LPCTSTR lpStrBranchId, IN LPCTSTR lpStrOrderNum, IN CONST INT& dwImgType, IN CONST DWORD& dwImgNum, IN LPCTSTR lpStrImgs, IN LPCTSTR lpStrImgExt)
  214. {
  215. AfxSetResourceHandle(g_Instance);
  216. // 1.判断参数有效性;
  217. if (lpStrBranchId == NULL || !strstr(lpStrBranchId, _T(".ly.com")) || lpStrOrderNum == NULL || _tcscmp(lpStrOrderNum, _T("")) == 0)
  218. {
  219. OutputDebugString(_T("回调函数参数(域名、订单号)无效\n"));
  220. return;
  221. }
  222. // 2.是否需要备份分店相片;
  223. BOOL bIsNeedBranchImg = FALSE;
  224. switch (dwImgType)
  225. {
  226. case 1://是否备份分店原片;
  227. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck1;
  228. break;
  229. case 2://是否备份分店修片;
  230. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck2;
  231. break;
  232. case 3://是否备份分店精修;
  233. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck3;
  234. break;
  235. case 4://是否备份分店设计;
  236. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck4;
  237. break;
  238. default:
  239. OutputDebugString(_T("未知相片类型!\n"));
  240. break;
  241. }
  242. // 3.同时更新IncrementalBack表;
  243. CString strSQLInsert = _T("");
  244. strSQLInsert.Format(INSERT_INCREMENT, 0, lpStrBranchId, CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S"), lpStrOrderNum, dwImgType, lpStrImgs, g_user.account, g_user.name);
  245. // 4.连接服务器,更新dindan和IncrementalBackup;
  246. g_sendhead.bsql = 1;
  247. if (g_bAllBranch)
  248. {// 多店汇总时;
  249. g_branchip = GetBranchIPbyId(lpStrBranchId);
  250. g_pMainWnd->OnDisconnect();
  251. g_branchname = GetBranchNamebyId(lpStrBranchId);
  252. g_bBranchModify = 1;
  253. if (dwImgType == OImgtype)
  254. {// 如果导入的是原片;
  255. CString strSQL = _T("");
  256. strSQL.Format(_T("update dindan set curno = '%d' where id = '%s' ***%s"), dwImgNum, lpStrOrderNum, strSQLInsert);
  257. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  258. }
  259. else
  260. {//导入的不是原片;
  261. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  262. }
  263. // 如果连接服务器失败,要记录下来;
  264. // if () .........
  265. g_pMainWnd->OnDisconnect();
  266. g_bBranchModify = 0;
  267. g_branchip = g_branchname = _T("");
  268. if (g_domain.CompareNoCase(lpStrBranchId) != 0 && bIsNeedBranchImg)
  269. {// 如果不是本店,且本店设置中需要备份分店相片,需要向本店添加导入相片记录;
  270. g_sendhead.bsql = 1;
  271. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  272. g_pMainWnd->OnDisconnect();
  273. g_bBranchModify = 0;
  274. }
  275. }
  276. else
  277. {// 连接本店或分店时;
  278. if (dwImgType == OImgtype)
  279. {// 如果导入的是原片;
  280. CString strSQL = _T("");
  281. strSQL.Format(_T("update dindan set curno = '%d' where id = '%s' ***%s"), dwImgNum, lpStrOrderNum, strSQLInsert);
  282. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  283. }
  284. else
  285. {//导入的不是原片;
  286. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  287. }
  288. if (g_domain.CompareNoCase(lpStrBranchId) != 0 && bIsNeedBranchImg)
  289. {// 如果不是本店,且本店设置中需要备份分店相片,需要向本店添加导入相片记录;
  290. #if 1
  291. ::SendMessage(g_pMainWnd->m_hWnd, MSG_KERNEL_SENDMSG, (WPARAM)lpStrBranchId, (LPARAM)&strSQLInsert);
  292. #else // 可能是VC6.0与VC9.0间DLL调用产生的问题,下面代码执行时会出错;
  293. // 如果连接的是分店,断开分店,回连本店;
  294. g_bBranchModify = FALSE;
  295. g_pMainWnd->OnDisconnect();
  296. g_branchname = g_branchip = _T("");
  297. g_sendhead.bsql = 1;
  298. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  299. g_pMainWnd->OnDisconnect();
  300. // 设置回分店连接;
  301. g_branchip = GetBranchIPbyId(lpStrBranchId);
  302. g_branchname = GetBranchNamebyId(lpStrBranchId);
  303. g_bBranchModify = TRUE;
  304. #endif
  305. }
  306. }
  307. if ( dwImgType == OImgtype )
  308. {// 最后一步,更新完了数据库,刷新TakFrom类所对应的对话框;
  309. HWND hWnd = ::FindWindowEx(g_pMainWnd->GetSafeHwnd(), NULL, _T("MDIClient"), NULL);
  310. if (hWnd)
  311. {
  312. hWnd = ::FindWindowEx(hWnd, NULL, NULL, _T("拍照"));
  313. if (hWnd)
  314. {
  315. hWnd = ::FindWindowEx(hWnd, NULL, _T("#32770"), NULL);
  316. if (hWnd)
  317. {
  318. ::SendMessage(hWnd, MSG_KERNEL_CALLBACK, 0, 0);
  319. }
  320. }
  321. }
  322. }
  323. }
  324. #endif
  325. /////////////////////////////////////////////////////////////////////////////
  326. // CMainFrame客人付款
  327. /////////////////////////////////////////////////////////////////////////////
  328. /////////////////////////////////////////////////////////////////////////////
  329. static void HandleClientNetEvent(IN SOCKET hSocket,
  330. IN ETransportEvent eEvent,
  331. IN void *pDataBuf,
  332. IN unsigned long nDataLen,
  333. IN int nError,
  334. IN void *pContext)
  335. {
  336. if (nError != TRANSPORT_OK)
  337. return;
  338. CMainFrame *pDlg = (CMainFrame *)pContext;
  339. if (NULL == pDlg)
  340. return;
  341. pDlg->ProcessNetEvent(eEvent, pDataBuf, nDataLen);
  342. }
  343. BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam)
  344. {
  345. CRect rtCtrl, rtWnd; // 子窗口,父窗口;
  346. if (hwnd)
  347. {
  348. ::GetWindowRect(hwnd, &rtCtrl); // 获取控件大小;
  349. ::GetWindowRect(GetParent(hwnd), &rtWnd); // 获取父窗口大小;
  350. // printf("Jeff:g_WidthScale=%d,g_HeightScale=%d,rtWnd.left=%d,rtWnd.top=%d\n\n",g_WidthScale,g_HeightScale,rtWnd.left,rtWnd.top);
  351. // printf("Jeff:old:ctrl.left=%d,ctrl.top=%d,ctrl.right=%d,ctrl.bottom=%d\n\n",rtCtrl.left,rtCtrl.top,rtCtrl.right,rtCtrl.bottom);
  352. rtCtrl.OffsetRect(-rtWnd.left, -rtWnd.top);
  353. float temp;
  354. temp = (float)rtCtrl.left*g_WidthScale;
  355. rtCtrl.left = (int)temp + g_dx;
  356. temp = (float)rtCtrl.top*g_HeightScale;
  357. rtCtrl.top = (int)temp + g_dy;
  358. temp = (float)rtCtrl.right*g_WidthScale;
  359. rtCtrl.right = (int)temp + g_dx;
  360. temp = (float)rtCtrl.bottom*g_HeightScale;
  361. rtCtrl.bottom = (int)temp + g_dy;
  362. //printf("Jeff:new:ctrl.left=%d,ctrl.top=%d,ctrl.right=%d,ctrl.bottom=%d\n\n",rtCtrl.left,rtCtrl.top,rtCtrl.right,rtCtrl.bottom);
  363. ::MoveWindow(hwnd, rtCtrl.left, rtCtrl.top, rtCtrl.Width(), rtCtrl.Height(), TRUE);
  364. return TRUE;
  365. }
  366. else
  367. {
  368. return FALSE;
  369. }
  370. }
  371. IMPLEMENT_DYNCREATE(CMainFrame, CMDIFrameWnd)
  372. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  373. //{{AFX_MSG_MAP(CMainFrame)
  374. ON_WM_CREATE()
  375. ON_WM_DESTROY()
  376. ON_WM_CLOSE()
  377. ON_WM_TIMER()
  378. ON_COMMAND(IDM_choosephotoskin, Onchoosephotoskin)
  379. ON_COMMAND(IDM_PATH, OnPath)
  380. ON_COMMAND(IDM_SERVER, OnServer)
  381. ON_COMMAND(IDM_SHOWHIS, OnShowhis)
  382. ON_COMMAND(IDM_StaffAchievementShow, OnStaffAchievementShow)
  383. ON_COMMAND(IDM_AUTODELPHOTO, OnAutodelphoto)
  384. ON_COMMAND(IDM_PHOTOMANAGE, Onphotomanage)
  385. ON_COMMAND(IDM_COMPANYINFO, OnCompanyinfo)
  386. ON_COMMAND(IDM_HELPFILE, OnHelpfile)
  387. ON_COMMAND(IDM_PHOTOBAK, OnPhotobak)
  388. ON_COMMAND(IDM_TAOXIFG, OnTaoxifg)
  389. ON_COMMAND(IDM_ShowBakState, OnShowBakState)
  390. ON_WM_NCLBUTTONDBLCLK()
  391. ON_WM_NCHITTEST()
  392. ON_COMMAND(IDM_LOG, OnLog)
  393. //}}AFX_MSG_MAP
  394. ON_COMMAND_RANGE(0, 50000, OnCommandMenu)
  395. ON_MESSAGE(MSG_KERNEL_SENDMSG, OnKernelSendMessaage)
  396. END_MESSAGE_MAP()
  397. static UINT indicators[] =
  398. {
  399. ID_SEPARATOR, // status line indicator
  400. ID_INDICATOR_CAPS,
  401. ID_INDICATOR_NUM,
  402. ID_INDICATOR_SCRL,
  403. };
  404. /////////////////////////////////////////////////////////////////////////////
  405. // CMainFrame construction/destruction
  406. #if defined(VC70) || defined(VC60)
  407. UINT CMainFrame::OnNcHitTest(CPoint point)
  408. {
  409. if (CWnd::OnNcHitTest(point) == HTRIGHT || CWnd::OnNcHitTest(point) == HTLEFT || CWnd::OnNcHitTest(point) == HTTOP || CWnd::OnNcHitTest(point) == HTBOTTOM)
  410. return HTCLIENT;
  411. return CWnd::OnNcHitTest(point);
  412. }
  413. #else
  414. LRESULT CMainFrame::OnNcHitTest(CPoint point)
  415. {
  416. if (CWnd::OnNcHitTest(point) == HTRIGHT || CWnd::OnNcHitTest(point) == HTLEFT || CWnd::OnNcHitTest(point) == HTTOP || CWnd::OnNcHitTest(point) == HTBOTTOM)
  417. return HTCLIENT;
  418. return CWnd::OnNcHitTest(point);
  419. }
  420. #endif
  421. void CMainFrame::OnNcLButtonDblClk(UINT nFlags, CPoint point)
  422. {
  423. if (nFlags != HTCAPTION)
  424. CMDIFrameWnd::OnNcLButtonDblClk(nFlags, point);
  425. }
  426. // 回调使用;
  427. LRESULT CMainFrame::OnKernelSendMessaage(WPARAM wp, LPARAM lp)
  428. {
  429. CString strBranchId = (LPCTSTR)wp;
  430. CString strSQLInsert = *(CString*)lp;
  431. // 如果连接的是分店,断开分店,回连本店;
  432. g_bBranchModify = FALSE;
  433. g_pMainWnd->OnDisconnect();
  434. g_branchname = g_branchip = _T("");
  435. g_sendhead.bsql = 1;
  436. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  437. g_pMainWnd->OnDisconnect();
  438. // 设置回分店连接;
  439. g_branchip = GetBranchIPbyId(strBranchId);
  440. g_branchname = GetBranchNamebyId(strBranchId);
  441. g_bBranchModify = TRUE;
  442. g_pMainWnd->OnConnect();
  443. return 0;
  444. }
  445. CMainFrame::CMainFrame()
  446. {
  447. // TODO: add member initialization code here
  448. SetConnectionID(INVALID_SOCKET);
  449. m_pMainFrimDlg2 = NULL;
  450. m_bCheckF2F3 = AfxGetApp()->GetProfileInt(LYFZVERSION, "f2f3", 0);
  451. if (0 == ::PathFileExists(g_mainpath + "\\skin\\5.lia"))
  452. {
  453. g_bNoLoginLia = 1;
  454. }
  455. }
  456. CMainFrame::~CMainFrame()
  457. {
  458. if (m_pMainFrimDlg2)
  459. {
  460. m_pMainFrimDlg2->DestroyWindow();
  461. delete m_pMainFrimDlg2;
  462. }
  463. }
  464. void InTheMe(HWND m_hWnd)
  465. {
  466. BOOL bXpVisualStyle = FALSE;
  467. OSVERSIONINFO osvi;
  468. osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  469. ::GetVersionEx(&osvi);
  470. if ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) && (osvi.dwMajorVersion >= 5) && (osvi.dwMinorVersion >= 1))
  471. {
  472. HMODULE hUxTheme = ::LoadLibrary(_T("UxTheme.dll"));
  473. POPENTHEMEDATA pOpenThemeData;
  474. PCLOSETHEMEDATA pCloseThemeData;
  475. if (hUxTheme != NULL)
  476. {
  477. pOpenThemeData = (POPENTHEMEDATA)::GetProcAddress(hUxTheme, "OpenThemeData");
  478. pCloseThemeData = (PCLOSETHEMEDATA)::GetProcAddress(hUxTheme, "CloseThemeData");
  479. HTHEME hButtonTheme = (*pOpenThemeData)(m_hWnd, L"BUTTON");
  480. if (hButtonTheme != NULL)
  481. bXpVisualStyle = TRUE;
  482. (*pCloseThemeData)(hButtonTheme);
  483. }
  484. ::FreeLibrary(hUxTheme);
  485. }
  486. if (bXpVisualStyle)
  487. AfxMessageBox(_T("正在使用视觉主题 "));
  488. else
  489. AfxMessageBox(_T("没有使用视觉主题 "));
  490. }
  491. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  492. {
  493. if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  494. {
  495. // Jeff.创建失败的可能性小,加日志输出;
  496. return -1;
  497. }
  498. if (::PathFileExists(g_mainpath + "\\logo.ico"))
  499. {
  500. Bitmap *bmp = NULL;
  501. LoadImageFromFile((Image**)&bmp, g_mainpath + "\\logo.ico");
  502. // m_hIcon = AfxGetApp()->LoadIcon(g_mainpath+"\\logo.ico");
  503. bmp->GetHICON(&m_hIcon);
  504. delete bmp;
  505. SetIcon(m_hIcon, TRUE); // Set big icon
  506. SetIcon(m_hIcon, FALSE); // Set small icon
  507. }
  508. if (!m_wndClient.SubclassWindow(m_hWndMDIClient))
  509. {
  510. return -1;
  511. }
  512. if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  513. | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  514. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  515. {
  516. TRACE0("Failed to create toolbar\n");
  517. return -1; // fail to create
  518. }
  519. m_wndToolBar.LoadTrueColorToolBar(90, IDB_NORMAL, 0, IDB_DISABLE);
  520. // second toolbar must have different ID
  521. if (!m_wndToolBar2.Create(this, WS_CHILD | WS_VISIBLE | CBRS_LEFT | CBRS_NOALIGN,
  522. AFX_IDW_CONTROLBAR_FIRST + 32) ||
  523. !m_wndToolBar2.LoadToolBar(IDR_TOOLBAR1))
  524. {
  525. TRACE0("Failed to create toolbar\n");
  526. return -1; // fail to create
  527. }
  528. #ifndef NEW_SKIN
  529. if (!m_wndStatusBar.Create(this) ||
  530. !m_wndStatusBar.SetIndicators(indicators,
  531. sizeof(indicators)/sizeof(UINT)))
  532. {
  533. // Jeff.创建失败的可能性小,加日志输出;
  534. TRACE0("Failed to create status bar\n");
  535. return -1; // fail to create
  536. }
  537. m_wndStatusBar.SetPaneInfo(1,ID_INDICATOR_USER,SBPS_NORMAL,200);
  538. m_wndStatusBar.SetPaneText(1,"未登录",TRUE);
  539. #endif
  540. // TODO: Delete these three lines if you don't want the toolbar to
  541. // be dockable
  542. NewMenu2();
  543. ::GetWindowRect(this->m_hWndMDIClient, g_rc);
  544. g_pMainWnd = this;
  545. m_wndToolBar2.Init();
  546. g_rc.top += 38;
  547. g_rc.left += 160;
  548. /* m_WidthScale = (float)g_rc.Width ()/722;
  549. m_HeightScale = (float)g_rc.Height ()/533;*/
  550. g_user.bLongin = 0;
  551. SetTimer(1, 100, NULL);
  552. #ifdef USE_KERNEL_DLL
  553. if ( g_pIMGProcess )
  554. g_pIMGProcess->SetCallBack(ImgImportMergeCallback);
  555. #endif
  556. return 0;
  557. }
  558. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  559. {
  560. if (!CMDIFrameWnd::PreCreateWindow(cs))
  561. return FALSE;
  562. // TODO: Modify the Window class or styles here by modifying
  563. // the CREATESTRUCT cs
  564. cs.style &= ~WS_MAXIMIZEBOX;
  565. cs.style &= ~WS_THICKFRAME;
  566. cs.lpszName = g_title + "影楼管理系统";
  567. cs.style &= ~FWS_ADDTOTITLE;
  568. RECT rect;
  569. HWND hWnd = ::FindWindow("Shell_TrayWnd", 0);
  570. ::GetWindowRect(hWnd, &rect);
  571. cs.x = 0;
  572. cs.y = 0;
  573. cs.cx = GetSystemMetrics(SM_CXSCREEN);
  574. cs.cy = GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top) + 3;
  575. return TRUE;
  576. }
  577. /////////////////////////////////////////////////////////////////////////////
  578. // CMainFrame diagnostics
  579. #ifdef _DEBUG
  580. void CMainFrame::AssertValid() const
  581. {
  582. CMDIFrameWnd::AssertValid();
  583. }
  584. void CMainFrame::Dump(CDumpContext& dc) const
  585. {
  586. CMDIFrameWnd::Dump(dc);
  587. }
  588. #endif //_DEBUG
  589. /////////////////////////////////////////////////////////////////////////////
  590. // CMainFrame message handlers
  591. void CMainFrame::OnDestroy()
  592. {
  593. OnDisconnect();
  594. #if defined(VC80) || defined(VC70) || defined(VC60)
  595. Transport_UnInit();
  596. #else
  597. CClientTunnel::Transport_UnInit();
  598. #endif //#ifdef VC60
  599. m_Mdi.DeleteAll();
  600. if (g_hmouse)UnhookWindowsHookEx(g_hmouse);
  601. CMDIFrameWnd::OnDestroy();
  602. }
  603. void CMainFrame::OnClose()
  604. {
  605. g_bShowBar = 0;
  606. if (m_Mdi.MainClose())
  607. CMDIFrameWnd::OnClose();
  608. }//连接
  609. void CMainFrame::NewMenu2()
  610. {
  611. CMenu *pMemu = GetMenu();
  612. #ifdef BASIC_VERSION
  613. CMenu* submenu = pMemu->GetSubMenu(1);
  614. //submenu->RemoveMenu (IDM_StaffAchievementShow, MF_BYCOMMAND );//Jeff del 2014.06.16
  615. submenu->RemoveMenu (IDM_salaryset, MF_BYCOMMAND );
  616. #endif
  617. #if 0 // 此机用选片菜单项,去掉不用;
  618. {
  619. BOOL checked=AfxGetApp()->GetProfileInt (LYFZVERSION, "status", 0);
  620. if(checked)
  621. {
  622. CMenu* submenu = pMemu->GetSubMenu(1);
  623. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  624. }
  625. }
  626. #endif
  627. #ifndef BASIC_VERSION
  628. {
  629. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status2", 0);
  630. if (checked)
  631. {
  632. #if 0 // Jeff:去掉菜单,此机用于员工业绩查看的菜单选项;
  633. CMenu* submenu = pMemu->GetSubMenu(1);
  634. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  635. #endif
  636. g_bStaffAchievementShow = 1;
  637. SetTimer(3, 100, NULL);
  638. }
  639. }
  640. #endif
  641. if (g_bShowOK == 0)
  642. {
  643. CMenu* submenu = pMemu->GetSubMenu(2);
  644. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  645. }
  646. }
  647. HMENU CMainFrame::NewMenu()
  648. {
  649. //设置菜单为XP风格 IDM_SHOWHIS
  650. BCMenu::SetMenuDrawMode(1);
  651. //若取消下面这句注释,则可看到菜单的图标栏和文字栏背景颜色为白色,
  652. //文字颜色为蓝色,选中项的前景色为紫红色
  653. //m_menuXP.SetMenuXPItemColor(0x00FFFFFF,0x00FFFFFF,0x00FF0000,0x00FF00FF);
  654. // 设置菜单中图标大小为32×32
  655. // m_menuXP.SetIconSize(32,32);
  656. // 加载菜单资源
  657. m_menuXP.LoadMenu(IDR_MAINFRAME);
  658. // 加载菜单对应的工具栏资源
  659. // m_menuXP.LoadToolbar(IDR_MAINFRAME);
  660. /*由于菜单左边栏中默认的图标大小为16×16,而与之对应的Toolbar中图标大小为32×32,
  661. 因此菜单中图标不能正确显示,只显示出工具栏中图标的左上角部分,所以修改菜单中各
  662. 项对应的图标为24b色位图资源IDB_***,或者在LoadMenu之前调用SetIconSize,设置菜单
  663. 中图标大小为32×32*/
  664. // m_menuXP.SetIconSize(24,24);
  665. // m_menuXP.ModifyODMenu(NULL,IDM_YWBU,IDB_YW); //
  666. /* m_menuXP.ModifyODMenu(NULL,ID_FILE_OPEN,IDB_BITMAP5);
  667. m_menuXP.ModifyODMenu(NULL,ID_FILE_SAVE,IDB_BITMAP7);
  668. m_menuXP.ModifyODMenu(NULL,ID_FILE_PRINT,IDB_BITMAP6);
  669. m_menuXP.ModifyODMenu(NULL,ID_APP_ABOUT,IDB_BITMAP3);
  670. m_menuXP.ModifyODMenu(NULL,ID_APP_EXIT,IDB_BITMAP2);*/
  671. // m_menuXP.EnableMenuItem (0, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  672. // m_menuXP.EnableMenuItem (2, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  673. // m_menuXP.EnableMenuItem (3, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  674. // m_menuXP.EnableMenuItem (4, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  675. // m_menuXP.EnableMenuItem (5, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  676. // m_menuXP.EnableMenuItem (8, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  677. #if 0 // Jeff此机用选片菜单项不用;
  678. {
  679. BOOL checked=AfxGetApp()->GetProfileInt (LYFZVERSION, "status", 0);
  680. if(checked)
  681. {
  682. CMenu* submenu = m_menuXP.GetSubMenu(1);
  683. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  684. }
  685. }
  686. #endif
  687. {
  688. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status2", 0);
  689. if (checked)
  690. {
  691. #if 0 // Jeff:去掉此机用于员工业绩查看的菜单选项;
  692. CMenu* submenu = m_menuXP.GetSubMenu(1);
  693. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  694. #endif
  695. g_bStaffAchievementShow = 1;
  696. SetTimer(3, 100, NULL);
  697. }
  698. }
  699. if (g_bShowOK == 0)
  700. {
  701. CMenu* submenu = m_menuXP.GetSubMenu(2);
  702. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  703. }
  704. return(m_menuXP.Detach());
  705. }
  706. ///////////////////////////////////////////////////////
  707. //减少代码
  708. #define OPEN_MENU(x) m_Mdi.Append(pName, RUNTIME_CLASS(x), IDR_MAINFRAME, this, nID)
  709. //响应菜单命令
  710. void CMainFrame::OnCommandMenu(UINT nID) // 所有菜单命令都在这里处理;
  711. {
  712. if (nID >= 2000 && nID <= 2100)
  713. {
  714. OnBranchData(nID);
  715. return;
  716. }
  717. if (g_user.bLongin == 0)
  718. {
  719. if (g_bNoLoginLia)
  720. {
  721. Login dlg;
  722. dlg.SetLiaPath("5.lia");
  723. dlg.DoModal();
  724. }
  725. else
  726. {
  727. Login3 dlg;
  728. dlg.SetLiaPath("5.lia");
  729. dlg.DoModal();
  730. }
  731. return;
  732. if (g_user.bLongin == 0)return;
  733. }
  734. else
  735. {
  736. InsideMsg();
  737. }
  738. ResetTimer();
  739. if (nID >= 1000 && nID <= 1100)
  740. {
  741. OnHistory(nID);
  742. return;
  743. }
  744. LPSTR pName;
  745. //打开窗口
  746. switch (nID)
  747. {
  748. case IDM_PayOutSet:
  749. {
  750. if (IsHasRights(16) == 0)return;
  751. PayOutSet dlg;
  752. dlg.DoModal();
  753. return;
  754. }
  755. case IDM_SPLB:
  756. {
  757. if (IsHasRightsnew(29) == 0)return;
  758. SPLBDlg dlg;
  759. dlg.DoModal();
  760. return;
  761. }
  762. case IDM_JD:
  763. {
  764. if (IsHasRightsnew(49) == 0)return;
  765. SPLBDlg dlg;
  766. dlg.m_mode = 1;
  767. dlg.DoModal();
  768. return;
  769. }
  770. case IDM_AREA:
  771. {
  772. if (IsHasRightsnew(47) == 0)return;
  773. AreaDlg dlg;
  774. dlg.DoModal();
  775. return;
  776. }
  777. case IDM_Psw:
  778. {
  779. Psw dlg;
  780. dlg.DoModal();
  781. return;
  782. }
  783. case IDM_Set:
  784. {
  785. if (IsHasRightsnew(49) == 0)return;
  786. Set dlg;
  787. dlg.DoModal();
  788. return;
  789. }
  790. case IDM_HIDEWINDOW:
  791. {
  792. HideWindow dlg;
  793. dlg.DoModal();
  794. return;
  795. }
  796. case IDM_Logout:// Jeff.注销;
  797. {
  798. if(g_user.bLongin)
  799. WriteLog("退出系统!", "退出系统!");
  800. g_user.bLongin = 0;
  801. g_user.name.Empty();
  802. g_user.rights.Empty();
  803. g_user.account.Empty();
  804. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  805. g_pMainWnd2->RefreshOutlookBar();
  806. #ifndef NEW_SKIN
  807. m_wndStatusBar.SetPaneText(1, "未登录", TRUE);
  808. #endif
  809. m_Mdi.CloseAll();
  810. #ifdef ENTERPRISE_VERSION
  811. g_branchname.Empty();
  812. g_branchip.Empty();
  813. g_pMainWnd->OnDisconnect();
  814. g_bBranchModify = 0;
  815. #endif
  816. if (g_pMainWnd2)
  817. {
  818. g_pMainWnd2->DrawLogin();
  819. g_pMainWnd2->ShowBar(0);
  820. }
  821. g_hisyeararray.RemoveAll();
  822. g_pMainWnd->AddHistoryMenu(&g_hisyeararray);
  823. g_brancharray.RemoveAll();
  824. g_pMainWnd->AddBranchMenu(&g_brancharray);
  825. if (g_bNoLoginLia)
  826. {
  827. Login dlg;
  828. dlg.SetLiaPath("5.lia");
  829. dlg.DoModal();
  830. }
  831. else
  832. {
  833. Login3 dlg;
  834. dlg.SetLiaPath("5.lia");
  835. dlg.DoModal();
  836. }
  837. if (g_user.bLongin == 1)
  838. {
  839. if (g_pMainWnd2)
  840. {
  841. g_pMainWnd2->ShowBar(TRUE,TRUE);
  842. }
  843. }
  844. return;
  845. }
  846. case IDM_TODAY:
  847. pName = (LPSTR)(LPCSTR)"历史订单";
  848. // OPEN_MENU(SalarySet3);
  849. OPEN_MENU(DinDanHistroy);
  850. break;
  851. case IDM_TAKECONTROL:
  852. pName = (LPSTR)(LPCSTR)"摄控表";
  853. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(117)))
  854. OPEN_MENU(TodayForm2);
  855. else
  856. OPEN_MENU(TodayForm);
  857. break;
  858. case IDM_CLIENTMONEY:
  859. pName = (LPSTR)(LPCSTR)"客人付款";
  860. OPEN_MENU(ClientMoney);
  861. break;
  862. case IDM_TAKEAWAYBOOK:
  863. pName = (LPSTR)(LPCSTR)"发片/取件";
  864. OPEN_MENU(outsourcing);
  865. break;
  866. case IDM_CODE:
  867. pName = (LPSTR)(LPCSTR)"商品报表";
  868. OPEN_MENU(SPForm);
  869. break;
  870. case IDM_Daily:
  871. // if(IsHasRightsnew(22)==0)return;
  872. // pName = (LPSTR)(LPCSTR)"日财务表";
  873. // OPEN_MENU(DailyForm);
  874. pName = (LPSTR)(LPCSTR)"沟通助手";
  875. OPEN_MENU(InsideMsg);
  876. break;
  877. case IDM_ProcessAlarm:
  878. pName = (LPSTR)(LPCSTR)"流程监控";
  879. OPEN_MENU(ProcessAlarm);
  880. break;
  881. case IDM_DINDAN:
  882. // if(IsHasRights(7)==0)return;
  883. pName = (LPSTR)(LPCSTR)"订单报表";
  884. OPEN_MENU(DinDanFrom);
  885. break;
  886. case IDM_CLIENT:
  887. //if(IsHasRights(8)==0)return;
  888. pName = (LPSTR)(LPCSTR)"客户报表";
  889. OPEN_MENU(CClientForm);
  890. break;
  891. case IDM_PayOutInput:
  892. if (IsHasRightsnew(20) == 0)return;
  893. pName = (LPSTR)(LPCSTR)"现金支出";
  894. OPEN_MENU(PayOutInput);
  895. break;
  896. case IDM_salaryset:
  897. if (IsHasRightsnew(25) == 0)return;
  898. pName = (LPSTR)(LPCSTR)"工资设置";
  899. OPEN_MENU(SalarySet);
  900. break;
  901. case IDM_mysalary:
  902. if (IsHasRights(16) == 0)return;
  903. pName = (LPSTR)(LPCSTR)"我的工资";
  904. OPEN_MENU(MySalary);
  905. break;
  906. case IDM_SP:
  907. // if(IsHasRightsnew(29)==0)return;
  908. pName = (LPSTR)(LPCSTR)"商品设置";
  909. OPEN_MENU(ShangPin);
  910. break;
  911. case IDM_WORKER:
  912. if (IsHasRightsnew(27) == 0)return;
  913. pName = (LPSTR)(LPCSTR)"员工设置";
  914. OPEN_MENU(Worker);
  915. break;
  916. case IDM_TAOXI:
  917. if (IsHasRightsnew(30) == 0)return;
  918. pName = (LPSTR)(LPCSTR)"套系设置";
  919. OPEN_MENU(TXDlg);
  920. break;
  921. case IDM_TAOXISP:
  922. if (IsHasRightsnew(30) == 0)return;
  923. pName = (LPSTR)(LPCSTR)"套系赠送商品设置";
  924. OPEN_MENU(TXSPDlg);
  925. break;
  926. case IDM_Provider:
  927. if (IsHasRightsnew(32) == 0)return;
  928. pName = (LPSTR)(LPCSTR)"供应商设置";
  929. OPEN_MENU(ProviderDlg);
  930. break;
  931. case IDM_BUMEN:
  932. {
  933. if (IsHasRightsnew(49) == 0)return;
  934. BuMenDlg dlg;
  935. dlg.DoModal();
  936. return;
  937. }
  938. case IDM_Account:
  939. if (IsHasRightsnew(49) == 0)return;
  940. pName = (LPSTR)(LPCSTR)"账号管理";
  941. OPEN_MENU(Account);
  942. break;
  943. case IDM_YLCD:
  944. {
  945. //AfxMessageBox("IDM_YLCD");
  946. ::CopyFile(_T(g_path7 + "\\接单系统\\Regsvr32.exe"), _T(g_mainpath + "\\Regsvr32.exe"), 0);
  947. ::CopyFile(_T(g_path7 + "\\接单系统\\Flash9f.ocx"), _T(g_mainpath + "\\Flash9f.ocx"), 0);
  948. CString temp;
  949. temp.Format("%s\\regsvr32.exe /s %s\\Flash9f.OCX", g_mainpath, g_mainpath);
  950. WinExec(temp, SW_HIDE);
  951. ::CopyFile(_T(g_path7 + "\\接单系统\\接单系统.exe"), _T(g_mainpath + "\\接单系统.exe"), 0);
  952. ::CopyFile(_T(g_path7 + "\\接单系统\\my32.dll"), _T(g_mainpath + "\\my32.dll"), 0);
  953. ::CopyFile(_T(g_path7 + "\\接单系统\\server.dat"), _T(g_mainpath + "\\server.dat"), 0);
  954. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\接单系统.exe"), g_server, NULL, SW_SHOWNORMAL);
  955. }
  956. break;
  957. case IDM_YLCDMANAGE:
  958. ::CopyFile(_T(g_path7 + "\\接单系统\\资源管理器.exe"), _T(g_mainpath + "\\资源管理器.exe"), 0);
  959. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\资源管理器.exe"), g_server, NULL, SW_SHOWNORMAL);
  960. break;
  961. }
  962. }
  963. //减少代码
  964. ///////////////////////////////////////////////////////////////////////////////
  965. void CMainFrame::OnDisconnect()
  966. {
  967. printf("断开TCP连接\n");
  968. m_tClientTunnel.net_CloseSocket();
  969. SetConnectionID(INVALID_SOCKET);
  970. }
  971. void CMainFrame::ProcessLoginResponse(void *pLoginResult)
  972. {
  973. if (NULL == pLoginResult) return;
  974. LOGIN_RESULT_STRU *ptLoginResult = (LOGIN_RESULT_STRU *)pLoginResult;
  975. DWORD dwConnectionID = ptLoginResult->tCommonMsg.dwConnectionID;
  976. SetConnectionID(dwConnectionID);
  977. BYTE byResult = ptLoginResult->byResult;
  978. if (LOGIN_RESULT_SUC == byResult)
  979. {
  980. //AfxMessageBox("登录成功"); // Jeff test;
  981. }
  982. else
  983. {
  984. OnDisconnect();
  985. }
  986. }
  987. /************************************************************************/
  988. /* 函数:ProcessLoginRequest[3/3/2016 IT];
  989. /* 描述:登陆服务器;
  990. /* 参数:;
  991. /* [IN] :;
  992. /* [OUT] :;
  993. /* [IN/OUT] :;
  994. /* 返回:登陆成功返回TRUE;
  995. /* 注意:;
  996. /* 示例:;
  997. /*
  998. /* 修改:;
  999. /* 日期:;
  1000. /* 内容:;
  1001. /************************************************************************/
  1002. BOOL CMainFrame::ProcessLoginRequest()
  1003. {
  1004. // 1.设置通信类型MSG_LOGIN_REQ,为登陆请求;
  1005. WORD wMessageId = 0;
  1006. if (g_conntype == 0 && !g_bConnLYFZ)
  1007. wMessageId = (MSG_LOGIN_REQ + 0X1FFF);
  1008. else// if (g_bConnLYFZ )
  1009. wMessageId = MSG_LOGIN_REQ;
  1010. // 2.填充发送数据;
  1011. TLOGIN_STRU tLogonInfo = { 0 };
  1012. tLogonInfo.tCommonMsg.dwConnectionID = GetConnectionID();//此时m_dwConnectionID为INVALIDE_SOCKET;
  1013. tLogonInfo.tCommonMsg.wMessageId = wMessageId;
  1014. CString strUserName = newGUID();// 以随机数作为登陆时的用户名称;
  1015. strUserName.TrimLeft();
  1016. strUserName.TrimRight();
  1017. #if defined(VC80) || defined(VC70) || defined(VC60)
  1018. strcpy(tLogonInfo.tUserInfo.szUserName, strUserName);
  1019. #else
  1020. strcpy_s(tLogonInfo.tUserInfo.szUserName, 31, strUserName);
  1021. #endif
  1022. DWORD dwDataLen = sizeof(TLOGIN_STRU);
  1023. // 3.填充数据头;
  1024. TMessageHeader tHeader = { 0 };
  1025. tHeader.wMessageId = wMessageId;
  1026. tHeader.dwDataLen = dwDataLen;
  1027. // 4.发送数据;
  1028. unsigned long ulSendLen = m_tClientTunnel.net_Send(&tHeader, (void *)&tLogonInfo, dwDataLen);
  1029. if (ulSendLen == SOCKET_ERROR)
  1030. {
  1031. return 0;
  1032. }
  1033. return 1;
  1034. }
  1035. DWORD CMainFrame::GetConnectionID()
  1036. {
  1037. return m_dwConnectionID;
  1038. }
  1039. void CMainFrame::SetConnectionID(DWORD dwConnection)
  1040. {
  1041. m_dwConnectionID = dwConnection;
  1042. }
  1043. /************************************************************************/
  1044. /* 函数:ProcessChatMessageRequest2[3/3/2016 IT];
  1045. /* 描述:;
  1046. /* 参数:;
  1047. /* [IN] code:;
  1048. /* 返回:void;
  1049. /* 注意:
  1050. OnConnect() -> ProcessChatMessageRequest()
  1051. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1052. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1053. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1054. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1055. 5.关闭对话框和断开连接;;
  1056. /* 示例:;
  1057. /*
  1058. /* 修改:;
  1059. /* 日期:;
  1060. /* 内容:;
  1061. /************************************************************************/
  1062. void CMainFrame::ProcessChatMessageRequest2(BYTE code)
  1063. {
  1064. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1065. SendDataDlg dlg;
  1066. dlg.m_bycode = code;
  1067. dlg.DoModal();
  1068. }
  1069. //*********************************************//
  1070. /*
  1071. 函数:ProcessChatMessageRequest2
  1072. 参数:CString sql [IN]
  1073. 返回:无
  1074. 过程:OnConnect() -> ProcessChatMessageRequest()
  1075. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1076. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1077. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1078. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1079. 5.关闭对话框和断开连接;
  1080. */
  1081. //*********************************************//
  1082. void CMainFrame::ProcessChatMessageRequest2(CString sql)
  1083. {
  1084. if ((sql.Find("insert") != -1 || sql.Find("update") != -1 || sql.Find("delete") != -1) && g_branchname != "" && g_bBranchModify == 0)
  1085. {
  1086. AfxMessageBox("当前为分店数据查看状态,不能更改分店数据!", MB_ICONSTOP);
  1087. g_bSendOK = 0;
  1088. return;
  1089. }
  1090. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1091. SendDataDlg dlg;
  1092. dlg.m_strSQL = sql;
  1093. dlg.DoModal();
  1094. }
  1095. //*********************************************//
  1096. /*
  1097. 函数:ProcessChatMessageRequest2
  1098. 参数:BYTE *pData [IN], int length [IN]
  1099. 返回:无
  1100. 过程:OnConnect() -> ProcessChatMessageRequest()
  1101. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1102. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1103. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1104. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1105. 5.关闭对话框和断开连接;
  1106. */
  1107. //*********************************************//
  1108. void CMainFrame::ProcessChatMessageRequest2(BYTE *pData, int length)
  1109. {
  1110. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1111. SendDataDlg dlg;
  1112. dlg.m_pData = pData;
  1113. dlg.m_nlength = length;
  1114. dlg.DoModal(); // DoModal未执行完时,就被其他函数销毁,导致局部函数dlg无效;
  1115. }
  1116. /************************************************************************/
  1117. /*
  1118. 函数:ProcessChatMessageRequest
  1119. 描述:对服务发送数据;
  1120. 参数:void *szDataBuf[IN], int nDataLen[IN]
  1121. 返回:发送成功与否;
  1122. */
  1123. /************************************************************************/
  1124. BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)
  1125. {
  1126. // 1.获取当前与服务器连接的id;
  1127. DWORD dwFromUserID = GetConnectionID();
  1128. // 2.设置通信类型为MSG_CHATMESSAGE_REQ;
  1129. WORD wMessageId = 0;
  1130. if (g_conntype == 0 && !g_bConnLYFZ)
  1131. wMessageId = (MSG_CHATMESSAGE_REQ + 0X3FFF);
  1132. else
  1133. wMessageId = MSG_CHATMESSAGE_REQ;
  1134. // 3.计算出欲发送的数据的长度 dwDataLen;
  1135. DWORD dwDataLen = sizeof(TCHAT_MESSAGE_STRU) + nDataLen;
  1136. BYTE *pSendData = new BYTE[dwDataLen];
  1137. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU*)pSendData;
  1138. memset(pChatMessage, 0x00, dwDataLen);
  1139. // 3.1.g_nYearpos==-1,表示连接是当前主数据库,其他值表示历史数据库;
  1140. if (g_nYearpos == -1)
  1141. g_sendhead.length[99] = g_nYearpos;
  1142. else
  1143. g_sendhead.length[99] = g_nYearpos * 32142953 + 10966236;
  1144. g_sendhead.length[98] = 987123768;
  1145. memcpy(pSendData, &g_sendhead, sizeof(g_sendhead));
  1146. #ifdef ENTERPRISE_VERSION
  1147. if (g_bBranchModify == 0)
  1148. #if defined(VC60) || defined(VC70)
  1149. strcpy(pChatMessage->szFromUserName, g_branchname);
  1150. #else
  1151. strcpy_s(pChatMessage->szFromUserName, 30, g_branchname);
  1152. #endif
  1153. #endif
  1154. // 4.填充发送的数据结构;
  1155. pChatMessage->tCommonMsg.dwConnectionID = GetConnectionID();
  1156. pChatMessage->tCommonMsg.wMessageId = wMessageId;
  1157. pChatMessage->dwFromUserID = dwFromUserID;
  1158. pChatMessage->dwToUserID = g_nSendCode;//▲▲g_nSendCode在服务端同为dwToUserID;
  1159. pChatMessage->wMessageLen = nDataLen;
  1160. memcpy(pChatMessage->byFileContent, szDataBuf, nDataLen);
  1161. // 5.填充数据头;
  1162. TMessageHeader tHeader = { 0 };
  1163. tHeader.wMessageId = wMessageId;
  1164. tHeader.dwDataLen = dwDataLen;
  1165. // 6.发送数据;
  1166. BOOL bRet = 0;
  1167. unsigned long ulSendLen = m_tClientTunnel.net_Send(&tHeader, (void *)pChatMessage, dwDataLen);
  1168. if (ulSendLen != SOCKET_ERROR)
  1169. {
  1170. bRet = 1;
  1171. }
  1172. // 7.发送完毕,释放内存;
  1173. delete[] pSendData;
  1174. return bRet;
  1175. }
  1176. /************************************************************************/
  1177. /*
  1178. 函数:ProcessChatMessageResponse
  1179. 描述:接收服务返回的数据;
  1180. 参数:void *pResponse[IN]
  1181. 返回:无;
  1182. 调用关系:
  1183. 1.由 void CMainFrame::ProcessNetEvent(...)调用
  1184. */
  1185. /************************************************************************/
  1186. void CMainFrame::ProcessChatMessageResponse(void *pResponse)
  1187. {
  1188. // 1.数据空,直接返回;
  1189. if (NULL == pResponse)
  1190. return;
  1191. // 2.数据解析过程;
  1192. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pResponse;
  1193. int nMessageLen = pChatMessage->wMessageLen;
  1194. int nMessageLen2 = pChatMessage->dwToUserID; // 在服务器中被处理了,一般使dwToUserID=wMessageLen;
  1195. // Jeff.dwFromUserID==8888表示的内容是更新客户端skin界面数据,只有两处dwToUserID==211和dwToUserID==21;
  1196. // Jeff.其余的大多数都是 dwFromUserID = wMessageLen = dwToUserID 三者相等;
  1197. if (nMessageLen == nMessageLen2 && pChatMessage->dwFromUserID != 8888)
  1198. {
  1199. // 2.1.清除全局变量g_pData数据,用于保存接收的实际数据;
  1200. if (g_pData)
  1201. delete[]g_pData;
  1202. g_pData = NULL;
  1203. g_pData = new BYTE[nMessageLen];
  1204. memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
  1205. memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
  1206. g_nLeng = nMessageLen;
  1207. if (nMessageLen <= sizeof(DWORD))
  1208. {
  1209. memcpy(&g_ncount, pChatMessage->byFileContent, sizeof(DWORD));
  1210. }
  1211. KillTimer(2);
  1212. if (g_hSendWnd)
  1213. {
  1214. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);//关闭发送对话框;
  1215. }
  1216. }
  1217. else if (nMessageLen == nMessageLen2 && pChatMessage->dwFromUserID == 8888)
  1218. {
  1219. if (g_pData2)
  1220. delete[]g_pData2;
  1221. g_pData2 = NULL;
  1222. g_pData2 = new BYTE[nMessageLen2];
  1223. memcpy(g_pData2, pChatMessage->byFileContent, nMessageLen2);
  1224. g_nLeng2 = nMessageLen2;
  1225. KillTimer(2);
  1226. if (g_hSendWnd)
  1227. {
  1228. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1229. }
  1230. }
  1231. else // 登陆返回;
  1232. {
  1233. if (g_bConnLYFZ)
  1234. {
  1235. if (g_pData)
  1236. delete[]g_pData;
  1237. g_pData = NULL;
  1238. g_pData = new BYTE[nMessageLen];
  1239. memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
  1240. memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
  1241. g_nLeng = nMessageLen;
  1242. if (nMessageLen <= sizeof(DWORD))
  1243. {
  1244. memcpy(&g_ncount, pChatMessage->byFileContent, sizeof(DWORD));
  1245. }
  1246. KillTimer(2);
  1247. if (g_hSendWnd)
  1248. {
  1249. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1250. }
  1251. return;
  1252. }
  1253. if (g_conntype) // Jeff.g_conntype == 1,表示连接公司服务器的返回,用于集团版解析*.ly.com的IP地址;
  1254. {
  1255. // KillTimer(2);
  1256. char *szChatMessage = new char[nMessageLen + 1];
  1257. memset(szChatMessage, 0x00, nMessageLen + 1);
  1258. memcpy(szChatMessage, pChatMessage->byFileContent, nMessageLen);
  1259. g_server = szChatMessage;
  1260. delete[]szChatMessage;
  1261. CStdioFile fp;
  1262. CString path = g_mainpath + "\\ip.txt";
  1263. ::DeleteFile(path); // 删除ip.txt;
  1264. fp.Open(path, CFile::modeCreate | CFile::modeWrite);
  1265. fp.WriteString(g_server);
  1266. fp.Close();
  1267. g_conntype = 0;
  1268. // g_serverip=g_server;
  1269. return;
  1270. }
  1271. if (g_pData2 == NULL)
  1272. {
  1273. g_pData2 = new BYTE[nMessageLen2];
  1274. g_nLeng2 = 0;
  1275. }
  1276. memcpy(g_pData2 + g_nLeng2, pChatMessage->byFileContent, nMessageLen);
  1277. g_nLeng2 += nMessageLen;
  1278. if (g_nLeng2 == nMessageLen2)//已收完
  1279. {
  1280. KillTimer(2);
  1281. if (g_hSendWnd)
  1282. {
  1283. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1284. }
  1285. }
  1286. else
  1287. {
  1288. KillTimer(2);
  1289. SetTimer(2, g_ntimeout, NULL);
  1290. }
  1291. }
  1292. }
  1293. #if USE_SHARE_FLORD
  1294. /************************************************************************/
  1295. /*
  1296. Date: 2015-04-11
  1297. Author: Jeff
  1298. 函数:GetSharePathInfo
  1299. 描述:获取共享目录表的所有信息;
  1300. 参数:
  1301. 返回:成功返回TRUE;
  1302. 注意:获取的表记录存储在全局变量g_aryOfSharePathInfo中;
  1303. 调用约定:在登陆软件时调用,且必须连接的服务器是本店的;
  1304. */
  1305. /************************************************************************/
  1306. BOOL CMainFrame::GetSharePathInfo()
  1307. {
  1308. // 1.连接的数据库必须是本局域网的服务器;
  1309. if ( g_bAllBranch || !g_branchname.IsEmpty() || !g_branchip.IsEmpty() )
  1310. {
  1311. // 非当前局域网服务器;
  1312. return FALSE;
  1313. }
  1314. // 2.获取当前连接的分店域名是否与g_domain一致;
  1315. g_sendhead.bsql = 0;
  1316. g_sendhead.code[0] = 29;
  1317. g_sendhead.tabcount = 1;
  1318. g_pMainWnd->ProcessChatMessageRequest2(23);
  1319. if ( !g_bSendOK )
  1320. {
  1321. // 连接服务器失败;
  1322. return FALSE;
  1323. }
  1324. CArray<CStringArray,CStringArray> strArray;
  1325. DataToArray(&strArray);
  1326. CString strCurBranchDomain = _T("");
  1327. if ( strArray.GetSize() )
  1328. {
  1329. strCurBranchDomain = strArray.ElementAt(0).ElementAt(0);
  1330. if ( strCurBranchDomain.Find(_T(".ly.com")) == -1)
  1331. {
  1332. // 当前获取的域名有错;
  1333. return FALSE;
  1334. }
  1335. }
  1336. if ( g_domain.CompareNoCase(strCurBranchDomain) != 0)
  1337. {
  1338. // 当前连接的分店域名与局域网服务器域名不一致;
  1339. return FALSE;
  1340. }
  1341. // 3.获取可用的共享信息;//select * from NetShareInfo where enable = 1;
  1342. CString strFilter = _T("");
  1343. strFilter.Format(_T("enable = 1"));
  1344. int g_nYearposTemp=g_nYearpos;
  1345. g_nYearpos=-1;
  1346. g_bSendOK = 0;
  1347. g_sendhead.bsql = 0;
  1348. g_sendhead.code[0] = 236;
  1349. g_sendhead.tabcount = 1;
  1350. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  1351. g_nYearpos = g_nYearposTemp;
  1352. if ( !g_bSendOK )
  1353. {
  1354. // 获取共享信息失败;
  1355. return FALSE;
  1356. }
  1357. g_aryOfSharePathInfo.RemoveAll();
  1358. DataToArray(&g_aryOfSharePathInfo);
  1359. return g_aryOfSharePathInfo.GetSize() ? TRUE : FALSE;
  1360. }
  1361. #endif
  1362. BOOL CMainFrame::OnConnectBranch()
  1363. {
  1364. if (g_branchip == "")
  1365. {
  1366. return 0;
  1367. }
  1368. g_conntype = 0;
  1369. CString strServerAddress = g_branchip;
  1370. char *szServerAddress = strServerAddress.GetBuffer(0);
  1371. strServerAddress.ReleaseBuffer();
  1372. /*for Client, IP and Port can be 0,
  1373. and for Server, IP is LocalIP, and Port is Listening Port*/
  1374. int nResult = m_tClientTunnel.net_OpenSocket(
  1375. Transport_Client,
  1376. 0,
  1377. HandleClientNetEvent,
  1378. this);
  1379. if (TRANSPORT_OK != nResult)
  1380. {
  1381. // AfxMessageBox("网络初始化失败!");
  1382. return 0;
  1383. }
  1384. GetSysIniInfo(g_szModulePath, g_branchname + _T(".ini"));
  1385. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1386. DWORD wPort = g_dwCSPort;
  1387. #if defined(VC80) || defined(VC70) || defined(VC60)
  1388. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1389. if (TRANSPORT_OK != nResult)
  1390. #else
  1391. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1392. if (!nResult)
  1393. #endif
  1394. {
  1395. m_tClientTunnel.net_CloseSocket();
  1396. return OnConnectBranch2();
  1397. }
  1398. return ProcessLoginRequest();
  1399. }
  1400. BOOL CMainFrame::OnConnectBranch2()
  1401. {
  1402. if (g_branchip2 == "")
  1403. {
  1404. return 0;
  1405. }
  1406. g_conntype = 0;
  1407. CString strServerAddress = g_branchip2;
  1408. char *szServerAddress = strServerAddress.GetBuffer(0);
  1409. strServerAddress.ReleaseBuffer();
  1410. /*for Client, IP and Port can be 0,
  1411. and for Server, IP is LocalIP, and Port is Listening Port*/
  1412. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1413. 0,
  1414. HandleClientNetEvent,
  1415. this);
  1416. if (TRANSPORT_OK != nResult)
  1417. {
  1418. // AfxMessageBox("网络初始化失败!");
  1419. return 0;
  1420. }
  1421. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1422. DWORD wPort = SERVER_PORT; // 5678
  1423. #if defined(VC80) || defined(VC70) || defined(VC60)
  1424. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1425. if (TRANSPORT_OK != nResult)
  1426. #else
  1427. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1428. if (!nResult)
  1429. #endif
  1430. {
  1431. m_tClientTunnel.net_CloseSocket();
  1432. return 0;
  1433. }
  1434. return ProcessLoginRequest();
  1435. }
  1436. BOOL CMainFrame::OnConnectIP()
  1437. {
  1438. CString strServerAddress = g_server;
  1439. char *szServerAddress = strServerAddress.GetBuffer(0);
  1440. strServerAddress.ReleaseBuffer();
  1441. /*for Client, IP and Port can be 0,
  1442. and for Server, IP is LocalIP, and Port is Listening Port*/
  1443. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1444. 0,
  1445. HandleClientNetEvent,
  1446. this);
  1447. if (TRANSPORT_OK != nResult)
  1448. {
  1449. // AfxMessageBox("网络初始化失败!");
  1450. return 0;
  1451. }
  1452. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1453. DWORD wPort = SERVER_PORT; // 5678
  1454. #if defined(VC80) || defined(VC70) || defined(VC60)
  1455. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1456. if (TRANSPORT_OK != nResult)
  1457. #else
  1458. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1459. if (!nResult)
  1460. #endif
  1461. {
  1462. m_tClientTunnel.net_CloseSocket();
  1463. return 0;
  1464. }
  1465. return ProcessLoginRequest();
  1466. }
  1467. //ip.txt
  1468. BOOL CMainFrame::OnConnectLYFZ()
  1469. {
  1470. CString strBranchIP = "lijiafz.vicp.net";
  1471. MyGetIPByName2(strBranchIP);
  1472. if (strBranchIP == "")
  1473. {
  1474. return 0;
  1475. }
  1476. g_conntype = 0; // Jeff.Delete at 2014.10.18
  1477. //g_conntype = 1;
  1478. CString strServerAddress = strBranchIP;
  1479. char *szServerAddress = strServerAddress.GetBuffer(0);
  1480. strServerAddress.ReleaseBuffer();
  1481. /*for Client, IP and Port can be 0,
  1482. and for Server, IP is LocalIP, and Port is Listening Port*/
  1483. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1484. 0,
  1485. HandleClientNetEvent,
  1486. this);
  1487. if (TRANSPORT_OK != nResult)
  1488. {
  1489. return 0;
  1490. }
  1491. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1492. DWORD wPort = GetPort();
  1493. #if defined(VC80) || defined(VC70) || defined(VC60)
  1494. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1495. if (TRANSPORT_OK != nResult)
  1496. #else
  1497. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1498. if (!nResult)
  1499. #endif
  1500. {
  1501. m_tClientTunnel.net_CloseSocket();
  1502. return 0;
  1503. }
  1504. return ProcessLoginRequest();
  1505. }
  1506. BOOL CMainFrame::OnConnect()
  1507. {
  1508. // 1.Jeff 断开(如果有在在未关的连接)之前的连接;
  1509. OnDisconnect();
  1510. // 2.根据需要连接指定的服务器;
  1511. if (g_bBranchModify)
  1512. {
  1513. // Jeff.g_bBranchModify在g_bGenBranchData=1时,在welcome::OnTimer里被设置为1;
  1514. return OnConnectBranch();// 连接集团版分店;
  1515. }
  1516. if (g_bConnLYFZ)
  1517. {
  1518. return OnConnectLYFZ();// 连接公司服务端程序;
  1519. }
  1520. g_conntype = 0;
  1521. CString strServerAddress = g_server;
  1522. // 3.如果dbconfig.dat里保存的是*.ly.com的信息,就要读取ip.txt里的IP地址;
  1523. if (g_serverbak.Find(".ly.com") != -1)
  1524. {
  1525. strServerAddress = g_serverbak;
  1526. CStdioFile fp;
  1527. CString path = g_mainpath + "\\ip.txt";
  1528. if (::PathFileExists(path))
  1529. {
  1530. fp.Open(path, CFile::modeRead);
  1531. fp.ReadString(g_server);
  1532. fp.Close();
  1533. if (OnConnectIP())
  1534. {
  1535. // g_serverip=g_server;
  1536. return 1;
  1537. }
  1538. g_server = strServerAddress;
  1539. OnDisconnect();//MessageBox("ip失败");
  1540. }
  1541. g_conntype = 1; // Jeff.连接公司服务器,用于获取集团版*.ly.com的解析IP结果;
  1542. strServerAddress = "lijiafz.vicp.net";
  1543. MyGetIPByName2(strServerAddress);
  1544. if (strServerAddress.IsEmpty())
  1545. {
  1546. return 0;//OnConnect2();
  1547. }
  1548. }
  1549. else if (g_ntimeout == 29000)//非远程 30000
  1550. {
  1551. strServerAddress = g_serverarray.ElementAt(g_conpos);
  1552. }
  1553. // 4.如果没有IP.txt或dbconfig.dat里的不是ly.com信息,而是一般的计算机名称;
  1554. char *szServerAddress = strServerAddress.GetBuffer(0);
  1555. strServerAddress.ReleaseBuffer();
  1556. // AfxMessageBox("连接:"+strServerAddress);
  1557. /*for Client, IP and Port can be 0,
  1558. and for Server, IP is LocalIP, and Port is Listening Port*/
  1559. // 5.创建通信对象连接;
  1560. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1561. 0,
  1562. HandleClientNetEvent,
  1563. this);
  1564. if (TRANSPORT_OK != nResult)
  1565. {
  1566. return 0;
  1567. }
  1568. GetSysIniInfo();
  1569. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1570. DWORD wPort = g_dwCSPort;
  1571. if (g_conntype) wPort = GetPort();
  1572. // 6.连接公司服务器或影楼服务器;
  1573. #if defined(VC80) || defined(VC70) || defined(VC60)
  1574. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1575. if (TRANSPORT_OK != nResult)
  1576. #else
  1577. nResult = m_tClientTunnel.net_Connect(szServerAddress,wPort);
  1578. if (!nResult)
  1579. #endif
  1580. {
  1581. m_tClientTunnel.net_CloseSocket();
  1582. if (g_conntype)// Jeff.连接公司服务器,用于获取集团版*.ly.com的解析IP结果;
  1583. {
  1584. return 0;//OnConnect2();
  1585. }
  1586. if (g_serverarray.GetSize() > 1)
  1587. {
  1588. if (g_conpos < (g_serverarray.GetSize() - 1))
  1589. {
  1590. g_conpos++;
  1591. return OnConnect();
  1592. }
  1593. else
  1594. {
  1595. g_conpos = 0;
  1596. return 0;
  1597. }
  1598. }
  1599. return 0;
  1600. }
  1601. return ProcessLoginRequest();
  1602. }
  1603. BOOL CMainFrame::OnConnect2()
  1604. {
  1605. g_conntype = 2;
  1606. CString server = "http://www.lyfz.net/download/ip.txt";
  1607. char buf[MAX_PATH];
  1608. ::GetTempPath(sizeof(buf), buf);
  1609. CString m_strTempDir = buf;
  1610. DWORD m_dwHttpRequestFlags = HSR_DOWNLOAD | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
  1611. INTERNET_PORT m_dwPort;
  1612. DWORD dwType;
  1613. CInternetSession m_cis;
  1614. CHttpConnection *m_pHttp;
  1615. CString m_strServer;
  1616. CString m_strIniPath;
  1617. AfxParseURL(server, dwType, m_strServer, m_strIniPath, m_dwPort);
  1618. if (dwType != AFX_INET_SERVICE_HTTP)
  1619. {
  1620. return 0;//OnConnect3();
  1621. }
  1622. m_cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5);
  1623. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1624. try
  1625. {
  1626. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1627. }
  1628. catch (CInternetException* pEx)
  1629. {
  1630. return 0;//OnConnect3();
  1631. }
  1632. CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_GET,
  1633. m_strIniPath, NULL, 1, NULL, NULL, m_dwHttpRequestFlags);
  1634. try
  1635. {
  1636. pFile->SendRequest();
  1637. }
  1638. catch (CInternetException* pEx)
  1639. {
  1640. pFile->Close();
  1641. return 0;//OnConnect3();
  1642. }
  1643. if (pFile)
  1644. {
  1645. CStdioFile csf;
  1646. csf.Open(m_strTempDir + "\\ip.txt", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
  1647. char buf[2048];
  1648. int n;
  1649. while ((n = pFile->Read(buf, 2048)) > 0)
  1650. csf.Write(buf, n);
  1651. csf.Close();
  1652. pFile->Close();
  1653. }
  1654. CString strServerAddress;
  1655. CStdioFile fp;
  1656. fp.Open(m_strTempDir + "\\ip.txt", CFile::modeRead);
  1657. fp.ReadString(strServerAddress);
  1658. fp.Close();
  1659. char *szServerAddress = strServerAddress.GetBuffer(0);
  1660. strServerAddress.ReleaseBuffer();
  1661. /*for Client, IP and Port can be 0,
  1662. and for Server, IP is LocalIP, and Port is Listening Port*/
  1663. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1664. 0,
  1665. HandleClientNetEvent,
  1666. this);
  1667. if (TRANSPORT_OK != nResult)
  1668. {
  1669. return 0;
  1670. }
  1671. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1672. DWORD wPort = SERVER_PORT; // 5678
  1673. if (g_conntype)wPort = GetPort();
  1674. #if defined(VC80) || defined(VC70) || defined(VC60)
  1675. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1676. if (TRANSPORT_OK != nResult)
  1677. #else
  1678. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1679. if (!nResult)
  1680. #endif
  1681. {
  1682. m_tClientTunnel.net_CloseSocket();
  1683. return 0;//OnConnect3();
  1684. }
  1685. return ProcessLoginRequest();
  1686. }
  1687. BOOL CMainFrame::OnConnect3()
  1688. {
  1689. g_conntype = 3;
  1690. CString server = "http://photo.bjlyfz.com/download/ip.txt";
  1691. char buf[MAX_PATH];
  1692. ::GetTempPath(sizeof(buf), buf);
  1693. CString m_strTempDir = buf;
  1694. DWORD m_dwHttpRequestFlags = HSR_DOWNLOAD | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
  1695. INTERNET_PORT m_dwPort;
  1696. DWORD dwType;
  1697. CInternetSession m_cis;
  1698. CHttpConnection *m_pHttp;
  1699. CString m_strServer;
  1700. CString m_strIniPath;
  1701. AfxParseURL(server, dwType, m_strServer, m_strIniPath, m_dwPort);
  1702. if (dwType != AFX_INET_SERVICE_HTTP)
  1703. {
  1704. return FALSE;
  1705. }
  1706. m_cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5);
  1707. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1708. try
  1709. {
  1710. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1711. }
  1712. catch (CInternetException* pEx)
  1713. {
  1714. return false;
  1715. }
  1716. CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_GET,
  1717. m_strIniPath, NULL, 1, NULL, NULL, m_dwHttpRequestFlags);
  1718. try
  1719. {
  1720. pFile->SendRequest();
  1721. }
  1722. catch (CInternetException* pEx)
  1723. {
  1724. pFile->Close();
  1725. return false;
  1726. }
  1727. if (pFile)
  1728. {
  1729. CStdioFile csf;
  1730. csf.Open(m_strTempDir + "\\ip.txt", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
  1731. char buf[2048];
  1732. int n;
  1733. while ((n = pFile->Read(buf, 2048)) > 0)
  1734. csf.Write(buf, n);
  1735. csf.Close();
  1736. pFile->Close();
  1737. }
  1738. CString strServerAddress;
  1739. CStdioFile fp;
  1740. fp.Open(m_strTempDir + "\\ip.txt", CFile::modeRead);
  1741. fp.ReadString(strServerAddress);
  1742. fp.Close();
  1743. char *szServerAddress = strServerAddress.GetBuffer(0);
  1744. strServerAddress.ReleaseBuffer();
  1745. /*for Client, IP and Port can be 0,
  1746. and for Server, IP is LocalIP, and Port is Listening Port*/
  1747. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1748. 0,
  1749. HandleClientNetEvent,
  1750. this);
  1751. if (TRANSPORT_OK != nResult)
  1752. {
  1753. return 0;
  1754. }
  1755. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1756. DWORD wPort = SERVER_PORT; // 5678
  1757. if (g_conntype)wPort = GetPort();
  1758. #if defined(VC80) || defined(VC70) || defined(VC60)
  1759. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1760. if (TRANSPORT_OK != nResult)
  1761. #else
  1762. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1763. if (!nResult)
  1764. #endif
  1765. {
  1766. m_tClientTunnel.net_CloseSocket();
  1767. return 0;
  1768. }
  1769. return ProcessLoginRequest();
  1770. }
  1771. void CMainFrame::ProcessNetEvent(int nEventType, void *pRecvMsg, DWORD dwDataLen)
  1772. {
  1773. //printf("Jeff:ProcessNetEvent\n\n");//Jeff Printf;
  1774. if (Transport_ReadEv == nEventType)
  1775. {
  1776. if (NULL == pRecvMsg) return;
  1777. TMessageHeader* pHeader = (TMessageHeader *)pRecvMsg;
  1778. char *pDataBuf = (char *)pRecvMsg + MESSAGE_HEADER_LEN;
  1779. WORD dwMessageID = pHeader->wMessageId;
  1780. switch (dwMessageID)
  1781. {
  1782. case MSG_LOGIN_RESP:
  1783. case (MSG_LOGIN_RESP + 0X2FFF) :
  1784. {
  1785. LOGIN_RESULT_STRU tLoginResult = { 0 };
  1786. memcpy(&tLoginResult, pDataBuf, sizeof(LOGIN_RESULT_STRU));
  1787. ProcessLoginResponse(&tLoginResult);
  1788. break;
  1789. }
  1790. case MSG_USERINFO_RESP:
  1791. {
  1792. break;
  1793. }
  1794. case MSG_LOGOUT_RESP:
  1795. {
  1796. break;
  1797. }
  1798. case MSG_CHATMESSAGE_RESP:
  1799. case (MSG_CHATMESSAGE_RESP + 0X4FFF) :
  1800. {
  1801. static int i = 0;
  1802. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pDataBuf;
  1803. ProcessChatMessageResponse((void *)pChatMessage);
  1804. break;
  1805. }
  1806. default:
  1807. {
  1808. break;
  1809. }
  1810. }
  1811. }
  1812. else if (Transport_CloseEv == nEventType)
  1813. {
  1814. OnDisconnect();
  1815. }
  1816. }
  1817. //extern BOOL g_bNeedCoon;
  1818. extern BOOL EncryptFile2(BYTE *buffer, DWORD leng, PCHAR szPassword);
  1819. void CMainFrame::OnTimer(UINT nIDEvent)
  1820. {
  1821. // TODO: Add your message handler code here and/or call default
  1822. if (1 == nIDEvent)
  1823. {
  1824. KillTimer(nIDEvent);
  1825. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status", 0);//status:此机用选片菜单项
  1826. // checked==1:此机用选片菜单项
  1827. // g_bStaffAchievementShow==1:此机用于员工业绩查看
  1828. if (checked && g_bStaffAchievementShow == 0) // .此机用选片菜单项;
  1829. {
  1830. KillTimer(3);
  1831. #ifdef NEW_SKIN
  1832. Welcome weldlg;
  1833. weldlg.DoModal();
  1834. #endif
  1835. ChoosePhotoSkin dlg;
  1836. dlg.SetLiaPath("1.lia");
  1837. if (dlg.DoModal() != IDOK)
  1838. {
  1839. PostMessage(WM_QUIT);
  1840. return;
  1841. }
  1842. if (dlg.m_exitcode == 3)
  1843. {
  1844. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  1845. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  1846. }
  1847. else
  1848. {
  1849. ShowWindow(SW_SHOW);
  1850. #ifdef NEW_SKIN
  1851. if (m_pMainFrimDlg2 == NULL)
  1852. {
  1853. m_pMainFrimDlg2 = new MainFrimDlg2;
  1854. m_pMainFrimDlg2->SetLiaPath("10.lia");
  1855. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  1856. }
  1857. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1858. #endif
  1859. }
  1860. }
  1861. else if (g_bStaffAchievementShow == 0) // .非选片、非查看员工业绩;
  1862. {
  1863. #ifdef NEW_SKIN
  1864. g_bNoConnDlg = 1;
  1865. Welcome weldlg;
  1866. weldlg.DoModal();
  1867. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1868. ShowWindow(SW_SHOW);
  1869. g_bNoConnDlg = 0;
  1870. if (g_bNoLoginLia) // Jeff.OnCreate里判断skin文件有5.lia, g_bNoLoginLia = 0, 无 g_bNoLoginLia = 1;
  1871. {
  1872. Login dlg;
  1873. dlg.SetLiaPath("5.lia");
  1874. dlg.DoModal();
  1875. }
  1876. else
  1877. {
  1878. Login3 dlg;
  1879. dlg.SetLiaPath("5.lia"); // Login3的父类为MyDlg,在BOOL MyDlg::OnInitDialog()里调用了纯虚函数Init();
  1880. dlg.DoModal();
  1881. // 数据库完整性提醒;
  1882. if ( 1 == atoi(g_cominfoarray.ElementAt(0).ElementAt(159)) )
  1883. {
  1884. MessageBox(_T("贵店数据库可能已损坏,请尽快联系售后人员进行确认或维护,联系电话:0752-2398865 或 4006-067-068!"), _T("重要提示:"), MB_OK | MB_TOPMOST /*| MB_SETFOREGROUND*/ | MB_ICONWARNING);
  1885. if ( !g_bRunOnCorruptdb )
  1886. exit(0);
  1887. }
  1888. }
  1889. if (g_user.bLongin && g_pMainWnd2)
  1890. {
  1891. g_pMainWnd2->ShowBar(TRUE,TRUE);
  1892. InsideMsg();
  1893. }
  1894. #else
  1895. ShowWindow(SW_SHOW);
  1896. if (g_bNoLoginLia)
  1897. {
  1898. Login dlg;
  1899. dlg.SetLiaPath ("5.lia");
  1900. dlg.DoModal();
  1901. }
  1902. else
  1903. {
  1904. Login3 dlg;
  1905. dlg.SetLiaPath ("5.lia");
  1906. dlg.DoModal();
  1907. }
  1908. #endif
  1909. }
  1910. if (g_hmouse == NULL)
  1911. {
  1912. g_hmouse = SetWindowsHookEx(WH_MOUSE, MouseProc, 0, ::GetCurrentThreadId());
  1913. }
  1914. }
  1915. else if (2 == nIDEvent) //29秒后,若连接和发送未完成,将关闭连接和发送框;
  1916. {
  1917. KillTimer(2);
  1918. if (g_hConnectWnd)
  1919. ::PostMessage(g_hConnectWnd, WM_CLOSE, 0, 0);
  1920. if (g_hSendWnd)
  1921. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1922. if (g_bStaffAchievementShow == 0 && g_bConnLYFZ == 0)
  1923. {
  1924. if (g_bGenBranchData == 0)
  1925. {
  1926. if (g_branchip != "")
  1927. AfxMessageBox("连接分店:" + g_branchname + "失败!", MB_ICONINFORMATION);
  1928. else
  1929. AfxMessageBox("连接服务器失败!", MB_ICONINFORMATION);
  1930. }
  1931. OnDisconnect();
  1932. }
  1933. g_bSendOK = 0;
  1934. g_bNeedCoon = 1;
  1935. }
  1936. else if (3 == nIDEvent)
  1937. {
  1938. KillTimer(3);
  1939. #ifdef NEW_SKIN
  1940. Welcome weldlg;
  1941. weldlg.DoModal();
  1942. #endif
  1943. ShowWindow(SW_SHOW);
  1944. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1945. g_sendhead.bsql = 0;
  1946. g_sendhead.code[0] = 24;
  1947. g_sendhead.code[1] = 1;
  1948. g_sendhead.tabcount = 2;
  1949. g_pMainWnd->ProcessChatMessageRequest2(1);
  1950. if (g_bSendOK == 0)
  1951. {
  1952. return;
  1953. }
  1954. CArray<CStringArray, CStringArray>patharray;
  1955. CArray<CStringArray, CStringArray>userarray;
  1956. DataToArray(&g_cominfoarray, &g_hisyeararray);
  1957. g_userarray.SetSize(userarray.GetSize(), 1);
  1958. int count = 0;
  1959. for (int ii = 0; ii < userarray.GetSize(); ii++)
  1960. {
  1961. if (userarray.ElementAt(ii).ElementAt(10) == "在职")
  1962. g_userarray.ElementAt(count++).Copy(userarray.ElementAt(ii));
  1963. }
  1964. g_userarray.SetSize(count, 1);
  1965. StaffAchievementShowAll dlg;
  1966. g_pMainWnd->GetOcx();
  1967. dlg.DoModal();
  1968. }
  1969. else if (5 == nIDEvent)
  1970. {
  1971. if (g_bInSkin)
  1972. {
  1973. OutputDebugString("使用皮肤\n");
  1974. return;
  1975. }
  1976. if (g_nAutoShowStaffAchievement == 1){
  1977. OutputDebugString("用于选片\n");
  1978. return;
  1979. }
  1980. if (g_bAllBranch){
  1981. OutputDebugString("多店汇总当中\n");
  1982. return;
  1983. }
  1984. if (g_user.bLongin)
  1985. {
  1986. // m_Mdi.CloseAll();
  1987. g_pMainWnd->OnCommandMenu(IDM_Logout);
  1988. }
  1989. /* g_nAutoShowStaffAchievement=1;
  1990. KillTimer(5);
  1991. StaffAchievementShowAll dlg;
  1992. g_pMainWnd->GetOcx();
  1993. dlg.DoModal ();*/
  1994. }
  1995. else if (6 == nIDEvent)
  1996. {
  1997. static BOOL bDouble = 0;
  1998. bDouble = !bDouble;
  1999. if (bDouble)
  2000. g_pMainWnd->OnCommandMenu(IDM_TAKEAWAYBOOK);
  2001. else
  2002. g_pMainWnd->OnCommandMenu(IDM_CLIENTMONEY);
  2003. }
  2004. else if (7 == nIDEvent)
  2005. {
  2006. // Jeff,当g_bSendLYFZ==TRUE时;
  2007. // 向lijiafz.vicp.net发送影楼信息,防止有盗版用户;
  2008. KillTimer(7);
  2009. if (g_bInSkin)return;
  2010. if (g_nAutoShowStaffAchievement == 1)return;
  2011. if (g_bAllBranch)return;
  2012. CString str = g_sInfo;
  2013. g_bConnLYFZ = 1; // Jeff指示连接的服务器为lijiafz.vicp.net
  2014. // 断开当前连接;
  2015. OnDisconnect();
  2016. BYTE *pData = new BYTE[str.GetLength()];
  2017. memcpy(pData, str.GetBuffer(0), str.GetLength());
  2018. str.ReleaseBuffer();
  2019. EncryptFile2(pData, str.GetLength(), "888666333");
  2020. g_nSendCode = 16;
  2021. g_pMainWnd->ProcessChatMessageRequest2(pData, str.GetLength());
  2022. g_nSendCode = 0;
  2023. delete[]pData;
  2024. OnDisconnect();
  2025. g_bSendLYFZ = 0;
  2026. g_bConnLYFZ = 0;
  2027. if (g_bSendOK)
  2028. {
  2029. char *pStr = new char[g_nLeng + 1];
  2030. memset(pStr, 0, g_nLeng + 1);
  2031. memcpy(pStr, g_pData, g_nLeng);
  2032. CString str = pStr;
  2033. delete[]pStr;
  2034. if (str == "g_bInSkin")
  2035. {
  2036. g_sendhead.bsql = 1;
  2037. g_pMainWnd->ProcessChatMessageRequest2("update version set [setcheck1]='ok'");
  2038. }
  2039. }
  2040. }
  2041. }
  2042. void CMainFrame::OnOutbarNotify(CString strMsg)
  2043. {
  2044. if (g_user.bLongin == 0)
  2045. {
  2046. if (g_bNoLoginLia)
  2047. {
  2048. Login dlg;
  2049. dlg.SetLiaPath("5.lia");
  2050. dlg.DoModal();
  2051. }
  2052. else
  2053. {
  2054. Login3 dlg;
  2055. dlg.SetLiaPath("5.lia");
  2056. dlg.DoModal();
  2057. }
  2058. return;
  2059. if (g_user.bLongin == 0)return;
  2060. }
  2061. else
  2062. {
  2063. InsideMsg();
  2064. }
  2065. ResetTimer();
  2066. if (strMsg == "开单")
  2067. {
  2068. if (IsHasRights(0) == 0)return;
  2069. Booking2 dlg;
  2070. dlg.DoModal();
  2071. return;
  2072. }
  2073. else if (strMsg == "拍照")
  2074. {
  2075. if (IsHasRights(1) == 0)return;
  2076. UINT nID = 1;
  2077. LPSTR pName;
  2078. pName = (LPSTR)(LPCSTR)"拍照";
  2079. OPEN_MENU(TakeFrom);
  2080. return;
  2081. }
  2082. else if (strMsg == "修片")
  2083. {
  2084. if (IsHasRights(1) == 0)return;
  2085. UINT nID = 1;
  2086. LPSTR pName;
  2087. pName = (LPSTR)(LPCSTR)"修片";
  2088. OPEN_MENU(BeautifySkinFrom);
  2089. return;
  2090. }
  2091. else if (strMsg == "选片")
  2092. {
  2093. if (IsHasRights(2) == 0)return;
  2094. UINT nID = 1;
  2095. LPSTR pName;
  2096. pName = (LPSTR)(LPCSTR)"选片";
  2097. OPEN_MENU(ChoosePhotoForm);
  2098. return;
  2099. }
  2100. else if (strMsg == "精修")
  2101. {
  2102. if (IsHasRights(2) == 0)return;
  2103. UINT nID = 1;
  2104. LPSTR pName;
  2105. pName = (LPSTR)(LPCSTR)"精修";
  2106. OPEN_MENU(BeautifySkinFrom2);
  2107. return;
  2108. }
  2109. else if (strMsg == "设计")
  2110. {
  2111. if (IsHasRights(2) == 0)return;
  2112. UINT nID = 1;
  2113. LPSTR pName;
  2114. pName = (LPSTR)(LPCSTR)"设计";
  2115. OPEN_MENU(DesignFrom);
  2116. return;
  2117. }
  2118. else if (strMsg == "数码安排")
  2119. {
  2120. UINT nID = 1;
  2121. LPSTR pName;
  2122. pName = (LPSTR)(LPCSTR)"数码安排";
  2123. OPEN_MENU(DigitalWork);
  2124. return;
  2125. }
  2126. else if (strMsg == "刻盘")
  2127. {
  2128. UINT nID = 1;
  2129. LPSTR pName;
  2130. pName = (LPSTR)(LPCSTR)"刻盘";
  2131. OPEN_MENU(BurnCD);
  2132. return;
  2133. }
  2134. else if (strMsg == "相片冲印")
  2135. {
  2136. UINT nID = 1;
  2137. LPSTR pName;
  2138. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  2139. OPEN_MENU(PhotoPrintFrom);
  2140. return;
  2141. }
  2142. else if (strMsg == "发片/取件")
  2143. {
  2144. if (IsHasRights(3) == 0)return;
  2145. UINT nID = 1;
  2146. LPSTR pName;
  2147. pName = (LPSTR)(LPCSTR)"发片/取件";
  2148. OPEN_MENU(outsourcing);
  2149. return;
  2150. }
  2151. else if (strMsg == "满意度")
  2152. {
  2153. UINT nID = 1;
  2154. LPSTR pName;
  2155. pName = (LPSTR)(LPCSTR)"满意度";
  2156. OPEN_MENU(Satisfaction);
  2157. return;
  2158. }
  2159. else if (strMsg == "满意度汇总")
  2160. {
  2161. UINT nID = 1;
  2162. LPSTR pName;
  2163. pName = (LPSTR)(LPCSTR)"满意度汇总";
  2164. OPEN_MENU(SatisfactionReportForm);
  2165. return;
  2166. }
  2167. #if JEFF_DELETE_ON // 2014.11.14-PM 16:20
  2168. else if (strMsg == "回复统计")
  2169. {
  2170. UINT nID = 1;
  2171. LPSTR pName;
  2172. pName = (LPSTR)(LPCSTR)"回复统计";
  2173. OPEN_MENU(MsgReg2);
  2174. return;
  2175. }
  2176. #endif
  2177. /* else if(strMsg=="取件")
  2178. {
  2179. if(IsHasRights(3)==0)return;
  2180. UINT nID=1;
  2181. LPSTR pName ;
  2182. pName = (LPSTR)(LPCSTR)"取件";
  2183. OPEN_MENU(TakeAwayFrom);
  2184. return;
  2185. }*/
  2186. else if (strMsg == "其它收入")
  2187. {
  2188. if (IsHasRightsnew(16) == 0)return;
  2189. // if(IsHasRightsnew(48)==0)return;
  2190. UINT nID = 1;
  2191. LPSTR pName;
  2192. pName = (LPSTR)(LPCSTR)"其它收入";
  2193. OPEN_MENU(IncomeInput);
  2194. return;
  2195. }
  2196. else if (strMsg == "散客消费")
  2197. {
  2198. if (IsHasRightsnew(16) == 0)return;
  2199. UINT nID = 1;
  2200. LPSTR pName;
  2201. pName = (LPSTR)(LPCSTR)"散客消费";
  2202. OPEN_MENU(IncomeInput2);
  2203. return;
  2204. }
  2205. else if (strMsg == "员工奖罚")
  2206. {
  2207. if (IsHasRightsnew(16) == 0)return;
  2208. UINT nID = 1;
  2209. LPSTR pName;
  2210. pName = (LPSTR)(LPCSTR)"员工奖罚";
  2211. OPEN_MENU(IncomeInput3);
  2212. return;
  2213. }
  2214. else if (strMsg == "员工奖惩")
  2215. {
  2216. if (IsHasRightsnew(16) == 0)return;
  2217. UINT nID = 1;
  2218. LPSTR pName;
  2219. pName = (LPSTR)(LPCSTR)"员工奖惩";
  2220. OPEN_MENU(IncomeInput4);
  2221. return;
  2222. }
  2223. else if (strMsg == "订单收款")
  2224. {
  2225. if (IsHasRights(17) == 0)return;
  2226. UINT nID = 1;
  2227. LPSTR pName;
  2228. pName = (LPSTR)(LPCSTR)"订单收款";
  2229. OPEN_MENU(FinanceForm);
  2230. return;
  2231. }
  2232. else if (strMsg == "日财务表")
  2233. {
  2234. if (IsHasRightsnew(22) == 0)return;
  2235. UINT nID = 2;
  2236. LPSTR pName;
  2237. pName = (LPSTR)(LPCSTR)"日财务表";
  2238. OPEN_MENU(DailyForm);
  2239. return;
  2240. }
  2241. else if (strMsg == "提成比例")
  2242. {
  2243. #ifndef ENTERPRISE_VERSION
  2244. #ifndef CHILD_VERSION
  2245. #ifdef BASIC_VERSION
  2246. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2247. {
  2248. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2249. exit(0);return;
  2250. }
  2251. #else
  2252. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2253. {
  2254. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2255. exit(0);return;
  2256. }
  2257. #endif
  2258. #else
  2259. #ifdef BASIC_VERSION
  2260. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2261. {
  2262. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2263. exit(0);return;
  2264. }
  2265. #else
  2266. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2267. {
  2268. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2269. exit(0); return;
  2270. }
  2271. #endif
  2272. #endif
  2273. #else
  2274. #ifndef CHILD_VERSION
  2275. #ifdef BASIC_VERSION
  2276. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2277. {
  2278. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2279. exit(0); return;
  2280. }
  2281. #else
  2282. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2283. {
  2284. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2285. exit(0); return;
  2286. }
  2287. #endif
  2288. #else
  2289. #ifdef BASIC_VERSION
  2290. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2291. {
  2292. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2293. exit(0);return;
  2294. }
  2295. #else
  2296. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2297. {
  2298. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2299. exit(0); return;
  2300. }
  2301. #endif
  2302. #endif
  2303. #endif
  2304. UINT nID = 2;
  2305. LPSTR pName;
  2306. pName = (LPSTR)(LPCSTR)"提成比例";
  2307. OPEN_MENU(SalarySet2);
  2308. return;
  2309. }
  2310. //else if(strMsg=="员工工作")
  2311. else if (strMsg == "计件提成")
  2312. {
  2313. UINT nID = 2;
  2314. LPSTR pName;
  2315. //pName = (LPSTR)(LPCSTR)"员工工作";
  2316. pName = (LPSTR)(LPCSTR)"计件提成";
  2317. OPEN_MENU(SalarySet3);
  2318. return;
  2319. }
  2320. else if (strMsg == "工资管理")
  2321. {
  2322. #ifndef ENTERPRISE_VERSION
  2323. #ifndef CHILD_VERSION
  2324. #ifdef BASIC_VERSION
  2325. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2326. {
  2327. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2328. exit(0);return;
  2329. }
  2330. #else
  2331. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2332. {
  2333. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2334. exit(0);return;
  2335. }
  2336. #endif
  2337. #else
  2338. #ifdef BASIC_VERSION
  2339. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2340. {
  2341. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2342. exit(0);return;
  2343. }
  2344. #else
  2345. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2346. {
  2347. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2348. exit(0); return;
  2349. }
  2350. #endif
  2351. #endif
  2352. #else
  2353. #ifndef CHILD_VERSION
  2354. #ifdef BASIC_VERSION
  2355. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2356. {
  2357. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2358. exit(0); return;
  2359. }
  2360. #else
  2361. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2362. {
  2363. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2364. exit(0); return;
  2365. }
  2366. #endif
  2367. #else
  2368. #ifdef BASIC_VERSION
  2369. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2370. {
  2371. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2372. exit(0);return;
  2373. }
  2374. #else
  2375. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2376. {
  2377. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2378. exit(0); return;
  2379. }
  2380. #endif
  2381. #endif
  2382. #endif
  2383. UINT nID = 2;
  2384. LPSTR pName;
  2385. pName = (LPSTR)(LPCSTR)"工资管理";
  2386. OPEN_MENU(MySalary);
  2387. return;
  2388. }
  2389. else if (strMsg == "客人付款")
  2390. {
  2391. UINT nID = 2;
  2392. LPSTR pName;
  2393. pName = (LPSTR)(LPCSTR)"客人付款";
  2394. OPEN_MENU(ClientMoney);
  2395. return;
  2396. }
  2397. else if (strMsg == "工资报表")
  2398. {
  2399. #ifndef ENTERPRISE_VERSION
  2400. #ifndef CHILD_VERSION
  2401. #ifdef BASIC_VERSION
  2402. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2403. {
  2404. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2405. exit(0);return;
  2406. }
  2407. #else
  2408. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2409. {
  2410. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2411. exit(0);return;
  2412. }
  2413. #endif
  2414. #else
  2415. #ifdef BASIC_VERSION
  2416. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2417. {
  2418. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2419. exit(0);return;
  2420. }
  2421. #else
  2422. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2423. {
  2424. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2425. exit(0); return;
  2426. }
  2427. #endif
  2428. #endif
  2429. #else
  2430. #ifndef CHILD_VERSION
  2431. #ifdef BASIC_VERSION
  2432. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2433. {
  2434. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2435. exit(0); return;
  2436. }
  2437. #else
  2438. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2439. {
  2440. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2441. exit(0); return;
  2442. }
  2443. #endif
  2444. #else
  2445. #ifdef BASIC_VERSION
  2446. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2447. {
  2448. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2449. exit(0);return;
  2450. }
  2451. #else
  2452. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2453. {
  2454. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2455. exit(0); return;
  2456. }
  2457. #endif
  2458. #endif
  2459. #endif
  2460. if (IsHasRightsnew(25) == 0)return;
  2461. UINT nID = 2;
  2462. LPSTR pName;
  2463. pName = (LPSTR)(LPCSTR)"工资报表";
  2464. g_ncount = 100;
  2465. OPEN_MENU(MySalary);
  2466. return;
  2467. }
  2468. else if (strMsg == "员工业绩")
  2469. {
  2470. #ifndef ENTERPRISE_VERSION
  2471. #ifndef CHILD_VERSION
  2472. #ifdef BASIC_VERSION
  2473. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2474. {
  2475. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2476. exit(0);return;
  2477. }
  2478. #else
  2479. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2480. {
  2481. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2482. exit(0);return;
  2483. }
  2484. #endif
  2485. #else
  2486. #ifdef BASIC_VERSION
  2487. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2488. {
  2489. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2490. exit(0);return;
  2491. }
  2492. #else
  2493. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2494. {
  2495. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2496. exit(0); return;
  2497. }
  2498. #endif
  2499. #endif
  2500. #else
  2501. #ifndef CHILD_VERSION
  2502. #ifdef BASIC_VERSION
  2503. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2504. {
  2505. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2506. exit(0); return;
  2507. }
  2508. #else
  2509. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2510. {
  2511. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2512. exit(0); return;
  2513. }
  2514. #endif
  2515. #else
  2516. #ifdef BASIC_VERSION
  2517. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2518. {
  2519. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2520. exit(0);return;
  2521. }
  2522. #else
  2523. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2524. {
  2525. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2526. exit(0); return;
  2527. }
  2528. #endif
  2529. #endif
  2530. #endif
  2531. if (IsHasRightsnew(33) == 0)return;
  2532. UINT nID = 2;
  2533. LPSTR pName;
  2534. pName = (LPSTR)(LPCSTR)"员工业绩";
  2535. OPEN_MENU(StaffAchievement);
  2536. return;
  2537. }
  2538. else if (strMsg == "订单客户")
  2539. {
  2540. UINT nID = 2;
  2541. LPSTR pName;
  2542. pName = (LPSTR)(LPCSTR)"订单客户";
  2543. g_dx += 10000;
  2544. OPEN_MENU(CClientForm);
  2545. if (g_dx >= 10000)g_dx -= 10000;
  2546. return;
  2547. }
  2548. else if (strMsg == "意向客户")
  2549. {
  2550. UINT nID = 2;
  2551. LPSTR pName;
  2552. pName = (LPSTR)(LPCSTR)"意向客户";
  2553. OPEN_MENU(Client2Form);
  2554. return;
  2555. }
  2556. else if (strMsg == "老客户")
  2557. {
  2558. UINT nID = 2;
  2559. LPSTR pName;
  2560. pName = (LPSTR)(LPCSTR)"老客户";
  2561. OPEN_MENU(OldClient);
  2562. return;
  2563. }
  2564. else if (strMsg == "客户来电")
  2565. {
  2566. UINT nID = 2;
  2567. LPSTR pName;
  2568. pName = (LPSTR)(LPCSTR)"客户来电";
  2569. OPEN_MENU(PhoneRecord);
  2570. return;
  2571. }
  2572. else if (strMsg == "拨出电话")
  2573. {
  2574. UINT nID = 2;
  2575. LPSTR pName;
  2576. pName = (LPSTR)(LPCSTR)"拨出电话";
  2577. OPEN_MENU(PhoneRecordOut);
  2578. return;
  2579. }
  2580. else if (strMsg == "未接来电")
  2581. {
  2582. UINT nID = 2;
  2583. LPSTR pName;
  2584. pName = (LPSTR)(LPCSTR)"未接来电";
  2585. OPEN_MENU(MissCall);
  2586. return;
  2587. }
  2588. else if (strMsg == "客户流失")
  2589. {
  2590. UINT nID = 2;
  2591. LPSTR pName;
  2592. pName = (LPSTR)(LPCSTR)"客户流失";
  2593. OPEN_MENU(ClientReasonChart);
  2594. return;
  2595. }
  2596. else if (strMsg == "客户来源")
  2597. {
  2598. UINT nID = 2;
  2599. LPSTR pName;
  2600. pName = (LPSTR)(LPCSTR)"客户来源";
  2601. OPEN_MENU(ClientFromChart);
  2602. return;
  2603. }
  2604. else if (strMsg == "月财务表")
  2605. {
  2606. if (IsHasRightsnew(23) == 0)return;
  2607. UINT nID = 2;
  2608. LPSTR pName;
  2609. pName = (LPSTR)(LPCSTR)"月财务表";
  2610. OPEN_MENU(MonthForm);
  2611. return;
  2612. }
  2613. else if (strMsg == "支出报表")
  2614. {
  2615. if (IsHasRightsnew(23) == 0)return;
  2616. UINT nID = 2;
  2617. LPSTR pName;
  2618. pName = (LPSTR)(LPCSTR)"支出报表";
  2619. OPEN_MENU(MonthForm2);
  2620. return;
  2621. }
  2622. else if (strMsg == "年财务表")
  2623. {
  2624. if (IsHasRightsnew(24) == 0)return;
  2625. UINT nID = 2;
  2626. LPSTR pName;
  2627. pName = (LPSTR)(LPCSTR)"年财务表";
  2628. OPEN_MENU(YearForm);
  2629. return;
  2630. }
  2631. else if (strMsg == "年财务图表")
  2632. {
  2633. if (IsHasRightsnew(24) == 0)return;
  2634. GetOcx();
  2635. UINT nID = 2;
  2636. LPSTR pName;
  2637. pName = (LPSTR)(LPCSTR)"年财务图表";
  2638. OPEN_MENU(YearForm2);
  2639. return;
  2640. }
  2641. else if (strMsg == "订单图表")
  2642. {
  2643. GetOcx();
  2644. UINT nID = 2;
  2645. LPSTR pName;
  2646. pName = (LPSTR)(LPCSTR)"订单图表";
  2647. OPEN_MENU(DinDanForm);
  2648. return;
  2649. }
  2650. #ifdef ENTERPRISE_VERSION
  2651. else if (strMsg == "订单报表")
  2652. {
  2653. GetOcx();
  2654. UINT nID = 2;
  2655. LPSTR pName;
  2656. pName = (LPSTR)(LPCSTR)"订单报表2";
  2657. OPEN_MENU(DinDanFromBranch);
  2658. return;
  2659. }
  2660. else if (strMsg == "财务图表")
  2661. {
  2662. GetOcx();
  2663. UINT nID = 2;
  2664. LPSTR pName;
  2665. pName = (LPSTR)(LPCSTR)"财务图表";
  2666. OPEN_MENU(YearFormBranch);
  2667. return;
  2668. }
  2669. else if (strMsg == "订单图表")
  2670. {
  2671. GetOcx();
  2672. UINT nID = 2;
  2673. LPSTR pName;
  2674. pName = (LPSTR)(LPCSTR)"订单图表";
  2675. OPEN_MENU(YearFormBranch2);
  2676. return;
  2677. }
  2678. else if (strMsg == "摄控安排")
  2679. {
  2680. UINT nID = 2;
  2681. LPSTR pName;
  2682. pName = (LPSTR)(LPCSTR)"摄控安排";
  2683. g_bookingtype = 0;
  2684. OPEN_MENU(TodayForm);
  2685. return;
  2686. }
  2687. else if (strMsg == "选片预约")
  2688. {
  2689. UINT nID = 2;
  2690. LPSTR pName;
  2691. pName = (LPSTR)(LPCSTR)"选片预约";
  2692. g_bookingtype = 1;
  2693. OPEN_MENU(TodayForm);
  2694. return;
  2695. }
  2696. else if (strMsg == "看样预约")
  2697. {
  2698. UINT nID = 2;
  2699. LPSTR pName;
  2700. pName = (LPSTR)(LPCSTR)"看样预约";
  2701. g_bookingtype = 2;
  2702. OPEN_MENU(TodayForm);
  2703. return;
  2704. }
  2705. else if (strMsg == "取件预约")
  2706. {
  2707. UINT nID = 2;
  2708. LPSTR pName;
  2709. pName = (LPSTR)(LPCSTR)"取件预约";
  2710. g_bookingtype = 3;
  2711. OPEN_MENU(TodayForm);
  2712. return;
  2713. }
  2714. else if (strMsg == "婚庆安排")
  2715. {
  2716. UINT nID = 2;
  2717. LPSTR pName;
  2718. pName = (LPSTR)(LPCSTR)"婚庆安排";
  2719. g_bookingtype = 4;
  2720. OPEN_MENU(TodayForm);
  2721. return;
  2722. }
  2723. #endif
  2724. else if (strMsg == "员工资料")
  2725. {
  2726. UINT nID = 2;
  2727. LPSTR pName;
  2728. pName = (LPSTR)(LPCSTR)"员工资料";
  2729. if (g_bAllBranch)
  2730. OPEN_MENU(EmployeeForm2);
  2731. else
  2732. OPEN_MENU(EmployeeForm);
  2733. return;
  2734. }
  2735. else if (strMsg == "客户区域")
  2736. {
  2737. // if(IsHasRightsnew(48)==0)return;
  2738. GetOcx();
  2739. UINT nID = 2;
  2740. LPSTR pName;
  2741. pName = (LPSTR)(LPCSTR)"客户区域";
  2742. OPEN_MENU(AreaClient);
  2743. return;
  2744. }
  2745. else if (strMsg == "客户报表")
  2746. {
  2747. UINT nID = 3;
  2748. LPSTR pName;
  2749. pName = (LPSTR)(LPCSTR)"客户报表";
  2750. OPEN_MENU(CClientForm);
  2751. return;
  2752. }
  2753. else if (strMsg == "现金支出")
  2754. {
  2755. if (IsHasRightsnew(16) == 0)return;
  2756. UINT nID = 3;
  2757. LPSTR pName;
  2758. pName = (LPSTR)(LPCSTR)"现金支出";
  2759. OPEN_MENU(PayOutInput);
  2760. return;
  2761. }
  2762. else if (strMsg == "短信群发")
  2763. {
  2764. UINT nID = 3;
  2765. LPSTR pName;
  2766. pName = (LPSTR)(LPCSTR)"短信群发";
  2767. OPEN_MENU(SendMsg);
  2768. return;
  2769. }
  2770. else if (strMsg == "短信发送")
  2771. {
  2772. UINT nID = 3;
  2773. LPSTR pName;
  2774. pName = (LPSTR)(LPCSTR)"客户报表";
  2775. OPEN_MENU(CClientForm);
  2776. return;
  2777. }
  2778. else if (strMsg == "流程短信")
  2779. {
  2780. UINT nID = 3;
  2781. LPSTR pName;
  2782. pName = (LPSTR)(LPCSTR)"流程短信";
  2783. OPEN_MENU(WorkMsg);
  2784. return;
  2785. }
  2786. else if (strMsg == "员工短信")
  2787. {
  2788. UINT nID = 3;
  2789. LPSTR pName;
  2790. pName = (LPSTR)(LPCSTR)"员工短信";
  2791. OPEN_MENU(EmployeeMsg);
  2792. return;
  2793. }
  2794. else if (strMsg == "发送记录")
  2795. {
  2796. UINT nID = 3;
  2797. LPSTR pName;
  2798. pName = (LPSTR)(LPCSTR)"发送记录";
  2799. OPEN_MENU(MsgReg);
  2800. return;
  2801. }
  2802. else if (strMsg == "短信设置")
  2803. {
  2804. if (IsHasRightsnew(49) == 0)return;
  2805. MsgSet dlg;
  2806. dlg.DoModal();
  2807. return;
  2808. }
  2809. else if (strMsg == "金卡会员")
  2810. {
  2811. #ifndef ENTERPRISE_VERSION
  2812. #ifndef CHILD_VERSION
  2813. #ifdef BASIC_VERSION
  2814. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2815. {
  2816. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2817. exit(0);return;
  2818. }
  2819. #else
  2820. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2821. {
  2822. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2823. exit(0);return;
  2824. }
  2825. #endif
  2826. #else
  2827. #ifdef BASIC_VERSION
  2828. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2829. {
  2830. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2831. exit(0);return;
  2832. }
  2833. #else
  2834. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2835. {
  2836. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2837. exit(0); return;
  2838. }
  2839. #endif
  2840. #endif
  2841. #else
  2842. #ifndef CHILD_VERSION
  2843. #ifdef BASIC_VERSION
  2844. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2845. {
  2846. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2847. exit(0); return;
  2848. }
  2849. #else
  2850. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2851. {
  2852. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2853. exit(0); return;
  2854. }
  2855. #endif
  2856. #else
  2857. #ifdef BASIC_VERSION
  2858. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2859. {
  2860. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2861. exit(0);return;
  2862. }
  2863. #else
  2864. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2865. {
  2866. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2867. exit(0); return;
  2868. }
  2869. #endif
  2870. #endif
  2871. #endif
  2872. UINT nID = 3;
  2873. LPSTR pName;
  2874. pName = (LPSTR)(LPCSTR)"金卡会员";
  2875. OPEN_MENU(ShowMember);
  2876. return;
  2877. }
  2878. else if (strMsg == "现金子卡")
  2879. {
  2880. UINT nID = 3;
  2881. LPSTR pName;
  2882. pName = (LPSTR)(LPCSTR)"现金子卡";
  2883. OPEN_MENU(ShowMember2);
  2884. return;
  2885. }
  2886. else if (strMsg == "蓝钻会员")
  2887. {
  2888. #ifndef ENTERPRISE_VERSION
  2889. #ifndef CHILD_VERSION
  2890. #ifdef BASIC_VERSION
  2891. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2892. {
  2893. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2894. exit(0);return;
  2895. }
  2896. #else
  2897. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2898. {
  2899. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2900. exit(0);return;
  2901. }
  2902. #endif
  2903. #else
  2904. #ifdef BASIC_VERSION
  2905. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2906. {
  2907. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2908. exit(0);return;
  2909. }
  2910. #else
  2911. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2912. {
  2913. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2914. exit(0); return;
  2915. }
  2916. #endif
  2917. #endif
  2918. #else
  2919. #ifndef CHILD_VERSION
  2920. #ifdef BASIC_VERSION
  2921. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2922. {
  2923. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2924. exit(0); return;
  2925. }
  2926. #else
  2927. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2928. {
  2929. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2930. exit(0); return;
  2931. }
  2932. #endif
  2933. #else
  2934. #ifdef BASIC_VERSION
  2935. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2936. {
  2937. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2938. exit(0);return;
  2939. }
  2940. #else
  2941. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2942. {
  2943. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2944. exit(0); return;
  2945. }
  2946. #endif
  2947. #endif
  2948. #endif
  2949. UINT nID = 3;
  2950. LPSTR pName;
  2951. pName = (LPSTR)(LPCSTR)"蓝钻会员";
  2952. OPEN_MENU(ShowMemberBlue);
  2953. return;
  2954. }
  2955. else if (strMsg == "转介绍积分")
  2956. {
  2957. #ifndef ENTERPRISE_VERSION
  2958. #ifndef CHILD_VERSION
  2959. #ifdef BASIC_VERSION
  2960. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2961. {
  2962. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2963. exit(0);return;
  2964. }
  2965. #else
  2966. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2967. {
  2968. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2969. exit(0);return;
  2970. }
  2971. #endif
  2972. #else
  2973. #ifdef BASIC_VERSION
  2974. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2975. {
  2976. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2977. exit(0);return;
  2978. }
  2979. #else
  2980. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2981. {
  2982. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2983. exit(0); return;
  2984. }
  2985. #endif
  2986. #endif
  2987. #else
  2988. #ifndef CHILD_VERSION
  2989. #ifdef BASIC_VERSION
  2990. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2991. {
  2992. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2993. exit(0); return;
  2994. }
  2995. #else
  2996. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2997. {
  2998. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2999. exit(0); return;
  3000. }
  3001. #endif
  3002. #else
  3003. #ifdef BASIC_VERSION
  3004. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3005. {
  3006. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3007. exit(0);return;
  3008. }
  3009. #else
  3010. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3011. {
  3012. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3013. exit(0); return;
  3014. }
  3015. #endif
  3016. #endif
  3017. #endif
  3018. UINT nID = 3;
  3019. LPSTR pName;
  3020. pName = (LPSTR)(LPCSTR)"转介绍积分";
  3021. OPEN_MENU(Card2Reg);
  3022. return;
  3023. }
  3024. /* else if(strMsg=="转介绍图表")
  3025. {
  3026. #ifndef ENTERPRISE_VERSION
  3027. #ifndef CHILD_VERSION
  3028. #ifdef BASIC_VERSION
  3029. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="0")
  3030. {
  3031. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3032. exit(0);return;
  3033. }
  3034. #else
  3035. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3036. {
  3037. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3038. exit(0);return;
  3039. }
  3040. #endif
  3041. #else
  3042. #ifdef BASIC_VERSION
  3043. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3044. {
  3045. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3046. exit(0);return;
  3047. }
  3048. #else
  3049. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  3050. {
  3051. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3052. exit(0);return;
  3053. }
  3054. #endif
  3055. #endif
  3056. #else
  3057. #ifndef CHILD_VERSION
  3058. #ifdef BASIC_VERSION
  3059. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3060. {
  3061. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3062. exit(0);return;
  3063. }
  3064. #else
  3065. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="5")
  3066. {
  3067. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3068. exit(0);return;
  3069. }
  3070. #endif
  3071. #else
  3072. #ifdef BASIC_VERSION
  3073. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="6")
  3074. {
  3075. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3076. exit(0);return;
  3077. }
  3078. #else
  3079. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="7")
  3080. {
  3081. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3082. exit(0);return;
  3083. }
  3084. #endif
  3085. #endif
  3086. #endif
  3087. UINT nID=3;
  3088. LPSTR pName ;
  3089. pName = (LPSTR)(LPCSTR)"转介绍图表";
  3090. OPEN_MENU(Card2RegChart);
  3091. return;
  3092. }*/
  3093. else if (strMsg == "金卡图表")
  3094. {
  3095. UINT nID = 3;
  3096. LPSTR pName;
  3097. pName = (LPSTR)(LPCSTR)"金卡图表";
  3098. OPEN_MENU(MemberChart);
  3099. return;
  3100. }
  3101. else if (strMsg == "积分短信")
  3102. {
  3103. UINT nID = 3;
  3104. LPSTR pName;
  3105. pName = (LPSTR)(LPCSTR)"积分短信";
  3106. OPEN_MENU(ShowMemberMsg);
  3107. return;
  3108. }
  3109. else if (strMsg == "转介绍返现")
  3110. {
  3111. #ifndef ENTERPRISE_VERSION
  3112. #ifndef CHILD_VERSION
  3113. #ifdef BASIC_VERSION
  3114. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3115. {
  3116. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3117. exit(0);return;
  3118. }
  3119. #else
  3120. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3121. {
  3122. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3123. exit(0);return;
  3124. }
  3125. #endif
  3126. #else
  3127. #ifdef BASIC_VERSION
  3128. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3129. {
  3130. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3131. exit(0);return;
  3132. }
  3133. #else
  3134. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3135. {
  3136. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3137. exit(0); return;
  3138. }
  3139. #endif
  3140. #endif
  3141. #else
  3142. #ifndef CHILD_VERSION
  3143. #ifdef BASIC_VERSION
  3144. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3145. {
  3146. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3147. exit(0); return;
  3148. }
  3149. #else
  3150. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3151. {
  3152. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3153. exit(0); return;
  3154. }
  3155. #endif
  3156. #else
  3157. #ifdef BASIC_VERSION
  3158. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3159. {
  3160. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3161. exit(0);return;
  3162. }
  3163. #else
  3164. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3165. {
  3166. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3167. exit(0); return;
  3168. }
  3169. #endif
  3170. #endif
  3171. #endif
  3172. UINT nID = 3;
  3173. LPSTR pName;
  3174. pName = (LPSTR)(LPCSTR)"转介绍返现";
  3175. OPEN_MENU(Card2RegBlue);
  3176. return;
  3177. }
  3178. else if (strMsg == "转介绍图表")
  3179. {
  3180. #ifndef ENTERPRISE_VERSION
  3181. #ifndef CHILD_VERSION
  3182. #ifdef BASIC_VERSION
  3183. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3184. {
  3185. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3186. exit(0);return;
  3187. }
  3188. #else
  3189. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3190. {
  3191. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3192. exit(0);return;
  3193. }
  3194. #endif
  3195. #else
  3196. #ifdef BASIC_VERSION
  3197. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3198. {
  3199. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3200. exit(0);return;
  3201. }
  3202. #else
  3203. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3204. {
  3205. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3206. exit(0); return;
  3207. }
  3208. #endif
  3209. #endif
  3210. #else
  3211. #ifndef CHILD_VERSION
  3212. #ifdef BASIC_VERSION
  3213. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3214. {
  3215. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3216. exit(0); return;
  3217. }
  3218. #else
  3219. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3220. {
  3221. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3222. exit(0); return;
  3223. }
  3224. #endif
  3225. #else
  3226. #ifdef BASIC_VERSION
  3227. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3228. {
  3229. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3230. exit(0);return;
  3231. }
  3232. #else
  3233. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3234. {
  3235. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3236. exit(0); return;
  3237. }
  3238. #endif
  3239. #endif
  3240. #endif
  3241. UINT nID = 3;
  3242. LPSTR pName;
  3243. pName = (LPSTR)(LPCSTR)"转介绍图表";
  3244. OPEN_MENU(Card2RegChartBlue);
  3245. return;
  3246. }
  3247. else if (strMsg == "积分设置")
  3248. {
  3249. if (IsHasRightsnew(49) == 0)return;
  3250. MemberSet dlg;
  3251. dlg.DoModal();
  3252. return;
  3253. }
  3254. else if (strMsg == "礼服录入")
  3255. {
  3256. if (IsHasRightsnew(39) == 0)return;
  3257. UINT nID = 3;
  3258. LPSTR pName;
  3259. pName = (LPSTR)(LPCSTR)"礼服录入";
  3260. OPEN_MENU(DressManage);
  3261. return;
  3262. }
  3263. else if (strMsg == "礼服查看")
  3264. {
  3265. #ifndef ENTERPRISE_VERSION
  3266. #ifndef CHILD_VERSION
  3267. #ifdef BASIC_VERSION
  3268. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3269. {
  3270. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3271. exit(0);return;
  3272. }
  3273. #else
  3274. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3275. {
  3276. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3277. exit(0);return;
  3278. }
  3279. #endif
  3280. #else
  3281. #ifdef BASIC_VERSION
  3282. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3283. {
  3284. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3285. exit(0);return;
  3286. }
  3287. #else
  3288. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3289. {
  3290. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3291. exit(0); return;
  3292. }
  3293. #endif
  3294. #endif
  3295. #else
  3296. #ifndef CHILD_VERSION
  3297. #ifdef BASIC_VERSION
  3298. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3299. {
  3300. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3301. exit(0); return;
  3302. }
  3303. #else
  3304. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3305. {
  3306. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3307. exit(0); return;
  3308. }
  3309. #endif
  3310. #else
  3311. #ifdef BASIC_VERSION
  3312. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3313. {
  3314. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3315. exit(0);return;
  3316. }
  3317. #else
  3318. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3319. {
  3320. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3321. exit(0); return;
  3322. }
  3323. #endif
  3324. #endif
  3325. #endif
  3326. if (IsHasRightsnew(40) == 0)return;
  3327. UINT nID = 3;
  3328. LPSTR pName;
  3329. pName = (LPSTR)(LPCSTR)"礼服查看";
  3330. OPEN_MENU(ShowDress);
  3331. return;
  3332. }
  3333. else if (strMsg == "撞期预警")
  3334. {
  3335. UINT nID = 3;
  3336. LPSTR pName;
  3337. pName = (LPSTR)(LPCSTR)"撞期预警";
  3338. OPEN_MENU(DressEarlyWarning);
  3339. return;
  3340. }
  3341. else if (strMsg == "礼服出租")
  3342. {
  3343. UINT nID = 3;
  3344. LPSTR pName;
  3345. pName = (LPSTR)(LPCSTR)"礼服出租";
  3346. OPEN_MENU(ShowHireReg);
  3347. return;
  3348. }
  3349. else if (strMsg == "礼服图片")
  3350. {
  3351. ShowPic dlg;
  3352. dlg.m_mode = 4;
  3353. //dlg.m_path = g_path5 + "\\";
  3354. dlg.m_id = g_path5 + "\\";
  3355. dlg.DoModal();
  3356. return;
  3357. }
  3358. else if (strMsg == "商品类别设置")
  3359. {
  3360. if (IsHasRightsnew(29) == 0)return;
  3361. SPLBDlg dlg;
  3362. dlg.DoModal();
  3363. return;
  3364. }
  3365. else if (strMsg == "商品名称设置")
  3366. {
  3367. if (IsHasRightsnew(29) == 0)return;
  3368. UINT nID = 3;
  3369. LPSTR pName;
  3370. pName = (LPSTR)(LPCSTR)"商品设置";
  3371. OPEN_MENU(ShangPin);
  3372. return;
  3373. }
  3374. else if (strMsg == "固定资产管理")
  3375. {
  3376. UINT nID = 3;
  3377. LPSTR pName;
  3378. pName = (LPSTR)(LPCSTR)"固定资产管理";
  3379. OPEN_MENU(FixedAssets);
  3380. return;
  3381. }
  3382. else if (strMsg == "入库单")
  3383. {
  3384. if (IsHasRightsnew(44) == 0)return;
  3385. InputGoods dlg;
  3386. dlg.DoModal();
  3387. return;
  3388. }
  3389. else if (strMsg == "出库单")
  3390. {
  3391. #ifndef ENTERPRISE_VERSION
  3392. #ifndef CHILD_VERSION
  3393. #ifdef BASIC_VERSION
  3394. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3395. {
  3396. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3397. exit(0);return;
  3398. }
  3399. #else
  3400. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3401. {
  3402. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3403. exit(0);return;
  3404. }
  3405. #endif
  3406. #else
  3407. #ifdef BASIC_VERSION
  3408. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3409. {
  3410. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3411. exit(0);return;
  3412. }
  3413. #else
  3414. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3415. {
  3416. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3417. exit(0); return;
  3418. }
  3419. #endif
  3420. #endif
  3421. #else
  3422. #ifndef CHILD_VERSION
  3423. #ifdef BASIC_VERSION
  3424. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3425. {
  3426. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3427. exit(0); return;
  3428. }
  3429. #else
  3430. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3431. {
  3432. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3433. exit(0); return;
  3434. }
  3435. #endif
  3436. #else
  3437. #ifdef BASIC_VERSION
  3438. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3439. {
  3440. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3441. exit(0);return;
  3442. }
  3443. #else
  3444. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3445. {
  3446. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3447. exit(0); return;
  3448. }
  3449. #endif
  3450. #endif
  3451. #endif
  3452. if (IsHasRightsnew(45) == 0)return;
  3453. InputGoods dlg;
  3454. dlg.m_mode = 1;
  3455. dlg.DoModal();
  3456. return;
  3457. }
  3458. else if (strMsg == "库存查询")
  3459. {
  3460. #ifndef ENTERPRISE_VERSION
  3461. #ifndef CHILD_VERSION
  3462. #ifdef BASIC_VERSION
  3463. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3464. {
  3465. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3466. exit(0);return;
  3467. }
  3468. #else
  3469. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3470. {
  3471. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3472. exit(0);return;
  3473. }
  3474. #endif
  3475. #else
  3476. #ifdef BASIC_VERSION
  3477. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3478. {
  3479. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3480. exit(0);return;
  3481. }
  3482. #else
  3483. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3484. {
  3485. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3486. exit(0); return;
  3487. }
  3488. #endif
  3489. #endif
  3490. #else
  3491. #ifndef CHILD_VERSION
  3492. #ifdef BASIC_VERSION
  3493. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3494. {
  3495. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3496. exit(0); return;
  3497. }
  3498. #else
  3499. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3500. {
  3501. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3502. exit(0); return;
  3503. }
  3504. #endif
  3505. #else
  3506. #ifdef BASIC_VERSION
  3507. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3508. {
  3509. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3510. exit(0);return;
  3511. }
  3512. #else
  3513. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3514. {
  3515. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3516. exit(0); return;
  3517. }
  3518. #endif
  3519. #endif
  3520. #endif
  3521. UINT nID = 3;
  3522. LPSTR pName;
  3523. pName = (LPSTR)(LPCSTR)"库存查询";
  3524. OPEN_MENU(ShowGoods);
  3525. return;
  3526. }
  3527. else if (strMsg == "商品图表")
  3528. {
  3529. UINT nID = 3;
  3530. LPSTR pName;
  3531. pName = (LPSTR)(LPCSTR)"商品图表";
  3532. OPEN_MENU(StoreInfoChart);
  3533. return;
  3534. }
  3535. else if (strMsg == "成本核算")
  3536. {
  3537. UINT nID = 3;
  3538. LPSTR pName;
  3539. pName = (LPSTR)(LPCSTR)"成本核算";
  3540. OPEN_MENU(CostCal);
  3541. return;
  3542. }
  3543. else if (strMsg == "考勤记录")
  3544. {
  3545. UINT nID = 3;
  3546. LPSTR pName;
  3547. pName = (LPSTR)(LPCSTR)"考勤记录";
  3548. OPEN_MENU(LoginReg);
  3549. return;
  3550. }
  3551. else if (strMsg == "月统计")
  3552. {
  3553. UINT nID = 3;
  3554. LPSTR pName;
  3555. pName = (LPSTR)(LPCSTR)"月统计";
  3556. OPEN_MENU(LoginReg2);
  3557. return;
  3558. }
  3559. else if (strMsg == "时间设置")
  3560. {
  3561. if (IsHasRightsnew(21) == 0)return;
  3562. SetLoginTime dlg;
  3563. dlg.DoModal();
  3564. return;
  3565. }
  3566. else if (strMsg == "排班设置")
  3567. {
  3568. if (IsHasRightsnew(21) == 0)return;
  3569. SetLoginBan dlg;
  3570. dlg.DoModal();
  3571. return;
  3572. }
  3573. else if (strMsg == "意向查询")
  3574. {
  3575. UINT nID = 3;
  3576. LPSTR pName;
  3577. pName = (LPSTR)(LPCSTR)"意向查询";
  3578. OPEN_MENU(HospitalClient);
  3579. return;
  3580. }
  3581. else if (strMsg == "今日提醒")
  3582. {
  3583. UINT nID = 3;
  3584. LPSTR pName;
  3585. pName = (LPSTR)(LPCSTR)"今日提醒";
  3586. OPEN_MENU(HospitalClientAlarm);
  3587. return;
  3588. }
  3589. else if (strMsg == "跟踪短信")
  3590. {
  3591. UINT nID = 3;
  3592. LPSTR pName;
  3593. pName = (LPSTR)(LPCSTR)"跟踪短信";
  3594. OPEN_MENU(HospitalClientMsg);
  3595. return;
  3596. }
  3597. else if (strMsg == "意向单录入")
  3598. {
  3599. AddHospitalClient dlg;
  3600. dlg.DoModal();
  3601. return;
  3602. }
  3603. else if (strMsg == "资料设置")
  3604. {
  3605. HospitalInfoSet dlg;
  3606. dlg.DoModal();
  3607. return;
  3608. }
  3609. else if ( strMsg == _T("公众号设置"))
  3610. {
  3611. if (IsHasRightsnew(62) == 0)return;
  3612. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3613. {
  3614. lyfzLibrary::g_PtrShowWeiXinDialog(g_rc, g_bkcol);
  3615. lyfzLibrary::FreeWeiXinLibaray();
  3616. }
  3617. return;
  3618. }
  3619. else if ( strMsg == _T("模板消息设置"))
  3620. {
  3621. if (IsHasRightsnew(63) == 0)return;
  3622. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3623. {
  3624. lyfzLibrary::g_PtrShowWXMsgconfigDialog(g_rc, g_bkcol);
  3625. lyfzLibrary::FreeWeiXinLibaray();
  3626. }
  3627. return;
  3628. }
  3629. else if ( strMsg == _T("推送记录") )
  3630. {
  3631. if (IsHasRightsnew(64) == 0)return;
  3632. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3633. {
  3634. lyfzLibrary::g_PtrShowWXMsgRcordDialog(g_rc, g_bkcol);
  3635. lyfzLibrary::FreeWeiXinLibaray();
  3636. }
  3637. return;
  3638. }
  3639. AfxMessageBox(strMsg + ",开发中...");
  3640. }
  3641. // Jeff.当版本号不一致时,调用AutoUpdate.exe来升级YLGL.exe
  3642. void CMainFrame::AutoUpdate()
  3643. {
  3644. if (g_bBranchModify)
  3645. {
  3646. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3647. return;
  3648. }
  3649. else if (g_branchname != "")
  3650. {
  3651. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3652. return;
  3653. }
  3654. g_ntimeout = 30000;
  3655. if (!::PathFileExists(g_mainpath + "\\AutoUpdate.exe"))
  3656. {
  3657. g_sendhead.bsql = 0;
  3658. g_sendhead.code[0] = 99;
  3659. g_sendhead.tabcount = 1;
  3660. g_pMainWnd->ProcessChatMessageRequest2(99);
  3661. if (g_bSendOK == 0)
  3662. goto failed;
  3663. CFile fp;
  3664. fp.Open(g_mainpath + "\\AutoUpdate.exe", CFile::modeWrite | CFile::modeCreate);
  3665. fp.Write(g_pData, g_nLeng);
  3666. fp.Close();
  3667. }
  3668. {
  3669. ::DeleteFile(g_mainpath + "\\YLGL2.exe"); // 删除ylgl.exe;
  3670. g_sendhead.bsql = 0;
  3671. g_sendhead.code[0] = 98;
  3672. g_sendhead.tabcount = 1;
  3673. g_pMainWnd->ProcessChatMessageRequest2(99); if (g_bSendOK == 0)goto failed;
  3674. CFile fp;
  3675. fp.Open(g_mainpath + "\\YLGL2.exe", CFile::modeWrite | CFile::modeCreate);
  3676. fp.Write(g_pData, g_nLeng);
  3677. fp.Close();
  3678. }
  3679. AfxMessageBox("自动升级成功!", MB_ICONINFORMATION);
  3680. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\AutoUpdate.exe"), "12345", NULL, SW_SHOWNORMAL);
  3681. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3682. exit(0);
  3683. return;
  3684. failed:
  3685. AfxMessageBox("自动升级失败!", MB_ICONINFORMATION);
  3686. if (g_ntimeout == 30000)//非远程
  3687. {
  3688. AfxMessageBox("提醒:升级过程中需要传输较多的数据,如果网速慢可能导致远程升级失败!\r\n\
  3689. 可拷贝店内客户端用QQ传过来覆盖除dbconfig.dat的文件即可。", MB_ICONINFORMATION);
  3690. }
  3691. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3692. }
  3693. void CMainFrame::Onchoosephotoskin() //Jeff:此机用于选片菜单项;不在使用2014.06.16
  3694. {
  3695. if (g_user.bLongin == 0)
  3696. {
  3697. if (g_bNoLoginLia)
  3698. {
  3699. Login dlg;
  3700. dlg.SetLiaPath("5.lia");
  3701. dlg.DoModal();
  3702. }
  3703. else
  3704. {
  3705. Login3 dlg;
  3706. dlg.SetLiaPath("5.lia");
  3707. dlg.DoModal();
  3708. }
  3709. if (g_user.bLongin == 0)return;
  3710. }
  3711. // TODO: Add your command handler code here
  3712. CMenu *pMenu = GetMenu();
  3713. CMenu* submenu = pMenu->GetSubMenu(1);
  3714. UINT status = submenu->GetMenuState(IDM_choosephotoskin, MF_BYCOMMAND);
  3715. if (status&MF_CHECKED)
  3716. {
  3717. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_UNCHECKED);
  3718. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status", 0);
  3719. }
  3720. else
  3721. {
  3722. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  3723. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status", 1);
  3724. }
  3725. }
  3726. /*BOOL g_bInSkin = 0;*/
  3727. BOOL CMainFrame::IsCtrlDown()
  3728. {
  3729. short state = GetKeyState(VK_LCONTROL);
  3730. BYTE sta = (BYTE)(state >> 8);
  3731. state = GetKeyState(VK_RCONTROL);
  3732. BYTE sta2 = (BYTE)(state >> 8);
  3733. if (sta || sta2)
  3734. return 1;
  3735. else
  3736. return 0;
  3737. }//IsShiftDown
  3738. BOOL CMainFrame::IsShiftDown()
  3739. {
  3740. short state = GetKeyState(VK_LSHIFT);
  3741. BYTE sta = (BYTE)(state >> 8);
  3742. state = GetKeyState(VK_RSHIFT);
  3743. BYTE sta2 = (BYTE)(state >> 8);
  3744. if (sta || sta2)
  3745. return 1;
  3746. else
  3747. return 0;
  3748. }
  3749. BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
  3750. {
  3751. // TODO: Add your specialized code here and/or call the base class IDM_Logout
  3752. if (pMsg->message == WM_KEYDOWN)
  3753. {
  3754. switch (pMsg->wParam)
  3755. {
  3756. case VK_F12:
  3757. g_pMainWnd->OnCommandMenu(IDM_Logout);
  3758. return 1;
  3759. case VK_F1:
  3760. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  3761. return 1;
  3762. case VK_F2: // 此机用于选片和选设计;
  3763. {
  3764. if (g_pMainWnd->m_bCheckF2F3 && (IsShiftDown() == 0 || IsCtrlDown() == 0))return 1;
  3765. m_Mdi.MainClose();
  3766. if (g_user.bLongin)
  3767. {
  3768. SearchClient dlg;
  3769. dlg.SetLiaPath("2.lia");
  3770. if (dlg.DoModal() != IDOK)
  3771. {
  3772. if (dlg.m_bLogout)
  3773. {
  3774. g_user.bLongin = 0;
  3775. g_user.name.Empty();
  3776. g_user.rights.Empty();
  3777. g_user.account.Empty();
  3778. goto ll;
  3779. }
  3780. PostMessage(WM_QUIT);
  3781. return 1;
  3782. }
  3783. if (dlg.m_exitcode == 3)
  3784. {
  3785. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3786. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3787. }
  3788. else
  3789. {
  3790. ShowWindow(SW_SHOW);
  3791. #ifdef NEW_SKIN
  3792. if (m_pMainFrimDlg2 == NULL)
  3793. {
  3794. m_pMainFrimDlg2 = new MainFrimDlg2;
  3795. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3796. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3797. }
  3798. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3799. g_bInSkin = 0;
  3800. #endif
  3801. }
  3802. }
  3803. else
  3804. {
  3805. ll:
  3806. ChoosePhotoSkin dlg;
  3807. dlg.SetLiaPath("1.lia");
  3808. if (dlg.DoModal() != IDOK)
  3809. {
  3810. PostMessage(WM_QUIT);
  3811. return 1;
  3812. }
  3813. if (dlg.m_exitcode == 3)
  3814. {
  3815. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3816. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3817. }
  3818. else
  3819. {
  3820. ShowWindow(SW_SHOW);
  3821. #ifdef NEW_SKIN
  3822. if (m_pMainFrimDlg2 == NULL)
  3823. {
  3824. m_pMainFrimDlg2 = new MainFrimDlg2;
  3825. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3826. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3827. }
  3828. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3829. g_bInSkin = 0;
  3830. #endif
  3831. }
  3832. }
  3833. }
  3834. return 1;
  3835. case VK_F3: // 此机用于选片和选设计;
  3836. {
  3837. if (g_pMainWnd->m_bCheckF2F3 && (g_pMainWnd->IsShiftDown() == 0 || g_pMainWnd->IsCtrlDown() == 0))return 1;
  3838. m_Mdi.MainClose();
  3839. if (g_user.bLongin)
  3840. {
  3841. SearchClient dlg;
  3842. dlg.m_mode = 1;
  3843. dlg.SetLiaPath("2.lia");
  3844. if (dlg.DoModal() != IDOK)
  3845. {
  3846. if (dlg.m_bLogout)
  3847. {
  3848. g_user.bLongin = 0;
  3849. g_user.name.Empty();
  3850. g_user.rights.Empty();
  3851. g_user.account.Empty();
  3852. goto mm;
  3853. }
  3854. PostMessage(WM_QUIT);
  3855. return 1;
  3856. }
  3857. if (dlg.m_exitcode == 2)
  3858. {
  3859. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3860. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3861. }
  3862. else
  3863. {
  3864. ShowWindow(SW_SHOW);
  3865. #ifdef NEW_SKIN
  3866. if (m_pMainFrimDlg2 == NULL)
  3867. {
  3868. m_pMainFrimDlg2 = new MainFrimDlg2;
  3869. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3870. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3871. }
  3872. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3873. g_bInSkin = 0;
  3874. #endif
  3875. }
  3876. }
  3877. else
  3878. {
  3879. mm:
  3880. ChoosePhotoSkin dlg;
  3881. dlg.m_mode = 1;
  3882. dlg.SetLiaPath("1.lia");
  3883. if (dlg.DoModal() != IDOK)
  3884. {
  3885. PostMessage(WM_QUIT);
  3886. return 1;
  3887. }
  3888. if (dlg.m_exitcode == 2)
  3889. {
  3890. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3891. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3892. }
  3893. else
  3894. {
  3895. ShowWindow(SW_SHOW);
  3896. #ifdef NEW_SKIN
  3897. if (m_pMainFrimDlg2 == NULL)
  3898. {
  3899. m_pMainFrimDlg2 = new MainFrimDlg2;
  3900. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3901. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3902. }
  3903. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3904. g_bInSkin = 0;
  3905. #endif
  3906. }
  3907. }
  3908. }
  3909. return 1;
  3910. //#if 0 // 2015-05-30 禁用F11功能;
  3911. // case VK_F11:
  3912. // if (g_bInSkin)return 1;
  3913. // if (g_user.bLongin)
  3914. // {
  3915. // SqlDlg dlg;
  3916. // dlg.DoModal();
  3917. // }
  3918. // break;
  3919. //#endif
  3920. }
  3921. }
  3922. return CMDIFrameWnd::PreTranslateMessage(pMsg);
  3923. }
  3924. void CMainFrame::GetSkin()
  3925. {
  3926. return;
  3927. #ifdef MNLS_VERSION
  3928. if (::PathFileExists(g_mainpath + "\\skin\\4.lia"))
  3929. {
  3930. CFile fp;
  3931. fp.Open(g_mainpath + "\\skin\\4.lia", CFile::modeRead);
  3932. DWORD leng=fp.GetLength ();
  3933. fp.Close ();
  3934. if(leng!=194987)
  3935. ::DeleteFile (g_mainpath+"\\skin\\4.lia"); // 删除4.lia
  3936. }
  3937. if(!::PathFileExists (g_mainpath+"\\skin\\4.lia"))
  3938. {
  3939. ::CreateDirectory (g_mainpath+"\\skin", NULL);
  3940. g_sendhead.bsql=0;
  3941. g_sendhead.code[0]=100;
  3942. g_sendhead.tabcount=1;
  3943. g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return;
  3944. CFile fp;
  3945. fp.Open (g_mainpath+"\\skin\\4.lia", CFile::modeWrite|CFile::modeCreate);
  3946. fp.Write (g_pData, g_nLeng);
  3947. fp.Close ();
  3948. }
  3949. #endif
  3950. }
  3951. void AutoDraw(CPrintRX &m_Print, CRect &StrRect, CString &str, float fscale)
  3952. {
  3953. CString tempbz =_T(""), temp = _T("");
  3954. BOOL bRun = 0;
  3955. CSize size;
  3956. int fontsize = 12;
  3957. int i = 0;
  3958. ll: tempbz = str;
  3959. i = 0;
  3960. m_Print.SetFontFace(fontsize, 1, "宋体");
  3961. while (1)
  3962. {
  3963. if (!tempbz.IsEmpty())
  3964. {
  3965. temp = tempbz;
  3966. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  3967. int right = 0;
  3968. CRect temprc = StrRect;
  3969. temprc.top += i*(fontsize*fscale); i++;
  3970. temprc.bottom = temprc.top + fontsize;
  3971. if (temprc.bottom > StrRect.bottom)break;
  3972. while (size.cx > temprc.Width())
  3973. {
  3974. right++;
  3975. temp = tempbz.Left(tempbz.GetLength() - (right));
  3976. if (GIsHalfHZ(temp))
  3977. {
  3978. right++;
  3979. temp.Delete(temp.GetLength() - 1);
  3980. }
  3981. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  3982. }
  3983. // 判断最后的字符是否还含有半个汉字;
  3984. if ( GIsHalfHZ(temp) )
  3985. {
  3986. right++;
  3987. temp.Delete(temp.GetLength() -1);
  3988. temp = tempbz.Left(tempbz.GetLength() - (right));
  3989. }
  3990. if (temp.Find("\r\n") != -1)
  3991. {
  3992. temp = temp.Left(temp.Find("\r\n"));//i++;
  3993. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength() - 2);
  3994. }
  3995. else
  3996. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  3997. if (bRun)
  3998. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, temprc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3999. }
  4000. else
  4001. break;
  4002. }
  4003. if (tempbz.IsEmpty() == 0)
  4004. {
  4005. fontsize--;
  4006. goto ll;
  4007. }
  4008. if (bRun == 0)
  4009. {
  4010. bRun = 1;
  4011. goto ll;
  4012. }
  4013. }
  4014. void CMainFrame::PrintDinDan3(CString strOrderNumber)
  4015. {
  4016. // TODO: Add your control notification handler code here
  4017. CPrintRX m_Print;
  4018. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  4019. {
  4020. m_Print.InitToPrint(NULL, 1);
  4021. }
  4022. else
  4023. {
  4024. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  4025. if (name.IsEmpty())
  4026. m_Print.InitToPrint(NULL, 1);
  4027. else
  4028. {
  4029. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  4030. if (nret == -1)
  4031. {
  4032. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  4033. }
  4034. }
  4035. }
  4036. m_Print.StartPrint();
  4037. m_Print.StartPage();
  4038. LoadRect load;
  4039. load.SetLiaPath("11.lia");
  4040. load.SetMargins(0, 0);
  4041. if (!load.Load())return;
  4042. LoadRect load2;
  4043. load2.SetLiaPath("12.lia");
  4044. load2.SetMargins(0, 0);
  4045. if (!load2.Load())return;
  4046. LoadRect load3;
  4047. load3.SetLiaPath("13.lia");
  4048. load3.SetMargins(-6, 520);
  4049. if (!load3.Load())return;
  4050. int i;
  4051. //////////////////////////////////////////////////////////////
  4052. CStringArray txarray;
  4053. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "'";
  4054. g_sendhead.code[0] = 11;
  4055. g_sendhead.code[1] = 52;
  4056. g_sendhead.code[2] = 50;
  4057. g_sendhead.code[3] = 150;
  4058. g_sendhead.tabcount = 4;
  4059. g_sendhead.bsql = 0;
  4060. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  4061. CArray<CStringArray, CStringArray>sparray;
  4062. CArray<CStringArray, CStringArray>clientarray;
  4063. CArray<CStringArray, CStringArray>jdarray;
  4064. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray);
  4065. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  4066. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  4067. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  4068. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  4069. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  4070. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  4071. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  4072. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  4073. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  4074. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  4075. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  4076. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  4077. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  4078. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  4079. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  4080. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  4081. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  4082. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  4083. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  4084. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  4085. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  4086. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  4087. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  4088. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  4089. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  4090. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  4091. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  4092. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  4093. CString m_bz = "其它要求: " + g_List1array.ElementAt(0).ElementAt(38);
  4094. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  4095. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  4096. if (IsHasRights2new(31) == 0)
  4097. {
  4098. m_phone1 = "***";
  4099. m_phone2 = "***";
  4100. }
  4101. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  4102. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  4103. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  4104. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  4105. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  4106. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  4107. CString m_addr = m_addr1 + ";";
  4108. m_addr.TrimLeft(";");
  4109. m_addr += m_addr2;
  4110. CString m_qq = m_qq1 + ";";
  4111. m_qq.TrimLeft(";");
  4112. m_qq += m_qq2;
  4113. CString m_jd;
  4114. for (i = 0; i < jdarray.GetSize(); i++)
  4115. {
  4116. m_jd += jdarray.ElementAt(i).ElementAt(1);
  4117. m_jd += ";";
  4118. }
  4119. m_jd.TrimRight(";");
  4120. m_money1.Format("%f", atof(m_taoxijiage));
  4121. m_money2.Format("%f", atof(m_payed1));
  4122. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  4123. ConvertToPrice(m_money1);
  4124. ConvertToPrice(m_money2);
  4125. ConvertToPrice(m_money3);
  4126. ////////////////////////////////////////////////////////////////
  4127. int rcpos = -1;
  4128. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  4129. m_Print.SetFontFace(17, 1, "宋体");
  4130. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4131. StrRect.top -= 0;
  4132. StrRect.bottom -= 10;
  4133. StrRect.left -= 140;
  4134. StrRect.right = StrRect.left + 48;
  4135. m_Print.SetFontFace(15, 1, "宋体");
  4136. m_Print.SetColor(0xffffff);
  4137. m_Print.DrawRect(StrRect, 0);
  4138. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4139. StrRect.left = StrRect.right;
  4140. StrRect.right = StrRect.left + 48;
  4141. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  4142. m_Print.SetColor(0, RGB(255, 0, 0));
  4143. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4144. m_Print.SetColor(0);
  4145. m_Print.SetFontFace(12, 1, "宋体");
  4146. StrRect.left -= 48;
  4147. int hei = StrRect.Height();
  4148. StrRect.top = StrRect.bottom + 2;
  4149. StrRect.bottom += hei + 2;
  4150. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4151. StrRect.top = StrRect.bottom - 2;
  4152. StrRect.bottom += hei - 5;
  4153. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  4154. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4155. m_Print.SetFontFace(12, 1, "宋体");
  4156. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4157. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4158. m_Print.SetFontFace(11, 1, "宋体");
  4159. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4160. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4161. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4162. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4163. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4164. m_Print.DrawRect2(StrRect, 2);
  4165. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4166. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4167. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4168. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4169. m_Print.DrawRect2(StrRect, 2);
  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_birthday1, 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_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4179. m_Print.DrawRect2(StrRect, 2);
  4180. ////////////
  4181. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4182. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4183. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4184. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4185. m_Print.DrawRect2(StrRect, 2);
  4186. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4187. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4188. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4189. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4190. m_Print.DrawRect2(StrRect, 2);
  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_birthday2, 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_time3, 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_addr, 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)"QQ/邮箱:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4208. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4209. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, 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_money1, 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)"定金:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4218. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4219. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money2, 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_money3, 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_outside, 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_jd, 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_clothescount, StrRect, 0, 0, FORMAT_HCENTER | 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)"女士:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4245. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4246. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4247. m_Print.DrawRect2(StrRect, 2);
  4248. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4249. m_Print.DrawText((LPTSTR)(LPCTSTR)"套", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4250. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4251. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内提供拍摄区服装/头饰造型", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4252. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4253. m_Print.DrawText((LPTSTR)(LPCTSTR)"其它:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4254. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4255. m_Print.DrawText((LPTSTR)(LPCTSTR)" ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4256. m_Print.DrawRect2(StrRect, 2);
  4257. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4258. m_Print.DrawText((LPTSTR)(LPCTSTR)"专业数码拍摄:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4259. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4260. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4261. m_Print.DrawRect2(StrRect, 2);
  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)"(JPG格式数据)", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4266. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4267. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内赠送:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4268. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4269. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_List1array.ElementAt(0).ElementAt(9)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4270. m_Print.DrawRect2(StrRect, 2);
  4271. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4272. m_Print.DrawText((LPTSTR)(LPCTSTR)"张设计排版精修入册", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4273. //////////////////////load2
  4274. rcpos = -1;
  4275. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4276. m_Print.DrawText((LPTSTR)(LPCTSTR)"原始数据套系内张数JPG格式光盘壹只", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4277. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4278. m_Print.DrawText((LPTSTR)(LPCTSTR)"其它:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4279. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4280. // m_Print.DrawText((LPTSTR)(LPCTSTR)"", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4281. // AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4282. m_Print.DrawRect2(StrRect, 2);
  4283. m_Print.SetFontFace(11, 1, "宋体");
  4284. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4285. m_Print.DrawText((LPTSTR)(LPCTSTR)"客人产品:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4286. int rowcount = sparray.GetSize() / 8;
  4287. int needaddrow = 0;
  4288. while (sparray.GetSize() > rowcount * 8 + needaddrow)
  4289. needaddrow++;
  4290. int pos = 0;
  4291. CString str = "";
  4292. int addcount = 0;
  4293. if (needaddrow > 0)
  4294. addcount = 1;
  4295. else
  4296. addcount = 0;
  4297. needaddrow--;
  4298. str.Empty();
  4299. for (i = 0; i < rowcount + addcount; i++)
  4300. {
  4301. str += sparray.ElementAt(pos).ElementAt(5);
  4302. str += " 数量:";
  4303. str += sparray.ElementAt(pos).ElementAt(3);
  4304. str += ";";
  4305. pos++;
  4306. }
  4307. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4308. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4309. m_Print.DrawRect2(StrRect, 2);
  4310. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4311. if (needaddrow > 0)
  4312. addcount = 1;
  4313. else
  4314. addcount = 0;
  4315. needaddrow--;
  4316. str.Empty();
  4317. for (i = 0; i < rowcount + addcount; i++)
  4318. {
  4319. str += sparray.ElementAt(pos).ElementAt(5);
  4320. str += " 数量:";
  4321. str += sparray.ElementAt(pos).ElementAt(3);
  4322. str += ";";
  4323. pos++;
  4324. }
  4325. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4326. m_Print.DrawRect2(StrRect, 2);
  4327. StrRect = load2.m_rcarray.ElementAt(++rcpos);//7
  4328. if (needaddrow > 0)
  4329. addcount = 1;
  4330. else
  4331. addcount = 0;
  4332. needaddrow--;
  4333. str.Empty();
  4334. for (i = 0; i < rowcount + addcount; i++)
  4335. {
  4336. str += sparray.ElementAt(pos).ElementAt(5);
  4337. str += " 数量:";
  4338. str += sparray.ElementAt(pos).ElementAt(3);
  4339. str += ";";
  4340. pos++;
  4341. }
  4342. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4343. m_Print.DrawRect2(StrRect, 2);
  4344. StrRect = load2.m_rcarray.ElementAt(++rcpos);//8
  4345. if (needaddrow > 0)
  4346. addcount = 1;
  4347. else
  4348. addcount = 0;
  4349. needaddrow--;
  4350. str.Empty();
  4351. for (i = 0; i < rowcount + addcount; i++)
  4352. {
  4353. str += sparray.ElementAt(pos).ElementAt(5);
  4354. str += " 数量:";
  4355. str += sparray.ElementAt(pos).ElementAt(3);
  4356. str += ";";
  4357. pos++;
  4358. }
  4359. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4360. m_Print.DrawRect2(StrRect, 2);
  4361. StrRect = load2.m_rcarray.ElementAt(++rcpos);//9
  4362. if (needaddrow > 0)
  4363. addcount = 1;
  4364. else
  4365. addcount = 0;
  4366. needaddrow--;
  4367. str.Empty();
  4368. for (i = 0; i < rowcount + addcount; i++)
  4369. {
  4370. str += sparray.ElementAt(pos).ElementAt(5);
  4371. str += " 数量:";
  4372. str += sparray.ElementAt(pos).ElementAt(3);
  4373. str += ";";
  4374. pos++;
  4375. }
  4376. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4377. m_Print.DrawRect2(StrRect, 2);
  4378. StrRect = load2.m_rcarray.ElementAt(++rcpos);//10
  4379. if (needaddrow > 0)
  4380. addcount = 1;
  4381. else
  4382. addcount = 0;
  4383. needaddrow--;
  4384. str.Empty();
  4385. for (i = 0; i < rowcount + addcount; i++)
  4386. {
  4387. str += sparray.ElementAt(pos).ElementAt(5);
  4388. str += " 数量:";
  4389. str += sparray.ElementAt(pos).ElementAt(3);
  4390. str += ";";
  4391. pos++;
  4392. }
  4393. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4394. m_Print.DrawRect2(StrRect, 2);
  4395. StrRect = load2.m_rcarray.ElementAt(++rcpos);//11
  4396. if (needaddrow > 0)
  4397. addcount = 1;
  4398. else
  4399. addcount = 0;
  4400. needaddrow--;
  4401. str.Empty();
  4402. for (i = 0; i < rowcount + addcount; i++)
  4403. {
  4404. str += sparray.ElementAt(pos).ElementAt(5);
  4405. str += " 数量:";
  4406. str += sparray.ElementAt(pos).ElementAt(3);
  4407. str += ";";
  4408. pos++;
  4409. }
  4410. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4411. m_Print.DrawRect2(StrRect, 2);
  4412. StrRect = load2.m_rcarray.ElementAt(++rcpos);//12
  4413. if (needaddrow > 0)
  4414. addcount = 1;
  4415. else
  4416. addcount = 0;
  4417. needaddrow--;
  4418. str.Empty();
  4419. for (i = 0; i < rowcount + addcount; i++)
  4420. {
  4421. str += sparray.ElementAt(pos).ElementAt(5);
  4422. str += " 数量:";
  4423. str += sparray.ElementAt(pos).ElementAt(3);
  4424. str += ";";
  4425. pos++;
  4426. }
  4427. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4428. m_Print.DrawRect2(StrRect, 2);
  4429. /* StrRect=load2.m_rcarray .ElementAt (++rcpos);//12
  4430. if(needaddrow>0)
  4431. addcount=1;
  4432. else
  4433. addcount=0;
  4434. needaddrow--;
  4435. str.Empty ();
  4436. for( i=0; i<rowcount+addcount; i++)
  4437. {
  4438. str+=sparray.ElementAt (pos).ElementAt (5);
  4439. str+=" 数量:";
  4440. str+=sparray.ElementAt (pos).ElementAt (3);
  4441. str+=";";
  4442. pos++;
  4443. }
  4444. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4445. m_Print.DrawRect2(StrRect, 2);
  4446. StrRect=load2.m_rcarray .ElementAt (++rcpos);//14
  4447. if(needaddrow>0)
  4448. addcount=1;
  4449. else
  4450. addcount=0;
  4451. needaddrow--;
  4452. str.Empty ();
  4453. for( i=0; i<rowcount+addcount; i++)
  4454. {
  4455. str+=sparray.ElementAt (pos).ElementAt (5);
  4456. str+=" 数量:";
  4457. str+=sparray.ElementAt (pos).ElementAt (3);
  4458. str+=";";
  4459. pos++;
  4460. }
  4461. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4462. m_Print.DrawRect2(StrRect, 2);*/
  4463. CRect sprc[2];
  4464. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4465. // AutoDraw(m_Print, StrRect, m_bz.Left (leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4466. m_Print.DrawRect2(StrRect, 2);
  4467. sprc[0] = StrRect;
  4468. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4469. // AutoDraw(m_Print, StrRect, m_bz.Right (leng-leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4470. m_Print.DrawRect2(StrRect, 2);
  4471. sprc[1] = StrRect;
  4472. //AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4473. {
  4474. CString temp, tempspno, tempbz;
  4475. CSize size;
  4476. BOOL bRun = 0;
  4477. int fontsize = 12;
  4478. ll: tempspno = m_bz;
  4479. m_Print.SetFontFace(fontsize, 1, "宋体");
  4480. for (i = 0; i<2; i++)
  4481. {
  4482. if (!tempspno.IsEmpty())
  4483. {
  4484. temp = tempspno;
  4485. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4486. int right = 0;
  4487. CRect temprc = sprc[i];
  4488. while (size.cx>temprc.Width())
  4489. {
  4490. right++;
  4491. temp = tempspno.Left(tempspno.GetLength() - (right));
  4492. if (GIsHalfHZ(temp))
  4493. {
  4494. right++;
  4495. temp.Delete(temp.GetLength() - 1);
  4496. }
  4497. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4498. }
  4499. if (bRun)
  4500. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4501. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  4502. if (tempspno.IsEmpty())i++;
  4503. }
  4504. }
  4505. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  4506. {
  4507. fontsize--;
  4508. goto ll;
  4509. }
  4510. if (bRun == 0)
  4511. {
  4512. bRun = 1;
  4513. goto ll;
  4514. }
  4515. }
  4516. m_Print.SetFontFace(11, 1, "宋体");
  4517. //////////////////////load3
  4518. rcpos = -1;
  4519. for (i = 0; i < 24; i++)
  4520. {
  4521. StrRect = load3.m_rcarray.ElementAt(i);
  4522. m_Print.DrawRect2(StrRect, 1);
  4523. }
  4524. CStringArray strarray;
  4525. strarray.Add("营业员");
  4526. strarray.Add("前台接待");
  4527. strarray.Add("化妆师");
  4528. strarray.Add("礼服师");
  4529. strarray.Add("摄影师");
  4530. strarray.Add("摄影助理");
  4531. strarray.Add("美工师");
  4532. strarray.Add("设计师");
  4533. for (i = 0; i < 8; i++)
  4534. {
  4535. StrRect = load3.m_rcarray.ElementAt(i);
  4536. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4537. }
  4538. strarray.RemoveAll();
  4539. strarray.Add(m_ren);
  4540. strarray.Add(g_List1array.ElementAt(0).ElementAt(49));
  4541. strarray.Add(m_waiter2);
  4542. strarray.Add(g_List1array.ElementAt(0).ElementAt(51));
  4543. strarray.Add(m_waiter1);
  4544. strarray.Add(g_List1array.ElementAt(0).ElementAt(50));
  4545. strarray.Add("");
  4546. strarray.Add(m_waiter4);
  4547. for (i = 8; i < 16; i++)
  4548. {
  4549. StrRect = load3.m_rcarray.ElementAt(i);
  4550. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 8), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4551. }
  4552. StrRect = load3.m_rcarray.ElementAt(27);
  4553. m_Print.DrawText((LPTSTR)(LPCTSTR)"客户电话: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4554. StrRect = load3.m_rcarray.ElementAt(28);
  4555. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4556. m_Print.SetFontFace(13, 1, "宋体");
  4557. StrRect = load3.m_rcarray.ElementAt(25);
  4558. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4559. StrRect = load3.m_rcarray.ElementAt(26);
  4560. m_Print.DrawRect2(StrRect, 2);
  4561. StrRect = load3.m_rcarray.ElementAt(24);
  4562. str = "\
  4563. 顾客须知\r\n\
  4564. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  4565. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  4566. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  4567. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  4568. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  4569. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  4570. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  4571. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  4572. AutoDraw(m_Print, StrRect, str, 1.8f);
  4573. PrintPreview dlg;
  4574. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4575. dlg.m_pDC = m_Print.GetPDC();
  4576. if (dlg.DoModal() != IDOK)return;
  4577. //结束打印
  4578. m_Print.EndPage();
  4579. m_Print.EndPrint();
  4580. }
  4581. void CMainFrame::PrintDailyForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4582. {
  4583. // TODO: Add your control notification handler code here
  4584. int pages = Listarray->GetSize() / 46;
  4585. if (Listarray->GetSize() % 46)pages++;
  4586. for (int aa = 0; aa < pages; aa++)
  4587. {
  4588. PrintPreview dlg;
  4589. CPrintRX m_Print;
  4590. m_Print.InitToPrint(NULL, 1);
  4591. m_Print.StartPrint();
  4592. m_Print.StartPage();
  4593. CRect mainrc(0, 0, 560, 793);
  4594. float fscale;
  4595. {
  4596. int w, h;
  4597. m_Print.GetWidHei(w, h);
  4598. fscale = (float)w / (float)h;
  4599. }
  4600. mainrc.DeflateRect(25, 40, 10, 0);
  4601. CRect rc, rc2;
  4602. rc = mainrc;
  4603. rc.bottom = rc.top;
  4604. rc.top -= 20;
  4605. m_Print.SetFontFace(16, 1, "黑体");
  4606. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4607. m_Print.SetFontFace(9, 1, "宋体");
  4608. CString str;
  4609. int wid[4] = { 320, 60, 60, 90 };
  4610. int hei = 16;
  4611. if (fscale > 0.71)hei = 15;
  4612. rc = mainrc;
  4613. rc.bottom = rc.top + hei;
  4614. for (int i = 0; i < 47; i++)
  4615. {
  4616. rc2.top = rc.top + i*hei;
  4617. rc2.bottom = rc.bottom + i*hei;
  4618. rc2.left = rc.left;
  4619. rc2.right = rc.left + wid[0];
  4620. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  4621. for (int j = 0; j<4; j++)
  4622. {
  4623. m_Print.DrawRect2(rc2, 1);
  4624. if (Listarray->GetSize()>aa * 46 + i)
  4625. {
  4626. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  4627. rc2.left += 3;
  4628. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4629. rc2.left -= 3;
  4630. }
  4631. rc2.left += wid[j];
  4632. rc2.right = rc2.left + wid[j + 1];
  4633. }
  4634. }
  4635. rc2.top += 2;
  4636. rc2.left += 2; rc2.right = mainrc.right + 4;
  4637. m_Print.SetFontFace(8, 1, "宋体");
  4638. int infopos = info.Find("***");
  4639. if (infopos != -1)
  4640. {
  4641. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Left(infopos), rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4642. CRect rc3 = rc2;
  4643. rc3.top = rc2.bottom - 4;
  4644. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Right(info.GetLength() - infopos - 3), rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4645. }
  4646. else
  4647. m_Print.DrawText((LPTSTR)(LPCTSTR)info, rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4648. str.Format(" 页:%d/%d", aa + 1, pages);
  4649. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4650. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  4651. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4652. dlg.m_pDC = m_Print.GetPDC();
  4653. // dlg.m_mode=1;
  4654. if (aa == 0)
  4655. {
  4656. if (dlg.DoModal() != IDOK)
  4657. return;
  4658. }
  4659. //结束打印
  4660. m_Print.EndPage();
  4661. m_Print.EndPrint();
  4662. }
  4663. }
  4664. void CMainFrame::PrintLoginForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4665. {
  4666. // TODO: Add your control notification handler code here
  4667. int sinlecount = 33 * 6;
  4668. int pages = Listarray->GetSize() / sinlecount;
  4669. if (Listarray->GetSize() % sinlecount)pages++;
  4670. for (int aa = 0; aa < pages; aa++)
  4671. {
  4672. PrintPreview dlg;
  4673. CPrintRX m_Print;
  4674. m_Print.InitToPrint(NULL, 1);
  4675. m_Print.StartPrint();
  4676. m_Print.StartPage();
  4677. CRect mainrc(0, 0, 560, 793);
  4678. float fscale;
  4679. {
  4680. int w, h;
  4681. m_Print.GetWidHei(w, h);
  4682. fscale = (float)w / (float)h;
  4683. }
  4684. mainrc.DeflateRect(25, 40, 10, 0);
  4685. CString str;
  4686. CRect rc, rc2;
  4687. rc = mainrc;
  4688. rc.bottom = rc.top;
  4689. rc.top -= 20;
  4690. rc.left -= 20;
  4691. m_Print.SetFontFace(12, 1, "黑体");
  4692. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4693. m_Print.SetFontFace(6, 1, "宋体");
  4694. str.Format(" 页:%d/%d", aa + 1, pages);
  4695. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4696. rc.right = mainrc.right + 20;
  4697. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4698. int wid[2] = { 50, 110 };
  4699. int hei = 11;
  4700. rc = mainrc;
  4701. rc.bottom = rc.top + hei;
  4702. rc.top += 10;
  4703. rc.bottom += 10;
  4704. int dtx = rc.Width() / 3 + 18;
  4705. int dty = 380;
  4706. for (int j = 0; j < 6; j++)
  4707. {
  4708. if (Listarray->GetSize() < aa*sinlecount + 33 * (j + 1))continue;
  4709. for (int i = 0; i < 33; i++)
  4710. {
  4711. rc2.top = rc.top + i*hei;
  4712. rc2.bottom = rc.bottom + i*hei;
  4713. rc2.left = rc.left;
  4714. rc2.right = rc.left + wid[0];
  4715. if (i == 0)
  4716. {
  4717. // rc2.left +=wid[1];
  4718. rc2.right += wid[1];
  4719. }
  4720. if (j == 1 || j == 4)
  4721. {
  4722. rc2.left += dtx;
  4723. rc2.right += dtx;
  4724. }
  4725. if (j == 2 || j == 5)
  4726. {
  4727. rc2.left += dtx * 2;
  4728. rc2.right += dtx * 2;
  4729. }
  4730. if (j == 3 || j == 4 || j == 5)
  4731. {
  4732. rc2.top += dty;
  4733. rc2.bottom += dty;
  4734. }
  4735. m_Print.DrawRect2(rc2, 1);
  4736. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4737. {
  4738. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(0);
  4739. rc2.left += 3;
  4740. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4741. rc2.left -= 3;
  4742. }
  4743. if (i == 0)continue;
  4744. rc2.left = rc2.right;
  4745. rc2.right += wid[1];
  4746. m_Print.DrawRect2(rc2, 1);
  4747. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4748. {
  4749. if (Listarray->ElementAt(aa*sinlecount + 33 * j + i).GetSize() > 1)
  4750. {
  4751. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(1);
  4752. rc2.left += 3;
  4753. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4754. rc2.left -= 3;
  4755. }
  4756. }
  4757. /* if(Listarray->GetSize ()>aa*46+i)
  4758. {
  4759. str=Listarray->ElementAt (aa*46+i).ElementAt (j);
  4760. rc2.left +=3;
  4761. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4762. rc2.left -=3;
  4763. }
  4764. rc2.left +=wid[j];
  4765. rc2.right =rc2.left+wid[j+1];*/
  4766. }
  4767. }
  4768. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4769. dlg.m_pDC = m_Print.GetPDC();
  4770. if (aa == 0)
  4771. {
  4772. if (dlg.DoModal() != IDOK)
  4773. return;
  4774. }
  4775. //结束打印
  4776. m_Print.EndPage();
  4777. m_Print.EndPrint();
  4778. }
  4779. }
  4780. void CMainFrame::PrintTakeForm(CArray<CStringArray, CStringArray>*Listarray)
  4781. {
  4782. CString title;
  4783. CString info;
  4784. // TODO: Add your control notification handler code here
  4785. int sinlecount = 4;
  4786. int pages = Listarray->GetSize() / sinlecount;
  4787. if (Listarray->GetSize() % sinlecount)pages++;
  4788. for (int aa = 0; aa < pages; aa++)
  4789. {
  4790. PrintPreview dlg;
  4791. CPrintRX m_Print;
  4792. m_Print.InitToPrint(NULL, 1);
  4793. m_Print.StartPrint();
  4794. m_Print.StartPage();
  4795. CRect mainrc(0, 0, 560, 793);
  4796. float fscale;
  4797. {
  4798. int w, h;
  4799. m_Print.GetWidHei(w, h);
  4800. fscale = (float)w / (float)h;
  4801. }
  4802. mainrc.DeflateRect(25, 40, 10, 0);
  4803. CString str;
  4804. CRect rc, rc2;
  4805. rc = mainrc;
  4806. rc.bottom = rc.top;
  4807. rc.top -= 20;
  4808. rc.left -= 20;
  4809. m_Print.SetFontFace(6, 1, "宋体");
  4810. str.Format(" 页:%d/%d", aa + 1, pages);
  4811. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4812. rc.right = mainrc.right + 10;
  4813. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4814. m_Print.SetFontFace(12, 1, "宋体");
  4815. int wid[2] = { 70, 190 };
  4816. int hei = 22;
  4817. rc = mainrc;
  4818. rc.bottom = rc.top + hei;
  4819. rc.top += 10;
  4820. rc.bottom += 10;
  4821. int dtx = rc.Width() / 2 + 18;
  4822. int dty = 380;
  4823. int arraysize = Listarray->ElementAt(0).GetSize();
  4824. for (int j = 0; j < 4; j++)
  4825. {
  4826. if (Listarray->GetSize() <= aa*sinlecount + j)continue;
  4827. for (int i = 0; i < arraysize; i++)
  4828. {
  4829. rc2.top = rc.top + i / 2 * hei;
  4830. rc2.bottom = rc.bottom + i / 2 * hei;
  4831. rc2.left = rc.left;
  4832. rc2.right = rc.left + wid[0];
  4833. if (i % 2)
  4834. {
  4835. rc2.left = rc2.right;
  4836. rc2.right += wid[1];
  4837. }
  4838. if (j == 1 || j == 3)
  4839. {
  4840. rc2.left += dtx;
  4841. rc2.right += dtx;
  4842. }
  4843. if (j == 2 || j == 3)
  4844. {
  4845. rc2.top += dty;
  4846. rc2.bottom += dty;
  4847. }
  4848. if (i == arraysize - 1 || i == arraysize - 2)
  4849. {
  4850. rc2.bottom += hei * 2;
  4851. }
  4852. m_Print.DrawRect2(rc2, 1);
  4853. {
  4854. str = Listarray->ElementAt(aa*sinlecount + j).ElementAt(i);
  4855. if (i == arraysize - 1)
  4856. {
  4857. CRect rc3 = rc2;
  4858. rc3.left += 3;
  4859. rc3.top += 3;
  4860. AutoDraw(m_Print, rc3, str, 1.4f);
  4861. }
  4862. else if (i == arraysize - 2)
  4863. {
  4864. CRect rc3 = rc2;
  4865. rc3.left += 3;
  4866. rc3.top += 3;
  4867. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4868. }
  4869. else
  4870. {
  4871. rc2.left += 3;
  4872. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4873. rc2.left -= 3;
  4874. }
  4875. }
  4876. }
  4877. }
  4878. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4879. dlg.m_pDC = m_Print.GetPDC();
  4880. if (aa == 0)
  4881. {
  4882. if (dlg.DoModal() != IDOK)
  4883. return;
  4884. }
  4885. //结束打印
  4886. m_Print.EndPage();
  4887. m_Print.EndPrint();
  4888. }
  4889. }
  4890. void CMainFrame::PrintThumbNail(CStringArray *array, CString client, BOOL bDir, CString m_size)
  4891. {
  4892. // TODO: Add your control notification handler code here
  4893. CStringArray titlearray;
  4894. CStringArray namearray;
  4895. CStringArray noarray;
  4896. CArray<CRect, CRect>rcarray;
  4897. CArray<CRect, CRect>widtharray;
  4898. if (m_size != "")
  4899. {
  4900. int pos = m_size.Find(";");
  4901. while (pos != -1)
  4902. {
  4903. CString size = m_size.Left(pos);
  4904. int pos2 = size.Find(":");
  4905. if (pos2 != -1)
  4906. {
  4907. CString str;
  4908. CRect rc;
  4909. str = size.Left(pos2);
  4910. noarray.Add(str);
  4911. str = size.Right(size.GetLength() - pos2 - 1);
  4912. pos2 = str.Find(",");
  4913. namearray.Add(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4914. pos2 = str.Find(",");
  4915. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4916. pos2 = str.Find(",");
  4917. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4918. widtharray.Add(rc);
  4919. pos2 = str.Find(",");
  4920. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4921. pos2 = str.Find(",");
  4922. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4923. pos2 = str.Find(",");
  4924. rc.right = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4925. rc.bottom = atoi(str);
  4926. rcarray.Add(rc);
  4927. }
  4928. m_size = m_size.Right(m_size.GetLength() - pos - 1);
  4929. pos = m_size.Find(";");
  4930. }
  4931. }
  4932. PrintPreview dlg;
  4933. CPrintRX m_Print;
  4934. m_Print.InitToPrint(NULL, 1);
  4935. m_Print.StartPrint();
  4936. m_Print.StartPage();
  4937. CRect mainrc(0, 0, 560, 793);
  4938. mainrc.DeflateRect(25, 50, 10, 0);
  4939. m_Print.SetFontFace(10, 1, "宋体");
  4940. CRect rc, rc2;
  4941. rc = mainrc;
  4942. rc.bottom = rc.top;
  4943. rc.top -= 20;
  4944. m_Print.DrawText((LPTSTR)(LPCTSTR)client, rc, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4945. rc.bottom -= 5;
  4946. m_Print.DrawRect2(rc, 2);
  4947. if (array->GetSize() > 130)m_Print.SetFontFace(8, 1, "宋体");
  4948. if (bDir)m_Print.SetFontFace(6, 1, "宋体");
  4949. ////////////////////////////////////////////////////////////////
  4950. int imgcount = array->GetSize();
  4951. int dtx = 5;
  4952. int dty = 15;
  4953. int cx, cy;
  4954. int countx = 5;
  4955. int county = 1;
  4956. while (1)
  4957. {
  4958. if (countx*county >= imgcount)
  4959. {
  4960. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  4961. cy = cx * 4 / 3;
  4962. break;
  4963. }
  4964. else
  4965. {
  4966. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  4967. cy = cx * 4 / 3;
  4968. if (cy*(county + 1) + dty*county < mainrc.Height())//Y方向可以增加一个
  4969. {
  4970. county++;
  4971. }
  4972. else//Y方向不能加,X方向加
  4973. {
  4974. countx++;
  4975. county = 1;
  4976. }
  4977. }
  4978. }
  4979. int imgpos = 0;
  4980. CString stemp;
  4981. CPen pen(PS_SOLID, 1, RGB(255, 0, 0));
  4982. CPen *oldpen = m_Print.m_DC.SelectObject(&pen);
  4983. CPen *oldpen2 = m_Print.m_memdc.SelectObject(&pen);
  4984. for (int i = 0; i < county; i++)
  4985. {
  4986. for (int j = 0; j < countx; j++)
  4987. {
  4988. rc = mainrc;
  4989. rc.top += i*(cy + dty);
  4990. rc.left += j*(cx + dtx);
  4991. rc.right = rc.left + cx;
  4992. rc.bottom = rc.top + cy;
  4993. Image *pImg = NULL;
  4994. if (imgpos >= array->GetSize())break;
  4995. CString str = array->ElementAt(imgpos);
  4996. CString spath = str.Left(str.ReverseFind('\\') + 1);
  4997. spath += "m";
  4998. spath += str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  4999. if (PathFileExists(spath))
  5000. ::LoadImageFromBuf(&pImg, spath);
  5001. else
  5002. {
  5003. ::LoadImageFromBuf(&pImg, str);
  5004. if (pImg == NULL)continue;
  5005. int orientation = GetOrientation(pImg);
  5006. if (orientation == 8)
  5007. pImg->RotateFlip(Rotate270FlipNone);
  5008. else if (orientation == 6)
  5009. pImg->RotateFlip(Rotate90FlipNone);
  5010. }
  5011. if (pImg == NULL)continue;
  5012. rc2 = rc;
  5013. RectFitDes(pImg->GetWidth(), pImg->GetHeight(), rc);
  5014. imgpos++;
  5015. m_Print.DrawImage(pImg, rc);
  5016. int imgwidth = pImg->GetWidth();
  5017. delete pImg;
  5018. rc2.top = rc2.bottom + 3;
  5019. rc2.bottom += 10;
  5020. if (bDir == 0)
  5021. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5022. else
  5023. {
  5024. stemp = str.Left(str.ReverseFind('\\'));
  5025. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5026. if (stemp.ReverseFind('\\') != -1)
  5027. {
  5028. stemp = stemp.Right(stemp.GetLength() - stemp.ReverseFind('\\') - 1);
  5029. str = stemp + "\\" + str;
  5030. }
  5031. }
  5032. if (str.Find(".") != -1)
  5033. str = str.Left(str.Find("."));
  5034. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5035. if (noarray.GetSize())
  5036. {
  5037. rc2 = rc;
  5038. for (int aa = 0; aa < noarray.GetSize(); aa++)
  5039. {
  5040. float scale = (float)rc2.Width() / (float)imgwidth;
  5041. if (noarray.ElementAt(aa) == str)
  5042. {
  5043. int nIndex = aa;
  5044. CRect rc = rcarray.ElementAt(nIndex);
  5045. int wid = widtharray.ElementAt(nIndex).left;
  5046. int hei = widtharray.ElementAt(nIndex).top;
  5047. scale *= (float)imgwidth / (float)wid;
  5048. rc.left *= scale;
  5049. rc.right *= scale;
  5050. rc.top *= scale;
  5051. rc.bottom *= scale;
  5052. rc.left += rc2.left;
  5053. rc.right += rc2.left;
  5054. rc.top += rc2.top;
  5055. rc.bottom += rc2.top;
  5056. if (rc.left < rc2.left)rc.left = rc2.left;
  5057. if (rc.right > rc2.right)rc.right = rc2.right;
  5058. if (rc.top < rc2.top)rc.top = rc2.top;
  5059. if (rc.bottom > rc2.bottom)rc.bottom = rc2.bottom;
  5060. m_Print.DrawRect2(rc, 1);
  5061. }
  5062. }
  5063. }
  5064. }
  5065. }
  5066. m_Print.m_DC.SelectObject(oldpen);
  5067. m_Print.m_memdc.SelectObject(oldpen2);
  5068. /* CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  5069. StrRect.top -=15;StrRect.bottom -=15;
  5070. Image *pImg=NULL;
  5071. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  5072. m_Print.DrawImage(pImg, StrRect);
  5073. delete pImg;
  5074. m_Print.SetFontFace(10, 1, "宋体");
  5075. StrRect=load.m_rcarray .ElementAt (20);
  5076. StrRect.right=load.m_rcarray .ElementAt (23).right;
  5077. StrRect.top -=18;StrRect.bottom -=18;
  5078. CString str="地址:"+g_cominfoarray.ElementAt (0).ElementAt (12);
  5079. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5080. */
  5081. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  5082. dlg.m_pDC = m_Print.GetPDC();
  5083. if (dlg.DoModal() != IDOK)
  5084. return;
  5085. //结束打印
  5086. m_Print.EndPage();
  5087. m_Print.EndPrint();
  5088. }
  5089. // remark by Jeff
  5090. // 函数:PrintDinDan
  5091. // 参数:
  5092. // strOrderNumber:订单单号;(Order number)
  5093. // 返回:void
  5094. // 注意:#
  5095. void CMainFrame::PrintDinDan(CString strOrderNumber)//打印订单报表;
  5096. {
  5097. int printcot = 1;
  5098. for (int aa = 0; aa < printcot; aa++)
  5099. {
  5100. PrintPreview dlg;
  5101. CPrintRX m_Print;
  5102. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  5103. {
  5104. m_Print.InitToPrint(NULL, 1);
  5105. }
  5106. else
  5107. {
  5108. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  5109. if (name.IsEmpty())
  5110. m_Print.InitToPrint(NULL, 1);
  5111. else
  5112. {
  5113. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  5114. if (nret == -1 && aa == 0)
  5115. {
  5116. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  5117. }
  5118. }
  5119. }
  5120. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 0)
  5121. {
  5122. #ifdef ZHIAI_VERSION
  5123. PrintDinDan3(strOrderNumber);
  5124. return;
  5125. #endif
  5126. #ifdef SZBLCT_VERSION
  5127. PrintDinDan4(strOrderNumber);
  5128. return;
  5129. #endif
  5130. m_Print.StartPrint();
  5131. m_Print.StartPage();
  5132. LoadRect load;
  5133. load.SetLiaPath("6.lia");
  5134. load.SetMargins(-14, 15);
  5135. if (!load.Load())return;
  5136. LoadRect load2;
  5137. load2.SetLiaPath("7.lia");
  5138. load2.SetMargins(-14, 216 + 15);
  5139. if (!load2.Load())return;
  5140. LoadRect load3;
  5141. load3.SetLiaPath("8.lia");
  5142. load3.SetMargins(-14, 705 + 15);
  5143. if (!load3.Load())return;
  5144. int i;
  5145. //////////////////////////////////////////////////////////////
  5146. CStringArray txarray;
  5147. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  5148. g_sendhead.code[0] = 11;
  5149. g_sendhead.code[1] = 52;
  5150. g_sendhead.code[2] = 50;
  5151. g_sendhead.code[3] = 150;
  5152. g_sendhead.code[4] = 77;
  5153. g_sendhead.code[5] = 4;
  5154. g_sendhead.tabcount = 6;
  5155. g_sendhead.bsql = 0;
  5156. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5157. CArray<CStringArray, CStringArray>sparray;
  5158. CArray<CStringArray, CStringArray>clientarray;
  5159. CArray<CStringArray, CStringArray>phonearray;
  5160. CArray<CStringArray, CStringArray>fgarray;
  5161. CArray<CStringArray, CStringArray>danweiarray;
  5162. CArray<CStringArray, CStringArray>jdarray;
  5163. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5164. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5165. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5166. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5167. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5168. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5169. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5170. CString m_taoxiname;
  5171. if (m_zs.Find("\\") != -1)
  5172. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  5173. else
  5174. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  5175. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5176. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5177. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5178. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5179. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5180. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5181. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5182. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5183. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5184. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5185. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5186. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5187. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5188. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5189. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5190. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5191. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5192. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5193. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5194. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5195. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5196. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5197. if (jdarray.GetSize())
  5198. {
  5199. if (m_bz.IsEmpty() == 0)
  5200. m_bz = "\r\n" + m_bz;
  5201. m_bz += "景点:";
  5202. }
  5203. #ifdef DDF_VERSION
  5204. m_bz += "219店:219路馨园小区对面\r\n";
  5205. m_bz += "金色店:万科金色家园小区东门南走20米荣光社区一楼\r\n";
  5206. m_bz += "万泰店:万泰锦绣华城小区正门\r\n";
  5207. #else
  5208. for (i = 0; i < jdarray.GetSize(); i++)
  5209. {
  5210. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5211. }
  5212. m_bz.TrimRight(";");
  5213. #endif
  5214. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5215. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5216. if (IsHasRights2new(31) == 0)
  5217. {
  5218. m_phone1 = "***";
  5219. m_phone2 = "***";
  5220. }
  5221. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5222. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5223. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  5224. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  5225. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  5226. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  5227. filter = "name='" + m_ren + "'";
  5228. g_sendhead.code[0] = 5;
  5229. g_sendhead.tabcount = 1;
  5230. g_sendhead.bsql = 0;
  5231. int g_nYearposTemp = g_nYearpos;
  5232. g_nYearpos = -1;
  5233. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5234. g_nYearpos = g_nYearposTemp;
  5235. if (g_bSendOK == 0)return;
  5236. DataToArray(&phonearray);
  5237. m_money1.Format("%f", atof(m_taoxijiage));
  5238. m_money2.Format("%f", atof(m_payed1));
  5239. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5240. ConvertToPrice(m_money1);
  5241. ConvertToPrice(m_money2);
  5242. ConvertToPrice(m_money3);
  5243. ////////////////////////////////////////////////////////////////
  5244. int rcpos = -1;
  5245. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  5246. StrRect.top -= 15; StrRect.bottom -= 15;
  5247. Image *pImg = NULL;
  5248. #ifdef MNLS_VERSION
  5249. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  5250. #else
  5251. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  5252. #endif
  5253. m_Print.DrawImage(pImg, StrRect);
  5254. delete pImg;
  5255. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5256. {
  5257. Image *pImg = NULL;
  5258. g_nSendCode = 31;
  5259. int g_nYearposTemp = g_nYearpos;
  5260. g_nYearpos = -1;
  5261. g_pMainWnd->ProcessChatMessageRequest2(1);
  5262. g_nYearpos = g_nYearposTemp;
  5263. g_nSendCode = 0;
  5264. if (g_bSendOK == 0)return;
  5265. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5266. if (pImg)
  5267. {
  5268. StrRect.left = 30;
  5269. StrRect.top = 12;
  5270. StrRect.right = StrRect.left + 60;
  5271. StrRect.bottom = StrRect.top + 60;
  5272. m_Print.DrawImage(pImg, StrRect);
  5273. delete pImg; pImg = NULL;
  5274. }
  5275. }
  5276. m_Print.SetFontFace(11, 1, "宋体");
  5277. StrRect = load.m_rcarray.ElementAt(20);
  5278. StrRect.right = load.m_rcarray.ElementAt(23).right;
  5279. StrRect.top -= 18; StrRect.bottom -= 18;
  5280. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  5281. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5282. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  5283. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5284. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5285. StrRect.top -= 15; StrRect.bottom -= 15;
  5286. #ifdef MNLS_VERSION
  5287. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5288. #endif
  5289. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5290. StrRect.top -= 15; StrRect.bottom -= 15;
  5291. #ifdef MNLS_VERSION
  5292. m_Print.DrawRect(StrRect);
  5293. #endif
  5294. m_Print.SetFontFace(7, 1, "黑体");
  5295. m_Print.SetColor(0xffffff);
  5296. #ifdef MNLS_VERSION
  5297. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5298. #endif
  5299. m_Print.SetColor(0);
  5300. m_Print.SetFontFace(15, 1, "宋体");
  5301. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5302. StrRect.top -= 15; StrRect.bottom -= 15;
  5303. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同预约订单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5304. CStringArray strarray;
  5305. strarray.Add("NO: " + strOrderNumber);
  5306. CString date;
  5307. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  5308. strarray.Add(date);
  5309. strarray.Add("喜爱");
  5310. strarray.Add("格调");
  5311. if (fgarray.GetSize() == 12)
  5312. {
  5313. for (int i = 0; i < 12; i++)
  5314. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  5315. }
  5316. else
  5317. {
  5318. strarray.Add("复古典雅");
  5319. strarray.Add("温文尔雅");
  5320. strarray.Add("豪华艳丽");
  5321. strarray.Add("传统大方");
  5322. strarray.Add("新潮个性");
  5323. strarray.Add("浪漫奔放");
  5324. strarray.Add("简单素雅");
  5325. strarray.Add("活泼俏丽");
  5326. strarray.Add("妩媚温馨");
  5327. strarray.Add("温柔贤惠");
  5328. strarray.Add("成熟感性");
  5329. strarray.Add("清纯可爱");
  5330. }
  5331. strarray.Add("姓名");
  5332. // strarray.Add("职业");
  5333. strarray.Add("");
  5334. strarray.Add("地址");
  5335. strarray.Add("电话");
  5336. #ifdef CHILD_VERSION
  5337. strarray.Add("家长");
  5338. strarray.Add("宝宝");
  5339. #else
  5340. strarray.Add("先生");
  5341. strarray.Add("女士");
  5342. #endif
  5343. m_Print.SetFontFace(11, 1, "宋体");
  5344. for (i = 0; i < strarray.GetSize(); i++)
  5345. {
  5346. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5347. if (i < 2)
  5348. {
  5349. StrRect.top -= 15; StrRect.bottom -= 15;
  5350. }
  5351. if (i>15)
  5352. m_Print.DrawRect2(StrRect, 1);
  5353. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5354. }
  5355. for (i = 29; i <= 40; i++)
  5356. {
  5357. if (m_style.GetLength() <= (i - 29))continue;
  5358. if (m_style.GetAt(i - 29) != '1')continue;
  5359. StrRect = load.m_rcarray.ElementAt(i - 1);
  5360. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5361. }
  5362. for (i = 27; i <= 48; i++)
  5363. {
  5364. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5365. m_Print.DrawRect2(StrRect, 1);
  5366. }
  5367. #ifdef CHILD_VERSION
  5368. StrRect = load.m_rcarray.ElementAt(45);
  5369. StrRect.right = StrRect.left + 62;
  5370. m_Print.DrawRect2(StrRect, 1);
  5371. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5372. StrRect.left = StrRect.right;
  5373. StrRect.right = StrRect.left + 62;
  5374. m_Print.DrawRect2(StrRect, 1);
  5375. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5376. StrRect.left = StrRect.right;
  5377. StrRect.right = StrRect.left + 62;
  5378. m_Print.DrawRect2(StrRect, 1);
  5379. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5380. StrRect.left = StrRect.right;
  5381. StrRect.right = StrRect.left + 62;
  5382. m_Print.DrawRect2(StrRect, 1);
  5383. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5384. #endif
  5385. /////////////////////////
  5386. strarray.RemoveAll();
  5387. CString temp;
  5388. temp.Format("拍摄多款选 %d 款,其中影", atoi(m_outside) + atoi(m_outside2));
  5389. strarray.Add(temp);
  5390. temp.Format("棚景 %d 款,景点 %d 款.", atoi(m_outside2), atoi(m_outside));
  5391. strarray.Add(temp);
  5392. strarray.Add("化妆");
  5393. strarray.Add("造型");
  5394. #ifdef CHILD_VERSION
  5395. strarray.Add("");
  5396. #else
  5397. strarray.Add("婚纱");
  5398. #endif
  5399. strarray.Add("服饰");
  5400. strarray.Add("配");
  5401. strarray.Add("置");
  5402. strarray.Add("其");
  5403. strarray.Add("它");
  5404. strarray.Add("套系名称");
  5405. strarray.Add("镜款");
  5406. strarray.Add("套系总价");
  5407. strarray.Add("主摄影师");
  5408. strarray.Add("拍摄日期");
  5409. strarray.Add("定金");
  5410. #ifdef CHILD_VERSION
  5411. strarray.Add("主引导师");
  5412. #else
  5413. strarray.Add("主化妆师");
  5414. #endif
  5415. strarray.Add("看样日期");
  5416. strarray.Add("欠款余额");
  5417. strarray.Add("总监");
  5418. strarray.Add("取件日期");
  5419. rcpos = -1;
  5420. for (i = 0; i < strarray.GetSize(); i++)
  5421. {
  5422. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5423. if (i>9)
  5424. m_Print.DrawRect2(StrRect, 1);
  5425. #ifdef CHILD_VERSION
  5426. if (i == 5)
  5427. StrRect.top -= StrRect.Height();
  5428. #endif
  5429. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5430. }
  5431. for (i = 22; i <= 41; i++)
  5432. {
  5433. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5434. m_Print.DrawRect2(StrRect, 1);
  5435. }
  5436. /////////////////////////////
  5437. strarray.RemoveAll();
  5438. #ifdef CHILD_VERSION
  5439. strarray.Add("顾客方 家长:");
  5440. strarray.Add("宝宝:");
  5441. #else
  5442. strarray.Add("顾客方 先生:");
  5443. strarray.Add("女士:");
  5444. #endif
  5445. strarray.Add("电话:");
  5446. strarray.Add("影楼方 店长:");
  5447. strarray.Add("接单人:");
  5448. strarray.Add("电话:");
  5449. rcpos = -1;
  5450. for (i = 0; i < strarray.GetSize(); i++)
  5451. {
  5452. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5453. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5454. }
  5455. for (i = 7; i <= 12; i++)
  5456. {
  5457. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5458. // if(i!=10)
  5459. m_Print.DrawRect2(StrRect, 2);
  5460. }
  5461. //////////////////////////////////////
  5462. //开始打数据
  5463. strarray.RemoveAll();
  5464. strarray.Add(m_name1);
  5465. strarray.Add(m_name2);
  5466. /// strarray.Add (m_occupation1);
  5467. // strarray.Add (m_occupation2);
  5468. strarray.Add("");
  5469. strarray.Add("");
  5470. strarray.Add(m_addr1);
  5471. #ifdef CHILD_VERSION
  5472. strarray.Add("");
  5473. #else
  5474. strarray.Add(m_addr2);
  5475. #endif
  5476. strarray.Add(m_phone1);
  5477. strarray.Add(m_phone2);
  5478. for (i = 41; i <= 48; i++)
  5479. {
  5480. StrRect = load.m_rcarray.ElementAt(i - 1);
  5481. StrRect.left += 4;
  5482. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5483. }
  5484. ///////////////////////////////
  5485. strarray.RemoveAll();
  5486. strarray.Add(m_money1);
  5487. strarray.Add(m_waiter1);
  5488. strarray.Add(m_time2);
  5489. strarray.Add(m_money2);
  5490. strarray.Add(m_waiter2);
  5491. strarray.Add(m_time4);
  5492. strarray.Add(m_money3);
  5493. strarray.Add("");
  5494. strarray.Add(m_time5);
  5495. for (i = 32; i <= 40; i++)
  5496. {
  5497. StrRect = load2.m_rcarray.ElementAt(i - 1);
  5498. StrRect.left += 4;
  5499. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5500. }
  5501. ///////////////////////////////
  5502. strarray.RemoveAll();
  5503. strarray.Add(m_name1);
  5504. strarray.Add(m_name2);
  5505. CString phone;
  5506. if (m_phone1.IsEmpty() == 0)
  5507. phone = m_phone1 + ",";
  5508. phone += m_phone2;
  5509. phone.TrimRight(",");
  5510. strarray.Add(phone);
  5511. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  5512. strarray.Add(m_ren);
  5513. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  5514. for (i = 7; i <= 12; i++)
  5515. {
  5516. StrRect = load3.m_rcarray.ElementAt(i - 1);
  5517. StrRect.left += 4;
  5518. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5519. }
  5520. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  5521. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5522. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  5523. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5524. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  5525. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5526. //////////////////////////////
  5527. //开始画文字
  5528. StrRect = load2.m_rcarray.ElementAt(30);
  5529. StrRect.left += 3;
  5530. StrRect.top += 3;
  5531. StrRect.right -= 2;
  5532. StrRect.bottom -= 2;
  5533. AutoDraw(m_Print, StrRect, m_bz, 1.4f);
  5534. StrRect = load2.m_rcarray.ElementAt(29);
  5535. StrRect.left += 3;
  5536. StrRect.top += 3;
  5537. StrRect.right -= 2;
  5538. StrRect.bottom -= 2;
  5539. str = "";
  5540. for (i = 0; i < sparray.GetSize(); i++)
  5541. {
  5542. str += sparray.ElementAt(i).ElementAt(5);
  5543. str += " 数量:";
  5544. str += sparray.ElementAt(i).ElementAt(3);
  5545. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5546. str += "\r\n";
  5547. }
  5548. str.TrimRight("\r\n");
  5549. AutoDraw(m_Print, StrRect, str, 1.4);
  5550. StrRect = load2.m_rcarray.ElementAt(40);
  5551. StrRect.top += 8;
  5552. m_Print.SetFontFace(12, 1, "黑体");
  5553. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5554. StrRect.left += 3;
  5555. StrRect.top += 30;
  5556. StrRect.right -= 2;
  5557. StrRect.bottom -= 2;
  5558. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5559. if (str.IsEmpty())
  5560. {
  5561. str = "\
  5562. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5563. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5564. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5565. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5566. 持良好的心境.\r\n\
  5567. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5568. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5569. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5570. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5571. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5572. 勿进影室, 以免影响拍摄.\r\n\
  5573. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5574. 师或店长沟通.\r\n\
  5575. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5576. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5577. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5578. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5579. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5580. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5581. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5582. 还.";
  5583. }
  5584. AutoDraw(m_Print, StrRect, str, 1.8);
  5585. }
  5586. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 1)
  5587. {//AfxMessageBox("yyy");
  5588. m_Print.StartPrint();
  5589. m_Print.StartPage();
  5590. LoadRect load;
  5591. load.SetLiaPath("6-2.lia");
  5592. load.SetMargins(0, 0);
  5593. if (!load.Load())return;
  5594. int i;
  5595. //////////////////////////////////////////////////////////////
  5596. CStringArray txarray;
  5597. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  5598. g_sendhead.code[0] = 11;
  5599. g_sendhead.code[1] = 52;
  5600. g_sendhead.code[2] = 50;
  5601. g_sendhead.code[3] = 150;
  5602. g_sendhead.code[4] = 77;
  5603. g_sendhead.code[5] = 4;
  5604. g_sendhead.tabcount = 6;
  5605. g_sendhead.bsql = 0;
  5606. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5607. CArray<CStringArray, CStringArray>sparray;
  5608. CArray<CStringArray, CStringArray>clientarray;
  5609. CArray<CStringArray, CStringArray>phonearray;
  5610. CArray<CStringArray, CStringArray>fgarray;
  5611. CArray<CStringArray, CStringArray>danweiarray;
  5612. CArray<CStringArray, CStringArray>jdarray;
  5613. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5614. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5615. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5616. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5617. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5618. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5619. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  5620. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5621. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5622. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5623. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5624. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5625. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5626. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5627. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5628. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5629. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5630. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5631. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5632. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5633. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5634. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5635. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5636. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5637. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5638. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5639. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5640. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5641. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5642. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5643. if (jdarray.GetSize())
  5644. {
  5645. if (m_bz.IsEmpty() == 0)
  5646. m_bz = "\r\n" + m_bz;
  5647. m_bz += "景点:";
  5648. }
  5649. for (i = 0; i < jdarray.GetSize(); i++)
  5650. {
  5651. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5652. }
  5653. m_bz.TrimRight(";");
  5654. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5655. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5656. if (IsHasRights2new(31) == 0)
  5657. {
  5658. m_phone1 = "***";
  5659. m_phone2 = "***";
  5660. }
  5661. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5662. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5663. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  5664. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  5665. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  5666. CString str;
  5667. filter = "name='" + m_ren + "'";
  5668. g_sendhead.code[0] = 5;
  5669. g_sendhead.tabcount = 1;
  5670. g_sendhead.bsql = 0;
  5671. int g_nYearposTemp = g_nYearpos;
  5672. g_nYearpos = -1;
  5673. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5674. g_nYearpos = g_nYearposTemp;
  5675. if (g_bSendOK == 0)return;
  5676. DataToArray(&phonearray);
  5677. m_money1.Format("%f", atof(m_taoxijiage));
  5678. m_money2.Format("%f", atof(m_payed1));
  5679. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5680. ConvertToPrice(m_money1);
  5681. ConvertToPrice(m_money2);
  5682. ConvertToPrice(m_money3);
  5683. ////////////////////////////////////////////////////////////////
  5684. int rcpos = -1;
  5685. CRect StrRect = load.m_rcarray.ElementAt(0);
  5686. m_Print.SetFontFace(25, 1, "黑体");
  5687. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "预约单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5688. m_Print.SetFontFace(11, 1, "宋体");
  5689. StrRect = load.m_rcarray.ElementAt(1);
  5690. if (m_time1.GetLength() == 10)
  5691. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  5692. else
  5693. str = "开单日期:";
  5694. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5695. StrRect = load.m_rcarray.ElementAt(2);
  5696. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + strOrderNumber), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5697. CStringArray strarray;
  5698. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5699. {
  5700. Image *pImg = NULL;
  5701. g_nSendCode = 31;
  5702. int g_nYearposTemp = g_nYearpos;
  5703. g_nYearpos = -1;
  5704. g_pMainWnd->ProcessChatMessageRequest2(1);
  5705. g_nYearpos = g_nYearposTemp;
  5706. g_nSendCode = 0;
  5707. if (g_bSendOK == 0)return;
  5708. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5709. if (pImg)
  5710. {
  5711. StrRect.left = 47;
  5712. StrRect.top = 12;
  5713. StrRect.right = StrRect.left + 60;
  5714. StrRect.bottom = StrRect.top + 60;
  5715. m_Print.DrawImage(pImg, StrRect);
  5716. delete pImg; pImg = NULL;
  5717. }
  5718. }
  5719. #ifdef CHILD_VERSION
  5720. strarray.Add("家长姓名");
  5721. strarray.Add("宝宝姓名");
  5722. #else
  5723. strarray.Add("先生姓名");
  5724. strarray.Add("女士姓名");
  5725. #endif
  5726. strarray.Add("服装套数");
  5727. // strarray.Add ("拍摄张数");
  5728. #ifdef CHILD_VERSION
  5729. strarray.Add("出生日期");
  5730. #else
  5731. strarray.Add("结婚日期");
  5732. #endif
  5733. strarray.Add("拍摄日期");
  5734. strarray.Add("联系电话");
  5735. strarray.Add("联系电话");
  5736. strarray.Add("造型套数");
  5737. if (m_zs.Find("\\") != -1)
  5738. strarray.Add("入底\\入册");
  5739. else
  5740. strarray.Add("入底张数");
  5741. strarray.Add("选片日期");
  5742. strarray.Add("QQ/邮箱");
  5743. strarray.Add("套系总额");
  5744. strarray.Add("定金");
  5745. strarray.Add("余款金额");
  5746. strarray.Add("取件日期");
  5747. strarray.Add(m_name1);
  5748. strarray.Add(m_name2);
  5749. strarray.Add(m_clothescount);
  5750. // str.Format("%d", atoi(m_zs)*3);
  5751. // strarray.Add (str);
  5752. #ifdef CHILD_VERSION
  5753. strarray.Add(m_birthday1);
  5754. #else
  5755. strarray.Add(m_time3);
  5756. #endif
  5757. strarray.Add(m_time2);
  5758. strarray.Add(m_phone1);
  5759. strarray.Add(m_phone2);
  5760. strarray.Add(m_clothescount2);
  5761. strarray.Add(m_zs);
  5762. strarray.Add(m_time4);
  5763. strarray.Add(m_qq1);
  5764. strarray.Add(m_money1);
  5765. strarray.Add(m_money2);
  5766. strarray.Add(m_money3);
  5767. strarray.Add(m_time5);
  5768. for (i = 4; i <= 33; i++)
  5769. {
  5770. StrRect = load.m_rcarray.ElementAt(i - 1);
  5771. m_Print.DrawRect2(StrRect, 1);
  5772. if (strarray.GetSize() > (i - 4))
  5773. {
  5774. if (i <= 18)
  5775. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5776. else
  5777. {
  5778. StrRect.left += 4;
  5779. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5780. }
  5781. }
  5782. }
  5783. int dt = 413;
  5784. StrRect = load.m_rcarray.ElementAt(36); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5785. m_Print.DrawText((LPTSTR)(LPCTSTR)"门市签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5786. StrRect = load.m_rcarray.ElementAt(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5787. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5788. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5789. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5790. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  5791. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5792. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  5793. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5794. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  5795. m_Print.DrawText((LPTSTR)(LPCTSTR)("网址:" + g_cominfoarray.ElementAt(0).ElementAt(13)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5796. //////////////////////////////
  5797. //开始画文字
  5798. StrRect = load.m_rcarray.ElementAt(7);
  5799. int hei = StrRect.Height();
  5800. StrRect.top += hei;
  5801. StrRect.bottom += hei;
  5802. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5803. StrRect.top += dt;
  5804. StrRect.bottom += dt;
  5805. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5806. StrRect = load.m_rcarray.ElementAt(17);
  5807. StrRect.top += hei;
  5808. StrRect.bottom += hei;
  5809. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5810. StrRect = load.m_rcarray.ElementAt(33);
  5811. StrRect.bottom = StrRect.top + dt; m_Print.DrawRect2(StrRect, 1);
  5812. StrRect.top += hei;
  5813. StrRect.left += 3;
  5814. StrRect.top += 3;
  5815. StrRect.right -= 2;
  5816. StrRect.bottom -= 2;
  5817. str = "";
  5818. for (i = 0; i < sparray.GetSize(); i++)
  5819. {
  5820. str += sparray.ElementAt(i).ElementAt(5);
  5821. str += " 数量:";
  5822. str += sparray.ElementAt(i).ElementAt(3);
  5823. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5824. str += "\r\n";
  5825. }
  5826. str.TrimRight("\r\n");
  5827. AutoDraw(m_Print, StrRect, str, 1.4);
  5828. StrRect = load.m_rcarray.ElementAt(33);
  5829. StrRect.top += dt;
  5830. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5831. StrRect.top += hei;
  5832. StrRect.left += 3;
  5833. StrRect.top += 3;
  5834. StrRect.right -= 2;
  5835. StrRect.bottom -= 2;
  5836. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  5837. StrRect = load.m_rcarray.ElementAt(34);
  5838. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5839. StrRect.top += hei;
  5840. StrRect.left += 3;
  5841. StrRect.top += 3;
  5842. StrRect.right -= 2;
  5843. StrRect.bottom -= 2;
  5844. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5845. if (str.IsEmpty())
  5846. {
  5847. str = "\
  5848. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5849. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5850. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5851. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5852. 持良好的心境.\r\n\
  5853. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5854. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5855. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5856. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5857. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5858. 勿进影室, 以免影响拍摄.\r\n\
  5859. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5860. 师或店长沟通.\r\n\
  5861. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5862. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5863. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5864. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5865. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5866. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5867. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5868. 还.";
  5869. }
  5870. AutoDraw(m_Print, StrRect, str, 1.8);
  5871. StrRect = load.m_rcarray.ElementAt(35);
  5872. StrRect.bottom += 100;
  5873. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  5874. 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∨";
  5875. // AutoDraw(m_Print, StrRect, str, 1.4);
  5876. }
  5877. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 2)
  5878. {
  5879. PrintDinDan5(strOrderNumber);
  5880. return;
  5881. }
  5882. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  5883. {
  5884. PrintDinDan6(strOrderNumber);
  5885. return;
  5886. }
  5887. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  5888. dlg.m_pDC = m_Print.GetPDC();
  5889. dlg.m_mode = 1;
  5890. if (aa == 0)
  5891. {
  5892. if (dlg.DoModal() != IDOK)
  5893. return;
  5894. printcot = dlg.m_num;
  5895. }
  5896. //结束打印
  5897. m_Print.EndPage();
  5898. m_Print.EndPrint();
  5899. }
  5900. }
  5901. void CovertDate2(CString date, CString &date2)
  5902. {
  5903. try
  5904. {
  5905. if (date == "2013-04-09")
  5906. {
  5907. date2 = "2013-02-29";
  5908. return;
  5909. }
  5910. ///////////////////////////////////
  5911. date2 = date;
  5912. GongToLong(date2);
  5913. ////////////////////////////////////
  5914. return;
  5915. CCalendarConvert m_CalendarConvert;
  5916. SYSTEMTIME src = { 0 };
  5917. SYSTEMTIME dst = { 0 };
  5918. COleDateTime m_timeLunar(atoi(date.Mid(0, 4)), atoi(date.Mid(5, 2)), atoi(date.Mid(8, 2)), 0, 0, 0);
  5919. COleDateTime m_timeGregorian;
  5920. m_timeLunar.GetAsSystemTime(src);
  5921. BOOL bEmbolism = 0;
  5922. if (m_CalendarConvert.Gregorian2Lunar(&src, &dst, &bEmbolism))
  5923. {
  5924. m_timeGregorian = m_CalendarConvert.ConvertSysTime2OleDateTime(&dst);
  5925. date2.Format("%04d-%02d-%02d", m_timeGregorian.GetYear(), m_timeGregorian.GetMonth(), m_timeGregorian.GetDay());
  5926. if (m_timeGregorian.GetYear() == -1)date2 = "2000-13-32";
  5927. }
  5928. else
  5929. {
  5930. date2.Empty();
  5931. }
  5932. }
  5933. catch (...)
  5934. {
  5935. }
  5936. }
  5937. void CMainFrame::PrintDinDan5(CString m_id)
  5938. {
  5939. int printcot = 1;
  5940. for (int aa = 0; aa < printcot; aa++)
  5941. {
  5942. PrintPreview dlg;
  5943. CPrintRX m_Print;
  5944. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  5945. {
  5946. m_Print.InitToPrint(NULL, 1);
  5947. }
  5948. else
  5949. {
  5950. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  5951. if (name.IsEmpty())
  5952. m_Print.InitToPrint(NULL, 1);
  5953. else
  5954. {
  5955. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  5956. if (nret == -1 && aa == 0)
  5957. {
  5958. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  5959. }
  5960. }
  5961. }
  5962. {
  5963. m_Print.StartPrint();
  5964. m_Print.StartPage();
  5965. LoadRect load;
  5966. load.SetLiaPath("19.lia");
  5967. load.SetMargins(0, -20);
  5968. if (!load.Load())return;
  5969. int i;
  5970. //////////////////////////////////////////////////////////////
  5971. CStringArray txarray;
  5972. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  5973. g_sendhead.code[0] = 11;
  5974. g_sendhead.code[1] = 52;
  5975. g_sendhead.code[2] = 50;
  5976. g_sendhead.code[3] = 150;
  5977. g_sendhead.code[4] = 77;
  5978. g_sendhead.code[5] = 4;
  5979. g_sendhead.tabcount = 6;
  5980. g_sendhead.bsql = 0;
  5981. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5982. CArray<CStringArray, CStringArray>sparray;
  5983. CArray<CStringArray, CStringArray>clientarray;
  5984. CArray<CStringArray, CStringArray>phonearray;
  5985. CArray<CStringArray, CStringArray>fgarray;
  5986. CArray<CStringArray, CStringArray>danweiarray;
  5987. CArray<CStringArray, CStringArray>jdarray;
  5988. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5989. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5990. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5991. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5992. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5993. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5994. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  5995. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5996. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5997. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5998. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5999. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  6000. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  6001. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  6002. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  6003. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  6004. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  6005. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  6006. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  6007. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  6008. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  6009. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  6010. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  6011. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  6012. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  6013. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  6014. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  6015. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  6016. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(36);
  6017. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  6018. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6019. CString m_txtype = g_List1array.ElementAt(0).ElementAt(52);
  6020. CString m_memberno = g_List1array.ElementAt(0).ElementAt(47);
  6021. CString str;
  6022. if (jdarray.GetSize())
  6023. {
  6024. if (m_bz.IsEmpty() == 0)
  6025. m_bz = "\r\n" + m_bz;
  6026. m_bz += "景点:";
  6027. }
  6028. for (i = 0; i < jdarray.GetSize(); i++)
  6029. {
  6030. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  6031. }
  6032. m_bz.TrimRight(";");
  6033. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  6034. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  6035. if (IsHasRights2new(31) == 0)
  6036. {
  6037. m_phone1 = "***";
  6038. m_phone2 = "***";
  6039. }
  6040. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  6041. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  6042. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  6043. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  6044. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  6045. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  6046. BOOL check1 = atoi(clientarray.ElementAt(0).ElementAt(15));
  6047. filter = "name='" + m_ren + "'";
  6048. g_sendhead.code[0] = 5;
  6049. g_sendhead.tabcount = 1;
  6050. g_sendhead.bsql = 0;
  6051. int g_nYearposTemp = g_nYearpos;
  6052. g_nYearpos = -1;
  6053. g_pMainWnd->ProcessChatMessageRequest2(filter);
  6054. g_nYearpos = g_nYearposTemp;
  6055. if (g_bSendOK == 0)return;
  6056. DataToArray(&phonearray);
  6057. m_money1.Format("%f", atof(m_taoxijiage));
  6058. m_money2.Format("%f", atof(m_payed1));
  6059. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  6060. ConvertToPrice(m_money1);
  6061. ConvertToPrice(m_money2);
  6062. ConvertToPrice(m_money3);
  6063. ////////////////////////////////////////////////////////////////
  6064. int rcpos = -1;
  6065. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6066. //Image *pImg=NULL;
  6067. // ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  6068. // m_Print.DrawImage(pImg, StrRect);
  6069. // delete pImg;
  6070. m_Print.SetFontFace(20, 1, "宋体");
  6071. StrRect = load.m_rcarray.ElementAt(1);
  6072. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "定单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6073. m_Print.SetFontFace(12, 1, "宋体");
  6074. StrRect = load.m_rcarray.ElementAt(2);
  6075. m_Print.DrawText((LPTSTR)(LPCTSTR)("NO." + m_id), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6076. StrRect = load.m_rcarray.ElementAt(3);
  6077. str.Format("%s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  6078. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6079. StrRect = load.m_rcarray.ElementAt(4);
  6080. m_Print.DrawText((LPTSTR)(LPCTSTR)("联系人:" + m_name1), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6081. CStringArray strarray;
  6082. strarray.Add("姓名");
  6083. strarray.Add("性别");
  6084. strarray.Add("年龄");
  6085. strarray.Add("出生年月");
  6086. strarray.Add("套系价格");
  6087. strarray.Add("定金");
  6088. strarray.Add("欠款");
  6089. strarray.Add("拍摄类型");
  6090. strarray.Add("会员卡号");
  6091. strarray.Add("定单人");
  6092. strarray.Add("入底\\入册");
  6093. strarray.Add("联系电话");
  6094. for (i = 6; i <= 17; i++)
  6095. {
  6096. StrRect = load.m_rcarray.ElementAt(i - 1);
  6097. m_Print.DrawRect2(StrRect, 1);
  6098. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 6), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6099. }
  6100. strarray.RemoveAll();
  6101. strarray.Add(m_name2);
  6102. strarray.Add(m_sex);
  6103. if (m_birthday.GetLength() != 10)
  6104. strarray.Add("");
  6105. else
  6106. {
  6107. int year = 0;
  6108. if (check1)
  6109. {
  6110. CString date2;
  6111. CovertDate2(g_date, date2);
  6112. year = atoi(date2.Left(4)) - atoi(m_birthday.Left(4));
  6113. if (date2.Right(5) >= m_birthday.Right(5))
  6114. year++;
  6115. }
  6116. else
  6117. {
  6118. year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  6119. if (g_date.Right(5) >= m_birthday.Right(5))
  6120. year++;
  6121. }
  6122. str.Format("%d", year);
  6123. strarray.Add(str);
  6124. }
  6125. strarray.Add(m_birthday);
  6126. strarray.Add(m_money1);
  6127. strarray.Add(m_money2);
  6128. strarray.Add(m_money3);
  6129. strarray.Add(m_txtype);
  6130. strarray.Add(m_memberno);
  6131. strarray.Add(m_ren);
  6132. strarray.Add(m_zs);
  6133. if (!m_phone1.IsEmpty())
  6134. strarray.Add(m_phone1);
  6135. else
  6136. strarray.Add(m_phone2);
  6137. for (i = 18; i <= 29; i++)
  6138. {
  6139. StrRect = load.m_rcarray.ElementAt(i - 1);
  6140. m_Print.DrawRect2(StrRect, 1);
  6141. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6142. }
  6143. strarray.RemoveAll();
  6144. strarray.Add("摄影师");
  6145. strarray.Add("拍照时间");
  6146. strarray.Add("选片人");
  6147. strarray.Add("选片时间");
  6148. strarray.Add("引导师");
  6149. strarray.Add("设计师");
  6150. strarray.Add("取件时间");
  6151. strarray.Add("顾客签字");
  6152. for (i = 34; i <= 41; i++)
  6153. {
  6154. StrRect = load.m_rcarray.ElementAt(i - 1);
  6155. m_Print.DrawRect2(StrRect, 1);
  6156. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 34), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6157. }
  6158. strarray.RemoveAll();
  6159. strarray.Add(m_waiter1);
  6160. strarray.Add(m_time2);
  6161. strarray.Add(m_waiter3);
  6162. strarray.Add(m_time4);
  6163. strarray.Add(m_waiter2);
  6164. strarray.Add(m_waiter4);
  6165. strarray.Add(m_time5);
  6166. strarray.Add("");
  6167. for (i = 42; i <= 49; i++)
  6168. {
  6169. StrRect = load.m_rcarray.ElementAt(i - 1);
  6170. m_Print.DrawRect2(StrRect, 1);
  6171. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6172. }
  6173. m_Print.SetFontFace(15, 1, "宋体");
  6174. StrRect = load.m_rcarray.ElementAt(29);
  6175. m_Print.DrawRect2(StrRect, 1);
  6176. StrRect.top += 45;
  6177. m_Print.DrawText((LPTSTR)(LPCTSTR)"拍", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6178. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6179. m_Print.DrawText((LPTSTR)(LPCTSTR)"内", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6180. m_Print.DrawText((LPTSTR)(LPCTSTR)"容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  6181. StrRect = load.m_rcarray.ElementAt(30);
  6182. m_Print.DrawRect2(StrRect, 1);
  6183. StrRect.top += 45;
  6184. m_Print.DrawText((LPTSTR)(LPCTSTR)"友", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6185. m_Print.DrawText((LPTSTR)(LPCTSTR)"情", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6186. m_Print.DrawText((LPTSTR)(LPCTSTR)"提", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6187. m_Print.DrawText((LPTSTR)(LPCTSTR)"示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  6188. m_Print.SetFontFace(10, 1, "宋体");
  6189. StrRect = load.m_rcarray.ElementAt(37); StrRect.top = StrRect.bottom + 2;
  6190. str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  6191. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  6192. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  6193. StrRect = load.m_rcarray.ElementAt(48); StrRect.top = StrRect.bottom + 2; StrRect.left -= 200;
  6194. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  6195. //开始画文字
  6196. StrRect = load.m_rcarray.ElementAt(31);
  6197. StrRect.left += 3;
  6198. StrRect.top += 3;
  6199. StrRect.right -= 2;
  6200. StrRect.bottom -= 2;
  6201. str = "";
  6202. for (i = 0; i < sparray.GetSize(); i++)
  6203. {
  6204. str += sparray.ElementAt(i).ElementAt(5);
  6205. str += " 数量:";
  6206. str += sparray.ElementAt(i).ElementAt(3);
  6207. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6208. str += "\r\n";
  6209. }
  6210. str.TrimRight("\r\n");
  6211. m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6212. m_bz.TrimLeft();
  6213. if (m_bz != "")
  6214. {
  6215. str += "\r\n"; str += "\r\n";
  6216. str += "备注:" + m_bz;
  6217. }
  6218. AutoDraw(m_Print, StrRect, str, 1.4);
  6219. StrRect = load.m_rcarray.ElementAt(32); m_Print.DrawRect2(StrRect, 1);
  6220. StrRect.left += 3;
  6221. StrRect.top += 3;
  6222. StrRect.right -= 2;
  6223. StrRect.bottom -= 2;
  6224. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6225. if (str.IsEmpty())
  6226. {
  6227. str = "\
  6228. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6229. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6230. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6231. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6232. 持良好的心境.\r\n\
  6233. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6234. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6235. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6236. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6237. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6238. 勿进影室, 以免影响拍摄.\r\n\
  6239. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6240. 师或店长沟通.\r\n\
  6241. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6242. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6243. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6244. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6245. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6246. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6247. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6248. 还.";
  6249. }
  6250. AutoDraw(m_Print, StrRect, str, 1.8);
  6251. }
  6252. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6253. dlg.m_pDC = m_Print.GetPDC();
  6254. dlg.m_mode = 1;
  6255. if (aa == 0)
  6256. {
  6257. if (dlg.DoModal() != IDOK)
  6258. return;
  6259. printcot = dlg.m_num;
  6260. }
  6261. //结束打印
  6262. m_Print.EndPage();
  6263. m_Print.EndPrint();
  6264. }
  6265. }
  6266. void CMainFrame::PrintDinDan4(CString m_id)
  6267. {
  6268. // TODO: Add your control notification handler code here
  6269. CPrintRX m_Print;
  6270. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6271. {
  6272. m_Print.InitToPrint(NULL, 1);
  6273. }
  6274. else
  6275. {
  6276. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  6277. if (name.IsEmpty())
  6278. m_Print.InitToPrint(NULL, 1);
  6279. else
  6280. {
  6281. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6282. if (nret == -1)
  6283. {
  6284. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6285. }
  6286. }
  6287. }
  6288. m_Print.StartPrint();
  6289. m_Print.StartPage();
  6290. LoadRect load;
  6291. load.SetLiaPath("6-2.lia");
  6292. load.SetMargins(0, 0);
  6293. if (!load.Load())return;
  6294. int i;
  6295. //////////////////////////////////////////////////////////////
  6296. CStringArray txarray;
  6297. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  6298. g_sendhead.code[0] = 11;
  6299. g_sendhead.code[1] = 52;
  6300. g_sendhead.code[2] = 50;
  6301. g_sendhead.code[3] = 150;
  6302. g_sendhead.code[4] = 77;
  6303. g_sendhead.code[5] = 4;
  6304. g_sendhead.tabcount = 6;
  6305. g_sendhead.bsql = 0;
  6306. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  6307. CArray<CStringArray, CStringArray>sparray;
  6308. CArray<CStringArray, CStringArray>clientarray;
  6309. CArray<CStringArray, CStringArray>phonearray;
  6310. CArray<CStringArray, CStringArray>fgarray;
  6311. CArray<CStringArray, CStringArray>danweiarray;
  6312. CArray<CStringArray, CStringArray>jdarray;
  6313. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  6314. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  6315. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  6316. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  6317. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  6318. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  6319. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  6320. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  6321. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  6322. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  6323. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  6324. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  6325. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  6326. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  6327. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  6328. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  6329. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  6330. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  6331. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  6332. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  6333. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  6334. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  6335. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  6336. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  6337. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  6338. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  6339. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  6340. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  6341. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  6342. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6343. if (jdarray.GetSize())
  6344. {
  6345. if (m_bz.IsEmpty() == 0)
  6346. m_bz = "\r\n" + m_bz;
  6347. m_bz += "景点:";
  6348. }
  6349. for (i = 0; i < jdarray.GetSize(); i++)
  6350. {
  6351. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  6352. }
  6353. m_bz.TrimRight(";");
  6354. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  6355. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  6356. if (IsHasRights2new(31) == 0)
  6357. {
  6358. m_phone1 = "***";
  6359. m_phone2 = "***";
  6360. }
  6361. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  6362. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  6363. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  6364. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  6365. CString str;
  6366. filter = "name='" + m_ren + "'";
  6367. g_sendhead.code[0] = 5;
  6368. g_sendhead.tabcount = 1;
  6369. g_sendhead.bsql = 0;
  6370. int g_nYearposTemp = g_nYearpos;
  6371. g_nYearpos = -1;
  6372. g_pMainWnd->ProcessChatMessageRequest2(filter);
  6373. g_nYearpos = g_nYearposTemp;
  6374. if (g_bSendOK == 0)return;
  6375. DataToArray(&phonearray);
  6376. m_money1.Format("%f", atof(m_taoxijiage));
  6377. m_money2.Format("%f", atof(m_payed1));
  6378. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  6379. ConvertToPrice(m_money1);
  6380. ConvertToPrice(m_money2);
  6381. ConvertToPrice(m_money3);
  6382. ////////////////////////////////////////////////////////////////
  6383. int rcpos = -1;
  6384. CRect StrRect = load.m_rcarray.ElementAt(0);
  6385. m_Print.SetFontFace(25, 1, "黑体");
  6386. m_Print.DrawText((LPTSTR)(LPCTSTR)"巴黎春天婚纱摄影预约单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6387. m_Print.SetFontFace(11, 1, "宋体");
  6388. StrRect = load.m_rcarray.ElementAt(1);
  6389. if (m_time1.GetLength() == 10)
  6390. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  6391. else
  6392. str = "开单日期:";
  6393. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6394. StrRect = load.m_rcarray.ElementAt(2);
  6395. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + m_id), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6396. CStringArray strarray;
  6397. strarray.Add("先生姓名");
  6398. strarray.Add("女士姓名");
  6399. strarray.Add("服装套数");
  6400. strarray.Add("拍摄张数");
  6401. strarray.Add("拍摄日期");
  6402. strarray.Add("联系电话");
  6403. strarray.Add("联系电话");
  6404. strarray.Add("造型套数");
  6405. strarray.Add("入册张数");
  6406. strarray.Add("选片日期");
  6407. strarray.Add("QQ/邮箱");
  6408. strarray.Add("套系总额");
  6409. strarray.Add("定金");
  6410. strarray.Add("余款金额");
  6411. strarray.Add("取件日期");
  6412. strarray.Add(m_name1);
  6413. strarray.Add(m_name2);
  6414. strarray.Add(m_clothescount);
  6415. str.Format("%d", atoi(m_zs) * 3);
  6416. strarray.Add(str);
  6417. strarray.Add(m_time2);
  6418. strarray.Add(m_phone1);
  6419. strarray.Add(m_phone2);
  6420. strarray.Add(m_clothescount2);
  6421. strarray.Add(m_zs);
  6422. strarray.Add(m_time4);
  6423. strarray.Add(m_qq1);
  6424. strarray.Add(m_money1);
  6425. strarray.Add(m_money2);
  6426. strarray.Add(m_money3);
  6427. strarray.Add(m_time5);
  6428. for (i = 4; i <= 33; i++)
  6429. {
  6430. StrRect = load.m_rcarray.ElementAt(i - 1);
  6431. m_Print.DrawRect2(StrRect, 1);
  6432. if (strarray.GetSize() > (i - 4))
  6433. {
  6434. if (i <= 18)
  6435. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6436. else
  6437. {
  6438. StrRect.left += 4;
  6439. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6440. }
  6441. }
  6442. }
  6443. int dt = 413;
  6444. StrRect = load.m_rcarray.ElementAt(36); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6445. m_Print.DrawText((LPTSTR)(LPCTSTR)"门市签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6446. StrRect = load.m_rcarray.ElementAt(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6447. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6448. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6449. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6450. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  6451. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址:深圳市红岭中路中深国际大厦首层,二十二层", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6452. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  6453. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:0755-61308198 61308199 25860696 25860697", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6454. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  6455. m_Print.DrawText((LPTSTR)(LPCTSTR)"网址:www.paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6456. StrRect = load.m_rcarray.ElementAt(43); StrRect.top += dt; StrRect.bottom += dt;
  6457. m_Print.DrawText((LPTSTR)(LPCTSTR)"邮箱:blct@paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6458. //////////////////////////////
  6459. //开始画文字
  6460. StrRect = load.m_rcarray.ElementAt(7);
  6461. int hei = StrRect.Height();
  6462. StrRect.top += hei;
  6463. StrRect.bottom += hei;
  6464. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6465. StrRect.top += dt;
  6466. StrRect.bottom += dt;
  6467. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6468. StrRect = load.m_rcarray.ElementAt(17);
  6469. StrRect.top += hei;
  6470. StrRect.bottom += hei;
  6471. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6472. StrRect = load.m_rcarray.ElementAt(33);
  6473. StrRect.bottom = StrRect.top + dt; m_Print.DrawRect2(StrRect, 1);
  6474. StrRect.top += hei;
  6475. StrRect.left += 3;
  6476. StrRect.top += 3;
  6477. StrRect.right -= 2;
  6478. StrRect.bottom -= 2;
  6479. str = "";
  6480. for (i = 0; i < sparray.GetSize(); i++)
  6481. {
  6482. str += sparray.ElementAt(i).ElementAt(5);
  6483. str += " 数量:";
  6484. str += sparray.ElementAt(i).ElementAt(3);
  6485. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6486. str += "\r\n";
  6487. }
  6488. str.TrimRight("\r\n");
  6489. AutoDraw(m_Print, StrRect, str, 1.4);
  6490. StrRect = load.m_rcarray.ElementAt(33);
  6491. StrRect.top += dt;
  6492. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6493. StrRect.top += hei;
  6494. StrRect.left += 3;
  6495. StrRect.top += 3;
  6496. StrRect.right -= 2;
  6497. StrRect.bottom -= 2;
  6498. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  6499. StrRect = load.m_rcarray.ElementAt(34);
  6500. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6501. StrRect.top += hei;
  6502. StrRect.left += 3;
  6503. StrRect.top += 3;
  6504. StrRect.right -= 2;
  6505. StrRect.bottom -= 2;
  6506. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6507. if (str.IsEmpty())
  6508. {
  6509. str = "\
  6510. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6511. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6512. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6513. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6514. 持良好的心境.\r\n\
  6515. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6516. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6517. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6518. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6519. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6520. 勿进影室, 以免影响拍摄.\r\n\
  6521. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6522. 师或店长沟通.\r\n\
  6523. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6524. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6525. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6526. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6527. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6528. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6529. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6530. 还.";
  6531. }
  6532. AutoDraw(m_Print, StrRect, str, 1.8);
  6533. StrRect = load.m_rcarray.ElementAt(35);
  6534. StrRect.bottom += 100;
  6535. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  6536. 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∨";
  6537. AutoDraw(m_Print, StrRect, str, 1.4);
  6538. PrintPreview dlg;
  6539. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6540. dlg.m_pDC = m_Print.GetPDC();
  6541. if (dlg.DoModal() != IDOK)return;
  6542. //结束打印
  6543. m_Print.EndPage();
  6544. m_Print.EndPrint();
  6545. }
  6546. int CalHeight_01(CRect &rc, CStringArray *saContent, CPrintRX *Print, int FORMAT)
  6547. {
  6548. CSize size;
  6549. int nMaxheight = 0;
  6550. CString strTemp;
  6551. CString strContent;
  6552. int nSize = saContent->GetSize();
  6553. int nRow = 0; // 行数;
  6554. for (int i = 0; i < nSize; i++)
  6555. {
  6556. strTemp = "";
  6557. strContent = saContent->ElementAt(i);
  6558. while (FALSE == strContent.IsEmpty())
  6559. {
  6560. strContent = strContent.Mid(strTemp.GetLength());
  6561. if (strContent.IsEmpty())
  6562. break;
  6563. Print->GetStrSize((LPTSTR)(LPCTSTR)strContent, size);
  6564. if (size.cx <= rc.Width())
  6565. {
  6566. CRect rc2 = rc;
  6567. rc2.top += nRow*(size.cy + 1);
  6568. rc2.bottom = rc2.top + (size.cy + 1);
  6569. Print->DrawText((LPTSTR)(LPCTSTR)strContent, rc2, 0, 0, FORMAT | FORMAT_UP);
  6570. nMaxheight = max(nMaxheight, rc2.bottom);
  6571. nRow++;
  6572. break;
  6573. }
  6574. int right = 0;
  6575. while (size.cx > rc.Width())
  6576. {
  6577. right++;
  6578. strTemp = strContent.Left(strContent.GetLength() - (right));
  6579. if (GIsHalfHZ(strTemp))
  6580. {
  6581. right++;
  6582. strTemp.Delete(strTemp.GetLength() - 1);
  6583. }
  6584. Print->GetStrSize((LPTSTR)(LPCTSTR)strTemp, size);
  6585. }
  6586. CRect rc2 = rc;
  6587. rc2.top += nRow*(size.cy + 1);
  6588. rc2.bottom = rc2.top + (size.cy + 1);
  6589. Print->DrawText((LPTSTR)(LPCTSTR)strTemp, rc2, 0, 0, FORMAT | FORMAT_UP); //printf("Jeff:str=%s\n\n",str);// Jeff Printf;
  6590. nRow++;
  6591. nMaxheight = max(nMaxheight, rc2.bottom);
  6592. }
  6593. }
  6594. return (nMaxheight == 0) ? (rc.bottom + 1) : (nMaxheight + 1);
  6595. }
  6596. /************************************************************************/
  6597. /*
  6598. 多字节字符编码下的CaleHeight函数;
  6599. 函数:CaleHeight
  6600. 描述:计算出一行高度可变,宽度特定的表格(CArray<CRect,CRect>),在输入指定内容时(CStringArray),表格高度变化最大的值。
  6601. 参数:
  6602. aRowRect: 一行表格,CArray::GetSize()表示表格列数;
  6603. aRowStr: 与表格对应的一行字符,CStringArray::GetSize()大小与CArray::GetSize()一致。
  6604. pPrinter: 打印机实例指针;
  6605. nFormat: 字符串的显示格式。
  6606. 返回:返回最大的表格高度;
  6607. 注意:只能多字节下使用,因为函数GIsHalfHZ。
  6608. */
  6609. /************************************************************************/
  6610. INT CalcHeight( IN CArray<CRect, CRect> &aRowRect, IN CStringArray &aRowStr, IN CPrintRX *pPrinter, IN CONST INT& nFormat)
  6611. {
  6612. // 参数有效性;
  6613. if( aRowRect.GetSize() != aRowStr.GetSize() )
  6614. {
  6615. OutputDebugString(_T("表格列数与字符列数不等!\n"));
  6616. return -1;
  6617. }
  6618. if( pPrinter == NULL )
  6619. {
  6620. OutputDebugString(_T("打印机句柄指针无效\n"));
  6621. return -1;
  6622. }
  6623. // 表格字串长度;
  6624. CSize size;
  6625. // 当前表格字体高度;
  6626. INT nGridFontHeight = 0;
  6627. // 当前表格区域;
  6628. CRect curGrid;
  6629. // 当前表格字符串;
  6630. CString strGridContent;
  6631. // 最大值高底;
  6632. INT nMaxHeigth = 0;
  6633. // 当前换行数;
  6634. INT nWrapRows = 0;
  6635. // 当前换行字串;
  6636. CString strWrapRow = _T("");
  6637. // 表格列数;
  6638. INT nColumns = aRowRect.GetSize();
  6639. // 临时表格;
  6640. CRect rcGrid;
  6641. // 循环计算每个表格的高度;
  6642. for( INT i = 0; i < nColumns; i++ )
  6643. {
  6644. nWrapRows = 0;
  6645. strWrapRow.Empty();
  6646. curGrid = aRowRect.ElementAt(i);
  6647. strGridContent = aRowStr.ElementAt(i);
  6648. nMaxHeigth = max(nMaxHeigth, curGrid.bottom);
  6649. while( !strGridContent.IsEmpty() )
  6650. {
  6651. strGridContent = strGridContent.Right(strGridContent.GetLength() - strWrapRow.GetLength());
  6652. if ( strGridContent.IsEmpty() )
  6653. {
  6654. OutputDebugString(_T("表格字符已空\n"));
  6655. break;
  6656. }
  6657. pPrinter->GetStrSize((LPTSTR)(LPCTSTR)strGridContent, size);
  6658. nGridFontHeight = size.cy + 1;
  6659. // 字串长度 <= 表格宽度;
  6660. if( size.cx <= curGrid.Width() )
  6661. {
  6662. rcGrid = curGrid;
  6663. rcGrid.top += nWrapRows*nGridFontHeight;
  6664. rcGrid.bottom = rcGrid.top + nGridFontHeight;
  6665. nMaxHeigth = max(nMaxHeigth, rcGrid.bottom);
  6666. pPrinter->DrawText((LPTSTR)(LPCTSTR)strGridContent, rcGrid, 0, 0, nFormat|FORMAT_UP);
  6667. break;
  6668. }
  6669. else
  6670. {// 字串长度 >= 表格宽度;
  6671. INT nRight = 0; // 字串右位置;
  6672. // 从右边开始逐个字符取出,直到左边字串小于表格宽度;
  6673. while( size.cx > curGrid.Width() )
  6674. {
  6675. nRight++;
  6676. strWrapRow = strGridContent.Left(strGridContent.GetLength() - nRight);
  6677. if( GIsHalfHZ(strWrapRow) )
  6678. {// 判断字串最后一个字符是否是汉字;
  6679. nRight++;
  6680. strWrapRow.Delete(strWrapRow.GetLength() - 1);
  6681. }
  6682. pPrinter->GetStrSize((LPTSTR)(LPCTSTR)strWrapRow, size);
  6683. }
  6684. rcGrid = curGrid;
  6685. rcGrid.top += nWrapRows*nGridFontHeight;
  6686. rcGrid.bottom = rcGrid.top + nGridFontHeight;
  6687. nMaxHeigth = max(nMaxHeigth, rcGrid.bottom);
  6688. pPrinter->DrawText((LPTSTR)(LPCTSTR)strWrapRow, rcGrid, 0, 0, nFormat|FORMAT_UP);
  6689. // 换行加+1;
  6690. nWrapRows++;
  6691. }
  6692. }
  6693. }
  6694. return nMaxHeigth + 1;
  6695. }
  6696. void CMainFrame::PrintReceipt(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  6697. {
  6698. //AfxMessageBox("abce");
  6699. int i = 0;
  6700. int printcot = 1;
  6701. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  6702. {
  6703. g_sendhead.bsql = 0;
  6704. g_sendhead.code[0] = 24;
  6705. g_sendhead.tabcount = 1;
  6706. int g_nYearposTemp = g_nYearpos;
  6707. g_nYearpos = -1;
  6708. g_pMainWnd->ProcessChatMessageRequest2(1);
  6709. g_nYearpos = g_nYearposTemp;
  6710. if (0 == g_bSendOK)return;
  6711. DataToArray(&g_cominfoarray);
  6712. CString SerialNo;
  6713. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6714. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  6715. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6716. CString sql;
  6717. sql.Format("update version set [serialno]='%s'", SerialNo);
  6718. g_sendhead.bsql=1;
  6719. g_nYearposTemp=g_nYearpos;
  6720. g_nYearpos=-1;
  6721. g_pMainWnd->ProcessChatMessageRequest2(sql);
  6722. g_nYearpos=g_nYearposTemp;
  6723. #endif
  6724. // 1.创建打印对象
  6725. CPrintRX m_Print;
  6726. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6727. {
  6728. m_Print.InitToPrint(NULL, 1);
  6729. }
  6730. else
  6731. {
  6732. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  6733. if (name.IsEmpty())
  6734. m_Print.InitToPrint(NULL, 1);
  6735. else
  6736. {
  6737. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6738. if (nret == -1 && aa == 0)
  6739. {
  6740. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6741. }
  6742. }
  6743. }
  6744. // 2.开始打印
  6745. m_Print.StartPrint();
  6746. m_Print.StartPage();
  6747. LoadRect load;
  6748. BOOL bSmall = 0;
  6749. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  6750. {
  6751. bSmall = 1;
  6752. load.SetLiaPath("20.lia");
  6753. }
  6754. else
  6755. load.SetLiaPath("10.lia");
  6756. if (bSmall)
  6757. load.SetMargins(0, 0);
  6758. else
  6759. load.SetMargins(10, 0);
  6760. if (!load.Load())return;
  6761. int rcpos = -1;
  6762. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6763. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  6764. {
  6765. Image *pImg = NULL;
  6766. g_nSendCode = 31;
  6767. int g_nYearposTemp = g_nYearpos;
  6768. g_nYearpos = -1;
  6769. g_pMainWnd->ProcessChatMessageRequest2(1);
  6770. g_nYearpos = g_nYearposTemp;
  6771. g_nSendCode = 0;
  6772. if (g_bSendOK == 0)return;
  6773. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  6774. if (pImg)
  6775. {
  6776. StrRect.left = 65;
  6777. if (bSmall) StrRect.left = 55;
  6778. StrRect.top = 10;
  6779. StrRect.right = StrRect.left + 58;
  6780. StrRect.bottom = StrRect.top + 58;
  6781. // 3.打印2维码图像;
  6782. m_Print.DrawImage(pImg, StrRect);
  6783. delete pImg;
  6784. pImg = NULL;
  6785. }
  6786. }
  6787. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  6788. if (bSmall)
  6789. {
  6790. m_Print.SetFontFace(18, 1, "黑体");
  6791. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6792. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6793. m_Print.SetFontFace(9, 1, "宋体");
  6794. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6795. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6796. m_Print.SetFontFace(6, 1, "宋体");
  6797. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6798. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6799. m_Print.SetFontFace(9, 1, "宋体");
  6800. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6801. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6802. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6803. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  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_RIGHT | FORMAT_VCENTER);
  6806. int hei = StrRect.Height();
  6807. StrRect.bottom = StrRect.top;
  6808. StrRect.top -= 8;
  6809. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6810. m_Print.SetFontFace(11, 1, "宋体");
  6811. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6812. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6813. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6814. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6815. m_Print.SetFontFace(8, 1, "宋体");
  6816. for (i = 7; i < 24; i++)
  6817. {
  6818. StrRect = load.m_rcarray.ElementAt(i);
  6819. m_Print.DrawRect2(StrRect, 1);
  6820. }
  6821. for (i = 9; i < 24; i++)
  6822. {
  6823. StrRect = load.m_rcarray.ElementAt(i);
  6824. StrRect.left += 2;
  6825. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6826. }
  6827. m_Print.SetFontFace(6, 1, "宋体");
  6828. for (i = 24; i < 26; i++)
  6829. {
  6830. StrRect = load.m_rcarray.ElementAt(i);
  6831. StrRect.left += 2;
  6832. if (i == 24)
  6833. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6834. else
  6835. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6836. }
  6837. // StrRect=load.m_rcarray .ElementAt (27);
  6838. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  6839. }
  6840. else//大单
  6841. {
  6842. // 1.打印表头(蒙娜丽莎收款单)
  6843. m_Print.SetFontFace(20, 1, "黑体");
  6844. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6845. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6846. m_Print.SetFontFace(11, 1, "宋体");
  6847. // 2.打印订单号(NO.20140608-001)
  6848. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6849. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6850. // 3.打印SerialNo(SerialNo.01062)
  6851. int hei = StrRect.Height();
  6852. StrRect.bottom = StrRect.top;
  6853. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6854. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6855. // 4.打印影楼地址信息、电话;
  6856. m_Print.SetFontFace(8, 1, "宋体");
  6857. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6858. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6859. m_Print.SetFontFace(11, 1, "宋体");
  6860. // 5.打印客户姓名
  6861. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6862. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6863. // 6.打印客户联系电话
  6864. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6865. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6866. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6867. // 7.打印开单日期
  6868. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6869. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6870. // 8.打印列字段:收款项目
  6871. m_Print.SetFontFace(13, 1, "宋体");
  6872. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6873. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6874. //printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6875. // 9.打印列字段:金额
  6876. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6877. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6878. //printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6879. // 10.打印列字段:开单人
  6880. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6881. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6882. //printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6883. // 11.画表格-画3列;
  6884. m_Print.SetFontFace(11, 1, "宋体");
  6885. for (i = 7; i < 10; i++)
  6886. {
  6887. StrRect = load.m_rcarray.ElementAt(i);
  6888. m_Print.DrawRect2(StrRect, 1);
  6889. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6890. }
  6891. // 12.打印详细内容
  6892. int dty = 0;
  6893. int dtytemp = 0;
  6894. // for( i=10; i<14; i+=3)
  6895. for (i = 10; i<22; i += 3) // 循环4次,再画
  6896. {
  6897. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  6898. CArray<CRect, CRect>rcarray;
  6899. CStringArray strarray2;
  6900. StrRect = load.m_rcarray.ElementAt(i);
  6901. StrRect.top += dty;
  6902. StrRect.bottom += dty;
  6903. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  6904. {
  6905. StrRect = load.m_rcarray.ElementAt(i - 1);
  6906. StrRect.top += dty;
  6907. StrRect.bottom += dty;
  6908. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  6909. break;
  6910. }
  6911. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  6912. StrRect.left += 2;
  6913. StrRect.right -= 2;
  6914. StrRect.top += 4;
  6915. rcarray.Add(StrRect);
  6916. strarray2.Add(pArray->ElementAt(i));
  6917. // 指定格子宽度,计算字符串占几行(高度).
  6918. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  6919. dtytemp = bottom - StrRect.bottom;
  6920. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  6921. // 重新获取表格大小,并画出表格;
  6922. StrRect = load.m_rcarray.ElementAt(i);
  6923. StrRect.bottom += dtytemp;
  6924. StrRect.top += dty;
  6925. StrRect.bottom += dty;
  6926. m_Print.DrawRect2(StrRect, 1);
  6927. // 获取下一表格大小,并画出表格;
  6928. StrRect = load.m_rcarray.ElementAt(i + 1);
  6929. StrRect.top += dty;
  6930. StrRect.bottom += dty;
  6931. StrRect.bottom += dtytemp;
  6932. m_Print.DrawRect2(StrRect, 1);
  6933. StrRect.left += 2;
  6934. // 打印出金额字段内容
  6935. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6936. //printf("Jeff:%d:%s\n\n",i+1,pArray->ElementAt(i+1));//Jeff Printf;
  6937. StrRect = load.m_rcarray.ElementAt(i + 2);
  6938. StrRect.top += dty;
  6939. StrRect.bottom += dty;
  6940. StrRect.bottom += dtytemp;
  6941. m_Print.DrawRect2(StrRect, 1);
  6942. StrRect.left += 2;
  6943. // 打印开单人字段内容
  6944. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6945. //printf("Jeff:%d:%s\n\n",i+2,pArray->ElementAt(i+2));//Jeff Printf;
  6946. dty += dtytemp;
  6947. }
  6948. //.打印->付款情况 应付 实付 欠款.
  6949. i = 22;
  6950. StrRect = load.m_rcarray.ElementAt(i);
  6951. StrRect.top += dty;
  6952. StrRect.bottom += dty;
  6953. m_Print.DrawRect2(StrRect, 1);
  6954. StrRect.left += 2;
  6955. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6956. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  6957. //.打印->合计人民币(大写):.......
  6958. i = 23;
  6959. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  6960. m_Print.DrawRect2(StrRect, 1);
  6961. StrRect.left += 2;
  6962. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6963. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  6964. m_Print.SetFontFace(7, 1, "宋体");
  6965. for (i = 24; i < 27; i++)
  6966. {
  6967. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  6968. StrRect.left += 2;
  6969. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6970. }
  6971. StrRect = load.m_rcarray.ElementAt(24); StrRect.top += dty; StrRect.bottom += dty;
  6972. hei = StrRect.Height();
  6973. StrRect.top += hei;
  6974. StrRect.bottom += hei;
  6975. StrRect.right += 100;
  6976. StrRect.left += 2;
  6977. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  6978. AutoDraw(m_Print, StrRect, pArray->ElementAt(27), 1.0);
  6979. }
  6980. PrintPreview dlg;
  6981. dlg.m_mode = 3;
  6982. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6983. dlg.m_pDC = m_Print.GetPDC();
  6984. if (aa == 0)
  6985. {
  6986. if (dlg.DoModal() != IDOK)
  6987. return;
  6988. printcot = dlg.m_num;
  6989. }
  6990. //结束打印
  6991. m_Print.EndPage();
  6992. m_Print.EndPrint();
  6993. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  6994. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6995. CString sql;
  6996. sql.Format("update version set [serialno]='%s'", SerialNo);
  6997. g_sendhead.bsql = 1;
  6998. g_nYearposTemp = g_nYearpos;
  6999. g_nYearpos = -1;
  7000. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7001. g_nYearpos = g_nYearposTemp;
  7002. #endif
  7003. }
  7004. }
  7005. /************************************************************************/
  7006. /*
  7007. 函数:PrintRechargeRecord
  7008. 描述:打印会员卡充值记录;
  7009. 参数:
  7010. pArryRechargeRecod[IN]:要打印的数据;
  7011. 返回:
  7012. 注意:
  7013. 示例:
  7014. */
  7015. /************************************************************************/
  7016. void CMainFrame::PrintRechargeRecord(CStringArray *pArryRechargeRecod)
  7017. {
  7018. }
  7019. void CMainFrame::PrintReceipt_01(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  7020. {
  7021. //AfxMessageBox("abce");
  7022. int i = 0;
  7023. int printcot = 1;
  7024. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  7025. {
  7026. g_sendhead.bsql = 0;
  7027. g_sendhead.code[0] = 24;
  7028. g_sendhead.tabcount = 1;
  7029. int g_nYearposTemp = g_nYearpos;
  7030. g_nYearpos = -1;
  7031. g_pMainWnd->ProcessChatMessageRequest2(1);
  7032. g_nYearpos = g_nYearposTemp;
  7033. if (0 == g_bSendOK)return;
  7034. DataToArray(&g_cominfoarray);
  7035. CString SerialNo;
  7036. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7037. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7038. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7039. CString sql;
  7040. sql.Format("update version set [serialno]='%s'", SerialNo);
  7041. g_sendhead.bsql=1;
  7042. g_nYearposTemp=g_nYearpos;
  7043. g_nYearpos=-1;
  7044. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7045. g_nYearpos=g_nYearposTemp;
  7046. #endif
  7047. // 1.创建打印对象
  7048. CPrintRX m_Print;
  7049. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7050. {
  7051. m_Print.InitToPrint(NULL, 1);
  7052. }
  7053. else
  7054. {
  7055. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  7056. if (name.IsEmpty())
  7057. m_Print.InitToPrint(NULL, 1);
  7058. else
  7059. {
  7060. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  7061. if (nret == -1 && aa == 0)
  7062. {
  7063. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  7064. m_Print.InitToPrint(NULL, 1);
  7065. }
  7066. }
  7067. }
  7068. // 2.开始打印
  7069. m_Print.StartPrint();
  7070. m_Print.StartPage();
  7071. LoadRect load;
  7072. BOOL bSmall = 0;
  7073. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  7074. {
  7075. bSmall = 1;
  7076. load.SetLiaPath("20.lia");
  7077. }
  7078. else
  7079. load.SetLiaPath("10.lia");
  7080. if (bSmall)
  7081. load.SetMargins(0, 0);
  7082. else
  7083. load.SetMargins(10, 0);
  7084. if (!load.Load())return;
  7085. int rcpos = -1;
  7086. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7087. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  7088. {
  7089. Image *pImg = NULL;
  7090. g_nSendCode = 31;
  7091. int g_nYearposTemp = g_nYearpos;
  7092. g_nYearpos = -1;
  7093. g_pMainWnd->ProcessChatMessageRequest2(1);
  7094. g_nYearpos = g_nYearposTemp;
  7095. g_nSendCode = 0;
  7096. if (g_bSendOK == 0)return;
  7097. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7098. if (pImg)
  7099. {
  7100. StrRect.left = 65;
  7101. if (bSmall) StrRect.left = 55;
  7102. StrRect.top = 10;
  7103. StrRect.right = StrRect.left + 58;
  7104. StrRect.bottom = StrRect.top + 58;
  7105. // 3.打印2维码图像;
  7106. m_Print.DrawImage(pImg, StrRect);
  7107. delete pImg;
  7108. pImg = NULL;
  7109. }
  7110. }
  7111. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  7112. if (bSmall)
  7113. {
  7114. m_Print.SetFontFace(18, 1, "黑体");
  7115. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7116. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7117. m_Print.SetFontFace(9, 1, "宋体");
  7118. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7119. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7120. m_Print.SetFontFace(6, 1, "宋体");
  7121. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7122. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7123. m_Print.SetFontFace(9, 1, "宋体");
  7124. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7125. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7126. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7127. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  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_RIGHT | FORMAT_VCENTER);
  7130. int hei = StrRect.Height();
  7131. StrRect.bottom = StrRect.top;
  7132. StrRect.top -= 8;
  7133. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7134. m_Print.SetFontFace(11, 1, "宋体");
  7135. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7136. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7137. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7138. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7139. m_Print.SetFontFace(8, 1, "宋体");
  7140. for ( i = 7; i < 24; i++)
  7141. {
  7142. StrRect = load.m_rcarray.ElementAt(i);
  7143. m_Print.DrawRect2(StrRect, 1);
  7144. }
  7145. for (i = 9; i < 24; i++)
  7146. {
  7147. StrRect = load.m_rcarray.ElementAt(i);
  7148. StrRect.left += 2;
  7149. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7150. }
  7151. m_Print.SetFontFace(6, 1, "宋体");
  7152. for (i = 24; i < 26; i++)
  7153. {
  7154. StrRect = load.m_rcarray.ElementAt(i);
  7155. StrRect.left += 2;
  7156. if (i == 24)
  7157. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7158. else
  7159. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7160. }
  7161. // StrRect=load.m_rcarray .ElementAt (27);
  7162. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  7163. }
  7164. else//大单
  7165. {
  7166. // 1.打印表头(蒙娜丽莎收款单)
  7167. m_Print.SetFontFace(20, 1, "黑体");
  7168. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7169. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7170. m_Print.SetFontFace(11, 1, "宋体");
  7171. // 2.打印订单号(NO.20140608-001)
  7172. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7173. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7174. // 3.打印SerialNo(SerialNo.01062)
  7175. int hei = StrRect.Height();
  7176. StrRect.bottom = StrRect.top;
  7177. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7178. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7179. // 4.打印影楼地址信息、电话;
  7180. m_Print.SetFontFace(8, 1, "宋体");
  7181. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7182. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7183. m_Print.SetFontFace(11, 1, "宋体");
  7184. // 5.打印客户姓名
  7185. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7186. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7187. // 6.打印客户联系电话
  7188. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7189. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7190. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7191. // 7.打印开单日期
  7192. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7193. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7194. #if 0 // Original Edition
  7195. // 8.打印列字段:收款项目
  7196. m_Print.SetFontFace(13, 1, "宋体");
  7197. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7198. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7199. printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7200. // 9.打印列字段:金额
  7201. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7202. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7203. printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7204. // 10.打印列字段:开单人
  7205. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7206. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7207. printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7208. #else
  7209. // 8.打印列字段:收款项目
  7210. m_Print.SetFontFace(13, 1, "宋体");
  7211. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7212. StrRect = CRect(66, 85, 280, 105);
  7213. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7214. //m_Print.DrawText("收款项目",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7215. // 8.1 Jeff add:支付方式
  7216. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7217. StrRect = CRect(280, 85, 350, 105);
  7218. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7219. //m_Print.DrawText("支付方式",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7220. // 9.打印列字段:金额
  7221. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7222. StrRect = CRect(350, 85, 442, 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. // 10.打印列字段:开单人
  7226. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7227. StrRect = CRect(442, 85, 535, 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. //rcpos += 3;
  7231. #endif
  7232. // 11.画表格-画3列;old
  7233. // 11.draw 4 column
  7234. m_Print.SetFontFace(11, 1, "宋体");
  7235. //for( i=7; i<10; i++)
  7236. //{
  7237. // StrRect=load.m_rcarray.ElementAt(i);
  7238. // m_Print.DrawRect2(StrRect, 1);
  7239. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7240. //}
  7241. m_Print.DrawRect2(CRect(66, 85, 280, 105), 1);
  7242. m_Print.DrawRect2(CRect(280, 85, 350, 105), 1);
  7243. m_Print.DrawRect2(CRect(350, 85, 442, 105), 1);
  7244. m_Print.DrawRect2(CRect(442, 85, 535, 105), 1);
  7245. // 12.打印详细内容
  7246. int dty = 0;
  7247. int dtytemp = 0;
  7248. // for( i=10; i<14; i+=3)
  7249. //for( i=10; i<22; i+=3) // 循环4次,再画
  7250. int j = 0;
  7251. for (i = 10, j = 11; i<22; i += 3, j += 4) // 循环4次,再画
  7252. {
  7253. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  7254. CArray<CRect, CRect>rcarray;
  7255. CStringArray strarray2;
  7256. StrRect = load.m_rcarray.ElementAt(i);
  7257. StrRect.top += dty;
  7258. StrRect.bottom += dty;
  7259. StrRect.right -= 70; // Jeff add
  7260. //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;
  7261. /*
  7262. 4次的CRect
  7263. 66,105,350,125
  7264. 66,126,350,146
  7265. 66,147,350,167
  7266. 66,168,350,188
  7267. */
  7268. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  7269. {
  7270. StrRect = load.m_rcarray.ElementAt(i - 1);
  7271. StrRect.top += dty;
  7272. StrRect.bottom += dty;
  7273. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  7274. break;
  7275. }
  7276. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  7277. StrRect.left += 2;
  7278. StrRect.right -= 2;
  7279. StrRect.top += 4;
  7280. rcarray.Add(StrRect);
  7281. //strarray2.Add(pArray->ElementAt(i+1));
  7282. strarray2.Add(pArray->ElementAt(j));
  7283. //printf("Jeff:%d:%s\n\n",j,pArray->ElementAt(j));//Jeff Printf;
  7284. // 指定格子宽度,计算字符串占几行(高度).
  7285. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  7286. dtytemp = bottom - StrRect.bottom;
  7287. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7288. // 重新获取表格大小,并画出表格;
  7289. /*
  7290. CRect(66,85,280,105),
  7291. CRect(280,85,350,105)
  7292. CRect(350,85,442,105)
  7293. CRect(442,85,535,105)
  7294. CRect(66,105,350,125),
  7295. CRect(66,126,350,146)
  7296. CRect(66,147,350,167)
  7297. CRect(66,168,350,188)
  7298. */
  7299. // 画收款项目框及打印内容;
  7300. StrRect = load.m_rcarray.ElementAt(i);
  7301. //StrRect=CRect(66,85,280,105);
  7302. StrRect.bottom += dtytemp;
  7303. StrRect.top += dty;
  7304. StrRect.bottom += dty;
  7305. //StrRect.left -= 70; // Jeff add
  7306. StrRect.right -= 70; // Jeff add
  7307. //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;
  7308. m_Print.DrawRect2(StrRect, 1);
  7309. // 画支付方式框及打印内容;
  7310. StrRect = load.m_rcarray.ElementAt(i);
  7311. //StrRect=CRect(280,85,350,105);
  7312. StrRect.bottom += dtytemp;
  7313. StrRect.top += dty;
  7314. StrRect.bottom += dty;
  7315. StrRect.left += StrRect.Width() - 70;
  7316. //StrRect.right += 70; // Jeff add
  7317. //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;
  7318. m_Print.DrawRect2(StrRect, 1);
  7319. StrRect.left += 2;
  7320. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7321. //printf("Jeff:%d:%s\n\n",j+1,pArray->ElementAt(j+1));//Jeff Printf;
  7322. // 画金额框及打印内容;
  7323. StrRect = load.m_rcarray.ElementAt(i + 1);
  7324. //StrRect=CRect(350,85,442,105);
  7325. StrRect.top += dty;
  7326. StrRect.bottom += dty;
  7327. StrRect.bottom += dtytemp;
  7328. //StrRect.right -= 70; // Jeff add
  7329. //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;
  7330. m_Print.DrawRect2(StrRect, 1);
  7331. StrRect.left += 2;
  7332. // 打印出金额字段内容
  7333. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7334. //printf("Jeff:%d:%s\n\n",j+2,pArray->ElementAt(j+2));//Jeff Printf;
  7335. // 画开单人框及打印内容;
  7336. StrRect = load.m_rcarray.ElementAt(i + 2);
  7337. //StrRect=CRect(442,85,535,105);
  7338. StrRect.top += dty;
  7339. StrRect.bottom += dty;
  7340. StrRect.bottom += dtytemp;
  7341. //StrRect.right -= 70; // Jeff add
  7342. //printf("Jeff:i=%d:left=%d,top=%d,right=%d,bottom=%d.\n\n",i,StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7343. m_Print.DrawRect2(StrRect, 1);
  7344. StrRect.left += 2;
  7345. // 打印开单人字段内容
  7346. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 3), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7347. //printf("Jeff:%d:%s\n\n",j+3,pArray->ElementAt(j+3));//Jeff Printf;
  7348. dty += dtytemp;
  7349. }
  7350. //.打印->付款情况 应付 实付 欠款.
  7351. i = 22;
  7352. j = 27;
  7353. StrRect = load.m_rcarray.ElementAt(i);
  7354. StrRect.top += dty;
  7355. StrRect.bottom += dty;
  7356. m_Print.DrawRect2(StrRect, 1);
  7357. StrRect.left += 2;
  7358. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7359. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7360. //.打印->合计人民币(大写):.......
  7361. i = 23;
  7362. j = 28;
  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. m_Print.SetFontFace(7, 1, "宋体");
  7372. for (i = 24, j = 29; i < 27; i++, j++)
  7373. {
  7374. StrRect = load.m_rcarray.ElementAt(i);
  7375. StrRect.top += dty;
  7376. StrRect.bottom += dty;
  7377. StrRect.left += 2;
  7378. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7379. }
  7380. StrRect = load.m_rcarray.ElementAt(24);
  7381. StrRect.top += dty;
  7382. StrRect.bottom += dty;
  7383. hei = StrRect.Height();
  7384. StrRect.top += hei;
  7385. StrRect.bottom += hei;
  7386. StrRect.right += 100;
  7387. StrRect.left += 2;
  7388. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  7389. AutoDraw(m_Print, StrRect, pArray->ElementAt(32), 1.0);
  7390. }
  7391. PrintPreview dlg;
  7392. dlg.m_mode = 3;
  7393. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  7394. dlg.m_pDC = m_Print.GetPDC();
  7395. if (aa == 0)
  7396. {
  7397. if (dlg.DoModal() != IDOK)
  7398. {
  7399. return;
  7400. }
  7401. printcot = dlg.m_num;
  7402. }
  7403. //结束打印
  7404. m_Print.EndPage();
  7405. m_Print.EndPrint();
  7406. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7407. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7408. CString sql;
  7409. sql.Format("update version set [serialno]='%s'", SerialNo);
  7410. g_sendhead.bsql = 1;
  7411. g_nYearposTemp = g_nYearpos;
  7412. g_nYearpos = -1;
  7413. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7414. g_nYearpos = g_nYearposTemp;
  7415. #endif
  7416. }
  7417. }
  7418. void CMainFrame::PrintReceipt_02(CStringArray *pArray, CPrintRX *pPrinter, const int &nCount, const BOOL bPrintImmediately) // 打印订单*预约收款、预约补款*
  7419. {
  7420. //AfxMessageBox("abce");
  7421. int printcot = 1;
  7422. // for(int aa=0; aa<printcot; aa++) // Jeff, printcot=1....
  7423. // {
  7424. g_sendhead.bsql = 0;
  7425. g_sendhead.code[0] = 24;
  7426. g_sendhead.tabcount = 1;
  7427. int g_nYearposTemp = g_nYearpos;
  7428. g_nYearpos = -1;
  7429. g_pMainWnd->ProcessChatMessageRequest2(1);
  7430. g_nYearpos = g_nYearposTemp;
  7431. if (0 == g_bSendOK)return;
  7432. DataToArray(&g_cominfoarray);
  7433. CString SerialNo;
  7434. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7435. CPrintRX *tagPrinter = NULL;
  7436. if (pPrinter == NULL)
  7437. {
  7438. // 1.创建打印对象
  7439. tagPrinter = new CPrintRX;
  7440. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7441. {
  7442. tagPrinter->InitToPrint(NULL, 1);
  7443. }
  7444. else
  7445. {
  7446. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  7447. if (name.IsEmpty())
  7448. {
  7449. tagPrinter->InitToPrint(NULL, 1);
  7450. }
  7451. else
  7452. {
  7453. int nret = tagPrinter->InitToPrint((char*)(LPCTSTR)name, 1);
  7454. ///if(nret==-1 && aa==0)
  7455. if (nret == -1)
  7456. {
  7457. if (bPrintImmediately == FALSE)
  7458. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  7459. tagPrinter->InitToPrint(NULL, 1);
  7460. }
  7461. }
  7462. }
  7463. // 2.开始打印
  7464. tagPrinter->StartPrint();
  7465. tagPrinter->StartPage();
  7466. }
  7467. else
  7468. {
  7469. //SerialNo.Format ("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126))+1);
  7470. tagPrinter = pPrinter;
  7471. }
  7472. LoadRect load;
  7473. BOOL bSmall = 0;
  7474. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  7475. {
  7476. bSmall = 1;
  7477. load.SetLiaPath("20.lia");
  7478. }
  7479. else
  7480. load.SetLiaPath("10.lia");
  7481. if (bSmall)
  7482. load.SetMargins(0, 0);
  7483. else
  7484. load.SetMargins(10, 0);
  7485. if (!load.Load())return;
  7486. int rcpos = -1;
  7487. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7488. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  7489. {
  7490. Image *pImg = NULL;
  7491. g_nSendCode = 31;
  7492. int g_nYearposTemp = g_nYearpos;
  7493. g_nYearpos = -1;
  7494. g_pMainWnd->ProcessChatMessageRequest2(1);
  7495. g_nYearpos = g_nYearposTemp;
  7496. g_nSendCode = 0;
  7497. if (g_bSendOK == 0)return;
  7498. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7499. if (pImg)
  7500. {
  7501. StrRect.left = 65;
  7502. if (bSmall) StrRect.left = 55;
  7503. StrRect.top = 10;
  7504. StrRect.right = StrRect.left + 58;
  7505. StrRect.bottom = StrRect.top + 58;
  7506. // 3.打印2维码图像;
  7507. tagPrinter->DrawImage(pImg, StrRect);
  7508. delete pImg;
  7509. pImg = NULL;
  7510. }
  7511. }
  7512. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  7513. if (bSmall)
  7514. {
  7515. tagPrinter->SetFontFace(18, 1, "黑体");
  7516. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7517. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7518. tagPrinter->SetFontFace(9, 1, "宋体");
  7519. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7520. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7521. tagPrinter->SetFontFace(6, 1, "宋体");
  7522. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7523. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7524. tagPrinter->SetFontFace(9, 1, "宋体");
  7525. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7526. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7527. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7528. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7529. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7530. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7531. int hei = StrRect.Height();
  7532. StrRect.bottom = StrRect.top;
  7533. StrRect.top -= 8;
  7534. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7535. tagPrinter->SetFontFace(11, 1, "宋体");
  7536. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7537. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7538. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7539. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7540. tagPrinter->SetFontFace(8, 1, "宋体");
  7541. int i = 0;
  7542. for (i = 7; i < 24; i++)
  7543. {
  7544. StrRect = load.m_rcarray.ElementAt(i);
  7545. tagPrinter->DrawRect2(StrRect, 1);
  7546. }
  7547. for (i = 9; i < 24; i++)
  7548. {
  7549. StrRect = load.m_rcarray.ElementAt(i);
  7550. StrRect.left += 2;
  7551. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7552. }
  7553. tagPrinter->SetFontFace(6, 1, "宋体");
  7554. for (i = 24; i < 26; i++)
  7555. {
  7556. StrRect = load.m_rcarray.ElementAt(i);
  7557. StrRect.left += 2;
  7558. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7559. }
  7560. StrRect = load.m_rcarray.ElementAt(22);
  7561. int nH = StrRect.Height();
  7562. int nW = StrRect.Width();
  7563. int nlen = load.m_rcarray.GetSize();
  7564. int nLeft = StrRect.left;
  7565. int j = 0;
  7566. for (i = 27; i<32; i++)
  7567. {
  7568. CRect rct = StrRect;
  7569. if(i == 31)
  7570. {
  7571. rct.top = rct.top + (nH*(j - 1));
  7572. rct.bottom = rct.top + nH;
  7573. rct.left = rct.left + 200;
  7574. rct.right = rct.left + 200;
  7575. }
  7576. else
  7577. {
  7578. rct.top = rct.top + (nH*j);
  7579. rct.bottom = rct.top + nH;
  7580. rct.left = rct.left + 2;
  7581. rct.right = rct.left + 200;
  7582. }
  7583. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), rct, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7584. j++;
  7585. }
  7586. }
  7587. else//大单
  7588. {
  7589. // 1.打印表头(蒙娜丽莎收款单)
  7590. tagPrinter->SetFontFace(20, 1, "黑体");
  7591. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7592. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7593. tagPrinter->SetFontFace(11, 1, "宋体");
  7594. // 2.打印订单号(NO.20140608-001)
  7595. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7596. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7597. // 3.打印SerialNo(SerialNo.01062)
  7598. int hei = StrRect.Height();
  7599. StrRect.bottom = StrRect.top;
  7600. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7601. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7602. // 4.打印影楼地址信息、电话;
  7603. tagPrinter->SetFontFace(8, 1, "宋体");
  7604. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7605. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7606. tagPrinter->SetFontFace(11, 1, "宋体");
  7607. // 5.打印客户姓名
  7608. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7609. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7610. // 6.打印客户联系电话
  7611. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7612. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7613. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7614. // 7.打印开单日期
  7615. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7616. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7617. #if 0 // Original Edition
  7618. // 8.打印列字段:收款项目
  7619. tagPrinter->SetFontFace(13, 1, "宋体");
  7620. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7621. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7622. printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7623. // 9.打印列字段:金额
  7624. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7625. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7626. printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7627. // 10.打印列字段:开单人
  7628. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7629. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7630. printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7631. #else
  7632. // 8.打印列字段:收款项目
  7633. tagPrinter->SetFontFace(13, 1, "宋体");
  7634. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7635. StrRect = CRect(66, 85, 280, 105);
  7636. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7637. //m_Print.DrawText("收款项目",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7638. // 8.1 Jeff add:支付方式
  7639. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7640. StrRect = CRect(280, 85, 350, 105);
  7641. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7642. //m_Print.DrawText("支付方式",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7643. // 9.打印列字段:金额
  7644. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7645. StrRect = CRect(350, 85, 442, 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. // 10.打印列字段:开单人
  7649. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7650. StrRect = CRect(442, 85, 535, 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. //rcpos += 3;
  7654. #endif
  7655. // 11.画表格-画3列;old
  7656. // 11.draw 4 column
  7657. tagPrinter->SetFontFace(11, 1, "宋体");
  7658. int i;
  7659. //for( i=7; i<10; i++)
  7660. //{
  7661. // StrRect=load.m_rcarray.ElementAt(i);
  7662. // m_Print.DrawRect2(StrRect, 1);
  7663. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7664. //}
  7665. tagPrinter->DrawRect2(CRect(66, 85, 280, 105), 1);
  7666. tagPrinter->DrawRect2(CRect(280, 85, 350, 105), 1);
  7667. tagPrinter->DrawRect2(CRect(350, 85, 442, 105), 1);
  7668. tagPrinter->DrawRect2(CRect(442, 85, 535, 105), 1);
  7669. // 12.打印详细内容
  7670. int dty = 0;
  7671. int dtytemp = 0;
  7672. // for( i=10; i<14; i+=3)
  7673. //for( i=10; i<22; i+=3) // 循环4次,再画
  7674. int j = 0;
  7675. for (i = 10, j = 11; i<22; i += 3, j += 4) // 循环4次,再画
  7676. {
  7677. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  7678. CArray<CRect, CRect>rcarray;
  7679. CStringArray strarray2;
  7680. StrRect = load.m_rcarray.ElementAt(i);
  7681. StrRect.top += dty;
  7682. StrRect.bottom += dty;
  7683. StrRect.right -= 70; // Jeff add
  7684. //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;
  7685. /*
  7686. 4次的CRect
  7687. 66,105,350,125
  7688. 66,126,350,146
  7689. 66,147,350,167
  7690. 66,168,350,188
  7691. */
  7692. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  7693. {
  7694. StrRect = load.m_rcarray.ElementAt(i - 1);
  7695. StrRect.top += dty;
  7696. StrRect.bottom += dty;
  7697. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  7698. break;
  7699. }
  7700. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  7701. StrRect.left += 2;
  7702. StrRect.right -= 2;
  7703. StrRect.top += 4;
  7704. rcarray.Add(StrRect);
  7705. //strarray2.Add(pArray->ElementAt(i+1));
  7706. strarray2.Add(pArray->ElementAt(j));
  7707. //printf("Jeff:%d:%s\n\n",j,pArray->ElementAt(j));//Jeff Printf;
  7708. // 指定格子宽度,计算字符串占几行(高度).
  7709. INT bottom = CalcHeight(rcarray, strarray2, tagPrinter, FORMAT_LEFT);
  7710. dtytemp = bottom - StrRect.bottom;
  7711. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7712. // 重新获取表格大小,并画出表格;
  7713. /*
  7714. CRect(66,85,280,105),
  7715. CRect(280,85,350,105)
  7716. CRect(350,85,442,105)
  7717. CRect(442,85,535,105)
  7718. CRect(66,105,350,125),
  7719. CRect(66,126,350,146)
  7720. CRect(66,147,350,167)
  7721. CRect(66,168,350,188)
  7722. */
  7723. // 画收款项目框及打印内容;
  7724. StrRect = load.m_rcarray.ElementAt(i);
  7725. //StrRect=CRect(66,85,280,105);
  7726. StrRect.bottom += dtytemp;
  7727. StrRect.top += dty;
  7728. StrRect.bottom += dty;
  7729. //StrRect.left -= 70; // Jeff add
  7730. StrRect.right -= 70; // Jeff add
  7731. //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;
  7732. tagPrinter->DrawRect2(StrRect, 1);
  7733. // 画支付方式框及打印内容;
  7734. StrRect = load.m_rcarray.ElementAt(i);
  7735. //StrRect=CRect(280,85,350,105);
  7736. StrRect.bottom += dtytemp;
  7737. StrRect.top += dty;
  7738. StrRect.bottom += dty;
  7739. StrRect.left += StrRect.Width() - 70;
  7740. //StrRect.right += 70; // Jeff add
  7741. //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;
  7742. tagPrinter->DrawRect2(StrRect, 1);
  7743. StrRect.left += 2;
  7744. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7745. //printf("Jeff:%d:%s\n\n",j+1,pArray->ElementAt(j+1));//Jeff Printf;
  7746. // 画金额框及打印内容;
  7747. StrRect = load.m_rcarray.ElementAt(i + 1);
  7748. //StrRect=CRect(350,85,442,105);
  7749. StrRect.top += dty;
  7750. StrRect.bottom += dty;
  7751. StrRect.bottom += dtytemp;
  7752. //StrRect.right -= 70; // Jeff add
  7753. //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;
  7754. tagPrinter->DrawRect2(StrRect, 1);
  7755. StrRect.left += 2;
  7756. // 打印出金额字段内容
  7757. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7758. //printf("Jeff:%d:%s\n\n",j+2,pArray->ElementAt(j+2));//Jeff Printf;
  7759. // 画开单人框及打印内容;
  7760. StrRect = load.m_rcarray.ElementAt(i + 2);
  7761. //StrRect=CRect(442,85,535,105);
  7762. StrRect.top += dty;
  7763. StrRect.bottom += dty;
  7764. StrRect.bottom += dtytemp;
  7765. //StrRect.right -= 70; // Jeff add
  7766. //printf("Jeff:i=%d:left=%d,top=%d,right=%d,bottom=%d.\n\n",i,StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7767. tagPrinter->DrawRect2(StrRect, 1);
  7768. StrRect.left += 2;
  7769. // 打印开单人字段内容
  7770. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 3), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7771. //printf("Jeff:%d:%s\n\n",j+3,pArray->ElementAt(j+3));//Jeff Printf;
  7772. dty += dtytemp;
  7773. }
  7774. //.打印->付款情况 应付 实付 欠款.
  7775. i = 22;
  7776. j = 27;
  7777. StrRect = load.m_rcarray.ElementAt(i);
  7778. StrRect.top += dty;
  7779. StrRect.bottom += dty;
  7780. tagPrinter->DrawRect2(StrRect, 1);
  7781. StrRect.left += 2;
  7782. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7783. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7784. //.打印->合计人民币(大写):.......
  7785. i = 23;
  7786. j = 28;
  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. tagPrinter->SetFontFace(7, 1, "宋体");
  7796. for (i = 24, j = 29; i < 27; i++, j++)
  7797. {
  7798. StrRect = load.m_rcarray.ElementAt(i);
  7799. StrRect.top += dty;
  7800. StrRect.bottom += dty;
  7801. StrRect.left += 2;
  7802. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7803. }
  7804. StrRect = load.m_rcarray.ElementAt(24);
  7805. StrRect.top += dty;
  7806. StrRect.bottom += dty;
  7807. hei = StrRect.Height();
  7808. StrRect.top += hei;
  7809. StrRect.bottom += hei;
  7810. StrRect.right += 100;
  7811. StrRect.left += 2;
  7812. StrRect = load.m_rcarray.ElementAt(27);
  7813. StrRect.top += dty;
  7814. StrRect.bottom += dty;
  7815. AutoDraw(*tagPrinter, StrRect, pArray->ElementAt(32), 1.0);
  7816. }
  7817. if (bPrintImmediately == TRUE)
  7818. {
  7819. printcot = nCount;
  7820. ////结束打印
  7821. tagPrinter->EndPage();
  7822. tagPrinter->EndPrint();
  7823. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7824. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7825. CString sql;
  7826. sql.Format("update version set [serialno]='%s'", SerialNo);
  7827. g_sendhead.bsql = 1;
  7828. g_nYearposTemp = g_nYearpos;
  7829. g_nYearpos = -1;
  7830. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7831. g_nYearpos = g_nYearposTemp;
  7832. #endif
  7833. }
  7834. else
  7835. {
  7836. PrintPreview dlg;
  7837. dlg.m_mode = 3;
  7838. tagPrinter->GetWidHei(dlg.m_w, dlg.m_h);
  7839. dlg.m_pDC = tagPrinter->GetPDC();
  7840. //if(aa==0)
  7841. //{
  7842. if (dlg.DoModal() != IDOK)
  7843. {
  7844. return;
  7845. }
  7846. else
  7847. {
  7848. printcot = dlg.m_num;
  7849. //m_Print.deletePrinter();
  7850. for (int i = 0; i < printcot; i++)
  7851. {
  7852. //tagPrinter->EndPage();
  7853. //tagPrinter->m_DC.AbortDoc(); // 结束清空由StartDoc写入的内容;2014-09-15;
  7854. //tagPrinter->m_DC.EndDoc();
  7855. //Sleep(10000);
  7856. //tagPrinter->StartPrint();
  7857. //tagPrinter->NewPage();
  7858. //PrintReceipt_02(pArray,/*tagPrinter*/NULL,printcot,TRUE);
  7859. PrintReceipt_02(pArray, tagPrinter, printcot, TRUE);
  7860. }
  7861. }
  7862. if (tagPrinter) delete tagPrinter;
  7863. //}
  7864. }
  7865. //}
  7866. }
  7867. void CMainFrame::PrintFlowChart(CString strOrderNumber) // 选片打单;
  7868. {
  7869. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(75)))
  7870. {
  7871. // Jeff 使用风格2打印;
  7872. //PrintFlowChart3_20151116(strOrderNumber);
  7873. PrintFlowChart3(strOrderNumber);
  7874. return;
  7875. }
  7876. #ifdef ZHIAI_VERSION
  7877. PrintFlowChart2(strOrderNumber);
  7878. return;
  7879. #endif
  7880. int i = 0;
  7881. int printcot = 1;
  7882. for (int aa = 0; aa < printcot; aa++)
  7883. {
  7884. CPrintRX m_Print;
  7885. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7886. {
  7887. m_Print.InitToPrint(NULL, 1);
  7888. }
  7889. else
  7890. {
  7891. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  7892. if (name.IsEmpty())
  7893. m_Print.InitToPrint(NULL, 1);
  7894. else
  7895. {
  7896. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  7897. if (nret == -1 && aa == 0)
  7898. {
  7899. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  7900. }
  7901. }
  7902. }
  7903. m_Print.StartPrint();
  7904. m_Print.StartPage();
  7905. // CRect StrRect(0,0,560,818);
  7906. LoadRect load;
  7907. load.SetLiaPath("4.lia");
  7908. load.SetMargins(-14, -14);
  7909. if (!load.Load())return;
  7910. LoadRect load2;
  7911. load2.SetMargins(-14, 472 + 27 - 14);
  7912. load2.SetLiaPath("5.lia");
  7913. if (!load2.Load())return;
  7914. //////////////////////////////////////////////////////////////
  7915. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2'";
  7916. g_sendhead.code[0] = 54;
  7917. g_sendhead.code[1] = 223;
  7918. g_sendhead.tabcount = 2;
  7919. g_sendhead.bsql = 0;
  7920. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  7921. CArray<CStringArray, CStringArray>sparray;
  7922. DataToArray(&g_List1array, &sparray);
  7923. CString spno;
  7924. for ( i = 0; i < sparray.GetSize(); i++)
  7925. {
  7926. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  7927. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  7928. if (sparray.ElementAt(i).ElementAt(5) == "入册" && sparray.ElementAt(i).ElementAt(5) == "入底" && sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  7929. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  7930. spno += sparray.ElementAt(i).ElementAt(5);
  7931. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  7932. spno += "; ";
  7933. else
  7934. {
  7935. spno += ":";
  7936. spno += sparray.ElementAt(i).ElementAt(6);
  7937. spno += "; ";
  7938. }
  7939. }
  7940. spno += " 加挑:";
  7941. for (i = 0; i < sparray.GetSize(); i++)
  7942. {
  7943. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  7944. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  7945. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  7946. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  7947. spno += sparray.ElementAt(i).ElementAt(5);
  7948. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  7949. spno += "; ";
  7950. else
  7951. {
  7952. spno += ":";
  7953. spno += sparray.ElementAt(i).ElementAt(6);
  7954. spno += "; ";
  7955. }
  7956. }
  7957. if (spno.Right(6) == " 加挑:")
  7958. {
  7959. spno = spno.Left(spno.GetLength() - 6);
  7960. }
  7961. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  7962. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  7963. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  7964. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  7965. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  7966. if (m_urgent.IsEmpty())m_urgent = "否";
  7967. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  7968. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  7969. // CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  7970. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  7971. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  7972. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  7973. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  7974. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  7975. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  7976. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  7977. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  7978. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(17) + g_List1array.ElementAt(0).ElementAt(29);
  7979. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  7980. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  7981. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  7982. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  7983. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  7984. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  7985. CString m_sum3;
  7986. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  7987. ::ConvertToPrice(m_sum3);
  7988. if (m_money3.IsEmpty())m_money3 = "0";
  7989. // m_money3=m_money3+"/"+m_sum3;
  7990. CString name;
  7991. if (!m_name1.IsEmpty())
  7992. name = m_name1 + ",";
  7993. name += m_name2;
  7994. name.TrimRight(",");
  7995. CString phone;
  7996. if (!m_phone1.IsEmpty())
  7997. phone = m_phone1 + ",";
  7998. phone += m_phone2; phone.TrimRight(",");
  7999. if (IsHasRights2new(31) == 0)
  8000. phone = "***";
  8001. CStringArray strarray;
  8002. strarray.Add(m_urgent);
  8003. strarray.Add(m_ren);
  8004. strarray.Add(m_waiter3);
  8005. strarray.Add(name);
  8006. strarray.Add(m_time2);
  8007. strarray.Add(m_time4);
  8008. strarray.Add(m_money3);
  8009. strarray.Add(m_sum3);
  8010. strarray.Add(m_takezs);
  8011. strarray.Add(m_taoxizs);
  8012. strarray.Add(m_choosezs);
  8013. strarray.Add(strOrderNumber);
  8014. strarray.Add(phone);
  8015. ////////////////////////////////////////////////////////////////
  8016. int rcpos = -1;
  8017. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8018. Image *pImg = NULL;
  8019. #ifdef MNLS_VERSION
  8020. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  8021. #else
  8022. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  8023. #endif
  8024. m_Print.DrawImage(pImg, StrRect);
  8025. delete pImg;
  8026. m_Print.SetFontFace(11, 1, "宋体");
  8027. StrRect = load2.m_rcarray.ElementAt(7);
  8028. StrRect.top = load2.m_rcarray.ElementAt(15).top - 15;
  8029. StrRect.bottom = load2.m_rcarray.ElementAt(15).bottom - 15;
  8030. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  8031. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8032. StrRect.top += 15;
  8033. StrRect.bottom += 15;
  8034. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  8035. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8036. m_Print.SetFontFace(15, 1, "宋体");
  8037. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8038. #ifdef MNLS_VERSION
  8039. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8040. #endif
  8041. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8042. #ifdef MNLS_VERSION
  8043. m_Print.DrawRect(StrRect);
  8044. #endif
  8045. m_Print.SetFontFace(7, 1, "黑体");
  8046. m_Print.SetColor(0xffffff);
  8047. #ifdef MNLS_VERSION
  8048. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8049. #endif
  8050. m_Print.SetColor(0);
  8051. m_Print.SetFontFace(25, 1, "黑体");
  8052. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8053. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8054. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  8055. {
  8056. Image *pImg = NULL;
  8057. g_nSendCode = 31;
  8058. int g_nYearposTemp = g_nYearpos;
  8059. g_nYearpos = -1;
  8060. g_pMainWnd->ProcessChatMessageRequest2(1);
  8061. g_nYearpos = g_nYearposTemp;
  8062. g_nSendCode = 0;
  8063. if (g_bSendOK == 0)return;
  8064. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8065. if (pImg)
  8066. {
  8067. StrRect.left = 450;
  8068. StrRect.top = 22;
  8069. StrRect.right = StrRect.left + 60;
  8070. StrRect.bottom = StrRect.top + 60;
  8071. m_Print.DrawImage(pImg, StrRect);
  8072. delete pImg; pImg = NULL;
  8073. }
  8074. }
  8075. #ifdef CHILD_VERSION
  8076. CString title[13] = { "是否加急:", "接单门市:", \
  8077. "选样人员:", "客人姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  8078. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:"
  8079. };
  8080. #else
  8081. CString title[13] = { "是否加急:", "接单门市:", \
  8082. "选样人员:", "新郎新娘姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  8083. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:" };
  8084. #endif
  8085. m_Print.SetFontFace(12, 1, "宋体");
  8086. for (i = 0; i < 13; i++)
  8087. {
  8088. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8089. if (i < 3)
  8090. m_Print.DrawRect2(StrRect, 0);
  8091. else
  8092. m_Print.DrawRect2(StrRect, 1);
  8093. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8094. }
  8095. for (i = 18; i <= 37; i++)
  8096. {
  8097. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8098. if (i >= 19 && i <= 21)
  8099. m_Print.DrawRect2(StrRect, 2);
  8100. /* else if(i==26)
  8101. {
  8102. CRect rc=StrRect;
  8103. CRect rc2=rc;
  8104. rc.right -=rc2.Width ()/2;
  8105. m_Print.DrawRect2(rc, 1);
  8106. rc2.left +=rc.Width ();
  8107. m_Print.DrawRect2(rc2, 1);
  8108. }*/
  8109. else
  8110. m_Print.DrawRect2(StrRect, 1);
  8111. if (i == 18)
  8112. {
  8113. StrRect.left += 5;
  8114. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8115. }
  8116. }
  8117. //////////////////////////////////////
  8118. rcpos = -1;
  8119. for (i = 0; i < 8; i++)
  8120. {
  8121. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8122. m_Print.DrawRect2(StrRect, 1);
  8123. }
  8124. #ifdef CHILD_VERSION
  8125. CString title2[4] = { "引导师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  8126. #else
  8127. CString title2[4] = { "化妆师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  8128. #endif
  8129. for (i = 0; i < 4; i++)
  8130. {
  8131. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8132. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8133. }
  8134. for (i = 0; i < 4; i++)
  8135. {
  8136. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8137. m_Print.DrawRect2(StrRect, 2);
  8138. }
  8139. StrRect = load2.m_rcarray.ElementAt(11);
  8140. StrRect.top -= 15;
  8141. StrRect.bottom -= 15;
  8142. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客选片签名:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8143. StrRect = load2.m_rcarray.ElementAt(15);
  8144. StrRect.top -= 15;
  8145. StrRect.bottom -= 15;
  8146. m_Print.DrawRect2(StrRect, 2);
  8147. ///////////////////////////////////////////
  8148. for (i = 19; i <= 31; i++)
  8149. {
  8150. StrRect = load.m_rcarray.ElementAt(i - 1);
  8151. StrRect.left += 4;
  8152. if (i == 31)
  8153. {
  8154. if (m_phone1.IsEmpty() == 0 && m_phone2.IsEmpty() == 0)
  8155. {
  8156. StrRect.top += 2;
  8157. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  8158. StrRect.top += 8;
  8159. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8160. }
  8161. else
  8162. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8163. }
  8164. /* else if((i-19)==7)
  8165. {
  8166. CRect rc=StrRect;
  8167. CRect rc2=rc;
  8168. rc.right -=rc2.Width ()/2;
  8169. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8170. rc2.left +=rc.Width ()+3;
  8171. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8172. }*/
  8173. else
  8174. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8175. }
  8176. strarray.RemoveAll();
  8177. strarray.Add(m_waiter2);
  8178. strarray.Add(m_waiter1);
  8179. strarray.Add(m_waiter4);
  8180. for (i = 13; i <= 15; i++)
  8181. {
  8182. StrRect = load2.m_rcarray.ElementAt(i - 1);
  8183. StrRect.left += 4;
  8184. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8185. }
  8186. ///////////spno
  8187. CRect sprc[14];
  8188. for (i = 0; i < 14; i++)
  8189. {
  8190. if (i < 7)
  8191. {
  8192. if (i == 0)
  8193. {
  8194. StrRect = load.m_rcarray.ElementAt(17); StrRect.left += 94; StrRect.right -= 3;
  8195. }
  8196. else
  8197. {
  8198. StrRect = load.m_rcarray.ElementAt(30 + i); StrRect.left += 4; StrRect.right -= 3;
  8199. }
  8200. }
  8201. else
  8202. {
  8203. StrRect = load2.m_rcarray.ElementAt(i - 7); StrRect.left += 4; StrRect.right -= 3;
  8204. }
  8205. sprc[i] = StrRect;
  8206. }
  8207. CString temp, tempspno, tempbz;
  8208. CSize size;
  8209. BOOL bRun = 0;
  8210. int fontsize = 12;
  8211. ll: tempspno = spno;
  8212. tempbz = m_bz;
  8213. m_Print.SetFontFace(fontsize, 1, "宋体");
  8214. for (i = 0; i<14; i++)
  8215. {
  8216. if (!tempspno.IsEmpty())
  8217. {
  8218. temp = tempspno;
  8219. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8220. int right = 0;
  8221. CRect temprc = sprc[i];
  8222. while (size.cx>temprc.Width())
  8223. {
  8224. right++;
  8225. temp = tempspno.Left(tempspno.GetLength() - (right));
  8226. if (GIsHalfHZ(temp))
  8227. {
  8228. right++;
  8229. temp.Delete(temp.GetLength() - 1);
  8230. }
  8231. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8232. }
  8233. if (bRun)
  8234. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8235. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  8236. if (tempspno.IsEmpty())i++;
  8237. }
  8238. else if (!tempbz.IsEmpty())
  8239. {
  8240. temp = tempbz;
  8241. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8242. int right = 0;
  8243. CRect temprc = sprc[i];
  8244. while (size.cx > temprc.Width())
  8245. {
  8246. right++;
  8247. temp = tempbz.Left(tempbz.GetLength() - (right));
  8248. if (GIsHalfHZ(temp))
  8249. {
  8250. right++;
  8251. temp.Delete(temp.GetLength() - 1);
  8252. }
  8253. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8254. }
  8255. if (bRun)
  8256. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8257. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  8258. }
  8259. }
  8260. if (tempspno.IsEmpty() == 0 || tempbz.IsEmpty() == 0)
  8261. {
  8262. fontsize--;
  8263. goto ll;
  8264. }
  8265. if (bRun == 0)
  8266. {
  8267. bRun = 1;
  8268. goto ll;
  8269. }
  8270. PrintPreview dlg;
  8271. dlg.m_mode = 2;
  8272. dlg.m_name = name;
  8273. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8274. dlg.m_pDC = m_Print.GetPDC();
  8275. if (aa == 0)
  8276. {
  8277. if (dlg.DoModal() != IDOK)
  8278. return;
  8279. printcot = dlg.m_num;
  8280. }
  8281. //结束打印
  8282. m_Print.EndPage();
  8283. m_Print.EndPrint();
  8284. }
  8285. }
  8286. void CMainFrame::PrintFlowChart3LKAY(CString strOrderNumber)
  8287. {
  8288. int i = 0;
  8289. int printcot = 1;
  8290. for (int aa = 0; aa < printcot; aa++)
  8291. {
  8292. CPrintRX m_Print;
  8293. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  8294. {
  8295. m_Print.InitToPrint(NULL, 1);
  8296. }
  8297. else
  8298. {
  8299. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  8300. if (name.IsEmpty())
  8301. m_Print.InitToPrint(NULL, 1);
  8302. else
  8303. {
  8304. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8305. if (nret == -1 && aa == 0)
  8306. {
  8307. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8308. }
  8309. }
  8310. }
  8311. m_Print.StartPrint();
  8312. m_Print.StartPage();
  8313. LoadRect load;
  8314. load.SetLiaPath("18.lia");
  8315. load.SetMargins(10, 0);
  8316. if (!load.Load())return;
  8317. CString str;
  8318. int rcpos = -1;
  8319. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8320. m_Print.SetFontFace(25, 1, "宋体");
  8321. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8322. m_Print.SetFontFace(15, 1, "宋体");
  8323. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8324. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8325. m_Print.SetFontFace(9, 1, "宋体");
  8326. //////////////////////////////////////////////////////////////
  8327. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8328. g_sendhead.code[0] = 54;
  8329. g_sendhead.code[1] = 223;
  8330. g_sendhead.code[2] = 52;
  8331. g_sendhead.tabcount = 3;
  8332. g_sendhead.bsql = 0;
  8333. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  8334. CArray<CStringArray, CStringArray>sparray;
  8335. CArray<CStringArray, CStringArray>clientarray;
  8336. DataToArray(&g_List1array, &sparray, &clientarray);
  8337. CString spno;
  8338. CStringArray sparray2;
  8339. for ( i = 0; i < sparray.GetSize(); i++)
  8340. {
  8341. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8342. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8343. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8344. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8345. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8346. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8347. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8348. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8349. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8350. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8351. }
  8352. for (i = 0; i < sparray.GetSize(); i++)
  8353. {
  8354. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8355. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8356. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8357. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8358. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8359. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8360. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8361. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8362. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8363. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8364. }
  8365. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8366. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8367. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8368. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8369. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8370. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8371. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8372. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8373. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8374. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8375. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8376. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8377. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8378. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8379. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8380. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8381. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8382. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8383. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8384. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8385. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8386. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8387. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8388. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8389. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8390. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8391. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8392. CString m_sum3;
  8393. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8394. ::ConvertToPrice(m_sum3);
  8395. if (m_money3.IsEmpty())m_money3 = "0";
  8396. int dty = 0;
  8397. CString name;
  8398. if (!m_name1.IsEmpty())
  8399. name = m_name1 + ",";
  8400. name += m_name2;
  8401. name.TrimRight(",");
  8402. CString phone;
  8403. if (!m_phone1.IsEmpty())
  8404. phone = m_phone1 + ",";
  8405. phone += m_phone2; phone.TrimRight(",");
  8406. if (IsHasRights2new(31) == 0)
  8407. phone = "***";
  8408. CStringArray strarray;
  8409. #ifdef CHILD_VERSION
  8410. if (m_birthday.IsEmpty())
  8411. strarray.Add("姓名/性别");
  8412. else
  8413. strarray.Add("姓名/性别/年龄");
  8414. #else
  8415. strarray.Add("客人姓名");
  8416. #endif
  8417. strarray.Add("电话");
  8418. strarray.Add("单号");
  8419. strarray.Add("套系");
  8420. strarray.Add("选样");
  8421. strarray.Add("余款/加挑");
  8422. strarray.Add("选片/日期");
  8423. #ifdef CHILD_VERSION
  8424. if (m_birthday.IsEmpty())
  8425. strarray.Add(name + "/" + m_sex);
  8426. else
  8427. {
  8428. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8429. m_birthday.Format("%d", year + 1);
  8430. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8431. }
  8432. #else
  8433. strarray.Add(name);
  8434. #endif
  8435. strarray.Add(phone);
  8436. strarray.Add(strOrderNumber);
  8437. strarray.Add(m_taoxiname);
  8438. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8439. strarray.Add(str);
  8440. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8441. strarray.Add(str);
  8442. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8443. for (i = 3; i <= 16; i++)
  8444. {
  8445. StrRect = load.m_rcarray.ElementAt(i - 1);
  8446. if (i < 10)
  8447. {
  8448. m_Print.DrawRect2(StrRect, 1);
  8449. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8450. }
  8451. }
  8452. StrRect = load.m_rcarray.ElementAt(29);
  8453. m_Print.DrawRect2(StrRect, 1);
  8454. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8455. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  8456. {
  8457. Image *pImg = NULL;
  8458. g_nSendCode = 31;
  8459. int g_nYearposTemp = g_nYearpos;
  8460. g_nYearpos = -1;
  8461. g_pMainWnd->ProcessChatMessageRequest2(1);
  8462. g_nYearpos = g_nYearposTemp;
  8463. g_nSendCode = 0;
  8464. if (g_bSendOK == 0)return;
  8465. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8466. if (pImg)
  8467. {
  8468. StrRect.left = 485;
  8469. StrRect.top = 12;
  8470. StrRect.right = StrRect.left + 60;
  8471. StrRect.bottom = StrRect.top + 60;
  8472. m_Print.DrawImage(pImg, StrRect);
  8473. delete pImg; pImg = NULL;
  8474. }
  8475. }
  8476. CArray<CRect, CRect>rcarray;
  8477. CStringArray strarray2;
  8478. for (i = 10; i <= 16; i++)
  8479. {
  8480. StrRect = load.m_rcarray.ElementAt(i - 1);
  8481. StrRect.left += 2;
  8482. StrRect.right -= 2;
  8483. StrRect.top += 2;
  8484. rcarray.Add(StrRect);
  8485. strarray2.Add(strarray.ElementAt(7 + i - 10));
  8486. }
  8487. if (1)
  8488. {
  8489. StrRect = load.m_rcarray.ElementAt(30);
  8490. StrRect.left += 2;
  8491. StrRect.right -= 2;
  8492. StrRect.top += 2;
  8493. rcarray.Add(StrRect);
  8494. strarray2.Add(m_time6 + "/" + m_time5);
  8495. }
  8496. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8497. for (i = 10; i <= 16; i++)
  8498. {
  8499. StrRect = load.m_rcarray.ElementAt(i - 1);
  8500. if (i == 10)
  8501. {
  8502. dty += bottom - StrRect.bottom;
  8503. }
  8504. StrRect.bottom = bottom;
  8505. m_Print.DrawRect2(StrRect, 1);
  8506. }
  8507. if (1)
  8508. {
  8509. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  8510. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  8511. // m_Print.DrawText((LPTSTR)(LPCTSTR)(m_time6+"/"+m_time5), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER );
  8512. }
  8513. m_Print.SetFontFace(15, 1, "宋体");
  8514. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  8515. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8516. m_Print.SetFontFace(9, 1, "宋体");
  8517. strarray.RemoveAll();
  8518. strarray.Add("产品名称");
  8519. strarray.Add("数量");
  8520. strarray.Add("P数");
  8521. strarray.Add("张数");
  8522. strarray.Add("照片编号");
  8523. CArray<CRect, CRect>rc2array;
  8524. int wid = 25;
  8525. for (i = 18; i <= 22; i++)
  8526. {
  8527. StrRect = load.m_rcarray.ElementAt(i - 1);
  8528. if (i == 19)
  8529. {
  8530. StrRect.right = StrRect.left + wid;
  8531. }
  8532. if (i == 20)
  8533. {
  8534. StrRect = load.m_rcarray.ElementAt(i - 2);
  8535. StrRect.left += wid; StrRect.right = StrRect.left;
  8536. StrRect.right += wid;
  8537. }
  8538. if (i == 21)
  8539. {
  8540. StrRect = load.m_rcarray.ElementAt(i - 3);
  8541. StrRect.left += wid * 2; StrRect.right = StrRect.left;
  8542. StrRect.right += wid;
  8543. wid = StrRect.right;
  8544. }
  8545. if (i == 22)
  8546. {
  8547. StrRect = load.m_rcarray.ElementAt(i - 3);
  8548. StrRect.left = wid;
  8549. }
  8550. StrRect.top += dty; StrRect.bottom += dty;
  8551. m_Print.DrawRect2(StrRect, 1);
  8552. StrRect.left += 2;
  8553. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8554. StrRect.left -= 2;
  8555. StrRect.top = StrRect.bottom;
  8556. StrRect.bottom += 18;
  8557. rc2array.Add(StrRect);
  8558. }
  8559. int curypos = 0;
  8560. for (i = 0; i < sparray2.GetSize(); i += 5)
  8561. {
  8562. rcarray.RemoveAll();
  8563. strarray2.RemoveAll();
  8564. int j = 0;
  8565. for ( j = 0; j < 5; j++)
  8566. {
  8567. StrRect = rc2array.ElementAt(j);
  8568. StrRect.left += 2;
  8569. StrRect.right -= 2;
  8570. StrRect.top += 2;
  8571. rcarray.Add(StrRect);
  8572. strarray2.Add(sparray2.ElementAt(i + j));
  8573. }
  8574. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8575. rcarray.RemoveAll();
  8576. for (j = 0; j < 5; j++)
  8577. {
  8578. StrRect = rc2array.ElementAt(j);
  8579. if (j == 0)
  8580. {
  8581. dty += bottom - StrRect.bottom;
  8582. }
  8583. StrRect.bottom = bottom;
  8584. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8585. StrRect.top = StrRect.bottom;
  8586. StrRect.bottom += 18;
  8587. rcarray.Add(StrRect);
  8588. }
  8589. rc2array.RemoveAll();
  8590. rc2array.Copy(rcarray);
  8591. }
  8592. m_Print.SetFontFace(15, 1, "宋体");
  8593. StrRect = load.m_rcarray.ElementAt(20);
  8594. dty = curypos - StrRect.bottom + 35;
  8595. StrRect.top += dty; StrRect.bottom += dty;
  8596. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8597. m_Print.SetFontFace(9, 1, "宋体");
  8598. rcarray.RemoveAll();
  8599. strarray2.RemoveAll();
  8600. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8601. StrRect.left += 2;
  8602. StrRect.right -= 2;
  8603. StrRect.top += 2;
  8604. rcarray.Add(StrRect);
  8605. strarray2.Add(m_bz);
  8606. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8607. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8608. dty += bottom - StrRect.bottom;
  8609. StrRect.bottom = bottom;
  8610. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8611. m_Print.SetFontFace(10, 1, "宋体");
  8612. StrRect = load.m_rcarray.ElementAt(22);
  8613. dty = curypos - StrRect.bottom + 25;
  8614. StrRect.top += dty; StrRect.bottom += dty;
  8615. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  8616. if (m_edit9.IsEmpty())
  8617. {
  8618. m_edit9 = "\
  8619. 经确认后的照片均排入制作流程,\r\n\
  8620. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  8621. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  8622. }
  8623. CString info1, info2, info3;
  8624. int newlinepos = m_edit9.Find("\r\n");
  8625. if (newlinepos != -1)
  8626. {
  8627. info1 = m_edit9.Left(newlinepos);
  8628. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8629. }
  8630. newlinepos = m_edit9.Find("\r\n");
  8631. if (newlinepos != -1)
  8632. {
  8633. info2 = m_edit9.Left(newlinepos);
  8634. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8635. info3 = m_edit9;
  8636. }
  8637. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8638. StrRect = load.m_rcarray.ElementAt(23);
  8639. StrRect.top += dty; StrRect.bottom += dty;
  8640. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8641. StrRect = load.m_rcarray.ElementAt(24);
  8642. StrRect.top += dty; StrRect.bottom += dty;
  8643. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8644. StrRect.top += 15;
  8645. StrRect.bottom += 15;
  8646. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8647. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  8648. StrRect = load.m_rcarray.ElementAt(25);
  8649. StrRect.top += dty - dy;
  8650. StrRect.bottom += dty - dy;
  8651. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8652. StrRect = load.m_rcarray.ElementAt(26);
  8653. StrRect.top += dty - dy;
  8654. StrRect.bottom += dty - dy;
  8655. m_Print.DrawRect2(StrRect, 2);
  8656. StrRect = load.m_rcarray.ElementAt(25);
  8657. StrRect.top += dty + 15 - dy;
  8658. StrRect.bottom += dty + 15 - dy;
  8659. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8660. StrRect = load.m_rcarray.ElementAt(26);
  8661. StrRect.top += dty + 15 - dy;
  8662. StrRect.bottom += dty + 15 - dy;
  8663. m_Print.DrawRect2(StrRect, 2);
  8664. StrRect = load.m_rcarray.ElementAt(25);
  8665. StrRect.top += dty + 15 * 2 - dy;
  8666. StrRect.bottom += dty + 15 * 2 - dy;
  8667. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8668. StrRect = load.m_rcarray.ElementAt(26);
  8669. StrRect.top += dty + 15 * 2 - dy;
  8670. StrRect.bottom += dty + 15 * 2 - dy;
  8671. m_Print.DrawRect2(StrRect, 2);
  8672. PrintPreview dlg; dlg.m_mode = 2;
  8673. dlg.m_name = name;
  8674. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8675. dlg.m_pDC = m_Print.GetPDC();
  8676. if (aa == 0)
  8677. {
  8678. if (dlg.DoModal() != IDOK)
  8679. return;
  8680. printcot = dlg.m_num;
  8681. }
  8682. //结束打印
  8683. m_Print.EndPage();
  8684. m_Print.EndPrint();
  8685. }
  8686. }
  8687. void CMainFrame::PrintFlowChart3(CString strOrderNumber) // 选片打单 风格2;
  8688. {
  8689. #ifdef LKAY_VERSION
  8690. PrintFlowChart3LKAY(strOrderNumber);
  8691. return;
  8692. #endif
  8693. int i = 0;
  8694. int j = 0;
  8695. int printcot = 1;
  8696. for (int aa = 0; aa < printcot; aa++)
  8697. {
  8698. BOOL bSecondPage = 0;
  8699. int nPrintedPos = 0;
  8700. for (int bb = 0; bb < 2; bb++)
  8701. {
  8702. if (bb && bSecondPage == 0)break;
  8703. CPrintRX m_Print;
  8704. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58))) // 58-[version].[setcheck1] ==1,使用默认打印机;
  8705. {
  8706. m_Print.InitToPrint(NULL, 1);
  8707. }
  8708. else // 否则使用指定的打印机;
  8709. {
  8710. CString name = g_cominfoarray.ElementAt(0).ElementAt(64); // 64-[version].[printer2] 制作单打印机;
  8711. if (name.IsEmpty())
  8712. m_Print.InitToPrint(NULL, 1);
  8713. else
  8714. {
  8715. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8716. if (nret == -1 && aa == 0)
  8717. {
  8718. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8719. }
  8720. }
  8721. }
  8722. m_Print.StartPrint();
  8723. m_Print.StartPage();
  8724. LoadRect load;
  8725. load.SetLiaPath("18.lia");
  8726. load.SetMargins(10, 0);
  8727. if (!load.Load())return;
  8728. CString str;
  8729. int rcpos = -1;
  8730. // ■■■■■■从18.lia获取到第一个区域大小 - 1.显示店名;
  8731. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8732. if ((bb == 0 && bSecondPage == 0))
  8733. {
  8734. m_Print.SetFontFace(25, 1, "宋体");
  8735. // 10-[version].[info1] 店名;
  8736. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8737. m_Print.SetFontFace(15, 1, "宋体");
  8738. // ■■■■■■从18.lia获取第二个区域大小 - 2.显示"基本资料";
  8739. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8740. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8741. m_Print.SetFontFace(9, 1, "宋体");
  8742. }
  8743. //////////////////////////////////////////////////////////////
  8744. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8745. g_sendhead.code[0] = 54; // dindan;
  8746. g_sendhead.code[1] = 223; // dindanspview2; shangpin+dindansp;
  8747. g_sendhead.code[2] = 52; // client;
  8748. g_sendhead.tabcount = 3;
  8749. g_sendhead.bsql = 0;
  8750. g_pMainWnd->ProcessChatMessageRequest2(filter);
  8751. if (g_bSendOK == 0)return;
  8752. CArray<CStringArray, CStringArray>sparray;
  8753. CArray<CStringArray, CStringArray>clientarray;
  8754. DataToArray(&g_List1array, &sparray, &clientarray);
  8755. CString spno;
  8756. CStringArray sparray2;
  8757. for ( i = 0; i < sparray.GetSize(); i++)
  8758. {
  8759. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8760. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8761. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8762. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8763. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8764. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8765. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8766. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8767. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8768. }
  8769. for (i = 0; i < sparray.GetSize(); i++)
  8770. {
  8771. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8772. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8773. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8774. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8775. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8776. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8777. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8778. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8779. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8780. }
  8781. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8782. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8783. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8784. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8785. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8786. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8787. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8788. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8789. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8790. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8791. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8792. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8793. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8794. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8795. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8796. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8797. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8798. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8799. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  8800. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8801. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8802. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8803. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8804. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8805. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8806. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8807. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8808. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8809. CString m_sum3;
  8810. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8811. ::ConvertToPrice(m_sum3);
  8812. if (m_money3.IsEmpty())m_money3 = "0";
  8813. int dty = 0;
  8814. CString name;
  8815. if (!m_name1.IsEmpty())
  8816. name = m_name1 + ",";
  8817. name += m_name2;
  8818. name.TrimRight(",");
  8819. CString phone;
  8820. if (!m_phone1.IsEmpty())
  8821. phone = m_phone1 + ",";
  8822. phone += m_phone2; phone.TrimRight(",");
  8823. if (IsHasRights2new(31) == 0)
  8824. phone = "***";
  8825. CStringArray strarray;
  8826. CArray<CRect, CRect>rcarray;
  8827. CStringArray strarray2; CArray<CRect, CRect>rc2array;
  8828. int bottom;
  8829. if ((bb == 0 && bSecondPage == 0))
  8830. {
  8831. #ifdef CHILD_VERSION
  8832. if (m_birthday.IsEmpty())
  8833. strarray.Add("姓名/性别");
  8834. else
  8835. strarray.Add("姓名/性别/年龄");
  8836. #else
  8837. strarray.Add("客人姓名"); // 第3.1区域 -3.显示客人姓名;
  8838. #endif
  8839. strarray.Add("电话");
  8840. strarray.Add("单号");
  8841. strarray.Add("套系");
  8842. strarray.Add("选样");
  8843. strarray.Add("余款/加挑");
  8844. strarray.Add("选片/日期");
  8845. #ifdef CHILD_VERSION
  8846. if (m_birthday.IsEmpty())
  8847. strarray.Add(name + "/" + m_sex);
  8848. else
  8849. {
  8850. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8851. m_birthday.Format("%d", year + 1);
  8852. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8853. }
  8854. #else
  8855. strarray.Add(name); // 第4.1区域 -3.显示客人姓名;
  8856. #endif
  8857. strarray.Add(phone);
  8858. strarray.Add(strOrderNumber);
  8859. strarray.Add(m_taoxiname);
  8860. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8861. strarray.Add(str);
  8862. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8863. strarray.Add(str);
  8864. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8865. for (i = 3; i <= 16; i++)
  8866. {
  8867. // ■■■■■■从18.lia中获取第3~16的区域大小;
  8868. StrRect = load.m_rcarray.ElementAt(i - 1);
  8869. if (i < 10)
  8870. {
  8871. m_Print.DrawRect2(StrRect, 1);
  8872. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8873. }
  8874. }
  8875. // ■■■■■■从18.lia中获取第30的区域大小;
  8876. StrRect = load.m_rcarray.ElementAt(29);
  8877. m_Print.DrawRect2(StrRect, 1);
  8878. BOOL bPrintDate = 1;
  8879. #ifdef DDF_VERSION
  8880. // bPrintDate=0;
  8881. #else
  8882. if (m_time5 == "" && m_time6 == "")
  8883. bPrintDate = 0;
  8884. #endif
  8885. if (bPrintDate)
  8886. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8887. else
  8888. {
  8889. #ifdef CHILD_VERSION
  8890. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/引导", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8891. #else
  8892. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/化妆", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8893. #endif
  8894. }
  8895. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138))) // [version].[reverse3]
  8896. {
  8897. Image *pImg = NULL;
  8898. g_nSendCode = 31;
  8899. int g_nYearposTemp = g_nYearpos;
  8900. g_nYearpos = -1;
  8901. g_pMainWnd->ProcessChatMessageRequest2(1);
  8902. g_nYearpos = g_nYearposTemp;
  8903. g_nSendCode = 0;
  8904. if (g_bSendOK == 0)return;
  8905. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8906. // Jeff二维码的区域不是从18.lia里获取的,是固定在右上角指定区域;
  8907. if (pImg)
  8908. {
  8909. StrRect.left = 485;
  8910. StrRect.top = 12;
  8911. StrRect.right = StrRect.left + 60;
  8912. StrRect.bottom = StrRect.top + 60;
  8913. m_Print.DrawImage(pImg, StrRect);
  8914. delete pImg; pImg = NULL;
  8915. }
  8916. }
  8917. // CArray<CRect,CRect>rcarray;
  8918. // CStringArray strarray2;
  8919. // ■■■■■■从18.lia中获取第10的区域大小;
  8920. for (i = 10; i <= 16; i++)
  8921. {
  8922. StrRect = load.m_rcarray.ElementAt(i - 1);
  8923. StrRect.left += 2;
  8924. StrRect.right -= 2;
  8925. StrRect.top += 2;
  8926. rcarray.Add(StrRect);
  8927. strarray2.Add(strarray.ElementAt(7 + i - 10));
  8928. }
  8929. if (1)
  8930. {
  8931. // ■■■■■■从18.lia中获取第31的区域大小;
  8932. StrRect = load.m_rcarray.ElementAt(30);
  8933. StrRect.left += 2;
  8934. StrRect.right -= 2;
  8935. StrRect.top += 2;
  8936. rcarray.Add(StrRect);
  8937. if (bPrintDate)
  8938. strarray2.Add(m_time6 + "/" + m_time5);
  8939. else
  8940. {
  8941. strarray2.Add(m_waiter1 + "/" + m_waiter2);
  8942. }
  8943. }
  8944. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  8945. for (i = 10; i <= 16; i++)
  8946. {
  8947. StrRect = load.m_rcarray.ElementAt(i - 1);
  8948. if (i == 10)
  8949. {
  8950. dty += bottom - StrRect.bottom;
  8951. }
  8952. StrRect.bottom = bottom;
  8953. m_Print.DrawRect2(StrRect, 1);
  8954. }
  8955. if (1)
  8956. {
  8957. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  8958. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  8959. }
  8960. m_Print.SetFontFace(15, 1, "宋体");
  8961. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  8962. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8963. }
  8964. int curypos = 0;
  8965. int oldpos = 0;
  8966. if (bb == 1)
  8967. {
  8968. dty = -100;
  8969. oldpos = nPrintedPos;
  8970. if (oldpos == 0)oldpos = 10000;
  8971. }
  8972. m_Print.SetFontFace(9, 1, "宋体");
  8973. strarray.RemoveAll();
  8974. if ((oldpos != 10000 && oldpos < sparray2.GetSize()) || bb == 0)
  8975. {
  8976. strarray.Add("产品名称");
  8977. strarray.Add("数量");
  8978. strarray.Add("照片编号");
  8979. for (i = 18; i <= 20; i++)
  8980. {
  8981. StrRect = load.m_rcarray.ElementAt(i - 1);
  8982. StrRect.top += dty;
  8983. StrRect.bottom += dty;
  8984. m_Print.DrawRect2(StrRect, 1);
  8985. StrRect.left += 2;
  8986. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8987. StrRect.left -= 2;
  8988. StrRect.top = StrRect.bottom;
  8989. StrRect.bottom += 18;
  8990. rc2array.Add(StrRect);
  8991. }
  8992. }
  8993. for (i = oldpos; i < sparray2.GetSize(); i += 3)
  8994. {
  8995. rcarray.RemoveAll();
  8996. strarray2.RemoveAll();
  8997. for ( j = 0; j < 3; j++)
  8998. {
  8999. StrRect = rc2array.ElementAt(j);
  9000. StrRect.left += 2;
  9001. StrRect.right -= 2;
  9002. StrRect.top += 2;
  9003. rcarray.Add(StrRect);
  9004. #if JEFF_TEST_ON
  9005. if (2 == j)
  9006. {
  9007. CString strImg = sparray2.ElementAt(i + 2);
  9008. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  9009. if (nImgCount != 0)
  9010. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  9011. else if (!strImg.IsEmpty())
  9012. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  9013. strarray2.Add(strImg);
  9014. }
  9015. else
  9016. strarray2.Add(sparray2.ElementAt(i + j));
  9017. #else
  9018. strarray2.Add(sparray2.ElementAt(i + j));
  9019. #endif
  9020. }
  9021. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9022. rcarray.RemoveAll();
  9023. for (j = 0; j < 3; j++)
  9024. {
  9025. StrRect = rc2array.ElementAt(j);
  9026. if (j == 0)
  9027. {
  9028. dty += bottom - StrRect.bottom;
  9029. }
  9030. StrRect.bottom = bottom;
  9031. m_Print.DrawRect2(StrRect, 1);
  9032. curypos = StrRect.bottom;
  9033. StrRect.top = StrRect.bottom;
  9034. StrRect.bottom += 18;
  9035. rcarray.Add(StrRect);
  9036. }
  9037. rc2array.RemoveAll();
  9038. rc2array.Copy(rcarray);
  9039. if (bottom > 750)
  9040. {
  9041. bSecondPage = 1;
  9042. nPrintedPos = i + 3;
  9043. break;
  9044. }
  9045. }
  9046. if ((bb == 0 && bSecondPage == 0) || (bb == 1 && bSecondPage == 1))
  9047. {
  9048. m_Print.SetFontFace(15, 1, "宋体");
  9049. StrRect = load.m_rcarray.ElementAt(20);
  9050. dty = curypos - StrRect.bottom + 35;
  9051. StrRect.top += dty;
  9052. StrRect.bottom += dty;
  9053. if (StrRect.bottom > 700 && bb == 0)
  9054. {
  9055. bSecondPage = 1;
  9056. }
  9057. else
  9058. {
  9059. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9060. m_Print.SetFontFace(9, 1, "宋体");
  9061. rcarray.RemoveAll();
  9062. strarray2.RemoveAll();
  9063. StrRect = load.m_rcarray.ElementAt(21);
  9064. StrRect.top += dty;
  9065. StrRect.bottom += dty;
  9066. StrRect.left += 2;
  9067. StrRect.right -= 2;
  9068. StrRect.top += 2;
  9069. rcarray.Add(StrRect);
  9070. #if JEFF_TEST_ON
  9071. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9072. strarray2.RemoveAll();
  9073. CString strFind = "要求:";
  9074. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  9075. do
  9076. {
  9077. int nIndex = strbz3.Find(strFind, 1);
  9078. if (nIndex != -1)
  9079. {
  9080. CString strbz = strbz3.Left(nIndex);
  9081. strbz3 = strbz3.Mid(nIndex);
  9082. strarray2.Add(strbz);
  9083. }
  9084. else
  9085. {
  9086. strarray2.Add(strbz3);
  9087. strbz3 = "";
  9088. }
  9089. } while (strbz3.Find(strFind) != -1);
  9090. strarray2.Add(g_List1array.ElementAt(0).ElementAt(29));
  9091. strarray2.Add(g_List1array.ElementAt(0).ElementAt(23));
  9092. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  9093. #else
  9094. strarray2.Add(m_bz);
  9095. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9096. #endif
  9097. StrRect = load.m_rcarray.ElementAt(21);
  9098. StrRect.top += dty;
  9099. StrRect.bottom += dty;
  9100. dty += bottom - StrRect.bottom;
  9101. StrRect.bottom = bottom;
  9102. m_Print.DrawRect2(StrRect, 1);
  9103. curypos = StrRect.bottom;
  9104. m_Print.SetFontFace(10, 1, "宋体");
  9105. StrRect = load.m_rcarray.ElementAt(22);
  9106. dty = curypos - StrRect.bottom + 25;
  9107. StrRect.top += dty;
  9108. StrRect.bottom += dty;
  9109. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  9110. if (m_edit9.IsEmpty())
  9111. {
  9112. m_edit9 = "\
  9113. 经确认后的照片均排入制作流程,\r\n\
  9114. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9115. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9116. }
  9117. CString info1, info2, info3;
  9118. int newlinepos = m_edit9.Find("\r\n");
  9119. if (newlinepos != -1)
  9120. {
  9121. info1 = m_edit9.Left(newlinepos);
  9122. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9123. }
  9124. newlinepos = m_edit9.Find("\r\n");
  9125. if (newlinepos != -1)
  9126. {
  9127. info2 = m_edit9.Left(newlinepos);
  9128. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9129. info3 = m_edit9;
  9130. }
  9131. #ifdef QCH_VERSION
  9132. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9133. StrRect = load.m_rcarray.ElementAt(23);
  9134. StrRect.top += dty; StrRect.bottom += dty;
  9135. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9136. StrRect=load.m_rcarray .ElementAt (24);
  9137. StrRect.top +=dty;StrRect.bottom +=dty;
  9138. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9139. StrRect.top +=15;
  9140. StrRect.bottom +=15;
  9141. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9142. #else
  9143. if (1)
  9144. {
  9145. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9146. StrRect = load.m_rcarray.ElementAt(23);
  9147. StrRect.top += dty; StrRect.bottom += dty;
  9148. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9149. StrRect = load.m_rcarray.ElementAt(24);
  9150. StrRect.top += dty; StrRect.bottom += dty;
  9151. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9152. }
  9153. else
  9154. {
  9155. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", 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)"恕不接受更改及退费。实际冲晒出来的相片", 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)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9162. }
  9163. StrRect.top += 15;
  9164. StrRect.bottom += 15;
  9165. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9166. #endif
  9167. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  9168. StrRect = load.m_rcarray.ElementAt(25);
  9169. StrRect.top += dty - dy;
  9170. StrRect.bottom += dty - dy;
  9171. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9172. StrRect = load.m_rcarray.ElementAt(26);
  9173. StrRect.top += dty - dy;
  9174. StrRect.bottom += dty - dy;
  9175. m_Print.DrawRect2(StrRect, 2);
  9176. StrRect = load.m_rcarray.ElementAt(25);
  9177. StrRect.top += dty + 15 - dy;
  9178. StrRect.bottom += dty + 15 - dy;
  9179. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9180. StrRect = load.m_rcarray.ElementAt(26);
  9181. StrRect.top += dty + 15 - dy;
  9182. StrRect.bottom += dty + 15 - dy;
  9183. m_Print.DrawRect2(StrRect, 2);
  9184. StrRect = load.m_rcarray.ElementAt(25);
  9185. StrRect.top += dty + 15 * 2 - dy;
  9186. StrRect.bottom += dty + 15 * 2 - dy;
  9187. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9188. StrRect = load.m_rcarray.ElementAt(26);
  9189. StrRect.top += dty + 15 * 2 - dy;
  9190. StrRect.bottom += dty + 15 * 2 - dy;
  9191. m_Print.DrawRect2(StrRect, 2);
  9192. }
  9193. }
  9194. PrintPreview dlg; dlg.m_mode = 2;
  9195. dlg.m_name = name;
  9196. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  9197. dlg.m_pDC = m_Print.GetPDC();
  9198. if (aa == 0)
  9199. {
  9200. if (dlg.DoModal() != IDOK)
  9201. return;
  9202. printcot = dlg.m_num;
  9203. }
  9204. //结束打印
  9205. m_Print.EndPage();
  9206. m_Print.EndPrint();
  9207. }
  9208. }
  9209. }
  9210. void CMainFrame::PrintFlowChart3_20151116(CString strOrderNumber) // 选片打单 风格2;
  9211. {
  9212. #ifdef LKAY_VERSION
  9213. PrintFlowChart3LKAY(strOrderNumber);
  9214. return;
  9215. #endif
  9216. int i = 0;
  9217. int j = 0;
  9218. int printcot = 1;
  9219. for (int aa = 0; aa < printcot; aa++)
  9220. {
  9221. BOOL bSecondPage = 0;
  9222. int nPrintedPos = 0;
  9223. for (int bb = 0; bb < 3; bb++)
  9224. {
  9225. if (bb && bSecondPage == 0)break;
  9226. CPrintRX m_Print;
  9227. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58))) // 58-[version].[setcheck1] ==1,使用默认打印机;
  9228. {
  9229. m_Print.InitToPrint(NULL, 1);
  9230. }
  9231. else // 否则使用指定的打印机;
  9232. {
  9233. CString name = g_cominfoarray.ElementAt(0).ElementAt(64); // 64-[version].[printer2] 制作单打印机;
  9234. if (name.IsEmpty())
  9235. m_Print.InitToPrint(NULL, 1);
  9236. else
  9237. {
  9238. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9239. if (nret == -1 && aa == 0)
  9240. {
  9241. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9242. }
  9243. }
  9244. }
  9245. m_Print.StartPrint();
  9246. m_Print.StartPage();
  9247. LoadRect load;
  9248. load.SetLiaPath("18.lia");
  9249. load.SetMargins(10, 0);
  9250. if (!load.Load())return;
  9251. CString str;
  9252. int rcpos = -1;
  9253. // ■■■■■■从18.lia获取到第一个区域大小 - 1.显示店名;
  9254. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  9255. if ((bb == 0 && bSecondPage == 0))
  9256. {
  9257. m_Print.SetFontFace(25, 1, "宋体");
  9258. // 10-[version].[info1] 店名;
  9259. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9260. m_Print.SetFontFace(15, 1, "宋体");
  9261. // ■■■■■■从18.lia获取第二个区域大小 - 2.显示"基本资料";
  9262. StrRect = load.m_rcarray.ElementAt(++rcpos);
  9263. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9264. m_Print.SetFontFace(9, 1, "宋体");
  9265. }
  9266. //////////////////////////////////////////////////////////////////////////
  9267. // 获取打印所需要的数据,并布局好;
  9268. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  9269. g_sendhead.code[0] = 54; // dindan;
  9270. g_sendhead.code[1] = 223; // dindanspview2; shangpin+dindansp;
  9271. g_sendhead.code[2] = 52; // client;
  9272. g_sendhead.tabcount = 3;
  9273. g_sendhead.bsql = 0;
  9274. g_pMainWnd->ProcessChatMessageRequest2(filter);
  9275. if (g_bSendOK == 0)return;
  9276. CArray<CStringArray, CStringArray>sparray;
  9277. CArray<CStringArray, CStringArray>clientarray;
  9278. DataToArray(&g_List1array, &sparray, &clientarray);
  9279. CString spno;
  9280. CStringArray sparray2;
  9281. for ( i = 0; i < sparray.GetSize(); i++)
  9282. {
  9283. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  9284. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  9285. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  9286. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9287. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  9288. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9289. sparray2.Add(sparray.ElementAt(i).ElementAt(5)); // 商品名称;
  9290. sparray2.Add(sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  9291. sparray2.Add(sparray.ElementAt(i).ElementAt(6)); // 选中的相片串;
  9292. sparray2.Add(sparray.ElementAt(i).ElementAt(10)); // 商品备注;
  9293. }
  9294. for (i = 0; i < sparray.GetSize(); i++)
  9295. {
  9296. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  9297. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  9298. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  9299. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9300. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  9301. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9302. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+"); // 商品名称;
  9303. sparray2.Add(sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  9304. sparray2.Add(sparray.ElementAt(i).ElementAt(6)); // 选中的相片串;
  9305. sparray2.Add(sparray.ElementAt(i).ElementAt(10)); // 商品备注;
  9306. }
  9307. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  9308. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  9309. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  9310. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  9311. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  9312. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  9313. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  9314. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  9315. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  9316. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  9317. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  9318. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  9319. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  9320. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  9321. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  9322. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  9323. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  9324. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  9325. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9326. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  9327. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  9328. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  9329. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  9330. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  9331. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  9332. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  9333. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  9334. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  9335. CString m_sum3;
  9336. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  9337. ::ConvertToPrice(m_sum3);
  9338. if (m_money3.IsEmpty())m_money3 = "0";
  9339. int dty = 0;
  9340. CString name;
  9341. if (!m_name1.IsEmpty())
  9342. name = m_name1 + ",";
  9343. name += m_name2;
  9344. name.TrimRight(",");
  9345. CString phone;
  9346. if (!m_phone1.IsEmpty())
  9347. phone = m_phone1 + ",";
  9348. phone += m_phone2; phone.TrimRight(",");
  9349. if (IsHasRights2new(31) == 0)
  9350. phone = "***";
  9351. CStringArray strarray;
  9352. CArray<CRect, CRect>rcarray;
  9353. CStringArray strarray2; CArray<CRect, CRect>rc2array;
  9354. int bottom;
  9355. //////////////////////////////////////////////////////////////////////////
  9356. // 开始画打印DC;
  9357. if ((bb == 0 && bSecondPage == 0))
  9358. {
  9359. #ifdef CHILD_VERSION
  9360. if (m_birthday.IsEmpty())
  9361. strarray.Add("姓名/性别");
  9362. else
  9363. strarray.Add("姓名/性别/年龄");
  9364. #else
  9365. strarray.Add("客人姓名"); // 第3.1区域 -3.显示客人姓名;
  9366. #endif
  9367. strarray.Add("电话");
  9368. strarray.Add("单号");
  9369. strarray.Add("套系");
  9370. strarray.Add("选样");
  9371. strarray.Add("余款/加挑");
  9372. strarray.Add("选片/日期");
  9373. #ifdef CHILD_VERSION
  9374. if (m_birthday.IsEmpty())
  9375. strarray.Add(name + "/" + m_sex);
  9376. else
  9377. {
  9378. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  9379. m_birthday.Format("%d", year + 1);
  9380. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  9381. }
  9382. #else
  9383. strarray.Add(name); // 第4.1区域 -3.显示客人姓名;
  9384. #endif
  9385. strarray.Add(phone);
  9386. strarray.Add(strOrderNumber);
  9387. strarray.Add(m_taoxiname);
  9388. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9389. strarray.Add(str);
  9390. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  9391. strarray.Add(str);
  9392. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  9393. for (i = 3; i <= 16; i++)
  9394. {
  9395. // ■■■■■■从18.lia中获取第3~16的区域大小;
  9396. StrRect = load.m_rcarray.ElementAt(i - 1);
  9397. if (i < 10)
  9398. {
  9399. m_Print.DrawRect2(StrRect, 1);
  9400. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9401. }
  9402. }
  9403. // ■■■■■■从18.lia中获取第30的区域大小;
  9404. StrRect = load.m_rcarray.ElementAt(29);
  9405. m_Print.DrawRect2(StrRect, 1);
  9406. BOOL bPrintDate = 1;
  9407. #ifdef DDF_VERSION
  9408. // bPrintDate=0;
  9409. #else
  9410. if (m_time5 == "" && m_time6 == "")
  9411. bPrintDate = 0;
  9412. #endif
  9413. if (bPrintDate)
  9414. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9415. else
  9416. {
  9417. #ifdef CHILD_VERSION
  9418. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/引导", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9419. #else
  9420. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/化妆", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9421. #endif
  9422. }
  9423. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138))) // [version].[reverse3]
  9424. {
  9425. Image *pImg = NULL;
  9426. g_nSendCode = 31;
  9427. int g_nYearposTemp = g_nYearpos;
  9428. g_nYearpos = -1;
  9429. g_pMainWnd->ProcessChatMessageRequest2(1);
  9430. g_nYearpos = g_nYearposTemp;
  9431. g_nSendCode = 0;
  9432. if (g_bSendOK == 0)return;
  9433. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  9434. // Jeff二维码的区域不是从18.lia里获取的,是固定在右上角指定区域;
  9435. if (pImg)
  9436. {
  9437. StrRect.left = 485;
  9438. StrRect.top = 12;
  9439. StrRect.right = StrRect.left + 60;
  9440. StrRect.bottom = StrRect.top + 60;
  9441. m_Print.DrawImage(pImg, StrRect);
  9442. delete pImg; pImg = NULL;
  9443. }
  9444. }
  9445. // CArray<CRect,CRect>rcarray;
  9446. // CStringArray strarray2;
  9447. // ■■■■■■从18.lia中获取第10的区域大小;
  9448. for (i = 10; i <= 16; i++)
  9449. {
  9450. StrRect = load.m_rcarray.ElementAt(i - 1);
  9451. StrRect.left += 2;
  9452. StrRect.right -= 2;
  9453. StrRect.top += 2;
  9454. rcarray.Add(StrRect);
  9455. strarray2.Add(strarray.ElementAt(7 + i - 10));
  9456. }
  9457. if (1)
  9458. {
  9459. // ■■■■■■从18.lia中获取第31的区域大小;
  9460. StrRect = load.m_rcarray.ElementAt(30);
  9461. StrRect.left += 2;
  9462. StrRect.right -= 2;
  9463. StrRect.top += 2;
  9464. rcarray.Add(StrRect);
  9465. if (bPrintDate)
  9466. strarray2.Add(m_time6 + "/" + m_time5);
  9467. else
  9468. {
  9469. strarray2.Add(m_waiter1 + "/" + m_waiter2);
  9470. }
  9471. }
  9472. int bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  9473. for (i = 10; i <= 16; i++)
  9474. {
  9475. StrRect = load.m_rcarray.ElementAt(i - 1);
  9476. if (i == 10)
  9477. {
  9478. dty += bottom - StrRect.bottom;
  9479. }
  9480. StrRect.bottom = bottom;
  9481. m_Print.DrawRect2(StrRect, 1);
  9482. }
  9483. if (1)
  9484. {
  9485. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  9486. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  9487. }
  9488. m_Print.SetFontFace(15, 1, "宋体");
  9489. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  9490. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9491. }
  9492. int curypos = 0;
  9493. int oldpos = 0;
  9494. if (bb == 1)
  9495. {
  9496. dty = -100;
  9497. oldpos = nPrintedPos;
  9498. if (oldpos == 0)oldpos = 10000;
  9499. }
  9500. m_Print.SetFontFace(9, 1, "宋体");
  9501. strarray.RemoveAll();
  9502. if ((oldpos != 10000 && oldpos < sparray2.GetSize()) || bb == 0)
  9503. {
  9504. strarray.Add("产品名称");
  9505. strarray.Add("数量");
  9506. strarray.Add("照片编号");
  9507. strarray.Add(_T("备注"));
  9508. CRect mycr[4] = {
  9509. CRect(39,172,130,189), // 产品名称;
  9510. CRect(130,172,157,189), // 产品数量;
  9511. CRect(157,172,407,189), // 相片;
  9512. CRect(407,172,546,189) // 备注;
  9513. };
  9514. for (i = 0; i <= 3; i++)
  9515. {
  9516. StrRect = mycr[i];
  9517. StrRect.top += dty;
  9518. StrRect.bottom += dty;
  9519. m_Print.DrawRect2(StrRect, 1);
  9520. StrRect.left += 2;
  9521. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9522. StrRect.left -= 2;
  9523. StrRect.top = StrRect.bottom;
  9524. StrRect.bottom += 18;
  9525. rc2array.Add(StrRect);
  9526. }
  9527. }
  9528. for (i = oldpos; i < sparray2.GetSize(); i += 4)
  9529. {
  9530. rcarray.RemoveAll();
  9531. strarray2.RemoveAll();
  9532. for ( j = 0; j < 4; j++)
  9533. {
  9534. StrRect = rc2array.ElementAt(j);
  9535. StrRect.left += 2;
  9536. StrRect.right -= 2;
  9537. StrRect.top += 2;
  9538. rcarray.Add(StrRect);
  9539. #if JEFF_TEST_ON
  9540. if (2 == j)
  9541. {
  9542. CString strImg = sparray2.ElementAt(i + 2);
  9543. //int nImgCount = strImg.Replace(",", ",");
  9544. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  9545. if (nImgCount != 0)
  9546. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  9547. else if (!strImg.IsEmpty())
  9548. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  9549. strarray2.Add(strImg);
  9550. }
  9551. else
  9552. strarray2.Add(sparray2.ElementAt(i + j));
  9553. #else
  9554. strarray2.Add(sparray2.ElementAt(i + j));
  9555. #endif
  9556. }
  9557. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9558. rcarray.RemoveAll();
  9559. for (j = 0; j < 4; j++)
  9560. {
  9561. StrRect = rc2array.ElementAt(j);
  9562. if (j == 0)
  9563. {
  9564. dty += bottom - StrRect.bottom;
  9565. }
  9566. StrRect.bottom = bottom;
  9567. m_Print.DrawRect2(StrRect, 1);
  9568. curypos = StrRect.bottom;
  9569. StrRect.top = StrRect.bottom;
  9570. StrRect.bottom += 18;
  9571. rcarray.Add(StrRect);
  9572. }
  9573. rc2array.RemoveAll();
  9574. rc2array.Copy(rcarray);
  9575. if (bottom > 750)
  9576. {
  9577. bSecondPage = 1;
  9578. nPrintedPos = i + 3;
  9579. break;
  9580. }
  9581. }
  9582. if ((bb == 0 && bSecondPage == 0) || (bb == 1 && bSecondPage == 1))
  9583. {
  9584. m_Print.SetFontFace(15, 1, "宋体");
  9585. StrRect = load.m_rcarray.ElementAt(20);
  9586. dty = curypos - StrRect.bottom + 35;
  9587. StrRect.top += dty;
  9588. StrRect.bottom += dty;
  9589. if (StrRect.bottom > 700 && bb == 0)
  9590. {
  9591. bSecondPage = 1;
  9592. }
  9593. else
  9594. {
  9595. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9596. m_Print.SetFontFace(9, 1, "宋体");
  9597. rcarray.RemoveAll();
  9598. strarray2.RemoveAll();
  9599. StrRect = load.m_rcarray.ElementAt(21);
  9600. StrRect.top += dty;
  9601. StrRect.bottom += dty;
  9602. StrRect.left += 2;
  9603. StrRect.right -= 2;
  9604. StrRect.top += 2;
  9605. rcarray.Add(StrRect);
  9606. #if JEFF_TEST_ON
  9607. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9608. strarray2.RemoveAll();
  9609. CString strFind = "要求:";
  9610. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  9611. do
  9612. {
  9613. int nIndex = strbz3.Find(strFind, 1);
  9614. if (nIndex != -1)
  9615. {
  9616. CString strbz = strbz3.Left(nIndex);
  9617. strbz3 = strbz3.Mid(nIndex);
  9618. strarray2.Add(strbz);
  9619. }
  9620. else
  9621. {
  9622. strarray2.Add(strbz3);
  9623. strbz3 = "";
  9624. }
  9625. } while (strbz3.Find(strFind) != -1);
  9626. strarray2.Add(g_List1array.ElementAt(0).ElementAt(29));
  9627. strarray2.Add(g_List1array.ElementAt(0).ElementAt(23));
  9628. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  9629. #else
  9630. strarray2.Add(m_bz);
  9631. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9632. #endif
  9633. StrRect = load.m_rcarray.ElementAt(21);
  9634. StrRect.top += dty;
  9635. StrRect.bottom += dty;
  9636. dty += bottom - StrRect.bottom;
  9637. StrRect.bottom = bottom;
  9638. m_Print.DrawRect2(StrRect, 1);
  9639. curypos = StrRect.bottom;
  9640. m_Print.SetFontFace(10, 1, "宋体");
  9641. StrRect = load.m_rcarray.ElementAt(22);
  9642. dty = curypos - StrRect.bottom + 25;
  9643. StrRect.top += dty;
  9644. StrRect.bottom += dty;
  9645. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  9646. if (m_edit9.IsEmpty())
  9647. {
  9648. m_edit9 = "\
  9649. 经确认后的照片均排入制作流程,\r\n\
  9650. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9651. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9652. }
  9653. CString info1, info2, info3;
  9654. int newlinepos = m_edit9.Find("\r\n");
  9655. if (newlinepos != -1)
  9656. {
  9657. info1 = m_edit9.Left(newlinepos);
  9658. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9659. }
  9660. newlinepos = m_edit9.Find("\r\n");
  9661. if (newlinepos != -1)
  9662. {
  9663. info2 = m_edit9.Left(newlinepos);
  9664. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9665. info3 = m_edit9;
  9666. }
  9667. #ifdef QCH_VERSION
  9668. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9669. StrRect = load.m_rcarray.ElementAt(23);
  9670. StrRect.top += dty; StrRect.bottom += dty;
  9671. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9672. StrRect=load.m_rcarray .ElementAt (24);
  9673. StrRect.top +=dty;StrRect.bottom +=dty;
  9674. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9675. StrRect.top +=15;
  9676. StrRect.bottom +=15;
  9677. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9678. #else
  9679. if (1)
  9680. {
  9681. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9682. StrRect = load.m_rcarray.ElementAt(23);
  9683. StrRect.top += dty; StrRect.bottom += dty;
  9684. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9685. StrRect = load.m_rcarray.ElementAt(24);
  9686. StrRect.top += dty; StrRect.bottom += dty;
  9687. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9688. }
  9689. else
  9690. {
  9691. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", 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)"恕不接受更改及退费。实际冲晒出来的相片", 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)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9698. }
  9699. StrRect.top += 15;
  9700. StrRect.bottom += 15;
  9701. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9702. #endif
  9703. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  9704. StrRect = load.m_rcarray.ElementAt(25);
  9705. StrRect.top += dty - dy;
  9706. StrRect.bottom += dty - dy;
  9707. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9708. StrRect = load.m_rcarray.ElementAt(26);
  9709. StrRect.top += dty - dy;
  9710. StrRect.bottom += dty - dy;
  9711. m_Print.DrawRect2(StrRect, 2);
  9712. StrRect = load.m_rcarray.ElementAt(25);
  9713. StrRect.top += dty + 15 - dy;
  9714. StrRect.bottom += dty + 15 - dy;
  9715. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9716. StrRect = load.m_rcarray.ElementAt(26);
  9717. StrRect.top += dty + 15 - dy;
  9718. StrRect.bottom += dty + 15 - dy;
  9719. m_Print.DrawRect2(StrRect, 2);
  9720. StrRect = load.m_rcarray.ElementAt(25);
  9721. StrRect.top += dty + 15 * 2 - dy;
  9722. StrRect.bottom += dty + 15 * 2 - dy;
  9723. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9724. StrRect = load.m_rcarray.ElementAt(26);
  9725. StrRect.top += dty + 15 * 2 - dy;
  9726. StrRect.bottom += dty + 15 * 2 - dy;
  9727. m_Print.DrawRect2(StrRect, 2);
  9728. }
  9729. }
  9730. PrintPreview dlg; dlg.m_mode = 2;
  9731. dlg.m_name = name;
  9732. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  9733. dlg.m_pDC = m_Print.GetPDC();
  9734. if (aa == 0)
  9735. {
  9736. if (dlg.DoModal() != IDOK)
  9737. return;
  9738. printcot = dlg.m_num;
  9739. }
  9740. //结束打印
  9741. m_Print.EndPage();
  9742. m_Print.EndPrint();
  9743. }
  9744. }
  9745. }
  9746. //void CMainFrame::PrintFlowChart4(CString m_id) // 选设计打单函数;
  9747. void CMainFrame::PrintFlowChart4(CString strOrderNumber) // 选设计打单函数,使用18.lia文件;
  9748. {
  9749. int i = 0;
  9750. int j = 0;
  9751. int printcot = 1;
  9752. for (int aa = 0; aa < printcot; aa++)
  9753. {
  9754. CPrintRX m_Print;
  9755. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  9756. {
  9757. m_Print.InitToPrint(NULL, 1);
  9758. }
  9759. else
  9760. {
  9761. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  9762. if (name.IsEmpty())
  9763. m_Print.InitToPrint(NULL, 1);
  9764. else
  9765. {
  9766. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9767. if (nret == -1 && aa == 0)
  9768. {
  9769. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9770. }
  9771. }
  9772. }
  9773. m_Print.StartPrint();
  9774. m_Print.StartPage();
  9775. LoadRect load;
  9776. load.SetLiaPath("18.lia");
  9777. load.SetMargins(10, 0);
  9778. if (!load.Load())return;
  9779. CString str;
  9780. int rcpos = -1;
  9781. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  9782. m_Print.SetFontFace(25, 1, "宋体");
  9783. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9784. m_Print.SetFontFace(15, 1, "宋体");
  9785. StrRect = load.m_rcarray.ElementAt(++rcpos);
  9786. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9787. m_Print.SetFontFace(9, 1, "宋体");
  9788. //////////////////////////////////////////////////////////////
  9789. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  9790. g_sendhead.code[0] = 54;
  9791. g_sendhead.code[1] = 223;
  9792. g_sendhead.code[2] = 52;
  9793. g_sendhead.tabcount = 3;
  9794. g_sendhead.bsql = 0;
  9795. g_pMainWnd->ProcessChatMessageRequest2(filter);
  9796. if (g_bSendOK == 0)return;
  9797. CArray<CStringArray, CStringArray>sparray;
  9798. CArray<CStringArray, CStringArray>clientarray;
  9799. DataToArray(&g_List1array, &sparray, &clientarray);
  9800. CString spno;
  9801. CStringArray sparray2;
  9802. for ( i = 0; i < sparray.GetSize(); i++)
  9803. {
  9804. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  9805. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(8).IsEmpty())continue;
  9806. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9807. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9808. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  9809. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9810. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9811. }
  9812. for (i = 0; i < sparray.GetSize(); i++)
  9813. {
  9814. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  9815. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  9816. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  9817. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9818. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9819. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  9820. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9821. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9822. }
  9823. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  9824. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  9825. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  9826. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  9827. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  9828. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  9829. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  9830. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  9831. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  9832. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  9833. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  9834. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  9835. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  9836. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  9837. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  9838. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  9839. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  9840. CString m_bz = g_List1array.ElementAt(0).ElementAt(17);
  9841. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(25);
  9842. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  9843. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  9844. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  9845. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  9846. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  9847. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  9848. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  9849. CString m_waiter8 = g_List1array.ElementAt(0).ElementAt(27);
  9850. CString m_replace = g_List1array.ElementAt(0).ElementAt(28);
  9851. if (!m_replace.IsEmpty())
  9852. {
  9853. m_replace = "设计替换照片:" + m_replace;
  9854. m_replace.Replace("$", ";");
  9855. m_replace.TrimLeft(";");
  9856. m_bz += ";";
  9857. m_bz += m_replace;
  9858. }
  9859. CString m_sum3;
  9860. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  9861. ::ConvertToPrice(m_sum3);
  9862. if (m_money3.IsEmpty())m_money3 = "0";
  9863. int dty = 0;
  9864. CString name;
  9865. if (!m_name1.IsEmpty())
  9866. name = m_name1 + ",";
  9867. name += m_name2;
  9868. name.TrimRight(",");
  9869. CString phone;
  9870. if (!m_phone1.IsEmpty())
  9871. phone = m_phone1 + ",";
  9872. phone += m_phone2; phone.TrimRight(",");
  9873. if (IsHasRights2new(31) == 0)
  9874. phone = "***";
  9875. CStringArray strarray;
  9876. #ifdef CHILD_VERSION
  9877. if (m_birthday.IsEmpty())
  9878. strarray.Add("姓名/性别");
  9879. else
  9880. strarray.Add("姓名/性别/年龄");
  9881. #else
  9882. strarray.Add("客人姓名");
  9883. #endif
  9884. strarray.Add("电话");
  9885. strarray.Add("单号");
  9886. strarray.Add("套系");
  9887. strarray.Add("");
  9888. strarray.Add("余款/加挑");
  9889. strarray.Add("看设计/日期");
  9890. #ifdef CHILD_VERSION
  9891. if (m_birthday.IsEmpty())
  9892. strarray.Add(name + "/" + m_sex);
  9893. else
  9894. {
  9895. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  9896. m_birthday.Format("%d", year + 1);
  9897. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  9898. }
  9899. #else
  9900. strarray.Add(name);
  9901. #endif
  9902. strarray.Add(phone);
  9903. strarray.Add(strOrderNumber);
  9904. strarray.Add(m_taoxiname);
  9905. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9906. strarray.Add("");
  9907. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  9908. strarray.Add(str);
  9909. strarray.Add(m_waiter8 + "/" + m_time6);
  9910. //////////////////////////////////////////////
  9911. if (1)
  9912. {
  9913. StrRect = load.m_rcarray.ElementAt(6);
  9914. int addwid = StrRect.Width() / 6;
  9915. for (i = 3; i <= 6; i++)
  9916. {
  9917. StrRect = load.m_rcarray.ElementAt(i - 1);
  9918. StrRect.left += (i - 3)*addwid;
  9919. StrRect.right += (i - 2)*addwid;
  9920. load.m_rcarray.SetAt(i - 1, StrRect);
  9921. }
  9922. StrRect.left = StrRect.right = -1;
  9923. load.m_rcarray.SetAt(6, StrRect);
  9924. for (i = 10; i <= 13; i++)
  9925. {
  9926. StrRect = load.m_rcarray.ElementAt(i - 1);
  9927. StrRect.left += (i - 10)*addwid;
  9928. StrRect.right += (i - 9)*addwid;
  9929. load.m_rcarray.SetAt(i - 1, StrRect);
  9930. }
  9931. StrRect.left = StrRect.right = -1;
  9932. load.m_rcarray.SetAt(13, StrRect);
  9933. StrRect = load.m_rcarray.ElementAt(7);
  9934. int rcwid = StrRect.Width();
  9935. StrRect.left = load.m_rcarray.ElementAt(5).right;
  9936. StrRect.right = StrRect.left + rcwid + addwid;
  9937. load.m_rcarray.SetAt(7, StrRect);
  9938. StrRect = load.m_rcarray.ElementAt(8);
  9939. StrRect.left = load.m_rcarray.ElementAt(7).right;
  9940. StrRect.right = load.m_rcarray.ElementAt(29).left;
  9941. load.m_rcarray.SetAt(8, StrRect);
  9942. StrRect = load.m_rcarray.ElementAt(14);
  9943. rcwid = StrRect.Width();
  9944. StrRect.left = load.m_rcarray.ElementAt(12).right;
  9945. StrRect.right = StrRect.left + rcwid + addwid;
  9946. load.m_rcarray.SetAt(14, StrRect);
  9947. StrRect = load.m_rcarray.ElementAt(15);
  9948. StrRect.left = load.m_rcarray.ElementAt(14).right;
  9949. StrRect.right = load.m_rcarray.ElementAt(29).left;
  9950. load.m_rcarray.SetAt(15, StrRect);
  9951. }
  9952. ////////////////////////////////////////////////
  9953. for (i = 3; i <= 16; i++)
  9954. {
  9955. StrRect = load.m_rcarray.ElementAt(i - 1);
  9956. if (i < 10)
  9957. {
  9958. m_Print.DrawRect2(StrRect, 1);
  9959. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9960. }
  9961. }
  9962. StrRect = load.m_rcarray.ElementAt(29);
  9963. m_Print.DrawRect2(StrRect, 1);
  9964. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9965. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  9966. {
  9967. Image *pImg = NULL;
  9968. g_nSendCode = 31;
  9969. int g_nYearposTemp = g_nYearpos;
  9970. g_nYearpos = -1;
  9971. g_pMainWnd->ProcessChatMessageRequest2(1);
  9972. g_nYearpos = g_nYearposTemp;
  9973. g_nSendCode = 0;
  9974. if (g_bSendOK == 0)return;
  9975. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  9976. if (pImg)
  9977. {
  9978. StrRect.left = 485;
  9979. StrRect.top = 12;
  9980. StrRect.right = StrRect.left + 60;
  9981. StrRect.bottom = StrRect.top + 60;
  9982. m_Print.DrawImage(pImg, StrRect);
  9983. delete pImg; pImg = NULL;
  9984. }
  9985. }
  9986. CArray<CRect, CRect>rcarray;
  9987. CStringArray strarray2;
  9988. for (i = 10; i <= 16; i++)
  9989. {
  9990. StrRect = load.m_rcarray.ElementAt(i - 1);
  9991. StrRect.left += 2;
  9992. StrRect.right -= 2;
  9993. StrRect.top += 2;
  9994. rcarray.Add(StrRect);
  9995. strarray2.Add(strarray.ElementAt(7 + i - 10));
  9996. }
  9997. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  9998. for (i = 10; i <= 16; i++)
  9999. {
  10000. StrRect = load.m_rcarray.ElementAt(i - 1);
  10001. if (i == 10)
  10002. {
  10003. dty += bottom - StrRect.bottom;
  10004. }
  10005. StrRect.bottom = bottom;
  10006. m_Print.DrawRect2(StrRect, 1);
  10007. }
  10008. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  10009. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  10010. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time5, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  10011. m_Print.SetFontFace(15, 1, "宋体");
  10012. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  10013. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10014. m_Print.SetFontFace(9, 1, "宋体");
  10015. strarray.RemoveAll();
  10016. strarray.Add("产品名称");
  10017. strarray.Add("数量");
  10018. strarray.Add("照片编号");
  10019. CArray<CRect, CRect>rc2array;
  10020. for (i = 18; i <= 20; i++)
  10021. {
  10022. StrRect = load.m_rcarray.ElementAt(i - 1); StrRect.top += dty; StrRect.bottom += dty;
  10023. m_Print.DrawRect2(StrRect, 1);
  10024. StrRect.left += 2;
  10025. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10026. StrRect.left -= 2;
  10027. StrRect.top = StrRect.bottom;
  10028. StrRect.bottom += 18;
  10029. rc2array.Add(StrRect);
  10030. }
  10031. int curypos = 0;
  10032. for (i = 0; i < sparray2.GetSize(); i += 3)
  10033. {
  10034. rcarray.RemoveAll();
  10035. strarray2.RemoveAll();
  10036. for ( j = 0; j < 3; j++)
  10037. {
  10038. StrRect = rc2array.ElementAt(j);
  10039. StrRect.left += 2;
  10040. StrRect.right -= 2;
  10041. StrRect.top += 2;
  10042. rcarray.Add(StrRect);
  10043. #if JEFF_TEST_ON
  10044. if (2 == j)
  10045. {
  10046. CString strImg = sparray2.ElementAt(i + 2);
  10047. //int nImgCount = strImg.Replace(",", ",");
  10048. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  10049. if (nImgCount != 0)
  10050. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  10051. else if (!strImg.IsEmpty())
  10052. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  10053. strarray2.Add(strImg);
  10054. }
  10055. else
  10056. strarray2.Add(sparray2.ElementAt(i + j));
  10057. #else
  10058. strarray2.Add(sparray2.ElementAt(i + j));
  10059. #endif
  10060. }
  10061. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  10062. rcarray.RemoveAll();
  10063. for (j = 0; j < 3; j++)
  10064. {
  10065. StrRect = rc2array.ElementAt(j);
  10066. if (j == 0)
  10067. {
  10068. dty += bottom - StrRect.bottom;
  10069. }
  10070. StrRect.bottom = bottom;
  10071. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  10072. StrRect.top = StrRect.bottom;
  10073. StrRect.bottom += 18;
  10074. rcarray.Add(StrRect);
  10075. }
  10076. rc2array.RemoveAll();
  10077. rc2array.Copy(rcarray);
  10078. }
  10079. m_Print.SetFontFace(15, 1, "宋体");
  10080. StrRect = load.m_rcarray.ElementAt(20);
  10081. dty = curypos - StrRect.bottom + 35;
  10082. StrRect.top += dty; StrRect.bottom += dty;
  10083. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10084. m_Print.SetFontFace(9, 1, "宋体");
  10085. rcarray.RemoveAll();
  10086. strarray2.RemoveAll();
  10087. StrRect = load.m_rcarray.ElementAt(21);
  10088. StrRect.top += dty;
  10089. StrRect.bottom += dty;
  10090. StrRect.left += 2;
  10091. StrRect.right -= 2;
  10092. StrRect.top += 2;
  10093. rcarray.Add(StrRect);
  10094. #if JEFF_TEST_ON
  10095. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  10096. strarray2.RemoveAll();
  10097. CString strFind = "要求:";
  10098. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  10099. do
  10100. {
  10101. int nIndex = strbz3.Find(strFind, 1);
  10102. if (nIndex != -1)
  10103. {
  10104. CString strbz = strbz3.Left(nIndex);
  10105. strbz3 = strbz3.Mid(nIndex);
  10106. strarray2.Add(strbz);
  10107. }
  10108. else
  10109. {
  10110. strarray2.Add(strbz3);
  10111. strbz3 = "";
  10112. }
  10113. } while (strbz3.Find(strFind) != -1);
  10114. strarray2.Add(g_List1array.ElementAt(0).ElementAt(25));
  10115. if (!m_replace.IsEmpty())
  10116. {
  10117. m_replace = "设计替换照片:" + m_replace;
  10118. m_replace.Replace("$", ";");
  10119. m_replace.TrimLeft(";");
  10120. }
  10121. strarray2.Add(m_replace);
  10122. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  10123. #else
  10124. strarray2.Add(m_bz);
  10125. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  10126. #endif
  10127. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  10128. dty += bottom - StrRect.bottom;
  10129. StrRect.bottom = bottom;
  10130. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  10131. m_Print.SetFontFace(10, 1, "宋体");
  10132. StrRect = load.m_rcarray.ElementAt(22);
  10133. dty = curypos - StrRect.bottom + 25;
  10134. StrRect.top += dty; StrRect.bottom += dty;
  10135. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  10136. if (m_edit9.IsEmpty())
  10137. {
  10138. m_edit9 = "\
  10139. 经确认后的照片均排入制作流程,\r\n\
  10140. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  10141. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  10142. }
  10143. CString info1, info2, info3;
  10144. int newlinepos = m_edit9.Find("\r\n");
  10145. if (newlinepos != -1)
  10146. {
  10147. info1 = m_edit9.Left(newlinepos);
  10148. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  10149. }
  10150. newlinepos = m_edit9.Find("\r\n");
  10151. if (newlinepos != -1)
  10152. {
  10153. info2 = m_edit9.Left(newlinepos);
  10154. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  10155. info3 = m_edit9;
  10156. }
  10157. if (1)
  10158. {
  10159. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10160. StrRect = load.m_rcarray.ElementAt(23);
  10161. StrRect.top += dty; StrRect.bottom += dty;
  10162. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10163. StrRect = load.m_rcarray.ElementAt(24);
  10164. StrRect.top += dty; StrRect.bottom += dty;
  10165. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10166. }
  10167. else
  10168. {
  10169. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", 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)"恕不接受更改及退费。实际冲晒出来的相片", 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)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10176. }
  10177. StrRect = load.m_rcarray.ElementAt(25);
  10178. StrRect.top += dty; StrRect.bottom += dty;
  10179. m_Print.DrawText((LPTSTR)(LPCTSTR)"贵宾签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10180. StrRect = load.m_rcarray.ElementAt(26);
  10181. StrRect.top += dty; StrRect.bottom += dty;
  10182. m_Print.DrawRect2(StrRect, 2);
  10183. m_Print.SetFontFace(9, 1, "宋体");
  10184. StrRect = load.m_rcarray.ElementAt(27);
  10185. StrRect.top += dty; StrRect.bottom += dty;
  10186. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10187. StrRect = load.m_rcarray.ElementAt(28);
  10188. StrRect.top += dty; StrRect.bottom += dty;
  10189. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10190. PrintPreview dlg;//dlg.m_mode=2;
  10191. dlg.m_name = name;
  10192. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  10193. dlg.m_pDC = m_Print.GetPDC();
  10194. if (aa == 0)
  10195. {
  10196. if (dlg.DoModal() != IDOK)
  10197. return;
  10198. printcot = dlg.m_num;
  10199. }
  10200. //结束打印
  10201. m_Print.EndPage();
  10202. m_Print.EndPrint();
  10203. }
  10204. }
  10205. /*
  10206. void CMainFrame::PrintFlowChart(CString m_id)
  10207. {
  10208. CPrintRX m_Print;
  10209. m_Print.InitToPrint(NULL, 1);
  10210. m_Print.StartPrint();
  10211. m_Print.StartPage();
  10212. // CRect StrRect(0,0,560,818);
  10213. LoadRect load;
  10214. load.SetLiaPath ("4.lia");
  10215. load.SetMargins(-14,-14);
  10216. if(!load.Load ())return;
  10217. LoadRect load2;
  10218. load2.SetMargins(-14,472+27-14);
  10219. load2.SetLiaPath ("5.lia");
  10220. if(!load2.Load ())return;
  10221. //////////////////////////////////////////////////////////////
  10222. CString filter="id='"+m_id+"';id='"+m_id+"'";
  10223. g_sendhead.code[0]=54;
  10224. g_sendhead.code[1]=50;
  10225. g_sendhead.tabcount=2;
  10226. g_sendhead.bsql=0;
  10227. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  10228. CArray<CStringArray, CStringArray>sparray;
  10229. DataToArray(&g_List1array,&sparray);
  10230. CString spno;
  10231. for(int i=0; i<sparray.GetSize (); i++)
  10232. {
  10233. if(sparray.ElementAt (i).ElementAt (4)=="4" && sparray.ElementAt (i).ElementAt (5)!="入册")continue;
  10234. if(sparray.ElementAt (i).ElementAt (5)=="入册"&&sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  10235. spno+=sparray.ElementAt (i).ElementAt (5);
  10236. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  10237. spno+=";";
  10238. else
  10239. {
  10240. spno+=":";
  10241. spno+=sparray.ElementAt (i).ElementAt (6);
  10242. spno+=";";
  10243. }
  10244. }
  10245. spno+=" 加挑:";
  10246. for( i=0; i<sparray.GetSize (); i++)
  10247. {
  10248. if(sparray.ElementAt (i).ElementAt (4)!="4")continue;
  10249. if(sparray.ElementAt (i).ElementAt (5)=="入册")continue;
  10250. spno+=sparray.ElementAt (i).ElementAt (5);
  10251. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  10252. spno+=";";
  10253. else
  10254. {
  10255. spno+=":";
  10256. spno+=sparray.ElementAt (i).ElementAt (6);
  10257. spno+=";";
  10258. }
  10259. }
  10260. if(spno.Right (6)==" 加挑:")
  10261. {
  10262. spno=spno.Left (spno.GetLength ()-6);
  10263. }
  10264. CString m_name1 = g_List1array.ElementAt (0).ElementAt (1);
  10265. CString m_name2 = g_List1array.ElementAt (0).ElementAt (2);
  10266. CString m_phone1=g_List1array.ElementAt (0).ElementAt (3);
  10267. CString m_phone2=g_List1array.ElementAt (0).ElementAt (4);
  10268. CString m_urgent=g_List1array.ElementAt (0).ElementAt (5);
  10269. if(m_urgent.IsEmpty ())m_urgent="否";
  10270. CString m_time2 = g_List1array.ElementAt (0).ElementAt (6);
  10271. CString m_time4 = g_List1array.ElementAt (0).ElementAt (7);
  10272. CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  10273. CString m_takezs = g_List1array.ElementAt (0).ElementAt (9);
  10274. CString m_taoxizs = g_List1array.ElementAt (0).ElementAt (10);
  10275. CString m_choosezs = g_List1array.ElementAt (0).ElementAt (11);
  10276. CString m_ren = g_List1array.ElementAt (0).ElementAt (12);
  10277. CString m_waiter3 = g_List1array.ElementAt (0).ElementAt (13);
  10278. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (14);
  10279. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (15);
  10280. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (16);
  10281. CString m_bz = "客人要求: "+g_List1array.ElementAt (0).ElementAt (17);
  10282. CString m_money3 = g_List1array.ElementAt (0).ElementAt (18);
  10283. CString m_money1 = g_List1array.ElementAt (0).ElementAt (19);
  10284. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (20);
  10285. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (21);
  10286. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (22);
  10287. CString m_sum3;
  10288. m_sum3.Format ("%0.2f", atof(m_taoxijiage)+atof(m_payed4)-(atof(m_payed5)+atof(m_money1)));
  10289. ::ConvertToPrice (m_sum3);
  10290. if(m_money3.IsEmpty ())m_money3="0";
  10291. // m_money3=m_money3+"/"+m_sum3;
  10292. CString name;
  10293. if(!m_name1.IsEmpty ())
  10294. name=m_name1+",";
  10295. name+=m_name2;
  10296. name.TrimRight (",");
  10297. CString phone;
  10298. if(!m_phone1.IsEmpty ())
  10299. phone=m_phone1+",";
  10300. phone+=m_phone2;phone.TrimRight (",");
  10301. CStringArray strarray;
  10302. strarray.Add (m_urgent);
  10303. strarray.Add (m_ren);
  10304. strarray.Add (m_waiter3);
  10305. strarray.Add (name);
  10306. strarray.Add (m_time2);
  10307. strarray.Add (m_time4);
  10308. strarray.Add (m_time5);
  10309. strarray.Add (m_money3);
  10310. strarray.Add (m_takezs);
  10311. strarray.Add (m_taoxizs);
  10312. strarray.Add (m_choosezs);
  10313. strarray.Add (m_id);
  10314. strarray.Add (phone);
  10315. ////////////////////////////////////////////////////////////////
  10316. int rcpos=-1;
  10317. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  10318. Image *pImg=NULL;
  10319. #ifdef MNLS_VERSION
  10320. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG") );
  10321. #else
  10322. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  10323. #endif
  10324. m_Print.DrawImage(pImg, StrRect);
  10325. delete pImg;
  10326. m_Print.SetFontFace(15, 1, "宋体");
  10327. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10328. #ifdef MNLS_VERSION
  10329. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10330. #endif
  10331. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10332. #ifdef MNLS_VERSION
  10333. m_Print.DrawRect(StrRect);
  10334. #endif
  10335. m_Print.SetFontFace(7, 1, "黑体");
  10336. m_Print.SetColor(0xffffff);
  10337. #ifdef MNLS_VERSION
  10338. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10339. #endif
  10340. m_Print.SetColor(0);
  10341. m_Print.SetFontFace(25, 1, "黑体");
  10342. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10343. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10344. CString title[13]={"是否加急:","接单门市:","选样人员:","新郎新娘姓名:","拍照日期:","选片日期:","取件日期:","加挑/余款:","拍摄总张数:","应挑选张数:","额外加挑张数:","票号:","客户联系电话:"};
  10345. m_Print.SetFontFace(12, 1, "宋体");
  10346. for( i=0; i<13; i++)
  10347. {
  10348. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10349. if(i<3)
  10350. m_Print.DrawRect2(StrRect, 0);
  10351. else
  10352. m_Print.DrawRect2(StrRect, 1);
  10353. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10354. }
  10355. for( i=18; i<=37; i++)
  10356. {
  10357. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10358. if(i>=19&&i<=21)
  10359. m_Print.DrawRect2(StrRect, 2);
  10360. else if(i==26)
  10361. {
  10362. CRect rc=StrRect;
  10363. CRect rc2=rc;
  10364. rc.right -=rc2.Width ()/2;
  10365. m_Print.DrawRect2(rc, 1);
  10366. rc2.left +=rc.Width ();
  10367. m_Print.DrawRect2(rc2, 1);
  10368. }
  10369. else
  10370. m_Print.DrawRect2(StrRect, 1);
  10371. if(i==18)
  10372. {
  10373. StrRect.left +=5;
  10374. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10375. }
  10376. }
  10377. //////////////////////////////////////
  10378. rcpos=-1;
  10379. for( i=0; i<8; i++)
  10380. {
  10381. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10382. m_Print.DrawRect2(StrRect, 1);
  10383. }
  10384. CString title2[4]={"化妆师:","摄影师:","数码设计师:","顾客签名:"};
  10385. for( i=0; i<4; i++)
  10386. {
  10387. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10388. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10389. }
  10390. for( i=0; i<4; i++)
  10391. {
  10392. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10393. m_Print.DrawRect2(StrRect, 2);
  10394. }
  10395. ///////////////////////////////////////////
  10396. for( i=19; i<=31; i++)
  10397. {
  10398. StrRect=load.m_rcarray .ElementAt (i-1);
  10399. StrRect.left +=4;
  10400. if(i==31)
  10401. {
  10402. if(m_phone1.IsEmpty ()==0 && m_phone2.IsEmpty ()==0)
  10403. {
  10404. StrRect.top +=2;
  10405. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  10406. StrRect.top +=8;
  10407. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10408. }
  10409. else
  10410. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10411. }
  10412. else if((i-19)==7)
  10413. {
  10414. CRect rc=StrRect;
  10415. CRect rc2=rc;
  10416. rc.right -=rc2.Width ()/2;
  10417. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10418. rc2.left +=rc.Width ()+3;
  10419. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10420. }
  10421. else
  10422. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10423. }
  10424. strarray.RemoveAll ();
  10425. strarray.Add (m_waiter2);
  10426. strarray.Add (m_waiter1);
  10427. strarray.Add (m_waiter4);
  10428. for( i=13; i<=15; i++)
  10429. {
  10430. StrRect=load2.m_rcarray .ElementAt (i-1);
  10431. StrRect.left +=4;
  10432. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10433. }
  10434. ///////////spno
  10435. CRect sprc[14];
  10436. for(i=0; i<14; i++)
  10437. {
  10438. if(i<7)
  10439. {
  10440. if(i==0)
  10441. {
  10442. StrRect=load.m_rcarray .ElementAt (17);StrRect.left +=94;StrRect.right -=3;
  10443. }
  10444. else
  10445. {
  10446. StrRect=load.m_rcarray .ElementAt (30+i);StrRect.left +=4;StrRect.right -=3;
  10447. }
  10448. }
  10449. else
  10450. {
  10451. StrRect=load2.m_rcarray .ElementAt (i-7);StrRect.left +=4;StrRect.right -=3;
  10452. }
  10453. sprc[i]=StrRect;
  10454. // m_Print.DrawText((LPTSTR)(LPCTSTR)"xxx", sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10455. }
  10456. CString temp,tempspno,tempbz;
  10457. CSize size;
  10458. BOOL bRun=0;
  10459. int fontsize=12;
  10460. ll: tempspno=spno;
  10461. tempbz=m_bz;
  10462. m_Print.SetFontFace(fontsize, 1, "宋体");
  10463. for( i=0; i<14; i++)
  10464. {
  10465. if(!tempspno.IsEmpty ())
  10466. {
  10467. temp=tempspno;
  10468. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10469. int right=0;
  10470. CRect temprc=sprc[i];
  10471. while(size.cx>temprc.Width ())
  10472. {
  10473. right++;
  10474. temp=tempspno.Left (tempspno.GetLength ()-(right));
  10475. if(GIsHalfHZ(temp))
  10476. {
  10477. right++;
  10478. temp.Delete (temp.GetLength ()-1);
  10479. }
  10480. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10481. }
  10482. if(bRun)
  10483. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10484. tempspno=tempspno.Right (tempspno.GetLength ()-temp.GetLength ());
  10485. if(tempspno.IsEmpty ())i++;
  10486. }
  10487. else if(!tempbz.IsEmpty ())
  10488. {
  10489. temp=tempbz;
  10490. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10491. int right=0;
  10492. CRect temprc=sprc[i];
  10493. while(size.cx>temprc.Width ())
  10494. {
  10495. right++;
  10496. temp=tempbz.Left (tempbz.GetLength ()-(right));
  10497. if(GIsHalfHZ(temp))
  10498. {
  10499. right++;
  10500. temp.Delete (temp.GetLength ()-1);
  10501. }
  10502. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10503. }
  10504. if(bRun)
  10505. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10506. tempbz=tempbz.Right (tempbz.GetLength ()-temp.GetLength ());
  10507. }
  10508. }
  10509. if(tempspno.IsEmpty ()==0 || tempbz.IsEmpty ()==0)
  10510. {
  10511. fontsize--;
  10512. goto ll;
  10513. }
  10514. if(bRun==0)
  10515. {
  10516. bRun=1;
  10517. goto ll;
  10518. }
  10519. PrintPreview dlg;
  10520. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  10521. dlg.m_pDC =m_Print.GetPDC() ;
  10522. if(dlg.DoModal ()!=IDOK)return;
  10523. //结束打印
  10524. m_Print.EndPage();
  10525. m_Print.EndPrint();
  10526. }
  10527. void CMainFrame::SetSelFolder(int pos)
  10528. {
  10529. m_wndToolBar2.SetSelFolder(pos);
  10530. }*/
  10531. void CMainFrame::ToPhotoPrint()
  10532. {
  10533. UINT nID = 1;
  10534. LPSTR pName;
  10535. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  10536. OPEN_MENU(PhotoPrintFrom);
  10537. }
  10538. void CMainFrame::GetOcx()
  10539. {
  10540. char path[MAX_PATH];
  10541. ::GetSystemDirectory(path, MAX_PATH);
  10542. CString syspath = path;
  10543. try
  10544. {
  10545. if (!::PathFileExists(syspath + "\\MSCHRT20.OCX"))
  10546. {
  10547. g_sendhead.bsql = 0;
  10548. g_sendhead.code[0] = 103;
  10549. g_sendhead.tabcount = 1;
  10550. g_pMainWnd->ProcessChatMessageRequest2(1); if (g_bSendOK == 0)return;
  10551. CFile fp;
  10552. if (fp.Open(syspath + "\\MSCHRT20.OCX", CFile::modeWrite | CFile::modeCreate))
  10553. {
  10554. fp.Write(g_pData, g_nLeng);
  10555. fp.Close();
  10556. ::Sleep(1000);
  10557. }
  10558. }
  10559. CString temp;
  10560. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10561. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10562. }
  10563. catch (...)
  10564. {
  10565. }
  10566. try
  10567. {
  10568. CString temp;
  10569. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10570. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10571. }
  10572. catch (...)
  10573. {
  10574. }
  10575. }
  10576. void CMainFrame::OnServer()
  10577. {
  10578. // TODO: Add your command handler code here
  10579. DBConfig dlg;
  10580. dlg.DoModal();
  10581. }
  10582. void CMainFrame::OnPath()
  10583. {
  10584. // TODO: Add your command handler code here
  10585. if (g_user.bLongin == 0)
  10586. {
  10587. if (g_bNoLoginLia)
  10588. {
  10589. Login dlg;
  10590. dlg.SetLiaPath("5.lia");
  10591. dlg.DoModal();
  10592. }
  10593. else
  10594. {
  10595. Login3 dlg;
  10596. dlg.SetLiaPath("5.lia");
  10597. dlg.DoModal();
  10598. }
  10599. if (g_user.bLongin == 0)return;
  10600. }
  10601. if (IsHasRightsnew(49) == 0)return;
  10602. SetPathDlg2 dlg;
  10603. dlg.DoModal();
  10604. }
  10605. void CMainFrame::OnShowhis()
  10606. {
  10607. // TODO: Add your command handler code here
  10608. if (g_user.bLongin == 0)
  10609. {
  10610. if (g_bNoLoginLia)
  10611. {
  10612. Login dlg;
  10613. dlg.SetLiaPath("5.lia");
  10614. dlg.DoModal();
  10615. }
  10616. else
  10617. {
  10618. Login3 dlg;
  10619. dlg.SetLiaPath("5.lia");
  10620. dlg.DoModal();
  10621. }
  10622. if (g_user.bLongin == 0)return;
  10623. }
  10624. if (IsHasRightsnew(52) == 0)return;
  10625. CMenu *pMenu = GetMenu();
  10626. CMenu* submenu = pMenu->GetSubMenu(2);
  10627. UINT status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10628. if (status&MF_CHECKED)
  10629. {
  10630. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_UNCHECKED);
  10631. g_bShowOK = 1;
  10632. }
  10633. else
  10634. {
  10635. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  10636. g_bShowOK = 0;
  10637. } m_Mdi.CloseAll();
  10638. }
  10639. void CMainFrame::AddHistoryMenu(CArray<CStringArray, CStringArray>*hisyeararray) // 添加历史数据库菜单;
  10640. {
  10641. #ifdef NEW_SKIN
  10642. CMenu* m_menuXP = GetMenu();
  10643. CMenu* submenu = m_menuXP->GetSubMenu(2);
  10644. // 删除原有菜单;
  10645. int i = 0;
  10646. for ( i = 0; i < 100; i++)
  10647. {
  10648. submenu->DeleteMenu(1000 + i, MF_BYCOMMAND);
  10649. }
  10650. // 重创菜单,从资源ID1000开始;
  10651. for (i = 0; i < hisyeararray->GetSize(); i++)
  10652. {
  10653. submenu->AppendMenu(MF_STRING, 1000 + i, "查看历史数据:" + hisyeararray->ElementAt(i).ElementAt(0)); // 第一项菜单项;
  10654. }
  10655. g_nYearpos = -1;
  10656. #else
  10657. HMENU hMenu = ::GetMenu(m_hWnd);
  10658. m_menuXP.Attach(hMenu);
  10659. BCMenu* submenu = (BCMenu*)m_menuXP.GetSubMenu(2);
  10660. for (int i = 0; i < 100; i++)
  10661. {
  10662. submenu->DeleteMenu (1000+i, MF_BYCOMMAND);
  10663. }
  10664. for( i=0; i<hisyeararray->GetSize (); i++)
  10665. {
  10666. submenu->AppendMenu(MF_STRING, 1000+i, "查看历史数据:"+hisyeararray->ElementAt (i).ElementAt (0)); // 第一项菜单项
  10667. }
  10668. m_menuXP.Detach ();
  10669. g_nYearpos = -1;
  10670. #endif
  10671. }
  10672. /************************************************************************/
  10673. /*
  10674. Jeff
  10675. 函数:AddBranchMenu()
  10676. 参数:CArray<CStringArray, CStringArray> *branchArray
  10677. 返回:void
  10678. 注意:
  10679. 调用关系:
  10680. */
  10681. /************************************************************************/
  10682. void CMainFrame::AddBranchMenu(CArray<CStringArray, CStringArray>*branchArray)
  10683. {
  10684. //WriteTextLog("AddBranchMenu,添加集团版菜单");
  10685. #ifdef ENTERPRISE_VERSION
  10686. CMenu *m_menuXP = GetMenu();
  10687. CMenu* submenu = m_menuXP->GetSubMenu(0);
  10688. int i = 0;
  10689. for ( i = 0; i < 100; i++)
  10690. {
  10691. submenu->DeleteMenu(2000 + i, MF_BYCOMMAND);
  10692. }
  10693. g_menubranchname.RemoveAll();
  10694. CString name;
  10695. int a = 0;
  10696. #if 0 // Jeff.add for test
  10697. CString strCount;
  10698. strCount.Format("历史数据库个数=%d", branchArray->GetSize());
  10699. WriteTextLog(strCount);
  10700. #endif
  10701. for (i = 0; i < branchArray->GetSize() - 1; i++)
  10702. {
  10703. //WriteTextLog("111");
  10704. //WriteTextLog(hisyeararray->ElementAt(i).ElementAt(0));
  10705. //WriteTextLog(name);
  10706. if (name == "")
  10707. {
  10708. name = branchArray->ElementAt(i).ElementAt(0);
  10709. #ifndef SQLSERVER_VERSION
  10710. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10711. a++;
  10712. #endif
  10713. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10714. a++;
  10715. g_menubranchname.Add(name);
  10716. continue;
  10717. }
  10718. else if (branchArray->ElementAt(i).ElementAt(0).Find(name) != -1 && ((branchArray->ElementAt(i).ElementAt(0).GetLength() - name.GetLength()) == 4))
  10719. {
  10720. continue;
  10721. }
  10722. name = branchArray->ElementAt(i).ElementAt(0);
  10723. #ifndef SQLSERVER_VERSION
  10724. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10725. a++;
  10726. #endif
  10727. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10728. g_menubranchname.Add(name);
  10729. a++;
  10730. //WriteTextLog("222");
  10731. }
  10732. if ((branchArray->GetSize() - 1) > 0)
  10733. {
  10734. if (branchArray->ElementAt(0).ElementAt(3) == "总店")
  10735. submenu->AppendMenu(MF_STRING, 2000 + a, "多店数据汇总");
  10736. }
  10737. #endif
  10738. }
  10739. // Jeff:如果选择了历史数据库,则开单的数据会录入到该历史数据库中,而非当前数据库;
  10740. // g_nYearpos==-1,表示当前主数据库,其他>=0的值表示历史数据库在g_historydb中的索引值;
  10741. void CMainFrame::OnHistory(UINT nID) // 选择历史数据库菜单响应;
  10742. {
  10743. CMenu* pMenu = GetMenu();
  10744. CMenu* submenu = pMenu->GetSubMenu(2);
  10745. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10746. if (g_user.bLongin == 0)
  10747. {
  10748. if (g_bNoLoginLia)
  10749. {
  10750. Login dlg;
  10751. dlg.SetLiaPath("5.lia");
  10752. dlg.DoModal();
  10753. }
  10754. else
  10755. {
  10756. Login3 dlg;
  10757. dlg.SetLiaPath("5.lia");
  10758. dlg.DoModal();
  10759. }
  10760. if (g_user.bLongin == 0)return;
  10761. }
  10762. if (IsHasRightsnew(52) == 0)return;
  10763. m_Mdi.CloseAll();
  10764. for (int i = 0; i < 100; i++)
  10765. {
  10766. submenu->CheckMenuItem(1000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10767. }
  10768. if (status&MF_CHECKED)
  10769. {
  10770. g_nYearpos = -1;
  10771. status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10772. if (status&MF_CHECKED)
  10773. g_bShowOK = 0;
  10774. else
  10775. g_bShowOK = 1;
  10776. }
  10777. else
  10778. {
  10779. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10780. g_nYearpos = nID - 1000;
  10781. g_bShowOK = 1;
  10782. }
  10783. }
  10784. void CMainFrame::OnBranchData(UINT nID)
  10785. {
  10786. #ifdef ENTERPRISE_VERSION
  10787. #ifdef SQLSERVER_VERSION
  10788. OnBranchData2(nID);
  10789. return;
  10790. #endif
  10791. #endif
  10792. }
  10793. void CMainFrame::OnBranchData2(UINT nID)
  10794. {
  10795. #ifdef ENTERPRISE_VERSION
  10796. g_bAllBranch = 0;
  10797. m_Mdi.CloseAll();
  10798. OnDisconnect();
  10799. CMenu *pMenu = GetMenu();
  10800. CMenu* submenu = pMenu->GetSubMenu(0);
  10801. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10802. for (int i = 0; i < 100; i++)
  10803. {
  10804. submenu->CheckMenuItem(2000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10805. }
  10806. if (status&MF_CHECKED)
  10807. {
  10808. g_branchname.Empty();
  10809. g_branchip.Empty();
  10810. g_bBranchModify = 0;
  10811. g_user.bLongin = 0;
  10812. if (g_bNoLoginLia)
  10813. {
  10814. Login dlg;
  10815. dlg.SetLiaPath("5.lia");
  10816. dlg.DoModal();
  10817. }
  10818. else
  10819. {
  10820. Login3 dlg;
  10821. dlg.SetLiaPath("5.lia");
  10822. dlg.DoModal();
  10823. }
  10824. g_pMainWnd2->RefreshOutlookBar();
  10825. g_pMainWnd2->DrawLogin();
  10826. g_path1 = g_path1bak;
  10827. g_path2 = g_path2bak;
  10828. g_path3 = g_path3bak;
  10829. g_path4 = g_path4bak;
  10830. g_path5 = g_path5bak;
  10831. g_path6 = g_path6bak;
  10832. g_path7 = g_path7bak;
  10833. g_pMainWnd2->EnableBtns(1);
  10834. }
  10835. else
  10836. {
  10837. BOOL bNeedCheckRights = 1;
  10838. if (g_user.bLongin && g_branchname == "")//无需登陆本店判断其访问分店权限
  10839. {
  10840. bNeedCheckRights = 0;
  10841. }
  10842. #ifndef SQLSERVER_VERSION
  10843. if ((g_menubranchname.GetSize() * 2) == nID - 2000)//多店数据汇总
  10844. #else
  10845. if ((g_menubranchname.GetSize()) == nID - 2000)//多店数据汇总
  10846. #endif
  10847. {
  10848. g_branchname.Empty();
  10849. g_branchip.Empty();
  10850. g_bBranchModify = 0;
  10851. if (bNeedCheckRights)
  10852. {
  10853. g_user.bLongin = 0;
  10854. if (g_user.bLongin == 0)
  10855. {
  10856. if (g_bNoLoginLia)
  10857. {
  10858. Login dlg;
  10859. dlg.SetLiaPath("5.lia");
  10860. dlg.DoModal();
  10861. }
  10862. else
  10863. {
  10864. Login3 dlg;
  10865. dlg.SetLiaPath("5.lia");
  10866. dlg.DoModal();
  10867. }
  10868. if (g_user.bLongin == 0)return;
  10869. }
  10870. }
  10871. if (IsHasRightsnew(28) == 0)
  10872. {
  10873. return;
  10874. }
  10875. g_bAllBranch = 1; g_pMainWnd2->ShowBar(0);
  10876. g_pMainWnd2->RefreshOutlookBar2();
  10877. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10878. g_branchname.Empty();
  10879. g_branchip.Empty();
  10880. g_bBranchModify = 0;
  10881. g_pMainWnd2->DrawLogin();
  10882. g_pMainWnd2->EnableBtns(0);
  10883. g_path1 = g_path1bak;
  10884. g_path2 = g_path2bak;
  10885. g_path3 = g_path3bak;
  10886. g_path4 = g_path4bak;
  10887. g_path5 = g_path5bak;
  10888. g_path6 = g_path6bak;
  10889. g_path7 = g_path7bak;
  10890. }
  10891. else
  10892. {
  10893. if (bNeedCheckRights)
  10894. {
  10895. g_branchname.Empty();
  10896. g_branchip.Empty();
  10897. g_bBranchModify = 0;
  10898. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_UNCHECKED);
  10899. g_user.bLongin = 0;
  10900. if (g_pMainWnd2)
  10901. {
  10902. g_pMainWnd2->DrawLogin();
  10903. g_pMainWnd2->ShowBar(0);
  10904. }
  10905. if (g_bNoLoginLia)
  10906. {
  10907. Login dlg;
  10908. dlg.SetLiaPath("5.lia");
  10909. dlg.DoModal();
  10910. }
  10911. else
  10912. {
  10913. Login3 dlg;
  10914. dlg.SetLiaPath("5.lia");
  10915. dlg.DoModal();
  10916. }
  10917. if (g_user.bLongin == 0)return;
  10918. }
  10919. if (IsHasRightsnew(28) == 0)
  10920. {
  10921. return;
  10922. }
  10923. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10924. #ifndef SQLSERVER_VERSION
  10925. if (nID % 2 == 0)
  10926. g_branchname = g_menubranchname.ElementAt((nID - 2000) / 2);
  10927. else
  10928. g_branchname = g_menubranchname.ElementAt((nID - 2001) / 2);
  10929. #else
  10930. g_branchname = g_menubranchname.ElementAt(nID - 2000);
  10931. #endif
  10932. //printf("选择分店:%s\n", g_branchname);
  10933. g_branchip.Empty();
  10934. CString domainname = "";
  10935. for (int i = 0; i < g_brancharray.GetSize(); i++)
  10936. {
  10937. /*
  10938. for(int j=0; j<g_brancharray.GetSize(); j++)
  10939. printf("%s\n", g_brancharray.ElementAt(i).ElementAt(j));
  10940. */
  10941. if (g_branchname == g_brancharray.ElementAt(i).ElementAt(0))
  10942. {
  10943. g_branchip = g_brancharray.ElementAt(i).ElementAt(1);
  10944. g_branchip2 = g_brancharray.ElementAt(i).ElementAt(4);
  10945. domainname = g_brancharray.ElementAt(i).ElementAt(2);
  10946. }
  10947. }
  10948. g_path1 = g_path1bak;
  10949. g_path2 = g_path2bak;
  10950. g_path3 = g_path3bak;
  10951. g_path4 = g_path4bak;
  10952. g_path5 = g_path5bak;
  10953. g_path6 = g_path6bak;
  10954. g_path7 = g_path7bak;
  10955. if (domainname.IsEmpty())
  10956. {
  10957. g_path1 = g_path2 = g_path3 = g_path4 = g_path5 = g_path6 = g_path7 = "xxx";
  10958. }
  10959. else
  10960. {
  10961. g_path1 += "\\" + domainname;
  10962. g_path2 += "\\" + domainname;
  10963. g_path3 += "\\" + domainname;
  10964. g_path4 += "\\" + domainname;
  10965. g_path5 += "\\" + domainname;
  10966. g_path6 += "\\" + domainname;
  10967. g_path7 += "\\" + domainname;
  10968. }
  10969. g_bBranchModify = 1;
  10970. /* CArray<CStringArray, CStringArray>yeararray;
  10971. for( i=0; i<g_brancharray.GetSize (); i++)
  10972. {
  10973. if(g_brancharray.ElementAt (i).ElementAt (0).Find (g_branchname)!=-1 && g_branchname!=g_brancharray.ElementAt (i).ElementAt (0))
  10974. {
  10975. int size=yeararray.GetSize ();
  10976. yeararray.SetSize(size+1,1);
  10977. CString str=g_brancharray.ElementAt (i).ElementAt (0);
  10978. str.Delete (0, g_branchname.GetLength ());
  10979. yeararray.ElementAt (size).Add (str);
  10980. }
  10981. }
  10982. AddHistoryMenu(&yeararray);*/
  10983. if (g_bBranchModify)OnDisconnect();
  10984. if (1)
  10985. {
  10986. g_user.bLongin = 0;
  10987. g_user.name.Empty();
  10988. g_user.rights.Empty();
  10989. g_user.account.Empty();
  10990. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  10991. g_pMainWnd2->RefreshOutlookBar();
  10992. m_Mdi.CloseAll();
  10993. if (g_pMainWnd2)
  10994. {
  10995. g_pMainWnd2->DrawLogin();
  10996. g_pMainWnd2->ShowBar(0);
  10997. }
  10998. if (g_bNoLoginLia)
  10999. {
  11000. Login dlg;
  11001. dlg.SetLiaPath("5.lia");
  11002. dlg.DoModal();
  11003. }
  11004. else
  11005. {
  11006. Login3 dlg;
  11007. dlg.SetLiaPath("5.lia");
  11008. dlg.DoModal();
  11009. }
  11010. if (g_user.bLongin == 0)return;
  11011. if (g_pMainWnd2)g_pMainWnd2->ShowBar(1);
  11012. }
  11013. g_pMainWnd2->DrawLogin();
  11014. g_pMainWnd2->EnableBtns(1);
  11015. }
  11016. g_nYearpos = -1;
  11017. }
  11018. #endif
  11019. }
  11020. void CMainFrame::OnStaffAchievementShow() //Jeff:此机只用于员工看业绩;
  11021. {
  11022. // TODO: Add your command handler code here
  11023. if (g_user.bLongin == 0) // 是否登陆系统;
  11024. {
  11025. if (g_bNoLoginLia)
  11026. {
  11027. Login dlg;
  11028. dlg.SetLiaPath("5.lia");
  11029. dlg.DoModal();
  11030. }
  11031. else
  11032. {
  11033. Login3 dlg;
  11034. dlg.SetLiaPath("5.lia");
  11035. dlg.DoModal();
  11036. }
  11037. if (g_user.bLongin == 0)return;
  11038. }
  11039. if (IsHasRightsnew(49) == 0)return;// 是否有权限进行设置;
  11040. CMenu *pMenu = GetMenu();
  11041. CMenu* submenu = pMenu->GetSubMenu(1);
  11042. UINT status = submenu->GetMenuState(IDM_StaffAchievementShow, MF_BYCOMMAND);
  11043. if (status&MF_CHECKED)
  11044. {
  11045. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_UNCHECKED);
  11046. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status2", 0);
  11047. g_bStaffAchievementShow = 0;
  11048. TCHAR szKey[MAX_PATH];
  11049. TCHAR szDir[MAX_PATH];
  11050. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  11051. HKEY hKey = 0;
  11052. DWORD disp = 0;
  11053. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  11054. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  11055. if (lResult == ERROR_SUCCESS)
  11056. {
  11057. RegDeleteValue(hKey, "YLGLMAINAUTORUN");
  11058. RegDeleteKey(hKey, "YLGLMAINAUTORUN");
  11059. RegCloseKey(hKey);
  11060. }
  11061. }
  11062. else
  11063. {
  11064. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  11065. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status2", 1);
  11066. g_bStaffAchievementShow = 1;
  11067. TCHAR szKey[MAX_PATH];
  11068. TCHAR szDir[MAX_PATH];
  11069. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  11070. HKEY hKey = 0;
  11071. DWORD disp = 0;
  11072. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  11073. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  11074. if (lResult == ERROR_SUCCESS)
  11075. {
  11076. lResult = RegSetValueEx(hKey, "YLGLMAINAUTORUN", 0, REG_SZ, (const unsigned char*)szDir, lstrlen(szDir));
  11077. RegCloseKey(hKey);
  11078. }
  11079. StaffAchievementSet dlg;
  11080. dlg.DoModal();
  11081. }
  11082. }
  11083. void CMainFrame::PrintDinDan2(CString m_id)
  11084. {
  11085. #ifdef MODERN_VERSION
  11086. SelContent seldlg;
  11087. if (seldlg.DoModal() != IDOK)return;
  11088. CPrintRX m_Print;
  11089. m_Print.InitToPrint(NULL, 1);
  11090. m_Print.StartPrint();
  11091. m_Print.StartPage();
  11092. // CRect StrRect(0,0,560,818);
  11093. LoadRect load;
  11094. LoadRect load2;
  11095. LoadRect load3;
  11096. load.SetLiaPath ("9.lia");
  11097. load.SetMargins(-14,0);
  11098. if(!load.Load ())return;
  11099. int i;
  11100. //////////////////////////////////////////////////////////////
  11101. CStringArray txarray;
  11102. CString filter="id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"'";
  11103. g_sendhead.code[0]=11;
  11104. g_sendhead.code[1]=52;
  11105. g_sendhead.code[2]=50;
  11106. g_sendhead.code[3]=38;
  11107. g_sendhead.code[4]=27;
  11108. g_sendhead.tabcount=5;
  11109. g_sendhead.bsql=0;
  11110. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  11111. CArray<CStringArray, CStringArray>sparray;
  11112. CArray<CStringArray, CStringArray>clientarray;
  11113. CArray<CStringArray, CStringArray>phonearray;
  11114. CArray<CStringArray, CStringArray>bukuan2array;
  11115. CArray<CStringArray, CStringArray>bukuanarray;
  11116. DataToArray(&g_List1array, &clientarray, &sparray, &bukuan2array, &bukuanarray);
  11117. CTime tm=CTime::GetCurrentTime ();
  11118. CString str;
  11119. CString m_money1 = g_List1array.ElementAt (0).ElementAt (1);
  11120. CString m_money2 = g_List1array.ElementAt (0).ElementAt (2);
  11121. CString m_money3 = g_List1array.ElementAt (0).ElementAt (3);
  11122. CString m_name1 = g_List1array.ElementAt (0).ElementAt (4);
  11123. CString m_name2 = g_List1array.ElementAt (0).ElementAt (5);
  11124. CString m_taoxiname= g_List1array.ElementAt (0).ElementAt (7);
  11125. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (8);
  11126. CString m_zs = g_List1array.ElementAt (0).ElementAt (9);
  11127. CString m_time1 = g_List1array.ElementAt (0).ElementAt (10);
  11128. CString m_time2 = g_List1array.ElementAt (0).ElementAt (11);
  11129. CString m_time3 = g_List1array.ElementAt (0).ElementAt (12);
  11130. CString m_ren = g_List1array.ElementAt (0).ElementAt (14);
  11131. CString m_discount = g_List1array.ElementAt (0).ElementAt (15);
  11132. CString m_payed1 = g_List1array.ElementAt (0).ElementAt (16);
  11133. CString m_payed2 = g_List1array.ElementAt (0).ElementAt (17);
  11134. CString m_payed3 = g_List1array.ElementAt (0).ElementAt (18);
  11135. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (19);
  11136. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (20);
  11137. CString m_time4 = g_List1array.ElementAt (0).ElementAt (21);
  11138. CString m_time5 = g_List1array.ElementAt (0).ElementAt (22);
  11139. CString m_clothescount = g_List1array.ElementAt (0).ElementAt (26);
  11140. CString m_clothescount2 = g_List1array.ElementAt (0).ElementAt (27);
  11141. CString m_outside = g_List1array.ElementAt (0).ElementAt (28);
  11142. CString m_outside2 = g_List1array.ElementAt (0).ElementAt (29);
  11143. CString m_style = g_List1array.ElementAt (0).ElementAt (30);
  11144. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (34);
  11145. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (35);
  11146. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (37);
  11147. CString m_bz = g_List1array.ElementAt (0).ElementAt (38);
  11148. CString m_phone1=clientarray.ElementAt (0).ElementAt (3);
  11149. CString m_phone2=clientarray.ElementAt (0).ElementAt (4);
  11150. CString m_addr1=clientarray.ElementAt (0).ElementAt (7);
  11151. CString m_addr2=clientarray.ElementAt (0).ElementAt (8);
  11152. CString m_occupation1=clientarray.ElementAt (0).ElementAt (9);
  11153. CString m_occupation2=clientarray.ElementAt (0).ElementAt (10);
  11154. filter="name='"+m_ren+"'";
  11155. g_sendhead.code[0]=5;
  11156. g_sendhead.tabcount=1;
  11157. g_sendhead.bsql=0;
  11158. int g_nYearposTemp=g_nYearpos;
  11159. g_nYearpos=-1;
  11160. g_pMainWnd->ProcessChatMessageRequest2(filter);
  11161. g_nYearpos=g_nYearposTemp;
  11162. if(g_bSendOK==0)return;
  11163. DataToArray(&phonearray);
  11164. m_money2.Format ("%f", atof(m_payed5)+atof(m_money1));
  11165. m_money1.Format ("%f", atof(m_taoxijiage)+atof(m_payed4));
  11166. m_money3.Format ("%f", atof(m_money1)-atof(m_money2));
  11167. ConvertToPrice(m_money1);
  11168. ConvertToPrice(m_money2);
  11169. ConvertToPrice(m_money3);
  11170. ////////////////////////////////////////////////////////////////
  11171. int rcpos=-1;
  11172. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  11173. Image *pImg=NULL;
  11174. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo2.jpg");
  11175. if(seldlg.m_bFrame)
  11176. m_Print.DrawImage(pImg, StrRect);
  11177. delete pImg;
  11178. m_Print.SetFontFace(16, 1, "黑体");
  11179. StrRect=load.m_rcarray .ElementAt (++rcpos);
  11180. if(seldlg.m_bFrame)
  11181. ///////////////////////////////不用改
  11182. m_Print.DrawText((LPTSTR)(LPCTSTR)"摩登新娘工作流程单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11183. m_Print.SetFontFace(10, 1, "宋体");
  11184. for( i=3; i<=6; i++)
  11185. {
  11186. StrRect=load.m_rcarray .ElementAt (i-1);
  11187. if(seldlg.m_bFrame)
  11188. m_Print.DrawRect2(StrRect, 1);
  11189. }
  11190. CStringArray strarray;
  11191. if(seldlg.m_bBooking==0)
  11192. {
  11193. m_name1.Empty ();
  11194. m_name2.Empty ();
  11195. m_phone1.Empty ();
  11196. m_phone2.Empty ();
  11197. m_addr1.Empty ();
  11198. m_addr2.Empty ();
  11199. m_taoxiname.Empty ();
  11200. m_taoxijiage.Empty ();
  11201. }
  11202. if(seldlg.m_bFrame )
  11203. {
  11204. strarray.Add("新郎:"+m_name1);
  11205. strarray.Add("H");
  11206. strarray.Add("O");
  11207. strarray.Add("手机:"+m_phone1);
  11208. strarray.Add("新娘:"+m_name2);
  11209. strarray.Add("H");
  11210. strarray.Add("O");
  11211. strarray.Add("手机:"+m_phone2);
  11212. }
  11213. else
  11214. {
  11215. strarray.Add(" "+m_name1);
  11216. strarray.Add("");
  11217. strarray.Add("");
  11218. strarray.Add(" "+m_phone1);
  11219. strarray.Add(" "+m_name2);
  11220. strarray.Add("");
  11221. strarray.Add("");
  11222. strarray.Add(" "+m_phone2);
  11223. }
  11224. for( i=7; i<=14; i++)
  11225. {
  11226. StrRect=load.m_rcarray .ElementAt (i-1);
  11227. StrRect.left +=2;
  11228. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11229. }
  11230. StrRect=load.m_rcarray .ElementAt (3);
  11231. StrRect.left +=2;
  11232. if(seldlg.m_bFrame)
  11233. str="地址:"+m_addr1;
  11234. else
  11235. str=" "+m_addr1;
  11236. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11237. StrRect=load.m_rcarray .ElementAt (5);
  11238. StrRect.left +=2;
  11239. if(seldlg.m_bFrame)
  11240. str="地址:"+m_addr2;
  11241. else
  11242. str=" "+m_addr2;
  11243. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11244. //////////////////////////////////////////////////////
  11245. StrRect=load.m_rcarray .ElementAt (14);
  11246. str="预\r\n约";
  11247. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11248. StrRect.top +=46;
  11249. StrRect.left +=2;
  11250. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11251. m_Print.SetFontFace(10, 1, "宋体");
  11252. StrRect=load.m_rcarray .ElementAt (15);
  11253. if(seldlg.m_bFrame)
  11254. str="套系名称:"+m_taoxiname;
  11255. else
  11256. str=" "+m_taoxiname;
  11257. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11258. StrRect.left +=4;
  11259. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11260. StrRect=load.m_rcarray .ElementAt (16);
  11261. if(seldlg.m_bFrame)
  11262. str="单价:"+m_taoxijiage;
  11263. else
  11264. str=" "+m_taoxijiage;
  11265. StrRect.left +=2;
  11266. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11267. StrRect=load.m_rcarray .ElementAt (21);
  11268. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11269. str="新人签名:";
  11270. StrRect.left +=2;
  11271. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11272. StrRect=load.m_rcarray .ElementAt (22);
  11273. if(seldlg.m_bBooking==0)
  11274. {
  11275. if(seldlg.m_bFrame)
  11276. str="未付款:";
  11277. else
  11278. str=" ";
  11279. }
  11280. else
  11281. {
  11282. if(seldlg.m_bFrame)
  11283. str="未付款:"+m_money3;
  11284. else
  11285. str=" "+m_money3;
  11286. }
  11287. StrRect.left +=2;
  11288. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11289. StrRect=load.m_rcarray .ElementAt (23);
  11290. str="结婚秘书:";
  11291. StrRect.left +=2;
  11292. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11293. StrRect=load.m_rcarray .ElementAt (24);
  11294. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11295. StrRect.left +=3;
  11296. StrRect.top +=3;
  11297. StrRect.right -=2;
  11298. StrRect.bottom -=2;
  11299. int realpos=0;str="";
  11300. for(i=0; i<sparray.GetSize (); i++)
  11301. {
  11302. if(atoi(sparray.ElementAt (i).ElementAt (4))!=1)continue;
  11303. str+=sparray.ElementAt (i).ElementAt (5);
  11304. str+=" 数量:";
  11305. str+=sparray.ElementAt (i).ElementAt (3);
  11306. if(realpos%2)
  11307. str+="\r\n";
  11308. else
  11309. str+=" ";
  11310. realpos++;
  11311. }
  11312. str.TrimRight ("\r\n");
  11313. str.TrimRight (" ");
  11314. if(seldlg.m_bBooking)AutoDraw(m_Print, StrRect, str, 1.4);
  11315. ///////////////////////////////////////////////////////////
  11316. StrRect=load.m_rcarray .ElementAt (14);
  11317. StrRect.top +=1*122;
  11318. StrRect.bottom +=1*122;
  11319. str="拍\r\n照";
  11320. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11321. StrRect.top +=46;
  11322. StrRect.left +=2;
  11323. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11324. m_Print.SetFontFace(10, 1, "宋体");
  11325. StrRect=load.m_rcarray .ElementAt (15);
  11326. StrRect.top +=1*122;
  11327. StrRect.bottom +=1*122;
  11328. str="拍照内容: 白 晚 特 便";
  11329. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11330. StrRect.left +=4;
  11331. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11332. StrRect=load.m_rcarray .ElementAt (21);
  11333. StrRect.top +=1*122;
  11334. StrRect.bottom +=1*122;
  11335. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11336. str=" 新人签名:";
  11337. StrRect.left +=2;
  11338. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11339. StrRect=load.m_rcarray .ElementAt (22);
  11340. StrRect.top +=1*122;
  11341. StrRect.bottom +=1*122;
  11342. if(seldlg.m_bTake)
  11343. {
  11344. if(seldlg.m_bFrame)
  11345. str="未付款:"+m_money3;
  11346. else
  11347. str=" "+m_money3;
  11348. }
  11349. else
  11350. {
  11351. if(seldlg.m_bFrame)
  11352. str="未付款:";
  11353. else
  11354. str=" ";
  11355. }
  11356. StrRect.left +=2;
  11357. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11358. StrRect=load.m_rcarray .ElementAt (23);
  11359. StrRect.top +=1*122;
  11360. StrRect.bottom +=1*122;
  11361. str="结婚秘书:";
  11362. StrRect.left +=2;
  11363. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11364. StrRect=load.m_rcarray .ElementAt (24);
  11365. StrRect.top +=1*122;
  11366. StrRect.bottom +=1*122;
  11367. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11368. StrRect.left +=3;
  11369. StrRect.top +=3;
  11370. StrRect.right -=2;
  11371. StrRect.bottom -=2;
  11372. if(seldlg.m_bTake)
  11373. {
  11374. str="";
  11375. for(i=0; i<bukuan2array.GetSize (); i++)
  11376. {
  11377. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=1)continue;
  11378. str+="加挑: ";
  11379. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11380. str+="\r\n";
  11381. }
  11382. str.TrimRight ("\r\n");
  11383. str.TrimRight (" ");
  11384. AutoDraw(m_Print, StrRect, str, 1.4);
  11385. }
  11386. ///////////////////////////////////////////////////////////
  11387. StrRect=load.m_rcarray .ElementAt (14);
  11388. StrRect.top +=2*122;
  11389. StrRect.bottom +=2*122;
  11390. str="选\r\n样";
  11391. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11392. StrRect.top +=46;
  11393. StrRect.left +=2;
  11394. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11395. m_Print.SetFontFace(10, 1, "宋体");
  11396. StrRect=load.m_rcarray .ElementAt (15);
  11397. StrRect.top +=2*122;
  11398. StrRect.bottom +=2*122;
  11399. str="选片内容:";
  11400. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11401. StrRect.left +=4;
  11402. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11403. StrRect=load.m_rcarray .ElementAt (21);
  11404. StrRect.top +=2*122;
  11405. StrRect.bottom +=2*122;
  11406. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11407. str=" 新人签名:";
  11408. StrRect.left +=2;
  11409. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11410. StrRect=load.m_rcarray .ElementAt (22);
  11411. StrRect.top +=2*122;
  11412. StrRect.bottom +=2*122;
  11413. if(seldlg.m_bChoose)
  11414. {
  11415. if(seldlg.m_bFrame)
  11416. str="未付款:"+m_money3;
  11417. else
  11418. str=" "+m_money3;
  11419. }
  11420. else
  11421. {
  11422. if(seldlg.m_bFrame)
  11423. str="未付款:";
  11424. else
  11425. str=" ";
  11426. }
  11427. StrRect.left +=2;
  11428. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11429. StrRect=load.m_rcarray .ElementAt (23);
  11430. StrRect.top +=2*122;
  11431. StrRect.bottom +=2*122;
  11432. str="结婚秘书:";
  11433. StrRect.left +=2;
  11434. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11435. StrRect=load.m_rcarray .ElementAt (24);
  11436. StrRect.top +=2*122;
  11437. StrRect.bottom +=2*122;
  11438. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11439. if(seldlg.m_bChoose)
  11440. {
  11441. StrRect.left +=3;
  11442. StrRect.top +=3;
  11443. StrRect.right -=2;
  11444. StrRect.bottom -=2;
  11445. str="";
  11446. for(i=0; i<bukuan2array.GetSize (); i++)
  11447. {
  11448. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=2)continue;
  11449. str+="加挑: ";
  11450. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11451. str+="\r\n";
  11452. }
  11453. str.TrimRight ("\r\n");
  11454. str.TrimRight (" ");
  11455. AutoDraw(m_Print, StrRect, str, 1.4);
  11456. }
  11457. ///////////////////////////////////////////////////////////
  11458. StrRect=load.m_rcarray .ElementAt (14);
  11459. StrRect.top +=3*122;
  11460. StrRect.bottom +=3*122;
  11461. str="结\r\n婚";
  11462. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11463. StrRect.top +=46;
  11464. StrRect.left +=2;
  11465. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11466. m_Print.SetFontFace(10, 1, "宋体");
  11467. StrRect=load.m_rcarray .ElementAt (15);
  11468. StrRect.top +=3*122;
  11469. StrRect.bottom +=3*122;
  11470. str="结婚内容: 区 白 晚 押金:";
  11471. if(seldlg.m_bFrame) m_Print.DrawRect2(StrRect, 1);
  11472. StrRect.left +=4;
  11473. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11474. StrRect=load.m_rcarray .ElementAt (21);
  11475. StrRect.top +=3*122;
  11476. StrRect.bottom +=3*122;
  11477. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11478. str=" 新人签名:";
  11479. StrRect.left +=2;
  11480. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11481. StrRect=load.m_rcarray .ElementAt (22);
  11482. StrRect.top +=3*122;
  11483. StrRect.bottom +=3*122;
  11484. if(seldlg.m_bBooking)
  11485. {
  11486. if(seldlg.m_bFrame)
  11487. str="未付款:"+m_money3;
  11488. else
  11489. str=" "+m_money3;
  11490. }
  11491. else
  11492. {
  11493. if(seldlg.m_bFrame)
  11494. str="未付款:";
  11495. else
  11496. str=" ";
  11497. }
  11498. StrRect.left +=2;
  11499. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11500. StrRect=load.m_rcarray .ElementAt (23);
  11501. StrRect.top +=3*122;
  11502. StrRect.bottom +=3*122;
  11503. str="结婚秘书:";
  11504. StrRect.left +=2;
  11505. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11506. StrRect=load.m_rcarray .ElementAt (24);
  11507. StrRect.top +=3*122;
  11508. StrRect.bottom +=3*122;
  11509. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11510. if(seldlg.m_bBooking)
  11511. {
  11512. StrRect.left +=3;
  11513. StrRect.top +=3;
  11514. StrRect.right -=2;
  11515. StrRect.bottom -=2;
  11516. realpos=0;str="";
  11517. for(i=0; i<sparray.GetSize (); i++)
  11518. {
  11519. if(atoi(sparray.ElementAt (i).ElementAt (4))!=2)continue;
  11520. str+=sparray.ElementAt (i).ElementAt (5);
  11521. str+=" 数量:";
  11522. str+=sparray.ElementAt (i).ElementAt (3);
  11523. if(realpos%2)
  11524. str+="\r\n";
  11525. else
  11526. str+=" ";
  11527. realpos++;
  11528. }
  11529. str.TrimRight ("\r\n");
  11530. str.TrimRight (" ");
  11531. AutoDraw(m_Print, StrRect, str, 1.4);
  11532. }
  11533. ///////////////////////////////////////
  11534. strarray.RemoveAll ();
  11535. if(seldlg.m_bFrame)
  11536. {
  11537. strarray.Add ("项目");
  11538. strarray.Add ("万");
  11539. strarray.Add ("千");
  11540. strarray.Add ("百");
  11541. strarray.Add ("十");
  11542. strarray.Add ("个");
  11543. strarray.Add ("收 银");
  11544. }
  11545. else
  11546. {
  11547. strarray.Add ("");
  11548. strarray.Add ("");
  11549. strarray.Add ("");
  11550. strarray.Add ("");
  11551. strarray.Add ("");
  11552. strarray.Add ("");
  11553. strarray.Add ("");
  11554. }
  11555. CStringArray strarray2;
  11556. float ftotal=0;
  11557. int realcount=0;
  11558. if(seldlg.m_bBooking)
  11559. {
  11560. for(i=0; i<bukuanarray.GetSize (); i++)
  11561. {
  11562. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=3 && atoi(bukuanarray.ElementAt (i).ElementAt (6))!=4)continue;
  11563. realcount++;
  11564. if(realcount>6)break;
  11565. str=bukuanarray.ElementAt (i).ElementAt (1);
  11566. ftotal+=atof(str);
  11567. strarray2.Add (GetW(str));
  11568. strarray2.Add (GetK(str));
  11569. strarray2.Add (GetB(str));
  11570. strarray2.Add (GetS(str));
  11571. strarray2.Add (GetG(str));
  11572. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11573. }
  11574. }
  11575. while(strarray2.GetSize ()<36)
  11576. strarray2.Add ("");
  11577. str.Format ("%f", ftotal);
  11578. strarray2.Add (GetW(str));
  11579. strarray2.Add (GetK(str));
  11580. strarray2.Add (GetB(str));
  11581. strarray2.Add (GetS(str));
  11582. strarray2.Add (GetG(str));
  11583. strarray2.Add ("");
  11584. //拍照
  11585. ftotal=0;
  11586. realcount=0;
  11587. if(seldlg.m_bTake)
  11588. {
  11589. for(i=0; i<bukuanarray.GetSize (); i++)
  11590. {
  11591. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=1)continue;
  11592. realcount++;
  11593. if(realcount>6)break;
  11594. str=bukuanarray.ElementAt (i).ElementAt (1);
  11595. ftotal+=atof(str);
  11596. strarray2.Add (GetW(str));
  11597. strarray2.Add (GetK(str));
  11598. strarray2.Add (GetB(str));
  11599. strarray2.Add (GetS(str));
  11600. strarray2.Add (GetG(str));
  11601. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11602. }
  11603. }
  11604. while(strarray2.GetSize ()<42+36)
  11605. strarray2.Add ("");
  11606. str.Format ("%f", ftotal);
  11607. strarray2.Add (GetW(str));
  11608. strarray2.Add (GetK(str));
  11609. strarray2.Add (GetB(str));
  11610. strarray2.Add (GetS(str));
  11611. strarray2.Add (GetG(str));
  11612. strarray2.Add ("");
  11613. //选片
  11614. ftotal=0;
  11615. realcount=0;
  11616. if(seldlg.m_bChoose)
  11617. {
  11618. for(i=0; i<bukuanarray.GetSize (); i++)
  11619. {
  11620. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=2)continue;
  11621. realcount++;
  11622. if(realcount>6)break;
  11623. str=bukuanarray.ElementAt (i).ElementAt (1);
  11624. ftotal+=atof(str);
  11625. strarray2.Add (GetW(str));
  11626. strarray2.Add (GetK(str));
  11627. strarray2.Add (GetB(str));
  11628. strarray2.Add (GetS(str));
  11629. strarray2.Add (GetG(str));
  11630. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11631. }
  11632. }
  11633. while(strarray2.GetSize ()<42*2+36)
  11634. strarray2.Add ("");
  11635. str.Format ("%f", ftotal);
  11636. strarray2.Add (GetW(str));
  11637. strarray2.Add (GetK(str));
  11638. strarray2.Add (GetB(str));
  11639. strarray2.Add (GetS(str));
  11640. strarray2.Add (GetG(str));
  11641. strarray2.Add ("");
  11642. /////////////////////////////
  11643. CRect temprc;
  11644. for(int n=0; n<4; n++)
  11645. {
  11646. StrRect=load.m_rcarray .ElementAt (17);
  11647. StrRect.top +=n*122;
  11648. StrRect.bottom +=n*122;
  11649. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11650. StrRect=load.m_rcarray .ElementAt (18);
  11651. if(n)
  11652. {
  11653. StrRect.left +=36;
  11654. StrRect.right +=36;
  11655. }
  11656. StrRect.top +=n*122;
  11657. StrRect.bottom +=n*122;
  11658. if(seldlg.m_bFrame)
  11659. str.Format("%d年", tm.GetYear ());
  11660. else
  11661. str.Format("%d ", tm.GetYear ());
  11662. 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))
  11663. {
  11664. if(seldlg.m_bFrame)
  11665. str=" 年";
  11666. else
  11667. str=" ";
  11668. }
  11669. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11670. StrRect=load.m_rcarray .ElementAt (19);
  11671. if(n)
  11672. {
  11673. StrRect.left +=38;
  11674. StrRect.right +=38;
  11675. }
  11676. StrRect.top +=n*122;
  11677. StrRect.bottom +=n*122;
  11678. if(seldlg.m_bFrame)
  11679. str.Format("%02d月", tm.GetMonth ());
  11680. else
  11681. str.Format("%02d ", tm.GetMonth ());
  11682. 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))
  11683. {
  11684. if(seldlg.m_bFrame)
  11685. str=" 月";
  11686. else
  11687. str=" ";
  11688. }
  11689. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11690. StrRect=load.m_rcarray .ElementAt (20);
  11691. if(n)
  11692. {
  11693. StrRect.left +=36;
  11694. StrRect.right +=36;
  11695. }
  11696. StrRect.top +=n*122;
  11697. StrRect.bottom +=n*122;
  11698. if(seldlg.m_bFrame)
  11699. str.Format("%02d日", tm.GetDay ());
  11700. else
  11701. str.Format("%02d ", tm.GetDay ());
  11702. 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))
  11703. {
  11704. if(seldlg.m_bFrame)
  11705. str=" 日";
  11706. else
  11707. str=" ";
  11708. }
  11709. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11710. for(i=26; i<=32; i++)
  11711. {
  11712. StrRect=load.m_rcarray .ElementAt (i-1);
  11713. StrRect.bottom -=14;
  11714. for(int j=0; j<8; j++)
  11715. {
  11716. StrRect.top=StrRect.bottom;
  11717. if(j>2)
  11718. {
  11719. StrRect.bottom =StrRect.top+14;
  11720. }
  11721. else
  11722. {
  11723. StrRect.bottom =StrRect.top+13;
  11724. }
  11725. temprc=StrRect;
  11726. StrRect.top +=n*122;
  11727. StrRect.bottom +=n*122;
  11728. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11729. if(i==26 && j==4 && seldlg.m_bFrame)
  11730. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11731. else if(i==26 && j==5 && seldlg.m_bFrame)
  11732. m_Print.DrawText((LPTSTR)(LPCTSTR)"付款", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11733. else if(i==26 && j==7 && seldlg.m_bFrame)
  11734. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11735. else if(j==0)
  11736. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-26), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11737. else if(j && i>26 && n<3)
  11738. {
  11739. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray2.ElementAt ((j-1)*6+(i-27)+n*42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11740. }
  11741. StrRect=temprc;
  11742. }
  11743. }
  11744. }
  11745. if(seldlg.m_bFrame)
  11746. {
  11747. StrRect=load.m_rcarray .ElementAt (32);
  11748. str="注\r\n意\r\n事\r\n项";
  11749. StrRect.top +=367;
  11750. StrRect.bottom +=367;
  11751. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11752. StrRect.top +=17;
  11753. StrRect.left +=2;
  11754. AutoDraw(m_Print, StrRect, str, 1.4);
  11755. StrRect=load.m_rcarray .ElementAt (33);
  11756. str="1: 本预约单自预定日期起一年内有效.定金在拍照套系金额中扣出.预定金一概不退\r\n\
  11757. 2: 多拍照片只供筛选.恕不奉送.版权所有.不得私自拷贝\r\n\
  11758. 3: 拍照款请于拍照时一次付清\r\n\
  11759. 4: 新娘装AM8:00前钟点费另计.婚纱礼服出租押金500-2000元\r\n\
  11760. 5: 本公司设有豪华VIP礼服区.及皇家御用礼服展区.但需另外加价.详情请咨本店人员\r\n\
  11761. 6: 安瓶, 美甲一次性化妆用具等均属增值服务部分,则需另外加价,详情咨询本店工作人员\r\n\
  11762. 7: 本电脑机械故障导致文件资料丢失.本公司只提供补拍服务\r\n\
  11763. 8: 每次前来请务必携带本单交给工作人员.本单是您在摩登新娘拍照的凭证.办理有关手续凭本单办理盖\r\n\
  11764. 章后方可生效";
  11765. StrRect.top +=367;
  11766. StrRect.bottom +=367;
  11767. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11768. StrRect.top +=4;
  11769. StrRect.left +=2;
  11770. AutoDraw(m_Print, StrRect, str, 1.0);
  11771. StrRect=load.m_rcarray .ElementAt (34);
  11772. 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)";
  11773. AutoDraw(m_Print, StrRect, str, 1.0);
  11774. m_Print.SetFontFace(13, 1, "宋体");
  11775. StrRect=load.m_rcarray .ElementAt (35);
  11776. str="地 址: 汉口 . 解放大道 . 头道街东部购物公园C栋二,三层";
  11777. StrRect.top +=367;
  11778. StrRect.bottom +=367;
  11779. StrRect.left +=2;
  11780. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11781. StrRect=load.m_rcarray .ElementAt (36);
  11782. str="喜讯热线: 027-81888799 81888599 81888699";
  11783. StrRect.top +=367;
  11784. StrRect.bottom +=367;
  11785. StrRect.left +=2;
  11786. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11787. }
  11788. PrintPreview dlg;
  11789. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  11790. dlg.m_pDC =m_Print.GetPDC() ;
  11791. if(dlg.DoModal ()!=IDOK)return;
  11792. //结束打印
  11793. m_Print.EndPage();
  11794. m_Print.EndPrint();
  11795. #endif
  11796. }
  11797. extern CString GetHMoney(CString str);
  11798. void CMainFrame::PrintReceipt3(CString strOrderNumber, CStringArray *pArray, float money)
  11799. {
  11800. int printcot = 1;
  11801. for (int aa = 0; aa < printcot; aa++)
  11802. {
  11803. g_sendhead.bsql = 0;
  11804. g_sendhead.code[0] = 24;
  11805. g_sendhead.tabcount = 1;
  11806. int g_nYearposTemp = g_nYearpos;
  11807. g_nYearpos = -1;
  11808. g_pMainWnd->ProcessChatMessageRequest2(1);
  11809. g_nYearpos = g_nYearposTemp;
  11810. if (0 == g_bSendOK)return;
  11811. DataToArray(&g_cominfoarray);
  11812. CString SerialNo;
  11813. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  11814. CPrintRX m_Print;
  11815. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  11816. {
  11817. m_Print.InitToPrint(NULL, 1);
  11818. }
  11819. else
  11820. {
  11821. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  11822. if (name.IsEmpty())
  11823. m_Print.InitToPrint(NULL, 1);
  11824. else
  11825. {
  11826. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  11827. if (nret == -1 && aa == 0)
  11828. {
  11829. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  11830. }
  11831. }
  11832. }
  11833. m_Print.StartPrint();
  11834. m_Print.StartPage();
  11835. LoadRect load;
  11836. load.SetLiaPath("15.lia");
  11837. load.SetMargins(0, 0);
  11838. if (!load.Load())return;
  11839. int i;
  11840. //////////////////////////////////////////////////////////////
  11841. CStringArray txarray;
  11842. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  11843. g_sendhead.code[0] = 11;
  11844. g_sendhead.code[1] = 52;
  11845. g_sendhead.tabcount = 2;
  11846. g_sendhead.bsql = 0;
  11847. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  11848. CArray<CStringArray, CStringArray>sparray;
  11849. CArray<CStringArray, CStringArray>clientarray;
  11850. DataToArray(&g_List1array, &clientarray);
  11851. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  11852. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  11853. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  11854. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  11855. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  11856. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  11857. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  11858. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  11859. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  11860. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  11861. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  11862. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  11863. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  11864. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  11865. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  11866. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  11867. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  11868. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  11869. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  11870. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  11871. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  11872. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  11873. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  11874. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  11875. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  11876. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  11877. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  11878. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  11879. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  11880. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  11881. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  11882. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  11883. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  11884. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  11885. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  11886. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  11887. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  11888. CString m_addr = m_addr1 + ";";
  11889. m_addr.TrimLeft(";");
  11890. m_addr += m_addr2;
  11891. CString m_qq = m_qq1 + ";";
  11892. m_qq.TrimLeft(";");
  11893. m_qq += m_qq2;
  11894. m_money1.Format("%f", atof(m_taoxijiage));
  11895. m_money2.Format("%f", atof(m_payed1));
  11896. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  11897. ConvertToPrice(m_money1);
  11898. ConvertToPrice(m_money2);
  11899. ConvertToPrice(m_money3);
  11900. ////////////////////////////////////////////////////////////////
  11901. int rcpos = -1;
  11902. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  11903. m_Print.SetFontFace(17, 1, "宋体");
  11904. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11905. StrRect.top -= 0;
  11906. StrRect.bottom -= 10;
  11907. StrRect.left -= 140;
  11908. StrRect.right = StrRect.left + 48;
  11909. m_Print.SetFontFace(15, 1, "宋体");
  11910. m_Print.SetColor(0xffffff);
  11911. m_Print.DrawRect(StrRect, 0);
  11912. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11913. StrRect.left = StrRect.right;
  11914. StrRect.right = StrRect.left + 48;
  11915. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  11916. m_Print.SetColor(0, RGB(255, 0, 0));
  11917. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11918. m_Print.SetColor(0);
  11919. m_Print.SetFontFace(12, 1, "宋体");
  11920. StrRect.left -= 48;
  11921. int hei = StrRect.Height();
  11922. StrRect.top = StrRect.bottom + 2;
  11923. StrRect.bottom += hei + 2;
  11924. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11925. StrRect.top = StrRect.bottom - 2;
  11926. StrRect.bottom += hei - 5;
  11927. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  11928. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11929. m_Print.SetFontFace(12, 1, "宋体");
  11930. m_Print.DrawText((LPTSTR)(LPCTSTR)"收款单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11931. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11932. m_Print.SetFontFace(9, 1, "宋体");
  11933. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11934. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11935. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11936. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11937. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11938. m_Print.DrawRect2(StrRect, 2);
  11939. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11940. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11941. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11942. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11943. m_Print.DrawRect2(StrRect, 2);
  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_birthday1, 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_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11953. m_Print.DrawRect2(StrRect, 2);
  11954. ////////////
  11955. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11956. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11957. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11958. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11959. m_Print.DrawRect2(StrRect, 2);
  11960. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11961. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11962. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11963. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11964. m_Print.DrawRect2(StrRect, 2);
  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_birthday2, 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)g_date, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11974. m_Print.DrawRect2(StrRect, 2);
  11975. for (i = 19; i < 49; i++)
  11976. {
  11977. if (i >= 44)
  11978. {
  11979. StrRect = load.m_rcarray.ElementAt(i - 5);
  11980. int hei = StrRect.Height();
  11981. StrRect.top += hei;
  11982. StrRect.bottom += hei;
  11983. }
  11984. else
  11985. StrRect = load.m_rcarray.ElementAt(i);
  11986. m_Print.DrawRect2(StrRect, 1);
  11987. }
  11988. float fmoney = 0;
  11989. for (i = 19; i < 49; i++)
  11990. {
  11991. if (i >= 44)
  11992. {
  11993. StrRect = load.m_rcarray.ElementAt(i - 5);
  11994. int hei = StrRect.Height();
  11995. StrRect.top += hei;
  11996. StrRect.bottom += hei;
  11997. }
  11998. else
  11999. StrRect = load.m_rcarray.ElementAt(i);
  12000. StrRect.left += 2;
  12001. /* if((i-19)%5==2)
  12002. {
  12003. fmoney+=atof(pArray->ElementAt (i-19));
  12004. }*/
  12005. m_Print.DrawText((LPTSTR)(LPCTSTR)(pArray->ElementAt(i - 19)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12006. }
  12007. m_money2.Format("%f", money);
  12008. ConvertToPrice(m_money2);
  12009. StrRect = load.m_rcarray.ElementAt(44);
  12010. CString str;
  12011. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 实收¥: %s 元 收银员: %s", \
  12012. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  12013. m_money2, g_user.name);
  12014. m_Print.DrawRect2(StrRect, 1);
  12015. StrRect.left += 3;
  12016. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12017. StrRect = load.m_rcarray.ElementAt(46);
  12018. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12019. StrRect = load.m_rcarray.ElementAt(47);
  12020. m_Print.DrawRect2(StrRect, 2);
  12021. StrRect = load.m_rcarray.ElementAt(48);
  12022. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12023. StrRect = load.m_rcarray.ElementAt(45);
  12024. str = "\
  12025. 顾客须知\r\n\
  12026. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  12027. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  12028. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  12029. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  12030. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  12031. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  12032. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  12033. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12034. AutoDraw(m_Print, StrRect, str, 1.8);
  12035. PrintPreview dlg;
  12036. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12037. dlg.m_pDC = m_Print.GetPDC();
  12038. if (aa == 0)
  12039. {
  12040. if (dlg.DoModal() != IDOK)
  12041. return;
  12042. printcot = dlg.m_num;
  12043. }
  12044. //结束打印
  12045. m_Print.EndPage();
  12046. m_Print.EndPrint();
  12047. }
  12048. }
  12049. void CMainFrame::PrintReceipt2(CString strOrderNumber)
  12050. {
  12051. int printcot = 1;
  12052. for (int aa = 0; aa < printcot; aa++)
  12053. {
  12054. g_sendhead.bsql = 0;
  12055. g_sendhead.code[0] = 24;
  12056. g_sendhead.tabcount = 1;
  12057. int g_nYearposTemp = g_nYearpos;
  12058. g_nYearpos = -1;
  12059. g_pMainWnd->ProcessChatMessageRequest2(1);
  12060. g_nYearpos = g_nYearposTemp;
  12061. if (0 == g_bSendOK)return;
  12062. DataToArray(&g_cominfoarray);
  12063. CString SerialNo;
  12064. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  12065. CPrintRX m_Print;
  12066. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12067. {
  12068. m_Print.InitToPrint(NULL, 1);
  12069. }
  12070. else
  12071. {
  12072. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  12073. if (name.IsEmpty())
  12074. m_Print.InitToPrint(NULL, 1);
  12075. else
  12076. {
  12077. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12078. if (nret == -1 && aa == 0)
  12079. {
  12080. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12081. }
  12082. }
  12083. }
  12084. m_Print.StartPrint();
  12085. m_Print.StartPage();
  12086. LoadRect load;
  12087. load.SetLiaPath("14.lia");
  12088. load.SetMargins(0, 0);
  12089. if (!load.Load())return;
  12090. int i;
  12091. //////////////////////////////////////////////////////////////
  12092. CStringArray txarray;
  12093. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  12094. g_sendhead.code[0] = 11;
  12095. g_sendhead.code[1] = 52;
  12096. g_sendhead.code[2] = 93;
  12097. g_sendhead.tabcount = 3;
  12098. g_sendhead.bsql = 0;
  12099. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12100. CArray<CStringArray, CStringArray>sparray;
  12101. CArray<CStringArray, CStringArray>clientarray;
  12102. CArray<CStringArray, CStringArray>moneyarray;
  12103. DataToArray(&g_List1array, &clientarray, &moneyarray);
  12104. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12105. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12106. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12107. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12108. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12109. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  12110. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12111. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12112. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12113. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12114. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12115. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12116. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12117. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12118. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12119. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12120. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12121. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12122. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12123. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12124. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12125. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12126. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12127. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12128. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12129. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12130. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12131. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12132. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  12133. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12134. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12135. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  12136. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  12137. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  12138. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  12139. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  12140. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  12141. CString m_addr = m_addr1 + ";";
  12142. m_addr.TrimLeft(";");
  12143. m_addr += m_addr2;
  12144. CString m_qq = m_qq1 + ";";
  12145. m_qq.TrimLeft(";");
  12146. m_qq += m_qq2;
  12147. m_money1.Format("%f", atof(m_taoxijiage));
  12148. m_money2 = "0";
  12149. for (i = 0; i < moneyarray.GetSize(); i++)
  12150. {
  12151. if (moneyarray.ElementAt(i).ElementAt(5) == "预约收款")
  12152. m_money2 = moneyarray.ElementAt(i).ElementAt(1);
  12153. }
  12154. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  12155. ConvertToPrice(m_money1);
  12156. ConvertToPrice(m_money2);
  12157. ConvertToPrice(m_money3);
  12158. ////////////////////////////////////////////////////////////////
  12159. int rcpos = -1;
  12160. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12161. m_Print.SetFontFace(17, 1, "宋体");
  12162. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12163. StrRect.top -= 0;
  12164. StrRect.bottom -= 10;
  12165. StrRect.left -= 140;
  12166. StrRect.right = StrRect.left + 48;
  12167. m_Print.SetFontFace(15, 1, "宋体");
  12168. m_Print.SetColor(0xffffff);
  12169. m_Print.DrawRect(StrRect, 0);
  12170. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12171. StrRect.left = StrRect.right;
  12172. StrRect.right = StrRect.left + 48;
  12173. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12174. m_Print.SetColor(0, RGB(255, 0, 0));
  12175. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12176. m_Print.SetColor(0);
  12177. m_Print.SetFontFace(12, 1, "宋体");
  12178. StrRect.left -= 48;
  12179. int hei = StrRect.Height();
  12180. StrRect.top = StrRect.bottom + 2;
  12181. StrRect.bottom += hei + 2;
  12182. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12183. StrRect.top = StrRect.bottom - 2;
  12184. StrRect.bottom += hei - 5;
  12185. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12186. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12187. m_Print.SetFontFace(12, 1, "宋体");
  12188. m_Print.DrawText((LPTSTR)(LPCTSTR)"定金单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12189. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12190. m_Print.SetFontFace(9, 1, "宋体");
  12191. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12192. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12193. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12194. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12195. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12196. m_Print.DrawRect2(StrRect, 2);
  12197. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12198. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12199. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12200. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12201. m_Print.DrawRect2(StrRect, 2);
  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_birthday1, 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_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12211. m_Print.DrawRect2(StrRect, 2);
  12212. ////////////
  12213. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12214. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12215. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12216. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12217. m_Print.DrawRect2(StrRect, 2);
  12218. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12219. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12220. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12221. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12222. m_Print.DrawRect2(StrRect, 2);
  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_birthday2, 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)g_date, 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_addr, 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)m_time3, 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)"QQ/MSN:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12245. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12246. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12247. m_Print.DrawRect2(StrRect, 2);
  12248. CStringArray strarray;
  12249. strarray.Add("套系名称");
  12250. strarray.Add("总 额");
  12251. strarray.Add("定 金");
  12252. strarray.Add("余 款");
  12253. strarray.Add("摄影日期");
  12254. strarray.Add(m_taoxiname);
  12255. strarray.Add(m_money1);
  12256. strarray.Add(m_money2);
  12257. strarray.Add(m_money3);
  12258. strarray.Add(m_time2);
  12259. for (i = 25; i < 37; i++)
  12260. {
  12261. StrRect = load.m_rcarray.ElementAt(i);
  12262. m_Print.DrawRect2(StrRect, 1);
  12263. }
  12264. for (i = 25; i < 35; i++)
  12265. {
  12266. StrRect = load.m_rcarray.ElementAt(i);
  12267. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 25), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12268. }
  12269. StrRect = load.m_rcarray.ElementAt(35);
  12270. StrRect.left += 5;
  12271. StrRect.top += 5;
  12272. m_Print.DrawText((LPTSTR)(LPCTSTR)" 备 注:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  12273. StrRect = load.m_rcarray.ElementAt(36);
  12274. CString str;
  12275. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 ¥: %s 元 收银员: %s", \
  12276. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  12277. m_money2, g_user.name);
  12278. StrRect.left += 3;
  12279. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12280. StrRect = load.m_rcarray.ElementAt(38);
  12281. m_Print.DrawText((LPTSTR)(LPCTSTR)"营业员:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12282. StrRect = load.m_rcarray.ElementAt(39);
  12283. m_Print.DrawText((LPTSTR)(LPCTSTR)m_ren, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12284. m_Print.DrawRect2(StrRect, 2);
  12285. StrRect = load.m_rcarray.ElementAt(40);
  12286. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12287. StrRect = load.m_rcarray.ElementAt(41);
  12288. m_Print.DrawRect2(StrRect, 2);
  12289. StrRect = load.m_rcarray.ElementAt(42);
  12290. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12291. StrRect = load.m_rcarray.ElementAt(37);
  12292. str = "\
  12293. 顾客须知\r\n\
  12294. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  12295. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  12296. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  12297. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  12298. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  12299. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  12300. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  12301. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12302. AutoDraw(m_Print, StrRect, str, 1.8);
  12303. PrintPreview dlg;
  12304. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12305. dlg.m_pDC = m_Print.GetPDC();
  12306. if (aa == 0)
  12307. {
  12308. if (dlg.DoModal() != IDOK)
  12309. return;
  12310. printcot = dlg.m_num;
  12311. }
  12312. //结束打印
  12313. m_Print.EndPage();
  12314. m_Print.EndPrint();
  12315. }
  12316. }
  12317. void CMainFrame::OnAutodelphoto()
  12318. {
  12319. // TODO: Add your command handler code here
  12320. if (g_user.bLongin == 0)
  12321. {
  12322. if (g_bNoLoginLia)
  12323. {
  12324. Login dlg;
  12325. dlg.SetLiaPath("5.lia");
  12326. dlg.DoModal();
  12327. }
  12328. else
  12329. {
  12330. Login3 dlg;
  12331. dlg.SetLiaPath("5.lia");
  12332. dlg.DoModal();
  12333. }
  12334. if (g_user.bLongin == 0)return;
  12335. }
  12336. if (IsHasRightsnew(49) == 0)return;
  12337. DelPhotoSet dlg;
  12338. dlg.DoModal();
  12339. }
  12340. void CMainFrame::Onphotomanage() // 客照管理中心;
  12341. {
  12342. if (g_user.bLongin == 0)
  12343. {
  12344. if (g_bNoLoginLia)
  12345. {
  12346. Login dlg;
  12347. dlg.SetLiaPath("5.lia");
  12348. dlg.DoModal();
  12349. }
  12350. else
  12351. {
  12352. Login3 dlg;
  12353. dlg.SetLiaPath("5.lia");
  12354. dlg.DoModal();
  12355. }
  12356. if (g_user.bLongin == 0)return;
  12357. }
  12358. if (IsHasRightsnew(49) == 0)return;
  12359. ShowPic3 dlg;
  12360. dlg.DoModal();
  12361. }
  12362. void CMainFrame::OnCompanyinfo()
  12363. {
  12364. // TODO: Add your command handler code here
  12365. if (g_user.bLongin == 0)
  12366. {
  12367. if (g_bNoLoginLia)
  12368. {
  12369. Login dlg;
  12370. dlg.SetLiaPath("5.lia");
  12371. dlg.DoModal();
  12372. }
  12373. else
  12374. {
  12375. Login3 dlg;
  12376. dlg.SetLiaPath("5.lia");
  12377. dlg.DoModal();
  12378. }
  12379. if (g_user.bLongin == 0)return;
  12380. }
  12381. if (IsHasRightsnew(49) == 0)return;
  12382. CompanyInfo dlg;
  12383. dlg.DoModal();
  12384. }
  12385. void CMainFrame::OnTaoxifg()
  12386. {
  12387. // TODO: Add your command handler code here
  12388. if (g_user.bLongin == 0)
  12389. {
  12390. if (g_bNoLoginLia)
  12391. {
  12392. Login dlg;
  12393. dlg.SetLiaPath("5.lia");
  12394. dlg.DoModal();
  12395. }
  12396. else
  12397. {
  12398. Login3 dlg;
  12399. dlg.SetLiaPath("5.lia");
  12400. dlg.DoModal();
  12401. }
  12402. if (g_user.bLongin == 0)return;
  12403. }
  12404. if (IsHasRightsnew(49) == 0)return;
  12405. TXFG dlg;
  12406. dlg.DoModal();
  12407. }
  12408. void CMainFrame::OnHelpfile()
  12409. {
  12410. // TODO: Add your command handler code here
  12411. // ShellExecute(NULL, _T("open"), _T(g_mainpath+"\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  12412. // if(::PathFileExists (g_mainpath+"\\zx.dll"))
  12413. // ShellExecute(NULL, _T("open"), _T("www.zcsmkj.com"), "", NULL, SW_SHOWNORMAL);
  12414. // else
  12415. ShellExecute(NULL, _T("open"), _T("www.lyfz.net"), "", NULL, SW_SHOWNORMAL);
  12416. }
  12417. void CMainFrame::OnPhotobak()
  12418. {
  12419. // TODO: Add your command handler code here
  12420. if (g_user.bLongin == 0)
  12421. {
  12422. if (g_bNoLoginLia)
  12423. {
  12424. Login dlg;
  12425. dlg.SetLiaPath("5.lia");
  12426. dlg.DoModal();
  12427. }
  12428. else
  12429. {
  12430. Login3 dlg;
  12431. dlg.SetLiaPath("5.lia");
  12432. dlg.DoModal();
  12433. }
  12434. if (g_user.bLongin == 0)return;
  12435. }
  12436. if (IsHasRightsnew(49) == 0)return;
  12437. PhotoBak dlg;
  12438. dlg.DoModal();
  12439. }
  12440. //客户报表
  12441. void CMainFrame::OnClose2()
  12442. { // TODO: Add your message handler code here and/or call default
  12443. if (AfxMessageBox("是否退出系统?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  12444. if(g_user.bLongin)
  12445. WriteLog("退出系统!", "退出系统!");
  12446. g_bShowBar = 0;
  12447. if (m_Mdi.MainClose())
  12448. CMDIFrameWnd::OnClose();
  12449. }
  12450. //
  12451. void CMainFrame::ResetTimer()
  12452. {
  12453. }
  12454. void CMainFrame::LinkClick(CString str, int nParent)
  12455. {
  12456. g_pMainWnd2->m_bar.LinkClick(str);
  12457. }
  12458. void CMainFrame::PrintFlowChart2(CString m_id)
  12459. {
  12460. CPrintRX m_Print;
  12461. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12462. {
  12463. m_Print.InitToPrint(NULL, 1);
  12464. }
  12465. else
  12466. {
  12467. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  12468. if (name.IsEmpty())
  12469. m_Print.InitToPrint(NULL, 1);
  12470. else
  12471. {
  12472. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12473. if (nret == -1)
  12474. {
  12475. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12476. }
  12477. }
  12478. }
  12479. m_Print.StartPrint();
  12480. m_Print.StartPage();
  12481. LoadRect load;
  12482. load.SetLiaPath("16.lia");
  12483. load.SetMargins(0, 0);
  12484. if (!load.Load())return;
  12485. LoadRect load2;
  12486. load2.SetLiaPath("17.lia");
  12487. load2.SetMargins(0, 660);
  12488. if (!load2.Load())return;
  12489. int i;
  12490. //////////////////////////////////////////////////////////////
  12491. CStringArray txarray;
  12492. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and kind<>'2'";
  12493. g_sendhead.code[0] = 11;
  12494. g_sendhead.code[1] = 52;
  12495. g_sendhead.code[2] = 223;
  12496. g_sendhead.tabcount = 3;
  12497. g_sendhead.bsql = 0;
  12498. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12499. CArray<CStringArray, CStringArray>sparray;
  12500. CArray<CStringArray, CStringArray>clientarray;
  12501. DataToArray(&g_List1array, &clientarray, &sparray);
  12502. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12503. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12504. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12505. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12506. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12507. CString m_photocount = g_List1array.ElementAt(0).ElementAt(9);
  12508. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12509. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12510. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12511. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12512. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12513. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12514. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12515. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12516. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12517. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12518. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12519. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12520. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12521. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12522. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12523. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12524. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12525. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12526. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12527. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12528. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12529. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12530. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(39) + g_List1array.ElementAt(0).ElementAt(75);
  12531. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12532. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12533. CString spno;
  12534. for (i = 0; i < sparray.GetSize(); i++)
  12535. {
  12536. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  12537. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  12538. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  12539. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12540. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12541. spno += sparray.ElementAt(i).ElementAt(5);
  12542. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12543. spno += "; ";
  12544. else
  12545. {
  12546. spno += ":";
  12547. spno += sparray.ElementAt(i).ElementAt(6);
  12548. spno += "; ";
  12549. }
  12550. }
  12551. spno += " 加挑:";
  12552. for (i = 0; i < sparray.GetSize(); i++)
  12553. {
  12554. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  12555. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  12556. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  12557. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12558. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12559. spno += sparray.ElementAt(i).ElementAt(5);
  12560. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12561. spno += "; ";
  12562. else
  12563. {
  12564. spno += ":";
  12565. spno += sparray.ElementAt(i).ElementAt(6);
  12566. spno += "; ";
  12567. }
  12568. }
  12569. if (spno.Right(6) == " 加挑:")
  12570. {
  12571. spno = spno.Left(spno.GetLength() - 6);
  12572. }
  12573. ////////////////////////////////////////////////////////////////
  12574. int rcpos = -1;
  12575. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12576. m_Print.SetFontFace(17, 1, "宋体");
  12577. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12578. StrRect.top -= 0;
  12579. StrRect.bottom -= 10;
  12580. StrRect.left -= 140;
  12581. StrRect.right = StrRect.left + 48;
  12582. m_Print.SetFontFace(15, 1, "宋体");
  12583. m_Print.SetColor(0xffffff);
  12584. m_Print.DrawRect(StrRect, 0);
  12585. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12586. StrRect.left = StrRect.right;
  12587. StrRect.right = StrRect.left + 48;
  12588. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12589. m_Print.SetColor(0, RGB(255, 0, 0));
  12590. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12591. m_Print.SetColor(0);
  12592. m_Print.SetFontFace(12, 1, "宋体");
  12593. StrRect.left -= 48;
  12594. int hei = StrRect.Height();
  12595. StrRect.top = StrRect.bottom + 2;
  12596. StrRect.bottom += hei + 2;
  12597. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12598. StrRect.top = StrRect.bottom - 2;
  12599. StrRect.bottom += hei - 5;
  12600. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12601. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12602. m_Print.SetFontFace(12, 1, "宋体");
  12603. m_Print.DrawText((LPTSTR)(LPCTSTR)"加做取件单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12604. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12605. m_Print.SetFontFace(11, 1, "宋体");
  12606. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + m_id), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12607. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12608. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12609. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12610. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12611. m_Print.DrawRect2(StrRect, 2);
  12612. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12613. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12614. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12615. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12616. m_Print.DrawRect2(StrRect, 2);
  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_time4, 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_time5, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12626. m_Print.DrawRect2(StrRect, 2);
  12627. ////////////
  12628. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12629. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12630. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12631. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12632. m_Print.DrawRect2(StrRect, 2);
  12633. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12634. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12635. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12636. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12637. m_Print.DrawRect2(StrRect, 2);
  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_photocount, 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_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12647. m_Print.DrawRect2(StrRect, 2);
  12648. ////////////
  12649. ///////////spno
  12650. CRect sprc[22];
  12651. StrRect = load.m_rcarray.ElementAt(19);
  12652. StrRect.left += 4; StrRect.right -= 3;
  12653. hei = StrRect.Height();
  12654. for (i = 0; i < 22; i++)
  12655. {
  12656. sprc[i] = StrRect;
  12657. m_Print.DrawRect2(StrRect, 1);
  12658. if (i == 0)
  12659. {
  12660. StrRect.left += 5;
  12661. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12662. StrRect.left -= 5;
  12663. }
  12664. StrRect.top = StrRect.bottom;
  12665. StrRect.bottom = StrRect.top + hei;
  12666. sprc[i].left += 4; sprc[i].right -= 3;
  12667. }
  12668. StrRect.bottom = StrRect.top + 60;
  12669. m_Print.DrawRect2(StrRect, 1);
  12670. StrRect.left += 3; StrRect.top += 3;
  12671. StrRect.right -= 3; StrRect.bottom -= 3;
  12672. AutoDraw(m_Print, StrRect, m_bz, 1.8);
  12673. CString temp, tempspno, tempbz;
  12674. CSize size;
  12675. BOOL bRun = 0;
  12676. int fontsize = 12;
  12677. ll: tempspno = spno;
  12678. m_Print.SetFontFace(fontsize, 1, "宋体");
  12679. for (i = 1; i<22; i++)
  12680. {
  12681. if (!tempspno.IsEmpty())
  12682. {
  12683. temp = tempspno;
  12684. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12685. int right = 0;
  12686. CRect temprc = sprc[i];
  12687. while (size.cx>temprc.Width())
  12688. {
  12689. right++;
  12690. temp = tempspno.Left(tempspno.GetLength() - (right));
  12691. if (GIsHalfHZ(temp))
  12692. {
  12693. right++;
  12694. temp.Delete(temp.GetLength() - 1);
  12695. }
  12696. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12697. }
  12698. if (bRun)
  12699. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12700. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  12701. if (tempspno.IsEmpty())i++;
  12702. }
  12703. }
  12704. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  12705. {
  12706. fontsize--;
  12707. goto ll;
  12708. }
  12709. if (bRun == 0)
  12710. {
  12711. bRun = 1;
  12712. goto ll;
  12713. }
  12714. m_Print.SetFontFace(12, 1, "宋体");
  12715. StrRect = load2.m_rcarray.ElementAt(1);
  12716. m_Print.DrawText((LPTSTR)(LPCTSTR)"喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12717. StrRect = load2.m_rcarray.ElementAt(2);
  12718. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12719. StrRect = load2.m_rcarray.ElementAt(3);
  12720. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12721. StrRect = load2.m_rcarray.ElementAt(4);
  12722. m_Print.DrawRect2(StrRect, 2);
  12723. StrRect = load2.m_rcarray.ElementAt(0);
  12724. CString str = "\
  12725. 爱心提示:如对制作有任何要求请清楚列出,所有制作内容一经确认将按要求制作。\r\n\
  12726. 选样文件从拍摄日期计算将保留二个月;套相成品按取件日期保留三个月,逾期不做保留。\r\n\
  12727. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12728. AutoDraw(m_Print, StrRect, str, 1.8);
  12729. PrintPreview dlg; dlg.m_mode = 2;
  12730. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12731. dlg.m_pDC = m_Print.GetPDC();
  12732. if (dlg.DoModal() != IDOK)return;
  12733. //结束打印
  12734. m_Print.EndPage();
  12735. m_Print.EndPrint();
  12736. }
  12737. //分店
  12738. CString CMainFrame::GetDanWei(CString name, CArray<CStringArray, CStringArray>*array)
  12739. {
  12740. for (int i = 0; i < array->GetSize(); i++)
  12741. {
  12742. if (name == array->ElementAt(i).ElementAt(1))
  12743. return array->ElementAt(i).ElementAt(2);
  12744. }
  12745. return "";
  12746. }
  12747. //g_sendhead
  12748. int CMainFrame::GetPort()
  12749. {
  12750. static int aaa = -1;
  12751. if (aaa == -1)
  12752. {
  12753. aaa = CTime::GetCurrentTime().GetSecond() % 7;
  12754. }
  12755. aaa++;
  12756. if (aaa >= 7)aaa = 0;
  12757. return 8387 + aaa;
  12758. }
  12759. void CMainFrame::OnShowBakState()
  12760. {
  12761. // TODO: Add your command handler code here
  12762. g_sendhead.bsql = 0;
  12763. g_sendhead.code[0] = 171;
  12764. g_sendhead.tabcount = 1;
  12765. g_pMainWnd->ProcessChatMessageRequest2(1);
  12766. if (g_bSendOK == 0)
  12767. {
  12768. return;
  12769. }
  12770. CArray<CStringArray, CStringArray>g_bakstatearray;
  12771. DataToArray(&g_bakstatearray);
  12772. while (g_bakstatearray.GetSize() > 7)
  12773. {
  12774. g_bakstatearray.RemoveAt(0);
  12775. }
  12776. int photocount = 0;
  12777. int infocount = 0;
  12778. for (int i = 0; i < g_bakstatearray.GetSize(); i++)
  12779. {
  12780. if (g_bakstatearray.ElementAt(i).ElementAt(1) != "1")photocount++;
  12781. if (g_bakstatearray.ElementAt(i).ElementAt(2) != "1")infocount++;
  12782. }
  12783. ShowBakState dlg;
  12784. dlg.m_pArray = &g_bakstatearray;
  12785. dlg.DoModal();
  12786. }
  12787. void CMainFrame::PrintReceipt2(CStringArray *pArray)
  12788. {
  12789. int i = 0;
  12790. int printcot = 1;
  12791. for (int aa = 0; aa < printcot; aa++)
  12792. {
  12793. g_sendhead.bsql = 0;
  12794. g_sendhead.code[0] = 24;
  12795. g_sendhead.tabcount = 1;
  12796. int g_nYearposTemp = g_nYearpos;
  12797. g_nYearpos = -1;
  12798. g_pMainWnd->ProcessChatMessageRequest2(1);
  12799. g_nYearpos = g_nYearposTemp;
  12800. if (0 == g_bSendOK)return;
  12801. DataToArray(&g_cominfoarray);
  12802. CString SerialNo;
  12803. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  12804. CPrintRX m_Print;
  12805. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12806. {
  12807. m_Print.InitToPrint(NULL, 1);
  12808. }
  12809. else
  12810. {
  12811. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  12812. if (name.IsEmpty())
  12813. m_Print.InitToPrint(NULL, 1);
  12814. else
  12815. {
  12816. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12817. if (nret == -1 && aa == 0)
  12818. {
  12819. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12820. }
  12821. }
  12822. }
  12823. m_Print.StartPrint();
  12824. m_Print.StartPage();
  12825. LoadRect load;
  12826. BOOL bSmall = 0;
  12827. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  12828. {
  12829. bSmall = 1;
  12830. load.SetLiaPath("20.lia");
  12831. }
  12832. else
  12833. load.SetLiaPath("10.lia");
  12834. if (bSmall)
  12835. load.SetMargins(-10, 0);
  12836. else
  12837. load.SetMargins(10, 0);
  12838. if (!load.Load())return;
  12839. int rcpos = -1;
  12840. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12841. Image *pImg = NULL;
  12842. #ifdef MNLS_VERSION
  12843. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  12844. #else
  12845. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  12846. #endif
  12847. // m_Print.DrawImage(pImg, StrRect);
  12848. delete pImg;
  12849. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  12850. {
  12851. Image *pImg = NULL;
  12852. g_nSendCode = 31;
  12853. int g_nYearposTemp = g_nYearpos;
  12854. g_nYearpos = -1;
  12855. g_pMainWnd->ProcessChatMessageRequest2(1);
  12856. g_nYearpos = g_nYearposTemp;
  12857. g_nSendCode = 0;
  12858. if (g_bSendOK == 0)return;
  12859. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  12860. if (pImg)
  12861. {
  12862. StrRect.left = 65;
  12863. if (bSmall)StrRect.left = 55;
  12864. StrRect.top = 10;
  12865. StrRect.right = StrRect.left + 58;
  12866. StrRect.bottom = StrRect.top + 58;
  12867. m_Print.DrawImage(pImg, StrRect);
  12868. delete pImg; pImg = NULL;
  12869. }
  12870. }
  12871. if (bSmall)
  12872. {
  12873. m_Print.SetFontFace(18, 1, "黑体");
  12874. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12875. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12876. m_Print.SetFontFace(9, 1, "宋体");
  12877. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12878. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12879. m_Print.SetFontFace(6, 1, "宋体");
  12880. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12881. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12882. m_Print.SetFontFace(9, 1, "宋体");
  12883. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12884. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12885. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12886. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12887. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12888. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12889. int hei = StrRect.Height();
  12890. StrRect.bottom = StrRect.top;
  12891. StrRect.top -= 8;
  12892. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  12893. m_Print.SetFontFace(10, 1, "宋体");
  12894. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12895. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12896. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12897. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12898. m_Print.SetFontFace(9, 1, "宋体");
  12899. for ( i = 7; i < 24; i++)
  12900. {
  12901. StrRect = load.m_rcarray.ElementAt(i);
  12902. m_Print.DrawRect2(StrRect, 1);
  12903. }
  12904. for (i = 9; i < 24; i++)
  12905. {
  12906. StrRect = load.m_rcarray.ElementAt(i);
  12907. StrRect.left += 2;
  12908. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12909. }
  12910. m_Print.SetFontFace(6, 1, "宋体");
  12911. for (i = 24; i < 26; i++)
  12912. {
  12913. StrRect = load.m_rcarray.ElementAt(i);
  12914. StrRect.left += 2;
  12915. if (i == 24)
  12916. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12917. else
  12918. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12919. }
  12920. }
  12921. else//大单
  12922. {
  12923. m_Print.SetFontFace(20, 1, "黑体");
  12924. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12925. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12926. m_Print.SetFontFace(11, 1, "宋体");
  12927. // StrRect=load.m_rcarray .ElementAt (++rcpos);
  12928. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12929. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15;
  12930. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12931. int hei = StrRect.Height();
  12932. StrRect.bottom = StrRect.top;
  12933. StrRect.top -= 10;
  12934. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  12935. m_Print.SetFontFace(8, 1, "宋体");
  12936. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12937. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12938. m_Print.SetFontFace(11, 1, "宋体");
  12939. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12940. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12941. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12942. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12943. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12944. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12945. m_Print.SetFontFace(13, 1, "宋体");
  12946. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12947. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12948. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12949. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12950. m_Print.SetFontFace(11, 1, "宋体");
  12951. for ( i = 7; i < 24; i++)
  12952. {
  12953. StrRect = load.m_rcarray.ElementAt(i);
  12954. m_Print.DrawRect2(StrRect, 1);
  12955. }
  12956. for (i = 9; i < 24; i++)
  12957. {
  12958. StrRect = load.m_rcarray.ElementAt(i);
  12959. StrRect.left += 2;
  12960. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12961. }
  12962. m_Print.SetFontFace(8, 1, "宋体");
  12963. for (i = 24; i < 27; i++)
  12964. {
  12965. StrRect = load.m_rcarray.ElementAt(i);
  12966. StrRect.left += 2;
  12967. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12968. }
  12969. }
  12970. PrintPreview dlg;
  12971. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12972. dlg.m_pDC = m_Print.GetPDC();
  12973. if (aa == 0)
  12974. {
  12975. if (dlg.DoModal() != IDOK)
  12976. return;
  12977. printcot = dlg.m_num;
  12978. }
  12979. //结束打印
  12980. m_Print.EndPage();
  12981. m_Print.EndPrint();
  12982. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  12983. CString sql;
  12984. sql.Format("update version set [serialno2]='%s'", SerialNo);
  12985. g_sendhead.bsql = 1;
  12986. g_nYearposTemp = g_nYearpos;
  12987. g_nYearpos = -1;
  12988. g_pMainWnd->ProcessChatMessageRequest2(sql);
  12989. g_nYearpos = g_nYearposTemp;
  12990. }
  12991. }
  12992. //出生年月
  12993. //第一联
  12994. void CMainFrame::OnLog()
  12995. {
  12996. // TODO: Add your command handler code here OnShowBakState
  12997. if (IsHasRightsnew(49) == 0)return;
  12998. ShowLOg dlg;
  12999. dlg.DoModal();
  13000. }
  13001. // www.lyfz.net 8888
  13002. void CMainFrame::PrintDinDan6(CString m_id)
  13003. {
  13004. // TODO: Add your control notification handler code here 预约订单
  13005. int printcot = 1;
  13006. for (int aa = 0; aa < printcot; aa++)
  13007. {
  13008. PrintPreview dlg;
  13009. CPrintRX m_Print;
  13010. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13011. {
  13012. m_Print.InitToPrint(NULL, 1);
  13013. }
  13014. else
  13015. {
  13016. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  13017. if (name.IsEmpty())
  13018. m_Print.InitToPrint(NULL, 1);
  13019. else
  13020. {
  13021. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13022. if (nret == -1 && aa == 0)
  13023. {
  13024. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  13025. }
  13026. }
  13027. }
  13028. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  13029. {
  13030. m_Print.StartPrint();
  13031. m_Print.StartPage();
  13032. LoadRect load;
  13033. load.SetLiaPath("6.lia");
  13034. load.SetMargins(-14, 15);
  13035. if (!load.Load())return;
  13036. LoadRect load2;
  13037. load2.SetLiaPath("7.lia");
  13038. load2.SetMargins(-14, 216 + 15);
  13039. if (!load2.Load())return;
  13040. LoadRect load3;
  13041. load3.SetLiaPath("8.lia");
  13042. load3.SetMargins(-14, 705 + 15);
  13043. if (!load3.Load())return;
  13044. int i;
  13045. //////////////////////////////////////////////////////////////
  13046. CStringArray txarray;
  13047. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  13048. g_sendhead.code[0] = 11;
  13049. g_sendhead.code[1] = 52;
  13050. g_sendhead.code[2] = 50;
  13051. g_sendhead.code[3] = 150;
  13052. g_sendhead.code[4] = 77;
  13053. g_sendhead.code[5] = 4;
  13054. g_sendhead.tabcount = 6;
  13055. g_sendhead.bsql = 0;
  13056. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  13057. CArray<CStringArray, CStringArray>sparray;
  13058. CArray<CStringArray, CStringArray>clientarray;
  13059. CArray<CStringArray, CStringArray>phonearray;
  13060. CArray<CStringArray, CStringArray>fgarray;
  13061. CArray<CStringArray, CStringArray>danweiarray;
  13062. CArray<CStringArray, CStringArray>jdarray;
  13063. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  13064. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  13065. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  13066. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  13067. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  13068. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  13069. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  13070. CString m_taoxiname;
  13071. if (m_zs.Find("\\") != -1)
  13072. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  13073. else
  13074. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  13075. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  13076. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  13077. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  13078. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  13079. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  13080. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  13081. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  13082. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  13083. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  13084. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  13085. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  13086. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  13087. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  13088. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  13089. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  13090. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  13091. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  13092. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  13093. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  13094. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  13095. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  13096. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  13097. if (jdarray.GetSize())
  13098. {
  13099. if (m_bz.IsEmpty() == 0)
  13100. m_bz = "\r\n" + m_bz;
  13101. m_bz += "景点:";
  13102. }
  13103. for (i = 0; i < jdarray.GetSize(); i++)
  13104. {
  13105. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  13106. }
  13107. m_bz.TrimRight(";");
  13108. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  13109. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13110. if (IsHasRights2new(31) == 0)
  13111. {
  13112. m_phone1 = "***";
  13113. m_phone2 = "***";
  13114. }
  13115. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  13116. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13117. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  13118. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  13119. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  13120. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  13121. filter = "name='" + m_ren + "'";
  13122. g_sendhead.code[0] = 5;
  13123. g_sendhead.tabcount = 1;
  13124. g_sendhead.bsql = 0;
  13125. int g_nYearposTemp = g_nYearpos;
  13126. g_nYearpos = -1;
  13127. g_pMainWnd->ProcessChatMessageRequest2(filter);
  13128. g_nYearpos = g_nYearposTemp;
  13129. if (g_bSendOK == 0)return;
  13130. DataToArray(&phonearray);
  13131. m_money1.Format("%f", atof(m_taoxijiage));
  13132. m_money2.Format("%f", atof(m_payed1));
  13133. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  13134. ConvertToPrice(m_money1);
  13135. ConvertToPrice(m_money2);
  13136. ConvertToPrice(m_money3);
  13137. ////////////////////////////////////////////////////////////////
  13138. int rcpos = -1;
  13139. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13140. StrRect.top -= 15; StrRect.bottom -= 15;
  13141. Image *pImg = NULL;
  13142. #ifdef MNLS_VERSION
  13143. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  13144. #else
  13145. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  13146. #endif
  13147. m_Print.DrawImage(pImg, StrRect);
  13148. delete pImg;
  13149. m_Print.SetFontFace(11, 1, "宋体");
  13150. StrRect = load.m_rcarray.ElementAt(20);
  13151. StrRect.right = load.m_rcarray.ElementAt(23).right;
  13152. StrRect.top -= 18; StrRect.bottom -= 18;
  13153. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  13154. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13155. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  13156. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13157. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13158. StrRect.top -= 15; StrRect.bottom -= 15;
  13159. #ifdef MNLS_VERSION
  13160. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13161. #endif
  13162. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13163. StrRect.top -= 15; StrRect.bottom -= 15;
  13164. #ifdef MNLS_VERSION
  13165. m_Print.DrawRect(StrRect);
  13166. #endif
  13167. m_Print.SetFontFace(7, 1, "黑体");
  13168. m_Print.SetColor(0xffffff);
  13169. #ifdef MNLS_VERSION
  13170. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13171. #endif
  13172. m_Print.SetColor(0);
  13173. m_Print.SetFontFace(15, 1, "宋体");
  13174. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13175. StrRect.top -= 15; StrRect.bottom -= 15;
  13176. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同拍摄单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13177. CStringArray strarray;
  13178. strarray.Add("NO: " + m_id);
  13179. CString date;
  13180. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  13181. strarray.Add(date);
  13182. strarray.Add("喜爱");
  13183. strarray.Add("格调");
  13184. if (fgarray.GetSize() == 12)
  13185. {
  13186. for (int i = 0; i < 12; i++)
  13187. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  13188. }
  13189. else
  13190. {
  13191. strarray.Add("复古典雅");
  13192. strarray.Add("温文尔雅");
  13193. strarray.Add("豪华艳丽");
  13194. strarray.Add("传统大方");
  13195. strarray.Add("新潮个性");
  13196. strarray.Add("浪漫奔放");
  13197. strarray.Add("简单素雅");
  13198. strarray.Add("活泼俏丽");
  13199. strarray.Add("妩媚温馨");
  13200. strarray.Add("温柔贤惠");
  13201. strarray.Add("成熟感性");
  13202. strarray.Add("清纯可爱");
  13203. }
  13204. strarray.Add("姓名");
  13205. // strarray.Add("职业");
  13206. strarray.Add("");
  13207. strarray.Add("地址");
  13208. strarray.Add("电话");
  13209. #ifdef CHILD_VERSION
  13210. strarray.Add("家长");
  13211. strarray.Add("宝宝");
  13212. #else
  13213. strarray.Add("先生");
  13214. strarray.Add("女士");
  13215. #endif
  13216. m_Print.SetFontFace(11, 1, "宋体");
  13217. for (i = 0; i < strarray.GetSize(); i++)
  13218. {
  13219. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13220. if (i < 2)
  13221. {
  13222. StrRect.top -= 15; StrRect.bottom -= 15;
  13223. }
  13224. if (i>15)
  13225. m_Print.DrawRect2(StrRect, 1);
  13226. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13227. }
  13228. for (i = 29; i <= 40; i++)
  13229. {
  13230. if (m_style.GetLength() <= (i - 29))continue;
  13231. if (m_style.GetAt(i - 29) != '1')continue;
  13232. StrRect = load.m_rcarray.ElementAt(i - 1);
  13233. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13234. }
  13235. for (i = 27; i <= 48; i++)
  13236. {
  13237. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13238. m_Print.DrawRect2(StrRect, 1);
  13239. }
  13240. #ifdef CHILD_VERSION
  13241. StrRect = load.m_rcarray.ElementAt(45);
  13242. StrRect.right = StrRect.left + 62;
  13243. m_Print.DrawRect2(StrRect, 1);
  13244. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13245. StrRect.left = StrRect.right;
  13246. StrRect.right = StrRect.left + 62;
  13247. m_Print.DrawRect2(StrRect, 1);
  13248. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13249. StrRect.left = StrRect.right;
  13250. StrRect.right = StrRect.left + 62;
  13251. m_Print.DrawRect2(StrRect, 1);
  13252. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13253. StrRect.left = StrRect.right;
  13254. StrRect.right = StrRect.left + 62;
  13255. m_Print.DrawRect2(StrRect, 1);
  13256. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13257. #endif
  13258. /////////////////////////
  13259. strarray.RemoveAll();
  13260. CString temp;
  13261. temp.Format("拍摄 选 %d 款,其中", atoi(m_outside) + atoi(m_outside2));
  13262. strarray.Add(temp);
  13263. temp.Format("内景 %d 款,外景 %d 款.", atoi(m_outside2), atoi(m_outside));
  13264. strarray.Add(temp);
  13265. strarray.Add("化妆");
  13266. strarray.Add("造型");
  13267. #ifdef CHILD_VERSION
  13268. strarray.Add("");
  13269. #else
  13270. strarray.Add("婚纱");
  13271. #endif
  13272. strarray.Add("服饰");
  13273. strarray.Add("配");
  13274. strarray.Add("置");
  13275. strarray.Add("其");
  13276. strarray.Add("它");
  13277. strarray.Add("套系名称");
  13278. strarray.Add("镜款");
  13279. strarray.Add("套系总价");
  13280. strarray.Add("主摄影师");
  13281. strarray.Add("拍摄日期");
  13282. strarray.Add("定金");
  13283. #ifdef CHILD_VERSION
  13284. strarray.Add("主引导师");
  13285. #else
  13286. strarray.Add("主化妆师");
  13287. #endif
  13288. strarray.Add("看样日期");
  13289. strarray.Add("补 余 款");
  13290. strarray.Add("总监");
  13291. strarray.Add("取件日期");
  13292. rcpos = -1;
  13293. for (i = 0; i < strarray.GetSize(); i++)
  13294. {
  13295. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13296. if (i>9)
  13297. m_Print.DrawRect2(StrRect, 1);
  13298. #ifdef CHILD_VERSION
  13299. if (i == 5)
  13300. StrRect.top -= StrRect.Height();
  13301. #endif
  13302. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13303. }
  13304. for (i = 22; i <= 41; i++)
  13305. {
  13306. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13307. m_Print.DrawRect2(StrRect, 1);
  13308. }
  13309. /////////////////////////////
  13310. strarray.RemoveAll();
  13311. #ifdef CHILD_VERSION
  13312. strarray.Add("顾客方 家长:");
  13313. strarray.Add("宝宝:");
  13314. #else
  13315. strarray.Add("顾客方 先生:");
  13316. strarray.Add("女士:");
  13317. #endif
  13318. strarray.Add("电话:");
  13319. strarray.Add("影楼方 店长:");
  13320. strarray.Add("接单人:");
  13321. strarray.Add("电话:");
  13322. rcpos = -1;
  13323. for (i = 0; i < strarray.GetSize(); i++)
  13324. {
  13325. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13326. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13327. }
  13328. for (i = 7; i <= 12; i++)
  13329. {
  13330. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13331. // if(i!=10)
  13332. m_Print.DrawRect2(StrRect, 2);
  13333. }
  13334. //////////////////////////////////////
  13335. //开始打数据
  13336. strarray.RemoveAll();
  13337. strarray.Add(m_name1);
  13338. strarray.Add(m_name2);
  13339. strarray.Add("");
  13340. strarray.Add("");
  13341. strarray.Add(m_addr1);
  13342. #ifdef CHILD_VERSION
  13343. strarray.Add("");
  13344. #else
  13345. strarray.Add(m_addr2);
  13346. #endif
  13347. strarray.Add(m_phone1);
  13348. strarray.Add(m_phone2);
  13349. for (i = 41; i <= 48; i++)
  13350. {
  13351. StrRect = load.m_rcarray.ElementAt(i - 1);
  13352. StrRect.left += 4;
  13353. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13354. }
  13355. ///////////////////////////////
  13356. strarray.RemoveAll();
  13357. strarray.Add(m_money1);
  13358. strarray.Add(m_waiter1);
  13359. strarray.Add(m_time2);
  13360. strarray.Add(m_money2);
  13361. strarray.Add(m_waiter2);
  13362. strarray.Add(m_time4);
  13363. strarray.Add(m_money3);
  13364. strarray.Add("");
  13365. strarray.Add(m_time5);
  13366. for (i = 32; i <= 40; i++)
  13367. {
  13368. StrRect = load2.m_rcarray.ElementAt(i - 1);
  13369. StrRect.left += 4;
  13370. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13371. }
  13372. ///////////////////////////////
  13373. strarray.RemoveAll();
  13374. strarray.Add("");//m_name1);
  13375. strarray.Add("");//m_name2);
  13376. CString phone;
  13377. if (m_phone1.IsEmpty() == 0)
  13378. phone = m_phone1 + ",";
  13379. phone += m_phone2;
  13380. phone.TrimRight(",");
  13381. strarray.Add("");//phone);
  13382. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  13383. strarray.Add(m_ren);
  13384. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13385. for (i = 7; i <= 12; i++)
  13386. {
  13387. StrRect = load3.m_rcarray.ElementAt(i - 1);
  13388. StrRect.left += 4;
  13389. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13390. }
  13391. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  13392. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13393. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  13394. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13395. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  13396. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13397. //////////////////////////////
  13398. //开始画文字
  13399. StrRect = load2.m_rcarray.ElementAt(30);
  13400. StrRect.left += 3;
  13401. StrRect.top += 3;
  13402. StrRect.right -= 2;
  13403. StrRect.bottom -= 2;
  13404. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  13405. StrRect = load2.m_rcarray.ElementAt(29);
  13406. StrRect.left += 3;
  13407. StrRect.top += 3;
  13408. StrRect.right -= 2;
  13409. StrRect.bottom -= 2;
  13410. str = "";
  13411. for (i = 0; i < sparray.GetSize(); i++)
  13412. {
  13413. str += sparray.ElementAt(i).ElementAt(5);
  13414. str += " 数量:";
  13415. str += sparray.ElementAt(i).ElementAt(3);
  13416. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  13417. str += "\r\n";
  13418. }
  13419. str.TrimRight("\r\n");
  13420. AutoDraw(m_Print, StrRect, str, 1.4);
  13421. StrRect = load2.m_rcarray.ElementAt(40);
  13422. StrRect.top += 8;
  13423. m_Print.SetFontFace(12, 1, "黑体");
  13424. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  13425. StrRect.left += 3;
  13426. StrRect.top += 30;
  13427. StrRect.right -= 2;
  13428. StrRect.bottom -= 2;
  13429. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  13430. if (str.IsEmpty())
  13431. {
  13432. str = "\
  13433. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  13434. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  13435. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  13436. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  13437. 持良好的心境.\r\n\
  13438. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  13439. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  13440. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  13441. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  13442. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  13443. 勿进影室, 以免影响拍摄.\r\n\
  13444. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  13445. 师或店长沟通.\r\n\
  13446. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  13447. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  13448. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  13449. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  13450. 9. 本合同余额欠款须在拍照前付清.\r\n\
  13451. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  13452. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  13453. 还.";
  13454. }
  13455. AutoDraw(m_Print, StrRect, str, 1.8);
  13456. }
  13457. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13458. dlg.m_pDC = m_Print.GetPDC();
  13459. dlg.m_mode = 1;
  13460. if (aa == 0)
  13461. {
  13462. if (dlg.DoModal() != IDOK)
  13463. return;
  13464. printcot = dlg.m_num;
  13465. }
  13466. //结束打印
  13467. m_Print.EndPage();
  13468. m_Print.EndPrint();
  13469. }
  13470. }
  13471. void CMainFrame::InsideMsg()
  13472. {
  13473. ///内部消息
  13474. CString str;
  13475. g_sendhead.bsql = 0;
  13476. g_sendhead.code[0] = 126;
  13477. g_sendhead.tabcount = 1;
  13478. g_bNoConnDlg = 1;
  13479. g_pMainWnd->ProcessChatMessageRequest2(1); g_bNoConnDlg = 0;
  13480. if (g_bSendOK == 0)return;
  13481. CArray<CStringArray, CStringArray>m_List1array;
  13482. DataToArray(&g_List1array);//, &m_List1array);
  13483. int i = 0;
  13484. m_List1array.SetSize(g_List1array.GetSize());
  13485. for ( i = 0; i < g_List1array.GetSize(); i++)
  13486. {
  13487. m_List1array.ElementAt(i).Copy(g_List1array.ElementAt(i));
  13488. }
  13489. str = "," + g_user.name + ",";
  13490. for (i = g_List1array.GetSize() - 1; i >= 0; i--)
  13491. {
  13492. CString receivers2 = g_List1array.ElementAt(i).ElementAt(4);
  13493. receivers2.TrimLeft(",");
  13494. receivers2.TrimRight(",");
  13495. receivers2 = "," + receivers2 + ",";
  13496. CString receivers = g_List1array.ElementAt(i).ElementAt(3);
  13497. receivers.TrimLeft(",");
  13498. receivers.TrimRight(",");
  13499. receivers = "," + receivers + ",";
  13500. if (receivers.Find(str) == -1)
  13501. g_List1array.RemoveAt(i);
  13502. else if (receivers2.Find(str) != -1)
  13503. g_List1array.RemoveAt(i);
  13504. }
  13505. if (g_List1array.GetSize())
  13506. {
  13507. ShowMsg dlg;
  13508. dlg.DoModal();
  13509. }
  13510. for (i = m_List1array.GetSize() - 1; i >= 0; i--)
  13511. {
  13512. CString receivers2 = m_List1array.ElementAt(i).ElementAt(4);
  13513. receivers2.TrimLeft(",");
  13514. receivers2.TrimRight(",");
  13515. receivers2 = "," + receivers2 + ",";
  13516. CString receivers = m_List1array.ElementAt(i).ElementAt(3);
  13517. if (receivers != "")
  13518. m_List1array.RemoveAt(i);
  13519. else if (receivers2.Find(str) != -1)
  13520. m_List1array.RemoveAt(i);
  13521. }
  13522. if (m_List1array.GetSize())
  13523. {
  13524. SendInsideMsg2 dlg;
  13525. dlg.m_bShow = 1;
  13526. dlg.m_pArray = &m_List1array;
  13527. dlg.DoModal();
  13528. }
  13529. }
  13530. //定金
  13531. /************************************************************************/
  13532. /*
  13533. 函数:PrintHireDress
  13534. 描述:打印礼服出租单;
  13535. 参数:
  13536. strOrderNumber 礼服订单号;
  13537. 注意:
  13538. */
  13539. /************************************************************************/
  13540. void CMainFrame::PrintHireDress(CString strOrderNumber) // 打印礼服出租单;
  13541. {
  13542. int printcot = 1;
  13543. for (int aa = 0; aa < printcot; aa++)
  13544. {
  13545. CPrintRX m_Print;
  13546. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13547. {
  13548. m_Print.InitToPrint(NULL, 1);
  13549. }
  13550. else
  13551. {
  13552. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13553. if (name.IsEmpty())
  13554. m_Print.InitToPrint(NULL, 1);
  13555. else
  13556. {
  13557. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13558. if (nret == -1 && aa == 0)
  13559. {
  13560. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  13561. }
  13562. }
  13563. }
  13564. m_Print.StartPrint();
  13565. m_Print.StartPage();
  13566. LoadRect load;
  13567. load.SetLiaPath("21.lia");
  13568. load.SetMargins(0, 0);
  13569. if (!load.Load())
  13570. {
  13571. return;
  13572. }
  13573. int i;
  13574. //////////////////////////////////////////////////////////////
  13575. //CString filter="id='"+strOrderNumber+"';id='"+strOrderNumber+"';id='"+strOrderNumber+"'";
  13576. CString strFilter;
  13577. strFilter.Format("id='%s';id='%s';id='%s'", strOrderNumber, strOrderNumber, strOrderNumber);
  13578. g_sendhead.bsql = 0;
  13579. g_sendhead.code[0] = 73;
  13580. g_sendhead.code[1] = 74;
  13581. g_sendhead.code[2] = 52;
  13582. g_sendhead.tabcount = 3;
  13583. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  13584. if (g_bSendOK == 0)
  13585. {
  13586. return;
  13587. }
  13588. CArray<CStringArray, CStringArray>dresshirearray;
  13589. CArray<CStringArray, CStringArray>dresshiredataarray;
  13590. CArray<CStringArray, CStringArray>clientarray;
  13591. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13592. if (dresshirearray.GetSize() == 0)
  13593. {
  13594. return;
  13595. }
  13596. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10);
  13597. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7);
  13598. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8);
  13599. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6);
  13600. if (clientarray.GetSize() == 0)
  13601. {
  13602. return;
  13603. }
  13604. //AfxMessageBox("打印礼服出租单-()");
  13605. CString m_name2 = clientarray.ElementAt(0).ElementAt(2);
  13606. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13607. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13608. CString m_time3 = clientarray.ElementAt(0).ElementAt(20);
  13609. //#if JEFF_TEST
  13610. // if ( dresshiredataarray.GetSize() == 0 )
  13611. // {
  13612. // AfxMessageBox("没衣服");
  13613. // }
  13614. //#endif
  13615. CString sItem;
  13616. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13617. {
  13618. sItem += "编号:";
  13619. sItem += dresshiredataarray.ElementAt(i).ElementAt(1);
  13620. sItem += " ";
  13621. sItem += " 名称:";
  13622. sItem += dresshiredataarray.ElementAt(i).ElementAt(2);
  13623. sItem += " 数量:";
  13624. sItem += dresshiredataarray.ElementAt(i).ElementAt(3) + "\r\n";
  13625. }
  13626. sItem += "金额:";
  13627. sItem += dresshirearray.ElementAt(0).ElementAt(1);
  13628. sItem += " ";
  13629. sItem += " 押金:";
  13630. sItem += dresshirearray.ElementAt(0).ElementAt(2) + "\r\n";
  13631. ////////////////////////////////////////////////////////////////
  13632. int rcpos = -1;
  13633. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13634. m_Print.SetFontFace(17, 1, "宋体");
  13635. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13636. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13637. m_Print.SetFontFace(10, 1, "宋体");
  13638. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13639. CStringArray strarray;
  13640. strarray.Add("客户姓名");
  13641. strarray.Add("客户电话");
  13642. strarray.Add("预定日期");
  13643. strarray.Add("结婚日期");
  13644. strarray.Add("取件日期");
  13645. strarray.Add("归还日期");
  13646. strarray.Add("本店地址");
  13647. strarray.Add("电 话");
  13648. strarray.Add("客户地址");
  13649. strarray.Add("客户签名");
  13650. for (i = 2; i < 12; i++)
  13651. {
  13652. StrRect = load.m_rcarray.ElementAt(i);
  13653. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13654. }
  13655. strarray.RemoveAll();
  13656. strarray.Add(m_name2);
  13657. strarray.Add(m_phone2);
  13658. strarray.Add(m_inputdate);
  13659. strarray.Add(m_time3);
  13660. strarray.Add(m_date1);
  13661. strarray.Add(m_date2);
  13662. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13663. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13664. strarray.Add(m_addr2);
  13665. strarray.Add("");
  13666. for (i = 12; i < 22; i++)
  13667. {
  13668. StrRect = load.m_rcarray.ElementAt(i);
  13669. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13670. m_Print.DrawRect2(StrRect, 2);
  13671. }
  13672. for (i = 25; i < 30; i++)
  13673. {
  13674. StrRect = load.m_rcarray.ElementAt(i);
  13675. m_Print.DrawRect2(StrRect, 1);
  13676. }
  13677. StrRect = load.m_rcarray.ElementAt(22);
  13678. StrRect.top += 7;
  13679. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13680. StrRect = load.m_rcarray.ElementAt(23);
  13681. StrRect.top += 7;
  13682. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13683. StrRect = load.m_rcarray.ElementAt(24);
  13684. StrRect.top += 7;
  13685. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13686. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13687. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13688. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13689. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13690. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13691. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13692. if (str.IsEmpty())
  13693. {
  13694. str = "\
  13695. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13696. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13697. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13698. 4. 如有破损酌情赔偿.";
  13699. }
  13700. AutoDraw(m_Print, StrRect, str, 1.5);
  13701. PrintPreview dlg;
  13702. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13703. dlg.m_pDC = m_Print.GetPDC();
  13704. if (aa == 0)
  13705. {
  13706. if (dlg.DoModal() != IDOK)
  13707. return;
  13708. printcot = dlg.m_num;
  13709. }
  13710. //结束打印
  13711. m_Print.EndPage();
  13712. m_Print.EndPrint();
  13713. }
  13714. }
  13715. void CMainFrame::PrintHireDress_01(CString strOrderNumber) // 打印礼服出租单,无法改变结构,需要修改21.lia才能改变打印的布局;
  13716. {
  13717. int printcot = 1;
  13718. for (int aa = 0; aa < printcot; aa++)
  13719. {
  13720. CPrintRX m_Print;
  13721. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13722. {
  13723. m_Print.InitToPrint(NULL, 1);
  13724. }
  13725. else
  13726. {
  13727. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13728. if (name.IsEmpty())
  13729. m_Print.InitToPrint(NULL, 1);
  13730. else
  13731. {
  13732. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13733. if (nret == -1 && aa == 0)
  13734. {
  13735. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  13736. m_Print.InitToPrint(NULL, 1);
  13737. }
  13738. }
  13739. }
  13740. m_Print.StartPrint();
  13741. m_Print.StartPage();
  13742. LoadRect load;
  13743. load.SetLiaPath("21.lia");
  13744. load.SetMargins(0, 0);
  13745. if (!load.Load())return;
  13746. int i;
  13747. //////////////////////////////////////////////////////////////
  13748. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  13749. g_sendhead.bsql = 0;
  13750. g_sendhead.code[0] = 73; // dresshire表;
  13751. g_sendhead.code[1] = 74; // dresshiredata表;
  13752. g_sendhead.code[2] = 52; // client表;
  13753. g_sendhead.tabcount = 3;
  13754. g_pMainWnd->ProcessChatMessageRequest2(filter);
  13755. if (g_bSendOK == 0)
  13756. {
  13757. return;
  13758. }
  13759. CArray<CStringArray, CStringArray>dresshirearray;
  13760. CArray<CStringArray, CStringArray>dresshiredataarray;
  13761. CArray<CStringArray, CStringArray>clientarray;
  13762. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13763. if (dresshirearray.GetSize() == 0)return;
  13764. // dresshire;
  13765. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10); // 备注;
  13766. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7); // 取衣日期;
  13767. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8); // 还衣日期;
  13768. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6); // 记录日期;
  13769. CString strPrice = dresshirearray.ElementAt(0).ElementAt(1); // 金额;
  13770. CString strDeposit = dresshirearray.ElementAt(0).ElementAt(2); // 押金;
  13771. // client表;
  13772. if (clientarray.GetSize() == 0)return;
  13773. CString m_name2 = clientarray.ElementAt(0).ElementAt(2); // 女宾姓名;
  13774. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4); // 女宾手机;
  13775. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8); // 女宾地址;
  13776. CString m_time3 = clientarray.ElementAt(0).ElementAt(20); // 婚期;
  13777. // dresshiredata表;
  13778. CString sItem;
  13779. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13780. {
  13781. sItem += dresshiredataarray.ElementAt(i).ElementAt(1); // 礼服编号;
  13782. sItem += " ";
  13783. sItem += dresshiredataarray.ElementAt(i).ElementAt(2); // 礼服名称;
  13784. sItem += " 数量:";
  13785. sItem += dresshiredataarray.ElementAt(i).ElementAt(3) + "\r\n"; // 礼服数量;
  13786. }
  13787. sItem += " 金额:";
  13788. sItem += dresshirearray.ElementAt(0).ElementAt(1); // 出租金额;
  13789. sItem += " 押金:";
  13790. sItem += dresshirearray.ElementAt(0).ElementAt(2) + "\r\n"; // 押金;
  13791. ////////////////////////////////////////////////////////////////
  13792. int rcpos = -1;
  13793. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13794. m_Print.SetFontFace(17, 1, "宋体");
  13795. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13796. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13797. m_Print.SetFontFace(10, 1, "宋体");
  13798. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13799. CStringArray strarray;
  13800. strarray.Add("客户姓名"); // 1.
  13801. strarray.Add("客户电话");
  13802. strarray.Add("预定日期");
  13803. strarray.Add("结婚日期");
  13804. strarray.Add("取件日期"); // 5.
  13805. strarray.Add("归还日期");
  13806. strarray.Add("本店地址");
  13807. strarray.Add("电 话");
  13808. strarray.Add("客户地址");
  13809. strarray.Add("客户签名"); // 10.
  13810. //strarray.Add("金额");
  13811. //strarray.Add("押金");
  13812. for( i=2; i<12; i++)
  13813. //for (i = 2; i < 14; i++)
  13814. {
  13815. StrRect = load.m_rcarray.ElementAt(i);
  13816. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13817. }
  13818. strarray.RemoveAll();
  13819. strarray.Add(m_name2);
  13820. strarray.Add(m_phone2);
  13821. strarray.Add(m_inputdate);
  13822. strarray.Add(m_time3);
  13823. strarray.Add(m_date1);
  13824. strarray.Add(m_date2);
  13825. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13826. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13827. strarray.Add(m_addr2);
  13828. strarray.Add("");
  13829. strarray.Add(strPrice); // 金额;
  13830. strarray.Add(strDeposit); // 押金;
  13831. for( i=12; i<22; i++)
  13832. //for (i = 14; i < 24; i++)
  13833. {
  13834. StrRect = load.m_rcarray.ElementAt(i);
  13835. //m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i-12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13836. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 14), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13837. m_Print.DrawRect2(StrRect, 2);
  13838. }
  13839. for (i = 25; i < 30; i++)
  13840. {
  13841. StrRect = load.m_rcarray.ElementAt(i);
  13842. m_Print.DrawRect2(StrRect, 1);
  13843. }
  13844. StrRect = load.m_rcarray.ElementAt(22);
  13845. StrRect.top += 7;
  13846. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13847. StrRect = load.m_rcarray.ElementAt(23);
  13848. StrRect.top += 7;
  13849. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13850. StrRect = load.m_rcarray.ElementAt(24);
  13851. StrRect.top += 7;
  13852. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13853. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13854. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13855. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13856. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13857. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13858. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13859. if (str.IsEmpty())
  13860. {
  13861. str = "\
  13862. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13863. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13864. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13865. 4. 如有破损酌情赔偿.";
  13866. }
  13867. AutoDraw(m_Print, StrRect, str, 1.5);
  13868. PrintPreview dlg;
  13869. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13870. dlg.m_pDC = m_Print.GetPDC();
  13871. if (aa == 0)
  13872. {
  13873. if (dlg.DoModal() != IDOK)
  13874. return;
  13875. printcot = dlg.m_num;
  13876. }
  13877. //结束打印
  13878. m_Print.EndPage();
  13879. m_Print.EndPrint();
  13880. }
  13881. }
  13882. // ****************************************************************************
  13883. // Jeff:
  13884. // 函数:PrintHireDress2
  13885. // 无参;
  13886. // 调用者:DinDanFrom.cpp
  13887. // void DinDanFrom::GetData(),订单报表调用时,判断订单数是否大于1000
  13888. // 当订单数大于1000,设置连接公司服务器开关量为真;
  13889. // -----------------------------------------------------------------------------
  13890. // 修改:Jeff
  13891. // 时间:2014.10.18
  13892. // 内容:将 g_ncot 比较值改为100;
  13893. // ****************************************************************************
  13894. void CMainFrame::PrintHireDress2()
  13895. {
  13896. if (g_ncot > 100) g_bSendLYFZ = 1;
  13897. // g_pMainWnd->SetTimer (7, 3000, NULL);
  13898. }
  13899. void CMainFrame::PrintTakeForm2(CArray<CStringArray, CStringArray>*Listarray)
  13900. {
  13901. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "选片客人明细表";
  13902. int pages = Listarray->GetSize() / 46;
  13903. if (Listarray->GetSize() % 46)pages++;
  13904. for (int aa = 0; aa < pages; aa++)
  13905. {
  13906. PrintPreview dlg;
  13907. CPrintRX m_Print;
  13908. m_Print.InitToPrint(NULL, 1);
  13909. m_Print.StartPrint();
  13910. m_Print.StartPage();
  13911. CRect mainrc(0, 0, 560, 793);
  13912. float fscale;
  13913. {
  13914. int w, h;
  13915. m_Print.GetWidHei(w, h);
  13916. fscale = (float)w / (float)h;
  13917. }
  13918. mainrc.DeflateRect(25, 40, 10, 0);
  13919. CRect rc, rc2;
  13920. rc = mainrc;
  13921. rc.bottom = rc.top;
  13922. rc.top -= 20;
  13923. m_Print.SetFontFace(16, 1, "黑体");
  13924. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13925. m_Print.SetFontFace(9, 1, "宋体");
  13926. CString str;
  13927. int wid[5] = { 200, 110, 70, 85, 62 };
  13928. int hei = 16;
  13929. if (fscale > 0.71)hei = 15;
  13930. rc = mainrc;
  13931. rc.bottom = rc.top + hei;
  13932. for (int i = 0; i < 47; i++)
  13933. {
  13934. rc2.top = rc.top + i*hei;
  13935. rc2.bottom = rc.bottom + i*hei;
  13936. rc2.left = rc.left;
  13937. rc2.right = rc.left + wid[0];
  13938. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  13939. for (int j = 0; j<5; j++)
  13940. {
  13941. m_Print.DrawRect2(rc2, 1);
  13942. if (Listarray->GetSize()>aa * 46 + i)
  13943. {
  13944. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  13945. rc2.left += 3;
  13946. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13947. rc2.left -= 3;
  13948. }
  13949. rc2.left += wid[j];
  13950. rc2.right = rc2.left + wid[j + 1];
  13951. }
  13952. }
  13953. rc2.top += 2;
  13954. rc2.left += 2; rc2.right = mainrc.right + 4;
  13955. m_Print.SetFontFace(8, 1, "宋体");
  13956. str.Format(" 页:%d/%d", aa + 1, pages);
  13957. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  13958. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13959. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13960. dlg.m_pDC = m_Print.GetPDC();
  13961. // dlg.m_mode=1;
  13962. if (aa == 0)
  13963. {
  13964. if (dlg.DoModal() != IDOK)
  13965. return;
  13966. }
  13967. //结束打印
  13968. m_Print.EndPage();
  13969. m_Print.EndPrint();
  13970. }
  13971. }
  13972. void CMainFrame::PrintTakeForm3(CArray<CStringArray, CStringArray>*Listarray)
  13973. {
  13974. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "看设计客人明细表";
  13975. int pages = Listarray->GetSize() / 46;
  13976. if (Listarray->GetSize() % 46)pages++;
  13977. for (int aa = 0; aa < pages; aa++)
  13978. {
  13979. PrintPreview dlg;
  13980. CPrintRX m_Print;
  13981. m_Print.InitToPrint(NULL, 1);
  13982. m_Print.StartPrint();
  13983. m_Print.StartPage();
  13984. CRect mainrc(0, 0, 560, 793);
  13985. float fscale;
  13986. {
  13987. int w, h;
  13988. m_Print.GetWidHei(w, h);
  13989. fscale = (float)w / (float)h;
  13990. }
  13991. mainrc.DeflateRect(25, 40, 10, 0);
  13992. CRect rc, rc2;
  13993. rc = mainrc;
  13994. rc.bottom = rc.top;
  13995. rc.top -= 20;
  13996. m_Print.SetFontFace(16, 1, "黑体");
  13997. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13998. m_Print.SetFontFace(9, 1, "宋体");
  13999. CString str;
  14000. int wid[5] = { 200, 110, 70, 85, 62 };
  14001. int hei = 16;
  14002. if (fscale > 0.71)hei = 15;
  14003. rc = mainrc;
  14004. rc.bottom = rc.top + hei;
  14005. for (int i = 0; i < 47; i++)
  14006. {
  14007. rc2.top = rc.top + i*hei;
  14008. rc2.bottom = rc.bottom + i*hei;
  14009. rc2.left = rc.left;
  14010. rc2.right = rc.left + wid[0];
  14011. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14012. for (int j = 0; j<5; j++)
  14013. {
  14014. m_Print.DrawRect2(rc2, 1);
  14015. if (Listarray->GetSize()>aa * 46 + i)
  14016. {
  14017. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14018. rc2.left += 3;
  14019. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14020. rc2.left -= 3;
  14021. }
  14022. rc2.left += wid[j];
  14023. rc2.right = rc2.left + wid[j + 1];
  14024. }
  14025. }
  14026. rc2.top += 2;
  14027. rc2.left += 2; rc2.right = mainrc.right + 4;
  14028. m_Print.SetFontFace(8, 1, "宋体");
  14029. str.Format(" 页:%d/%d", aa + 1, pages);
  14030. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14031. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14032. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14033. dlg.m_pDC = m_Print.GetPDC();
  14034. // dlg.m_mode=1;
  14035. if (aa == 0)
  14036. {
  14037. if (dlg.DoModal() != IDOK)
  14038. return;
  14039. }
  14040. //结束打印
  14041. m_Print.EndPage();
  14042. m_Print.EndPrint();
  14043. }
  14044. }
  14045. void CMainFrame::PrintTakeForm4(CArray<CStringArray, CStringArray>*Listarray)
  14046. {
  14047. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "取件客人明细表";
  14048. int pages = Listarray->GetSize() / 46;
  14049. if (Listarray->GetSize() % 46)pages++;
  14050. for (int aa = 0; aa < pages; aa++)
  14051. {
  14052. PrintPreview dlg;
  14053. CPrintRX m_Print;
  14054. m_Print.InitToPrint(NULL, 1);
  14055. m_Print.StartPrint();
  14056. m_Print.StartPage();
  14057. CRect mainrc(0, 0, 560, 793);
  14058. float fscale;
  14059. {
  14060. int w, h;
  14061. m_Print.GetWidHei(w, h);
  14062. fscale = (float)w / (float)h;
  14063. }
  14064. mainrc.DeflateRect(25, 40, 10, 0);
  14065. CRect rc, rc2;
  14066. rc = mainrc;
  14067. rc.bottom = rc.top;
  14068. rc.top -= 20;
  14069. m_Print.SetFontFace(16, 1, "黑体");
  14070. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14071. m_Print.SetFontFace(9, 1, "宋体");
  14072. CString str;
  14073. int wid[5] = { 200, 110, 70, 85, 62 };
  14074. int hei = 16;
  14075. if (fscale > 0.71)hei = 15;
  14076. rc = mainrc;
  14077. rc.bottom = rc.top + hei;
  14078. for (int i = 0; i < 47; i++)
  14079. {
  14080. rc2.top = rc.top + i*hei;
  14081. rc2.bottom = rc.bottom + i*hei;
  14082. rc2.left = rc.left;
  14083. rc2.right = rc.left + wid[0];
  14084. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14085. for (int j = 0; j<5; j++)
  14086. {
  14087. m_Print.DrawRect2(rc2, 1);
  14088. if (Listarray->GetSize()>aa * 46 + i)
  14089. {
  14090. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14091. rc2.left += 3;
  14092. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14093. rc2.left -= 3;
  14094. }
  14095. rc2.left += wid[j];
  14096. rc2.right = rc2.left + wid[j + 1];
  14097. }
  14098. }
  14099. rc2.top += 2;
  14100. rc2.left += 2; rc2.right = mainrc.right + 4;
  14101. m_Print.SetFontFace(8, 1, "宋体");
  14102. str.Format(" 页:%d/%d", aa + 1, pages);
  14103. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14104. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14105. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14106. dlg.m_pDC = m_Print.GetPDC();
  14107. // dlg.m_mode=1;
  14108. if (aa == 0)
  14109. {
  14110. if (dlg.DoModal() != IDOK)
  14111. return;
  14112. }
  14113. //结束打印
  14114. m_Print.EndPage();
  14115. m_Print.EndPrint();
  14116. }
  14117. }
  14118. void CMainFrame::PrintTakeForm5(CArray<CStringArray, CStringArray>*Listarray)
  14119. {
  14120. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "婚庆客人明细表";
  14121. int pages = Listarray->GetSize() / 46;
  14122. if (Listarray->GetSize() % 46)pages++;
  14123. for (int aa = 0; aa < pages; aa++)
  14124. {
  14125. PrintPreview dlg;
  14126. CPrintRX m_Print;
  14127. m_Print.InitToPrint(NULL, 1);
  14128. m_Print.StartPrint();
  14129. m_Print.StartPage();
  14130. CRect mainrc(0, 0, 560, 793);
  14131. float fscale;
  14132. {
  14133. int w, h;
  14134. m_Print.GetWidHei(w, h);
  14135. fscale = (float)w / (float)h;
  14136. }
  14137. mainrc.DeflateRect(25, 40, 10, 0);
  14138. CRect rc, rc2;
  14139. rc = mainrc;
  14140. rc.bottom = rc.top;
  14141. rc.top -= 20;
  14142. m_Print.SetFontFace(16, 1, "黑体");
  14143. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14144. m_Print.SetFontFace(8, 1, "宋体");
  14145. CString str;
  14146. int wid[7] = { 165, 90, 90, 45, 45, 60, 35 };
  14147. int hei = 16;
  14148. if (fscale > 0.71)hei = 15;
  14149. rc = mainrc;
  14150. rc.bottom = rc.top + hei;
  14151. for (int i = 0; i < 47; i++)
  14152. {
  14153. rc2.top = rc.top + i*hei;
  14154. rc2.bottom = rc.bottom + i*hei;
  14155. rc2.left = rc.left;
  14156. rc2.right = rc.left + wid[0];
  14157. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14158. for (int j = 0; j<7; j++)
  14159. {
  14160. m_Print.DrawRect2(rc2, 1);
  14161. if (Listarray->GetSize()>aa * 46 + i)
  14162. {
  14163. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14164. rc2.left += 3;
  14165. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14166. rc2.left -= 3;
  14167. }
  14168. rc2.left += wid[j];
  14169. rc2.right = rc2.left + wid[j + 1];
  14170. }
  14171. }
  14172. rc2.top += 2;
  14173. rc2.left += 2; rc2.right = mainrc.right + 4;
  14174. m_Print.SetFontFace(8, 1, "宋体");
  14175. str.Format(" 页:%d/%d", aa + 1, pages);
  14176. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14177. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14178. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14179. dlg.m_pDC = m_Print.GetPDC();
  14180. // dlg.m_mode=1;
  14181. if (aa == 0)
  14182. {
  14183. if (dlg.DoModal() != IDOK)
  14184. return;
  14185. }
  14186. //结束打印
  14187. m_Print.EndPage();
  14188. m_Print.EndPrint();
  14189. }
  14190. }
  14191. void CMainFrame::PrintTakeForm1(CArray<CStringArray, CStringArray>*Listarray)
  14192. {
  14193. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "拍照客人明细表";
  14194. int pages = Listarray->GetSize() / 46;
  14195. if (Listarray->GetSize() % 46)pages++;
  14196. for (int aa = 0; aa < pages; aa++)
  14197. {
  14198. PrintPreview dlg;
  14199. CPrintRX m_Print;
  14200. m_Print.InitToPrint(NULL, 1);
  14201. m_Print.StartPrint();
  14202. m_Print.StartPage();
  14203. CRect mainrc(0, 0, 560, 793);
  14204. float fscale;
  14205. {
  14206. int w, h;
  14207. m_Print.GetWidHei(w, h);
  14208. fscale = (float)w / (float)h;
  14209. }
  14210. mainrc.DeflateRect(25, 40, 10, 0);
  14211. CRect rc, rc2;
  14212. rc = mainrc;
  14213. rc.bottom = rc.top;
  14214. rc.top -= 20;
  14215. m_Print.SetFontFace(16, 1, "黑体");
  14216. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14217. m_Print.SetFontFace(8, 1, "宋体");
  14218. CString str;
  14219. int wid[7] = { 165, 60, 90, 60, 60, 60, 35 };
  14220. int hei = 16;
  14221. if (fscale > 0.71)hei = 15;
  14222. rc = mainrc;
  14223. rc.bottom = rc.top + hei;
  14224. for (int i = 0; i < 47; i++)
  14225. {
  14226. rc2.top = rc.top + i*hei;
  14227. rc2.bottom = rc.bottom + i*hei;
  14228. rc2.left = rc.left;
  14229. rc2.right = rc.left + wid[0];
  14230. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14231. for (int j = 0; j<7; j++)
  14232. {
  14233. m_Print.DrawRect2(rc2, 1);
  14234. if (Listarray->GetSize()>aa * 46 + i)
  14235. {
  14236. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14237. rc2.left += 3;
  14238. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14239. rc2.left -= 3;
  14240. }
  14241. rc2.left += wid[j];
  14242. rc2.right = rc2.left + wid[j + 1];
  14243. }
  14244. }
  14245. rc2.top += 2;
  14246. rc2.left += 2; rc2.right = mainrc.right + 4;
  14247. m_Print.SetFontFace(8, 1, "宋体");
  14248. str.Format(" 页:%d/%d", aa + 1, pages);
  14249. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14250. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14251. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14252. dlg.m_pDC = m_Print.GetPDC();
  14253. // dlg.m_mode=1;
  14254. if (aa == 0)
  14255. {
  14256. if (dlg.DoModal() != IDOK)
  14257. return;
  14258. }
  14259. //结束打印
  14260. m_Print.EndPage();
  14261. m_Print.EndPrint();
  14262. }
  14263. }
  14264. void CMainFrame::ShowMonthForm2()
  14265. {
  14266. }
  14267. // dlg;