MainFrm.cpp 456 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549
  1. // MainFrm.cpp : implementation of the CMainFrame class 员工工作
  2. #include "stdafx.h"
  3. #include "YLGL.h"
  4. #include "resource.h"
  5. #include "MainFrm.h"
  6. #include <afxinet.h>
  7. #include "ConnectDlg.h"
  8. #include "SendDataDlg.h"
  9. #include "DinDanHistroy.h"
  10. #include "ShangPin.h"
  11. #include "SPLBDlg.h"
  12. #include "BuMenDlg.h"
  13. #include "Worker.h"
  14. #include "ShowPic3.h"
  15. #include "TXDlg.h"
  16. #include "TXSPDlg.h"
  17. #include "MsgReg2.h"
  18. #include "ProviderDlg.h"
  19. #include "Booking.h"
  20. #include "Booking2.h"
  21. #include "PayOutSet.h"
  22. #include "PayOutInput.h"
  23. #include "IncomeInput.h"
  24. #include "IncomeInput2.h"
  25. #include "IncomeInput3.h"
  26. #include "IncomeInput4.h"
  27. #include "DressEarlyWarning.h"
  28. #include "DailyForm.h"
  29. #include "MonthForm.h"
  30. #include "ProcessAlarm.h"
  31. #include "MonthForm2.h"
  32. #include "YearForm.h"
  33. #include "ClientForm.h"
  34. #include "ClientForm2.h"
  35. #include "ClientForm3.h"
  36. #include "DinDanFrom.h"
  37. #include "Satisfaction.h"
  38. //#include "SatisfactionForm.h"
  39. #include "SatisfactionReportForm.h"
  40. #include "TodayForm.h"
  41. #include "TodayForm2.h"
  42. #include "SendInsideMsg2.h"
  43. #include "StoreInfoChart.h"
  44. #include "FixedAssets.h"
  45. #include "SPForm.h"
  46. #include "ShowMsg.h"
  47. #include "Account.h"
  48. #include "Login.h"
  49. #include "Login3.h"
  50. #include "Psw.h"
  51. #include "AreaDlg.h"
  52. #include "TakeFrom.h"
  53. #include "ChoosePhotoForm.h"
  54. #include "BeautifySkinFrom.h"
  55. #include "DesignFrom.h"
  56. #include "outsourcing.h"
  57. #include "ChoosePhotoSkin.h"
  58. #include "SalarySet.h"
  59. #include "SalarySet2.h"
  60. #include "MySalary.h"
  61. #include "PrintRX.h"
  62. #include "LoadRect.h"
  63. #include "PrintPreview.h"
  64. #include "SearchClient.h"
  65. #include "BeautifySkinFrom2.h"
  66. #include "FinanceForm.h"
  67. #include "PhotoPrintFrom.h"
  68. //#include "SqlDlg.h"
  69. #include "YearForm2.h"
  70. #include "AreaClient.h"
  71. #include "DBConfig.h"
  72. #include "SetPathDlg2.h"
  73. #include "StaffAchievement.h"
  74. #include "BurnCD.h"
  75. #include "StaffAchievementSet.h"
  76. #include "StaffAchievementShowAll.h"
  77. #include "SelContent.h"
  78. #include "ClientMoney.h"
  79. #include "DelPhotoSet.h"
  80. #include "ompanyInfo.h"
  81. #include "ClientForm.h"
  82. #include "PhotoBak.h"
  83. #include "MsgReg.h"
  84. #include "SendMsg.h"
  85. #include "MsgSet.h"
  86. #include "ShowMember.h"
  87. #include "ShowMember2.h"
  88. #include "MemberSet.h"
  89. #include "DressManage.h"
  90. #include "ShowDress.h"
  91. #include "ShowPic.h"
  92. #include "ShowHireReg.h"
  93. #include "InputGoods.h"
  94. #include "ShowGoods.h"
  95. #include "CostCal.h"
  96. #include "Welcome.h"
  97. #include "EmployeeMsg.h"
  98. #include "TXFG.h"
  99. #include "EmployeeForm.h"
  100. #include "EmployeeForm2.h"
  101. #include "Client2Form.h"
  102. #include "Client2FormLYFZ.h"
  103. #include "OldClient.h"
  104. #include "ClientReasonChart.h"
  105. #include "ClientFromChart.h"
  106. #include "WorkMsg.h"
  107. #include "SetLoginTime.h"
  108. #include "SetLoginBan.h"
  109. #include "LoginReg.h"
  110. #include "LoginReg2.h"
  111. #include "PhoneRecord.h"
  112. #include "PhoneRecordOut.h"
  113. #include "MissCall.h"
  114. #include "InsideMsg.h"
  115. #include "Card2Reg.h"
  116. #include "Card2RegChart.h"
  117. #include "ShowMemberBlue.h"
  118. #include "Card2RegBlue.h"
  119. #include "Card2RegChartBlue.h"
  120. #include "DigitalWork.h"
  121. #include "HideWindow.h"
  122. #include "SalarySet3.h"
  123. #include "YearFormBranch.h"
  124. #include "YearFormBranch2.h"
  125. #include "Set.h"
  126. #include "DinDanFromBranch.h"
  127. #include "MemberChart.h"
  128. #include "ShowMemberMsg.h"
  129. #include "ShowBakState.h"
  130. #include "DinDanForm.h"
  131. #include "CalendarConvert.h"
  132. #include "ShowLOg.h"
  133. #include "HospitalClient.h"
  134. #include "HospitalClientAlarm.h"
  135. #include "HospitalInfoSet.h"
  136. #include "AddHospitalClient.h"
  137. #include "HospitalClientMsg.h"
  138. #ifndef VC60
  139. #include "msgId_def.h"
  140. #include "struct_def.h"
  141. #endif //#ifndef VC60
  142. #ifdef _DEBUG
  143. #define new DEBUG_NEW
  144. #undef THIS_FILE
  145. static char THIS_FILE[] = __FILE__;
  146. #endif
  147. #ifndef WINVER
  148. #define WINVER 0x0400
  149. #endif
  150. #ifndef _WIN32_WINNT
  151. #define _WIN32_WINNT 0x0400
  152. #endif
  153. #ifndef _WIN32_WINDOWS
  154. #define _WIN32_WINDOWS 0x0410
  155. #endif
  156. #ifndef _WIN32_IE
  157. #define _WIN32_IE 0x0400
  158. #endif
  159. #include "uxtheme.h "
  160. typedef HTHEME(__stdcall * POPENTHEMEDATA)(HWND hwnd, LPCWSTR pszClassList);
  161. typedef HRESULT(__stdcall * PCLOSETHEMEDATA)(HTHEME hTheme);
  162. HHOOK g_hmouse = NULL; //g_sendhead zx.dll
  163. //extern void WriteTextLog(CString str); // Jeff写客户端日志;
  164. // Jeff.remark;
  165. // 函数:MouseProc
  166. // 参数:
  167. // nCode hook code
  168. // wParam message identifier
  169. // lParam mouse coordinates
  170. // 返回:
  171. //
  172. LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam)
  173. {
  174. if (g_pMainWnd)
  175. {
  176. if(g_cominfoarray.GetSize() > 0)
  177. {
  178. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(133)) && atoi(g_cominfoarray.ElementAt(0).ElementAt(134)) > 0)
  179. {
  180. g_pMainWnd->KillTimer(5);
  181. g_pMainWnd->SetTimer(5, atoi(g_cominfoarray.ElementAt(0).ElementAt(134)) * 60 * 1000, NULL);
  182. }
  183. }
  184. if (g_bSendLYFZ)
  185. {
  186. g_pMainWnd->KillTimer(7);
  187. g_pMainWnd->SetTimer(7, 5 * 60 * 1000, NULL);
  188. }
  189. }
  190. return CallNextHookEx(g_hmouse, nCode, wParam, lParam);
  191. }
  192. CRect g_rc; // 屏幕坐标值,区域是放置对话框。
  193. CMainFrame *g_pMainWnd = NULL;
  194. extern HWND g_hSendWnd;
  195. extern HWND g_hConnectWnd;
  196. //extern CString newGUID();
  197. #ifdef USE_KERNEL_DLL
  198. /************************************************************************/
  199. /*
  200. 函数:kernelCallback
  201. 描述:kernel.dll的回调函数;
  202. 参数:
  203. lpStrBranchId: 域名;
  204. lpStrOrder: 订单号;
  205. dwImgType: 相片类型;
  206. dwImgNum: 重命名使用,返回的相片编号;
  207. lpStrImg: IncrementalBack表使用的content字段内容,指定备份文件名的相片;
  208. lpStrImgExt: IncrementalBack表使用的backupExt字段内容,指定要备份的扩展名相片;
  209. 返回:void
  210. */
  211. /************************************************************************/
  212. #include "ImportPhoto.h"
  213. // 导入原片、初修、精修、设计结束后的回调函数(三合一);
  214. void CALLBACK ImgImportMergeCallback(IN LPCTSTR lpStrBranchId, IN LPCTSTR lpStrOrderNum, IN CONST INT& dwImgType, IN CONST DWORD& dwImgNum, IN LPCTSTR lpStrImgs, IN LPCTSTR lpStrImgExt)
  215. {
  216. AfxSetResourceHandle(g_Instance);
  217. // 1.判断参数有效性;
  218. if (lpStrBranchId == NULL || !strstr(lpStrBranchId, _T(".ly.com")) || lpStrOrderNum == NULL || _tcscmp(lpStrOrderNum, _T("")) == 0)
  219. {
  220. OutputDebugString(_T("回调函数参数(域名、订单号)无效\n"));
  221. return;
  222. }
  223. // 2.是否需要备份分店相片;
  224. BOOL bIsNeedBranchImg = FALSE;
  225. switch (dwImgType)
  226. {
  227. case 1://是否备份分店原片;
  228. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck1;
  229. break;
  230. case 2://是否备份分店修片;
  231. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck2;
  232. break;
  233. case 3://是否备份分店精修;
  234. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck3;
  235. break;
  236. case 4://是否备份分店设计;
  237. bIsNeedBranchImg = g_ThisShopVersion.bUpLoadCheck4;
  238. break;
  239. default:
  240. OutputDebugString(_T("未知相片类型!\n"));
  241. break;
  242. }
  243. // 3.同时更新IncrementalBack表;
  244. CString strSQLInsert = _T("");
  245. strSQLInsert.Format(INSERT_INCREMENT, 0, lpStrBranchId, CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S"), lpStrOrderNum, dwImgType, lpStrImgs, g_user.account, g_user.name);
  246. // 4.连接服务器,更新dindan和IncrementalBackup;
  247. g_sendhead.bsql = 1;
  248. if (g_bAllBranch)
  249. {// 多店汇总时;
  250. g_branchip = GetBranchIPbyId(lpStrBranchId);
  251. g_pMainWnd->OnDisconnect();
  252. g_branchname = GetBranchNamebyId(lpStrBranchId);
  253. g_bBranchModify = 1;
  254. if (dwImgType == OImgtype)
  255. {// 如果导入的是原片;
  256. CString strSQL = _T("");
  257. strSQL.Format(_T("update dindan set curno = '%d' where id = '%s' ***%s"), dwImgNum, lpStrOrderNum, strSQLInsert);
  258. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  259. }
  260. else
  261. {//导入的不是原片;
  262. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  263. }
  264. // 如果连接服务器失败,要记录下来;
  265. // if () .........
  266. g_pMainWnd->OnDisconnect();
  267. g_bBranchModify = 0;
  268. g_branchip = g_branchname = _T("");
  269. if (g_domain.CompareNoCase(lpStrBranchId) != 0 && bIsNeedBranchImg)
  270. {// 如果不是本店,且本店设置中需要备份分店相片,需要向本店添加导入相片记录;
  271. g_sendhead.bsql = 1;
  272. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  273. g_pMainWnd->OnDisconnect();
  274. g_bBranchModify = 0;
  275. }
  276. }
  277. else
  278. {// 连接本店或分店时;
  279. if (dwImgType == OImgtype)
  280. {// 如果导入的是原片;
  281. CString strSQL = _T("");
  282. strSQL.Format(_T("update dindan set curno = '%d' where id = '%s' ***%s"), dwImgNum, lpStrOrderNum, strSQLInsert);
  283. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  284. }
  285. else
  286. {//导入的不是原片;
  287. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  288. }
  289. if (g_domain.CompareNoCase(lpStrBranchId) != 0 && bIsNeedBranchImg)
  290. {// 如果不是本店,且本店设置中需要备份分店相片,需要向本店添加导入相片记录;
  291. #if 1
  292. ::SendMessage(g_pMainWnd->m_hWnd, MSG_KERNEL_SENDMSG, (WPARAM)lpStrBranchId, (LPARAM)&strSQLInsert);
  293. #else // 可能是VC6.0与VC9.0间DLL调用产生的问题,下面代码执行时会出错;
  294. // 如果连接的是分店,断开分店,回连本店;
  295. g_bBranchModify = FALSE;
  296. g_pMainWnd->OnDisconnect();
  297. g_branchname = g_branchip = _T("");
  298. g_sendhead.bsql = 1;
  299. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  300. g_pMainWnd->OnDisconnect();
  301. // 设置回分店连接;
  302. g_branchip = GetBranchIPbyId(lpStrBranchId);
  303. g_branchname = GetBranchNamebyId(lpStrBranchId);
  304. g_bBranchModify = TRUE;
  305. #endif
  306. }
  307. }
  308. if ( dwImgType == OImgtype )
  309. {// 最后一步,更新完了数据库,刷新TakFrom类所对应的对话框;
  310. HWND hWnd = ::FindWindowEx(g_pMainWnd->GetSafeHwnd(), NULL, _T("MDIClient"), NULL);
  311. if (hWnd)
  312. {
  313. hWnd = ::FindWindowEx(hWnd, NULL, NULL, _T("拍照"));
  314. if (hWnd)
  315. {
  316. hWnd = ::FindWindowEx(hWnd, NULL, _T("#32770"), NULL);
  317. if (hWnd)
  318. {
  319. ::SendMessage(hWnd, MSG_KERNEL_CALLBACK, 0, 0);
  320. }
  321. }
  322. }
  323. }
  324. }
  325. #endif
  326. /////////////////////////////////////////////////////////////////////////////
  327. // CMainFrame客人付款
  328. /////////////////////////////////////////////////////////////////////////////
  329. /////////////////////////////////////////////////////////////////////////////
  330. static void HandleClientNetEvent(IN SOCKET hSocket,
  331. IN ETransportEvent eEvent,
  332. IN void *pDataBuf,
  333. IN unsigned long nDataLen,
  334. IN int nError,
  335. IN void *pContext)
  336. {
  337. if (nError != TRANSPORT_OK)
  338. return;
  339. CMainFrame *pDlg = (CMainFrame *)pContext;
  340. if (NULL == pDlg)
  341. return;
  342. pDlg->ProcessNetEvent(eEvent, pDataBuf, nDataLen);
  343. }
  344. BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam)
  345. {
  346. CRect rtCtrl, rtWnd; // 子窗口,父窗口;
  347. if (hwnd)
  348. {
  349. ::GetWindowRect(hwnd, &rtCtrl); // 获取控件大小;
  350. ::GetWindowRect(GetParent(hwnd), &rtWnd); // 获取父窗口大小;
  351. // printf("Jeff:g_WidthScale=%d,g_HeightScale=%d,rtWnd.left=%d,rtWnd.top=%d\n\n",g_WidthScale,g_HeightScale,rtWnd.left,rtWnd.top);
  352. // 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);
  353. rtCtrl.OffsetRect(-rtWnd.left, -rtWnd.top);
  354. float temp;
  355. temp = (float)rtCtrl.left*g_WidthScale;
  356. rtCtrl.left = (int)temp + g_dx;
  357. temp = (float)rtCtrl.top*g_HeightScale;
  358. rtCtrl.top = (int)temp + g_dy;
  359. temp = (float)rtCtrl.right*g_WidthScale;
  360. rtCtrl.right = (int)temp + g_dx;
  361. temp = (float)rtCtrl.bottom*g_HeightScale;
  362. rtCtrl.bottom = (int)temp + g_dy;
  363. //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);
  364. ::MoveWindow(hwnd, rtCtrl.left, rtCtrl.top, rtCtrl.Width(), rtCtrl.Height(), TRUE);
  365. return TRUE;
  366. }
  367. else
  368. {
  369. return FALSE;
  370. }
  371. }
  372. IMPLEMENT_DYNCREATE(CMainFrame, CMDIFrameWnd)
  373. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  374. //{{AFX_MSG_MAP(CMainFrame)
  375. ON_WM_CREATE()
  376. ON_WM_DESTROY()
  377. ON_WM_CLOSE()
  378. ON_WM_TIMER()
  379. ON_COMMAND(IDM_choosephotoskin, Onchoosephotoskin)
  380. ON_COMMAND(IDM_PATH, OnPath)
  381. ON_COMMAND(IDM_SERVER, OnServer)
  382. ON_COMMAND(IDM_SHOWHIS, OnShowhis)
  383. ON_COMMAND(IDM_StaffAchievementShow, OnStaffAchievementShow)
  384. ON_COMMAND(IDM_AUTODELPHOTO, OnAutodelphoto)
  385. ON_COMMAND(IDM_PHOTOMANAGE, Onphotomanage)
  386. ON_COMMAND(IDM_COMPANYINFO, OnCompanyinfo)
  387. ON_COMMAND(IDM_HELPFILE, OnHelpfile)
  388. ON_COMMAND(IDM_PHOTOBAK, OnPhotobak)
  389. ON_COMMAND(IDM_TAOXIFG, OnTaoxifg)
  390. ON_COMMAND(IDM_ShowBakState, OnShowBakState)
  391. ON_WM_NCLBUTTONDBLCLK()
  392. ON_WM_NCHITTEST()
  393. ON_COMMAND(IDM_LOG, OnLog)
  394. //}}AFX_MSG_MAP
  395. ON_COMMAND_RANGE(0, 50000, OnCommandMenu)
  396. ON_MESSAGE(MSG_KERNEL_SENDMSG, OnKernelSendMessaage)
  397. END_MESSAGE_MAP()
  398. static UINT indicators[] =
  399. {
  400. ID_SEPARATOR, // status line indicator
  401. ID_INDICATOR_CAPS,
  402. ID_INDICATOR_NUM,
  403. ID_INDICATOR_SCRL,
  404. };
  405. /////////////////////////////////////////////////////////////////////////////
  406. // CMainFrame construction/destruction
  407. #ifdef VC60
  408. UINT CMainFrame::OnNcHitTest(CPoint point)
  409. {
  410. if (CWnd::OnNcHitTest(point) == HTRIGHT || CWnd::OnNcHitTest(point) == HTLEFT || CWnd::OnNcHitTest(point) == HTTOP || CWnd::OnNcHitTest(point) == HTBOTTOM)
  411. return HTCLIENT;
  412. return CWnd::OnNcHitTest(point);
  413. }
  414. #else
  415. LRESULT CMainFrame::OnNcHitTest(CPoint point)
  416. {
  417. if (CWnd::OnNcHitTest(point) == HTRIGHT || CWnd::OnNcHitTest(point) == HTLEFT || CWnd::OnNcHitTest(point) == HTTOP || CWnd::OnNcHitTest(point) == HTBOTTOM)
  418. return HTCLIENT;
  419. return CWnd::OnNcHitTest(point);
  420. }
  421. #endif
  422. void CMainFrame::OnNcLButtonDblClk(UINT nFlags, CPoint point)
  423. {
  424. if (nFlags != HTCAPTION)
  425. CMDIFrameWnd::OnNcLButtonDblClk(nFlags, point);
  426. }
  427. // 回调使用;
  428. LRESULT CMainFrame::OnKernelSendMessaage(WPARAM wp, LPARAM lp)
  429. {
  430. CString strBranchId = (LPCTSTR)wp;
  431. CString strSQLInsert = *(CString*)lp;
  432. // 如果连接的是分店,断开分店,回连本店;
  433. g_bBranchModify = FALSE;
  434. g_pMainWnd->OnDisconnect();
  435. g_branchname = g_branchip = _T("");
  436. g_sendhead.bsql = 1;
  437. g_pMainWnd->ProcessChatMessageRequest2(strSQLInsert);
  438. g_pMainWnd->OnDisconnect();
  439. // 设置回分店连接;
  440. g_branchip = GetBranchIPbyId(strBranchId);
  441. g_branchname = GetBranchNamebyId(strBranchId);
  442. g_bBranchModify = TRUE;
  443. g_pMainWnd->OnConnect();
  444. return 0;
  445. }
  446. CMainFrame::CMainFrame()
  447. {
  448. // TODO: add member initialization code here
  449. SetConnectionID(INVALID_SOCKET);
  450. m_pMainFrimDlg2 = NULL;
  451. m_bCheckF2F3 = AfxGetApp()->GetProfileInt(LYFZVERSION, "f2f3", 0);
  452. if (0 == ::PathFileExists(g_mainpath + "\\skin\\5.lia"))
  453. {
  454. g_bNoLoginLia = 1;
  455. }
  456. }
  457. CMainFrame::~CMainFrame()
  458. {
  459. if (m_pMainFrimDlg2)
  460. {
  461. m_pMainFrimDlg2->DestroyWindow();
  462. delete m_pMainFrimDlg2;
  463. }
  464. }
  465. void InTheMe(HWND m_hWnd)
  466. {
  467. BOOL bXpVisualStyle = FALSE;
  468. OSVERSIONINFO osvi;
  469. osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  470. ::GetVersionEx(&osvi);
  471. if ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) && (osvi.dwMajorVersion >= 5) && (osvi.dwMinorVersion >= 1))
  472. {
  473. HMODULE hUxTheme = ::LoadLibrary(_T("UxTheme.dll"));
  474. POPENTHEMEDATA pOpenThemeData;
  475. PCLOSETHEMEDATA pCloseThemeData;
  476. if (hUxTheme != NULL)
  477. {
  478. pOpenThemeData = (POPENTHEMEDATA)::GetProcAddress(hUxTheme, "OpenThemeData");
  479. pCloseThemeData = (PCLOSETHEMEDATA)::GetProcAddress(hUxTheme, "CloseThemeData");
  480. HTHEME hButtonTheme = (*pOpenThemeData)(m_hWnd, L"BUTTON");
  481. if (hButtonTheme != NULL)
  482. bXpVisualStyle = TRUE;
  483. (*pCloseThemeData)(hButtonTheme);
  484. }
  485. ::FreeLibrary(hUxTheme);
  486. }
  487. if (bXpVisualStyle)
  488. AfxMessageBox(_T("正在使用视觉主题 "));
  489. else
  490. AfxMessageBox(_T("没有使用视觉主题 "));
  491. }
  492. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  493. {
  494. if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  495. {
  496. // Jeff.创建失败的可能性小,加日志输出;
  497. return -1;
  498. }
  499. if (::PathFileExists(g_mainpath + "\\logo.ico"))
  500. {
  501. Bitmap *bmp = NULL;
  502. LoadImageFromFile((Image**)&bmp, g_mainpath + "\\logo.ico");
  503. // m_hIcon = AfxGetApp()->LoadIcon(g_mainpath+"\\logo.ico");
  504. bmp->GetHICON(&m_hIcon);
  505. delete bmp;
  506. SetIcon(m_hIcon, TRUE); // Set big icon
  507. SetIcon(m_hIcon, FALSE); // Set small icon
  508. }
  509. if (!m_wndClient.SubclassWindow(m_hWndMDIClient))
  510. {
  511. return -1;
  512. }
  513. if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  514. | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  515. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  516. {
  517. TRACE0("Failed to create toolbar\n");
  518. return -1; // fail to create
  519. }
  520. m_wndToolBar.LoadTrueColorToolBar(90, IDB_NORMAL, 0, IDB_DISABLE);
  521. // second toolbar must have different ID
  522. if (!m_wndToolBar2.Create(this, WS_CHILD | WS_VISIBLE | CBRS_LEFT | CBRS_NOALIGN,
  523. AFX_IDW_CONTROLBAR_FIRST + 32) ||
  524. !m_wndToolBar2.LoadToolBar(IDR_TOOLBAR1))
  525. {
  526. TRACE0("Failed to create toolbar\n");
  527. return -1; // fail to create
  528. }
  529. #ifndef NEW_SKIN
  530. if (!m_wndStatusBar.Create(this) ||
  531. !m_wndStatusBar.SetIndicators(indicators,
  532. sizeof(indicators)/sizeof(UINT)))
  533. {
  534. // Jeff.创建失败的可能性小,加日志输出;
  535. TRACE0("Failed to create status bar\n");
  536. return -1; // fail to create
  537. }
  538. m_wndStatusBar.SetPaneInfo(1,ID_INDICATOR_USER,SBPS_NORMAL,200);
  539. m_wndStatusBar.SetPaneText(1,"未登录",TRUE);
  540. #endif
  541. // TODO: Delete these three lines if you don't want the toolbar to
  542. // be dockable
  543. NewMenu2();
  544. ::GetWindowRect(this->m_hWndMDIClient, g_rc);
  545. g_pMainWnd = this;
  546. m_wndToolBar2.Init();
  547. g_rc.top += 38;
  548. g_rc.left += 160;
  549. /* m_WidthScale = (float)g_rc.Width ()/722;
  550. m_HeightScale = (float)g_rc.Height ()/533;*/
  551. g_user.bLongin = 0;
  552. SetTimer(1, 100, NULL);
  553. #ifdef USE_KERNEL_DLL
  554. if ( g_pIMGProcess )
  555. g_pIMGProcess->SetCallBack(ImgImportMergeCallback);
  556. #endif
  557. return 0;
  558. }
  559. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  560. {
  561. if (!CMDIFrameWnd::PreCreateWindow(cs))
  562. return FALSE;
  563. // TODO: Modify the Window class or styles here by modifying
  564. // the CREATESTRUCT cs
  565. cs.style &= ~WS_MAXIMIZEBOX;
  566. cs.style &= ~WS_THICKFRAME;
  567. cs.lpszName = g_title + "影楼管理系统";
  568. cs.style &= ~FWS_ADDTOTITLE;
  569. RECT rect;
  570. HWND hWnd = ::FindWindow("Shell_TrayWnd", 0);
  571. ::GetWindowRect(hWnd, &rect);
  572. cs.x = 0;
  573. cs.y = 0;
  574. cs.cx = GetSystemMetrics(SM_CXSCREEN);
  575. cs.cy = GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top) + 3;
  576. return TRUE;
  577. }
  578. /////////////////////////////////////////////////////////////////////////////
  579. // CMainFrame diagnostics
  580. #ifdef _DEBUG
  581. void CMainFrame::AssertValid() const
  582. {
  583. CMDIFrameWnd::AssertValid();
  584. }
  585. void CMainFrame::Dump(CDumpContext& dc) const
  586. {
  587. CMDIFrameWnd::Dump(dc);
  588. }
  589. #endif //_DEBUG
  590. /////////////////////////////////////////////////////////////////////////////
  591. // CMainFrame message handlers
  592. void CMainFrame::OnDestroy()
  593. {
  594. OnDisconnect();
  595. #ifdef VC60
  596. Transport_UnInit();
  597. #else
  598. CClientTunnel::Transport_UnInit();
  599. #endif //#ifdef VC60
  600. m_Mdi.DeleteAll();
  601. if (g_hmouse)UnhookWindowsHookEx(g_hmouse);
  602. CMDIFrameWnd::OnDestroy();
  603. }
  604. void CMainFrame::OnClose()
  605. {
  606. g_bShowBar = 0;
  607. if (m_Mdi.MainClose())
  608. CMDIFrameWnd::OnClose();
  609. }//连接
  610. void CMainFrame::NewMenu2()
  611. {
  612. CMenu *pMemu = GetMenu();
  613. #ifdef BASIC_VERSION
  614. CMenu* submenu = pMemu->GetSubMenu(1);
  615. //submenu->RemoveMenu (IDM_StaffAchievementShow, MF_BYCOMMAND );//Jeff del 2014.06.16
  616. submenu->RemoveMenu (IDM_salaryset, MF_BYCOMMAND );
  617. #endif
  618. #if 0 // 此机用选片菜单项,去掉不用;
  619. {
  620. BOOL checked=AfxGetApp()->GetProfileInt (LYFZVERSION, "status", 0);
  621. if(checked)
  622. {
  623. CMenu* submenu = pMemu->GetSubMenu(1);
  624. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  625. }
  626. }
  627. #endif
  628. #ifndef BASIC_VERSION
  629. {
  630. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status2", 0);
  631. if (checked)
  632. {
  633. #if 0 // Jeff:去掉菜单,此机用于员工业绩查看的菜单选项;
  634. CMenu* submenu = pMemu->GetSubMenu(1);
  635. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  636. #endif
  637. g_bStaffAchievementShow = 1;
  638. SetTimer(3, 100, NULL);
  639. }
  640. }
  641. #endif
  642. if (g_bShowOK == 0)
  643. {
  644. CMenu* submenu = pMemu->GetSubMenu(2);
  645. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  646. }
  647. }
  648. HMENU CMainFrame::NewMenu()
  649. {
  650. //设置菜单为XP风格 IDM_SHOWHIS
  651. BCMenu::SetMenuDrawMode(1);
  652. //若取消下面这句注释,则可看到菜单的图标栏和文字栏背景颜色为白色,
  653. //文字颜色为蓝色,选中项的前景色为紫红色
  654. //m_menuXP.SetMenuXPItemColor(0x00FFFFFF,0x00FFFFFF,0x00FF0000,0x00FF00FF);
  655. // 设置菜单中图标大小为32×32
  656. // m_menuXP.SetIconSize(32,32);
  657. // 加载菜单资源
  658. m_menuXP.LoadMenu(IDR_MAINFRAME);
  659. // 加载菜单对应的工具栏资源
  660. // m_menuXP.LoadToolbar(IDR_MAINFRAME);
  661. /*由于菜单左边栏中默认的图标大小为16×16,而与之对应的Toolbar中图标大小为32×32,
  662. 因此菜单中图标不能正确显示,只显示出工具栏中图标的左上角部分,所以修改菜单中各
  663. 项对应的图标为24b色位图资源IDB_***,或者在LoadMenu之前调用SetIconSize,设置菜单
  664. 中图标大小为32×32*/
  665. // m_menuXP.SetIconSize(24,24);
  666. // m_menuXP.ModifyODMenu(NULL,IDM_YWBU,IDB_YW); //
  667. /* m_menuXP.ModifyODMenu(NULL,ID_FILE_OPEN,IDB_BITMAP5);
  668. m_menuXP.ModifyODMenu(NULL,ID_FILE_SAVE,IDB_BITMAP7);
  669. m_menuXP.ModifyODMenu(NULL,ID_FILE_PRINT,IDB_BITMAP6);
  670. m_menuXP.ModifyODMenu(NULL,ID_APP_ABOUT,IDB_BITMAP3);
  671. m_menuXP.ModifyODMenu(NULL,ID_APP_EXIT,IDB_BITMAP2);*/
  672. // m_menuXP.EnableMenuItem (0, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  673. // m_menuXP.EnableMenuItem (2, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  674. // m_menuXP.EnableMenuItem (3, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  675. // m_menuXP.EnableMenuItem (4, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  676. // m_menuXP.EnableMenuItem (5, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  677. // m_menuXP.EnableMenuItem (8, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  678. #if 0 // Jeff此机用选片菜单项不用;
  679. {
  680. BOOL checked=AfxGetApp()->GetProfileInt (LYFZVERSION, "status", 0);
  681. if(checked)
  682. {
  683. CMenu* submenu = m_menuXP.GetSubMenu(1);
  684. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  685. }
  686. }
  687. #endif
  688. {
  689. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status2", 0);
  690. if (checked)
  691. {
  692. #if 0 // Jeff:去掉此机用于员工业绩查看的菜单选项;
  693. CMenu* submenu = m_menuXP.GetSubMenu(1);
  694. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  695. #endif
  696. g_bStaffAchievementShow = 1;
  697. SetTimer(3, 100, NULL);
  698. }
  699. }
  700. if (g_bShowOK == 0)
  701. {
  702. CMenu* submenu = m_menuXP.GetSubMenu(2);
  703. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  704. }
  705. return(m_menuXP.Detach());
  706. }
  707. ///////////////////////////////////////////////////////
  708. //减少代码
  709. #define OPEN_MENU(x) m_Mdi.Append(pName, RUNTIME_CLASS(x), IDR_MAINFRAME, this, nID)
  710. //响应菜单命令
  711. void CMainFrame::OnCommandMenu(UINT nID) // 所有菜单命令都在这里处理;
  712. {
  713. if (nID >= 2000 && nID <= 2100)
  714. {
  715. OnBranchData(nID);
  716. return;
  717. }
  718. if (g_user.bLongin == 0)
  719. {
  720. if (g_bNoLoginLia)
  721. {
  722. Login dlg;
  723. dlg.SetLiaPath("5.lia");
  724. dlg.DoModal();
  725. }
  726. else
  727. {
  728. Login3 dlg;
  729. dlg.SetLiaPath("5.lia");
  730. dlg.DoModal();
  731. }
  732. return;
  733. if (g_user.bLongin == 0)return;
  734. }
  735. else
  736. {
  737. InsideMsg();
  738. }
  739. ResetTimer();
  740. if (nID >= 1000 && nID <= 1100)
  741. {
  742. OnHistory(nID);
  743. return;
  744. }
  745. LPSTR pName;
  746. //打开窗口
  747. switch (nID)
  748. {
  749. case IDM_PayOutSet:
  750. {
  751. if (IsHasRights(16) == 0)return;
  752. PayOutSet dlg;
  753. dlg.DoModal();
  754. return;
  755. }
  756. case IDM_SPLB:
  757. {
  758. if (IsHasRightsnew(29) == 0)return;
  759. SPLBDlg dlg;
  760. dlg.DoModal();
  761. return;
  762. }
  763. case IDM_JD:
  764. {
  765. if (IsHasRightsnew(49) == 0)return;
  766. SPLBDlg dlg;
  767. dlg.m_mode = 1;
  768. dlg.DoModal();
  769. return;
  770. }
  771. case IDM_AREA:
  772. {
  773. if (IsHasRightsnew(47) == 0)return;
  774. AreaDlg dlg;
  775. dlg.DoModal();
  776. return;
  777. }
  778. case IDM_Psw:
  779. {
  780. Psw dlg;
  781. dlg.DoModal();
  782. return;
  783. }
  784. case IDM_Set:
  785. {
  786. if (IsHasRightsnew(49) == 0)return;
  787. Set dlg;
  788. dlg.DoModal();
  789. return;
  790. }
  791. case IDM_HIDEWINDOW:
  792. {
  793. HideWindow dlg;
  794. dlg.DoModal();
  795. return;
  796. }
  797. case IDM_Logout:// Jeff.注销;
  798. {
  799. if(g_user.bLongin)
  800. WriteLog("退出系统!", "退出系统!");
  801. g_user.bLongin = 0;
  802. g_user.name.Empty();
  803. g_user.rights.Empty();
  804. g_user.account.Empty();
  805. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  806. g_pMainWnd2->RefreshOutlookBar();
  807. #ifndef NEW_SKIN
  808. m_wndStatusBar.SetPaneText(1, "未登录", TRUE);
  809. #endif
  810. m_Mdi.CloseAll();
  811. #ifdef ENTERPRISE_VERSION
  812. g_branchname.Empty();
  813. g_branchip.Empty();
  814. g_pMainWnd->OnDisconnect();
  815. g_bBranchModify = 0;
  816. #endif
  817. if (g_pMainWnd2)
  818. {
  819. g_pMainWnd2->DrawLogin();
  820. g_pMainWnd2->ShowBar(0);
  821. }
  822. g_hisyeararray.RemoveAll();
  823. g_pMainWnd->AddHistoryMenu(&g_hisyeararray);
  824. g_brancharray.RemoveAll();
  825. g_pMainWnd->AddBranchMenu(&g_brancharray);
  826. if (g_bNoLoginLia)
  827. {
  828. Login dlg;
  829. dlg.SetLiaPath("5.lia");
  830. dlg.DoModal();
  831. }
  832. else
  833. {
  834. Login3 dlg;
  835. dlg.SetLiaPath("5.lia");
  836. dlg.DoModal();
  837. }
  838. if (g_user.bLongin == 1)
  839. {
  840. if (g_pMainWnd2)
  841. {
  842. g_pMainWnd2->ShowBar(TRUE,TRUE);
  843. }
  844. }
  845. return;
  846. }
  847. case IDM_TODAY:
  848. pName = (LPSTR)(LPCSTR)"历史订单";
  849. // OPEN_MENU(SalarySet3);
  850. OPEN_MENU(DinDanHistroy);
  851. break;
  852. case IDM_TAKECONTROL:
  853. pName = (LPSTR)(LPCSTR)"摄控表";
  854. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(117)))
  855. OPEN_MENU(TodayForm2);
  856. else
  857. OPEN_MENU(TodayForm);
  858. break;
  859. case IDM_CLIENTMONEY:
  860. pName = (LPSTR)(LPCSTR)"客人付款";
  861. OPEN_MENU(ClientMoney);
  862. break;
  863. case IDM_TAKEAWAYBOOK:
  864. pName = (LPSTR)(LPCSTR)"发片/取件";
  865. OPEN_MENU(outsourcing);
  866. break;
  867. case IDM_CODE:
  868. pName = (LPSTR)(LPCSTR)"商品报表";
  869. OPEN_MENU(SPForm);
  870. break;
  871. case IDM_Daily:
  872. // if(IsHasRightsnew(22)==0)return;
  873. // pName = (LPSTR)(LPCSTR)"日财务表";
  874. // OPEN_MENU(DailyForm);
  875. pName = (LPSTR)(LPCSTR)"沟通助手";
  876. OPEN_MENU(InsideMsg);
  877. break;
  878. case IDM_ProcessAlarm:
  879. pName = (LPSTR)(LPCSTR)"流程监控";
  880. OPEN_MENU(ProcessAlarm);
  881. break;
  882. case IDM_DINDAN:
  883. // if(IsHasRights(7)==0)return;
  884. pName = (LPSTR)(LPCSTR)"订单报表";
  885. OPEN_MENU(DinDanFrom);
  886. break;
  887. case IDM_CLIENT:
  888. //if(IsHasRights(8)==0)return;
  889. pName = (LPSTR)(LPCSTR)"客户报表";
  890. OPEN_MENU(CClientForm);
  891. break;
  892. case IDM_PayOutInput:
  893. if (IsHasRightsnew(20) == 0)return;
  894. pName = (LPSTR)(LPCSTR)"现金支出";
  895. OPEN_MENU(PayOutInput);
  896. break;
  897. case IDM_salaryset:
  898. if (IsHasRightsnew(25) == 0)return;
  899. pName = (LPSTR)(LPCSTR)"工资设置";
  900. OPEN_MENU(SalarySet);
  901. break;
  902. case IDM_mysalary:
  903. if (IsHasRights(16) == 0)return;
  904. pName = (LPSTR)(LPCSTR)"我的工资";
  905. OPEN_MENU(MySalary);
  906. break;
  907. case IDM_SP:
  908. // if(IsHasRightsnew(29)==0)return;
  909. pName = (LPSTR)(LPCSTR)"商品设置";
  910. OPEN_MENU(ShangPin);
  911. break;
  912. case IDM_WORKER:
  913. if (IsHasRightsnew(27) == 0)return;
  914. pName = (LPSTR)(LPCSTR)"员工设置";
  915. OPEN_MENU(Worker);
  916. break;
  917. case IDM_TAOXI:
  918. if (IsHasRightsnew(30) == 0)return;
  919. pName = (LPSTR)(LPCSTR)"套系设置";
  920. OPEN_MENU(TXDlg);
  921. break;
  922. case IDM_TAOXISP:
  923. if (IsHasRightsnew(30) == 0)return;
  924. pName = (LPSTR)(LPCSTR)"套系赠送商品设置";
  925. OPEN_MENU(TXSPDlg);
  926. break;
  927. case IDM_Provider:
  928. if (IsHasRightsnew(32) == 0)return;
  929. pName = (LPSTR)(LPCSTR)"供应商设置";
  930. OPEN_MENU(ProviderDlg);
  931. break;
  932. case IDM_BUMEN:
  933. {
  934. if (IsHasRightsnew(49) == 0)return;
  935. BuMenDlg dlg;
  936. dlg.DoModal();
  937. return;
  938. }
  939. case IDM_Account:
  940. if (IsHasRightsnew(49) == 0)return;
  941. pName = (LPSTR)(LPCSTR)"账号管理";
  942. OPEN_MENU(Account);
  943. break;
  944. case IDM_YLCD:
  945. {
  946. //AfxMessageBox("IDM_YLCD");
  947. ::CopyFile(_T(g_path7 + "\\接单系统\\Regsvr32.exe"), _T(g_mainpath + "\\Regsvr32.exe"), 0);
  948. ::CopyFile(_T(g_path7 + "\\接单系统\\Flash9f.ocx"), _T(g_mainpath + "\\Flash9f.ocx"), 0);
  949. CString temp;
  950. temp.Format("%s\\regsvr32.exe /s %s\\Flash9f.OCX", g_mainpath, g_mainpath);
  951. WinExec(temp, SW_HIDE);
  952. ::CopyFile(_T(g_path7 + "\\接单系统\\接单系统.exe"), _T(g_mainpath + "\\接单系统.exe"), 0);
  953. ::CopyFile(_T(g_path7 + "\\接单系统\\my32.dll"), _T(g_mainpath + "\\my32.dll"), 0);
  954. ::CopyFile(_T(g_path7 + "\\接单系统\\server.dat"), _T(g_mainpath + "\\server.dat"), 0);
  955. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\接单系统.exe"), g_server, NULL, SW_SHOWNORMAL);
  956. }
  957. break;
  958. case IDM_YLCDMANAGE:
  959. ::CopyFile(_T(g_path7 + "\\接单系统\\资源管理器.exe"), _T(g_mainpath + "\\资源管理器.exe"), 0);
  960. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\资源管理器.exe"), g_server, NULL, SW_SHOWNORMAL);
  961. break;
  962. }
  963. }
  964. //减少代码
  965. ///////////////////////////////////////////////////////////////////////////////
  966. void CMainFrame::OnDisconnect()
  967. {
  968. printf("断开TCP连接\n");
  969. m_tClientTunnel.net_CloseSocket();
  970. SetConnectionID(INVALID_SOCKET);
  971. }
  972. void CMainFrame::ProcessLoginResponse(void *pLoginResult)
  973. {
  974. if (NULL == pLoginResult) return;
  975. LOGIN_RESULT_STRU *ptLoginResult = (LOGIN_RESULT_STRU *)pLoginResult;
  976. DWORD dwConnectionID = ptLoginResult->tCommonMsg.dwConnectionID;
  977. SetConnectionID(dwConnectionID);
  978. BYTE byResult = ptLoginResult->byResult;
  979. if (LOGIN_RESULT_SUC == byResult)
  980. {
  981. //AfxMessageBox("登录成功"); // Jeff test;
  982. }
  983. else
  984. {
  985. OnDisconnect();
  986. }
  987. }
  988. /************************************************************************/
  989. /* 函数:ProcessLoginRequest[3/3/2016 IT];
  990. /* 描述:登陆服务器;
  991. /* 参数:;
  992. /* [IN] :;
  993. /* [OUT] :;
  994. /* [IN/OUT] :;
  995. /* 返回:登陆成功返回TRUE;
  996. /* 注意:;
  997. /* 示例:;
  998. /*
  999. /* 修改:;
  1000. /* 日期:;
  1001. /* 内容:;
  1002. /************************************************************************/
  1003. BOOL CMainFrame::ProcessLoginRequest()
  1004. {
  1005. // 1.设置通信类型MSG_LOGIN_REQ,为登陆请求;
  1006. WORD wMessageId = 0;
  1007. if (g_conntype == 0 && !g_bConnLYFZ)
  1008. wMessageId = (MSG_LOGIN_REQ + 0X1FFF);
  1009. else// if (g_bConnLYFZ )
  1010. wMessageId = MSG_LOGIN_REQ;
  1011. // 2.填充发送数据;
  1012. TLOGIN_STRU tLogonInfo = { 0 };
  1013. tLogonInfo.tCommonMsg.dwConnectionID = GetConnectionID();//此时m_dwConnectionID为INVALIDE_SOCKET;
  1014. tLogonInfo.tCommonMsg.wMessageId = wMessageId;
  1015. CString strUserName = newGUID();// 以随机数作为登陆时的用户名称;
  1016. strUserName.TrimLeft();
  1017. strUserName.TrimRight();
  1018. #ifdef VC60
  1019. strcpy(tLogonInfo.tUserInfo.szUserName, strUserName);
  1020. #else
  1021. strcpy_s(tLogonInfo.tUserInfo.szUserName, 31, strUserName);
  1022. #endif
  1023. DWORD dwDataLen = sizeof(TLOGIN_STRU);
  1024. // 3.填充数据头;
  1025. TMessageHeader tHeader = { 0 };
  1026. tHeader.wMessageId = wMessageId;
  1027. tHeader.dwDataLen = dwDataLen;
  1028. // 4.发送数据;
  1029. unsigned long ulSendLen = m_tClientTunnel.net_Send(&tHeader, (void *)&tLogonInfo, dwDataLen);
  1030. if (ulSendLen == SOCKET_ERROR)
  1031. {
  1032. return 0;
  1033. }
  1034. return 1;
  1035. }
  1036. DWORD CMainFrame::GetConnectionID()
  1037. {
  1038. return m_dwConnectionID;
  1039. }
  1040. void CMainFrame::SetConnectionID(DWORD dwConnection)
  1041. {
  1042. m_dwConnectionID = dwConnection;
  1043. }
  1044. /************************************************************************/
  1045. /* 函数:ProcessChatMessageRequest2[3/3/2016 IT];
  1046. /* 描述:;
  1047. /* 参数:;
  1048. /* [IN] code:;
  1049. /* 返回:void;
  1050. /* 注意:
  1051. OnConnect() -> ProcessChatMessageRequest()
  1052. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1053. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1054. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1055. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1056. 5.关闭对话框和断开连接;;
  1057. /* 示例:;
  1058. /*
  1059. /* 修改:;
  1060. /* 日期:;
  1061. /* 内容:;
  1062. /************************************************************************/
  1063. void CMainFrame::ProcessChatMessageRequest2(BYTE code)
  1064. {
  1065. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1066. SendDataDlg dlg;
  1067. dlg.m_bycode = code;
  1068. dlg.DoModal();
  1069. }
  1070. //*********************************************//
  1071. /*
  1072. 函数:ProcessChatMessageRequest2
  1073. 参数:CString sql [IN]
  1074. 返回:无
  1075. 过程:OnConnect() -> ProcessChatMessageRequest()
  1076. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1077. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1078. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1079. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1080. 5.关闭对话框和断开连接;
  1081. */
  1082. //*********************************************//
  1083. void CMainFrame::ProcessChatMessageRequest2(CString sql)
  1084. {
  1085. if ((sql.Find("insert") != -1 || sql.Find("update") != -1 || sql.Find("delete") != -1) && g_branchname != "" && g_bBranchModify == 0)
  1086. {
  1087. AfxMessageBox("当前为分店数据查看状态,不能更改分店数据!", MB_ICONSTOP);
  1088. g_bSendOK = 0;
  1089. return;
  1090. }
  1091. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1092. SendDataDlg dlg;
  1093. dlg.m_strSQL = sql;
  1094. dlg.DoModal();
  1095. }
  1096. //*********************************************//
  1097. /*
  1098. 函数:ProcessChatMessageRequest2
  1099. 参数:BYTE *pData [IN], int length [IN]
  1100. 返回:无
  1101. 过程:OnConnect() -> ProcessChatMessageRequest()
  1102. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  1103. 2.SendDataDlg计时器里调用CConnectDlg对话框
  1104. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  1105. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  1106. 5.关闭对话框和断开连接;
  1107. */
  1108. //*********************************************//
  1109. void CMainFrame::ProcessChatMessageRequest2(BYTE *pData, int length)
  1110. {
  1111. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  1112. SendDataDlg dlg;
  1113. dlg.m_pData = pData;
  1114. dlg.m_nlength = length;
  1115. dlg.DoModal(); // DoModal未执行完时,就被其他函数销毁,导致局部函数dlg无效;
  1116. }
  1117. /************************************************************************/
  1118. /*
  1119. 函数:ProcessChatMessageRequest
  1120. 描述:对服务发送数据;
  1121. 参数:void *szDataBuf[IN], int nDataLen[IN]
  1122. 返回:发送成功与否;
  1123. */
  1124. /************************************************************************/
  1125. BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)
  1126. {
  1127. // 1.获取当前与服务器连接的id;
  1128. DWORD dwFromUserID = GetConnectionID();
  1129. // 2.设置通信类型为MSG_CHATMESSAGE_REQ;
  1130. WORD wMessageId = 0;
  1131. if (g_conntype == 0 && !g_bConnLYFZ)
  1132. wMessageId = (MSG_CHATMESSAGE_REQ + 0X3FFF);
  1133. else
  1134. wMessageId = MSG_CHATMESSAGE_REQ;
  1135. // 3.计算出欲发送的数据的长度 dwDataLen;
  1136. DWORD dwDataLen = sizeof(TCHAT_MESSAGE_STRU) + nDataLen;
  1137. BYTE *pSendData = new BYTE[dwDataLen];
  1138. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU*)pSendData;
  1139. memset(pChatMessage, 0x00, dwDataLen);
  1140. // 3.1.g_nYearpos==-1,表示连接是当前主数据库,其他值表示历史数据库;
  1141. if (g_nYearpos == -1)
  1142. g_sendhead.length[99] = g_nYearpos;
  1143. else
  1144. g_sendhead.length[99] = g_nYearpos * 32142953 + 10966236;
  1145. g_sendhead.length[98] = 987123768;
  1146. memcpy(pSendData, &g_sendhead, sizeof(g_sendhead));
  1147. #ifdef ENTERPRISE_VERSION
  1148. if (g_bBranchModify == 0)
  1149. #ifdef VC60
  1150. strcpy(pChatMessage->szFromUserName, g_branchname);
  1151. #else
  1152. strcpy_s(pChatMessage->szFromUserName, 30, g_branchname);
  1153. #endif
  1154. #endif
  1155. // 4.填充发送的数据结构;
  1156. pChatMessage->tCommonMsg.dwConnectionID = GetConnectionID();
  1157. pChatMessage->tCommonMsg.wMessageId = wMessageId;
  1158. pChatMessage->dwFromUserID = dwFromUserID;
  1159. pChatMessage->dwToUserID = g_nSendCode;//▲▲g_nSendCode在服务端同为dwToUserID;
  1160. pChatMessage->wMessageLen = nDataLen;
  1161. memcpy(pChatMessage->byFileContent, szDataBuf, nDataLen);
  1162. // 5.填充数据头;
  1163. TMessageHeader tHeader = { 0 };
  1164. tHeader.wMessageId = wMessageId;
  1165. tHeader.dwDataLen = dwDataLen;
  1166. // 6.发送数据;
  1167. BOOL bRet = 0;
  1168. unsigned long ulSendLen = m_tClientTunnel.net_Send(&tHeader, (void *)pChatMessage, dwDataLen);
  1169. if (ulSendLen != SOCKET_ERROR)
  1170. {
  1171. bRet = 1;
  1172. }
  1173. // 7.发送完毕,释放内存;
  1174. delete[] pSendData;
  1175. return bRet;
  1176. }
  1177. /************************************************************************/
  1178. /*
  1179. 函数:ProcessChatMessageResponse
  1180. 描述:接收服务返回的数据;
  1181. 参数:void *pResponse[IN]
  1182. 返回:无;
  1183. 调用关系:
  1184. 1.由 void CMainFrame::ProcessNetEvent(...)调用
  1185. */
  1186. /************************************************************************/
  1187. void CMainFrame::ProcessChatMessageResponse(void *pResponse)
  1188. {
  1189. // 1.数据空,直接返回;
  1190. if (NULL == pResponse)
  1191. return;
  1192. // 2.数据解析过程;
  1193. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pResponse;
  1194. int nMessageLen = pChatMessage->wMessageLen;
  1195. int nMessageLen2 = pChatMessage->dwToUserID; // 在服务器中被处理了,一般使dwToUserID=wMessageLen;
  1196. // Jeff.dwFromUserID==8888表示的内容是更新客户端skin界面数据,只有两处dwToUserID==211和dwToUserID==21;
  1197. // Jeff.其余的大多数都是 dwFromUserID = wMessageLen = dwToUserID 三者相等;
  1198. if (nMessageLen == nMessageLen2 && pChatMessage->dwFromUserID != 8888)
  1199. {
  1200. // 2.1.清除全局变量g_pData数据,用于保存接收的实际数据;
  1201. if (g_pData)
  1202. delete[]g_pData;
  1203. g_pData = NULL;
  1204. g_pData = new BYTE[nMessageLen];
  1205. memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
  1206. memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
  1207. g_nLeng = nMessageLen;
  1208. if (nMessageLen <= sizeof(DWORD))
  1209. {
  1210. memcpy(&g_ncount, pChatMessage->byFileContent, sizeof(DWORD));
  1211. }
  1212. KillTimer(2);
  1213. if (g_hSendWnd)
  1214. {
  1215. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);//关闭发送对话框;
  1216. }
  1217. }
  1218. else if (nMessageLen == nMessageLen2 && pChatMessage->dwFromUserID == 8888)
  1219. {
  1220. if (g_pData2)
  1221. delete[]g_pData2;
  1222. g_pData2 = NULL;
  1223. g_pData2 = new BYTE[nMessageLen2];
  1224. memcpy(g_pData2, pChatMessage->byFileContent, nMessageLen2);
  1225. g_nLeng2 = nMessageLen2;
  1226. KillTimer(2);
  1227. if (g_hSendWnd)
  1228. {
  1229. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1230. }
  1231. }
  1232. else // 登陆返回;
  1233. {
  1234. if (g_bConnLYFZ)
  1235. {
  1236. if (g_pData)
  1237. delete[]g_pData;
  1238. g_pData = NULL;
  1239. g_pData = new BYTE[nMessageLen];
  1240. memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
  1241. memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
  1242. g_nLeng = nMessageLen;
  1243. if (nMessageLen <= sizeof(DWORD))
  1244. {
  1245. memcpy(&g_ncount, pChatMessage->byFileContent, sizeof(DWORD));
  1246. }
  1247. KillTimer(2);
  1248. if (g_hSendWnd)
  1249. {
  1250. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1251. }
  1252. return;
  1253. }
  1254. if (g_conntype) // Jeff.g_conntype == 1,表示连接公司服务器的返回,用于集团版解析*.ly.com的IP地址;
  1255. {
  1256. // KillTimer(2);
  1257. char *szChatMessage = new char[nMessageLen + 1];
  1258. memset(szChatMessage, 0x00, nMessageLen + 1);
  1259. memcpy(szChatMessage, pChatMessage->byFileContent, nMessageLen);
  1260. g_server = szChatMessage;
  1261. delete[]szChatMessage;
  1262. CStdioFile fp;
  1263. CString path = g_mainpath + "\\ip.txt";
  1264. ::DeleteFile(path); // 删除ip.txt;
  1265. fp.Open(path, CFile::modeCreate | CFile::modeWrite);
  1266. fp.WriteString(g_server);
  1267. fp.Close();
  1268. g_conntype = 0;
  1269. // g_serverip=g_server;
  1270. return;
  1271. }
  1272. if (g_pData2 == NULL)
  1273. {
  1274. g_pData2 = new BYTE[nMessageLen2];
  1275. g_nLeng2 = 0;
  1276. }
  1277. memcpy(g_pData2 + g_nLeng2, pChatMessage->byFileContent, nMessageLen);
  1278. g_nLeng2 += nMessageLen;
  1279. if (g_nLeng2 == nMessageLen2)//已收完
  1280. {
  1281. KillTimer(2);
  1282. if (g_hSendWnd)
  1283. {
  1284. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1285. }
  1286. }
  1287. else
  1288. {
  1289. KillTimer(2);
  1290. SetTimer(2, g_ntimeout, NULL);
  1291. }
  1292. }
  1293. }
  1294. #if USE_SHARE_FLORD
  1295. /************************************************************************/
  1296. /*
  1297. Date: 2015-04-11
  1298. Author: Jeff
  1299. 函数:GetSharePathInfo
  1300. 描述:获取共享目录表的所有信息;
  1301. 参数:
  1302. 返回:成功返回TRUE;
  1303. 注意:获取的表记录存储在全局变量g_aryOfSharePathInfo中;
  1304. 调用约定:在登陆软件时调用,且必须连接的服务器是本店的;
  1305. */
  1306. /************************************************************************/
  1307. BOOL CMainFrame::GetSharePathInfo()
  1308. {
  1309. // 1.连接的数据库必须是本局域网的服务器;
  1310. if ( g_bAllBranch || !g_branchname.IsEmpty() || !g_branchip.IsEmpty() )
  1311. {
  1312. // 非当前局域网服务器;
  1313. return FALSE;
  1314. }
  1315. // 2.获取当前连接的分店域名是否与g_domain一致;
  1316. g_sendhead.bsql = 0;
  1317. g_sendhead.code[0] = 29;
  1318. g_sendhead.tabcount = 1;
  1319. g_pMainWnd->ProcessChatMessageRequest2(23);
  1320. if ( !g_bSendOK )
  1321. {
  1322. // 连接服务器失败;
  1323. return FALSE;
  1324. }
  1325. CArray<CStringArray,CStringArray> strArray;
  1326. DataToArray(&strArray);
  1327. CString strCurBranchDomain = _T("");
  1328. if ( strArray.GetSize() )
  1329. {
  1330. strCurBranchDomain = strArray.ElementAt(0).ElementAt(0);
  1331. if ( strCurBranchDomain.Find(_T(".ly.com")) == -1)
  1332. {
  1333. // 当前获取的域名有错;
  1334. return FALSE;
  1335. }
  1336. }
  1337. if ( g_domain.CompareNoCase(strCurBranchDomain) != 0)
  1338. {
  1339. // 当前连接的分店域名与局域网服务器域名不一致;
  1340. return FALSE;
  1341. }
  1342. // 3.获取可用的共享信息;//select * from NetShareInfo where enable = 1;
  1343. CString strFilter = _T("");
  1344. strFilter.Format(_T("enable = 1"));
  1345. int g_nYearposTemp=g_nYearpos;
  1346. g_nYearpos=-1;
  1347. g_bSendOK = 0;
  1348. g_sendhead.bsql = 0;
  1349. g_sendhead.code[0] = 236;
  1350. g_sendhead.tabcount = 1;
  1351. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  1352. g_nYearpos = g_nYearposTemp;
  1353. if ( !g_bSendOK )
  1354. {
  1355. // 获取共享信息失败;
  1356. return FALSE;
  1357. }
  1358. g_aryOfSharePathInfo.RemoveAll();
  1359. DataToArray(&g_aryOfSharePathInfo);
  1360. return g_aryOfSharePathInfo.GetSize() ? TRUE : FALSE;
  1361. }
  1362. #endif
  1363. BOOL CMainFrame::OnConnectBranch()
  1364. {
  1365. if (g_branchip == "")
  1366. {
  1367. return 0;
  1368. }
  1369. g_conntype = 0;
  1370. CString strServerAddress = g_branchip;
  1371. char *szServerAddress = strServerAddress.GetBuffer(0);
  1372. strServerAddress.ReleaseBuffer();
  1373. /*for Client, IP and Port can be 0,
  1374. and for Server, IP is LocalIP, and Port is Listening Port*/
  1375. int nResult = m_tClientTunnel.net_OpenSocket(
  1376. Transport_Client,
  1377. 0,
  1378. HandleClientNetEvent,
  1379. this);
  1380. if (TRANSPORT_OK != nResult)
  1381. {
  1382. // AfxMessageBox("网络初始化失败!");
  1383. return 0;
  1384. }
  1385. GetSysIniInfo(g_szModulePath, g_branchname + _T(".ini"));
  1386. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1387. DWORD wPort = g_dwCSPort;
  1388. #ifdef VC60
  1389. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1390. if (TRANSPORT_OK != nResult)
  1391. #else
  1392. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1393. if (!nResult)
  1394. #endif
  1395. {
  1396. m_tClientTunnel.net_CloseSocket();
  1397. return OnConnectBranch2();
  1398. }
  1399. return ProcessLoginRequest();
  1400. }
  1401. BOOL CMainFrame::OnConnectBranch2()
  1402. {
  1403. if (g_branchip2 == "")
  1404. {
  1405. return 0;
  1406. }
  1407. g_conntype = 0;
  1408. CString strServerAddress = g_branchip2;
  1409. char *szServerAddress = strServerAddress.GetBuffer(0);
  1410. strServerAddress.ReleaseBuffer();
  1411. /*for Client, IP and Port can be 0,
  1412. and for Server, IP is LocalIP, and Port is Listening Port*/
  1413. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1414. 0,
  1415. HandleClientNetEvent,
  1416. this);
  1417. if (TRANSPORT_OK != nResult)
  1418. {
  1419. // AfxMessageBox("网络初始化失败!");
  1420. return 0;
  1421. }
  1422. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1423. DWORD wPort = SERVER_PORT; // 5678
  1424. #ifdef VC60
  1425. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1426. if (TRANSPORT_OK != nResult)
  1427. #else
  1428. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1429. if (!nResult)
  1430. #endif
  1431. {
  1432. m_tClientTunnel.net_CloseSocket();
  1433. return 0;
  1434. }
  1435. return ProcessLoginRequest();
  1436. }
  1437. BOOL CMainFrame::OnConnectIP()
  1438. {
  1439. CString strServerAddress = g_server;
  1440. char *szServerAddress = strServerAddress.GetBuffer(0);
  1441. strServerAddress.ReleaseBuffer();
  1442. /*for Client, IP and Port can be 0,
  1443. and for Server, IP is LocalIP, and Port is Listening Port*/
  1444. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1445. 0,
  1446. HandleClientNetEvent,
  1447. this);
  1448. if (TRANSPORT_OK != nResult)
  1449. {
  1450. // AfxMessageBox("网络初始化失败!");
  1451. return 0;
  1452. }
  1453. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1454. DWORD wPort = SERVER_PORT; // 5678
  1455. #ifdef VC60
  1456. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1457. if (TRANSPORT_OK != nResult)
  1458. #else
  1459. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1460. if (!nResult)
  1461. #endif
  1462. {
  1463. m_tClientTunnel.net_CloseSocket();
  1464. return 0;
  1465. }
  1466. return ProcessLoginRequest();
  1467. }
  1468. //ip.txt
  1469. BOOL CMainFrame::OnConnectLYFZ()
  1470. {
  1471. CString strBranchIP = "lijiafz.vicp.net";
  1472. MyGetIPByName2(strBranchIP);
  1473. if (strBranchIP == "")
  1474. {
  1475. return 0;
  1476. }
  1477. g_conntype = 0; // Jeff.Delete at 2014.10.18
  1478. //g_conntype = 1;
  1479. CString strServerAddress = strBranchIP;
  1480. char *szServerAddress = strServerAddress.GetBuffer(0);
  1481. strServerAddress.ReleaseBuffer();
  1482. /*for Client, IP and Port can be 0,
  1483. and for Server, IP is LocalIP, and Port is Listening Port*/
  1484. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1485. 0,
  1486. HandleClientNetEvent,
  1487. this);
  1488. if (TRANSPORT_OK != nResult)
  1489. {
  1490. return 0;
  1491. }
  1492. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1493. DWORD wPort = GetPort();
  1494. #ifdef VC60
  1495. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1496. if (TRANSPORT_OK != nResult)
  1497. #else
  1498. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1499. if (!nResult)
  1500. #endif
  1501. {
  1502. m_tClientTunnel.net_CloseSocket();
  1503. return 0;
  1504. }
  1505. return ProcessLoginRequest();
  1506. }
  1507. BOOL CMainFrame::OnConnect()
  1508. {
  1509. // 1.Jeff 断开(如果有在在未关的连接)之前的连接;
  1510. OnDisconnect();
  1511. // 2.根据需要连接指定的服务器;
  1512. if (g_bBranchModify)
  1513. {
  1514. // Jeff.g_bBranchModify在g_bGenBranchData=1时,在welcome::OnTimer里被设置为1;
  1515. return OnConnectBranch();// 连接集团版分店;
  1516. }
  1517. if (g_bConnLYFZ)
  1518. {
  1519. return OnConnectLYFZ();// 连接公司服务端程序;
  1520. }
  1521. g_conntype = 0;
  1522. CString strServerAddress = g_server;
  1523. // 3.如果dbconfig.dat里保存的是*.ly.com的信息,就要读取ip.txt里的IP地址;
  1524. if (g_serverbak.Find(".ly.com") != -1)
  1525. {
  1526. strServerAddress = g_serverbak;
  1527. CStdioFile fp;
  1528. CString path = g_mainpath + "\\ip.txt";
  1529. if (::PathFileExists(path))
  1530. {
  1531. fp.Open(path, CFile::modeRead);
  1532. fp.ReadString(g_server);
  1533. fp.Close();
  1534. if (OnConnectIP())
  1535. {
  1536. // g_serverip=g_server;
  1537. return 1;
  1538. }
  1539. g_server = strServerAddress;
  1540. OnDisconnect();//MessageBox("ip失败");
  1541. }
  1542. g_conntype = 1; // Jeff.连接公司服务器,用于获取集团版*.ly.com的解析IP结果;
  1543. strServerAddress = "lijiafz.vicp.net";
  1544. MyGetIPByName2(strServerAddress);
  1545. if (strServerAddress.IsEmpty())
  1546. {
  1547. return 0;//OnConnect2();
  1548. }
  1549. }
  1550. else if (g_ntimeout == 29000)//非远程 30000
  1551. {
  1552. strServerAddress = g_serverarray.ElementAt(g_conpos);
  1553. }
  1554. // 4.如果没有IP.txt或dbconfig.dat里的不是ly.com信息,而是一般的计算机名称;
  1555. char *szServerAddress = strServerAddress.GetBuffer(0);
  1556. strServerAddress.ReleaseBuffer();
  1557. // AfxMessageBox("连接:"+strServerAddress);
  1558. /*for Client, IP and Port can be 0,
  1559. and for Server, IP is LocalIP, and Port is Listening Port*/
  1560. // 5.创建通信对象连接;
  1561. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1562. 0,
  1563. HandleClientNetEvent,
  1564. this);
  1565. if (TRANSPORT_OK != nResult)
  1566. {
  1567. return 0;
  1568. }
  1569. GetSysIniInfo();
  1570. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1571. DWORD wPort = g_dwCSPort;
  1572. if (g_conntype) wPort = GetPort();
  1573. // 6.连接公司服务器或影楼服务器;
  1574. #ifdef VC60
  1575. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1576. if (TRANSPORT_OK != nResult)
  1577. #else
  1578. nResult = m_tClientTunnel.net_Connect(szServerAddress,wPort);
  1579. if (!nResult)
  1580. #endif
  1581. {
  1582. m_tClientTunnel.net_CloseSocket();
  1583. if (g_conntype)// Jeff.连接公司服务器,用于获取集团版*.ly.com的解析IP结果;
  1584. {
  1585. return 0;//OnConnect2();
  1586. }
  1587. if (g_serverarray.GetSize() > 1)
  1588. {
  1589. if (g_conpos < (g_serverarray.GetSize() - 1))
  1590. {
  1591. g_conpos++;
  1592. return OnConnect();
  1593. }
  1594. else
  1595. {
  1596. g_conpos = 0;
  1597. return 0;
  1598. }
  1599. }
  1600. return 0;
  1601. }
  1602. return ProcessLoginRequest();
  1603. }
  1604. BOOL CMainFrame::OnConnect2()
  1605. {
  1606. g_conntype = 2;
  1607. CString server = "http://www.lyfz.net/download/ip.txt";
  1608. char buf[MAX_PATH];
  1609. ::GetTempPath(sizeof(buf), buf);
  1610. CString m_strTempDir = buf;
  1611. DWORD m_dwHttpRequestFlags = HSR_DOWNLOAD | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
  1612. INTERNET_PORT m_dwPort;
  1613. DWORD dwType;
  1614. CInternetSession m_cis;
  1615. CHttpConnection *m_pHttp;
  1616. CString m_strServer;
  1617. CString m_strIniPath;
  1618. AfxParseURL(server, dwType, m_strServer, m_strIniPath, m_dwPort);
  1619. if (dwType != AFX_INET_SERVICE_HTTP)
  1620. {
  1621. return 0;//OnConnect3();
  1622. }
  1623. m_cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5);
  1624. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1625. try
  1626. {
  1627. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1628. }
  1629. catch (CInternetException* pEx)
  1630. {
  1631. return 0;//OnConnect3();
  1632. }
  1633. CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_GET,
  1634. m_strIniPath, NULL, 1, NULL, NULL, m_dwHttpRequestFlags);
  1635. try
  1636. {
  1637. pFile->SendRequest();
  1638. }
  1639. catch (CInternetException* pEx)
  1640. {
  1641. pFile->Close();
  1642. return 0;//OnConnect3();
  1643. }
  1644. if (pFile)
  1645. {
  1646. CStdioFile csf;
  1647. csf.Open(m_strTempDir + "\\ip.txt", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
  1648. char buf[2048];
  1649. int n;
  1650. while ((n = pFile->Read(buf, 2048)) > 0)
  1651. csf.Write(buf, n);
  1652. csf.Close();
  1653. pFile->Close();
  1654. }
  1655. CString strServerAddress;
  1656. CStdioFile fp;
  1657. fp.Open(m_strTempDir + "\\ip.txt", CFile::modeRead);
  1658. fp.ReadString(strServerAddress);
  1659. fp.Close();
  1660. char *szServerAddress = strServerAddress.GetBuffer(0);
  1661. strServerAddress.ReleaseBuffer();
  1662. /*for Client, IP and Port can be 0,
  1663. and for Server, IP is LocalIP, and Port is Listening Port*/
  1664. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1665. 0,
  1666. HandleClientNetEvent,
  1667. this);
  1668. if (TRANSPORT_OK != nResult)
  1669. {
  1670. return 0;
  1671. }
  1672. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1673. DWORD wPort = SERVER_PORT; // 5678
  1674. if (g_conntype)wPort = GetPort();
  1675. #ifdef VC60
  1676. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1677. if (TRANSPORT_OK != nResult)
  1678. #else
  1679. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1680. if (!nResult)
  1681. #endif
  1682. {
  1683. m_tClientTunnel.net_CloseSocket();
  1684. return 0;//OnConnect3();
  1685. }
  1686. return ProcessLoginRequest();
  1687. }
  1688. BOOL CMainFrame::OnConnect3()
  1689. {
  1690. g_conntype = 3;
  1691. CString server = "http://photo.bjlyfz.com/download/ip.txt";
  1692. char buf[MAX_PATH];
  1693. ::GetTempPath(sizeof(buf), buf);
  1694. CString m_strTempDir = buf;
  1695. DWORD m_dwHttpRequestFlags = HSR_DOWNLOAD | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
  1696. INTERNET_PORT m_dwPort;
  1697. DWORD dwType;
  1698. CInternetSession m_cis;
  1699. CHttpConnection *m_pHttp;
  1700. CString m_strServer;
  1701. CString m_strIniPath;
  1702. AfxParseURL(server, dwType, m_strServer, m_strIniPath, m_dwPort);
  1703. if (dwType != AFX_INET_SERVICE_HTTP)
  1704. {
  1705. return FALSE;
  1706. }
  1707. m_cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5);
  1708. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1709. try
  1710. {
  1711. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1712. }
  1713. catch (CInternetException* pEx)
  1714. {
  1715. return false;
  1716. }
  1717. CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_GET,
  1718. m_strIniPath, NULL, 1, NULL, NULL, m_dwHttpRequestFlags);
  1719. try
  1720. {
  1721. pFile->SendRequest();
  1722. }
  1723. catch (CInternetException* pEx)
  1724. {
  1725. pFile->Close();
  1726. return false;
  1727. }
  1728. if (pFile)
  1729. {
  1730. CStdioFile csf;
  1731. csf.Open(m_strTempDir + "\\ip.txt", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
  1732. char buf[2048];
  1733. int n;
  1734. while ((n = pFile->Read(buf, 2048)) > 0)
  1735. csf.Write(buf, n);
  1736. csf.Close();
  1737. pFile->Close();
  1738. }
  1739. CString strServerAddress;
  1740. CStdioFile fp;
  1741. fp.Open(m_strTempDir + "\\ip.txt", CFile::modeRead);
  1742. fp.ReadString(strServerAddress);
  1743. fp.Close();
  1744. char *szServerAddress = strServerAddress.GetBuffer(0);
  1745. strServerAddress.ReleaseBuffer();
  1746. /*for Client, IP and Port can be 0,
  1747. and for Server, IP is LocalIP, and Port is Listening Port*/
  1748. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1749. 0,
  1750. HandleClientNetEvent,
  1751. this);
  1752. if (TRANSPORT_OK != nResult)
  1753. {
  1754. return 0;
  1755. }
  1756. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1757. DWORD wPort = SERVER_PORT; // 5678
  1758. if (g_conntype)wPort = GetPort();
  1759. #ifdef VC60
  1760. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1761. if (TRANSPORT_OK != nResult)
  1762. #else
  1763. nResult = m_tClientTunnel.net_Connect(szServerAddress, wPort);
  1764. if (!nResult)
  1765. #endif
  1766. {
  1767. m_tClientTunnel.net_CloseSocket();
  1768. return 0;
  1769. }
  1770. return ProcessLoginRequest();
  1771. }
  1772. void CMainFrame::ProcessNetEvent(int nEventType, void *pRecvMsg, DWORD dwDataLen)
  1773. {
  1774. //printf("Jeff:ProcessNetEvent\n\n");//Jeff Printf;
  1775. if (Transport_ReadEv == nEventType)
  1776. {
  1777. if (NULL == pRecvMsg) return;
  1778. TMessageHeader* pHeader = (TMessageHeader *)pRecvMsg;
  1779. char *pDataBuf = (char *)pRecvMsg + MESSAGE_HEADER_LEN;
  1780. WORD dwMessageID = pHeader->wMessageId;
  1781. switch (dwMessageID)
  1782. {
  1783. case MSG_LOGIN_RESP:
  1784. case (MSG_LOGIN_RESP + 0X2FFF) :
  1785. {
  1786. LOGIN_RESULT_STRU tLoginResult = { 0 };
  1787. memcpy(&tLoginResult, pDataBuf, sizeof(LOGIN_RESULT_STRU));
  1788. ProcessLoginResponse(&tLoginResult);
  1789. break;
  1790. }
  1791. case MSG_USERINFO_RESP:
  1792. {
  1793. break;
  1794. }
  1795. case MSG_LOGOUT_RESP:
  1796. {
  1797. break;
  1798. }
  1799. case MSG_CHATMESSAGE_RESP:
  1800. case (MSG_CHATMESSAGE_RESP + 0X4FFF) :
  1801. {
  1802. static int i = 0;
  1803. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pDataBuf;
  1804. ProcessChatMessageResponse((void *)pChatMessage);
  1805. break;
  1806. }
  1807. default:
  1808. {
  1809. break;
  1810. }
  1811. }
  1812. }
  1813. else if (Transport_CloseEv == nEventType)
  1814. {
  1815. OnDisconnect();
  1816. }
  1817. }
  1818. //extern BOOL g_bNeedCoon;
  1819. extern BOOL EncryptFile2(BYTE *buffer, DWORD leng, PCHAR szPassword);
  1820. void CMainFrame::OnTimer(UINT nIDEvent)
  1821. {
  1822. // TODO: Add your message handler code here and/or call default
  1823. if (1 == nIDEvent)
  1824. {
  1825. KillTimer(nIDEvent);
  1826. BOOL checked = AfxGetApp()->GetProfileInt(LYFZVERSION, "status", 0);//status:此机用选片菜单项
  1827. // checked==1:此机用选片菜单项
  1828. // g_bStaffAchievementShow==1:此机用于员工业绩查看
  1829. if (checked && g_bStaffAchievementShow == 0) // .此机用选片菜单项;
  1830. {
  1831. KillTimer(3);
  1832. #ifdef NEW_SKIN
  1833. Welcome weldlg;
  1834. weldlg.DoModal();
  1835. #endif
  1836. ChoosePhotoSkin dlg;
  1837. dlg.SetLiaPath("1.lia");
  1838. if (dlg.DoModal() != IDOK)
  1839. {
  1840. PostMessage(WM_QUIT);
  1841. return;
  1842. }
  1843. if (dlg.m_exitcode == 3)
  1844. {
  1845. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  1846. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  1847. }
  1848. else
  1849. {
  1850. ShowWindow(SW_SHOW);
  1851. #ifdef NEW_SKIN
  1852. if (m_pMainFrimDlg2 == NULL)
  1853. {
  1854. m_pMainFrimDlg2 = new MainFrimDlg2;
  1855. m_pMainFrimDlg2->SetLiaPath("10.lia");
  1856. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  1857. }
  1858. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1859. #endif
  1860. }
  1861. }
  1862. else if (g_bStaffAchievementShow == 0) // .非选片、非查看员工业绩;
  1863. {
  1864. #ifdef NEW_SKIN
  1865. g_bNoConnDlg = 1;
  1866. Welcome weldlg;
  1867. weldlg.DoModal();
  1868. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1869. ShowWindow(SW_SHOW);
  1870. g_bNoConnDlg = 0;
  1871. if (g_bNoLoginLia) // Jeff.OnCreate里判断skin文件有5.lia, g_bNoLoginLia = 0, 无 g_bNoLoginLia = 1;
  1872. {
  1873. Login dlg;
  1874. dlg.SetLiaPath("5.lia");
  1875. dlg.DoModal();
  1876. }
  1877. else
  1878. {
  1879. Login3 dlg;
  1880. dlg.SetLiaPath("5.lia"); // Login3的父类为MyDlg,在BOOL MyDlg::OnInitDialog()里调用了纯虚函数Init();
  1881. dlg.DoModal();
  1882. // 数据库完整性提醒;
  1883. if ( 1 == atoi(g_cominfoarray.ElementAt(0).ElementAt(159)) )
  1884. {
  1885. MessageBox(_T("贵店数据库可能已损坏,请尽快联系售后人员进行确认或维护,联系电话:0752-2398865 或 4006-067-068!"), _T("重要提示:"), MB_OK | MB_TOPMOST /*| MB_SETFOREGROUND*/ | MB_ICONWARNING);
  1886. if ( !g_bRunOnCorruptdb )
  1887. exit(0);
  1888. }
  1889. }
  1890. if (g_user.bLongin && g_pMainWnd2)
  1891. {
  1892. g_pMainWnd2->ShowBar(TRUE,TRUE);
  1893. InsideMsg();
  1894. }
  1895. #else
  1896. ShowWindow(SW_SHOW);
  1897. if (g_bNoLoginLia)
  1898. {
  1899. Login dlg;
  1900. dlg.SetLiaPath ("5.lia");
  1901. dlg.DoModal();
  1902. }
  1903. else
  1904. {
  1905. Login3 dlg;
  1906. dlg.SetLiaPath ("5.lia");
  1907. dlg.DoModal();
  1908. }
  1909. #endif
  1910. }
  1911. if (g_hmouse == NULL)
  1912. {
  1913. g_hmouse = SetWindowsHookEx(WH_MOUSE, MouseProc, 0, ::GetCurrentThreadId());
  1914. }
  1915. }
  1916. else if (2 == nIDEvent) //29秒后,若连接和发送未完成,将关闭连接和发送框;
  1917. {
  1918. KillTimer(2);
  1919. if (g_hConnectWnd)
  1920. ::PostMessage(g_hConnectWnd, WM_CLOSE, 0, 0);
  1921. if (g_hSendWnd)
  1922. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1923. if (g_bStaffAchievementShow == 0 && g_bConnLYFZ == 0)
  1924. {
  1925. if (g_bGenBranchData == 0)
  1926. {
  1927. if (g_branchip != "")
  1928. AfxMessageBox("连接分店:" + g_branchname + "失败!", MB_ICONINFORMATION);
  1929. else
  1930. AfxMessageBox("连接服务器失败!", MB_ICONINFORMATION);
  1931. }
  1932. OnDisconnect();
  1933. }
  1934. g_bSendOK = 0;
  1935. g_bNeedCoon = 1;
  1936. }
  1937. else if (3 == nIDEvent)
  1938. {
  1939. KillTimer(3);
  1940. #ifdef NEW_SKIN
  1941. Welcome weldlg;
  1942. weldlg.DoModal();
  1943. #endif
  1944. ShowWindow(SW_SHOW);
  1945. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1946. g_sendhead.bsql = 0;
  1947. g_sendhead.code[0] = 24;
  1948. g_sendhead.code[1] = 1;
  1949. g_sendhead.tabcount = 2;
  1950. g_pMainWnd->ProcessChatMessageRequest2(1);
  1951. if (g_bSendOK == 0)
  1952. {
  1953. return;
  1954. }
  1955. CArray<CStringArray, CStringArray>patharray;
  1956. CArray<CStringArray, CStringArray>userarray;
  1957. DataToArray(&g_cominfoarray, &g_hisyeararray);
  1958. g_userarray.SetSize(userarray.GetSize(), 1);
  1959. int count = 0;
  1960. for (int ii = 0; ii < userarray.GetSize(); ii++)
  1961. {
  1962. if (userarray.ElementAt(ii).ElementAt(10) == "在职")
  1963. g_userarray.ElementAt(count++).Copy(userarray.ElementAt(ii));
  1964. }
  1965. g_userarray.SetSize(count, 1);
  1966. StaffAchievementShowAll dlg;
  1967. g_pMainWnd->GetOcx();
  1968. dlg.DoModal();
  1969. }
  1970. else if (5 == nIDEvent)
  1971. {
  1972. if (g_bInSkin)
  1973. {
  1974. OutputDebugString("使用皮肤\n");
  1975. return;
  1976. }
  1977. if (g_nAutoShowStaffAchievement == 1){
  1978. OutputDebugString("用于选片\n");
  1979. return;
  1980. }
  1981. if (g_bAllBranch){
  1982. OutputDebugString("多店汇总当中\n");
  1983. return;
  1984. }
  1985. if (g_user.bLongin)
  1986. {
  1987. // m_Mdi.CloseAll();
  1988. g_pMainWnd->OnCommandMenu(IDM_Logout);
  1989. }
  1990. /* g_nAutoShowStaffAchievement=1;
  1991. KillTimer(5);
  1992. StaffAchievementShowAll dlg;
  1993. g_pMainWnd->GetOcx();
  1994. dlg.DoModal ();*/
  1995. }
  1996. else if (6 == nIDEvent)
  1997. {
  1998. static BOOL bDouble = 0;
  1999. bDouble = !bDouble;
  2000. if (bDouble)
  2001. g_pMainWnd->OnCommandMenu(IDM_TAKEAWAYBOOK);
  2002. else
  2003. g_pMainWnd->OnCommandMenu(IDM_CLIENTMONEY);
  2004. }
  2005. else if (7 == nIDEvent)
  2006. {
  2007. // Jeff,当g_bSendLYFZ==TRUE时;
  2008. // 向lijiafz.vicp.net发送影楼信息,防止有盗版用户;
  2009. KillTimer(7);
  2010. if (g_bInSkin)return;
  2011. if (g_nAutoShowStaffAchievement == 1)return;
  2012. if (g_bAllBranch)return;
  2013. CString str = g_sInfo;
  2014. g_bConnLYFZ = 1; // Jeff指示连接的服务器为lijiafz.vicp.net
  2015. // 断开当前连接;
  2016. OnDisconnect();
  2017. BYTE *pData = new BYTE[str.GetLength()];
  2018. memcpy(pData, str.GetBuffer(0), str.GetLength());
  2019. str.ReleaseBuffer();
  2020. EncryptFile2(pData, str.GetLength(), "888666333");
  2021. g_nSendCode = 16;
  2022. g_pMainWnd->ProcessChatMessageRequest2(pData, str.GetLength());
  2023. g_nSendCode = 0;
  2024. delete[]pData;
  2025. OnDisconnect();
  2026. g_bSendLYFZ = 0;
  2027. g_bConnLYFZ = 0;
  2028. if (g_bSendOK)
  2029. {
  2030. char *pStr = new char[g_nLeng + 1];
  2031. memset(pStr, 0, g_nLeng + 1);
  2032. memcpy(pStr, g_pData, g_nLeng);
  2033. CString str = pStr;
  2034. delete[]pStr;
  2035. if (str == "g_bInSkin")
  2036. {
  2037. g_sendhead.bsql = 1;
  2038. g_pMainWnd->ProcessChatMessageRequest2("update version set [setcheck1]='ok'");
  2039. }
  2040. }
  2041. }
  2042. }
  2043. void CMainFrame::OnOutbarNotify(CString strMsg)
  2044. {
  2045. if (g_user.bLongin == 0)
  2046. {
  2047. if (g_bNoLoginLia)
  2048. {
  2049. Login dlg;
  2050. dlg.SetLiaPath("5.lia");
  2051. dlg.DoModal();
  2052. }
  2053. else
  2054. {
  2055. Login3 dlg;
  2056. dlg.SetLiaPath("5.lia");
  2057. dlg.DoModal();
  2058. }
  2059. return;
  2060. if (g_user.bLongin == 0)return;
  2061. }
  2062. else
  2063. {
  2064. InsideMsg();
  2065. }
  2066. ResetTimer();
  2067. if (strMsg == "开单")
  2068. {
  2069. if (IsHasRights(0) == 0)return;
  2070. Booking2 dlg;
  2071. dlg.DoModal();
  2072. return;
  2073. }
  2074. else if (strMsg == "拍照")
  2075. {
  2076. if (IsHasRights(1) == 0)return;
  2077. UINT nID = 1;
  2078. LPSTR pName;
  2079. pName = (LPSTR)(LPCSTR)"拍照";
  2080. OPEN_MENU(TakeFrom);
  2081. return;
  2082. }
  2083. else if (strMsg == "修片")
  2084. {
  2085. if (IsHasRights(1) == 0)return;
  2086. UINT nID = 1;
  2087. LPSTR pName;
  2088. pName = (LPSTR)(LPCSTR)"修片";
  2089. OPEN_MENU(BeautifySkinFrom);
  2090. return;
  2091. }
  2092. else if (strMsg == "选片")
  2093. {
  2094. if (IsHasRights(2) == 0)return;
  2095. UINT nID = 1;
  2096. LPSTR pName;
  2097. pName = (LPSTR)(LPCSTR)"选片";
  2098. OPEN_MENU(ChoosePhotoForm);
  2099. return;
  2100. }
  2101. else if (strMsg == "精修")
  2102. {
  2103. if (IsHasRights(2) == 0)return;
  2104. UINT nID = 1;
  2105. LPSTR pName;
  2106. pName = (LPSTR)(LPCSTR)"精修";
  2107. OPEN_MENU(BeautifySkinFrom2);
  2108. return;
  2109. }
  2110. else if (strMsg == "设计")
  2111. {
  2112. if (IsHasRights(2) == 0)return;
  2113. UINT nID = 1;
  2114. LPSTR pName;
  2115. pName = (LPSTR)(LPCSTR)"设计";
  2116. OPEN_MENU(DesignFrom);
  2117. return;
  2118. }
  2119. else if (strMsg == "数码安排")
  2120. {
  2121. UINT nID = 1;
  2122. LPSTR pName;
  2123. pName = (LPSTR)(LPCSTR)"数码安排";
  2124. OPEN_MENU(DigitalWork);
  2125. return;
  2126. }
  2127. else if (strMsg == "刻盘")
  2128. {
  2129. UINT nID = 1;
  2130. LPSTR pName;
  2131. pName = (LPSTR)(LPCSTR)"刻盘";
  2132. OPEN_MENU(BurnCD);
  2133. return;
  2134. }
  2135. else if (strMsg == "相片冲印")
  2136. {
  2137. UINT nID = 1;
  2138. LPSTR pName;
  2139. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  2140. OPEN_MENU(PhotoPrintFrom);
  2141. return;
  2142. }
  2143. else if (strMsg == "发片/取件")
  2144. {
  2145. if (IsHasRights(3) == 0)return;
  2146. UINT nID = 1;
  2147. LPSTR pName;
  2148. pName = (LPSTR)(LPCSTR)"发片/取件";
  2149. OPEN_MENU(outsourcing);
  2150. return;
  2151. }
  2152. else if (strMsg == "满意度")
  2153. {
  2154. UINT nID = 1;
  2155. LPSTR pName;
  2156. pName = (LPSTR)(LPCSTR)"满意度";
  2157. OPEN_MENU(Satisfaction);
  2158. return;
  2159. }
  2160. else if (strMsg == "满意度汇总")
  2161. {
  2162. UINT nID = 1;
  2163. LPSTR pName;
  2164. pName = (LPSTR)(LPCSTR)"满意度汇总";
  2165. OPEN_MENU(SatisfactionReportForm);
  2166. return;
  2167. }
  2168. #if JEFF_DELETE_ON // 2014.11.14-PM 16:20
  2169. else if (strMsg == "回复统计")
  2170. {
  2171. UINT nID = 1;
  2172. LPSTR pName;
  2173. pName = (LPSTR)(LPCSTR)"回复统计";
  2174. OPEN_MENU(MsgReg2);
  2175. return;
  2176. }
  2177. #endif
  2178. /* else if(strMsg=="取件")
  2179. {
  2180. if(IsHasRights(3)==0)return;
  2181. UINT nID=1;
  2182. LPSTR pName ;
  2183. pName = (LPSTR)(LPCSTR)"取件";
  2184. OPEN_MENU(TakeAwayFrom);
  2185. return;
  2186. }*/
  2187. else if (strMsg == "其它收入")
  2188. {
  2189. if (IsHasRightsnew(16) == 0)return;
  2190. // if(IsHasRightsnew(48)==0)return;
  2191. UINT nID = 1;
  2192. LPSTR pName;
  2193. pName = (LPSTR)(LPCSTR)"其它收入";
  2194. OPEN_MENU(IncomeInput);
  2195. return;
  2196. }
  2197. else if (strMsg == "其它二销")
  2198. {
  2199. if (IsHasRightsnew(16) == 0)return;
  2200. UINT nID = 1;
  2201. LPSTR pName;
  2202. pName = (LPSTR)(LPCSTR)"其它二销";
  2203. OPEN_MENU(IncomeInput2);
  2204. return;
  2205. }
  2206. else if (strMsg == "员工奖罚")
  2207. {
  2208. if (IsHasRightsnew(16) == 0)return;
  2209. UINT nID = 1;
  2210. LPSTR pName;
  2211. pName = (LPSTR)(LPCSTR)"员工奖罚";
  2212. OPEN_MENU(IncomeInput3);
  2213. return;
  2214. }
  2215. else if (strMsg == "员工奖惩")
  2216. {
  2217. if (IsHasRightsnew(16) == 0)return;
  2218. UINT nID = 1;
  2219. LPSTR pName;
  2220. pName = (LPSTR)(LPCSTR)"员工奖惩";
  2221. OPEN_MENU(IncomeInput4);
  2222. return;
  2223. }
  2224. else if (strMsg == "订单收款")
  2225. {
  2226. if (IsHasRights(17) == 0)return;
  2227. UINT nID = 1;
  2228. LPSTR pName;
  2229. pName = (LPSTR)(LPCSTR)"订单收款";
  2230. OPEN_MENU(FinanceForm);
  2231. return;
  2232. }
  2233. else if (strMsg == "日财务表")
  2234. {
  2235. if (IsHasRightsnew(22) == 0)return;
  2236. UINT nID = 2;
  2237. LPSTR pName;
  2238. pName = (LPSTR)(LPCSTR)"日财务表";
  2239. OPEN_MENU(DailyForm);
  2240. return;
  2241. }
  2242. else if (strMsg == "提成比例")
  2243. {
  2244. #ifndef ENTERPRISE_VERSION
  2245. #ifndef CHILD_VERSION
  2246. #ifdef BASIC_VERSION
  2247. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2248. {
  2249. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2250. exit(0);return;
  2251. }
  2252. #else
  2253. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2254. {
  2255. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2256. exit(0);return;
  2257. }
  2258. #endif
  2259. #else
  2260. #ifdef BASIC_VERSION
  2261. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2262. {
  2263. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2264. exit(0);return;
  2265. }
  2266. #else
  2267. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2268. {
  2269. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2270. exit(0); return;
  2271. }
  2272. #endif
  2273. #endif
  2274. #else
  2275. #ifndef CHILD_VERSION
  2276. #ifdef BASIC_VERSION
  2277. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2278. {
  2279. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2280. exit(0); return;
  2281. }
  2282. #else
  2283. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2284. {
  2285. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2286. exit(0); return;
  2287. }
  2288. #endif
  2289. #else
  2290. #ifdef BASIC_VERSION
  2291. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2292. {
  2293. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2294. exit(0);return;
  2295. }
  2296. #else
  2297. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2298. {
  2299. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2300. exit(0); return;
  2301. }
  2302. #endif
  2303. #endif
  2304. #endif
  2305. UINT nID = 2;
  2306. LPSTR pName;
  2307. pName = (LPSTR)(LPCSTR)"提成比例";
  2308. OPEN_MENU(SalarySet2);
  2309. return;
  2310. }
  2311. //else if(strMsg=="员工工作")
  2312. else if (strMsg == "计件提成")
  2313. {
  2314. UINT nID = 2;
  2315. LPSTR pName;
  2316. //pName = (LPSTR)(LPCSTR)"员工工作";
  2317. pName = (LPSTR)(LPCSTR)"计件提成";
  2318. OPEN_MENU(SalarySet3);
  2319. return;
  2320. }
  2321. else if (strMsg == "工资管理")
  2322. {
  2323. #ifndef ENTERPRISE_VERSION
  2324. #ifndef CHILD_VERSION
  2325. #ifdef BASIC_VERSION
  2326. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2327. {
  2328. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2329. exit(0);return;
  2330. }
  2331. #else
  2332. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2333. {
  2334. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2335. exit(0);return;
  2336. }
  2337. #endif
  2338. #else
  2339. #ifdef BASIC_VERSION
  2340. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2341. {
  2342. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2343. exit(0);return;
  2344. }
  2345. #else
  2346. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2347. {
  2348. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2349. exit(0); return;
  2350. }
  2351. #endif
  2352. #endif
  2353. #else
  2354. #ifndef CHILD_VERSION
  2355. #ifdef BASIC_VERSION
  2356. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2357. {
  2358. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2359. exit(0); return;
  2360. }
  2361. #else
  2362. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2363. {
  2364. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2365. exit(0); return;
  2366. }
  2367. #endif
  2368. #else
  2369. #ifdef BASIC_VERSION
  2370. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2371. {
  2372. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2373. exit(0);return;
  2374. }
  2375. #else
  2376. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2377. {
  2378. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2379. exit(0); return;
  2380. }
  2381. #endif
  2382. #endif
  2383. #endif
  2384. UINT nID = 2;
  2385. LPSTR pName;
  2386. pName = (LPSTR)(LPCSTR)"工资管理";
  2387. OPEN_MENU(MySalary);
  2388. return;
  2389. }
  2390. else if (strMsg == "客人付款")
  2391. {
  2392. UINT nID = 2;
  2393. LPSTR pName;
  2394. pName = (LPSTR)(LPCSTR)"客人付款";
  2395. OPEN_MENU(ClientMoney);
  2396. return;
  2397. }
  2398. else if (strMsg == "工资报表")
  2399. {
  2400. #ifndef ENTERPRISE_VERSION
  2401. #ifndef CHILD_VERSION
  2402. #ifdef BASIC_VERSION
  2403. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2404. {
  2405. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2406. exit(0);return;
  2407. }
  2408. #else
  2409. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2410. {
  2411. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2412. exit(0);return;
  2413. }
  2414. #endif
  2415. #else
  2416. #ifdef BASIC_VERSION
  2417. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2418. {
  2419. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2420. exit(0);return;
  2421. }
  2422. #else
  2423. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2424. {
  2425. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2426. exit(0); return;
  2427. }
  2428. #endif
  2429. #endif
  2430. #else
  2431. #ifndef CHILD_VERSION
  2432. #ifdef BASIC_VERSION
  2433. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2434. {
  2435. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2436. exit(0); return;
  2437. }
  2438. #else
  2439. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2440. {
  2441. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2442. exit(0); return;
  2443. }
  2444. #endif
  2445. #else
  2446. #ifdef BASIC_VERSION
  2447. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2448. {
  2449. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2450. exit(0);return;
  2451. }
  2452. #else
  2453. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2454. {
  2455. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2456. exit(0); return;
  2457. }
  2458. #endif
  2459. #endif
  2460. #endif
  2461. if (IsHasRightsnew(25) == 0)return;
  2462. UINT nID = 2;
  2463. LPSTR pName;
  2464. pName = (LPSTR)(LPCSTR)"工资报表";
  2465. g_ncount = 100;
  2466. OPEN_MENU(MySalary);
  2467. return;
  2468. }
  2469. else if (strMsg == "员工业绩")
  2470. {
  2471. #ifndef ENTERPRISE_VERSION
  2472. #ifndef CHILD_VERSION
  2473. #ifdef BASIC_VERSION
  2474. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2475. {
  2476. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2477. exit(0);return;
  2478. }
  2479. #else
  2480. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2481. {
  2482. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2483. exit(0);return;
  2484. }
  2485. #endif
  2486. #else
  2487. #ifdef BASIC_VERSION
  2488. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2489. {
  2490. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2491. exit(0);return;
  2492. }
  2493. #else
  2494. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2495. {
  2496. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2497. exit(0); return;
  2498. }
  2499. #endif
  2500. #endif
  2501. #else
  2502. #ifndef CHILD_VERSION
  2503. #ifdef BASIC_VERSION
  2504. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2505. {
  2506. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2507. exit(0); return;
  2508. }
  2509. #else
  2510. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2511. {
  2512. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2513. exit(0); return;
  2514. }
  2515. #endif
  2516. #else
  2517. #ifdef BASIC_VERSION
  2518. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2519. {
  2520. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2521. exit(0);return;
  2522. }
  2523. #else
  2524. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2525. {
  2526. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2527. exit(0); return;
  2528. }
  2529. #endif
  2530. #endif
  2531. #endif
  2532. if (IsHasRightsnew(33) == 0)return;
  2533. UINT nID = 2;
  2534. LPSTR pName;
  2535. pName = (LPSTR)(LPCSTR)"员工业绩";
  2536. OPEN_MENU(StaffAchievement);
  2537. return;
  2538. }
  2539. else if (strMsg == "订单客户")
  2540. {
  2541. UINT nID = 2;
  2542. LPSTR pName;
  2543. pName = (LPSTR)(LPCSTR)"订单客户";
  2544. g_dx += 10000;
  2545. OPEN_MENU(CClientForm);
  2546. if (g_dx >= 10000)g_dx -= 10000;
  2547. return;
  2548. }
  2549. else if (strMsg == "意向客户")
  2550. {
  2551. UINT nID = 2;
  2552. LPSTR pName;
  2553. pName = (LPSTR)(LPCSTR)"意向客户";
  2554. OPEN_MENU(Client2Form);
  2555. return;
  2556. }
  2557. else if (strMsg == "老客户")
  2558. {
  2559. UINT nID = 2;
  2560. LPSTR pName;
  2561. pName = (LPSTR)(LPCSTR)"老客户";
  2562. OPEN_MENU(OldClient);
  2563. return;
  2564. }
  2565. else if (strMsg == "客户来电")
  2566. {
  2567. UINT nID = 2;
  2568. LPSTR pName;
  2569. pName = (LPSTR)(LPCSTR)"客户来电";
  2570. OPEN_MENU(PhoneRecord);
  2571. return;
  2572. }
  2573. else if (strMsg == "拨出电话")
  2574. {
  2575. UINT nID = 2;
  2576. LPSTR pName;
  2577. pName = (LPSTR)(LPCSTR)"拨出电话";
  2578. OPEN_MENU(PhoneRecordOut);
  2579. return;
  2580. }
  2581. else if (strMsg == "未接来电")
  2582. {
  2583. UINT nID = 2;
  2584. LPSTR pName;
  2585. pName = (LPSTR)(LPCSTR)"未接来电";
  2586. OPEN_MENU(MissCall);
  2587. return;
  2588. }
  2589. else if (strMsg == "客户流失")
  2590. {
  2591. UINT nID = 2;
  2592. LPSTR pName;
  2593. pName = (LPSTR)(LPCSTR)"客户流失";
  2594. OPEN_MENU(ClientReasonChart);
  2595. return;
  2596. }
  2597. else if (strMsg == "客户来源")
  2598. {
  2599. UINT nID = 2;
  2600. LPSTR pName;
  2601. pName = (LPSTR)(LPCSTR)"客户来源";
  2602. OPEN_MENU(ClientFromChart);
  2603. return;
  2604. }
  2605. else if (strMsg == "月财务表")
  2606. {
  2607. if (IsHasRightsnew(23) == 0)return;
  2608. UINT nID = 2;
  2609. LPSTR pName;
  2610. pName = (LPSTR)(LPCSTR)"月财务表";
  2611. OPEN_MENU(MonthForm);
  2612. return;
  2613. }
  2614. else if (strMsg == "支出报表")
  2615. {
  2616. if (IsHasRightsnew(23) == 0)return;
  2617. UINT nID = 2;
  2618. LPSTR pName;
  2619. pName = (LPSTR)(LPCSTR)"支出报表";
  2620. OPEN_MENU(MonthForm2);
  2621. return;
  2622. }
  2623. else if (strMsg == "年财务表")
  2624. {
  2625. if (IsHasRightsnew(24) == 0)return;
  2626. UINT nID = 2;
  2627. LPSTR pName;
  2628. pName = (LPSTR)(LPCSTR)"年财务表";
  2629. OPEN_MENU(YearForm);
  2630. return;
  2631. }
  2632. else if (strMsg == "年财务图表")
  2633. {
  2634. if (IsHasRightsnew(24) == 0)return;
  2635. GetOcx();
  2636. UINT nID = 2;
  2637. LPSTR pName;
  2638. pName = (LPSTR)(LPCSTR)"年财务图表";
  2639. OPEN_MENU(YearForm2);
  2640. return;
  2641. }
  2642. else if (strMsg == "订单图表")
  2643. {
  2644. GetOcx();
  2645. UINT nID = 2;
  2646. LPSTR pName;
  2647. pName = (LPSTR)(LPCSTR)"订单图表";
  2648. OPEN_MENU(DinDanForm);
  2649. return;
  2650. }
  2651. #ifdef ENTERPRISE_VERSION
  2652. else if (strMsg == "订单报表")
  2653. {
  2654. GetOcx();
  2655. UINT nID = 2;
  2656. LPSTR pName;
  2657. pName = (LPSTR)(LPCSTR)"订单报表2";
  2658. OPEN_MENU(DinDanFromBranch);
  2659. return;
  2660. }
  2661. else if (strMsg == "财务图表")
  2662. {
  2663. GetOcx();
  2664. UINT nID = 2;
  2665. LPSTR pName;
  2666. pName = (LPSTR)(LPCSTR)"财务图表";
  2667. OPEN_MENU(YearFormBranch);
  2668. return;
  2669. }
  2670. else if (strMsg == "订单图表")
  2671. {
  2672. GetOcx();
  2673. UINT nID = 2;
  2674. LPSTR pName;
  2675. pName = (LPSTR)(LPCSTR)"订单图表";
  2676. OPEN_MENU(YearFormBranch2);
  2677. return;
  2678. }
  2679. else if (strMsg == "摄控安排")
  2680. {
  2681. UINT nID = 2;
  2682. LPSTR pName;
  2683. pName = (LPSTR)(LPCSTR)"摄控安排";
  2684. g_bookingtype = 0;
  2685. OPEN_MENU(TodayForm);
  2686. return;
  2687. }
  2688. else if (strMsg == "选片预约")
  2689. {
  2690. UINT nID = 2;
  2691. LPSTR pName;
  2692. pName = (LPSTR)(LPCSTR)"选片预约";
  2693. g_bookingtype = 1;
  2694. OPEN_MENU(TodayForm);
  2695. return;
  2696. }
  2697. else if (strMsg == "看样预约")
  2698. {
  2699. UINT nID = 2;
  2700. LPSTR pName;
  2701. pName = (LPSTR)(LPCSTR)"看样预约";
  2702. g_bookingtype = 2;
  2703. OPEN_MENU(TodayForm);
  2704. return;
  2705. }
  2706. else if (strMsg == "取件预约")
  2707. {
  2708. UINT nID = 2;
  2709. LPSTR pName;
  2710. pName = (LPSTR)(LPCSTR)"取件预约";
  2711. g_bookingtype = 3;
  2712. OPEN_MENU(TodayForm);
  2713. return;
  2714. }
  2715. else if (strMsg == "婚庆安排")
  2716. {
  2717. UINT nID = 2;
  2718. LPSTR pName;
  2719. pName = (LPSTR)(LPCSTR)"婚庆安排";
  2720. g_bookingtype = 4;
  2721. OPEN_MENU(TodayForm);
  2722. return;
  2723. }
  2724. #endif
  2725. else if (strMsg == "员工资料")
  2726. {
  2727. UINT nID = 2;
  2728. LPSTR pName;
  2729. pName = (LPSTR)(LPCSTR)"员工资料";
  2730. if (g_bAllBranch)
  2731. OPEN_MENU(EmployeeForm2);
  2732. else
  2733. OPEN_MENU(EmployeeForm);
  2734. return;
  2735. }
  2736. else if (strMsg == "客户区域")
  2737. {
  2738. // if(IsHasRightsnew(48)==0)return;
  2739. GetOcx();
  2740. UINT nID = 2;
  2741. LPSTR pName;
  2742. pName = (LPSTR)(LPCSTR)"客户区域";
  2743. OPEN_MENU(AreaClient);
  2744. return;
  2745. }
  2746. else if (strMsg == "客户报表")
  2747. {
  2748. UINT nID = 3;
  2749. LPSTR pName;
  2750. pName = (LPSTR)(LPCSTR)"客户报表";
  2751. OPEN_MENU(CClientForm);
  2752. return;
  2753. }
  2754. else if (strMsg == "现金支出")
  2755. {
  2756. if (IsHasRightsnew(16) == 0)return;
  2757. UINT nID = 3;
  2758. LPSTR pName;
  2759. pName = (LPSTR)(LPCSTR)"现金支出";
  2760. OPEN_MENU(PayOutInput);
  2761. return;
  2762. }
  2763. else if (strMsg == "短信群发")
  2764. {
  2765. UINT nID = 3;
  2766. LPSTR pName;
  2767. pName = (LPSTR)(LPCSTR)"短信群发";
  2768. OPEN_MENU(SendMsg);
  2769. return;
  2770. }
  2771. else if (strMsg == "短信发送")
  2772. {
  2773. UINT nID = 3;
  2774. LPSTR pName;
  2775. pName = (LPSTR)(LPCSTR)"客户报表";
  2776. OPEN_MENU(CClientForm);
  2777. return;
  2778. }
  2779. else if (strMsg == "流程短信")
  2780. {
  2781. UINT nID = 3;
  2782. LPSTR pName;
  2783. pName = (LPSTR)(LPCSTR)"流程短信";
  2784. OPEN_MENU(WorkMsg);
  2785. return;
  2786. }
  2787. else if (strMsg == "员工短信")
  2788. {
  2789. UINT nID = 3;
  2790. LPSTR pName;
  2791. pName = (LPSTR)(LPCSTR)"员工短信";
  2792. OPEN_MENU(EmployeeMsg);
  2793. return;
  2794. }
  2795. else if (strMsg == "发送记录")
  2796. {
  2797. UINT nID = 3;
  2798. LPSTR pName;
  2799. pName = (LPSTR)(LPCSTR)"发送记录";
  2800. OPEN_MENU(MsgReg);
  2801. return;
  2802. }
  2803. else if (strMsg == "短信设置")
  2804. {
  2805. if (IsHasRightsnew(49) == 0)return;
  2806. MsgSet dlg;
  2807. dlg.DoModal();
  2808. return;
  2809. }
  2810. else if (strMsg == "金卡会员")
  2811. {
  2812. #ifndef ENTERPRISE_VERSION
  2813. #ifndef CHILD_VERSION
  2814. #ifdef BASIC_VERSION
  2815. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2816. {
  2817. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2818. exit(0);return;
  2819. }
  2820. #else
  2821. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2822. {
  2823. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2824. exit(0);return;
  2825. }
  2826. #endif
  2827. #else
  2828. #ifdef BASIC_VERSION
  2829. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2830. {
  2831. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2832. exit(0);return;
  2833. }
  2834. #else
  2835. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2836. {
  2837. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2838. exit(0); return;
  2839. }
  2840. #endif
  2841. #endif
  2842. #else
  2843. #ifndef CHILD_VERSION
  2844. #ifdef BASIC_VERSION
  2845. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2846. {
  2847. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2848. exit(0); return;
  2849. }
  2850. #else
  2851. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2852. {
  2853. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2854. exit(0); return;
  2855. }
  2856. #endif
  2857. #else
  2858. #ifdef BASIC_VERSION
  2859. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2860. {
  2861. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2862. exit(0);return;
  2863. }
  2864. #else
  2865. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2866. {
  2867. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2868. exit(0); return;
  2869. }
  2870. #endif
  2871. #endif
  2872. #endif
  2873. UINT nID = 3;
  2874. LPSTR pName;
  2875. pName = (LPSTR)(LPCSTR)"金卡会员";
  2876. OPEN_MENU(ShowMember);
  2877. return;
  2878. }
  2879. else if (strMsg == "现金子卡")
  2880. {
  2881. UINT nID = 3;
  2882. LPSTR pName;
  2883. pName = (LPSTR)(LPCSTR)"现金子卡";
  2884. OPEN_MENU(ShowMember2);
  2885. return;
  2886. }
  2887. else if (strMsg == "蓝钻会员")
  2888. {
  2889. #ifndef ENTERPRISE_VERSION
  2890. #ifndef CHILD_VERSION
  2891. #ifdef BASIC_VERSION
  2892. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2893. {
  2894. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2895. exit(0);return;
  2896. }
  2897. #else
  2898. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2899. {
  2900. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2901. exit(0);return;
  2902. }
  2903. #endif
  2904. #else
  2905. #ifdef BASIC_VERSION
  2906. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2907. {
  2908. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2909. exit(0);return;
  2910. }
  2911. #else
  2912. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2913. {
  2914. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2915. exit(0); return;
  2916. }
  2917. #endif
  2918. #endif
  2919. #else
  2920. #ifndef CHILD_VERSION
  2921. #ifdef BASIC_VERSION
  2922. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2923. {
  2924. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2925. exit(0); return;
  2926. }
  2927. #else
  2928. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2929. {
  2930. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2931. exit(0); return;
  2932. }
  2933. #endif
  2934. #else
  2935. #ifdef BASIC_VERSION
  2936. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2937. {
  2938. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2939. exit(0);return;
  2940. }
  2941. #else
  2942. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2943. {
  2944. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2945. exit(0); return;
  2946. }
  2947. #endif
  2948. #endif
  2949. #endif
  2950. UINT nID = 3;
  2951. LPSTR pName;
  2952. pName = (LPSTR)(LPCSTR)"蓝钻会员";
  2953. OPEN_MENU(ShowMemberBlue);
  2954. return;
  2955. }
  2956. else if (strMsg == "转介绍积分")
  2957. {
  2958. #ifndef ENTERPRISE_VERSION
  2959. #ifndef CHILD_VERSION
  2960. #ifdef BASIC_VERSION
  2961. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2962. {
  2963. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2964. exit(0);return;
  2965. }
  2966. #else
  2967. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2968. {
  2969. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2970. exit(0);return;
  2971. }
  2972. #endif
  2973. #else
  2974. #ifdef BASIC_VERSION
  2975. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2976. {
  2977. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2978. exit(0);return;
  2979. }
  2980. #else
  2981. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2982. {
  2983. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2984. exit(0); return;
  2985. }
  2986. #endif
  2987. #endif
  2988. #else
  2989. #ifndef CHILD_VERSION
  2990. #ifdef BASIC_VERSION
  2991. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2992. {
  2993. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2994. exit(0); return;
  2995. }
  2996. #else
  2997. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2998. {
  2999. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3000. exit(0); return;
  3001. }
  3002. #endif
  3003. #else
  3004. #ifdef BASIC_VERSION
  3005. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3006. {
  3007. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3008. exit(0);return;
  3009. }
  3010. #else
  3011. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3012. {
  3013. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3014. exit(0); return;
  3015. }
  3016. #endif
  3017. #endif
  3018. #endif
  3019. UINT nID = 3;
  3020. LPSTR pName;
  3021. pName = (LPSTR)(LPCSTR)"转介绍积分";
  3022. OPEN_MENU(Card2Reg);
  3023. return;
  3024. }
  3025. /* else if(strMsg=="转介绍图表")
  3026. {
  3027. #ifndef ENTERPRISE_VERSION
  3028. #ifndef CHILD_VERSION
  3029. #ifdef BASIC_VERSION
  3030. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="0")
  3031. {
  3032. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3033. exit(0);return;
  3034. }
  3035. #else
  3036. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3037. {
  3038. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3039. exit(0);return;
  3040. }
  3041. #endif
  3042. #else
  3043. #ifdef BASIC_VERSION
  3044. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3045. {
  3046. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3047. exit(0);return;
  3048. }
  3049. #else
  3050. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  3051. {
  3052. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3053. exit(0);return;
  3054. }
  3055. #endif
  3056. #endif
  3057. #else
  3058. #ifndef CHILD_VERSION
  3059. #ifdef BASIC_VERSION
  3060. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3061. {
  3062. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3063. exit(0);return;
  3064. }
  3065. #else
  3066. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="5")
  3067. {
  3068. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3069. exit(0);return;
  3070. }
  3071. #endif
  3072. #else
  3073. #ifdef BASIC_VERSION
  3074. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="6")
  3075. {
  3076. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3077. exit(0);return;
  3078. }
  3079. #else
  3080. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="7")
  3081. {
  3082. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3083. exit(0);return;
  3084. }
  3085. #endif
  3086. #endif
  3087. #endif
  3088. UINT nID=3;
  3089. LPSTR pName ;
  3090. pName = (LPSTR)(LPCSTR)"转介绍图表";
  3091. OPEN_MENU(Card2RegChart);
  3092. return;
  3093. }*/
  3094. else if (strMsg == "金卡图表")
  3095. {
  3096. UINT nID = 3;
  3097. LPSTR pName;
  3098. pName = (LPSTR)(LPCSTR)"金卡图表";
  3099. OPEN_MENU(MemberChart);
  3100. return;
  3101. }
  3102. else if (strMsg == "积分短信")
  3103. {
  3104. UINT nID = 3;
  3105. LPSTR pName;
  3106. pName = (LPSTR)(LPCSTR)"积分短信";
  3107. OPEN_MENU(ShowMemberMsg);
  3108. return;
  3109. }
  3110. else if (strMsg == "转介绍返现")
  3111. {
  3112. #ifndef ENTERPRISE_VERSION
  3113. #ifndef CHILD_VERSION
  3114. #ifdef BASIC_VERSION
  3115. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3116. {
  3117. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3118. exit(0);return;
  3119. }
  3120. #else
  3121. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3122. {
  3123. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3124. exit(0);return;
  3125. }
  3126. #endif
  3127. #else
  3128. #ifdef BASIC_VERSION
  3129. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3130. {
  3131. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3132. exit(0);return;
  3133. }
  3134. #else
  3135. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3136. {
  3137. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3138. exit(0); return;
  3139. }
  3140. #endif
  3141. #endif
  3142. #else
  3143. #ifndef CHILD_VERSION
  3144. #ifdef BASIC_VERSION
  3145. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3146. {
  3147. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3148. exit(0); return;
  3149. }
  3150. #else
  3151. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3152. {
  3153. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3154. exit(0); return;
  3155. }
  3156. #endif
  3157. #else
  3158. #ifdef BASIC_VERSION
  3159. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3160. {
  3161. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3162. exit(0);return;
  3163. }
  3164. #else
  3165. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3166. {
  3167. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3168. exit(0); return;
  3169. }
  3170. #endif
  3171. #endif
  3172. #endif
  3173. UINT nID = 3;
  3174. LPSTR pName;
  3175. pName = (LPSTR)(LPCSTR)"转介绍返现";
  3176. OPEN_MENU(Card2RegBlue);
  3177. return;
  3178. }
  3179. else if (strMsg == "转介绍图表")
  3180. {
  3181. #ifndef ENTERPRISE_VERSION
  3182. #ifndef CHILD_VERSION
  3183. #ifdef BASIC_VERSION
  3184. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3185. {
  3186. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3187. exit(0);return;
  3188. }
  3189. #else
  3190. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3191. {
  3192. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3193. exit(0);return;
  3194. }
  3195. #endif
  3196. #else
  3197. #ifdef BASIC_VERSION
  3198. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3199. {
  3200. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3201. exit(0);return;
  3202. }
  3203. #else
  3204. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3205. {
  3206. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3207. exit(0); return;
  3208. }
  3209. #endif
  3210. #endif
  3211. #else
  3212. #ifndef CHILD_VERSION
  3213. #ifdef BASIC_VERSION
  3214. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3215. {
  3216. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3217. exit(0); return;
  3218. }
  3219. #else
  3220. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3221. {
  3222. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3223. exit(0); return;
  3224. }
  3225. #endif
  3226. #else
  3227. #ifdef BASIC_VERSION
  3228. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3229. {
  3230. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3231. exit(0);return;
  3232. }
  3233. #else
  3234. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3235. {
  3236. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3237. exit(0); return;
  3238. }
  3239. #endif
  3240. #endif
  3241. #endif
  3242. UINT nID = 3;
  3243. LPSTR pName;
  3244. pName = (LPSTR)(LPCSTR)"转介绍图表";
  3245. OPEN_MENU(Card2RegChartBlue);
  3246. return;
  3247. }
  3248. else if (strMsg == "积分设置")
  3249. {
  3250. if (IsHasRightsnew(49) == 0)return;
  3251. MemberSet dlg;
  3252. dlg.DoModal();
  3253. return;
  3254. }
  3255. else if (strMsg == "礼服录入")
  3256. {
  3257. if (IsHasRightsnew(39) == 0)return;
  3258. UINT nID = 3;
  3259. LPSTR pName;
  3260. pName = (LPSTR)(LPCSTR)"礼服录入";
  3261. OPEN_MENU(DressManage);
  3262. return;
  3263. }
  3264. else if (strMsg == "礼服查看")
  3265. {
  3266. #ifndef ENTERPRISE_VERSION
  3267. #ifndef CHILD_VERSION
  3268. #ifdef BASIC_VERSION
  3269. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3270. {
  3271. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3272. exit(0);return;
  3273. }
  3274. #else
  3275. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3276. {
  3277. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3278. exit(0);return;
  3279. }
  3280. #endif
  3281. #else
  3282. #ifdef BASIC_VERSION
  3283. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3284. {
  3285. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3286. exit(0);return;
  3287. }
  3288. #else
  3289. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3290. {
  3291. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3292. exit(0); return;
  3293. }
  3294. #endif
  3295. #endif
  3296. #else
  3297. #ifndef CHILD_VERSION
  3298. #ifdef BASIC_VERSION
  3299. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3300. {
  3301. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3302. exit(0); return;
  3303. }
  3304. #else
  3305. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3306. {
  3307. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3308. exit(0); return;
  3309. }
  3310. #endif
  3311. #else
  3312. #ifdef BASIC_VERSION
  3313. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3314. {
  3315. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3316. exit(0);return;
  3317. }
  3318. #else
  3319. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3320. {
  3321. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3322. exit(0); return;
  3323. }
  3324. #endif
  3325. #endif
  3326. #endif
  3327. if (IsHasRightsnew(40) == 0)return;
  3328. UINT nID = 3;
  3329. LPSTR pName;
  3330. pName = (LPSTR)(LPCSTR)"礼服查看";
  3331. OPEN_MENU(ShowDress);
  3332. return;
  3333. }
  3334. else if (strMsg == "撞期预警")
  3335. {
  3336. UINT nID = 3;
  3337. LPSTR pName;
  3338. pName = (LPSTR)(LPCSTR)"撞期预警";
  3339. OPEN_MENU(DressEarlyWarning);
  3340. return;
  3341. }
  3342. else if (strMsg == "礼服出租")
  3343. {
  3344. UINT nID = 3;
  3345. LPSTR pName;
  3346. pName = (LPSTR)(LPCSTR)"礼服出租";
  3347. OPEN_MENU(ShowHireReg);
  3348. return;
  3349. }
  3350. else if (strMsg == "礼服图片")
  3351. {
  3352. ShowPic dlg;
  3353. dlg.m_mode = 4;
  3354. //dlg.m_path = g_path5 + "\\";
  3355. dlg.m_id = g_path5 + "\\";
  3356. dlg.DoModal();
  3357. return;
  3358. }
  3359. else if (strMsg == "商品类别设置")
  3360. {
  3361. if (IsHasRightsnew(29) == 0)return;
  3362. SPLBDlg dlg;
  3363. dlg.DoModal();
  3364. return;
  3365. }
  3366. else if (strMsg == "商品名称设置")
  3367. {
  3368. if (IsHasRightsnew(29) == 0)return;
  3369. UINT nID = 3;
  3370. LPSTR pName;
  3371. pName = (LPSTR)(LPCSTR)"商品设置";
  3372. OPEN_MENU(ShangPin);
  3373. return;
  3374. }
  3375. else if (strMsg == "固定资产管理")
  3376. {
  3377. UINT nID = 3;
  3378. LPSTR pName;
  3379. pName = (LPSTR)(LPCSTR)"固定资产管理";
  3380. OPEN_MENU(FixedAssets);
  3381. return;
  3382. }
  3383. else if (strMsg == "入库单")
  3384. {
  3385. if (IsHasRightsnew(44) == 0)return;
  3386. InputGoods dlg;
  3387. dlg.DoModal();
  3388. return;
  3389. }
  3390. else if (strMsg == "出库单")
  3391. {
  3392. #ifndef ENTERPRISE_VERSION
  3393. #ifndef CHILD_VERSION
  3394. #ifdef BASIC_VERSION
  3395. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3396. {
  3397. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3398. exit(0);return;
  3399. }
  3400. #else
  3401. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3402. {
  3403. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3404. exit(0);return;
  3405. }
  3406. #endif
  3407. #else
  3408. #ifdef BASIC_VERSION
  3409. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3410. {
  3411. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3412. exit(0);return;
  3413. }
  3414. #else
  3415. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3416. {
  3417. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3418. exit(0); return;
  3419. }
  3420. #endif
  3421. #endif
  3422. #else
  3423. #ifndef CHILD_VERSION
  3424. #ifdef BASIC_VERSION
  3425. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3426. {
  3427. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3428. exit(0); return;
  3429. }
  3430. #else
  3431. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3432. {
  3433. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3434. exit(0); return;
  3435. }
  3436. #endif
  3437. #else
  3438. #ifdef BASIC_VERSION
  3439. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3440. {
  3441. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3442. exit(0);return;
  3443. }
  3444. #else
  3445. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3446. {
  3447. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3448. exit(0); return;
  3449. }
  3450. #endif
  3451. #endif
  3452. #endif
  3453. if (IsHasRightsnew(45) == 0)return;
  3454. InputGoods dlg;
  3455. dlg.m_mode = 1;
  3456. dlg.DoModal();
  3457. return;
  3458. }
  3459. else if (strMsg == "库存查询")
  3460. {
  3461. #ifndef ENTERPRISE_VERSION
  3462. #ifndef CHILD_VERSION
  3463. #ifdef BASIC_VERSION
  3464. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3465. {
  3466. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3467. exit(0);return;
  3468. }
  3469. #else
  3470. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3471. {
  3472. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3473. exit(0);return;
  3474. }
  3475. #endif
  3476. #else
  3477. #ifdef BASIC_VERSION
  3478. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3479. {
  3480. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3481. exit(0);return;
  3482. }
  3483. #else
  3484. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3485. {
  3486. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3487. exit(0); return;
  3488. }
  3489. #endif
  3490. #endif
  3491. #else
  3492. #ifndef CHILD_VERSION
  3493. #ifdef BASIC_VERSION
  3494. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3495. {
  3496. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3497. exit(0); return;
  3498. }
  3499. #else
  3500. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3501. {
  3502. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3503. exit(0); return;
  3504. }
  3505. #endif
  3506. #else
  3507. #ifdef BASIC_VERSION
  3508. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3509. {
  3510. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3511. exit(0);return;
  3512. }
  3513. #else
  3514. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3515. {
  3516. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3517. exit(0); return;
  3518. }
  3519. #endif
  3520. #endif
  3521. #endif
  3522. UINT nID = 3;
  3523. LPSTR pName;
  3524. pName = (LPSTR)(LPCSTR)"库存查询";
  3525. OPEN_MENU(ShowGoods);
  3526. return;
  3527. }
  3528. else if (strMsg == "商品图表")
  3529. {
  3530. UINT nID = 3;
  3531. LPSTR pName;
  3532. pName = (LPSTR)(LPCSTR)"商品图表";
  3533. OPEN_MENU(StoreInfoChart);
  3534. return;
  3535. }
  3536. else if (strMsg == "成本核算")
  3537. {
  3538. UINT nID = 3;
  3539. LPSTR pName;
  3540. pName = (LPSTR)(LPCSTR)"成本核算";
  3541. OPEN_MENU(CostCal);
  3542. return;
  3543. }
  3544. else if (strMsg == "考勤记录")
  3545. {
  3546. UINT nID = 3;
  3547. LPSTR pName;
  3548. pName = (LPSTR)(LPCSTR)"考勤记录";
  3549. OPEN_MENU(LoginReg);
  3550. return;
  3551. }
  3552. else if (strMsg == "月统计")
  3553. {
  3554. UINT nID = 3;
  3555. LPSTR pName;
  3556. pName = (LPSTR)(LPCSTR)"月统计";
  3557. OPEN_MENU(LoginReg2);
  3558. return;
  3559. }
  3560. else if (strMsg == "时间设置")
  3561. {
  3562. if (IsHasRightsnew(21) == 0)return;
  3563. SetLoginTime dlg;
  3564. dlg.DoModal();
  3565. return;
  3566. }
  3567. else if (strMsg == "排班设置")
  3568. {
  3569. if (IsHasRightsnew(21) == 0)return;
  3570. SetLoginBan dlg;
  3571. dlg.DoModal();
  3572. return;
  3573. }
  3574. else if (strMsg == "意向查询")
  3575. {
  3576. UINT nID = 3;
  3577. LPSTR pName;
  3578. pName = (LPSTR)(LPCSTR)"意向查询";
  3579. OPEN_MENU(HospitalClient);
  3580. return;
  3581. }
  3582. else if (strMsg == "今日提醒")
  3583. {
  3584. UINT nID = 3;
  3585. LPSTR pName;
  3586. pName = (LPSTR)(LPCSTR)"今日提醒";
  3587. OPEN_MENU(HospitalClientAlarm);
  3588. return;
  3589. }
  3590. else if (strMsg == "跟踪短信")
  3591. {
  3592. UINT nID = 3;
  3593. LPSTR pName;
  3594. pName = (LPSTR)(LPCSTR)"跟踪短信";
  3595. OPEN_MENU(HospitalClientMsg);
  3596. return;
  3597. }
  3598. else if (strMsg == "意向单录入")
  3599. {
  3600. AddHospitalClient dlg;
  3601. dlg.DoModal();
  3602. return;
  3603. }
  3604. else if (strMsg == "资料设置")
  3605. {
  3606. HospitalInfoSet dlg;
  3607. dlg.DoModal();
  3608. return;
  3609. }
  3610. else if ( strMsg == _T("公众号设置"))
  3611. {
  3612. if (IsHasRightsnew(62) == 0)return;
  3613. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3614. {
  3615. lyfzLibrary::g_PtrShowWeiXinDialog(g_rc, g_bkcol);
  3616. lyfzLibrary::FreeWeiXinLibaray();
  3617. }
  3618. return;
  3619. }
  3620. else if ( strMsg == _T("模板消息设置"))
  3621. {
  3622. if (IsHasRightsnew(63) == 0)return;
  3623. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3624. {
  3625. lyfzLibrary::g_PtrShowWXMsgconfigDialog(g_rc, g_bkcol);
  3626. lyfzLibrary::FreeWeiXinLibaray();
  3627. }
  3628. return;
  3629. }
  3630. else if ( strMsg == _T("推送记录") )
  3631. {
  3632. if (IsHasRightsnew(64) == 0)return;
  3633. if ( lyfzLibrary::LoadWeiXinLibaray() )
  3634. {
  3635. lyfzLibrary::g_PtrShowWXMsgRcordDialog(g_rc, g_bkcol);
  3636. lyfzLibrary::FreeWeiXinLibaray();
  3637. }
  3638. return;
  3639. }
  3640. AfxMessageBox(strMsg + ",开发中...");
  3641. }
  3642. // Jeff.当版本号不一致时,调用AutoUpdate.exe来升级YLGL.exe
  3643. void CMainFrame::AutoUpdate()
  3644. {
  3645. if (g_bBranchModify)
  3646. {
  3647. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3648. return;
  3649. }
  3650. else if (g_branchname != "")
  3651. {
  3652. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3653. return;
  3654. }
  3655. g_ntimeout = 30000;
  3656. if (!::PathFileExists(g_mainpath + "\\AutoUpdate.exe"))
  3657. {
  3658. g_sendhead.bsql = 0;
  3659. g_sendhead.code[0] = 99;
  3660. g_sendhead.tabcount = 1;
  3661. g_pMainWnd->ProcessChatMessageRequest2(99);
  3662. if (g_bSendOK == 0)
  3663. goto failed;
  3664. CFile fp;
  3665. fp.Open(g_mainpath + "\\AutoUpdate.exe", CFile::modeWrite | CFile::modeCreate);
  3666. fp.Write(g_pData, g_nLeng);
  3667. fp.Close();
  3668. }
  3669. {
  3670. ::DeleteFile(g_mainpath + "\\YLGL2.exe"); // 删除ylgl.exe;
  3671. g_sendhead.bsql = 0;
  3672. g_sendhead.code[0] = 98;
  3673. g_sendhead.tabcount = 1;
  3674. g_pMainWnd->ProcessChatMessageRequest2(99); if (g_bSendOK == 0)goto failed;
  3675. CFile fp;
  3676. fp.Open(g_mainpath + "\\YLGL2.exe", CFile::modeWrite | CFile::modeCreate);
  3677. fp.Write(g_pData, g_nLeng);
  3678. fp.Close();
  3679. }
  3680. AfxMessageBox("自动升级成功!", MB_ICONINFORMATION);
  3681. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\AutoUpdate.exe"), "12345", NULL, SW_SHOWNORMAL);
  3682. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3683. exit(0);
  3684. return;
  3685. failed:
  3686. AfxMessageBox("自动升级失败!", MB_ICONINFORMATION);
  3687. if (g_ntimeout == 30000)//非远程
  3688. {
  3689. AfxMessageBox("提醒:升级过程中需要传输较多的数据,如果网速慢可能导致远程升级失败!\r\n\
  3690. 可拷贝店内客户端用QQ传过来覆盖除dbconfig.dat的文件即可。", MB_ICONINFORMATION);
  3691. }
  3692. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3693. }
  3694. void CMainFrame::Onchoosephotoskin() //Jeff:此机用于选片菜单项;不在使用2014.06.16
  3695. {
  3696. if (g_user.bLongin == 0)
  3697. {
  3698. if (g_bNoLoginLia)
  3699. {
  3700. Login dlg;
  3701. dlg.SetLiaPath("5.lia");
  3702. dlg.DoModal();
  3703. }
  3704. else
  3705. {
  3706. Login3 dlg;
  3707. dlg.SetLiaPath("5.lia");
  3708. dlg.DoModal();
  3709. }
  3710. if (g_user.bLongin == 0)return;
  3711. }
  3712. // TODO: Add your command handler code here
  3713. CMenu *pMenu = GetMenu();
  3714. CMenu* submenu = pMenu->GetSubMenu(1);
  3715. UINT status = submenu->GetMenuState(IDM_choosephotoskin, MF_BYCOMMAND);
  3716. if (status&MF_CHECKED)
  3717. {
  3718. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_UNCHECKED);
  3719. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status", 0);
  3720. }
  3721. else
  3722. {
  3723. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  3724. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status", 1);
  3725. }
  3726. }
  3727. /*BOOL g_bInSkin = 0;*/
  3728. BOOL CMainFrame::IsCtrlDown()
  3729. {
  3730. short state = GetKeyState(VK_LCONTROL);
  3731. BYTE sta = (BYTE)(state >> 8);
  3732. state = GetKeyState(VK_RCONTROL);
  3733. BYTE sta2 = (BYTE)(state >> 8);
  3734. if (sta || sta2)
  3735. return 1;
  3736. else
  3737. return 0;
  3738. }//IsShiftDown
  3739. BOOL CMainFrame::IsShiftDown()
  3740. {
  3741. short state = GetKeyState(VK_LSHIFT);
  3742. BYTE sta = (BYTE)(state >> 8);
  3743. state = GetKeyState(VK_RSHIFT);
  3744. BYTE sta2 = (BYTE)(state >> 8);
  3745. if (sta || sta2)
  3746. return 1;
  3747. else
  3748. return 0;
  3749. }
  3750. BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
  3751. {
  3752. // TODO: Add your specialized code here and/or call the base class IDM_Logout
  3753. if (pMsg->message == WM_KEYDOWN)
  3754. {
  3755. switch (pMsg->wParam)
  3756. {
  3757. case VK_F12:
  3758. g_pMainWnd->OnCommandMenu(IDM_Logout);
  3759. return 1;
  3760. case VK_F1:
  3761. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  3762. return 1;
  3763. case VK_F2: // 此机用于选片和选设计;
  3764. {
  3765. if (g_pMainWnd->m_bCheckF2F3 && (IsShiftDown() == 0 || IsCtrlDown() == 0))return 1;
  3766. m_Mdi.MainClose();
  3767. if (g_user.bLongin)
  3768. {
  3769. SearchClient dlg;
  3770. dlg.SetLiaPath("2.lia");
  3771. if (dlg.DoModal() != IDOK)
  3772. {
  3773. if (dlg.m_bLogout)
  3774. {
  3775. g_user.bLongin = 0;
  3776. g_user.name.Empty();
  3777. g_user.rights.Empty();
  3778. g_user.account.Empty();
  3779. goto ll;
  3780. }
  3781. PostMessage(WM_QUIT);
  3782. return 1;
  3783. }
  3784. if (dlg.m_exitcode == 3)
  3785. {
  3786. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3787. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3788. }
  3789. else
  3790. {
  3791. ShowWindow(SW_SHOW);
  3792. #ifdef NEW_SKIN
  3793. if (m_pMainFrimDlg2 == NULL)
  3794. {
  3795. m_pMainFrimDlg2 = new MainFrimDlg2;
  3796. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3797. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3798. }
  3799. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3800. g_bInSkin = 0;
  3801. #endif
  3802. }
  3803. }
  3804. else
  3805. {
  3806. ll:
  3807. ChoosePhotoSkin dlg;
  3808. dlg.SetLiaPath("1.lia");
  3809. if (dlg.DoModal() != IDOK)
  3810. {
  3811. PostMessage(WM_QUIT);
  3812. return 1;
  3813. }
  3814. if (dlg.m_exitcode == 3)
  3815. {
  3816. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3817. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3818. }
  3819. else
  3820. {
  3821. ShowWindow(SW_SHOW);
  3822. #ifdef NEW_SKIN
  3823. if (m_pMainFrimDlg2 == NULL)
  3824. {
  3825. m_pMainFrimDlg2 = new MainFrimDlg2;
  3826. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3827. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3828. }
  3829. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3830. g_bInSkin = 0;
  3831. #endif
  3832. }
  3833. }
  3834. }
  3835. return 1;
  3836. case VK_F3: // 此机用于选片和选设计;
  3837. {
  3838. if (g_pMainWnd->m_bCheckF2F3 && (g_pMainWnd->IsShiftDown() == 0 || g_pMainWnd->IsCtrlDown() == 0))return 1;
  3839. m_Mdi.MainClose();
  3840. if (g_user.bLongin)
  3841. {
  3842. SearchClient dlg;
  3843. dlg.m_mode = 1;
  3844. dlg.SetLiaPath("2.lia");
  3845. if (dlg.DoModal() != IDOK)
  3846. {
  3847. if (dlg.m_bLogout)
  3848. {
  3849. g_user.bLongin = 0;
  3850. g_user.name.Empty();
  3851. g_user.rights.Empty();
  3852. g_user.account.Empty();
  3853. goto mm;
  3854. }
  3855. PostMessage(WM_QUIT);
  3856. return 1;
  3857. }
  3858. if (dlg.m_exitcode == 2)
  3859. {
  3860. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3861. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3862. }
  3863. else
  3864. {
  3865. ShowWindow(SW_SHOW);
  3866. #ifdef NEW_SKIN
  3867. if (m_pMainFrimDlg2 == NULL)
  3868. {
  3869. m_pMainFrimDlg2 = new MainFrimDlg2;
  3870. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3871. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3872. }
  3873. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3874. g_bInSkin = 0;
  3875. #endif
  3876. }
  3877. }
  3878. else
  3879. {
  3880. mm:
  3881. ChoosePhotoSkin dlg;
  3882. dlg.m_mode = 1;
  3883. dlg.SetLiaPath("1.lia");
  3884. if (dlg.DoModal() != IDOK)
  3885. {
  3886. PostMessage(WM_QUIT);
  3887. return 1;
  3888. }
  3889. if (dlg.m_exitcode == 2)
  3890. {
  3891. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3892. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3893. }
  3894. else
  3895. {
  3896. ShowWindow(SW_SHOW);
  3897. #ifdef NEW_SKIN
  3898. if (m_pMainFrimDlg2 == NULL)
  3899. {
  3900. m_pMainFrimDlg2 = new MainFrimDlg2;
  3901. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3902. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3903. }
  3904. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3905. g_bInSkin = 0;
  3906. #endif
  3907. }
  3908. }
  3909. }
  3910. return 1;
  3911. //#if 0 // 2015-05-30 禁用F11功能;
  3912. // case VK_F11:
  3913. // if (g_bInSkin)return 1;
  3914. // if (g_user.bLongin)
  3915. // {
  3916. // SqlDlg dlg;
  3917. // dlg.DoModal();
  3918. // }
  3919. // break;
  3920. //#endif
  3921. }
  3922. }
  3923. return CMDIFrameWnd::PreTranslateMessage(pMsg);
  3924. }
  3925. void CMainFrame::GetSkin()
  3926. {
  3927. return;
  3928. #ifdef MNLS_VERSION
  3929. if (::PathFileExists(g_mainpath + "\\skin\\4.lia"))
  3930. {
  3931. CFile fp;
  3932. fp.Open(g_mainpath + "\\skin\\4.lia", CFile::modeRead);
  3933. DWORD leng=fp.GetLength ();
  3934. fp.Close ();
  3935. if(leng!=194987)
  3936. ::DeleteFile (g_mainpath+"\\skin\\4.lia"); // 删除4.lia
  3937. }
  3938. if(!::PathFileExists (g_mainpath+"\\skin\\4.lia"))
  3939. {
  3940. ::CreateDirectory (g_mainpath+"\\skin", NULL);
  3941. g_sendhead.bsql=0;
  3942. g_sendhead.code[0]=100;
  3943. g_sendhead.tabcount=1;
  3944. g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return;
  3945. CFile fp;
  3946. fp.Open (g_mainpath+"\\skin\\4.lia", CFile::modeWrite|CFile::modeCreate);
  3947. fp.Write (g_pData, g_nLeng);
  3948. fp.Close ();
  3949. }
  3950. #endif
  3951. }
  3952. void AutoDraw(CPrintRX &m_Print, CRect &StrRect, CString &str, float fscale)
  3953. {
  3954. CString tempbz =_T(""), temp = _T("");
  3955. BOOL bRun = 0;
  3956. CSize size;
  3957. int fontsize = 12;
  3958. int i = 0;
  3959. ll: tempbz = str;
  3960. i = 0;
  3961. m_Print.SetFontFace(fontsize, 1, "宋体");
  3962. while (1)
  3963. {
  3964. if (!tempbz.IsEmpty())
  3965. {
  3966. temp = tempbz;
  3967. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  3968. int right = 0;
  3969. CRect temprc = StrRect;
  3970. temprc.top += i*(fontsize*fscale); i++;
  3971. temprc.bottom = temprc.top + fontsize;
  3972. if (temprc.bottom > StrRect.bottom)break;
  3973. while (size.cx > temprc.Width())
  3974. {
  3975. right++;
  3976. temp = tempbz.Left(tempbz.GetLength() - (right));
  3977. if (GIsHalfHZ(temp))
  3978. {
  3979. right++;
  3980. temp.Delete(temp.GetLength() - 1);
  3981. }
  3982. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  3983. }
  3984. // 判断最后的字符是否还含有半个汉字;
  3985. if ( GIsHalfHZ(temp) )
  3986. {
  3987. right++;
  3988. temp.Delete(temp.GetLength() -1);
  3989. temp = tempbz.Left(tempbz.GetLength() - (right));
  3990. }
  3991. if (temp.Find("\r\n") != -1)
  3992. {
  3993. temp = temp.Left(temp.Find("\r\n"));//i++;
  3994. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength() - 2);
  3995. }
  3996. else
  3997. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  3998. if (bRun)
  3999. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, temprc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4000. }
  4001. else
  4002. break;
  4003. }
  4004. if (tempbz.IsEmpty() == 0)
  4005. {
  4006. fontsize--;
  4007. goto ll;
  4008. }
  4009. if (bRun == 0)
  4010. {
  4011. bRun = 1;
  4012. goto ll;
  4013. }
  4014. }
  4015. void CMainFrame::PrintDinDan3(CString strOrderNumber)
  4016. {
  4017. // TODO: Add your control notification handler code here
  4018. CPrintRX m_Print;
  4019. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  4020. {
  4021. m_Print.InitToPrint(NULL, 1);
  4022. }
  4023. else
  4024. {
  4025. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  4026. if (name.IsEmpty())
  4027. m_Print.InitToPrint(NULL, 1);
  4028. else
  4029. {
  4030. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  4031. if (nret == -1)
  4032. {
  4033. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  4034. }
  4035. }
  4036. }
  4037. m_Print.StartPrint();
  4038. m_Print.StartPage();
  4039. LoadRect load;
  4040. load.SetLiaPath("11.lia");
  4041. load.SetMargins(0, 0);
  4042. if (!load.Load())return;
  4043. LoadRect load2;
  4044. load2.SetLiaPath("12.lia");
  4045. load2.SetMargins(0, 0);
  4046. if (!load2.Load())return;
  4047. LoadRect load3;
  4048. load3.SetLiaPath("13.lia");
  4049. load3.SetMargins(-6, 520);
  4050. if (!load3.Load())return;
  4051. int i;
  4052. //////////////////////////////////////////////////////////////
  4053. CStringArray txarray;
  4054. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "'";
  4055. g_sendhead.code[0] = 11;
  4056. g_sendhead.code[1] = 52;
  4057. g_sendhead.code[2] = 50;
  4058. g_sendhead.code[3] = 150;
  4059. g_sendhead.tabcount = 4;
  4060. g_sendhead.bsql = 0;
  4061. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  4062. CArray<CStringArray, CStringArray>sparray;
  4063. CArray<CStringArray, CStringArray>clientarray;
  4064. CArray<CStringArray, CStringArray>jdarray;
  4065. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray);
  4066. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  4067. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  4068. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  4069. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  4070. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  4071. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  4072. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  4073. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  4074. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  4075. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  4076. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  4077. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  4078. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  4079. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  4080. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  4081. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  4082. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  4083. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  4084. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  4085. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  4086. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  4087. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  4088. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  4089. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  4090. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  4091. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  4092. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  4093. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  4094. CString m_bz = "其它要求: " + g_List1array.ElementAt(0).ElementAt(38);
  4095. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  4096. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  4097. if (IsHasRights2new(31) == 0)
  4098. {
  4099. m_phone1 = "***";
  4100. m_phone2 = "***";
  4101. }
  4102. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  4103. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  4104. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  4105. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  4106. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  4107. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  4108. CString m_addr = m_addr1 + ";";
  4109. m_addr.TrimLeft(";");
  4110. m_addr += m_addr2;
  4111. CString m_qq = m_qq1 + ";";
  4112. m_qq.TrimLeft(";");
  4113. m_qq += m_qq2;
  4114. CString m_jd;
  4115. for (i = 0; i < jdarray.GetSize(); i++)
  4116. {
  4117. m_jd += jdarray.ElementAt(i).ElementAt(1);
  4118. m_jd += ";";
  4119. }
  4120. m_jd.TrimRight(";");
  4121. m_money1.Format("%f", atof(m_taoxijiage));
  4122. m_money2.Format("%f", atof(m_payed1));
  4123. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  4124. ConvertToPrice(m_money1);
  4125. ConvertToPrice(m_money2);
  4126. ConvertToPrice(m_money3);
  4127. ////////////////////////////////////////////////////////////////
  4128. int rcpos = -1;
  4129. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  4130. m_Print.SetFontFace(17, 1, "宋体");
  4131. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4132. StrRect.top -= 0;
  4133. StrRect.bottom -= 10;
  4134. StrRect.left -= 140;
  4135. StrRect.right = StrRect.left + 48;
  4136. m_Print.SetFontFace(15, 1, "宋体");
  4137. m_Print.SetColor(0xffffff);
  4138. m_Print.DrawRect(StrRect, 0);
  4139. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4140. StrRect.left = StrRect.right;
  4141. StrRect.right = StrRect.left + 48;
  4142. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  4143. m_Print.SetColor(0, RGB(255, 0, 0));
  4144. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4145. m_Print.SetColor(0);
  4146. m_Print.SetFontFace(12, 1, "宋体");
  4147. StrRect.left -= 48;
  4148. int hei = StrRect.Height();
  4149. StrRect.top = StrRect.bottom + 2;
  4150. StrRect.bottom += hei + 2;
  4151. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4152. StrRect.top = StrRect.bottom - 2;
  4153. StrRect.bottom += hei - 5;
  4154. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  4155. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4156. m_Print.SetFontFace(12, 1, "宋体");
  4157. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4158. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4159. m_Print.SetFontFace(11, 1, "宋体");
  4160. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4161. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4162. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4163. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4164. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4165. m_Print.DrawRect2(StrRect, 2);
  4166. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4167. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4168. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4169. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4170. m_Print.DrawRect2(StrRect, 2);
  4171. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4172. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4173. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4174. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4175. m_Print.DrawRect2(StrRect, 2);
  4176. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4177. m_Print.DrawText((LPTSTR)(LPCTSTR)"约单时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4178. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4179. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4180. m_Print.DrawRect2(StrRect, 2);
  4181. ////////////
  4182. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4183. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4184. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4185. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4186. m_Print.DrawRect2(StrRect, 2);
  4187. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4188. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4189. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4190. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4191. m_Print.DrawRect2(StrRect, 2);
  4192. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4193. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4194. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4195. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4196. m_Print.DrawRect2(StrRect, 2);
  4197. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4198. m_Print.DrawText((LPTSTR)(LPCTSTR)"大婚时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4199. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4200. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4201. m_Print.DrawRect2(StrRect, 2);
  4202. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4203. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客地址:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4204. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4205. m_Print.DrawText((LPTSTR)(LPCTSTR)m_addr, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4206. m_Print.DrawRect2(StrRect, 2);
  4207. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4208. m_Print.DrawText((LPTSTR)(LPCTSTR)"QQ/邮箱:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4209. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4210. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4211. m_Print.DrawRect2(StrRect, 2);
  4212. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4213. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系金额:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4214. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4215. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4216. m_Print.DrawRect2(StrRect, 2);
  4217. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4218. m_Print.DrawText((LPTSTR)(LPCTSTR)"定金:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4219. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4220. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4221. m_Print.DrawRect2(StrRect, 2);
  4222. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4223. m_Print.DrawText((LPTSTR)(LPCTSTR)"余额:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4224. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4225. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4226. m_Print.DrawRect2(StrRect, 2);
  4227. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4228. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4229. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4230. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4231. m_Print.DrawRect2(StrRect, 2);
  4232. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4233. m_Print.DrawText((LPTSTR)(LPCTSTR)"拍摄景点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4234. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4235. m_Print.DrawText((LPTSTR)(LPCTSTR)m_jd, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4236. m_Print.DrawRect2(StrRect, 2);
  4237. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4238. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内容提供: 男士服装:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4239. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4240. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4241. m_Print.DrawRect2(StrRect, 2);
  4242. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4243. m_Print.DrawText((LPTSTR)(LPCTSTR)"套", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4244. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4245. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4246. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4247. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4248. m_Print.DrawRect2(StrRect, 2);
  4249. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4250. m_Print.DrawText((LPTSTR)(LPCTSTR)"套", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4251. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4252. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内提供拍摄区服装/头饰造型", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4253. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4254. m_Print.DrawText((LPTSTR)(LPCTSTR)"其它:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4255. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4256. m_Print.DrawText((LPTSTR)(LPCTSTR)" ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4257. m_Print.DrawRect2(StrRect, 2);
  4258. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4259. m_Print.DrawText((LPTSTR)(LPCTSTR)"专业数码拍摄:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4260. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4261. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4262. m_Print.DrawRect2(StrRect, 2);
  4263. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4264. m_Print.DrawText((LPTSTR)(LPCTSTR)"张", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4265. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4266. m_Print.DrawText((LPTSTR)(LPCTSTR)"(JPG格式数据)", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4267. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4268. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内赠送:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4269. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4270. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_List1array.ElementAt(0).ElementAt(9)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4271. m_Print.DrawRect2(StrRect, 2);
  4272. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4273. m_Print.DrawText((LPTSTR)(LPCTSTR)"张设计排版精修入册", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4274. //////////////////////load2
  4275. rcpos = -1;
  4276. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4277. m_Print.DrawText((LPTSTR)(LPCTSTR)"原始数据套系内张数JPG格式光盘壹只", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4278. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4279. m_Print.DrawText((LPTSTR)(LPCTSTR)"其它:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4280. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4281. // m_Print.DrawText((LPTSTR)(LPCTSTR)"", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4282. // AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4283. m_Print.DrawRect2(StrRect, 2);
  4284. m_Print.SetFontFace(11, 1, "宋体");
  4285. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4286. m_Print.DrawText((LPTSTR)(LPCTSTR)"客人产品:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4287. int rowcount = sparray.GetSize() / 8;
  4288. int needaddrow = 0;
  4289. while (sparray.GetSize() > rowcount * 8 + needaddrow)
  4290. needaddrow++;
  4291. int pos = 0;
  4292. CString str = "";
  4293. int addcount = 0;
  4294. if (needaddrow > 0)
  4295. addcount = 1;
  4296. else
  4297. addcount = 0;
  4298. needaddrow--;
  4299. str.Empty();
  4300. for (i = 0; i < rowcount + addcount; i++)
  4301. {
  4302. str += sparray.ElementAt(pos).ElementAt(5);
  4303. str += " 数量:";
  4304. str += sparray.ElementAt(pos).ElementAt(3);
  4305. str += ";";
  4306. pos++;
  4307. }
  4308. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4309. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4310. m_Print.DrawRect2(StrRect, 2);
  4311. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4312. if (needaddrow > 0)
  4313. addcount = 1;
  4314. else
  4315. addcount = 0;
  4316. needaddrow--;
  4317. str.Empty();
  4318. for (i = 0; i < rowcount + addcount; i++)
  4319. {
  4320. str += sparray.ElementAt(pos).ElementAt(5);
  4321. str += " 数量:";
  4322. str += sparray.ElementAt(pos).ElementAt(3);
  4323. str += ";";
  4324. pos++;
  4325. }
  4326. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4327. m_Print.DrawRect2(StrRect, 2);
  4328. StrRect = load2.m_rcarray.ElementAt(++rcpos);//7
  4329. if (needaddrow > 0)
  4330. addcount = 1;
  4331. else
  4332. addcount = 0;
  4333. needaddrow--;
  4334. str.Empty();
  4335. for (i = 0; i < rowcount + addcount; i++)
  4336. {
  4337. str += sparray.ElementAt(pos).ElementAt(5);
  4338. str += " 数量:";
  4339. str += sparray.ElementAt(pos).ElementAt(3);
  4340. str += ";";
  4341. pos++;
  4342. }
  4343. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4344. m_Print.DrawRect2(StrRect, 2);
  4345. StrRect = load2.m_rcarray.ElementAt(++rcpos);//8
  4346. if (needaddrow > 0)
  4347. addcount = 1;
  4348. else
  4349. addcount = 0;
  4350. needaddrow--;
  4351. str.Empty();
  4352. for (i = 0; i < rowcount + addcount; i++)
  4353. {
  4354. str += sparray.ElementAt(pos).ElementAt(5);
  4355. str += " 数量:";
  4356. str += sparray.ElementAt(pos).ElementAt(3);
  4357. str += ";";
  4358. pos++;
  4359. }
  4360. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4361. m_Print.DrawRect2(StrRect, 2);
  4362. StrRect = load2.m_rcarray.ElementAt(++rcpos);//9
  4363. if (needaddrow > 0)
  4364. addcount = 1;
  4365. else
  4366. addcount = 0;
  4367. needaddrow--;
  4368. str.Empty();
  4369. for (i = 0; i < rowcount + addcount; i++)
  4370. {
  4371. str += sparray.ElementAt(pos).ElementAt(5);
  4372. str += " 数量:";
  4373. str += sparray.ElementAt(pos).ElementAt(3);
  4374. str += ";";
  4375. pos++;
  4376. }
  4377. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4378. m_Print.DrawRect2(StrRect, 2);
  4379. StrRect = load2.m_rcarray.ElementAt(++rcpos);//10
  4380. if (needaddrow > 0)
  4381. addcount = 1;
  4382. else
  4383. addcount = 0;
  4384. needaddrow--;
  4385. str.Empty();
  4386. for (i = 0; i < rowcount + addcount; i++)
  4387. {
  4388. str += sparray.ElementAt(pos).ElementAt(5);
  4389. str += " 数量:";
  4390. str += sparray.ElementAt(pos).ElementAt(3);
  4391. str += ";";
  4392. pos++;
  4393. }
  4394. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4395. m_Print.DrawRect2(StrRect, 2);
  4396. StrRect = load2.m_rcarray.ElementAt(++rcpos);//11
  4397. if (needaddrow > 0)
  4398. addcount = 1;
  4399. else
  4400. addcount = 0;
  4401. needaddrow--;
  4402. str.Empty();
  4403. for (i = 0; i < rowcount + addcount; i++)
  4404. {
  4405. str += sparray.ElementAt(pos).ElementAt(5);
  4406. str += " 数量:";
  4407. str += sparray.ElementAt(pos).ElementAt(3);
  4408. str += ";";
  4409. pos++;
  4410. }
  4411. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4412. m_Print.DrawRect2(StrRect, 2);
  4413. StrRect = load2.m_rcarray.ElementAt(++rcpos);//12
  4414. if (needaddrow > 0)
  4415. addcount = 1;
  4416. else
  4417. addcount = 0;
  4418. needaddrow--;
  4419. str.Empty();
  4420. for (i = 0; i < rowcount + addcount; i++)
  4421. {
  4422. str += sparray.ElementAt(pos).ElementAt(5);
  4423. str += " 数量:";
  4424. str += sparray.ElementAt(pos).ElementAt(3);
  4425. str += ";";
  4426. pos++;
  4427. }
  4428. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4429. m_Print.DrawRect2(StrRect, 2);
  4430. /* StrRect=load2.m_rcarray .ElementAt (++rcpos);//12
  4431. if(needaddrow>0)
  4432. addcount=1;
  4433. else
  4434. addcount=0;
  4435. needaddrow--;
  4436. str.Empty ();
  4437. for( i=0; i<rowcount+addcount; i++)
  4438. {
  4439. str+=sparray.ElementAt (pos).ElementAt (5);
  4440. str+=" 数量:";
  4441. str+=sparray.ElementAt (pos).ElementAt (3);
  4442. str+=";";
  4443. pos++;
  4444. }
  4445. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4446. m_Print.DrawRect2(StrRect, 2);
  4447. StrRect=load2.m_rcarray .ElementAt (++rcpos);//14
  4448. if(needaddrow>0)
  4449. addcount=1;
  4450. else
  4451. addcount=0;
  4452. needaddrow--;
  4453. str.Empty ();
  4454. for( i=0; i<rowcount+addcount; i++)
  4455. {
  4456. str+=sparray.ElementAt (pos).ElementAt (5);
  4457. str+=" 数量:";
  4458. str+=sparray.ElementAt (pos).ElementAt (3);
  4459. str+=";";
  4460. pos++;
  4461. }
  4462. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4463. m_Print.DrawRect2(StrRect, 2);*/
  4464. CRect sprc[2];
  4465. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4466. // AutoDraw(m_Print, StrRect, m_bz.Left (leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4467. m_Print.DrawRect2(StrRect, 2);
  4468. sprc[0] = StrRect;
  4469. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4470. // AutoDraw(m_Print, StrRect, m_bz.Right (leng-leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4471. m_Print.DrawRect2(StrRect, 2);
  4472. sprc[1] = StrRect;
  4473. //AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4474. {
  4475. CString temp, tempspno, tempbz;
  4476. CSize size;
  4477. BOOL bRun = 0;
  4478. int fontsize = 12;
  4479. ll: tempspno = m_bz;
  4480. m_Print.SetFontFace(fontsize, 1, "宋体");
  4481. for (i = 0; i<2; i++)
  4482. {
  4483. if (!tempspno.IsEmpty())
  4484. {
  4485. temp = tempspno;
  4486. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4487. int right = 0;
  4488. CRect temprc = sprc[i];
  4489. while (size.cx>temprc.Width())
  4490. {
  4491. right++;
  4492. temp = tempspno.Left(tempspno.GetLength() - (right));
  4493. if (GIsHalfHZ(temp))
  4494. {
  4495. right++;
  4496. temp.Delete(temp.GetLength() - 1);
  4497. }
  4498. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4499. }
  4500. if (bRun)
  4501. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4502. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  4503. if (tempspno.IsEmpty())i++;
  4504. }
  4505. }
  4506. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  4507. {
  4508. fontsize--;
  4509. goto ll;
  4510. }
  4511. if (bRun == 0)
  4512. {
  4513. bRun = 1;
  4514. goto ll;
  4515. }
  4516. }
  4517. m_Print.SetFontFace(11, 1, "宋体");
  4518. //////////////////////load3
  4519. rcpos = -1;
  4520. for (i = 0; i < 24; i++)
  4521. {
  4522. StrRect = load3.m_rcarray.ElementAt(i);
  4523. m_Print.DrawRect2(StrRect, 1);
  4524. }
  4525. CStringArray strarray;
  4526. strarray.Add("营业员");
  4527. strarray.Add("前台接待");
  4528. strarray.Add("化妆师");
  4529. strarray.Add("礼服师");
  4530. strarray.Add("摄影师");
  4531. strarray.Add("摄影助理");
  4532. strarray.Add("美工师");
  4533. strarray.Add("设计师");
  4534. for (i = 0; i < 8; i++)
  4535. {
  4536. StrRect = load3.m_rcarray.ElementAt(i);
  4537. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4538. }
  4539. strarray.RemoveAll();
  4540. strarray.Add(m_ren);
  4541. strarray.Add(g_List1array.ElementAt(0).ElementAt(49));
  4542. strarray.Add(m_waiter2);
  4543. strarray.Add(g_List1array.ElementAt(0).ElementAt(51));
  4544. strarray.Add(m_waiter1);
  4545. strarray.Add(g_List1array.ElementAt(0).ElementAt(50));
  4546. strarray.Add("");
  4547. strarray.Add(m_waiter4);
  4548. for (i = 8; i < 16; i++)
  4549. {
  4550. StrRect = load3.m_rcarray.ElementAt(i);
  4551. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 8), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4552. }
  4553. StrRect = load3.m_rcarray.ElementAt(27);
  4554. m_Print.DrawText((LPTSTR)(LPCTSTR)"客户电话: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4555. StrRect = load3.m_rcarray.ElementAt(28);
  4556. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4557. m_Print.SetFontFace(13, 1, "宋体");
  4558. StrRect = load3.m_rcarray.ElementAt(25);
  4559. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4560. StrRect = load3.m_rcarray.ElementAt(26);
  4561. m_Print.DrawRect2(StrRect, 2);
  4562. StrRect = load3.m_rcarray.ElementAt(24);
  4563. str = "\
  4564. 顾客须知\r\n\
  4565. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  4566. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  4567. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  4568. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  4569. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  4570. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  4571. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  4572. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  4573. AutoDraw(m_Print, StrRect, str, 1.8f);
  4574. PrintPreview dlg;
  4575. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4576. dlg.m_pDC = m_Print.GetPDC();
  4577. if (dlg.DoModal() != IDOK)return;
  4578. //结束打印
  4579. m_Print.EndPage();
  4580. m_Print.EndPrint();
  4581. }
  4582. void CMainFrame::PrintDailyForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4583. {
  4584. // TODO: Add your control notification handler code here
  4585. int pages = Listarray->GetSize() / 46;
  4586. if (Listarray->GetSize() % 46)pages++;
  4587. for (int aa = 0; aa < pages; aa++)
  4588. {
  4589. PrintPreview dlg;
  4590. CPrintRX m_Print;
  4591. m_Print.InitToPrint(NULL, 1);
  4592. m_Print.StartPrint();
  4593. m_Print.StartPage();
  4594. CRect mainrc(0, 0, 560, 793);
  4595. float fscale;
  4596. {
  4597. int w, h;
  4598. m_Print.GetWidHei(w, h);
  4599. fscale = (float)w / (float)h;
  4600. }
  4601. mainrc.DeflateRect(25, 40, 10, 0);
  4602. CRect rc, rc2;
  4603. rc = mainrc;
  4604. rc.bottom = rc.top;
  4605. rc.top -= 20;
  4606. m_Print.SetFontFace(16, 1, "黑体");
  4607. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4608. m_Print.SetFontFace(9, 1, "宋体");
  4609. CString str;
  4610. int wid[4] = { 320, 60, 60, 90 };
  4611. int hei = 16;
  4612. if (fscale > 0.71)hei = 15;
  4613. rc = mainrc;
  4614. rc.bottom = rc.top + hei;
  4615. for (int i = 0; i < 47; i++)
  4616. {
  4617. rc2.top = rc.top + i*hei;
  4618. rc2.bottom = rc.bottom + i*hei;
  4619. rc2.left = rc.left;
  4620. rc2.right = rc.left + wid[0];
  4621. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  4622. for (int j = 0; j<4; j++)
  4623. {
  4624. m_Print.DrawRect2(rc2, 1);
  4625. if (Listarray->GetSize()>aa * 46 + i)
  4626. {
  4627. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  4628. rc2.left += 3;
  4629. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4630. rc2.left -= 3;
  4631. }
  4632. rc2.left += wid[j];
  4633. rc2.right = rc2.left + wid[j + 1];
  4634. }
  4635. }
  4636. rc2.top += 2;
  4637. rc2.left += 2; rc2.right = mainrc.right + 4;
  4638. m_Print.SetFontFace(8, 1, "宋体");
  4639. int infopos = info.Find("***");
  4640. if (infopos != -1)
  4641. {
  4642. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Left(infopos), rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4643. CRect rc3 = rc2;
  4644. rc3.top = rc2.bottom - 4;
  4645. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Right(info.GetLength() - infopos - 3), rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4646. }
  4647. else
  4648. m_Print.DrawText((LPTSTR)(LPCTSTR)info, rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4649. str.Format(" 页:%d/%d", aa + 1, pages);
  4650. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4651. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  4652. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4653. dlg.m_pDC = m_Print.GetPDC();
  4654. // dlg.m_mode=1;
  4655. if (aa == 0)
  4656. {
  4657. if (dlg.DoModal() != IDOK)
  4658. return;
  4659. }
  4660. //结束打印
  4661. m_Print.EndPage();
  4662. m_Print.EndPrint();
  4663. }
  4664. }
  4665. void CMainFrame::PrintLoginForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4666. {
  4667. // TODO: Add your control notification handler code here
  4668. int sinlecount = 33 * 6;
  4669. int pages = Listarray->GetSize() / sinlecount;
  4670. if (Listarray->GetSize() % sinlecount)pages++;
  4671. for (int aa = 0; aa < pages; aa++)
  4672. {
  4673. PrintPreview dlg;
  4674. CPrintRX m_Print;
  4675. m_Print.InitToPrint(NULL, 1);
  4676. m_Print.StartPrint();
  4677. m_Print.StartPage();
  4678. CRect mainrc(0, 0, 560, 793);
  4679. float fscale;
  4680. {
  4681. int w, h;
  4682. m_Print.GetWidHei(w, h);
  4683. fscale = (float)w / (float)h;
  4684. }
  4685. mainrc.DeflateRect(25, 40, 10, 0);
  4686. CString str;
  4687. CRect rc, rc2;
  4688. rc = mainrc;
  4689. rc.bottom = rc.top;
  4690. rc.top -= 20;
  4691. rc.left -= 20;
  4692. m_Print.SetFontFace(12, 1, "黑体");
  4693. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4694. m_Print.SetFontFace(6, 1, "宋体");
  4695. str.Format(" 页:%d/%d", aa + 1, pages);
  4696. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4697. rc.right = mainrc.right + 20;
  4698. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4699. int wid[2] = { 50, 110 };
  4700. int hei = 11;
  4701. rc = mainrc;
  4702. rc.bottom = rc.top + hei;
  4703. rc.top += 10;
  4704. rc.bottom += 10;
  4705. int dtx = rc.Width() / 3 + 18;
  4706. int dty = 380;
  4707. for (int j = 0; j < 6; j++)
  4708. {
  4709. if (Listarray->GetSize() < aa*sinlecount + 33 * (j + 1))continue;
  4710. for (int i = 0; i < 33; i++)
  4711. {
  4712. rc2.top = rc.top + i*hei;
  4713. rc2.bottom = rc.bottom + i*hei;
  4714. rc2.left = rc.left;
  4715. rc2.right = rc.left + wid[0];
  4716. if (i == 0)
  4717. {
  4718. // rc2.left +=wid[1];
  4719. rc2.right += wid[1];
  4720. }
  4721. if (j == 1 || j == 4)
  4722. {
  4723. rc2.left += dtx;
  4724. rc2.right += dtx;
  4725. }
  4726. if (j == 2 || j == 5)
  4727. {
  4728. rc2.left += dtx * 2;
  4729. rc2.right += dtx * 2;
  4730. }
  4731. if (j == 3 || j == 4 || j == 5)
  4732. {
  4733. rc2.top += dty;
  4734. rc2.bottom += dty;
  4735. }
  4736. m_Print.DrawRect2(rc2, 1);
  4737. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4738. {
  4739. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(0);
  4740. rc2.left += 3;
  4741. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4742. rc2.left -= 3;
  4743. }
  4744. if (i == 0)continue;
  4745. rc2.left = rc2.right;
  4746. rc2.right += wid[1];
  4747. m_Print.DrawRect2(rc2, 1);
  4748. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4749. {
  4750. if (Listarray->ElementAt(aa*sinlecount + 33 * j + i).GetSize() > 1)
  4751. {
  4752. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(1);
  4753. rc2.left += 3;
  4754. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4755. rc2.left -= 3;
  4756. }
  4757. }
  4758. /* if(Listarray->GetSize ()>aa*46+i)
  4759. {
  4760. str=Listarray->ElementAt (aa*46+i).ElementAt (j);
  4761. rc2.left +=3;
  4762. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4763. rc2.left -=3;
  4764. }
  4765. rc2.left +=wid[j];
  4766. rc2.right =rc2.left+wid[j+1];*/
  4767. }
  4768. }
  4769. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4770. dlg.m_pDC = m_Print.GetPDC();
  4771. if (aa == 0)
  4772. {
  4773. if (dlg.DoModal() != IDOK)
  4774. return;
  4775. }
  4776. //结束打印
  4777. m_Print.EndPage();
  4778. m_Print.EndPrint();
  4779. }
  4780. }
  4781. void CMainFrame::PrintTakeForm(CArray<CStringArray, CStringArray>*Listarray)
  4782. {
  4783. CString title;
  4784. CString info;
  4785. // TODO: Add your control notification handler code here
  4786. int sinlecount = 4;
  4787. int pages = Listarray->GetSize() / sinlecount;
  4788. if (Listarray->GetSize() % sinlecount)pages++;
  4789. for (int aa = 0; aa < pages; aa++)
  4790. {
  4791. PrintPreview dlg;
  4792. CPrintRX m_Print;
  4793. m_Print.InitToPrint(NULL, 1);
  4794. m_Print.StartPrint();
  4795. m_Print.StartPage();
  4796. CRect mainrc(0, 0, 560, 793);
  4797. float fscale;
  4798. {
  4799. int w, h;
  4800. m_Print.GetWidHei(w, h);
  4801. fscale = (float)w / (float)h;
  4802. }
  4803. mainrc.DeflateRect(25, 40, 10, 0);
  4804. CString str;
  4805. CRect rc, rc2;
  4806. rc = mainrc;
  4807. rc.bottom = rc.top;
  4808. rc.top -= 20;
  4809. rc.left -= 20;
  4810. m_Print.SetFontFace(6, 1, "宋体");
  4811. str.Format(" 页:%d/%d", aa + 1, pages);
  4812. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4813. rc.right = mainrc.right + 10;
  4814. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4815. m_Print.SetFontFace(12, 1, "宋体");
  4816. int wid[2] = { 70, 190 };
  4817. int hei = 22;
  4818. rc = mainrc;
  4819. rc.bottom = rc.top + hei;
  4820. rc.top += 10;
  4821. rc.bottom += 10;
  4822. int dtx = rc.Width() / 2 + 18;
  4823. int dty = 380;
  4824. int arraysize = Listarray->ElementAt(0).GetSize();
  4825. for (int j = 0; j < 4; j++)
  4826. {
  4827. if (Listarray->GetSize() <= aa*sinlecount + j)continue;
  4828. for (int i = 0; i < arraysize; i++)
  4829. {
  4830. rc2.top = rc.top + i / 2 * hei;
  4831. rc2.bottom = rc.bottom + i / 2 * hei;
  4832. rc2.left = rc.left;
  4833. rc2.right = rc.left + wid[0];
  4834. if (i % 2)
  4835. {
  4836. rc2.left = rc2.right;
  4837. rc2.right += wid[1];
  4838. }
  4839. if (j == 1 || j == 3)
  4840. {
  4841. rc2.left += dtx;
  4842. rc2.right += dtx;
  4843. }
  4844. if (j == 2 || j == 3)
  4845. {
  4846. rc2.top += dty;
  4847. rc2.bottom += dty;
  4848. }
  4849. if (i == arraysize - 1 || i == arraysize - 2)
  4850. {
  4851. rc2.bottom += hei * 2;
  4852. }
  4853. m_Print.DrawRect2(rc2, 1);
  4854. {
  4855. str = Listarray->ElementAt(aa*sinlecount + j).ElementAt(i);
  4856. if (i == arraysize - 1)
  4857. {
  4858. CRect rc3 = rc2;
  4859. rc3.left += 3;
  4860. rc3.top += 3;
  4861. AutoDraw(m_Print, rc3, str, 1.4f);
  4862. }
  4863. else if (i == arraysize - 2)
  4864. {
  4865. CRect rc3 = rc2;
  4866. rc3.left += 3;
  4867. rc3.top += 3;
  4868. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4869. }
  4870. else
  4871. {
  4872. rc2.left += 3;
  4873. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4874. rc2.left -= 3;
  4875. }
  4876. }
  4877. }
  4878. }
  4879. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4880. dlg.m_pDC = m_Print.GetPDC();
  4881. if (aa == 0)
  4882. {
  4883. if (dlg.DoModal() != IDOK)
  4884. return;
  4885. }
  4886. //结束打印
  4887. m_Print.EndPage();
  4888. m_Print.EndPrint();
  4889. }
  4890. }
  4891. void CMainFrame::PrintThumbNail(CStringArray *array, CString client, BOOL bDir, CString m_size)
  4892. {
  4893. // TODO: Add your control notification handler code here
  4894. CStringArray titlearray;
  4895. CStringArray namearray;
  4896. CStringArray noarray;
  4897. CArray<CRect, CRect>rcarray;
  4898. CArray<CRect, CRect>widtharray;
  4899. if (m_size != "")
  4900. {
  4901. int pos = m_size.Find(";");
  4902. while (pos != -1)
  4903. {
  4904. CString size = m_size.Left(pos);
  4905. int pos2 = size.Find(":");
  4906. if (pos2 != -1)
  4907. {
  4908. CString str;
  4909. CRect rc;
  4910. str = size.Left(pos2);
  4911. noarray.Add(str);
  4912. str = size.Right(size.GetLength() - pos2 - 1);
  4913. pos2 = str.Find(",");
  4914. namearray.Add(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4915. pos2 = str.Find(",");
  4916. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4917. pos2 = str.Find(",");
  4918. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4919. widtharray.Add(rc);
  4920. pos2 = str.Find(",");
  4921. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4922. pos2 = str.Find(",");
  4923. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4924. pos2 = str.Find(",");
  4925. rc.right = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4926. rc.bottom = atoi(str);
  4927. rcarray.Add(rc);
  4928. }
  4929. m_size = m_size.Right(m_size.GetLength() - pos - 1);
  4930. pos = m_size.Find(";");
  4931. }
  4932. }
  4933. PrintPreview dlg;
  4934. CPrintRX m_Print;
  4935. m_Print.InitToPrint(NULL, 1);
  4936. m_Print.StartPrint();
  4937. m_Print.StartPage();
  4938. CRect mainrc(0, 0, 560, 793);
  4939. mainrc.DeflateRect(25, 50, 10, 0);
  4940. m_Print.SetFontFace(10, 1, "宋体");
  4941. CRect rc, rc2;
  4942. rc = mainrc;
  4943. rc.bottom = rc.top;
  4944. rc.top -= 20;
  4945. m_Print.DrawText((LPTSTR)(LPCTSTR)client, rc, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4946. rc.bottom -= 5;
  4947. m_Print.DrawRect2(rc, 2);
  4948. if (array->GetSize() > 130)m_Print.SetFontFace(8, 1, "宋体");
  4949. if (bDir)m_Print.SetFontFace(6, 1, "宋体");
  4950. ////////////////////////////////////////////////////////////////
  4951. int imgcount = array->GetSize();
  4952. int dtx = 5;
  4953. int dty = 15;
  4954. int cx, cy;
  4955. int countx = 5;
  4956. int county = 1;
  4957. while (1)
  4958. {
  4959. if (countx*county >= imgcount)
  4960. {
  4961. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  4962. cy = cx * 4 / 3;
  4963. break;
  4964. }
  4965. else
  4966. {
  4967. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  4968. cy = cx * 4 / 3;
  4969. if (cy*(county + 1) + dty*county < mainrc.Height())//Y方向可以增加一个
  4970. {
  4971. county++;
  4972. }
  4973. else//Y方向不能加,X方向加
  4974. {
  4975. countx++;
  4976. county = 1;
  4977. }
  4978. }
  4979. }
  4980. int imgpos = 0;
  4981. CString stemp;
  4982. CPen pen(PS_SOLID, 1, RGB(255, 0, 0));
  4983. CPen *oldpen = m_Print.m_DC.SelectObject(&pen);
  4984. CPen *oldpen2 = m_Print.m_memdc.SelectObject(&pen);
  4985. for (int i = 0; i < county; i++)
  4986. {
  4987. for (int j = 0; j < countx; j++)
  4988. {
  4989. rc = mainrc;
  4990. rc.top += i*(cy + dty);
  4991. rc.left += j*(cx + dtx);
  4992. rc.right = rc.left + cx;
  4993. rc.bottom = rc.top + cy;
  4994. Image *pImg = NULL;
  4995. if (imgpos >= array->GetSize())break;
  4996. CString str = array->ElementAt(imgpos);
  4997. CString spath = str.Left(str.ReverseFind('\\') + 1);
  4998. spath += "m";
  4999. spath += str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5000. if (PathFileExists(spath))
  5001. ::LoadImageFromBuf(&pImg, spath);
  5002. else
  5003. {
  5004. ::LoadImageFromBuf(&pImg, str);
  5005. if (pImg == NULL)continue;
  5006. int orientation = GetOrientation(pImg);
  5007. if (orientation == 8)
  5008. pImg->RotateFlip(Rotate270FlipNone);
  5009. else if (orientation == 6)
  5010. pImg->RotateFlip(Rotate90FlipNone);
  5011. }
  5012. if (pImg == NULL)continue;
  5013. rc2 = rc;
  5014. RectFitDes(pImg->GetWidth(), pImg->GetHeight(), rc);
  5015. imgpos++;
  5016. m_Print.DrawImage(pImg, rc);
  5017. int imgwidth = pImg->GetWidth();
  5018. delete pImg;
  5019. rc2.top = rc2.bottom + 3;
  5020. rc2.bottom += 10;
  5021. if (bDir == 0)
  5022. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5023. else
  5024. {
  5025. stemp = str.Left(str.ReverseFind('\\'));
  5026. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  5027. if (stemp.ReverseFind('\\') != -1)
  5028. {
  5029. stemp = stemp.Right(stemp.GetLength() - stemp.ReverseFind('\\') - 1);
  5030. str = stemp + "\\" + str;
  5031. }
  5032. }
  5033. if (str.Find(".") != -1)
  5034. str = str.Left(str.Find("."));
  5035. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5036. if (noarray.GetSize())
  5037. {
  5038. rc2 = rc;
  5039. for (int aa = 0; aa < noarray.GetSize(); aa++)
  5040. {
  5041. float scale = (float)rc2.Width() / (float)imgwidth;
  5042. if (noarray.ElementAt(aa) == str)
  5043. {
  5044. int nIndex = aa;
  5045. CRect rc = rcarray.ElementAt(nIndex);
  5046. int wid = widtharray.ElementAt(nIndex).left;
  5047. int hei = widtharray.ElementAt(nIndex).top;
  5048. scale *= (float)imgwidth / (float)wid;
  5049. rc.left *= scale;
  5050. rc.right *= scale;
  5051. rc.top *= scale;
  5052. rc.bottom *= scale;
  5053. rc.left += rc2.left;
  5054. rc.right += rc2.left;
  5055. rc.top += rc2.top;
  5056. rc.bottom += rc2.top;
  5057. if (rc.left < rc2.left)rc.left = rc2.left;
  5058. if (rc.right > rc2.right)rc.right = rc2.right;
  5059. if (rc.top < rc2.top)rc.top = rc2.top;
  5060. if (rc.bottom > rc2.bottom)rc.bottom = rc2.bottom;
  5061. m_Print.DrawRect2(rc, 1);
  5062. }
  5063. }
  5064. }
  5065. }
  5066. }
  5067. m_Print.m_DC.SelectObject(oldpen);
  5068. m_Print.m_memdc.SelectObject(oldpen2);
  5069. /* CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  5070. StrRect.top -=15;StrRect.bottom -=15;
  5071. Image *pImg=NULL;
  5072. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  5073. m_Print.DrawImage(pImg, StrRect);
  5074. delete pImg;
  5075. m_Print.SetFontFace(10, 1, "宋体");
  5076. StrRect=load.m_rcarray .ElementAt (20);
  5077. StrRect.right=load.m_rcarray .ElementAt (23).right;
  5078. StrRect.top -=18;StrRect.bottom -=18;
  5079. CString str="地址:"+g_cominfoarray.ElementAt (0).ElementAt (12);
  5080. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5081. */
  5082. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  5083. dlg.m_pDC = m_Print.GetPDC();
  5084. if (dlg.DoModal() != IDOK)
  5085. return;
  5086. //结束打印
  5087. m_Print.EndPage();
  5088. m_Print.EndPrint();
  5089. }
  5090. // remark by Jeff
  5091. // 函数:PrintDinDan
  5092. // 参数:
  5093. // strOrderNumber:订单单号;(Order number)
  5094. // 返回:void
  5095. // 注意:#
  5096. void CMainFrame::PrintDinDan(CString strOrderNumber)//打印订单报表;
  5097. {
  5098. int printcot = 1;
  5099. for (int aa = 0; aa < printcot; aa++)
  5100. {
  5101. PrintPreview dlg;
  5102. CPrintRX m_Print;
  5103. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  5104. {
  5105. m_Print.InitToPrint(NULL, 1);
  5106. }
  5107. else
  5108. {
  5109. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  5110. if (name.IsEmpty())
  5111. m_Print.InitToPrint(NULL, 1);
  5112. else
  5113. {
  5114. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  5115. if (nret == -1 && aa == 0)
  5116. {
  5117. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  5118. }
  5119. }
  5120. }
  5121. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 0)
  5122. {
  5123. #ifdef ZHIAI_VERSION
  5124. PrintDinDan3(strOrderNumber);
  5125. return;
  5126. #endif
  5127. #ifdef SZBLCT_VERSION
  5128. PrintDinDan4(strOrderNumber);
  5129. return;
  5130. #endif
  5131. m_Print.StartPrint();
  5132. m_Print.StartPage();
  5133. LoadRect load;
  5134. load.SetLiaPath("6.lia");
  5135. load.SetMargins(-14, 15);
  5136. if (!load.Load())return;
  5137. LoadRect load2;
  5138. load2.SetLiaPath("7.lia");
  5139. load2.SetMargins(-14, 216 + 15);
  5140. if (!load2.Load())return;
  5141. LoadRect load3;
  5142. load3.SetLiaPath("8.lia");
  5143. load3.SetMargins(-14, 705 + 15);
  5144. if (!load3.Load())return;
  5145. int i;
  5146. //////////////////////////////////////////////////////////////
  5147. CStringArray txarray;
  5148. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  5149. g_sendhead.code[0] = 11;
  5150. g_sendhead.code[1] = 52;
  5151. g_sendhead.code[2] = 50;
  5152. g_sendhead.code[3] = 150;
  5153. g_sendhead.code[4] = 77;
  5154. g_sendhead.code[5] = 4;
  5155. g_sendhead.tabcount = 6;
  5156. g_sendhead.bsql = 0;
  5157. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5158. CArray<CStringArray, CStringArray>sparray;
  5159. CArray<CStringArray, CStringArray>clientarray;
  5160. CArray<CStringArray, CStringArray>phonearray;
  5161. CArray<CStringArray, CStringArray>fgarray;
  5162. CArray<CStringArray, CStringArray>danweiarray;
  5163. CArray<CStringArray, CStringArray>jdarray;
  5164. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5165. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5166. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5167. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5168. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5169. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5170. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5171. CString m_taoxiname;
  5172. if (m_zs.Find("\\") != -1)
  5173. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  5174. else
  5175. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  5176. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5177. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5178. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5179. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5180. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5181. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5182. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5183. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5184. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5185. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5186. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5187. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5188. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5189. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5190. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5191. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5192. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5193. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5194. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5195. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5196. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5197. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5198. if (jdarray.GetSize())
  5199. {
  5200. if (m_bz.IsEmpty() == 0)
  5201. m_bz = "\r\n" + m_bz;
  5202. m_bz += "景点:";
  5203. }
  5204. #ifdef DDF_VERSION
  5205. m_bz += "219店:219路馨园小区对面\r\n";
  5206. m_bz += "金色店:万科金色家园小区东门南走20米荣光社区一楼\r\n";
  5207. m_bz += "万泰店:万泰锦绣华城小区正门\r\n";
  5208. #else
  5209. for (i = 0; i < jdarray.GetSize(); i++)
  5210. {
  5211. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5212. }
  5213. m_bz.TrimRight(";");
  5214. #endif
  5215. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5216. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5217. if (IsHasRights2new(31) == 0)
  5218. {
  5219. m_phone1 = "***";
  5220. m_phone2 = "***";
  5221. }
  5222. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5223. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5224. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  5225. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  5226. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  5227. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  5228. filter = "name='" + m_ren + "'";
  5229. g_sendhead.code[0] = 5;
  5230. g_sendhead.tabcount = 1;
  5231. g_sendhead.bsql = 0;
  5232. int g_nYearposTemp = g_nYearpos;
  5233. g_nYearpos = -1;
  5234. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5235. g_nYearpos = g_nYearposTemp;
  5236. if (g_bSendOK == 0)return;
  5237. DataToArray(&phonearray);
  5238. m_money1.Format("%f", atof(m_taoxijiage));
  5239. m_money2.Format("%f", atof(m_payed1));
  5240. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5241. ConvertToPrice(m_money1);
  5242. ConvertToPrice(m_money2);
  5243. ConvertToPrice(m_money3);
  5244. ////////////////////////////////////////////////////////////////
  5245. int rcpos = -1;
  5246. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  5247. StrRect.top -= 15; StrRect.bottom -= 15;
  5248. Image *pImg = NULL;
  5249. #ifdef MNLS_VERSION
  5250. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  5251. #else
  5252. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  5253. #endif
  5254. m_Print.DrawImage(pImg, StrRect);
  5255. delete pImg;
  5256. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5257. {
  5258. Image *pImg = NULL;
  5259. g_nSendCode = 31;
  5260. int g_nYearposTemp = g_nYearpos;
  5261. g_nYearpos = -1;
  5262. g_pMainWnd->ProcessChatMessageRequest2(1);
  5263. g_nYearpos = g_nYearposTemp;
  5264. g_nSendCode = 0;
  5265. if (g_bSendOK == 0)return;
  5266. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5267. if (pImg)
  5268. {
  5269. StrRect.left = 30;
  5270. StrRect.top = 12;
  5271. StrRect.right = StrRect.left + 60;
  5272. StrRect.bottom = StrRect.top + 60;
  5273. m_Print.DrawImage(pImg, StrRect);
  5274. delete pImg; pImg = NULL;
  5275. }
  5276. }
  5277. m_Print.SetFontFace(11, 1, "宋体");
  5278. StrRect = load.m_rcarray.ElementAt(20);
  5279. StrRect.right = load.m_rcarray.ElementAt(23).right;
  5280. StrRect.top -= 18; StrRect.bottom -= 18;
  5281. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  5282. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5283. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  5284. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5285. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5286. StrRect.top -= 15; StrRect.bottom -= 15;
  5287. #ifdef MNLS_VERSION
  5288. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5289. #endif
  5290. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5291. StrRect.top -= 15; StrRect.bottom -= 15;
  5292. #ifdef MNLS_VERSION
  5293. m_Print.DrawRect(StrRect);
  5294. #endif
  5295. m_Print.SetFontFace(7, 1, "黑体");
  5296. m_Print.SetColor(0xffffff);
  5297. #ifdef MNLS_VERSION
  5298. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5299. #endif
  5300. m_Print.SetColor(0);
  5301. m_Print.SetFontFace(15, 1, "宋体");
  5302. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5303. StrRect.top -= 15; StrRect.bottom -= 15;
  5304. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同预约订单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5305. CStringArray strarray;
  5306. strarray.Add("NO: " + strOrderNumber);
  5307. CString date;
  5308. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  5309. strarray.Add(date);
  5310. strarray.Add("喜爱");
  5311. strarray.Add("格调");
  5312. if (fgarray.GetSize() == 12)
  5313. {
  5314. for (int i = 0; i < 12; i++)
  5315. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  5316. }
  5317. else
  5318. {
  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. strarray.Add("清纯可爱");
  5331. }
  5332. strarray.Add("姓名");
  5333. // strarray.Add("职业");
  5334. strarray.Add("");
  5335. strarray.Add("地址");
  5336. strarray.Add("电话");
  5337. #ifdef CHILD_VERSION
  5338. strarray.Add("家长");
  5339. strarray.Add("宝宝");
  5340. #else
  5341. strarray.Add("先生");
  5342. strarray.Add("女士");
  5343. #endif
  5344. m_Print.SetFontFace(11, 1, "宋体");
  5345. for (i = 0; i < strarray.GetSize(); i++)
  5346. {
  5347. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5348. if (i < 2)
  5349. {
  5350. StrRect.top -= 15; StrRect.bottom -= 15;
  5351. }
  5352. if (i>15)
  5353. m_Print.DrawRect2(StrRect, 1);
  5354. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5355. }
  5356. for (i = 29; i <= 40; i++)
  5357. {
  5358. if (m_style.GetLength() <= (i - 29))continue;
  5359. if (m_style.GetAt(i - 29) != '1')continue;
  5360. StrRect = load.m_rcarray.ElementAt(i - 1);
  5361. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5362. }
  5363. for (i = 27; i <= 48; i++)
  5364. {
  5365. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5366. m_Print.DrawRect2(StrRect, 1);
  5367. }
  5368. #ifdef CHILD_VERSION
  5369. StrRect = load.m_rcarray.ElementAt(45);
  5370. StrRect.right = StrRect.left + 62;
  5371. m_Print.DrawRect2(StrRect, 1);
  5372. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5373. StrRect.left = StrRect.right;
  5374. StrRect.right = StrRect.left + 62;
  5375. m_Print.DrawRect2(StrRect, 1);
  5376. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5377. StrRect.left = StrRect.right;
  5378. StrRect.right = StrRect.left + 62;
  5379. m_Print.DrawRect2(StrRect, 1);
  5380. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5381. StrRect.left = StrRect.right;
  5382. StrRect.right = StrRect.left + 62;
  5383. m_Print.DrawRect2(StrRect, 1);
  5384. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5385. #endif
  5386. /////////////////////////
  5387. strarray.RemoveAll();
  5388. CString temp;
  5389. temp.Format("拍摄多款选 %d 款,其中影", atoi(m_outside) + atoi(m_outside2));
  5390. strarray.Add(temp);
  5391. temp.Format("棚景 %d 款,景点 %d 款.", atoi(m_outside2), atoi(m_outside));
  5392. strarray.Add(temp);
  5393. strarray.Add("化妆");
  5394. strarray.Add("造型");
  5395. #ifdef CHILD_VERSION
  5396. strarray.Add("");
  5397. #else
  5398. strarray.Add("婚纱");
  5399. #endif
  5400. strarray.Add("服饰");
  5401. strarray.Add("配");
  5402. strarray.Add("置");
  5403. strarray.Add("其");
  5404. strarray.Add("它");
  5405. strarray.Add("套系名称");
  5406. strarray.Add("镜款");
  5407. strarray.Add("套系总价");
  5408. strarray.Add("主摄影师");
  5409. strarray.Add("拍摄日期");
  5410. strarray.Add("定金");
  5411. #ifdef CHILD_VERSION
  5412. strarray.Add("主引导师");
  5413. #else
  5414. strarray.Add("主化妆师");
  5415. #endif
  5416. strarray.Add("看样日期");
  5417. strarray.Add("欠款余额");
  5418. strarray.Add("总监");
  5419. strarray.Add("取件日期");
  5420. rcpos = -1;
  5421. for (i = 0; i < strarray.GetSize(); i++)
  5422. {
  5423. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5424. if (i>9)
  5425. m_Print.DrawRect2(StrRect, 1);
  5426. #ifdef CHILD_VERSION
  5427. if (i == 5)
  5428. StrRect.top -= StrRect.Height();
  5429. #endif
  5430. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5431. }
  5432. for (i = 22; i <= 41; i++)
  5433. {
  5434. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5435. m_Print.DrawRect2(StrRect, 1);
  5436. }
  5437. /////////////////////////////
  5438. strarray.RemoveAll();
  5439. #ifdef CHILD_VERSION
  5440. strarray.Add("顾客方 家长:");
  5441. strarray.Add("宝宝:");
  5442. #else
  5443. strarray.Add("顾客方 先生:");
  5444. strarray.Add("女士:");
  5445. #endif
  5446. strarray.Add("电话:");
  5447. strarray.Add("影楼方 店长:");
  5448. strarray.Add("接单人:");
  5449. strarray.Add("电话:");
  5450. rcpos = -1;
  5451. for (i = 0; i < strarray.GetSize(); i++)
  5452. {
  5453. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5454. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5455. }
  5456. for (i = 7; i <= 12; i++)
  5457. {
  5458. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5459. // if(i!=10)
  5460. m_Print.DrawRect2(StrRect, 2);
  5461. }
  5462. //////////////////////////////////////
  5463. //开始打数据
  5464. strarray.RemoveAll();
  5465. strarray.Add(m_name1);
  5466. strarray.Add(m_name2);
  5467. /// strarray.Add (m_occupation1);
  5468. // strarray.Add (m_occupation2);
  5469. strarray.Add("");
  5470. strarray.Add("");
  5471. strarray.Add(m_addr1);
  5472. #ifdef CHILD_VERSION
  5473. strarray.Add("");
  5474. #else
  5475. strarray.Add(m_addr2);
  5476. #endif
  5477. strarray.Add(m_phone1);
  5478. strarray.Add(m_phone2);
  5479. for (i = 41; i <= 48; i++)
  5480. {
  5481. StrRect = load.m_rcarray.ElementAt(i - 1);
  5482. StrRect.left += 4;
  5483. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5484. }
  5485. ///////////////////////////////
  5486. strarray.RemoveAll();
  5487. strarray.Add(m_money1);
  5488. strarray.Add(m_waiter1);
  5489. strarray.Add(m_time2);
  5490. strarray.Add(m_money2);
  5491. strarray.Add(m_waiter2);
  5492. strarray.Add(m_time4);
  5493. strarray.Add(m_money3);
  5494. strarray.Add("");
  5495. strarray.Add(m_time5);
  5496. for (i = 32; i <= 40; i++)
  5497. {
  5498. StrRect = load2.m_rcarray.ElementAt(i - 1);
  5499. StrRect.left += 4;
  5500. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5501. }
  5502. ///////////////////////////////
  5503. strarray.RemoveAll();
  5504. strarray.Add(m_name1);
  5505. strarray.Add(m_name2);
  5506. CString phone;
  5507. if (m_phone1.IsEmpty() == 0)
  5508. phone = m_phone1 + ",";
  5509. phone += m_phone2;
  5510. phone.TrimRight(",");
  5511. strarray.Add(phone);
  5512. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  5513. strarray.Add(m_ren);
  5514. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  5515. for (i = 7; i <= 12; i++)
  5516. {
  5517. StrRect = load3.m_rcarray.ElementAt(i - 1);
  5518. StrRect.left += 4;
  5519. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5520. }
  5521. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  5522. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5523. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  5524. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5525. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  5526. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5527. //////////////////////////////
  5528. //开始画文字
  5529. StrRect = load2.m_rcarray.ElementAt(30);
  5530. StrRect.left += 3;
  5531. StrRect.top += 3;
  5532. StrRect.right -= 2;
  5533. StrRect.bottom -= 2;
  5534. AutoDraw(m_Print, StrRect, m_bz, 1.4f);
  5535. StrRect = load2.m_rcarray.ElementAt(29);
  5536. StrRect.left += 3;
  5537. StrRect.top += 3;
  5538. StrRect.right -= 2;
  5539. StrRect.bottom -= 2;
  5540. str = "";
  5541. for (i = 0; i < sparray.GetSize(); i++)
  5542. {
  5543. str += sparray.ElementAt(i).ElementAt(5);
  5544. str += " 数量:";
  5545. str += sparray.ElementAt(i).ElementAt(3);
  5546. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5547. str += "\r\n";
  5548. }
  5549. str.TrimRight("\r\n");
  5550. AutoDraw(m_Print, StrRect, str, 1.4);
  5551. StrRect = load2.m_rcarray.ElementAt(40);
  5552. StrRect.top += 8;
  5553. m_Print.SetFontFace(12, 1, "黑体");
  5554. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5555. StrRect.left += 3;
  5556. StrRect.top += 30;
  5557. StrRect.right -= 2;
  5558. StrRect.bottom -= 2;
  5559. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5560. if (str.IsEmpty())
  5561. {
  5562. str = "\
  5563. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5564. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5565. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5566. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5567. 持良好的心境.\r\n\
  5568. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5569. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5570. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5571. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5572. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5573. 勿进影室, 以免影响拍摄.\r\n\
  5574. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5575. 师或店长沟通.\r\n\
  5576. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5577. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5578. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5579. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5580. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5581. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5582. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5583. 还.";
  5584. }
  5585. AutoDraw(m_Print, StrRect, str, 1.8);
  5586. }
  5587. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 1)
  5588. {//AfxMessageBox("yyy");
  5589. m_Print.StartPrint();
  5590. m_Print.StartPage();
  5591. LoadRect load;
  5592. load.SetLiaPath("6-2.lia");
  5593. load.SetMargins(0, 0);
  5594. if (!load.Load())return;
  5595. int i;
  5596. //////////////////////////////////////////////////////////////
  5597. CStringArray txarray;
  5598. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  5599. g_sendhead.code[0] = 11;
  5600. g_sendhead.code[1] = 52;
  5601. g_sendhead.code[2] = 50;
  5602. g_sendhead.code[3] = 150;
  5603. g_sendhead.code[4] = 77;
  5604. g_sendhead.code[5] = 4;
  5605. g_sendhead.tabcount = 6;
  5606. g_sendhead.bsql = 0;
  5607. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5608. CArray<CStringArray, CStringArray>sparray;
  5609. CArray<CStringArray, CStringArray>clientarray;
  5610. CArray<CStringArray, CStringArray>phonearray;
  5611. CArray<CStringArray, CStringArray>fgarray;
  5612. CArray<CStringArray, CStringArray>danweiarray;
  5613. CArray<CStringArray, CStringArray>jdarray;
  5614. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5615. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5616. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5617. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5618. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5619. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5620. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  5621. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5622. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5623. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5624. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5625. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5626. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5627. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5628. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5629. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5630. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5631. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5632. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5633. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5634. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5635. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5636. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5637. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5638. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5639. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5640. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5641. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5642. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5643. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5644. if (jdarray.GetSize())
  5645. {
  5646. if (m_bz.IsEmpty() == 0)
  5647. m_bz = "\r\n" + m_bz;
  5648. m_bz += "景点:";
  5649. }
  5650. for (i = 0; i < jdarray.GetSize(); i++)
  5651. {
  5652. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5653. }
  5654. m_bz.TrimRight(";");
  5655. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5656. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5657. if (IsHasRights2new(31) == 0)
  5658. {
  5659. m_phone1 = "***";
  5660. m_phone2 = "***";
  5661. }
  5662. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5663. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5664. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  5665. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  5666. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  5667. CString str;
  5668. filter = "name='" + m_ren + "'";
  5669. g_sendhead.code[0] = 5;
  5670. g_sendhead.tabcount = 1;
  5671. g_sendhead.bsql = 0;
  5672. int g_nYearposTemp = g_nYearpos;
  5673. g_nYearpos = -1;
  5674. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5675. g_nYearpos = g_nYearposTemp;
  5676. if (g_bSendOK == 0)return;
  5677. DataToArray(&phonearray);
  5678. m_money1.Format("%f", atof(m_taoxijiage));
  5679. m_money2.Format("%f", atof(m_payed1));
  5680. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5681. ConvertToPrice(m_money1);
  5682. ConvertToPrice(m_money2);
  5683. ConvertToPrice(m_money3);
  5684. ////////////////////////////////////////////////////////////////
  5685. int rcpos = -1;
  5686. CRect StrRect = load.m_rcarray.ElementAt(0);
  5687. m_Print.SetFontFace(25, 1, "黑体");
  5688. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "预约单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5689. m_Print.SetFontFace(11, 1, "宋体");
  5690. StrRect = load.m_rcarray.ElementAt(1);
  5691. if (m_time1.GetLength() == 10)
  5692. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  5693. else
  5694. str = "开单日期:";
  5695. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5696. StrRect = load.m_rcarray.ElementAt(2);
  5697. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + strOrderNumber), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5698. CStringArray strarray;
  5699. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5700. {
  5701. Image *pImg = NULL;
  5702. g_nSendCode = 31;
  5703. int g_nYearposTemp = g_nYearpos;
  5704. g_nYearpos = -1;
  5705. g_pMainWnd->ProcessChatMessageRequest2(1);
  5706. g_nYearpos = g_nYearposTemp;
  5707. g_nSendCode = 0;
  5708. if (g_bSendOK == 0)return;
  5709. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5710. if (pImg)
  5711. {
  5712. StrRect.left = 47;
  5713. StrRect.top = 12;
  5714. StrRect.right = StrRect.left + 60;
  5715. StrRect.bottom = StrRect.top + 60;
  5716. m_Print.DrawImage(pImg, StrRect);
  5717. delete pImg; pImg = NULL;
  5718. }
  5719. }
  5720. #ifdef CHILD_VERSION
  5721. strarray.Add("家长姓名");
  5722. strarray.Add("宝宝姓名");
  5723. #else
  5724. strarray.Add("先生姓名");
  5725. strarray.Add("女士姓名");
  5726. #endif
  5727. strarray.Add("服装套数");
  5728. // strarray.Add ("拍摄张数");
  5729. #ifdef CHILD_VERSION
  5730. strarray.Add("出生日期");
  5731. #else
  5732. strarray.Add("结婚日期");
  5733. #endif
  5734. strarray.Add("拍摄日期");
  5735. strarray.Add("联系电话");
  5736. strarray.Add("联系电话");
  5737. strarray.Add("造型套数");
  5738. if (m_zs.Find("\\") != -1)
  5739. strarray.Add("入底\\入册");
  5740. else
  5741. strarray.Add("入底张数");
  5742. strarray.Add("选片日期");
  5743. strarray.Add("QQ/邮箱");
  5744. strarray.Add("套系总额");
  5745. strarray.Add("定金");
  5746. strarray.Add("余款金额");
  5747. strarray.Add("取件日期");
  5748. strarray.Add(m_name1);
  5749. strarray.Add(m_name2);
  5750. strarray.Add(m_clothescount);
  5751. // str.Format("%d", atoi(m_zs)*3);
  5752. // strarray.Add (str);
  5753. #ifdef CHILD_VERSION
  5754. strarray.Add(m_birthday1);
  5755. #else
  5756. strarray.Add(m_time3);
  5757. #endif
  5758. strarray.Add(m_time2);
  5759. strarray.Add(m_phone1);
  5760. strarray.Add(m_phone2);
  5761. strarray.Add(m_clothescount2);
  5762. strarray.Add(m_zs);
  5763. strarray.Add(m_time4);
  5764. strarray.Add(m_qq1);
  5765. strarray.Add(m_money1);
  5766. strarray.Add(m_money2);
  5767. strarray.Add(m_money3);
  5768. strarray.Add(m_time5);
  5769. for (i = 4; i <= 33; i++)
  5770. {
  5771. StrRect = load.m_rcarray.ElementAt(i - 1);
  5772. m_Print.DrawRect2(StrRect, 1);
  5773. if (strarray.GetSize() > (i - 4))
  5774. {
  5775. if (i <= 18)
  5776. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5777. else
  5778. {
  5779. StrRect.left += 4;
  5780. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5781. }
  5782. }
  5783. }
  5784. int dt = 413;
  5785. StrRect = load.m_rcarray.ElementAt(36); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5786. m_Print.DrawText((LPTSTR)(LPCTSTR)"门市签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5787. StrRect = load.m_rcarray.ElementAt(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5788. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5789. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5790. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5791. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  5792. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5793. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  5794. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5795. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  5796. m_Print.DrawText((LPTSTR)(LPCTSTR)("网址:" + g_cominfoarray.ElementAt(0).ElementAt(13)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5797. //////////////////////////////
  5798. //开始画文字
  5799. StrRect = load.m_rcarray.ElementAt(7);
  5800. int hei = StrRect.Height();
  5801. StrRect.top += hei;
  5802. StrRect.bottom += hei;
  5803. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5804. StrRect.top += dt;
  5805. StrRect.bottom += dt;
  5806. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5807. StrRect = load.m_rcarray.ElementAt(17);
  5808. StrRect.top += hei;
  5809. StrRect.bottom += hei;
  5810. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5811. StrRect = load.m_rcarray.ElementAt(33);
  5812. StrRect.bottom = StrRect.top + dt; m_Print.DrawRect2(StrRect, 1);
  5813. StrRect.top += hei;
  5814. StrRect.left += 3;
  5815. StrRect.top += 3;
  5816. StrRect.right -= 2;
  5817. StrRect.bottom -= 2;
  5818. str = "";
  5819. for (i = 0; i < sparray.GetSize(); i++)
  5820. {
  5821. str += sparray.ElementAt(i).ElementAt(5);
  5822. str += " 数量:";
  5823. str += sparray.ElementAt(i).ElementAt(3);
  5824. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5825. str += "\r\n";
  5826. }
  5827. str.TrimRight("\r\n");
  5828. AutoDraw(m_Print, StrRect, str, 1.4);
  5829. StrRect = load.m_rcarray.ElementAt(33);
  5830. StrRect.top += dt;
  5831. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5832. StrRect.top += hei;
  5833. StrRect.left += 3;
  5834. StrRect.top += 3;
  5835. StrRect.right -= 2;
  5836. StrRect.bottom -= 2;
  5837. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  5838. StrRect = load.m_rcarray.ElementAt(34);
  5839. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5840. StrRect.top += hei;
  5841. StrRect.left += 3;
  5842. StrRect.top += 3;
  5843. StrRect.right -= 2;
  5844. StrRect.bottom -= 2;
  5845. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5846. if (str.IsEmpty())
  5847. {
  5848. str = "\
  5849. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5850. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5851. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5852. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5853. 持良好的心境.\r\n\
  5854. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5855. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5856. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5857. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5858. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5859. 勿进影室, 以免影响拍摄.\r\n\
  5860. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5861. 师或店长沟通.\r\n\
  5862. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5863. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5864. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5865. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5866. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5867. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5868. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5869. 还.";
  5870. }
  5871. AutoDraw(m_Print, StrRect, str, 1.8);
  5872. StrRect = load.m_rcarray.ElementAt(35);
  5873. StrRect.bottom += 100;
  5874. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  5875. 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∨";
  5876. // AutoDraw(m_Print, StrRect, str, 1.4);
  5877. }
  5878. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 2)
  5879. {
  5880. PrintDinDan5(strOrderNumber);
  5881. return;
  5882. }
  5883. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  5884. {
  5885. PrintDinDan6(strOrderNumber);
  5886. return;
  5887. }
  5888. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  5889. dlg.m_pDC = m_Print.GetPDC();
  5890. dlg.m_mode = 1;
  5891. if (aa == 0)
  5892. {
  5893. if (dlg.DoModal() != IDOK)
  5894. return;
  5895. printcot = dlg.m_num;
  5896. }
  5897. //结束打印
  5898. m_Print.EndPage();
  5899. m_Print.EndPrint();
  5900. }
  5901. }
  5902. void CovertDate2(CString date, CString &date2)
  5903. {
  5904. try
  5905. {
  5906. if (date == "2013-04-09")
  5907. {
  5908. date2 = "2013-02-29";
  5909. return;
  5910. }
  5911. ///////////////////////////////////
  5912. date2 = date;
  5913. GongToLong(date2);
  5914. ////////////////////////////////////
  5915. return;
  5916. CCalendarConvert m_CalendarConvert;
  5917. SYSTEMTIME src = { 0 };
  5918. SYSTEMTIME dst = { 0 };
  5919. COleDateTime m_timeLunar(atoi(date.Mid(0, 4)), atoi(date.Mid(5, 2)), atoi(date.Mid(8, 2)), 0, 0, 0);
  5920. COleDateTime m_timeGregorian;
  5921. m_timeLunar.GetAsSystemTime(src);
  5922. BOOL bEmbolism = 0;
  5923. if (m_CalendarConvert.Gregorian2Lunar(&src, &dst, &bEmbolism))
  5924. {
  5925. m_timeGregorian = m_CalendarConvert.ConvertSysTime2OleDateTime(&dst);
  5926. date2.Format("%04d-%02d-%02d", m_timeGregorian.GetYear(), m_timeGregorian.GetMonth(), m_timeGregorian.GetDay());
  5927. if (m_timeGregorian.GetYear() == -1)date2 = "2000-13-32";
  5928. }
  5929. else
  5930. {
  5931. date2.Empty();
  5932. }
  5933. }
  5934. catch (...)
  5935. {
  5936. }
  5937. }
  5938. void CMainFrame::PrintDinDan5(CString m_id)
  5939. {
  5940. int printcot = 1;
  5941. for (int aa = 0; aa < printcot; aa++)
  5942. {
  5943. PrintPreview dlg;
  5944. CPrintRX m_Print;
  5945. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  5946. {
  5947. m_Print.InitToPrint(NULL, 1);
  5948. }
  5949. else
  5950. {
  5951. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  5952. if (name.IsEmpty())
  5953. m_Print.InitToPrint(NULL, 1);
  5954. else
  5955. {
  5956. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  5957. if (nret == -1 && aa == 0)
  5958. {
  5959. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  5960. }
  5961. }
  5962. }
  5963. {
  5964. m_Print.StartPrint();
  5965. m_Print.StartPage();
  5966. LoadRect load;
  5967. load.SetLiaPath("19.lia");
  5968. load.SetMargins(0, -20);
  5969. if (!load.Load())return;
  5970. int i;
  5971. //////////////////////////////////////////////////////////////
  5972. CStringArray txarray;
  5973. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  5974. g_sendhead.code[0] = 11;
  5975. g_sendhead.code[1] = 52;
  5976. g_sendhead.code[2] = 50;
  5977. g_sendhead.code[3] = 150;
  5978. g_sendhead.code[4] = 77;
  5979. g_sendhead.code[5] = 4;
  5980. g_sendhead.tabcount = 6;
  5981. g_sendhead.bsql = 0;
  5982. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5983. CArray<CStringArray, CStringArray>sparray;
  5984. CArray<CStringArray, CStringArray>clientarray;
  5985. CArray<CStringArray, CStringArray>phonearray;
  5986. CArray<CStringArray, CStringArray>fgarray;
  5987. CArray<CStringArray, CStringArray>danweiarray;
  5988. CArray<CStringArray, CStringArray>jdarray;
  5989. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5990. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5991. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5992. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5993. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5994. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5995. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  5996. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5997. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5998. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5999. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  6000. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  6001. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  6002. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  6003. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  6004. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  6005. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  6006. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  6007. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  6008. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  6009. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  6010. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  6011. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  6012. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  6013. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  6014. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  6015. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  6016. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  6017. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(36);
  6018. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  6019. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6020. CString m_txtype = g_List1array.ElementAt(0).ElementAt(52);
  6021. CString m_memberno = g_List1array.ElementAt(0).ElementAt(47);
  6022. CString str;
  6023. if (jdarray.GetSize())
  6024. {
  6025. if (m_bz.IsEmpty() == 0)
  6026. m_bz = "\r\n" + m_bz;
  6027. m_bz += "景点:";
  6028. }
  6029. for (i = 0; i < jdarray.GetSize(); i++)
  6030. {
  6031. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  6032. }
  6033. m_bz.TrimRight(";");
  6034. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  6035. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  6036. if (IsHasRights2new(31) == 0)
  6037. {
  6038. m_phone1 = "***";
  6039. m_phone2 = "***";
  6040. }
  6041. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  6042. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  6043. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  6044. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  6045. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  6046. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  6047. BOOL check1 = atoi(clientarray.ElementAt(0).ElementAt(15));
  6048. filter = "name='" + m_ren + "'";
  6049. g_sendhead.code[0] = 5;
  6050. g_sendhead.tabcount = 1;
  6051. g_sendhead.bsql = 0;
  6052. int g_nYearposTemp = g_nYearpos;
  6053. g_nYearpos = -1;
  6054. g_pMainWnd->ProcessChatMessageRequest2(filter);
  6055. g_nYearpos = g_nYearposTemp;
  6056. if (g_bSendOK == 0)return;
  6057. DataToArray(&phonearray);
  6058. m_money1.Format("%f", atof(m_taoxijiage));
  6059. m_money2.Format("%f", atof(m_payed1));
  6060. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  6061. ConvertToPrice(m_money1);
  6062. ConvertToPrice(m_money2);
  6063. ConvertToPrice(m_money3);
  6064. ////////////////////////////////////////////////////////////////
  6065. int rcpos = -1;
  6066. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6067. //Image *pImg=NULL;
  6068. // ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  6069. // m_Print.DrawImage(pImg, StrRect);
  6070. // delete pImg;
  6071. m_Print.SetFontFace(20, 1, "宋体");
  6072. StrRect = load.m_rcarray.ElementAt(1);
  6073. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "定单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6074. m_Print.SetFontFace(12, 1, "宋体");
  6075. StrRect = load.m_rcarray.ElementAt(2);
  6076. m_Print.DrawText((LPTSTR)(LPCTSTR)("NO." + m_id), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6077. StrRect = load.m_rcarray.ElementAt(3);
  6078. str.Format("%s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  6079. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6080. StrRect = load.m_rcarray.ElementAt(4);
  6081. m_Print.DrawText((LPTSTR)(LPCTSTR)("联系人:" + m_name1), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6082. CStringArray strarray;
  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. strarray.Add("联系电话");
  6095. for (i = 6; i <= 17; i++)
  6096. {
  6097. StrRect = load.m_rcarray.ElementAt(i - 1);
  6098. m_Print.DrawRect2(StrRect, 1);
  6099. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 6), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6100. }
  6101. strarray.RemoveAll();
  6102. strarray.Add(m_name2);
  6103. strarray.Add(m_sex);
  6104. if (m_birthday.GetLength() != 10)
  6105. strarray.Add("");
  6106. else
  6107. {
  6108. int year = 0;
  6109. if (check1)
  6110. {
  6111. CString date2;
  6112. CovertDate2(g_date, date2);
  6113. year = atoi(date2.Left(4)) - atoi(m_birthday.Left(4));
  6114. if (date2.Right(5) >= m_birthday.Right(5))
  6115. year++;
  6116. }
  6117. else
  6118. {
  6119. year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  6120. if (g_date.Right(5) >= m_birthday.Right(5))
  6121. year++;
  6122. }
  6123. str.Format("%d", year);
  6124. strarray.Add(str);
  6125. }
  6126. strarray.Add(m_birthday);
  6127. strarray.Add(m_money1);
  6128. strarray.Add(m_money2);
  6129. strarray.Add(m_money3);
  6130. strarray.Add(m_txtype);
  6131. strarray.Add(m_memberno);
  6132. strarray.Add(m_ren);
  6133. strarray.Add(m_zs);
  6134. if (!m_phone1.IsEmpty())
  6135. strarray.Add(m_phone1);
  6136. else
  6137. strarray.Add(m_phone2);
  6138. for (i = 18; i <= 29; i++)
  6139. {
  6140. StrRect = load.m_rcarray.ElementAt(i - 1);
  6141. m_Print.DrawRect2(StrRect, 1);
  6142. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6143. }
  6144. strarray.RemoveAll();
  6145. strarray.Add("摄影师");
  6146. strarray.Add("拍照时间");
  6147. strarray.Add("选片人");
  6148. strarray.Add("选片时间");
  6149. strarray.Add("引导师");
  6150. strarray.Add("设计师");
  6151. strarray.Add("取件时间");
  6152. strarray.Add("顾客签字");
  6153. for (i = 34; i <= 41; i++)
  6154. {
  6155. StrRect = load.m_rcarray.ElementAt(i - 1);
  6156. m_Print.DrawRect2(StrRect, 1);
  6157. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 34), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6158. }
  6159. strarray.RemoveAll();
  6160. strarray.Add(m_waiter1);
  6161. strarray.Add(m_time2);
  6162. strarray.Add(m_waiter3);
  6163. strarray.Add(m_time4);
  6164. strarray.Add(m_waiter2);
  6165. strarray.Add(m_waiter4);
  6166. strarray.Add(m_time5);
  6167. strarray.Add("");
  6168. for (i = 42; i <= 49; i++)
  6169. {
  6170. StrRect = load.m_rcarray.ElementAt(i - 1);
  6171. m_Print.DrawRect2(StrRect, 1);
  6172. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6173. }
  6174. m_Print.SetFontFace(15, 1, "宋体");
  6175. StrRect = load.m_rcarray.ElementAt(29);
  6176. m_Print.DrawRect2(StrRect, 1);
  6177. StrRect.top += 45;
  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); StrRect.top += 20;
  6181. m_Print.DrawText((LPTSTR)(LPCTSTR)"容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  6182. StrRect = load.m_rcarray.ElementAt(30);
  6183. m_Print.DrawRect2(StrRect, 1);
  6184. StrRect.top += 45;
  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); StrRect.top += 20;
  6188. m_Print.DrawText((LPTSTR)(LPCTSTR)"示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  6189. m_Print.SetFontFace(10, 1, "宋体");
  6190. StrRect = load.m_rcarray.ElementAt(37); StrRect.top = StrRect.bottom + 2;
  6191. str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  6192. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  6193. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  6194. StrRect = load.m_rcarray.ElementAt(48); StrRect.top = StrRect.bottom + 2; StrRect.left -= 200;
  6195. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  6196. //开始画文字
  6197. StrRect = load.m_rcarray.ElementAt(31);
  6198. StrRect.left += 3;
  6199. StrRect.top += 3;
  6200. StrRect.right -= 2;
  6201. StrRect.bottom -= 2;
  6202. str = "";
  6203. for (i = 0; i < sparray.GetSize(); i++)
  6204. {
  6205. str += sparray.ElementAt(i).ElementAt(5);
  6206. str += " 数量:";
  6207. str += sparray.ElementAt(i).ElementAt(3);
  6208. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6209. str += "\r\n";
  6210. }
  6211. str.TrimRight("\r\n");
  6212. m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6213. m_bz.TrimLeft();
  6214. if (m_bz != "")
  6215. {
  6216. str += "\r\n"; str += "\r\n";
  6217. str += "备注:" + m_bz;
  6218. }
  6219. AutoDraw(m_Print, StrRect, str, 1.4);
  6220. StrRect = load.m_rcarray.ElementAt(32); m_Print.DrawRect2(StrRect, 1);
  6221. StrRect.left += 3;
  6222. StrRect.top += 3;
  6223. StrRect.right -= 2;
  6224. StrRect.bottom -= 2;
  6225. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6226. if (str.IsEmpty())
  6227. {
  6228. str = "\
  6229. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6230. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6231. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6232. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6233. 持良好的心境.\r\n\
  6234. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6235. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6236. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6237. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6238. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6239. 勿进影室, 以免影响拍摄.\r\n\
  6240. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6241. 师或店长沟通.\r\n\
  6242. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6243. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6244. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6245. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6246. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6247. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6248. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6249. 还.";
  6250. }
  6251. AutoDraw(m_Print, StrRect, str, 1.8);
  6252. }
  6253. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6254. dlg.m_pDC = m_Print.GetPDC();
  6255. dlg.m_mode = 1;
  6256. if (aa == 0)
  6257. {
  6258. if (dlg.DoModal() != IDOK)
  6259. return;
  6260. printcot = dlg.m_num;
  6261. }
  6262. //结束打印
  6263. m_Print.EndPage();
  6264. m_Print.EndPrint();
  6265. }
  6266. }
  6267. void CMainFrame::PrintDinDan4(CString m_id)
  6268. {
  6269. // TODO: Add your control notification handler code here
  6270. CPrintRX m_Print;
  6271. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6272. {
  6273. m_Print.InitToPrint(NULL, 1);
  6274. }
  6275. else
  6276. {
  6277. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  6278. if (name.IsEmpty())
  6279. m_Print.InitToPrint(NULL, 1);
  6280. else
  6281. {
  6282. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6283. if (nret == -1)
  6284. {
  6285. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6286. }
  6287. }
  6288. }
  6289. m_Print.StartPrint();
  6290. m_Print.StartPage();
  6291. LoadRect load;
  6292. load.SetLiaPath("6-2.lia");
  6293. load.SetMargins(0, 0);
  6294. if (!load.Load())return;
  6295. int i;
  6296. //////////////////////////////////////////////////////////////
  6297. CStringArray txarray;
  6298. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  6299. g_sendhead.code[0] = 11;
  6300. g_sendhead.code[1] = 52;
  6301. g_sendhead.code[2] = 50;
  6302. g_sendhead.code[3] = 150;
  6303. g_sendhead.code[4] = 77;
  6304. g_sendhead.code[5] = 4;
  6305. g_sendhead.tabcount = 6;
  6306. g_sendhead.bsql = 0;
  6307. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  6308. CArray<CStringArray, CStringArray>sparray;
  6309. CArray<CStringArray, CStringArray>clientarray;
  6310. CArray<CStringArray, CStringArray>phonearray;
  6311. CArray<CStringArray, CStringArray>fgarray;
  6312. CArray<CStringArray, CStringArray>danweiarray;
  6313. CArray<CStringArray, CStringArray>jdarray;
  6314. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  6315. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  6316. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  6317. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  6318. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  6319. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  6320. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  6321. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  6322. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  6323. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  6324. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  6325. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  6326. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  6327. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  6328. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  6329. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  6330. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  6331. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  6332. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  6333. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  6334. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  6335. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  6336. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  6337. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  6338. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  6339. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  6340. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  6341. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  6342. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  6343. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6344. if (jdarray.GetSize())
  6345. {
  6346. if (m_bz.IsEmpty() == 0)
  6347. m_bz = "\r\n" + m_bz;
  6348. m_bz += "景点:";
  6349. }
  6350. for (i = 0; i < jdarray.GetSize(); i++)
  6351. {
  6352. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  6353. }
  6354. m_bz.TrimRight(";");
  6355. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  6356. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  6357. if (IsHasRights2new(31) == 0)
  6358. {
  6359. m_phone1 = "***";
  6360. m_phone2 = "***";
  6361. }
  6362. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  6363. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  6364. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  6365. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  6366. CString str;
  6367. filter = "name='" + m_ren + "'";
  6368. g_sendhead.code[0] = 5;
  6369. g_sendhead.tabcount = 1;
  6370. g_sendhead.bsql = 0;
  6371. int g_nYearposTemp = g_nYearpos;
  6372. g_nYearpos = -1;
  6373. g_pMainWnd->ProcessChatMessageRequest2(filter);
  6374. g_nYearpos = g_nYearposTemp;
  6375. if (g_bSendOK == 0)return;
  6376. DataToArray(&phonearray);
  6377. m_money1.Format("%f", atof(m_taoxijiage));
  6378. m_money2.Format("%f", atof(m_payed1));
  6379. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  6380. ConvertToPrice(m_money1);
  6381. ConvertToPrice(m_money2);
  6382. ConvertToPrice(m_money3);
  6383. ////////////////////////////////////////////////////////////////
  6384. int rcpos = -1;
  6385. CRect StrRect = load.m_rcarray.ElementAt(0);
  6386. m_Print.SetFontFace(25, 1, "黑体");
  6387. m_Print.DrawText((LPTSTR)(LPCTSTR)"巴黎春天婚纱摄影预约单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6388. m_Print.SetFontFace(11, 1, "宋体");
  6389. StrRect = load.m_rcarray.ElementAt(1);
  6390. if (m_time1.GetLength() == 10)
  6391. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  6392. else
  6393. str = "开单日期:";
  6394. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6395. StrRect = load.m_rcarray.ElementAt(2);
  6396. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + m_id), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6397. CStringArray strarray;
  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("选片日期");
  6408. strarray.Add("QQ/邮箱");
  6409. strarray.Add("套系总额");
  6410. strarray.Add("定金");
  6411. strarray.Add("余款金额");
  6412. strarray.Add("取件日期");
  6413. strarray.Add(m_name1);
  6414. strarray.Add(m_name2);
  6415. strarray.Add(m_clothescount);
  6416. str.Format("%d", atoi(m_zs) * 3);
  6417. strarray.Add(str);
  6418. strarray.Add(m_time2);
  6419. strarray.Add(m_phone1);
  6420. strarray.Add(m_phone2);
  6421. strarray.Add(m_clothescount2);
  6422. strarray.Add(m_zs);
  6423. strarray.Add(m_time4);
  6424. strarray.Add(m_qq1);
  6425. strarray.Add(m_money1);
  6426. strarray.Add(m_money2);
  6427. strarray.Add(m_money3);
  6428. strarray.Add(m_time5);
  6429. for (i = 4; i <= 33; i++)
  6430. {
  6431. StrRect = load.m_rcarray.ElementAt(i - 1);
  6432. m_Print.DrawRect2(StrRect, 1);
  6433. if (strarray.GetSize() > (i - 4))
  6434. {
  6435. if (i <= 18)
  6436. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6437. else
  6438. {
  6439. StrRect.left += 4;
  6440. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6441. }
  6442. }
  6443. }
  6444. int dt = 413;
  6445. StrRect = load.m_rcarray.ElementAt(36); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6446. m_Print.DrawText((LPTSTR)(LPCTSTR)"门市签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6447. StrRect = load.m_rcarray.ElementAt(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6448. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6449. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6450. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6451. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  6452. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址:深圳市红岭中路中深国际大厦首层,二十二层", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6453. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  6454. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:0755-61308198 61308199 25860696 25860697", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6455. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  6456. m_Print.DrawText((LPTSTR)(LPCTSTR)"网址:www.paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6457. StrRect = load.m_rcarray.ElementAt(43); StrRect.top += dt; StrRect.bottom += dt;
  6458. m_Print.DrawText((LPTSTR)(LPCTSTR)"邮箱:blct@paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6459. //////////////////////////////
  6460. //开始画文字
  6461. StrRect = load.m_rcarray.ElementAt(7);
  6462. int hei = StrRect.Height();
  6463. StrRect.top += hei;
  6464. StrRect.bottom += hei;
  6465. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6466. StrRect.top += dt;
  6467. StrRect.bottom += dt;
  6468. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6469. StrRect = load.m_rcarray.ElementAt(17);
  6470. StrRect.top += hei;
  6471. StrRect.bottom += hei;
  6472. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6473. StrRect = load.m_rcarray.ElementAt(33);
  6474. StrRect.bottom = StrRect.top + dt; m_Print.DrawRect2(StrRect, 1);
  6475. StrRect.top += hei;
  6476. StrRect.left += 3;
  6477. StrRect.top += 3;
  6478. StrRect.right -= 2;
  6479. StrRect.bottom -= 2;
  6480. str = "";
  6481. for (i = 0; i < sparray.GetSize(); i++)
  6482. {
  6483. str += sparray.ElementAt(i).ElementAt(5);
  6484. str += " 数量:";
  6485. str += sparray.ElementAt(i).ElementAt(3);
  6486. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6487. str += "\r\n";
  6488. }
  6489. str.TrimRight("\r\n");
  6490. AutoDraw(m_Print, StrRect, str, 1.4);
  6491. StrRect = load.m_rcarray.ElementAt(33);
  6492. StrRect.top += dt;
  6493. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6494. StrRect.top += hei;
  6495. StrRect.left += 3;
  6496. StrRect.top += 3;
  6497. StrRect.right -= 2;
  6498. StrRect.bottom -= 2;
  6499. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  6500. StrRect = load.m_rcarray.ElementAt(34);
  6501. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6502. StrRect.top += hei;
  6503. StrRect.left += 3;
  6504. StrRect.top += 3;
  6505. StrRect.right -= 2;
  6506. StrRect.bottom -= 2;
  6507. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6508. if (str.IsEmpty())
  6509. {
  6510. str = "\
  6511. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6512. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6513. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6514. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6515. 持良好的心境.\r\n\
  6516. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6517. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6518. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6519. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6520. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6521. 勿进影室, 以免影响拍摄.\r\n\
  6522. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6523. 师或店长沟通.\r\n\
  6524. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6525. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6526. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6527. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6528. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6529. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6530. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6531. 还.";
  6532. }
  6533. AutoDraw(m_Print, StrRect, str, 1.8);
  6534. StrRect = load.m_rcarray.ElementAt(35);
  6535. StrRect.bottom += 100;
  6536. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  6537. 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∨";
  6538. AutoDraw(m_Print, StrRect, str, 1.4);
  6539. PrintPreview dlg;
  6540. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6541. dlg.m_pDC = m_Print.GetPDC();
  6542. if (dlg.DoModal() != IDOK)return;
  6543. //结束打印
  6544. m_Print.EndPage();
  6545. m_Print.EndPrint();
  6546. }
  6547. int CalHeight_01(CRect &rc, CStringArray *saContent, CPrintRX *Print, int FORMAT)
  6548. {
  6549. CSize size;
  6550. int nMaxheight = 0;
  6551. CString strTemp;
  6552. CString strContent;
  6553. int nSize = saContent->GetSize();
  6554. int nRow = 0; // 行数;
  6555. for (int i = 0; i < nSize; i++)
  6556. {
  6557. strTemp = "";
  6558. strContent = saContent->ElementAt(i);
  6559. while (FALSE == strContent.IsEmpty())
  6560. {
  6561. strContent = strContent.Mid(strTemp.GetLength());
  6562. if (strContent.IsEmpty())
  6563. break;
  6564. Print->GetStrSize((LPTSTR)(LPCTSTR)strContent, size);
  6565. if (size.cx <= rc.Width())
  6566. {
  6567. CRect rc2 = rc;
  6568. rc2.top += nRow*(size.cy + 1);
  6569. rc2.bottom = rc2.top + (size.cy + 1);
  6570. Print->DrawText((LPTSTR)(LPCTSTR)strContent, rc2, 0, 0, FORMAT | FORMAT_UP);
  6571. nMaxheight = max(nMaxheight, rc2.bottom);
  6572. nRow++;
  6573. break;
  6574. }
  6575. int right = 0;
  6576. while (size.cx > rc.Width())
  6577. {
  6578. right++;
  6579. strTemp = strContent.Left(strContent.GetLength() - (right));
  6580. if (GIsHalfHZ(strTemp))
  6581. {
  6582. right++;
  6583. strTemp.Delete(strTemp.GetLength() - 1);
  6584. }
  6585. Print->GetStrSize((LPTSTR)(LPCTSTR)strTemp, size);
  6586. }
  6587. CRect rc2 = rc;
  6588. rc2.top += nRow*(size.cy + 1);
  6589. rc2.bottom = rc2.top + (size.cy + 1);
  6590. Print->DrawText((LPTSTR)(LPCTSTR)strTemp, rc2, 0, 0, FORMAT | FORMAT_UP); //printf("Jeff:str=%s\n\n",str);// Jeff Printf;
  6591. nRow++;
  6592. nMaxheight = max(nMaxheight, rc2.bottom);
  6593. }
  6594. }
  6595. return (nMaxheight == 0) ? (rc.bottom + 1) : (nMaxheight + 1);
  6596. }
  6597. /************************************************************************/
  6598. /*
  6599. 多字节字符编码下的CaleHeight函数;
  6600. 函数:CaleHeight
  6601. 描述:计算出一行高度可变,宽度特定的表格(CArray<CRect,CRect>),在输入指定内容时(CStringArray),表格高度变化最大的值。
  6602. 参数:
  6603. aRowRect: 一行表格,CArray::GetSize()表示表格列数;
  6604. aRowStr: 与表格对应的一行字符,CStringArray::GetSize()大小与CArray::GetSize()一致。
  6605. pPrinter: 打印机实例指针;
  6606. nFormat: 字符串的显示格式。
  6607. 返回:返回最大的表格高度;
  6608. 注意:只能多字节下使用,因为函数GIsHalfHZ。
  6609. */
  6610. /************************************************************************/
  6611. INT CalcHeight( IN CArray<CRect, CRect> &aRowRect, IN CStringArray &aRowStr, IN CPrintRX *pPrinter, IN CONST INT& nFormat)
  6612. {
  6613. // 参数有效性;
  6614. if( aRowRect.GetSize() != aRowStr.GetSize() )
  6615. {
  6616. OutputDebugString(_T("表格列数与字符列数不等!\n"));
  6617. return -1;
  6618. }
  6619. if( pPrinter == NULL )
  6620. {
  6621. OutputDebugString(_T("打印机句柄指针无效\n"));
  6622. return -1;
  6623. }
  6624. // 表格字串长度;
  6625. CSize size;
  6626. // 当前表格字体高度;
  6627. INT nGridFontHeight = 0;
  6628. // 当前表格区域;
  6629. CRect curGrid;
  6630. // 当前表格字符串;
  6631. CString strGridContent;
  6632. // 最大值高底;
  6633. INT nMaxHeigth = 0;
  6634. // 当前换行数;
  6635. INT nWrapRows = 0;
  6636. // 当前换行字串;
  6637. CString strWrapRow = _T("");
  6638. // 表格列数;
  6639. INT nColumns = aRowRect.GetSize();
  6640. // 临时表格;
  6641. CRect rcGrid;
  6642. // 循环计算每个表格的高度;
  6643. for( INT i = 0; i < nColumns; i++ )
  6644. {
  6645. nWrapRows = 0;
  6646. strWrapRow.Empty();
  6647. curGrid = aRowRect.ElementAt(i);
  6648. strGridContent = aRowStr.ElementAt(i);
  6649. nMaxHeigth = max(nMaxHeigth, curGrid.bottom);
  6650. while( !strGridContent.IsEmpty() )
  6651. {
  6652. strGridContent = strGridContent.Right(strGridContent.GetLength() - strWrapRow.GetLength());
  6653. if ( strGridContent.IsEmpty() )
  6654. {
  6655. OutputDebugString(_T("表格字符已空\n"));
  6656. break;
  6657. }
  6658. pPrinter->GetStrSize((LPTSTR)(LPCTSTR)strGridContent, size);
  6659. nGridFontHeight = size.cy + 1;
  6660. // 字串长度 <= 表格宽度;
  6661. if( size.cx <= curGrid.Width() )
  6662. {
  6663. rcGrid = curGrid;
  6664. rcGrid.top += nWrapRows*nGridFontHeight;
  6665. rcGrid.bottom = rcGrid.top + nGridFontHeight;
  6666. nMaxHeigth = max(nMaxHeigth, rcGrid.bottom);
  6667. pPrinter->DrawText((LPTSTR)(LPCTSTR)strGridContent, rcGrid, 0, 0, nFormat|FORMAT_UP);
  6668. break;
  6669. }
  6670. else
  6671. {// 字串长度 >= 表格宽度;
  6672. INT nRight = 0; // 字串右位置;
  6673. // 从右边开始逐个字符取出,直到左边字串小于表格宽度;
  6674. while( size.cx > curGrid.Width() )
  6675. {
  6676. nRight++;
  6677. strWrapRow = strGridContent.Left(strGridContent.GetLength() - nRight);
  6678. if( GIsHalfHZ(strWrapRow) )
  6679. {// 判断字串最后一个字符是否是汉字;
  6680. nRight++;
  6681. strWrapRow.Delete(strWrapRow.GetLength() - 1);
  6682. }
  6683. pPrinter->GetStrSize((LPTSTR)(LPCTSTR)strWrapRow, size);
  6684. }
  6685. rcGrid = curGrid;
  6686. rcGrid.top += nWrapRows*nGridFontHeight;
  6687. rcGrid.bottom = rcGrid.top + nGridFontHeight;
  6688. nMaxHeigth = max(nMaxHeigth, rcGrid.bottom);
  6689. pPrinter->DrawText((LPTSTR)(LPCTSTR)strWrapRow, rcGrid, 0, 0, nFormat|FORMAT_UP);
  6690. // 换行加+1;
  6691. nWrapRows++;
  6692. }
  6693. }
  6694. }
  6695. return nMaxHeigth + 1;
  6696. }
  6697. void CMainFrame::PrintReceipt(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  6698. {
  6699. //AfxMessageBox("abce");
  6700. int i = 0;
  6701. int printcot = 1;
  6702. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  6703. {
  6704. g_sendhead.bsql = 0;
  6705. g_sendhead.code[0] = 24;
  6706. g_sendhead.tabcount = 1;
  6707. int g_nYearposTemp = g_nYearpos;
  6708. g_nYearpos = -1;
  6709. g_pMainWnd->ProcessChatMessageRequest2(1);
  6710. g_nYearpos = g_nYearposTemp;
  6711. if (0 == g_bSendOK)return;
  6712. DataToArray(&g_cominfoarray);
  6713. CString SerialNo;
  6714. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6715. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  6716. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6717. CString sql;
  6718. sql.Format("update version set [serialno]='%s'", SerialNo);
  6719. g_sendhead.bsql=1;
  6720. g_nYearposTemp=g_nYearpos;
  6721. g_nYearpos=-1;
  6722. g_pMainWnd->ProcessChatMessageRequest2(sql);
  6723. g_nYearpos=g_nYearposTemp;
  6724. #endif
  6725. // 1.创建打印对象
  6726. CPrintRX m_Print;
  6727. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6728. {
  6729. m_Print.InitToPrint(NULL, 1);
  6730. }
  6731. else
  6732. {
  6733. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  6734. if (name.IsEmpty())
  6735. m_Print.InitToPrint(NULL, 1);
  6736. else
  6737. {
  6738. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6739. if (nret == -1 && aa == 0)
  6740. {
  6741. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6742. }
  6743. }
  6744. }
  6745. // 2.开始打印
  6746. m_Print.StartPrint();
  6747. m_Print.StartPage();
  6748. LoadRect load;
  6749. BOOL bSmall = 0;
  6750. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  6751. {
  6752. bSmall = 1;
  6753. load.SetLiaPath("20.lia");
  6754. }
  6755. else
  6756. load.SetLiaPath("10.lia");
  6757. if (bSmall)
  6758. load.SetMargins(0, 0);
  6759. else
  6760. load.SetMargins(10, 0);
  6761. if (!load.Load())return;
  6762. int rcpos = -1;
  6763. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6764. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  6765. {
  6766. Image *pImg = NULL;
  6767. g_nSendCode = 31;
  6768. int g_nYearposTemp = g_nYearpos;
  6769. g_nYearpos = -1;
  6770. g_pMainWnd->ProcessChatMessageRequest2(1);
  6771. g_nYearpos = g_nYearposTemp;
  6772. g_nSendCode = 0;
  6773. if (g_bSendOK == 0)return;
  6774. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  6775. if (pImg)
  6776. {
  6777. StrRect.left = 65;
  6778. if (bSmall) StrRect.left = 55;
  6779. StrRect.top = 10;
  6780. StrRect.right = StrRect.left + 58;
  6781. StrRect.bottom = StrRect.top + 58;
  6782. // 3.打印2维码图像;
  6783. m_Print.DrawImage(pImg, StrRect);
  6784. delete pImg;
  6785. pImg = NULL;
  6786. }
  6787. }
  6788. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  6789. if (bSmall)
  6790. {
  6791. m_Print.SetFontFace(18, 1, "黑体");
  6792. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6793. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6794. m_Print.SetFontFace(9, 1, "宋体");
  6795. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6796. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6797. m_Print.SetFontFace(6, 1, "宋体");
  6798. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6799. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6800. m_Print.SetFontFace(9, 1, "宋体");
  6801. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6802. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6803. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6804. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6805. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6806. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6807. int hei = StrRect.Height();
  6808. StrRect.bottom = StrRect.top;
  6809. StrRect.top -= 8;
  6810. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6811. m_Print.SetFontFace(11, 1, "宋体");
  6812. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6813. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6814. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6815. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6816. m_Print.SetFontFace(8, 1, "宋体");
  6817. for (i = 7; i < 24; i++)
  6818. {
  6819. StrRect = load.m_rcarray.ElementAt(i);
  6820. m_Print.DrawRect2(StrRect, 1);
  6821. }
  6822. for (i = 9; i < 24; i++)
  6823. {
  6824. StrRect = load.m_rcarray.ElementAt(i);
  6825. StrRect.left += 2;
  6826. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6827. }
  6828. m_Print.SetFontFace(6, 1, "宋体");
  6829. for (i = 24; i < 26; i++)
  6830. {
  6831. StrRect = load.m_rcarray.ElementAt(i);
  6832. StrRect.left += 2;
  6833. if (i == 24)
  6834. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6835. else
  6836. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6837. }
  6838. // StrRect=load.m_rcarray .ElementAt (27);
  6839. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  6840. }
  6841. else//大单
  6842. {
  6843. // 1.打印表头(蒙娜丽莎收款单)
  6844. m_Print.SetFontFace(20, 1, "黑体");
  6845. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6846. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6847. m_Print.SetFontFace(11, 1, "宋体");
  6848. // 2.打印订单号(NO.20140608-001)
  6849. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6850. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6851. // 3.打印SerialNo(SerialNo.01062)
  6852. int hei = StrRect.Height();
  6853. StrRect.bottom = StrRect.top;
  6854. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6855. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6856. // 4.打印影楼地址信息、电话;
  6857. m_Print.SetFontFace(8, 1, "宋体");
  6858. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6859. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6860. m_Print.SetFontFace(11, 1, "宋体");
  6861. // 5.打印客户姓名
  6862. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6863. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6864. // 6.打印客户联系电话
  6865. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6866. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6867. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6868. // 7.打印开单日期
  6869. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6870. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6871. // 8.打印列字段:收款项目
  6872. m_Print.SetFontFace(13, 1, "宋体");
  6873. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6874. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6875. //printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6876. // 9.打印列字段:金额
  6877. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6878. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6879. //printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6880. // 10.打印列字段:开单人
  6881. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6882. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6883. //printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6884. // 11.画表格-画3列;
  6885. m_Print.SetFontFace(11, 1, "宋体");
  6886. for (i = 7; i < 10; i++)
  6887. {
  6888. StrRect = load.m_rcarray.ElementAt(i);
  6889. m_Print.DrawRect2(StrRect, 1);
  6890. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6891. }
  6892. // 12.打印详细内容
  6893. int dty = 0;
  6894. int dtytemp = 0;
  6895. // for( i=10; i<14; i+=3)
  6896. for (i = 10; i<22; i += 3) // 循环4次,再画
  6897. {
  6898. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  6899. CArray<CRect, CRect>rcarray;
  6900. CStringArray strarray2;
  6901. StrRect = load.m_rcarray.ElementAt(i);
  6902. StrRect.top += dty;
  6903. StrRect.bottom += dty;
  6904. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  6905. {
  6906. StrRect = load.m_rcarray.ElementAt(i - 1);
  6907. StrRect.top += dty;
  6908. StrRect.bottom += dty;
  6909. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  6910. break;
  6911. }
  6912. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  6913. StrRect.left += 2;
  6914. StrRect.right -= 2;
  6915. StrRect.top += 4;
  6916. rcarray.Add(StrRect);
  6917. strarray2.Add(pArray->ElementAt(i));
  6918. // 指定格子宽度,计算字符串占几行(高度).
  6919. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  6920. dtytemp = bottom - StrRect.bottom;
  6921. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  6922. // 重新获取表格大小,并画出表格;
  6923. StrRect = load.m_rcarray.ElementAt(i);
  6924. StrRect.bottom += dtytemp;
  6925. StrRect.top += dty;
  6926. StrRect.bottom += dty;
  6927. m_Print.DrawRect2(StrRect, 1);
  6928. // 获取下一表格大小,并画出表格;
  6929. StrRect = load.m_rcarray.ElementAt(i + 1);
  6930. StrRect.top += dty;
  6931. StrRect.bottom += dty;
  6932. StrRect.bottom += dtytemp;
  6933. m_Print.DrawRect2(StrRect, 1);
  6934. StrRect.left += 2;
  6935. // 打印出金额字段内容
  6936. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6937. //printf("Jeff:%d:%s\n\n",i+1,pArray->ElementAt(i+1));//Jeff Printf;
  6938. StrRect = load.m_rcarray.ElementAt(i + 2);
  6939. StrRect.top += dty;
  6940. StrRect.bottom += dty;
  6941. StrRect.bottom += dtytemp;
  6942. m_Print.DrawRect2(StrRect, 1);
  6943. StrRect.left += 2;
  6944. // 打印开单人字段内容
  6945. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6946. //printf("Jeff:%d:%s\n\n",i+2,pArray->ElementAt(i+2));//Jeff Printf;
  6947. dty += dtytemp;
  6948. }
  6949. //.打印->付款情况 应付 实付 欠款.
  6950. i = 22;
  6951. StrRect = load.m_rcarray.ElementAt(i);
  6952. StrRect.top += dty;
  6953. StrRect.bottom += dty;
  6954. m_Print.DrawRect2(StrRect, 1);
  6955. StrRect.left += 2;
  6956. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6957. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  6958. //.打印->合计人民币(大写):.......
  6959. i = 23;
  6960. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  6961. m_Print.DrawRect2(StrRect, 1);
  6962. StrRect.left += 2;
  6963. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6964. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  6965. m_Print.SetFontFace(7, 1, "宋体");
  6966. for (i = 24; i < 27; i++)
  6967. {
  6968. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  6969. StrRect.left += 2;
  6970. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6971. }
  6972. StrRect = load.m_rcarray.ElementAt(24); StrRect.top += dty; StrRect.bottom += dty;
  6973. hei = StrRect.Height();
  6974. StrRect.top += hei;
  6975. StrRect.bottom += hei;
  6976. StrRect.right += 100;
  6977. StrRect.left += 2;
  6978. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  6979. AutoDraw(m_Print, StrRect, pArray->ElementAt(27), 1.0);
  6980. }
  6981. PrintPreview dlg;
  6982. dlg.m_mode = 3;
  6983. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6984. dlg.m_pDC = m_Print.GetPDC();
  6985. if (aa == 0)
  6986. {
  6987. if (dlg.DoModal() != IDOK)
  6988. return;
  6989. printcot = dlg.m_num;
  6990. }
  6991. //结束打印
  6992. m_Print.EndPage();
  6993. m_Print.EndPrint();
  6994. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  6995. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6996. CString sql;
  6997. sql.Format("update version set [serialno]='%s'", SerialNo);
  6998. g_sendhead.bsql = 1;
  6999. g_nYearposTemp = g_nYearpos;
  7000. g_nYearpos = -1;
  7001. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7002. g_nYearpos = g_nYearposTemp;
  7003. #endif
  7004. }
  7005. }
  7006. /************************************************************************/
  7007. /*
  7008. 函数:PrintRechargeRecord
  7009. 描述:打印会员卡充值记录;
  7010. 参数:
  7011. pArryRechargeRecod[IN]:要打印的数据;
  7012. 返回:
  7013. 注意:
  7014. 示例:
  7015. */
  7016. /************************************************************************/
  7017. void CMainFrame::PrintRechargeRecord(CStringArray *pArryRechargeRecod)
  7018. {
  7019. }
  7020. void CMainFrame::PrintReceipt_01(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  7021. {
  7022. //AfxMessageBox("abce");
  7023. int i = 0;
  7024. int printcot = 1;
  7025. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  7026. {
  7027. g_sendhead.bsql = 0;
  7028. g_sendhead.code[0] = 24;
  7029. g_sendhead.tabcount = 1;
  7030. int g_nYearposTemp = g_nYearpos;
  7031. g_nYearpos = -1;
  7032. g_pMainWnd->ProcessChatMessageRequest2(1);
  7033. g_nYearpos = g_nYearposTemp;
  7034. if (0 == g_bSendOK)return;
  7035. DataToArray(&g_cominfoarray);
  7036. CString SerialNo;
  7037. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7038. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7039. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7040. CString sql;
  7041. sql.Format("update version set [serialno]='%s'", SerialNo);
  7042. g_sendhead.bsql=1;
  7043. g_nYearposTemp=g_nYearpos;
  7044. g_nYearpos=-1;
  7045. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7046. g_nYearpos=g_nYearposTemp;
  7047. #endif
  7048. // 1.创建打印对象
  7049. CPrintRX m_Print;
  7050. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7051. {
  7052. m_Print.InitToPrint(NULL, 1);
  7053. }
  7054. else
  7055. {
  7056. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  7057. if (name.IsEmpty())
  7058. m_Print.InitToPrint(NULL, 1);
  7059. else
  7060. {
  7061. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  7062. if (nret == -1 && aa == 0)
  7063. {
  7064. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  7065. m_Print.InitToPrint(NULL, 1);
  7066. }
  7067. }
  7068. }
  7069. // 2.开始打印
  7070. m_Print.StartPrint();
  7071. m_Print.StartPage();
  7072. LoadRect load;
  7073. BOOL bSmall = 0;
  7074. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  7075. {
  7076. bSmall = 1;
  7077. load.SetLiaPath("20.lia");
  7078. }
  7079. else
  7080. load.SetLiaPath("10.lia");
  7081. if (bSmall)
  7082. load.SetMargins(0, 0);
  7083. else
  7084. load.SetMargins(10, 0);
  7085. if (!load.Load())return;
  7086. int rcpos = -1;
  7087. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7088. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  7089. {
  7090. Image *pImg = NULL;
  7091. g_nSendCode = 31;
  7092. int g_nYearposTemp = g_nYearpos;
  7093. g_nYearpos = -1;
  7094. g_pMainWnd->ProcessChatMessageRequest2(1);
  7095. g_nYearpos = g_nYearposTemp;
  7096. g_nSendCode = 0;
  7097. if (g_bSendOK == 0)return;
  7098. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7099. if (pImg)
  7100. {
  7101. StrRect.left = 65;
  7102. if (bSmall) StrRect.left = 55;
  7103. StrRect.top = 10;
  7104. StrRect.right = StrRect.left + 58;
  7105. StrRect.bottom = StrRect.top + 58;
  7106. // 3.打印2维码图像;
  7107. m_Print.DrawImage(pImg, StrRect);
  7108. delete pImg;
  7109. pImg = NULL;
  7110. }
  7111. }
  7112. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  7113. if (bSmall)
  7114. {
  7115. m_Print.SetFontFace(18, 1, "黑体");
  7116. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7117. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7118. m_Print.SetFontFace(9, 1, "宋体");
  7119. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7120. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7121. m_Print.SetFontFace(6, 1, "宋体");
  7122. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7123. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7124. m_Print.SetFontFace(9, 1, "宋体");
  7125. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7126. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7127. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7128. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7129. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7130. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7131. int hei = StrRect.Height();
  7132. StrRect.bottom = StrRect.top;
  7133. StrRect.top -= 8;
  7134. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7135. m_Print.SetFontFace(11, 1, "宋体");
  7136. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7137. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7138. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7139. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7140. m_Print.SetFontFace(8, 1, "宋体");
  7141. for ( i = 7; i < 24; i++)
  7142. {
  7143. StrRect = load.m_rcarray.ElementAt(i);
  7144. m_Print.DrawRect2(StrRect, 1);
  7145. }
  7146. for (i = 9; i < 24; i++)
  7147. {
  7148. StrRect = load.m_rcarray.ElementAt(i);
  7149. StrRect.left += 2;
  7150. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7151. }
  7152. m_Print.SetFontFace(6, 1, "宋体");
  7153. for (i = 24; i < 26; i++)
  7154. {
  7155. StrRect = load.m_rcarray.ElementAt(i);
  7156. StrRect.left += 2;
  7157. if (i == 24)
  7158. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7159. else
  7160. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7161. }
  7162. // StrRect=load.m_rcarray .ElementAt (27);
  7163. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  7164. }
  7165. else//大单
  7166. {
  7167. // 1.打印表头(蒙娜丽莎收款单)
  7168. m_Print.SetFontFace(20, 1, "黑体");
  7169. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7170. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7171. m_Print.SetFontFace(11, 1, "宋体");
  7172. // 2.打印订单号(NO.20140608-001)
  7173. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7174. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7175. // 3.打印SerialNo(SerialNo.01062)
  7176. int hei = StrRect.Height();
  7177. StrRect.bottom = StrRect.top;
  7178. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7179. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7180. // 4.打印影楼地址信息、电话;
  7181. m_Print.SetFontFace(8, 1, "宋体");
  7182. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7183. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7184. m_Print.SetFontFace(11, 1, "宋体");
  7185. // 5.打印客户姓名
  7186. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7187. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7188. // 6.打印客户联系电话
  7189. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7190. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7191. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7192. // 7.打印开单日期
  7193. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7194. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7195. #if 0 // Original Edition
  7196. // 8.打印列字段:收款项目
  7197. m_Print.SetFontFace(13, 1, "宋体");
  7198. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7199. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7200. printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7201. // 9.打印列字段:金额
  7202. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7203. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7204. printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7205. // 10.打印列字段:开单人
  7206. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7207. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7208. printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7209. #else
  7210. // 8.打印列字段:收款项目
  7211. m_Print.SetFontFace(13, 1, "宋体");
  7212. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7213. StrRect = CRect(66, 85, 280, 105);
  7214. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7215. //m_Print.DrawText("收款项目",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7216. // 8.1 Jeff add:支付方式
  7217. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7218. StrRect = CRect(280, 85, 350, 105);
  7219. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7220. //m_Print.DrawText("支付方式",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7221. // 9.打印列字段:金额
  7222. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7223. StrRect = CRect(350, 85, 442, 105);
  7224. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7225. //m_Print.DrawText("金额",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7226. // 10.打印列字段:开单人
  7227. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7228. StrRect = CRect(442, 85, 535, 105);
  7229. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7230. //m_Print.DrawText("开单人",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7231. //rcpos += 3;
  7232. #endif
  7233. // 11.画表格-画3列;old
  7234. // 11.draw 4 column
  7235. m_Print.SetFontFace(11, 1, "宋体");
  7236. //for( i=7; i<10; i++)
  7237. //{
  7238. // StrRect=load.m_rcarray.ElementAt(i);
  7239. // m_Print.DrawRect2(StrRect, 1);
  7240. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7241. //}
  7242. m_Print.DrawRect2(CRect(66, 85, 280, 105), 1);
  7243. m_Print.DrawRect2(CRect(280, 85, 350, 105), 1);
  7244. m_Print.DrawRect2(CRect(350, 85, 442, 105), 1);
  7245. m_Print.DrawRect2(CRect(442, 85, 535, 105), 1);
  7246. // 12.打印详细内容
  7247. int dty = 0;
  7248. int dtytemp = 0;
  7249. // for( i=10; i<14; i+=3)
  7250. //for( i=10; i<22; i+=3) // 循环4次,再画
  7251. int j = 0;
  7252. for (i = 10, j = 11; i<22; i += 3, j += 4) // 循环4次,再画
  7253. {
  7254. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  7255. CArray<CRect, CRect>rcarray;
  7256. CStringArray strarray2;
  7257. StrRect = load.m_rcarray.ElementAt(i);
  7258. StrRect.top += dty;
  7259. StrRect.bottom += dty;
  7260. StrRect.right -= 70; // Jeff add
  7261. //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;
  7262. /*
  7263. 4次的CRect
  7264. 66,105,350,125
  7265. 66,126,350,146
  7266. 66,147,350,167
  7267. 66,168,350,188
  7268. */
  7269. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  7270. {
  7271. StrRect = load.m_rcarray.ElementAt(i - 1);
  7272. StrRect.top += dty;
  7273. StrRect.bottom += dty;
  7274. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  7275. break;
  7276. }
  7277. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  7278. StrRect.left += 2;
  7279. StrRect.right -= 2;
  7280. StrRect.top += 4;
  7281. rcarray.Add(StrRect);
  7282. //strarray2.Add(pArray->ElementAt(i+1));
  7283. strarray2.Add(pArray->ElementAt(j));
  7284. //printf("Jeff:%d:%s\n\n",j,pArray->ElementAt(j));//Jeff Printf;
  7285. // 指定格子宽度,计算字符串占几行(高度).
  7286. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  7287. dtytemp = bottom - StrRect.bottom;
  7288. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7289. // 重新获取表格大小,并画出表格;
  7290. /*
  7291. CRect(66,85,280,105),
  7292. CRect(280,85,350,105)
  7293. CRect(350,85,442,105)
  7294. CRect(442,85,535,105)
  7295. CRect(66,105,350,125),
  7296. CRect(66,126,350,146)
  7297. CRect(66,147,350,167)
  7298. CRect(66,168,350,188)
  7299. */
  7300. // 画收款项目框及打印内容;
  7301. StrRect = load.m_rcarray.ElementAt(i);
  7302. //StrRect=CRect(66,85,280,105);
  7303. StrRect.bottom += dtytemp;
  7304. StrRect.top += dty;
  7305. StrRect.bottom += dty;
  7306. //StrRect.left -= 70; // Jeff add
  7307. StrRect.right -= 70; // Jeff add
  7308. //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;
  7309. m_Print.DrawRect2(StrRect, 1);
  7310. // 画支付方式框及打印内容;
  7311. StrRect = load.m_rcarray.ElementAt(i);
  7312. //StrRect=CRect(280,85,350,105);
  7313. StrRect.bottom += dtytemp;
  7314. StrRect.top += dty;
  7315. StrRect.bottom += dty;
  7316. StrRect.left += StrRect.Width() - 70;
  7317. //StrRect.right += 70; // Jeff add
  7318. //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;
  7319. m_Print.DrawRect2(StrRect, 1);
  7320. StrRect.left += 2;
  7321. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7322. //printf("Jeff:%d:%s\n\n",j+1,pArray->ElementAt(j+1));//Jeff Printf;
  7323. // 画金额框及打印内容;
  7324. StrRect = load.m_rcarray.ElementAt(i + 1);
  7325. //StrRect=CRect(350,85,442,105);
  7326. StrRect.top += dty;
  7327. StrRect.bottom += dty;
  7328. StrRect.bottom += dtytemp;
  7329. //StrRect.right -= 70; // Jeff add
  7330. //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;
  7331. m_Print.DrawRect2(StrRect, 1);
  7332. StrRect.left += 2;
  7333. // 打印出金额字段内容
  7334. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7335. //printf("Jeff:%d:%s\n\n",j+2,pArray->ElementAt(j+2));//Jeff Printf;
  7336. // 画开单人框及打印内容;
  7337. StrRect = load.m_rcarray.ElementAt(i + 2);
  7338. //StrRect=CRect(442,85,535,105);
  7339. StrRect.top += dty;
  7340. StrRect.bottom += dty;
  7341. StrRect.bottom += dtytemp;
  7342. //StrRect.right -= 70; // Jeff add
  7343. //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;
  7344. m_Print.DrawRect2(StrRect, 1);
  7345. StrRect.left += 2;
  7346. // 打印开单人字段内容
  7347. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 3), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7348. //printf("Jeff:%d:%s\n\n",j+3,pArray->ElementAt(j+3));//Jeff Printf;
  7349. dty += dtytemp;
  7350. }
  7351. //.打印->付款情况 应付 实付 欠款.
  7352. i = 22;
  7353. j = 27;
  7354. StrRect = load.m_rcarray.ElementAt(i);
  7355. StrRect.top += dty;
  7356. StrRect.bottom += dty;
  7357. m_Print.DrawRect2(StrRect, 1);
  7358. StrRect.left += 2;
  7359. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7360. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7361. //.打印->合计人民币(大写):.......
  7362. i = 23;
  7363. j = 28;
  7364. StrRect = load.m_rcarray.ElementAt(i);
  7365. StrRect.top += dty;
  7366. StrRect.bottom += dty;
  7367. m_Print.DrawRect2(StrRect, 1);
  7368. StrRect.left += 2;
  7369. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7370. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7371. // 打印总金额;
  7372. m_Print.SetFontFace(7, 1, "宋体");
  7373. for (i = 24, j = 29; i < 27; i++, j++)
  7374. {
  7375. StrRect = load.m_rcarray.ElementAt(i);
  7376. StrRect.top += dty;
  7377. StrRect.bottom += dty;
  7378. StrRect.left += 2;
  7379. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7380. }
  7381. StrRect = load.m_rcarray.ElementAt(24);
  7382. StrRect.top += dty;
  7383. StrRect.bottom += dty;
  7384. hei = StrRect.Height();
  7385. StrRect.top += hei;
  7386. StrRect.bottom += hei;
  7387. StrRect.right += 100;
  7388. StrRect.left += 2;
  7389. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  7390. AutoDraw(m_Print, StrRect, pArray->ElementAt(32), 1.0);
  7391. }
  7392. PrintPreview dlg;
  7393. dlg.m_mode = 3;
  7394. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  7395. dlg.m_pDC = m_Print.GetPDC();
  7396. if (aa == 0)
  7397. {
  7398. if (dlg.DoModal() != IDOK)
  7399. {
  7400. return;
  7401. }
  7402. printcot = dlg.m_num;
  7403. }
  7404. //结束打印
  7405. m_Print.EndPage();
  7406. m_Print.EndPrint();
  7407. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7408. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7409. CString sql;
  7410. sql.Format("update version set [serialno]='%s'", SerialNo);
  7411. g_sendhead.bsql = 1;
  7412. g_nYearposTemp = g_nYearpos;
  7413. g_nYearpos = -1;
  7414. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7415. g_nYearpos = g_nYearposTemp;
  7416. #endif
  7417. }
  7418. }
  7419. void CMainFrame::PrintReceipt_02(CStringArray *pArray, CPrintRX *pPrinter, const int &nCount, const BOOL bPrintImmediately) // 打印订单*预约收款、预约补款*
  7420. {
  7421. //AfxMessageBox("abce");
  7422. int printcot = 1;
  7423. // for(int aa=0; aa<printcot; aa++) // Jeff, printcot=1....
  7424. // {
  7425. g_sendhead.bsql = 0;
  7426. g_sendhead.code[0] = 24;
  7427. g_sendhead.tabcount = 1;
  7428. int g_nYearposTemp = g_nYearpos;
  7429. g_nYearpos = -1;
  7430. g_pMainWnd->ProcessChatMessageRequest2(1);
  7431. g_nYearpos = g_nYearposTemp;
  7432. if (0 == g_bSendOK)return;
  7433. DataToArray(&g_cominfoarray);
  7434. CString SerialNo;
  7435. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7436. CPrintRX *tagPrinter = NULL;
  7437. if (pPrinter == NULL)
  7438. {
  7439. // 1.创建打印对象
  7440. tagPrinter = new CPrintRX;
  7441. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7442. {
  7443. tagPrinter->InitToPrint(NULL, 1);
  7444. }
  7445. else
  7446. {
  7447. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  7448. if (name.IsEmpty())
  7449. {
  7450. tagPrinter->InitToPrint(NULL, 1);
  7451. }
  7452. else
  7453. {
  7454. int nret = tagPrinter->InitToPrint((char*)(LPCTSTR)name, 1);
  7455. ///if(nret==-1 && aa==0)
  7456. if (nret == -1)
  7457. {
  7458. if (bPrintImmediately == FALSE)
  7459. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  7460. tagPrinter->InitToPrint(NULL, 1);
  7461. }
  7462. }
  7463. }
  7464. // 2.开始打印
  7465. tagPrinter->StartPrint();
  7466. tagPrinter->StartPage();
  7467. }
  7468. else
  7469. {
  7470. //SerialNo.Format ("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126))+1);
  7471. tagPrinter = pPrinter;
  7472. }
  7473. LoadRect load;
  7474. BOOL bSmall = 0;
  7475. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  7476. {
  7477. bSmall = 1;
  7478. load.SetLiaPath("20.lia");
  7479. }
  7480. else
  7481. load.SetLiaPath("10.lia");
  7482. if (bSmall)
  7483. load.SetMargins(0, 0);
  7484. else
  7485. load.SetMargins(10, 0);
  7486. if (!load.Load())return;
  7487. int rcpos = -1;
  7488. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7489. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  7490. {
  7491. Image *pImg = NULL;
  7492. g_nSendCode = 31;
  7493. int g_nYearposTemp = g_nYearpos;
  7494. g_nYearpos = -1;
  7495. g_pMainWnd->ProcessChatMessageRequest2(1);
  7496. g_nYearpos = g_nYearposTemp;
  7497. g_nSendCode = 0;
  7498. if (g_bSendOK == 0)return;
  7499. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7500. if (pImg)
  7501. {
  7502. StrRect.left = 65;
  7503. if (bSmall) StrRect.left = 55;
  7504. StrRect.top = 10;
  7505. StrRect.right = StrRect.left + 58;
  7506. StrRect.bottom = StrRect.top + 58;
  7507. // 3.打印2维码图像;
  7508. tagPrinter->DrawImage(pImg, StrRect);
  7509. delete pImg;
  7510. pImg = NULL;
  7511. }
  7512. }
  7513. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  7514. if (bSmall)
  7515. {
  7516. tagPrinter->SetFontFace(18, 1, "黑体");
  7517. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7518. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7519. tagPrinter->SetFontFace(9, 1, "宋体");
  7520. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7521. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7522. tagPrinter->SetFontFace(6, 1, "宋体");
  7523. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7524. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7525. tagPrinter->SetFontFace(9, 1, "宋体");
  7526. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7527. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7528. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7529. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7530. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7531. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7532. int hei = StrRect.Height();
  7533. StrRect.bottom = StrRect.top;
  7534. StrRect.top -= 8;
  7535. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7536. tagPrinter->SetFontFace(11, 1, "宋体");
  7537. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7538. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7539. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7540. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7541. tagPrinter->SetFontFace(8, 1, "宋体");
  7542. int i = 0;
  7543. for (i = 7; i < 24; i++)
  7544. {
  7545. StrRect = load.m_rcarray.ElementAt(i);
  7546. tagPrinter->DrawRect2(StrRect, 1);
  7547. }
  7548. for (i = 9; i < 24; i++)
  7549. {
  7550. StrRect = load.m_rcarray.ElementAt(i);
  7551. StrRect.left += 2;
  7552. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7553. }
  7554. tagPrinter->SetFontFace(6, 1, "宋体");
  7555. for (i = 24; i < 26; i++)
  7556. {
  7557. StrRect = load.m_rcarray.ElementAt(i);
  7558. StrRect.left += 2;
  7559. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7560. }
  7561. StrRect = load.m_rcarray.ElementAt(22);
  7562. int nH = StrRect.Height();
  7563. int nW = StrRect.Width();
  7564. int nlen = load.m_rcarray.GetSize();
  7565. int nLeft = StrRect.left;
  7566. int j = 0;
  7567. for (i = 27; i<32; i++)
  7568. {
  7569. CRect rct = StrRect;
  7570. if(i == 31)
  7571. {
  7572. rct.top = rct.top + (nH*(j - 1));
  7573. rct.bottom = rct.top + nH;
  7574. rct.left = rct.left + 200;
  7575. rct.right = rct.left + 200;
  7576. }
  7577. else
  7578. {
  7579. rct.top = rct.top + (nH*j);
  7580. rct.bottom = rct.top + nH;
  7581. rct.left = rct.left + 2;
  7582. rct.right = rct.left + 200;
  7583. }
  7584. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), rct, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7585. j++;
  7586. }
  7587. }
  7588. else//大单
  7589. {
  7590. // 1.打印表头(蒙娜丽莎收款单)
  7591. tagPrinter->SetFontFace(20, 1, "黑体");
  7592. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7593. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7594. tagPrinter->SetFontFace(11, 1, "宋体");
  7595. // 2.打印订单号(NO.20140608-001)
  7596. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7597. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7598. // 3.打印SerialNo(SerialNo.01062)
  7599. int hei = StrRect.Height();
  7600. StrRect.bottom = StrRect.top;
  7601. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7602. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7603. // 4.打印影楼地址信息、电话;
  7604. tagPrinter->SetFontFace(8, 1, "宋体");
  7605. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7606. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7607. tagPrinter->SetFontFace(11, 1, "宋体");
  7608. // 5.打印客户姓名
  7609. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7610. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7611. // 6.打印客户联系电话
  7612. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7613. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7614. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7615. // 7.打印开单日期
  7616. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7617. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7618. #if 0 // Original Edition
  7619. // 8.打印列字段:收款项目
  7620. tagPrinter->SetFontFace(13, 1, "宋体");
  7621. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7622. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7623. printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7624. // 9.打印列字段:金额
  7625. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7626. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7627. printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7628. // 10.打印列字段:开单人
  7629. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7630. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7631. printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7632. #else
  7633. // 8.打印列字段:收款项目
  7634. tagPrinter->SetFontFace(13, 1, "宋体");
  7635. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7636. StrRect = CRect(66, 85, 280, 105);
  7637. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7638. //m_Print.DrawText("收款项目",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7639. // 8.1 Jeff add:支付方式
  7640. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7641. StrRect = CRect(280, 85, 350, 105);
  7642. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7643. //m_Print.DrawText("支付方式",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7644. // 9.打印列字段:金额
  7645. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7646. StrRect = CRect(350, 85, 442, 105);
  7647. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7648. //m_Print.DrawText("金额",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7649. // 10.打印列字段:开单人
  7650. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7651. StrRect = CRect(442, 85, 535, 105);
  7652. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7653. //m_Print.DrawText("开单人",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7654. //rcpos += 3;
  7655. #endif
  7656. // 11.画表格-画3列;old
  7657. // 11.draw 4 column
  7658. tagPrinter->SetFontFace(11, 1, "宋体");
  7659. int i;
  7660. //for( i=7; i<10; i++)
  7661. //{
  7662. // StrRect=load.m_rcarray.ElementAt(i);
  7663. // m_Print.DrawRect2(StrRect, 1);
  7664. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7665. //}
  7666. tagPrinter->DrawRect2(CRect(66, 85, 280, 105), 1);
  7667. tagPrinter->DrawRect2(CRect(280, 85, 350, 105), 1);
  7668. tagPrinter->DrawRect2(CRect(350, 85, 442, 105), 1);
  7669. tagPrinter->DrawRect2(CRect(442, 85, 535, 105), 1);
  7670. // 12.打印详细内容
  7671. int dty = 0;
  7672. int dtytemp = 0;
  7673. // for( i=10; i<14; i+=3)
  7674. //for( i=10; i<22; i+=3) // 循环4次,再画
  7675. int j = 0;
  7676. for (i = 10, j = 11; i<22; i += 3, j += 4) // 循环4次,再画
  7677. {
  7678. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  7679. CArray<CRect, CRect>rcarray;
  7680. CStringArray strarray2;
  7681. StrRect = load.m_rcarray.ElementAt(i);
  7682. StrRect.top += dty;
  7683. StrRect.bottom += dty;
  7684. StrRect.right -= 70; // Jeff add
  7685. //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;
  7686. /*
  7687. 4次的CRect
  7688. 66,105,350,125
  7689. 66,126,350,146
  7690. 66,147,350,167
  7691. 66,168,350,188
  7692. */
  7693. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  7694. {
  7695. StrRect = load.m_rcarray.ElementAt(i - 1);
  7696. StrRect.top += dty;
  7697. StrRect.bottom += dty;
  7698. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  7699. break;
  7700. }
  7701. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  7702. StrRect.left += 2;
  7703. StrRect.right -= 2;
  7704. StrRect.top += 4;
  7705. rcarray.Add(StrRect);
  7706. //strarray2.Add(pArray->ElementAt(i+1));
  7707. strarray2.Add(pArray->ElementAt(j));
  7708. //printf("Jeff:%d:%s\n\n",j,pArray->ElementAt(j));//Jeff Printf;
  7709. // 指定格子宽度,计算字符串占几行(高度).
  7710. INT bottom = CalcHeight(rcarray, strarray2, tagPrinter, FORMAT_LEFT);
  7711. dtytemp = bottom - StrRect.bottom;
  7712. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7713. // 重新获取表格大小,并画出表格;
  7714. /*
  7715. CRect(66,85,280,105),
  7716. CRect(280,85,350,105)
  7717. CRect(350,85,442,105)
  7718. CRect(442,85,535,105)
  7719. CRect(66,105,350,125),
  7720. CRect(66,126,350,146)
  7721. CRect(66,147,350,167)
  7722. CRect(66,168,350,188)
  7723. */
  7724. // 画收款项目框及打印内容;
  7725. StrRect = load.m_rcarray.ElementAt(i);
  7726. //StrRect=CRect(66,85,280,105);
  7727. StrRect.bottom += dtytemp;
  7728. StrRect.top += dty;
  7729. StrRect.bottom += dty;
  7730. //StrRect.left -= 70; // Jeff add
  7731. StrRect.right -= 70; // Jeff add
  7732. //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;
  7733. tagPrinter->DrawRect2(StrRect, 1);
  7734. // 画支付方式框及打印内容;
  7735. StrRect = load.m_rcarray.ElementAt(i);
  7736. //StrRect=CRect(280,85,350,105);
  7737. StrRect.bottom += dtytemp;
  7738. StrRect.top += dty;
  7739. StrRect.bottom += dty;
  7740. StrRect.left += StrRect.Width() - 70;
  7741. //StrRect.right += 70; // Jeff add
  7742. //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;
  7743. tagPrinter->DrawRect2(StrRect, 1);
  7744. StrRect.left += 2;
  7745. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7746. //printf("Jeff:%d:%s\n\n",j+1,pArray->ElementAt(j+1));//Jeff Printf;
  7747. // 画金额框及打印内容;
  7748. StrRect = load.m_rcarray.ElementAt(i + 1);
  7749. //StrRect=CRect(350,85,442,105);
  7750. StrRect.top += dty;
  7751. StrRect.bottom += dty;
  7752. StrRect.bottom += dtytemp;
  7753. //StrRect.right -= 70; // Jeff add
  7754. //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;
  7755. tagPrinter->DrawRect2(StrRect, 1);
  7756. StrRect.left += 2;
  7757. // 打印出金额字段内容
  7758. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7759. //printf("Jeff:%d:%s\n\n",j+2,pArray->ElementAt(j+2));//Jeff Printf;
  7760. // 画开单人框及打印内容;
  7761. StrRect = load.m_rcarray.ElementAt(i + 2);
  7762. //StrRect=CRect(442,85,535,105);
  7763. StrRect.top += dty;
  7764. StrRect.bottom += dty;
  7765. StrRect.bottom += dtytemp;
  7766. //StrRect.right -= 70; // Jeff add
  7767. //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;
  7768. tagPrinter->DrawRect2(StrRect, 1);
  7769. StrRect.left += 2;
  7770. // 打印开单人字段内容
  7771. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 3), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7772. //printf("Jeff:%d:%s\n\n",j+3,pArray->ElementAt(j+3));//Jeff Printf;
  7773. dty += dtytemp;
  7774. }
  7775. //.打印->付款情况 应付 实付 欠款.
  7776. i = 22;
  7777. j = 27;
  7778. StrRect = load.m_rcarray.ElementAt(i);
  7779. StrRect.top += dty;
  7780. StrRect.bottom += dty;
  7781. tagPrinter->DrawRect2(StrRect, 1);
  7782. StrRect.left += 2;
  7783. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7784. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7785. //.打印->合计人民币(大写):.......
  7786. i = 23;
  7787. j = 28;
  7788. StrRect = load.m_rcarray.ElementAt(i);
  7789. StrRect.top += dty;
  7790. StrRect.bottom += dty;
  7791. tagPrinter->DrawRect2(StrRect, 1);
  7792. StrRect.left += 2;
  7793. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7794. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7795. // 打印总金额;
  7796. tagPrinter->SetFontFace(7, 1, "宋体");
  7797. for (i = 24, j = 29; i < 27; i++, j++)
  7798. {
  7799. StrRect = load.m_rcarray.ElementAt(i);
  7800. StrRect.top += dty;
  7801. StrRect.bottom += dty;
  7802. StrRect.left += 2;
  7803. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7804. }
  7805. StrRect = load.m_rcarray.ElementAt(24);
  7806. StrRect.top += dty;
  7807. StrRect.bottom += dty;
  7808. hei = StrRect.Height();
  7809. StrRect.top += hei;
  7810. StrRect.bottom += hei;
  7811. StrRect.right += 100;
  7812. StrRect.left += 2;
  7813. StrRect = load.m_rcarray.ElementAt(27);
  7814. StrRect.top += dty;
  7815. StrRect.bottom += dty;
  7816. AutoDraw(*tagPrinter, StrRect, pArray->ElementAt(32), 1.0);
  7817. }
  7818. if (bPrintImmediately == TRUE)
  7819. {
  7820. printcot = nCount;
  7821. ////结束打印
  7822. tagPrinter->EndPage();
  7823. tagPrinter->EndPrint();
  7824. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7825. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7826. CString sql;
  7827. sql.Format("update version set [serialno]='%s'", SerialNo);
  7828. g_sendhead.bsql = 1;
  7829. g_nYearposTemp = g_nYearpos;
  7830. g_nYearpos = -1;
  7831. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7832. g_nYearpos = g_nYearposTemp;
  7833. #endif
  7834. }
  7835. else
  7836. {
  7837. PrintPreview dlg;
  7838. dlg.m_mode = 3;
  7839. tagPrinter->GetWidHei(dlg.m_w, dlg.m_h);
  7840. dlg.m_pDC = tagPrinter->GetPDC();
  7841. //if(aa==0)
  7842. //{
  7843. if (dlg.DoModal() != IDOK)
  7844. {
  7845. return;
  7846. }
  7847. else
  7848. {
  7849. printcot = dlg.m_num;
  7850. //m_Print.deletePrinter();
  7851. for (int i = 0; i < printcot; i++)
  7852. {
  7853. //tagPrinter->EndPage();
  7854. //tagPrinter->m_DC.AbortDoc(); // 结束清空由StartDoc写入的内容;2014-09-15;
  7855. //tagPrinter->m_DC.EndDoc();
  7856. //Sleep(10000);
  7857. //tagPrinter->StartPrint();
  7858. //tagPrinter->NewPage();
  7859. //PrintReceipt_02(pArray,/*tagPrinter*/NULL,printcot,TRUE);
  7860. PrintReceipt_02(pArray, tagPrinter, printcot, TRUE);
  7861. }
  7862. }
  7863. if (tagPrinter) delete tagPrinter;
  7864. //}
  7865. }
  7866. //}
  7867. }
  7868. void CMainFrame::PrintFlowChart(CString strOrderNumber) // 选片打单;
  7869. {
  7870. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(75)))
  7871. {
  7872. // Jeff 使用风格2打印;
  7873. //PrintFlowChart3_20151116(strOrderNumber);
  7874. PrintFlowChart3(strOrderNumber);
  7875. return;
  7876. }
  7877. #ifdef ZHIAI_VERSION
  7878. PrintFlowChart2(strOrderNumber);
  7879. return;
  7880. #endif
  7881. int i = 0;
  7882. int printcot = 1;
  7883. for (int aa = 0; aa < printcot; aa++)
  7884. {
  7885. CPrintRX m_Print;
  7886. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7887. {
  7888. m_Print.InitToPrint(NULL, 1);
  7889. }
  7890. else
  7891. {
  7892. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  7893. if (name.IsEmpty())
  7894. m_Print.InitToPrint(NULL, 1);
  7895. else
  7896. {
  7897. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  7898. if (nret == -1 && aa == 0)
  7899. {
  7900. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  7901. }
  7902. }
  7903. }
  7904. m_Print.StartPrint();
  7905. m_Print.StartPage();
  7906. // CRect StrRect(0,0,560,818);
  7907. LoadRect load;
  7908. load.SetLiaPath("4.lia");
  7909. load.SetMargins(-14, -14);
  7910. if (!load.Load())return;
  7911. LoadRect load2;
  7912. load2.SetMargins(-14, 472 + 27 - 14);
  7913. load2.SetLiaPath("5.lia");
  7914. if (!load2.Load())return;
  7915. //////////////////////////////////////////////////////////////
  7916. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2'";
  7917. g_sendhead.code[0] = 54;
  7918. g_sendhead.code[1] = 223;
  7919. g_sendhead.tabcount = 2;
  7920. g_sendhead.bsql = 0;
  7921. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  7922. CArray<CStringArray, CStringArray>sparray;
  7923. DataToArray(&g_List1array, &sparray);
  7924. CString spno;
  7925. for ( i = 0; i < sparray.GetSize(); i++)
  7926. {
  7927. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  7928. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  7929. if (sparray.ElementAt(i).ElementAt(5) == "入册" && sparray.ElementAt(i).ElementAt(5) == "入底" && sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  7930. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  7931. spno += sparray.ElementAt(i).ElementAt(5);
  7932. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  7933. spno += "; ";
  7934. else
  7935. {
  7936. spno += ":";
  7937. spno += sparray.ElementAt(i).ElementAt(6);
  7938. spno += "; ";
  7939. }
  7940. }
  7941. spno += " 加挑:";
  7942. for (i = 0; i < sparray.GetSize(); i++)
  7943. {
  7944. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  7945. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  7946. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  7947. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  7948. spno += sparray.ElementAt(i).ElementAt(5);
  7949. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  7950. spno += "; ";
  7951. else
  7952. {
  7953. spno += ":";
  7954. spno += sparray.ElementAt(i).ElementAt(6);
  7955. spno += "; ";
  7956. }
  7957. }
  7958. if (spno.Right(6) == " 加挑:")
  7959. {
  7960. spno = spno.Left(spno.GetLength() - 6);
  7961. }
  7962. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  7963. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  7964. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  7965. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  7966. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  7967. if (m_urgent.IsEmpty())m_urgent = "否";
  7968. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  7969. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  7970. // CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  7971. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  7972. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  7973. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  7974. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  7975. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  7976. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  7977. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  7978. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  7979. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(17) + g_List1array.ElementAt(0).ElementAt(29);
  7980. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  7981. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  7982. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  7983. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  7984. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  7985. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  7986. CString m_sum3;
  7987. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  7988. ::ConvertToPrice(m_sum3);
  7989. if (m_money3.IsEmpty())m_money3 = "0";
  7990. // m_money3=m_money3+"/"+m_sum3;
  7991. CString name;
  7992. if (!m_name1.IsEmpty())
  7993. name = m_name1 + ",";
  7994. name += m_name2;
  7995. name.TrimRight(",");
  7996. CString phone;
  7997. if (!m_phone1.IsEmpty())
  7998. phone = m_phone1 + ",";
  7999. phone += m_phone2; phone.TrimRight(",");
  8000. if (IsHasRights2new(31) == 0)
  8001. phone = "***";
  8002. CStringArray strarray;
  8003. strarray.Add(m_urgent);
  8004. strarray.Add(m_ren);
  8005. strarray.Add(m_waiter3);
  8006. strarray.Add(name);
  8007. strarray.Add(m_time2);
  8008. strarray.Add(m_time4);
  8009. strarray.Add(m_money3);
  8010. strarray.Add(m_sum3);
  8011. strarray.Add(m_takezs);
  8012. strarray.Add(m_taoxizs);
  8013. strarray.Add(m_choosezs);
  8014. strarray.Add(strOrderNumber);
  8015. strarray.Add(phone);
  8016. ////////////////////////////////////////////////////////////////
  8017. int rcpos = -1;
  8018. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8019. Image *pImg = NULL;
  8020. #ifdef MNLS_VERSION
  8021. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  8022. #else
  8023. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  8024. #endif
  8025. m_Print.DrawImage(pImg, StrRect);
  8026. delete pImg;
  8027. m_Print.SetFontFace(11, 1, "宋体");
  8028. StrRect = load2.m_rcarray.ElementAt(7);
  8029. StrRect.top = load2.m_rcarray.ElementAt(15).top - 15;
  8030. StrRect.bottom = load2.m_rcarray.ElementAt(15).bottom - 15;
  8031. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  8032. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8033. StrRect.top += 15;
  8034. StrRect.bottom += 15;
  8035. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  8036. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8037. m_Print.SetFontFace(15, 1, "宋体");
  8038. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8039. #ifdef MNLS_VERSION
  8040. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8041. #endif
  8042. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8043. #ifdef MNLS_VERSION
  8044. m_Print.DrawRect(StrRect);
  8045. #endif
  8046. m_Print.SetFontFace(7, 1, "黑体");
  8047. m_Print.SetColor(0xffffff);
  8048. #ifdef MNLS_VERSION
  8049. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8050. #endif
  8051. m_Print.SetColor(0);
  8052. m_Print.SetFontFace(25, 1, "黑体");
  8053. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8054. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8055. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  8056. {
  8057. Image *pImg = NULL;
  8058. g_nSendCode = 31;
  8059. int g_nYearposTemp = g_nYearpos;
  8060. g_nYearpos = -1;
  8061. g_pMainWnd->ProcessChatMessageRequest2(1);
  8062. g_nYearpos = g_nYearposTemp;
  8063. g_nSendCode = 0;
  8064. if (g_bSendOK == 0)return;
  8065. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8066. if (pImg)
  8067. {
  8068. StrRect.left = 450;
  8069. StrRect.top = 22;
  8070. StrRect.right = StrRect.left + 60;
  8071. StrRect.bottom = StrRect.top + 60;
  8072. m_Print.DrawImage(pImg, StrRect);
  8073. delete pImg; pImg = NULL;
  8074. }
  8075. }
  8076. #ifdef CHILD_VERSION
  8077. CString title[13] = { "是否加急:", "接单门市:", \
  8078. "选样人员:", "客人姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  8079. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:"
  8080. };
  8081. #else
  8082. CString title[13] = { "是否加急:", "接单门市:", \
  8083. "选样人员:", "新郎新娘姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  8084. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:" };
  8085. #endif
  8086. m_Print.SetFontFace(12, 1, "宋体");
  8087. for (i = 0; i < 13; i++)
  8088. {
  8089. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8090. if (i < 3)
  8091. m_Print.DrawRect2(StrRect, 0);
  8092. else
  8093. m_Print.DrawRect2(StrRect, 1);
  8094. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8095. }
  8096. for (i = 18; i <= 37; i++)
  8097. {
  8098. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8099. if (i >= 19 && i <= 21)
  8100. m_Print.DrawRect2(StrRect, 2);
  8101. /* else if(i==26)
  8102. {
  8103. CRect rc=StrRect;
  8104. CRect rc2=rc;
  8105. rc.right -=rc2.Width ()/2;
  8106. m_Print.DrawRect2(rc, 1);
  8107. rc2.left +=rc.Width ();
  8108. m_Print.DrawRect2(rc2, 1);
  8109. }*/
  8110. else
  8111. m_Print.DrawRect2(StrRect, 1);
  8112. if (i == 18)
  8113. {
  8114. StrRect.left += 5;
  8115. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8116. }
  8117. }
  8118. //////////////////////////////////////
  8119. rcpos = -1;
  8120. for (i = 0; i < 8; i++)
  8121. {
  8122. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8123. m_Print.DrawRect2(StrRect, 1);
  8124. }
  8125. #ifdef CHILD_VERSION
  8126. CString title2[4] = { "引导师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  8127. #else
  8128. CString title2[4] = { "化妆师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  8129. #endif
  8130. for (i = 0; i < 4; i++)
  8131. {
  8132. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8133. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8134. }
  8135. for (i = 0; i < 4; i++)
  8136. {
  8137. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8138. m_Print.DrawRect2(StrRect, 2);
  8139. }
  8140. StrRect = load2.m_rcarray.ElementAt(11);
  8141. StrRect.top -= 15;
  8142. StrRect.bottom -= 15;
  8143. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客选片签名:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8144. StrRect = load2.m_rcarray.ElementAt(15);
  8145. StrRect.top -= 15;
  8146. StrRect.bottom -= 15;
  8147. m_Print.DrawRect2(StrRect, 2);
  8148. ///////////////////////////////////////////
  8149. for (i = 19; i <= 31; i++)
  8150. {
  8151. StrRect = load.m_rcarray.ElementAt(i - 1);
  8152. StrRect.left += 4;
  8153. if (i == 31)
  8154. {
  8155. if (m_phone1.IsEmpty() == 0 && m_phone2.IsEmpty() == 0)
  8156. {
  8157. StrRect.top += 2;
  8158. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  8159. StrRect.top += 8;
  8160. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8161. }
  8162. else
  8163. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8164. }
  8165. /* else if((i-19)==7)
  8166. {
  8167. CRect rc=StrRect;
  8168. CRect rc2=rc;
  8169. rc.right -=rc2.Width ()/2;
  8170. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8171. rc2.left +=rc.Width ()+3;
  8172. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8173. }*/
  8174. else
  8175. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8176. }
  8177. strarray.RemoveAll();
  8178. strarray.Add(m_waiter2);
  8179. strarray.Add(m_waiter1);
  8180. strarray.Add(m_waiter4);
  8181. for (i = 13; i <= 15; i++)
  8182. {
  8183. StrRect = load2.m_rcarray.ElementAt(i - 1);
  8184. StrRect.left += 4;
  8185. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8186. }
  8187. ///////////spno
  8188. CRect sprc[14];
  8189. for (i = 0; i < 14; i++)
  8190. {
  8191. if (i < 7)
  8192. {
  8193. if (i == 0)
  8194. {
  8195. StrRect = load.m_rcarray.ElementAt(17); StrRect.left += 94; StrRect.right -= 3;
  8196. }
  8197. else
  8198. {
  8199. StrRect = load.m_rcarray.ElementAt(30 + i); StrRect.left += 4; StrRect.right -= 3;
  8200. }
  8201. }
  8202. else
  8203. {
  8204. StrRect = load2.m_rcarray.ElementAt(i - 7); StrRect.left += 4; StrRect.right -= 3;
  8205. }
  8206. sprc[i] = StrRect;
  8207. }
  8208. CString temp, tempspno, tempbz;
  8209. CSize size;
  8210. BOOL bRun = 0;
  8211. int fontsize = 12;
  8212. ll: tempspno = spno;
  8213. tempbz = m_bz;
  8214. m_Print.SetFontFace(fontsize, 1, "宋体");
  8215. for (i = 0; i<14; i++)
  8216. {
  8217. if (!tempspno.IsEmpty())
  8218. {
  8219. temp = tempspno;
  8220. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8221. int right = 0;
  8222. CRect temprc = sprc[i];
  8223. while (size.cx>temprc.Width())
  8224. {
  8225. right++;
  8226. temp = tempspno.Left(tempspno.GetLength() - (right));
  8227. if (GIsHalfHZ(temp))
  8228. {
  8229. right++;
  8230. temp.Delete(temp.GetLength() - 1);
  8231. }
  8232. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8233. }
  8234. if (bRun)
  8235. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8236. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  8237. if (tempspno.IsEmpty())i++;
  8238. }
  8239. else if (!tempbz.IsEmpty())
  8240. {
  8241. temp = tempbz;
  8242. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8243. int right = 0;
  8244. CRect temprc = sprc[i];
  8245. while (size.cx > temprc.Width())
  8246. {
  8247. right++;
  8248. temp = tempbz.Left(tempbz.GetLength() - (right));
  8249. if (GIsHalfHZ(temp))
  8250. {
  8251. right++;
  8252. temp.Delete(temp.GetLength() - 1);
  8253. }
  8254. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8255. }
  8256. if (bRun)
  8257. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8258. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  8259. }
  8260. }
  8261. if (tempspno.IsEmpty() == 0 || tempbz.IsEmpty() == 0)
  8262. {
  8263. fontsize--;
  8264. goto ll;
  8265. }
  8266. if (bRun == 0)
  8267. {
  8268. bRun = 1;
  8269. goto ll;
  8270. }
  8271. PrintPreview dlg;
  8272. dlg.m_mode = 2;
  8273. dlg.m_name = name;
  8274. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8275. dlg.m_pDC = m_Print.GetPDC();
  8276. if (aa == 0)
  8277. {
  8278. if (dlg.DoModal() != IDOK)
  8279. return;
  8280. printcot = dlg.m_num;
  8281. }
  8282. //结束打印
  8283. m_Print.EndPage();
  8284. m_Print.EndPrint();
  8285. }
  8286. }
  8287. void CMainFrame::PrintFlowChart3LKAY(CString strOrderNumber)
  8288. {
  8289. int i = 0;
  8290. int printcot = 1;
  8291. for (int aa = 0; aa < printcot; aa++)
  8292. {
  8293. CPrintRX m_Print;
  8294. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  8295. {
  8296. m_Print.InitToPrint(NULL, 1);
  8297. }
  8298. else
  8299. {
  8300. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  8301. if (name.IsEmpty())
  8302. m_Print.InitToPrint(NULL, 1);
  8303. else
  8304. {
  8305. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8306. if (nret == -1 && aa == 0)
  8307. {
  8308. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8309. }
  8310. }
  8311. }
  8312. m_Print.StartPrint();
  8313. m_Print.StartPage();
  8314. LoadRect load;
  8315. load.SetLiaPath("18.lia");
  8316. load.SetMargins(10, 0);
  8317. if (!load.Load())return;
  8318. CString str;
  8319. int rcpos = -1;
  8320. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8321. m_Print.SetFontFace(25, 1, "宋体");
  8322. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8323. m_Print.SetFontFace(15, 1, "宋体");
  8324. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8325. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8326. m_Print.SetFontFace(9, 1, "宋体");
  8327. //////////////////////////////////////////////////////////////
  8328. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8329. g_sendhead.code[0] = 54;
  8330. g_sendhead.code[1] = 223;
  8331. g_sendhead.code[2] = 52;
  8332. g_sendhead.tabcount = 3;
  8333. g_sendhead.bsql = 0;
  8334. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  8335. CArray<CStringArray, CStringArray>sparray;
  8336. CArray<CStringArray, CStringArray>clientarray;
  8337. DataToArray(&g_List1array, &sparray, &clientarray);
  8338. CString spno;
  8339. CStringArray sparray2;
  8340. for ( i = 0; i < sparray.GetSize(); i++)
  8341. {
  8342. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8343. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8344. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8345. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8346. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8347. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8348. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8349. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8350. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8351. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8352. }
  8353. for (i = 0; i < sparray.GetSize(); i++)
  8354. {
  8355. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8356. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8357. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8358. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8359. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8360. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8361. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8362. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8363. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8364. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8365. }
  8366. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8367. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8368. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8369. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8370. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8371. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8372. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8373. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8374. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8375. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8376. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8377. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8378. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8379. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8380. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8381. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8382. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8383. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8384. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8385. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8386. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8387. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8388. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8389. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8390. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8391. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8392. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8393. CString m_sum3;
  8394. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8395. ::ConvertToPrice(m_sum3);
  8396. if (m_money3.IsEmpty())m_money3 = "0";
  8397. int dty = 0;
  8398. CString name;
  8399. if (!m_name1.IsEmpty())
  8400. name = m_name1 + ",";
  8401. name += m_name2;
  8402. name.TrimRight(",");
  8403. CString phone;
  8404. if (!m_phone1.IsEmpty())
  8405. phone = m_phone1 + ",";
  8406. phone += m_phone2; phone.TrimRight(",");
  8407. if (IsHasRights2new(31) == 0)
  8408. phone = "***";
  8409. CStringArray strarray;
  8410. #ifdef CHILD_VERSION
  8411. if (m_birthday.IsEmpty())
  8412. strarray.Add("姓名/性别");
  8413. else
  8414. strarray.Add("姓名/性别/年龄");
  8415. #else
  8416. strarray.Add("客人姓名");
  8417. #endif
  8418. strarray.Add("电话");
  8419. strarray.Add("单号");
  8420. strarray.Add("套系");
  8421. strarray.Add("选样");
  8422. strarray.Add("余款/加挑");
  8423. strarray.Add("选片/日期");
  8424. #ifdef CHILD_VERSION
  8425. if (m_birthday.IsEmpty())
  8426. strarray.Add(name + "/" + m_sex);
  8427. else
  8428. {
  8429. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8430. m_birthday.Format("%d", year + 1);
  8431. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8432. }
  8433. #else
  8434. strarray.Add(name);
  8435. #endif
  8436. strarray.Add(phone);
  8437. strarray.Add(strOrderNumber);
  8438. strarray.Add(m_taoxiname);
  8439. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8440. strarray.Add(str);
  8441. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8442. strarray.Add(str);
  8443. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8444. for (i = 3; i <= 16; i++)
  8445. {
  8446. StrRect = load.m_rcarray.ElementAt(i - 1);
  8447. if (i < 10)
  8448. {
  8449. m_Print.DrawRect2(StrRect, 1);
  8450. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8451. }
  8452. }
  8453. StrRect = load.m_rcarray.ElementAt(29);
  8454. m_Print.DrawRect2(StrRect, 1);
  8455. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8456. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  8457. {
  8458. Image *pImg = NULL;
  8459. g_nSendCode = 31;
  8460. int g_nYearposTemp = g_nYearpos;
  8461. g_nYearpos = -1;
  8462. g_pMainWnd->ProcessChatMessageRequest2(1);
  8463. g_nYearpos = g_nYearposTemp;
  8464. g_nSendCode = 0;
  8465. if (g_bSendOK == 0)return;
  8466. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8467. if (pImg)
  8468. {
  8469. StrRect.left = 485;
  8470. StrRect.top = 12;
  8471. StrRect.right = StrRect.left + 60;
  8472. StrRect.bottom = StrRect.top + 60;
  8473. m_Print.DrawImage(pImg, StrRect);
  8474. delete pImg; pImg = NULL;
  8475. }
  8476. }
  8477. CArray<CRect, CRect>rcarray;
  8478. CStringArray strarray2;
  8479. for (i = 10; i <= 16; i++)
  8480. {
  8481. StrRect = load.m_rcarray.ElementAt(i - 1);
  8482. StrRect.left += 2;
  8483. StrRect.right -= 2;
  8484. StrRect.top += 2;
  8485. rcarray.Add(StrRect);
  8486. strarray2.Add(strarray.ElementAt(7 + i - 10));
  8487. }
  8488. if (1)
  8489. {
  8490. StrRect = load.m_rcarray.ElementAt(30);
  8491. StrRect.left += 2;
  8492. StrRect.right -= 2;
  8493. StrRect.top += 2;
  8494. rcarray.Add(StrRect);
  8495. strarray2.Add(m_time6 + "/" + m_time5);
  8496. }
  8497. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8498. for (i = 10; i <= 16; i++)
  8499. {
  8500. StrRect = load.m_rcarray.ElementAt(i - 1);
  8501. if (i == 10)
  8502. {
  8503. dty += bottom - StrRect.bottom;
  8504. }
  8505. StrRect.bottom = bottom;
  8506. m_Print.DrawRect2(StrRect, 1);
  8507. }
  8508. if (1)
  8509. {
  8510. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  8511. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  8512. // m_Print.DrawText((LPTSTR)(LPCTSTR)(m_time6+"/"+m_time5), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER );
  8513. }
  8514. m_Print.SetFontFace(15, 1, "宋体");
  8515. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  8516. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8517. m_Print.SetFontFace(9, 1, "宋体");
  8518. strarray.RemoveAll();
  8519. strarray.Add("产品名称");
  8520. strarray.Add("数量");
  8521. strarray.Add("P数");
  8522. strarray.Add("张数");
  8523. strarray.Add("照片编号");
  8524. CArray<CRect, CRect>rc2array;
  8525. int wid = 25;
  8526. for (i = 18; i <= 22; i++)
  8527. {
  8528. StrRect = load.m_rcarray.ElementAt(i - 1);
  8529. if (i == 19)
  8530. {
  8531. StrRect.right = StrRect.left + wid;
  8532. }
  8533. if (i == 20)
  8534. {
  8535. StrRect = load.m_rcarray.ElementAt(i - 2);
  8536. StrRect.left += wid; StrRect.right = StrRect.left;
  8537. StrRect.right += wid;
  8538. }
  8539. if (i == 21)
  8540. {
  8541. StrRect = load.m_rcarray.ElementAt(i - 3);
  8542. StrRect.left += wid * 2; StrRect.right = StrRect.left;
  8543. StrRect.right += wid;
  8544. wid = StrRect.right;
  8545. }
  8546. if (i == 22)
  8547. {
  8548. StrRect = load.m_rcarray.ElementAt(i - 3);
  8549. StrRect.left = wid;
  8550. }
  8551. StrRect.top += dty; StrRect.bottom += dty;
  8552. m_Print.DrawRect2(StrRect, 1);
  8553. StrRect.left += 2;
  8554. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8555. StrRect.left -= 2;
  8556. StrRect.top = StrRect.bottom;
  8557. StrRect.bottom += 18;
  8558. rc2array.Add(StrRect);
  8559. }
  8560. int curypos = 0;
  8561. for (i = 0; i < sparray2.GetSize(); i += 5)
  8562. {
  8563. rcarray.RemoveAll();
  8564. strarray2.RemoveAll();
  8565. int j = 0;
  8566. for ( j = 0; j < 5; j++)
  8567. {
  8568. StrRect = rc2array.ElementAt(j);
  8569. StrRect.left += 2;
  8570. StrRect.right -= 2;
  8571. StrRect.top += 2;
  8572. rcarray.Add(StrRect);
  8573. strarray2.Add(sparray2.ElementAt(i + j));
  8574. }
  8575. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8576. rcarray.RemoveAll();
  8577. for (j = 0; j < 5; j++)
  8578. {
  8579. StrRect = rc2array.ElementAt(j);
  8580. if (j == 0)
  8581. {
  8582. dty += bottom - StrRect.bottom;
  8583. }
  8584. StrRect.bottom = bottom;
  8585. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8586. StrRect.top = StrRect.bottom;
  8587. StrRect.bottom += 18;
  8588. rcarray.Add(StrRect);
  8589. }
  8590. rc2array.RemoveAll();
  8591. rc2array.Copy(rcarray);
  8592. }
  8593. m_Print.SetFontFace(15, 1, "宋体");
  8594. StrRect = load.m_rcarray.ElementAt(20);
  8595. dty = curypos - StrRect.bottom + 35;
  8596. StrRect.top += dty; StrRect.bottom += dty;
  8597. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8598. m_Print.SetFontFace(9, 1, "宋体");
  8599. rcarray.RemoveAll();
  8600. strarray2.RemoveAll();
  8601. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8602. StrRect.left += 2;
  8603. StrRect.right -= 2;
  8604. StrRect.top += 2;
  8605. rcarray.Add(StrRect);
  8606. strarray2.Add(m_bz);
  8607. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8608. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8609. dty += bottom - StrRect.bottom;
  8610. StrRect.bottom = bottom;
  8611. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8612. m_Print.SetFontFace(10, 1, "宋体");
  8613. StrRect = load.m_rcarray.ElementAt(22);
  8614. dty = curypos - StrRect.bottom + 25;
  8615. StrRect.top += dty; StrRect.bottom += dty;
  8616. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  8617. if (m_edit9.IsEmpty())
  8618. {
  8619. m_edit9 = "\
  8620. 经确认后的照片均排入制作流程,\r\n\
  8621. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  8622. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  8623. }
  8624. CString info1, info2, info3;
  8625. int newlinepos = m_edit9.Find("\r\n");
  8626. if (newlinepos != -1)
  8627. {
  8628. info1 = m_edit9.Left(newlinepos);
  8629. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8630. }
  8631. newlinepos = m_edit9.Find("\r\n");
  8632. if (newlinepos != -1)
  8633. {
  8634. info2 = m_edit9.Left(newlinepos);
  8635. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8636. info3 = m_edit9;
  8637. }
  8638. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8639. StrRect = load.m_rcarray.ElementAt(23);
  8640. StrRect.top += dty; StrRect.bottom += dty;
  8641. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8642. StrRect = load.m_rcarray.ElementAt(24);
  8643. StrRect.top += dty; StrRect.bottom += dty;
  8644. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8645. StrRect.top += 15;
  8646. StrRect.bottom += 15;
  8647. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8648. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  8649. StrRect = load.m_rcarray.ElementAt(25);
  8650. StrRect.top += dty - dy;
  8651. StrRect.bottom += dty - dy;
  8652. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8653. StrRect = load.m_rcarray.ElementAt(26);
  8654. StrRect.top += dty - dy;
  8655. StrRect.bottom += dty - dy;
  8656. m_Print.DrawRect2(StrRect, 2);
  8657. StrRect = load.m_rcarray.ElementAt(25);
  8658. StrRect.top += dty + 15 - dy;
  8659. StrRect.bottom += dty + 15 - dy;
  8660. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8661. StrRect = load.m_rcarray.ElementAt(26);
  8662. StrRect.top += dty + 15 - dy;
  8663. StrRect.bottom += dty + 15 - dy;
  8664. m_Print.DrawRect2(StrRect, 2);
  8665. StrRect = load.m_rcarray.ElementAt(25);
  8666. StrRect.top += dty + 15 * 2 - dy;
  8667. StrRect.bottom += dty + 15 * 2 - dy;
  8668. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8669. StrRect = load.m_rcarray.ElementAt(26);
  8670. StrRect.top += dty + 15 * 2 - dy;
  8671. StrRect.bottom += dty + 15 * 2 - dy;
  8672. m_Print.DrawRect2(StrRect, 2);
  8673. PrintPreview dlg; dlg.m_mode = 2;
  8674. dlg.m_name = name;
  8675. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8676. dlg.m_pDC = m_Print.GetPDC();
  8677. if (aa == 0)
  8678. {
  8679. if (dlg.DoModal() != IDOK)
  8680. return;
  8681. printcot = dlg.m_num;
  8682. }
  8683. //结束打印
  8684. m_Print.EndPage();
  8685. m_Print.EndPrint();
  8686. }
  8687. }
  8688. void CMainFrame::PrintFlowChart3(CString strOrderNumber) // 选片打单 风格2;
  8689. {
  8690. #ifdef LKAY_VERSION
  8691. PrintFlowChart3LKAY(strOrderNumber);
  8692. return;
  8693. #endif
  8694. int i = 0;
  8695. int j = 0;
  8696. int printcot = 1;
  8697. for (int aa = 0; aa < printcot; aa++)
  8698. {
  8699. BOOL bSecondPage = 0;
  8700. int nPrintedPos = 0;
  8701. for (int bb = 0; bb < 2; bb++)
  8702. {
  8703. if (bb && bSecondPage == 0)break;
  8704. CPrintRX m_Print;
  8705. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58))) // 58-[version].[setcheck1] ==1,使用默认打印机;
  8706. {
  8707. m_Print.InitToPrint(NULL, 1);
  8708. }
  8709. else // 否则使用指定的打印机;
  8710. {
  8711. CString name = g_cominfoarray.ElementAt(0).ElementAt(64); // 64-[version].[printer2] 制作单打印机;
  8712. if (name.IsEmpty())
  8713. m_Print.InitToPrint(NULL, 1);
  8714. else
  8715. {
  8716. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8717. if (nret == -1 && aa == 0)
  8718. {
  8719. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8720. }
  8721. }
  8722. }
  8723. m_Print.StartPrint();
  8724. m_Print.StartPage();
  8725. LoadRect load;
  8726. load.SetLiaPath("18.lia");
  8727. load.SetMargins(10, 0);
  8728. if (!load.Load())return;
  8729. CString str;
  8730. int rcpos = -1;
  8731. // ■■■■■■从18.lia获取到第一个区域大小 - 1.显示店名;
  8732. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8733. if ((bb == 0 && bSecondPage == 0))
  8734. {
  8735. m_Print.SetFontFace(25, 1, "宋体");
  8736. // 10-[version].[info1] 店名;
  8737. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8738. m_Print.SetFontFace(15, 1, "宋体");
  8739. // ■■■■■■从18.lia获取第二个区域大小 - 2.显示"基本资料";
  8740. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8741. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8742. m_Print.SetFontFace(9, 1, "宋体");
  8743. }
  8744. //////////////////////////////////////////////////////////////
  8745. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8746. g_sendhead.code[0] = 54; // dindan;
  8747. g_sendhead.code[1] = 223; // dindanspview2; shangpin+dindansp;
  8748. g_sendhead.code[2] = 52; // client;
  8749. g_sendhead.tabcount = 3;
  8750. g_sendhead.bsql = 0;
  8751. g_pMainWnd->ProcessChatMessageRequest2(filter);
  8752. if (g_bSendOK == 0)return;
  8753. CArray<CStringArray, CStringArray>sparray;
  8754. CArray<CStringArray, CStringArray>clientarray;
  8755. DataToArray(&g_List1array, &sparray, &clientarray);
  8756. CString spno;
  8757. CStringArray sparray2;
  8758. for ( i = 0; i < sparray.GetSize(); i++)
  8759. {
  8760. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8761. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8762. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8763. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8764. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8765. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8766. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8767. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8768. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8769. }
  8770. for (i = 0; i < sparray.GetSize(); i++)
  8771. {
  8772. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8773. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8774. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8775. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8776. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8777. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8778. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8779. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8780. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8781. }
  8782. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8783. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8784. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8785. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8786. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8787. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8788. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8789. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8790. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8791. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8792. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8793. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8794. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8795. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8796. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8797. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8798. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8799. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8800. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  8801. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8802. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8803. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8804. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8805. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8806. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8807. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8808. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8809. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8810. CString m_sum3;
  8811. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8812. ::ConvertToPrice(m_sum3);
  8813. if (m_money3.IsEmpty())m_money3 = "0";
  8814. int dty = 0;
  8815. CString name;
  8816. if (!m_name1.IsEmpty())
  8817. name = m_name1 + ",";
  8818. name += m_name2;
  8819. name.TrimRight(",");
  8820. CString phone;
  8821. if (!m_phone1.IsEmpty())
  8822. phone = m_phone1 + ",";
  8823. phone += m_phone2; phone.TrimRight(",");
  8824. if (IsHasRights2new(31) == 0)
  8825. phone = "***";
  8826. CStringArray strarray;
  8827. CArray<CRect, CRect>rcarray;
  8828. CStringArray strarray2; CArray<CRect, CRect>rc2array;
  8829. int bottom;
  8830. if ((bb == 0 && bSecondPage == 0))
  8831. {
  8832. #ifdef CHILD_VERSION
  8833. if (m_birthday.IsEmpty())
  8834. strarray.Add("姓名/性别");
  8835. else
  8836. strarray.Add("姓名/性别/年龄");
  8837. #else
  8838. strarray.Add("客人姓名"); // 第3.1区域 -3.显示客人姓名;
  8839. #endif
  8840. strarray.Add("电话");
  8841. strarray.Add("单号");
  8842. strarray.Add("套系");
  8843. strarray.Add("选样");
  8844. strarray.Add("余款/加挑");
  8845. strarray.Add("选片/日期");
  8846. #ifdef CHILD_VERSION
  8847. if (m_birthday.IsEmpty())
  8848. strarray.Add(name + "/" + m_sex);
  8849. else
  8850. {
  8851. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8852. m_birthday.Format("%d", year + 1);
  8853. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8854. }
  8855. #else
  8856. strarray.Add(name); // 第4.1区域 -3.显示客人姓名;
  8857. #endif
  8858. strarray.Add(phone);
  8859. strarray.Add(strOrderNumber);
  8860. strarray.Add(m_taoxiname);
  8861. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8862. strarray.Add(str);
  8863. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8864. strarray.Add(str);
  8865. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8866. for (i = 3; i <= 16; i++)
  8867. {
  8868. // ■■■■■■从18.lia中获取第3~16的区域大小;
  8869. StrRect = load.m_rcarray.ElementAt(i - 1);
  8870. if (i < 10)
  8871. {
  8872. m_Print.DrawRect2(StrRect, 1);
  8873. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8874. }
  8875. }
  8876. // ■■■■■■从18.lia中获取第30的区域大小;
  8877. StrRect = load.m_rcarray.ElementAt(29);
  8878. m_Print.DrawRect2(StrRect, 1);
  8879. BOOL bPrintDate = 1;
  8880. #ifdef DDF_VERSION
  8881. // bPrintDate=0;
  8882. #else
  8883. if (m_time5 == "" && m_time6 == "")
  8884. bPrintDate = 0;
  8885. #endif
  8886. if (bPrintDate)
  8887. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8888. else
  8889. {
  8890. #ifdef CHILD_VERSION
  8891. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/引导", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8892. #else
  8893. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/化妆", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8894. #endif
  8895. }
  8896. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138))) // [version].[reverse3]
  8897. {
  8898. Image *pImg = NULL;
  8899. g_nSendCode = 31;
  8900. int g_nYearposTemp = g_nYearpos;
  8901. g_nYearpos = -1;
  8902. g_pMainWnd->ProcessChatMessageRequest2(1);
  8903. g_nYearpos = g_nYearposTemp;
  8904. g_nSendCode = 0;
  8905. if (g_bSendOK == 0)return;
  8906. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8907. // Jeff二维码的区域不是从18.lia里获取的,是固定在右上角指定区域;
  8908. if (pImg)
  8909. {
  8910. StrRect.left = 485;
  8911. StrRect.top = 12;
  8912. StrRect.right = StrRect.left + 60;
  8913. StrRect.bottom = StrRect.top + 60;
  8914. m_Print.DrawImage(pImg, StrRect);
  8915. delete pImg; pImg = NULL;
  8916. }
  8917. }
  8918. // CArray<CRect,CRect>rcarray;
  8919. // CStringArray strarray2;
  8920. // ■■■■■■从18.lia中获取第10的区域大小;
  8921. for (i = 10; i <= 16; i++)
  8922. {
  8923. StrRect = load.m_rcarray.ElementAt(i - 1);
  8924. StrRect.left += 2;
  8925. StrRect.right -= 2;
  8926. StrRect.top += 2;
  8927. rcarray.Add(StrRect);
  8928. strarray2.Add(strarray.ElementAt(7 + i - 10));
  8929. }
  8930. if (1)
  8931. {
  8932. // ■■■■■■从18.lia中获取第31的区域大小;
  8933. StrRect = load.m_rcarray.ElementAt(30);
  8934. StrRect.left += 2;
  8935. StrRect.right -= 2;
  8936. StrRect.top += 2;
  8937. rcarray.Add(StrRect);
  8938. if (bPrintDate)
  8939. strarray2.Add(m_time6 + "/" + m_time5);
  8940. else
  8941. {
  8942. strarray2.Add(m_waiter1 + "/" + m_waiter2);
  8943. }
  8944. }
  8945. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  8946. for (i = 10; i <= 16; i++)
  8947. {
  8948. StrRect = load.m_rcarray.ElementAt(i - 1);
  8949. if (i == 10)
  8950. {
  8951. dty += bottom - StrRect.bottom;
  8952. }
  8953. StrRect.bottom = bottom;
  8954. m_Print.DrawRect2(StrRect, 1);
  8955. }
  8956. if (1)
  8957. {
  8958. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  8959. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  8960. }
  8961. m_Print.SetFontFace(15, 1, "宋体");
  8962. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  8963. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8964. }
  8965. int curypos = 0;
  8966. int oldpos = 0;
  8967. if (bb == 1)
  8968. {
  8969. dty = -100;
  8970. oldpos = nPrintedPos;
  8971. if (oldpos == 0)oldpos = 10000;
  8972. }
  8973. m_Print.SetFontFace(9, 1, "宋体");
  8974. strarray.RemoveAll();
  8975. if ((oldpos != 10000 && oldpos < sparray2.GetSize()) || bb == 0)
  8976. {
  8977. strarray.Add("产品名称");
  8978. strarray.Add("数量");
  8979. strarray.Add("照片编号");
  8980. for (i = 18; i <= 20; i++)
  8981. {
  8982. StrRect = load.m_rcarray.ElementAt(i - 1);
  8983. StrRect.top += dty;
  8984. StrRect.bottom += dty;
  8985. m_Print.DrawRect2(StrRect, 1);
  8986. StrRect.left += 2;
  8987. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8988. StrRect.left -= 2;
  8989. StrRect.top = StrRect.bottom;
  8990. StrRect.bottom += 18;
  8991. rc2array.Add(StrRect);
  8992. }
  8993. }
  8994. for (i = oldpos; i < sparray2.GetSize(); i += 3)
  8995. {
  8996. rcarray.RemoveAll();
  8997. strarray2.RemoveAll();
  8998. for ( j = 0; j < 3; j++)
  8999. {
  9000. StrRect = rc2array.ElementAt(j);
  9001. StrRect.left += 2;
  9002. StrRect.right -= 2;
  9003. StrRect.top += 2;
  9004. rcarray.Add(StrRect);
  9005. #if JEFF_TEST_ON
  9006. if (2 == j)
  9007. {
  9008. CString strImg = sparray2.ElementAt(i + 2);
  9009. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  9010. if (nImgCount != 0)
  9011. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  9012. else if (!strImg.IsEmpty())
  9013. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  9014. strarray2.Add(strImg);
  9015. }
  9016. else
  9017. strarray2.Add(sparray2.ElementAt(i + j));
  9018. #else
  9019. strarray2.Add(sparray2.ElementAt(i + j));
  9020. #endif
  9021. }
  9022. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9023. rcarray.RemoveAll();
  9024. for (j = 0; j < 3; j++)
  9025. {
  9026. StrRect = rc2array.ElementAt(j);
  9027. if (j == 0)
  9028. {
  9029. dty += bottom - StrRect.bottom;
  9030. }
  9031. StrRect.bottom = bottom;
  9032. m_Print.DrawRect2(StrRect, 1);
  9033. curypos = StrRect.bottom;
  9034. StrRect.top = StrRect.bottom;
  9035. StrRect.bottom += 18;
  9036. rcarray.Add(StrRect);
  9037. }
  9038. rc2array.RemoveAll();
  9039. rc2array.Copy(rcarray);
  9040. if (bottom > 750)
  9041. {
  9042. bSecondPage = 1;
  9043. nPrintedPos = i + 3;
  9044. break;
  9045. }
  9046. }
  9047. if ((bb == 0 && bSecondPage == 0) || (bb == 1 && bSecondPage == 1))
  9048. {
  9049. m_Print.SetFontFace(15, 1, "宋体");
  9050. StrRect = load.m_rcarray.ElementAt(20);
  9051. dty = curypos - StrRect.bottom + 35;
  9052. StrRect.top += dty;
  9053. StrRect.bottom += dty;
  9054. if (StrRect.bottom > 700 && bb == 0)
  9055. {
  9056. bSecondPage = 1;
  9057. }
  9058. else
  9059. {
  9060. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9061. m_Print.SetFontFace(9, 1, "宋体");
  9062. rcarray.RemoveAll();
  9063. strarray2.RemoveAll();
  9064. StrRect = load.m_rcarray.ElementAt(21);
  9065. StrRect.top += dty;
  9066. StrRect.bottom += dty;
  9067. StrRect.left += 2;
  9068. StrRect.right -= 2;
  9069. StrRect.top += 2;
  9070. rcarray.Add(StrRect);
  9071. #if JEFF_TEST_ON
  9072. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9073. strarray2.RemoveAll();
  9074. CString strFind = "要求:";
  9075. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  9076. do
  9077. {
  9078. int nIndex = strbz3.Find(strFind, 1);
  9079. if (nIndex != -1)
  9080. {
  9081. CString strbz = strbz3.Left(nIndex);
  9082. strbz3 = strbz3.Mid(nIndex);
  9083. strarray2.Add(strbz);
  9084. }
  9085. else
  9086. {
  9087. strarray2.Add(strbz3);
  9088. strbz3 = "";
  9089. }
  9090. } while (strbz3.Find(strFind) != -1);
  9091. strarray2.Add(g_List1array.ElementAt(0).ElementAt(29));
  9092. strarray2.Add(g_List1array.ElementAt(0).ElementAt(23));
  9093. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  9094. #else
  9095. strarray2.Add(m_bz);
  9096. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9097. #endif
  9098. StrRect = load.m_rcarray.ElementAt(21);
  9099. StrRect.top += dty;
  9100. StrRect.bottom += dty;
  9101. dty += bottom - StrRect.bottom;
  9102. StrRect.bottom = bottom;
  9103. m_Print.DrawRect2(StrRect, 1);
  9104. curypos = StrRect.bottom;
  9105. m_Print.SetFontFace(10, 1, "宋体");
  9106. StrRect = load.m_rcarray.ElementAt(22);
  9107. dty = curypos - StrRect.bottom + 25;
  9108. StrRect.top += dty;
  9109. StrRect.bottom += dty;
  9110. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  9111. if (m_edit9.IsEmpty())
  9112. {
  9113. m_edit9 = "\
  9114. 经确认后的照片均排入制作流程,\r\n\
  9115. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9116. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9117. }
  9118. CString info1, info2, info3;
  9119. int newlinepos = m_edit9.Find("\r\n");
  9120. if (newlinepos != -1)
  9121. {
  9122. info1 = m_edit9.Left(newlinepos);
  9123. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9124. }
  9125. newlinepos = m_edit9.Find("\r\n");
  9126. if (newlinepos != -1)
  9127. {
  9128. info2 = m_edit9.Left(newlinepos);
  9129. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9130. info3 = m_edit9;
  9131. }
  9132. #ifdef QCH_VERSION
  9133. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9134. StrRect = load.m_rcarray.ElementAt(23);
  9135. StrRect.top += dty; StrRect.bottom += dty;
  9136. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9137. StrRect=load.m_rcarray .ElementAt (24);
  9138. StrRect.top +=dty;StrRect.bottom +=dty;
  9139. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9140. StrRect.top +=15;
  9141. StrRect.bottom +=15;
  9142. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9143. #else
  9144. if (1)
  9145. {
  9146. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9147. StrRect = load.m_rcarray.ElementAt(23);
  9148. StrRect.top += dty; StrRect.bottom += dty;
  9149. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9150. StrRect = load.m_rcarray.ElementAt(24);
  9151. StrRect.top += dty; StrRect.bottom += dty;
  9152. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9153. }
  9154. else
  9155. {
  9156. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9157. StrRect = load.m_rcarray.ElementAt(23);
  9158. StrRect.top += dty; StrRect.bottom += dty;
  9159. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9160. StrRect = load.m_rcarray.ElementAt(24);
  9161. StrRect.top += dty; StrRect.bottom += dty;
  9162. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9163. }
  9164. StrRect.top += 15;
  9165. StrRect.bottom += 15;
  9166. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9167. #endif
  9168. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  9169. StrRect = load.m_rcarray.ElementAt(25);
  9170. StrRect.top += dty - dy;
  9171. StrRect.bottom += dty - dy;
  9172. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9173. StrRect = load.m_rcarray.ElementAt(26);
  9174. StrRect.top += dty - dy;
  9175. StrRect.bottom += dty - dy;
  9176. m_Print.DrawRect2(StrRect, 2);
  9177. StrRect = load.m_rcarray.ElementAt(25);
  9178. StrRect.top += dty + 15 - dy;
  9179. StrRect.bottom += dty + 15 - dy;
  9180. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9181. StrRect = load.m_rcarray.ElementAt(26);
  9182. StrRect.top += dty + 15 - dy;
  9183. StrRect.bottom += dty + 15 - dy;
  9184. m_Print.DrawRect2(StrRect, 2);
  9185. StrRect = load.m_rcarray.ElementAt(25);
  9186. StrRect.top += dty + 15 * 2 - dy;
  9187. StrRect.bottom += dty + 15 * 2 - dy;
  9188. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9189. StrRect = load.m_rcarray.ElementAt(26);
  9190. StrRect.top += dty + 15 * 2 - dy;
  9191. StrRect.bottom += dty + 15 * 2 - dy;
  9192. m_Print.DrawRect2(StrRect, 2);
  9193. }
  9194. }
  9195. PrintPreview dlg; dlg.m_mode = 2;
  9196. dlg.m_name = name;
  9197. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  9198. dlg.m_pDC = m_Print.GetPDC();
  9199. if (aa == 0)
  9200. {
  9201. if (dlg.DoModal() != IDOK)
  9202. return;
  9203. printcot = dlg.m_num;
  9204. }
  9205. //结束打印
  9206. m_Print.EndPage();
  9207. m_Print.EndPrint();
  9208. }
  9209. }
  9210. }
  9211. void CMainFrame::PrintFlowChart3_20151116(CString strOrderNumber) // 选片打单 风格2;
  9212. {
  9213. #ifdef LKAY_VERSION
  9214. PrintFlowChart3LKAY(strOrderNumber);
  9215. return;
  9216. #endif
  9217. int i = 0;
  9218. int j = 0;
  9219. int printcot = 1;
  9220. for (int aa = 0; aa < printcot; aa++)
  9221. {
  9222. BOOL bSecondPage = 0;
  9223. int nPrintedPos = 0;
  9224. for (int bb = 0; bb < 3; bb++)
  9225. {
  9226. if (bb && bSecondPage == 0)break;
  9227. CPrintRX m_Print;
  9228. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58))) // 58-[version].[setcheck1] ==1,使用默认打印机;
  9229. {
  9230. m_Print.InitToPrint(NULL, 1);
  9231. }
  9232. else // 否则使用指定的打印机;
  9233. {
  9234. CString name = g_cominfoarray.ElementAt(0).ElementAt(64); // 64-[version].[printer2] 制作单打印机;
  9235. if (name.IsEmpty())
  9236. m_Print.InitToPrint(NULL, 1);
  9237. else
  9238. {
  9239. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9240. if (nret == -1 && aa == 0)
  9241. {
  9242. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9243. }
  9244. }
  9245. }
  9246. m_Print.StartPrint();
  9247. m_Print.StartPage();
  9248. LoadRect load;
  9249. load.SetLiaPath("18.lia");
  9250. load.SetMargins(10, 0);
  9251. if (!load.Load())return;
  9252. CString str;
  9253. int rcpos = -1;
  9254. // ■■■■■■从18.lia获取到第一个区域大小 - 1.显示店名;
  9255. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  9256. if ((bb == 0 && bSecondPage == 0))
  9257. {
  9258. m_Print.SetFontFace(25, 1, "宋体");
  9259. // 10-[version].[info1] 店名;
  9260. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9261. m_Print.SetFontFace(15, 1, "宋体");
  9262. // ■■■■■■从18.lia获取第二个区域大小 - 2.显示"基本资料";
  9263. StrRect = load.m_rcarray.ElementAt(++rcpos);
  9264. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9265. m_Print.SetFontFace(9, 1, "宋体");
  9266. }
  9267. //////////////////////////////////////////////////////////////////////////
  9268. // 获取打印所需要的数据,并布局好;
  9269. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  9270. g_sendhead.code[0] = 54; // dindan;
  9271. g_sendhead.code[1] = 223; // dindanspview2; shangpin+dindansp;
  9272. g_sendhead.code[2] = 52; // client;
  9273. g_sendhead.tabcount = 3;
  9274. g_sendhead.bsql = 0;
  9275. g_pMainWnd->ProcessChatMessageRequest2(filter);
  9276. if (g_bSendOK == 0)return;
  9277. CArray<CStringArray, CStringArray>sparray;
  9278. CArray<CStringArray, CStringArray>clientarray;
  9279. DataToArray(&g_List1array, &sparray, &clientarray);
  9280. CString spno;
  9281. CStringArray sparray2;
  9282. for ( i = 0; i < sparray.GetSize(); i++)
  9283. {
  9284. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  9285. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  9286. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  9287. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9288. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  9289. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9290. sparray2.Add(sparray.ElementAt(i).ElementAt(5)); // 商品名称;
  9291. sparray2.Add(sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  9292. sparray2.Add(sparray.ElementAt(i).ElementAt(6)); // 选中的相片串;
  9293. sparray2.Add(sparray.ElementAt(i).ElementAt(10)); // 商品备注;
  9294. }
  9295. for (i = 0; i < sparray.GetSize(); i++)
  9296. {
  9297. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  9298. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  9299. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  9300. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9301. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  9302. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9303. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+"); // 商品名称;
  9304. sparray2.Add(sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  9305. sparray2.Add(sparray.ElementAt(i).ElementAt(6)); // 选中的相片串;
  9306. sparray2.Add(sparray.ElementAt(i).ElementAt(10)); // 商品备注;
  9307. }
  9308. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  9309. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  9310. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  9311. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  9312. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  9313. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  9314. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  9315. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  9316. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  9317. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  9318. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  9319. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  9320. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  9321. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  9322. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  9323. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  9324. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  9325. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  9326. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9327. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  9328. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  9329. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  9330. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  9331. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  9332. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  9333. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  9334. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  9335. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  9336. CString m_sum3;
  9337. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  9338. ::ConvertToPrice(m_sum3);
  9339. if (m_money3.IsEmpty())m_money3 = "0";
  9340. int dty = 0;
  9341. CString name;
  9342. if (!m_name1.IsEmpty())
  9343. name = m_name1 + ",";
  9344. name += m_name2;
  9345. name.TrimRight(",");
  9346. CString phone;
  9347. if (!m_phone1.IsEmpty())
  9348. phone = m_phone1 + ",";
  9349. phone += m_phone2; phone.TrimRight(",");
  9350. if (IsHasRights2new(31) == 0)
  9351. phone = "***";
  9352. CStringArray strarray;
  9353. CArray<CRect, CRect>rcarray;
  9354. CStringArray strarray2; CArray<CRect, CRect>rc2array;
  9355. int bottom;
  9356. //////////////////////////////////////////////////////////////////////////
  9357. // 开始画打印DC;
  9358. if ((bb == 0 && bSecondPage == 0))
  9359. {
  9360. #ifdef CHILD_VERSION
  9361. if (m_birthday.IsEmpty())
  9362. strarray.Add("姓名/性别");
  9363. else
  9364. strarray.Add("姓名/性别/年龄");
  9365. #else
  9366. strarray.Add("客人姓名"); // 第3.1区域 -3.显示客人姓名;
  9367. #endif
  9368. strarray.Add("电话");
  9369. strarray.Add("单号");
  9370. strarray.Add("套系");
  9371. strarray.Add("选样");
  9372. strarray.Add("余款/加挑");
  9373. strarray.Add("选片/日期");
  9374. #ifdef CHILD_VERSION
  9375. if (m_birthday.IsEmpty())
  9376. strarray.Add(name + "/" + m_sex);
  9377. else
  9378. {
  9379. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  9380. m_birthday.Format("%d", year + 1);
  9381. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  9382. }
  9383. #else
  9384. strarray.Add(name); // 第4.1区域 -3.显示客人姓名;
  9385. #endif
  9386. strarray.Add(phone);
  9387. strarray.Add(strOrderNumber);
  9388. strarray.Add(m_taoxiname);
  9389. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9390. strarray.Add(str);
  9391. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  9392. strarray.Add(str);
  9393. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  9394. for (i = 3; i <= 16; i++)
  9395. {
  9396. // ■■■■■■从18.lia中获取第3~16的区域大小;
  9397. StrRect = load.m_rcarray.ElementAt(i - 1);
  9398. if (i < 10)
  9399. {
  9400. m_Print.DrawRect2(StrRect, 1);
  9401. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9402. }
  9403. }
  9404. // ■■■■■■从18.lia中获取第30的区域大小;
  9405. StrRect = load.m_rcarray.ElementAt(29);
  9406. m_Print.DrawRect2(StrRect, 1);
  9407. BOOL bPrintDate = 1;
  9408. #ifdef DDF_VERSION
  9409. // bPrintDate=0;
  9410. #else
  9411. if (m_time5 == "" && m_time6 == "")
  9412. bPrintDate = 0;
  9413. #endif
  9414. if (bPrintDate)
  9415. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9416. else
  9417. {
  9418. #ifdef CHILD_VERSION
  9419. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/引导", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9420. #else
  9421. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/化妆", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9422. #endif
  9423. }
  9424. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138))) // [version].[reverse3]
  9425. {
  9426. Image *pImg = NULL;
  9427. g_nSendCode = 31;
  9428. int g_nYearposTemp = g_nYearpos;
  9429. g_nYearpos = -1;
  9430. g_pMainWnd->ProcessChatMessageRequest2(1);
  9431. g_nYearpos = g_nYearposTemp;
  9432. g_nSendCode = 0;
  9433. if (g_bSendOK == 0)return;
  9434. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  9435. // Jeff二维码的区域不是从18.lia里获取的,是固定在右上角指定区域;
  9436. if (pImg)
  9437. {
  9438. StrRect.left = 485;
  9439. StrRect.top = 12;
  9440. StrRect.right = StrRect.left + 60;
  9441. StrRect.bottom = StrRect.top + 60;
  9442. m_Print.DrawImage(pImg, StrRect);
  9443. delete pImg; pImg = NULL;
  9444. }
  9445. }
  9446. // CArray<CRect,CRect>rcarray;
  9447. // CStringArray strarray2;
  9448. // ■■■■■■从18.lia中获取第10的区域大小;
  9449. for (i = 10; i <= 16; i++)
  9450. {
  9451. StrRect = load.m_rcarray.ElementAt(i - 1);
  9452. StrRect.left += 2;
  9453. StrRect.right -= 2;
  9454. StrRect.top += 2;
  9455. rcarray.Add(StrRect);
  9456. strarray2.Add(strarray.ElementAt(7 + i - 10));
  9457. }
  9458. if (1)
  9459. {
  9460. // ■■■■■■从18.lia中获取第31的区域大小;
  9461. StrRect = load.m_rcarray.ElementAt(30);
  9462. StrRect.left += 2;
  9463. StrRect.right -= 2;
  9464. StrRect.top += 2;
  9465. rcarray.Add(StrRect);
  9466. if (bPrintDate)
  9467. strarray2.Add(m_time6 + "/" + m_time5);
  9468. else
  9469. {
  9470. strarray2.Add(m_waiter1 + "/" + m_waiter2);
  9471. }
  9472. }
  9473. int bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  9474. for (i = 10; i <= 16; i++)
  9475. {
  9476. StrRect = load.m_rcarray.ElementAt(i - 1);
  9477. if (i == 10)
  9478. {
  9479. dty += bottom - StrRect.bottom;
  9480. }
  9481. StrRect.bottom = bottom;
  9482. m_Print.DrawRect2(StrRect, 1);
  9483. }
  9484. if (1)
  9485. {
  9486. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  9487. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  9488. }
  9489. m_Print.SetFontFace(15, 1, "宋体");
  9490. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  9491. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9492. }
  9493. int curypos = 0;
  9494. int oldpos = 0;
  9495. if (bb == 1)
  9496. {
  9497. dty = -100;
  9498. oldpos = nPrintedPos;
  9499. if (oldpos == 0)oldpos = 10000;
  9500. }
  9501. m_Print.SetFontFace(9, 1, "宋体");
  9502. strarray.RemoveAll();
  9503. if ((oldpos != 10000 && oldpos < sparray2.GetSize()) || bb == 0)
  9504. {
  9505. strarray.Add("产品名称");
  9506. strarray.Add("数量");
  9507. strarray.Add("照片编号");
  9508. strarray.Add(_T("备注"));
  9509. CRect mycr[4] = {
  9510. CRect(39,172,130,189), // 产品名称;
  9511. CRect(130,172,157,189), // 产品数量;
  9512. CRect(157,172,407,189), // 相片;
  9513. CRect(407,172,546,189) // 备注;
  9514. };
  9515. for (i = 0; i <= 3; i++)
  9516. {
  9517. StrRect = mycr[i];
  9518. StrRect.top += dty;
  9519. StrRect.bottom += dty;
  9520. m_Print.DrawRect2(StrRect, 1);
  9521. StrRect.left += 2;
  9522. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9523. StrRect.left -= 2;
  9524. StrRect.top = StrRect.bottom;
  9525. StrRect.bottom += 18;
  9526. rc2array.Add(StrRect);
  9527. }
  9528. }
  9529. for (i = oldpos; i < sparray2.GetSize(); i += 4)
  9530. {
  9531. rcarray.RemoveAll();
  9532. strarray2.RemoveAll();
  9533. for ( j = 0; j < 4; j++)
  9534. {
  9535. StrRect = rc2array.ElementAt(j);
  9536. StrRect.left += 2;
  9537. StrRect.right -= 2;
  9538. StrRect.top += 2;
  9539. rcarray.Add(StrRect);
  9540. #if JEFF_TEST_ON
  9541. if (2 == j)
  9542. {
  9543. CString strImg = sparray2.ElementAt(i + 2);
  9544. //int nImgCount = strImg.Replace(",", ",");
  9545. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  9546. if (nImgCount != 0)
  9547. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  9548. else if (!strImg.IsEmpty())
  9549. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  9550. strarray2.Add(strImg);
  9551. }
  9552. else
  9553. strarray2.Add(sparray2.ElementAt(i + j));
  9554. #else
  9555. strarray2.Add(sparray2.ElementAt(i + j));
  9556. #endif
  9557. }
  9558. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9559. rcarray.RemoveAll();
  9560. for (j = 0; j < 4; j++)
  9561. {
  9562. StrRect = rc2array.ElementAt(j);
  9563. if (j == 0)
  9564. {
  9565. dty += bottom - StrRect.bottom;
  9566. }
  9567. StrRect.bottom = bottom;
  9568. m_Print.DrawRect2(StrRect, 1);
  9569. curypos = StrRect.bottom;
  9570. StrRect.top = StrRect.bottom;
  9571. StrRect.bottom += 18;
  9572. rcarray.Add(StrRect);
  9573. }
  9574. rc2array.RemoveAll();
  9575. rc2array.Copy(rcarray);
  9576. if (bottom > 750)
  9577. {
  9578. bSecondPage = 1;
  9579. nPrintedPos = i + 3;
  9580. break;
  9581. }
  9582. }
  9583. if ((bb == 0 && bSecondPage == 0) || (bb == 1 && bSecondPage == 1))
  9584. {
  9585. m_Print.SetFontFace(15, 1, "宋体");
  9586. StrRect = load.m_rcarray.ElementAt(20);
  9587. dty = curypos - StrRect.bottom + 35;
  9588. StrRect.top += dty;
  9589. StrRect.bottom += dty;
  9590. if (StrRect.bottom > 700 && bb == 0)
  9591. {
  9592. bSecondPage = 1;
  9593. }
  9594. else
  9595. {
  9596. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9597. m_Print.SetFontFace(9, 1, "宋体");
  9598. rcarray.RemoveAll();
  9599. strarray2.RemoveAll();
  9600. StrRect = load.m_rcarray.ElementAt(21);
  9601. StrRect.top += dty;
  9602. StrRect.bottom += dty;
  9603. StrRect.left += 2;
  9604. StrRect.right -= 2;
  9605. StrRect.top += 2;
  9606. rcarray.Add(StrRect);
  9607. #if JEFF_TEST_ON
  9608. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9609. strarray2.RemoveAll();
  9610. CString strFind = "要求:";
  9611. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  9612. do
  9613. {
  9614. int nIndex = strbz3.Find(strFind, 1);
  9615. if (nIndex != -1)
  9616. {
  9617. CString strbz = strbz3.Left(nIndex);
  9618. strbz3 = strbz3.Mid(nIndex);
  9619. strarray2.Add(strbz);
  9620. }
  9621. else
  9622. {
  9623. strarray2.Add(strbz3);
  9624. strbz3 = "";
  9625. }
  9626. } while (strbz3.Find(strFind) != -1);
  9627. strarray2.Add(g_List1array.ElementAt(0).ElementAt(29));
  9628. strarray2.Add(g_List1array.ElementAt(0).ElementAt(23));
  9629. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  9630. #else
  9631. strarray2.Add(m_bz);
  9632. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9633. #endif
  9634. StrRect = load.m_rcarray.ElementAt(21);
  9635. StrRect.top += dty;
  9636. StrRect.bottom += dty;
  9637. dty += bottom - StrRect.bottom;
  9638. StrRect.bottom = bottom;
  9639. m_Print.DrawRect2(StrRect, 1);
  9640. curypos = StrRect.bottom;
  9641. m_Print.SetFontFace(10, 1, "宋体");
  9642. StrRect = load.m_rcarray.ElementAt(22);
  9643. dty = curypos - StrRect.bottom + 25;
  9644. StrRect.top += dty;
  9645. StrRect.bottom += dty;
  9646. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  9647. if (m_edit9.IsEmpty())
  9648. {
  9649. m_edit9 = "\
  9650. 经确认后的照片均排入制作流程,\r\n\
  9651. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9652. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9653. }
  9654. CString info1, info2, info3;
  9655. int newlinepos = m_edit9.Find("\r\n");
  9656. if (newlinepos != -1)
  9657. {
  9658. info1 = m_edit9.Left(newlinepos);
  9659. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9660. }
  9661. newlinepos = m_edit9.Find("\r\n");
  9662. if (newlinepos != -1)
  9663. {
  9664. info2 = m_edit9.Left(newlinepos);
  9665. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9666. info3 = m_edit9;
  9667. }
  9668. #ifdef QCH_VERSION
  9669. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9670. StrRect = load.m_rcarray.ElementAt(23);
  9671. StrRect.top += dty; StrRect.bottom += dty;
  9672. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9673. StrRect=load.m_rcarray .ElementAt (24);
  9674. StrRect.top +=dty;StrRect.bottom +=dty;
  9675. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9676. StrRect.top +=15;
  9677. StrRect.bottom +=15;
  9678. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9679. #else
  9680. if (1)
  9681. {
  9682. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9683. StrRect = load.m_rcarray.ElementAt(23);
  9684. StrRect.top += dty; StrRect.bottom += dty;
  9685. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9686. StrRect = load.m_rcarray.ElementAt(24);
  9687. StrRect.top += dty; StrRect.bottom += dty;
  9688. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9689. }
  9690. else
  9691. {
  9692. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9693. StrRect = load.m_rcarray.ElementAt(23);
  9694. StrRect.top += dty; StrRect.bottom += dty;
  9695. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9696. StrRect = load.m_rcarray.ElementAt(24);
  9697. StrRect.top += dty; StrRect.bottom += dty;
  9698. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9699. }
  9700. StrRect.top += 15;
  9701. StrRect.bottom += 15;
  9702. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9703. #endif
  9704. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  9705. StrRect = load.m_rcarray.ElementAt(25);
  9706. StrRect.top += dty - dy;
  9707. StrRect.bottom += dty - dy;
  9708. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9709. StrRect = load.m_rcarray.ElementAt(26);
  9710. StrRect.top += dty - dy;
  9711. StrRect.bottom += dty - dy;
  9712. m_Print.DrawRect2(StrRect, 2);
  9713. StrRect = load.m_rcarray.ElementAt(25);
  9714. StrRect.top += dty + 15 - dy;
  9715. StrRect.bottom += dty + 15 - dy;
  9716. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9717. StrRect = load.m_rcarray.ElementAt(26);
  9718. StrRect.top += dty + 15 - dy;
  9719. StrRect.bottom += dty + 15 - dy;
  9720. m_Print.DrawRect2(StrRect, 2);
  9721. StrRect = load.m_rcarray.ElementAt(25);
  9722. StrRect.top += dty + 15 * 2 - dy;
  9723. StrRect.bottom += dty + 15 * 2 - dy;
  9724. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9725. StrRect = load.m_rcarray.ElementAt(26);
  9726. StrRect.top += dty + 15 * 2 - dy;
  9727. StrRect.bottom += dty + 15 * 2 - dy;
  9728. m_Print.DrawRect2(StrRect, 2);
  9729. }
  9730. }
  9731. PrintPreview dlg; dlg.m_mode = 2;
  9732. dlg.m_name = name;
  9733. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  9734. dlg.m_pDC = m_Print.GetPDC();
  9735. if (aa == 0)
  9736. {
  9737. if (dlg.DoModal() != IDOK)
  9738. return;
  9739. printcot = dlg.m_num;
  9740. }
  9741. //结束打印
  9742. m_Print.EndPage();
  9743. m_Print.EndPrint();
  9744. }
  9745. }
  9746. }
  9747. //void CMainFrame::PrintFlowChart4(CString m_id) // 选设计打单函数;
  9748. void CMainFrame::PrintFlowChart4(CString strOrderNumber) // 选设计打单函数,使用18.lia文件;
  9749. {
  9750. int i = 0;
  9751. int j = 0;
  9752. int printcot = 1;
  9753. for (int aa = 0; aa < printcot; aa++)
  9754. {
  9755. CPrintRX m_Print;
  9756. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  9757. {
  9758. m_Print.InitToPrint(NULL, 1);
  9759. }
  9760. else
  9761. {
  9762. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  9763. if (name.IsEmpty())
  9764. m_Print.InitToPrint(NULL, 1);
  9765. else
  9766. {
  9767. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9768. if (nret == -1 && aa == 0)
  9769. {
  9770. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9771. }
  9772. }
  9773. }
  9774. m_Print.StartPrint();
  9775. m_Print.StartPage();
  9776. LoadRect load;
  9777. load.SetLiaPath("18.lia");
  9778. load.SetMargins(10, 0);
  9779. if (!load.Load())return;
  9780. CString str;
  9781. int rcpos = -1;
  9782. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  9783. m_Print.SetFontFace(25, 1, "宋体");
  9784. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9785. m_Print.SetFontFace(15, 1, "宋体");
  9786. StrRect = load.m_rcarray.ElementAt(++rcpos);
  9787. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9788. m_Print.SetFontFace(9, 1, "宋体");
  9789. //////////////////////////////////////////////////////////////
  9790. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  9791. g_sendhead.code[0] = 54;
  9792. g_sendhead.code[1] = 223;
  9793. g_sendhead.code[2] = 52;
  9794. g_sendhead.tabcount = 3;
  9795. g_sendhead.bsql = 0;
  9796. g_pMainWnd->ProcessChatMessageRequest2(filter);
  9797. if (g_bSendOK == 0)return;
  9798. CArray<CStringArray, CStringArray>sparray;
  9799. CArray<CStringArray, CStringArray>clientarray;
  9800. DataToArray(&g_List1array, &sparray, &clientarray);
  9801. CString spno;
  9802. CStringArray sparray2;
  9803. for ( i = 0; i < sparray.GetSize(); i++)
  9804. {
  9805. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  9806. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(8).IsEmpty())continue;
  9807. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9808. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9809. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  9810. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9811. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9812. }
  9813. for (i = 0; i < sparray.GetSize(); i++)
  9814. {
  9815. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  9816. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  9817. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  9818. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9819. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9820. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  9821. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9822. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9823. }
  9824. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  9825. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  9826. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  9827. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  9828. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  9829. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  9830. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  9831. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  9832. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  9833. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  9834. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  9835. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  9836. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  9837. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  9838. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  9839. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  9840. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  9841. CString m_bz = g_List1array.ElementAt(0).ElementAt(17);
  9842. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(25);
  9843. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  9844. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  9845. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  9846. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  9847. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  9848. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  9849. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  9850. CString m_waiter8 = g_List1array.ElementAt(0).ElementAt(27);
  9851. CString m_replace = g_List1array.ElementAt(0).ElementAt(28);
  9852. if (!m_replace.IsEmpty())
  9853. {
  9854. m_replace = "设计替换照片:" + m_replace;
  9855. m_replace.Replace("$", ";");
  9856. m_replace.TrimLeft(";");
  9857. m_bz += ";";
  9858. m_bz += m_replace;
  9859. }
  9860. CString m_sum3;
  9861. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  9862. ::ConvertToPrice(m_sum3);
  9863. if (m_money3.IsEmpty())m_money3 = "0";
  9864. int dty = 0;
  9865. CString name;
  9866. if (!m_name1.IsEmpty())
  9867. name = m_name1 + ",";
  9868. name += m_name2;
  9869. name.TrimRight(",");
  9870. CString phone;
  9871. if (!m_phone1.IsEmpty())
  9872. phone = m_phone1 + ",";
  9873. phone += m_phone2; phone.TrimRight(",");
  9874. if (IsHasRights2new(31) == 0)
  9875. phone = "***";
  9876. CStringArray strarray;
  9877. #ifdef CHILD_VERSION
  9878. if (m_birthday.IsEmpty())
  9879. strarray.Add("姓名/性别");
  9880. else
  9881. strarray.Add("姓名/性别/年龄");
  9882. #else
  9883. strarray.Add("客人姓名");
  9884. #endif
  9885. strarray.Add("电话");
  9886. strarray.Add("单号");
  9887. strarray.Add("套系");
  9888. strarray.Add("");
  9889. strarray.Add("余款/加挑");
  9890. strarray.Add("看设计/日期");
  9891. #ifdef CHILD_VERSION
  9892. if (m_birthday.IsEmpty())
  9893. strarray.Add(name + "/" + m_sex);
  9894. else
  9895. {
  9896. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  9897. m_birthday.Format("%d", year + 1);
  9898. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  9899. }
  9900. #else
  9901. strarray.Add(name);
  9902. #endif
  9903. strarray.Add(phone);
  9904. strarray.Add(strOrderNumber);
  9905. strarray.Add(m_taoxiname);
  9906. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9907. strarray.Add("");
  9908. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  9909. strarray.Add(str);
  9910. strarray.Add(m_waiter8 + "/" + m_time6);
  9911. //////////////////////////////////////////////
  9912. if (1)
  9913. {
  9914. StrRect = load.m_rcarray.ElementAt(6);
  9915. int addwid = StrRect.Width() / 6;
  9916. for (i = 3; i <= 6; i++)
  9917. {
  9918. StrRect = load.m_rcarray.ElementAt(i - 1);
  9919. StrRect.left += (i - 3)*addwid;
  9920. StrRect.right += (i - 2)*addwid;
  9921. load.m_rcarray.SetAt(i - 1, StrRect);
  9922. }
  9923. StrRect.left = StrRect.right = -1;
  9924. load.m_rcarray.SetAt(6, StrRect);
  9925. for (i = 10; i <= 13; i++)
  9926. {
  9927. StrRect = load.m_rcarray.ElementAt(i - 1);
  9928. StrRect.left += (i - 10)*addwid;
  9929. StrRect.right += (i - 9)*addwid;
  9930. load.m_rcarray.SetAt(i - 1, StrRect);
  9931. }
  9932. StrRect.left = StrRect.right = -1;
  9933. load.m_rcarray.SetAt(13, StrRect);
  9934. StrRect = load.m_rcarray.ElementAt(7);
  9935. int rcwid = StrRect.Width();
  9936. StrRect.left = load.m_rcarray.ElementAt(5).right;
  9937. StrRect.right = StrRect.left + rcwid + addwid;
  9938. load.m_rcarray.SetAt(7, StrRect);
  9939. StrRect = load.m_rcarray.ElementAt(8);
  9940. StrRect.left = load.m_rcarray.ElementAt(7).right;
  9941. StrRect.right = load.m_rcarray.ElementAt(29).left;
  9942. load.m_rcarray.SetAt(8, StrRect);
  9943. StrRect = load.m_rcarray.ElementAt(14);
  9944. rcwid = StrRect.Width();
  9945. StrRect.left = load.m_rcarray.ElementAt(12).right;
  9946. StrRect.right = StrRect.left + rcwid + addwid;
  9947. load.m_rcarray.SetAt(14, StrRect);
  9948. StrRect = load.m_rcarray.ElementAt(15);
  9949. StrRect.left = load.m_rcarray.ElementAt(14).right;
  9950. StrRect.right = load.m_rcarray.ElementAt(29).left;
  9951. load.m_rcarray.SetAt(15, StrRect);
  9952. }
  9953. ////////////////////////////////////////////////
  9954. for (i = 3; i <= 16; i++)
  9955. {
  9956. StrRect = load.m_rcarray.ElementAt(i - 1);
  9957. if (i < 10)
  9958. {
  9959. m_Print.DrawRect2(StrRect, 1);
  9960. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9961. }
  9962. }
  9963. StrRect = load.m_rcarray.ElementAt(29);
  9964. m_Print.DrawRect2(StrRect, 1);
  9965. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9966. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  9967. {
  9968. Image *pImg = NULL;
  9969. g_nSendCode = 31;
  9970. int g_nYearposTemp = g_nYearpos;
  9971. g_nYearpos = -1;
  9972. g_pMainWnd->ProcessChatMessageRequest2(1);
  9973. g_nYearpos = g_nYearposTemp;
  9974. g_nSendCode = 0;
  9975. if (g_bSendOK == 0)return;
  9976. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  9977. if (pImg)
  9978. {
  9979. StrRect.left = 485;
  9980. StrRect.top = 12;
  9981. StrRect.right = StrRect.left + 60;
  9982. StrRect.bottom = StrRect.top + 60;
  9983. m_Print.DrawImage(pImg, StrRect);
  9984. delete pImg; pImg = NULL;
  9985. }
  9986. }
  9987. CArray<CRect, CRect>rcarray;
  9988. CStringArray strarray2;
  9989. for (i = 10; i <= 16; i++)
  9990. {
  9991. StrRect = load.m_rcarray.ElementAt(i - 1);
  9992. StrRect.left += 2;
  9993. StrRect.right -= 2;
  9994. StrRect.top += 2;
  9995. rcarray.Add(StrRect);
  9996. strarray2.Add(strarray.ElementAt(7 + i - 10));
  9997. }
  9998. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  9999. for (i = 10; i <= 16; i++)
  10000. {
  10001. StrRect = load.m_rcarray.ElementAt(i - 1);
  10002. if (i == 10)
  10003. {
  10004. dty += bottom - StrRect.bottom;
  10005. }
  10006. StrRect.bottom = bottom;
  10007. m_Print.DrawRect2(StrRect, 1);
  10008. }
  10009. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  10010. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  10011. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time5, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  10012. m_Print.SetFontFace(15, 1, "宋体");
  10013. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  10014. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10015. m_Print.SetFontFace(9, 1, "宋体");
  10016. strarray.RemoveAll();
  10017. strarray.Add("产品名称");
  10018. strarray.Add("数量");
  10019. strarray.Add("照片编号");
  10020. CArray<CRect, CRect>rc2array;
  10021. for (i = 18; i <= 20; i++)
  10022. {
  10023. StrRect = load.m_rcarray.ElementAt(i - 1); StrRect.top += dty; StrRect.bottom += dty;
  10024. m_Print.DrawRect2(StrRect, 1);
  10025. StrRect.left += 2;
  10026. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10027. StrRect.left -= 2;
  10028. StrRect.top = StrRect.bottom;
  10029. StrRect.bottom += 18;
  10030. rc2array.Add(StrRect);
  10031. }
  10032. int curypos = 0;
  10033. for (i = 0; i < sparray2.GetSize(); i += 3)
  10034. {
  10035. rcarray.RemoveAll();
  10036. strarray2.RemoveAll();
  10037. for ( j = 0; j < 3; j++)
  10038. {
  10039. StrRect = rc2array.ElementAt(j);
  10040. StrRect.left += 2;
  10041. StrRect.right -= 2;
  10042. StrRect.top += 2;
  10043. rcarray.Add(StrRect);
  10044. #if JEFF_TEST_ON
  10045. if (2 == j)
  10046. {
  10047. CString strImg = sparray2.ElementAt(i + 2);
  10048. //int nImgCount = strImg.Replace(",", ",");
  10049. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  10050. if (nImgCount != 0)
  10051. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  10052. else if (!strImg.IsEmpty())
  10053. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  10054. strarray2.Add(strImg);
  10055. }
  10056. else
  10057. strarray2.Add(sparray2.ElementAt(i + j));
  10058. #else
  10059. strarray2.Add(sparray2.ElementAt(i + j));
  10060. #endif
  10061. }
  10062. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  10063. rcarray.RemoveAll();
  10064. for (j = 0; j < 3; j++)
  10065. {
  10066. StrRect = rc2array.ElementAt(j);
  10067. if (j == 0)
  10068. {
  10069. dty += bottom - StrRect.bottom;
  10070. }
  10071. StrRect.bottom = bottom;
  10072. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  10073. StrRect.top = StrRect.bottom;
  10074. StrRect.bottom += 18;
  10075. rcarray.Add(StrRect);
  10076. }
  10077. rc2array.RemoveAll();
  10078. rc2array.Copy(rcarray);
  10079. }
  10080. m_Print.SetFontFace(15, 1, "宋体");
  10081. StrRect = load.m_rcarray.ElementAt(20);
  10082. dty = curypos - StrRect.bottom + 35;
  10083. StrRect.top += dty; StrRect.bottom += dty;
  10084. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10085. m_Print.SetFontFace(9, 1, "宋体");
  10086. rcarray.RemoveAll();
  10087. strarray2.RemoveAll();
  10088. StrRect = load.m_rcarray.ElementAt(21);
  10089. StrRect.top += dty;
  10090. StrRect.bottom += dty;
  10091. StrRect.left += 2;
  10092. StrRect.right -= 2;
  10093. StrRect.top += 2;
  10094. rcarray.Add(StrRect);
  10095. #if JEFF_TEST_ON
  10096. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  10097. strarray2.RemoveAll();
  10098. CString strFind = "要求:";
  10099. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  10100. do
  10101. {
  10102. int nIndex = strbz3.Find(strFind, 1);
  10103. if (nIndex != -1)
  10104. {
  10105. CString strbz = strbz3.Left(nIndex);
  10106. strbz3 = strbz3.Mid(nIndex);
  10107. strarray2.Add(strbz);
  10108. }
  10109. else
  10110. {
  10111. strarray2.Add(strbz3);
  10112. strbz3 = "";
  10113. }
  10114. } while (strbz3.Find(strFind) != -1);
  10115. strarray2.Add(g_List1array.ElementAt(0).ElementAt(25));
  10116. if (!m_replace.IsEmpty())
  10117. {
  10118. m_replace = "设计替换照片:" + m_replace;
  10119. m_replace.Replace("$", ";");
  10120. m_replace.TrimLeft(";");
  10121. }
  10122. strarray2.Add(m_replace);
  10123. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  10124. #else
  10125. strarray2.Add(m_bz);
  10126. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  10127. #endif
  10128. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  10129. dty += bottom - StrRect.bottom;
  10130. StrRect.bottom = bottom;
  10131. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  10132. m_Print.SetFontFace(10, 1, "宋体");
  10133. StrRect = load.m_rcarray.ElementAt(22);
  10134. dty = curypos - StrRect.bottom + 25;
  10135. StrRect.top += dty; StrRect.bottom += dty;
  10136. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  10137. if (m_edit9.IsEmpty())
  10138. {
  10139. m_edit9 = "\
  10140. 经确认后的照片均排入制作流程,\r\n\
  10141. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  10142. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  10143. }
  10144. CString info1, info2, info3;
  10145. int newlinepos = m_edit9.Find("\r\n");
  10146. if (newlinepos != -1)
  10147. {
  10148. info1 = m_edit9.Left(newlinepos);
  10149. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  10150. }
  10151. newlinepos = m_edit9.Find("\r\n");
  10152. if (newlinepos != -1)
  10153. {
  10154. info2 = m_edit9.Left(newlinepos);
  10155. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  10156. info3 = m_edit9;
  10157. }
  10158. if (1)
  10159. {
  10160. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10161. StrRect = load.m_rcarray.ElementAt(23);
  10162. StrRect.top += dty; StrRect.bottom += dty;
  10163. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10164. StrRect = load.m_rcarray.ElementAt(24);
  10165. StrRect.top += dty; StrRect.bottom += dty;
  10166. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10167. }
  10168. else
  10169. {
  10170. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10171. StrRect = load.m_rcarray.ElementAt(23);
  10172. StrRect.top += dty; StrRect.bottom += dty;
  10173. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10174. StrRect = load.m_rcarray.ElementAt(24);
  10175. StrRect.top += dty; StrRect.bottom += dty;
  10176. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10177. }
  10178. StrRect = load.m_rcarray.ElementAt(25);
  10179. StrRect.top += dty; StrRect.bottom += dty;
  10180. m_Print.DrawText((LPTSTR)(LPCTSTR)"贵宾签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10181. StrRect = load.m_rcarray.ElementAt(26);
  10182. StrRect.top += dty; StrRect.bottom += dty;
  10183. m_Print.DrawRect2(StrRect, 2);
  10184. m_Print.SetFontFace(9, 1, "宋体");
  10185. StrRect = load.m_rcarray.ElementAt(27);
  10186. StrRect.top += dty; StrRect.bottom += dty;
  10187. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10188. StrRect = load.m_rcarray.ElementAt(28);
  10189. StrRect.top += dty; StrRect.bottom += dty;
  10190. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10191. PrintPreview dlg;//dlg.m_mode=2;
  10192. dlg.m_name = name;
  10193. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  10194. dlg.m_pDC = m_Print.GetPDC();
  10195. if (aa == 0)
  10196. {
  10197. if (dlg.DoModal() != IDOK)
  10198. return;
  10199. printcot = dlg.m_num;
  10200. }
  10201. //结束打印
  10202. m_Print.EndPage();
  10203. m_Print.EndPrint();
  10204. }
  10205. }
  10206. /*
  10207. void CMainFrame::PrintFlowChart(CString m_id)
  10208. {
  10209. CPrintRX m_Print;
  10210. m_Print.InitToPrint(NULL, 1);
  10211. m_Print.StartPrint();
  10212. m_Print.StartPage();
  10213. // CRect StrRect(0,0,560,818);
  10214. LoadRect load;
  10215. load.SetLiaPath ("4.lia");
  10216. load.SetMargins(-14,-14);
  10217. if(!load.Load ())return;
  10218. LoadRect load2;
  10219. load2.SetMargins(-14,472+27-14);
  10220. load2.SetLiaPath ("5.lia");
  10221. if(!load2.Load ())return;
  10222. //////////////////////////////////////////////////////////////
  10223. CString filter="id='"+m_id+"';id='"+m_id+"'";
  10224. g_sendhead.code[0]=54;
  10225. g_sendhead.code[1]=50;
  10226. g_sendhead.tabcount=2;
  10227. g_sendhead.bsql=0;
  10228. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  10229. CArray<CStringArray, CStringArray>sparray;
  10230. DataToArray(&g_List1array,&sparray);
  10231. CString spno;
  10232. for(int i=0; i<sparray.GetSize (); i++)
  10233. {
  10234. if(sparray.ElementAt (i).ElementAt (4)=="4" && sparray.ElementAt (i).ElementAt (5)!="入册")continue;
  10235. if(sparray.ElementAt (i).ElementAt (5)=="入册"&&sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  10236. spno+=sparray.ElementAt (i).ElementAt (5);
  10237. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  10238. spno+=";";
  10239. else
  10240. {
  10241. spno+=":";
  10242. spno+=sparray.ElementAt (i).ElementAt (6);
  10243. spno+=";";
  10244. }
  10245. }
  10246. spno+=" 加挑:";
  10247. for( i=0; i<sparray.GetSize (); i++)
  10248. {
  10249. if(sparray.ElementAt (i).ElementAt (4)!="4")continue;
  10250. if(sparray.ElementAt (i).ElementAt (5)=="入册")continue;
  10251. spno+=sparray.ElementAt (i).ElementAt (5);
  10252. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  10253. spno+=";";
  10254. else
  10255. {
  10256. spno+=":";
  10257. spno+=sparray.ElementAt (i).ElementAt (6);
  10258. spno+=";";
  10259. }
  10260. }
  10261. if(spno.Right (6)==" 加挑:")
  10262. {
  10263. spno=spno.Left (spno.GetLength ()-6);
  10264. }
  10265. CString m_name1 = g_List1array.ElementAt (0).ElementAt (1);
  10266. CString m_name2 = g_List1array.ElementAt (0).ElementAt (2);
  10267. CString m_phone1=g_List1array.ElementAt (0).ElementAt (3);
  10268. CString m_phone2=g_List1array.ElementAt (0).ElementAt (4);
  10269. CString m_urgent=g_List1array.ElementAt (0).ElementAt (5);
  10270. if(m_urgent.IsEmpty ())m_urgent="否";
  10271. CString m_time2 = g_List1array.ElementAt (0).ElementAt (6);
  10272. CString m_time4 = g_List1array.ElementAt (0).ElementAt (7);
  10273. CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  10274. CString m_takezs = g_List1array.ElementAt (0).ElementAt (9);
  10275. CString m_taoxizs = g_List1array.ElementAt (0).ElementAt (10);
  10276. CString m_choosezs = g_List1array.ElementAt (0).ElementAt (11);
  10277. CString m_ren = g_List1array.ElementAt (0).ElementAt (12);
  10278. CString m_waiter3 = g_List1array.ElementAt (0).ElementAt (13);
  10279. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (14);
  10280. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (15);
  10281. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (16);
  10282. CString m_bz = "客人要求: "+g_List1array.ElementAt (0).ElementAt (17);
  10283. CString m_money3 = g_List1array.ElementAt (0).ElementAt (18);
  10284. CString m_money1 = g_List1array.ElementAt (0).ElementAt (19);
  10285. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (20);
  10286. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (21);
  10287. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (22);
  10288. CString m_sum3;
  10289. m_sum3.Format ("%0.2f", atof(m_taoxijiage)+atof(m_payed4)-(atof(m_payed5)+atof(m_money1)));
  10290. ::ConvertToPrice (m_sum3);
  10291. if(m_money3.IsEmpty ())m_money3="0";
  10292. // m_money3=m_money3+"/"+m_sum3;
  10293. CString name;
  10294. if(!m_name1.IsEmpty ())
  10295. name=m_name1+",";
  10296. name+=m_name2;
  10297. name.TrimRight (",");
  10298. CString phone;
  10299. if(!m_phone1.IsEmpty ())
  10300. phone=m_phone1+",";
  10301. phone+=m_phone2;phone.TrimRight (",");
  10302. CStringArray strarray;
  10303. strarray.Add (m_urgent);
  10304. strarray.Add (m_ren);
  10305. strarray.Add (m_waiter3);
  10306. strarray.Add (name);
  10307. strarray.Add (m_time2);
  10308. strarray.Add (m_time4);
  10309. strarray.Add (m_time5);
  10310. strarray.Add (m_money3);
  10311. strarray.Add (m_takezs);
  10312. strarray.Add (m_taoxizs);
  10313. strarray.Add (m_choosezs);
  10314. strarray.Add (m_id);
  10315. strarray.Add (phone);
  10316. ////////////////////////////////////////////////////////////////
  10317. int rcpos=-1;
  10318. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  10319. Image *pImg=NULL;
  10320. #ifdef MNLS_VERSION
  10321. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG") );
  10322. #else
  10323. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  10324. #endif
  10325. m_Print.DrawImage(pImg, StrRect);
  10326. delete pImg;
  10327. m_Print.SetFontFace(15, 1, "宋体");
  10328. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10329. #ifdef MNLS_VERSION
  10330. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10331. #endif
  10332. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10333. #ifdef MNLS_VERSION
  10334. m_Print.DrawRect(StrRect);
  10335. #endif
  10336. m_Print.SetFontFace(7, 1, "黑体");
  10337. m_Print.SetColor(0xffffff);
  10338. #ifdef MNLS_VERSION
  10339. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10340. #endif
  10341. m_Print.SetColor(0);
  10342. m_Print.SetFontFace(25, 1, "黑体");
  10343. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10344. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10345. CString title[13]={"是否加急:","接单门市:","选样人员:","新郎新娘姓名:","拍照日期:","选片日期:","取件日期:","加挑/余款:","拍摄总张数:","应挑选张数:","额外加挑张数:","票号:","客户联系电话:"};
  10346. m_Print.SetFontFace(12, 1, "宋体");
  10347. for( i=0; i<13; i++)
  10348. {
  10349. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10350. if(i<3)
  10351. m_Print.DrawRect2(StrRect, 0);
  10352. else
  10353. m_Print.DrawRect2(StrRect, 1);
  10354. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10355. }
  10356. for( i=18; i<=37; i++)
  10357. {
  10358. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10359. if(i>=19&&i<=21)
  10360. m_Print.DrawRect2(StrRect, 2);
  10361. else if(i==26)
  10362. {
  10363. CRect rc=StrRect;
  10364. CRect rc2=rc;
  10365. rc.right -=rc2.Width ()/2;
  10366. m_Print.DrawRect2(rc, 1);
  10367. rc2.left +=rc.Width ();
  10368. m_Print.DrawRect2(rc2, 1);
  10369. }
  10370. else
  10371. m_Print.DrawRect2(StrRect, 1);
  10372. if(i==18)
  10373. {
  10374. StrRect.left +=5;
  10375. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10376. }
  10377. }
  10378. //////////////////////////////////////
  10379. rcpos=-1;
  10380. for( i=0; i<8; i++)
  10381. {
  10382. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10383. m_Print.DrawRect2(StrRect, 1);
  10384. }
  10385. CString title2[4]={"化妆师:","摄影师:","数码设计师:","顾客签名:"};
  10386. for( i=0; i<4; i++)
  10387. {
  10388. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10389. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10390. }
  10391. for( i=0; i<4; i++)
  10392. {
  10393. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10394. m_Print.DrawRect2(StrRect, 2);
  10395. }
  10396. ///////////////////////////////////////////
  10397. for( i=19; i<=31; i++)
  10398. {
  10399. StrRect=load.m_rcarray .ElementAt (i-1);
  10400. StrRect.left +=4;
  10401. if(i==31)
  10402. {
  10403. if(m_phone1.IsEmpty ()==0 && m_phone2.IsEmpty ()==0)
  10404. {
  10405. StrRect.top +=2;
  10406. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  10407. StrRect.top +=8;
  10408. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10409. }
  10410. else
  10411. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10412. }
  10413. else if((i-19)==7)
  10414. {
  10415. CRect rc=StrRect;
  10416. CRect rc2=rc;
  10417. rc.right -=rc2.Width ()/2;
  10418. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10419. rc2.left +=rc.Width ()+3;
  10420. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10421. }
  10422. else
  10423. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10424. }
  10425. strarray.RemoveAll ();
  10426. strarray.Add (m_waiter2);
  10427. strarray.Add (m_waiter1);
  10428. strarray.Add (m_waiter4);
  10429. for( i=13; i<=15; i++)
  10430. {
  10431. StrRect=load2.m_rcarray .ElementAt (i-1);
  10432. StrRect.left +=4;
  10433. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10434. }
  10435. ///////////spno
  10436. CRect sprc[14];
  10437. for(i=0; i<14; i++)
  10438. {
  10439. if(i<7)
  10440. {
  10441. if(i==0)
  10442. {
  10443. StrRect=load.m_rcarray .ElementAt (17);StrRect.left +=94;StrRect.right -=3;
  10444. }
  10445. else
  10446. {
  10447. StrRect=load.m_rcarray .ElementAt (30+i);StrRect.left +=4;StrRect.right -=3;
  10448. }
  10449. }
  10450. else
  10451. {
  10452. StrRect=load2.m_rcarray .ElementAt (i-7);StrRect.left +=4;StrRect.right -=3;
  10453. }
  10454. sprc[i]=StrRect;
  10455. // m_Print.DrawText((LPTSTR)(LPCTSTR)"xxx", sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10456. }
  10457. CString temp,tempspno,tempbz;
  10458. CSize size;
  10459. BOOL bRun=0;
  10460. int fontsize=12;
  10461. ll: tempspno=spno;
  10462. tempbz=m_bz;
  10463. m_Print.SetFontFace(fontsize, 1, "宋体");
  10464. for( i=0; i<14; i++)
  10465. {
  10466. if(!tempspno.IsEmpty ())
  10467. {
  10468. temp=tempspno;
  10469. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10470. int right=0;
  10471. CRect temprc=sprc[i];
  10472. while(size.cx>temprc.Width ())
  10473. {
  10474. right++;
  10475. temp=tempspno.Left (tempspno.GetLength ()-(right));
  10476. if(GIsHalfHZ(temp))
  10477. {
  10478. right++;
  10479. temp.Delete (temp.GetLength ()-1);
  10480. }
  10481. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10482. }
  10483. if(bRun)
  10484. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10485. tempspno=tempspno.Right (tempspno.GetLength ()-temp.GetLength ());
  10486. if(tempspno.IsEmpty ())i++;
  10487. }
  10488. else if(!tempbz.IsEmpty ())
  10489. {
  10490. temp=tempbz;
  10491. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10492. int right=0;
  10493. CRect temprc=sprc[i];
  10494. while(size.cx>temprc.Width ())
  10495. {
  10496. right++;
  10497. temp=tempbz.Left (tempbz.GetLength ()-(right));
  10498. if(GIsHalfHZ(temp))
  10499. {
  10500. right++;
  10501. temp.Delete (temp.GetLength ()-1);
  10502. }
  10503. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10504. }
  10505. if(bRun)
  10506. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10507. tempbz=tempbz.Right (tempbz.GetLength ()-temp.GetLength ());
  10508. }
  10509. }
  10510. if(tempspno.IsEmpty ()==0 || tempbz.IsEmpty ()==0)
  10511. {
  10512. fontsize--;
  10513. goto ll;
  10514. }
  10515. if(bRun==0)
  10516. {
  10517. bRun=1;
  10518. goto ll;
  10519. }
  10520. PrintPreview dlg;
  10521. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  10522. dlg.m_pDC =m_Print.GetPDC() ;
  10523. if(dlg.DoModal ()!=IDOK)return;
  10524. //结束打印
  10525. m_Print.EndPage();
  10526. m_Print.EndPrint();
  10527. }
  10528. void CMainFrame::SetSelFolder(int pos)
  10529. {
  10530. m_wndToolBar2.SetSelFolder(pos);
  10531. }*/
  10532. void CMainFrame::ToPhotoPrint()
  10533. {
  10534. UINT nID = 1;
  10535. LPSTR pName;
  10536. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  10537. OPEN_MENU(PhotoPrintFrom);
  10538. }
  10539. void CMainFrame::GetOcx()
  10540. {
  10541. char path[MAX_PATH];
  10542. ::GetSystemDirectory(path, MAX_PATH);
  10543. CString syspath = path;
  10544. try
  10545. {
  10546. if (!::PathFileExists(syspath + "\\MSCHRT20.OCX"))
  10547. {
  10548. g_sendhead.bsql = 0;
  10549. g_sendhead.code[0] = 103;
  10550. g_sendhead.tabcount = 1;
  10551. g_pMainWnd->ProcessChatMessageRequest2(1); if (g_bSendOK == 0)return;
  10552. CFile fp;
  10553. if (fp.Open(syspath + "\\MSCHRT20.OCX", CFile::modeWrite | CFile::modeCreate))
  10554. {
  10555. fp.Write(g_pData, g_nLeng);
  10556. fp.Close();
  10557. ::Sleep(1000);
  10558. }
  10559. }
  10560. CString temp;
  10561. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10562. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10563. }
  10564. catch (...)
  10565. {
  10566. }
  10567. try
  10568. {
  10569. CString temp;
  10570. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10571. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10572. }
  10573. catch (...)
  10574. {
  10575. }
  10576. }
  10577. void CMainFrame::OnServer()
  10578. {
  10579. // TODO: Add your command handler code here
  10580. DBConfig dlg;
  10581. dlg.DoModal();
  10582. }
  10583. void CMainFrame::OnPath()
  10584. {
  10585. // TODO: Add your command handler code here
  10586. if (g_user.bLongin == 0)
  10587. {
  10588. if (g_bNoLoginLia)
  10589. {
  10590. Login dlg;
  10591. dlg.SetLiaPath("5.lia");
  10592. dlg.DoModal();
  10593. }
  10594. else
  10595. {
  10596. Login3 dlg;
  10597. dlg.SetLiaPath("5.lia");
  10598. dlg.DoModal();
  10599. }
  10600. if (g_user.bLongin == 0)return;
  10601. }
  10602. if (IsHasRightsnew(49) == 0)return;
  10603. SetPathDlg2 dlg;
  10604. dlg.DoModal();
  10605. }
  10606. void CMainFrame::OnShowhis()
  10607. {
  10608. // TODO: Add your command handler code here
  10609. if (g_user.bLongin == 0)
  10610. {
  10611. if (g_bNoLoginLia)
  10612. {
  10613. Login dlg;
  10614. dlg.SetLiaPath("5.lia");
  10615. dlg.DoModal();
  10616. }
  10617. else
  10618. {
  10619. Login3 dlg;
  10620. dlg.SetLiaPath("5.lia");
  10621. dlg.DoModal();
  10622. }
  10623. if (g_user.bLongin == 0)return;
  10624. }
  10625. if (IsHasRightsnew(52) == 0)return;
  10626. CMenu *pMenu = GetMenu();
  10627. CMenu* submenu = pMenu->GetSubMenu(2);
  10628. UINT status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10629. if (status&MF_CHECKED)
  10630. {
  10631. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_UNCHECKED);
  10632. g_bShowOK = 1;
  10633. }
  10634. else
  10635. {
  10636. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  10637. g_bShowOK = 0;
  10638. } m_Mdi.CloseAll();
  10639. }
  10640. void CMainFrame::AddHistoryMenu(CArray<CStringArray, CStringArray>*hisyeararray) // 添加历史数据库菜单;
  10641. {
  10642. #ifdef NEW_SKIN
  10643. CMenu* m_menuXP = GetMenu();
  10644. CMenu* submenu = m_menuXP->GetSubMenu(2);
  10645. // 删除原有菜单;
  10646. int i = 0;
  10647. for ( i = 0; i < 100; i++)
  10648. {
  10649. submenu->DeleteMenu(1000 + i, MF_BYCOMMAND);
  10650. }
  10651. // 重创菜单,从资源ID1000开始;
  10652. for (i = 0; i < hisyeararray->GetSize(); i++)
  10653. {
  10654. submenu->AppendMenu(MF_STRING, 1000 + i, "查看历史数据:" + hisyeararray->ElementAt(i).ElementAt(0)); // 第一项菜单项;
  10655. }
  10656. g_nYearpos = -1;
  10657. #else
  10658. HMENU hMenu = ::GetMenu(m_hWnd);
  10659. m_menuXP.Attach(hMenu);
  10660. BCMenu* submenu = (BCMenu*)m_menuXP.GetSubMenu(2);
  10661. for (int i = 0; i < 100; i++)
  10662. {
  10663. submenu->DeleteMenu (1000+i, MF_BYCOMMAND);
  10664. }
  10665. for( i=0; i<hisyeararray->GetSize (); i++)
  10666. {
  10667. submenu->AppendMenu(MF_STRING, 1000+i, "查看历史数据:"+hisyeararray->ElementAt (i).ElementAt (0)); // 第一项菜单项
  10668. }
  10669. m_menuXP.Detach ();
  10670. g_nYearpos = -1;
  10671. #endif
  10672. }
  10673. /************************************************************************/
  10674. /*
  10675. Jeff
  10676. 函数:AddBranchMenu()
  10677. 参数:CArray<CStringArray, CStringArray> *branchArray
  10678. 返回:void
  10679. 注意:
  10680. 调用关系:
  10681. */
  10682. /************************************************************************/
  10683. void CMainFrame::AddBranchMenu(CArray<CStringArray, CStringArray>*branchArray)
  10684. {
  10685. //WriteTextLog("AddBranchMenu,添加集团版菜单");
  10686. #ifdef ENTERPRISE_VERSION
  10687. CMenu *m_menuXP = GetMenu();
  10688. CMenu* submenu = m_menuXP->GetSubMenu(0);
  10689. int i = 0;
  10690. for ( i = 0; i < 100; i++)
  10691. {
  10692. submenu->DeleteMenu(2000 + i, MF_BYCOMMAND);
  10693. }
  10694. g_menubranchname.RemoveAll();
  10695. CString name;
  10696. int a = 0;
  10697. #if 0 // Jeff.add for test
  10698. CString strCount;
  10699. strCount.Format("历史数据库个数=%d", branchArray->GetSize());
  10700. WriteTextLog(strCount);
  10701. #endif
  10702. for (i = 0; i < branchArray->GetSize() - 1; i++)
  10703. {
  10704. //WriteTextLog("111");
  10705. //WriteTextLog(hisyeararray->ElementAt(i).ElementAt(0));
  10706. //WriteTextLog(name);
  10707. if (name == "")
  10708. {
  10709. name = branchArray->ElementAt(i).ElementAt(0);
  10710. #ifndef SQLSERVER_VERSION
  10711. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10712. a++;
  10713. #endif
  10714. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10715. a++;
  10716. g_menubranchname.Add(name);
  10717. continue;
  10718. }
  10719. else if (branchArray->ElementAt(i).ElementAt(0).Find(name) != -1 && ((branchArray->ElementAt(i).ElementAt(0).GetLength() - name.GetLength()) == 4))
  10720. {
  10721. continue;
  10722. }
  10723. name = branchArray->ElementAt(i).ElementAt(0);
  10724. #ifndef SQLSERVER_VERSION
  10725. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10726. a++;
  10727. #endif
  10728. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10729. g_menubranchname.Add(name);
  10730. a++;
  10731. //WriteTextLog("222");
  10732. }
  10733. if ((branchArray->GetSize() - 1) > 0)
  10734. {
  10735. if (branchArray->ElementAt(0).ElementAt(3) == "总店")
  10736. submenu->AppendMenu(MF_STRING, 2000 + a, "多店数据汇总");
  10737. }
  10738. #endif
  10739. }
  10740. // Jeff:如果选择了历史数据库,则开单的数据会录入到该历史数据库中,而非当前数据库;
  10741. // g_nYearpos==-1,表示当前主数据库,其他>=0的值表示历史数据库在g_historydb中的索引值;
  10742. void CMainFrame::OnHistory(UINT nID) // 选择历史数据库菜单响应;
  10743. {
  10744. CMenu* pMenu = GetMenu();
  10745. CMenu* submenu = pMenu->GetSubMenu(2);
  10746. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10747. if (g_user.bLongin == 0)
  10748. {
  10749. if (g_bNoLoginLia)
  10750. {
  10751. Login dlg;
  10752. dlg.SetLiaPath("5.lia");
  10753. dlg.DoModal();
  10754. }
  10755. else
  10756. {
  10757. Login3 dlg;
  10758. dlg.SetLiaPath("5.lia");
  10759. dlg.DoModal();
  10760. }
  10761. if (g_user.bLongin == 0)return;
  10762. }
  10763. if (IsHasRightsnew(52) == 0)return;
  10764. m_Mdi.CloseAll();
  10765. for (int i = 0; i < 100; i++)
  10766. {
  10767. submenu->CheckMenuItem(1000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10768. }
  10769. if (status&MF_CHECKED)
  10770. {
  10771. g_nYearpos = -1;
  10772. status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10773. if (status&MF_CHECKED)
  10774. g_bShowOK = 0;
  10775. else
  10776. g_bShowOK = 1;
  10777. }
  10778. else
  10779. {
  10780. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10781. g_nYearpos = nID - 1000;
  10782. g_bShowOK = 1;
  10783. }
  10784. }
  10785. void CMainFrame::OnBranchData(UINT nID)
  10786. {
  10787. #ifdef ENTERPRISE_VERSION
  10788. #ifdef SQLSERVER_VERSION
  10789. OnBranchData2(nID);
  10790. return;
  10791. #endif
  10792. #endif
  10793. }
  10794. void CMainFrame::OnBranchData2(UINT nID)
  10795. {
  10796. #ifdef ENTERPRISE_VERSION
  10797. g_bAllBranch = 0;
  10798. m_Mdi.CloseAll();
  10799. OnDisconnect();
  10800. CMenu *pMenu = GetMenu();
  10801. CMenu* submenu = pMenu->GetSubMenu(0);
  10802. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10803. for (int i = 0; i < 100; i++)
  10804. {
  10805. submenu->CheckMenuItem(2000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10806. }
  10807. if (status&MF_CHECKED)
  10808. {
  10809. g_branchname.Empty();
  10810. g_branchip.Empty();
  10811. g_bBranchModify = 0;
  10812. g_user.bLongin = 0;
  10813. if (g_bNoLoginLia)
  10814. {
  10815. Login dlg;
  10816. dlg.SetLiaPath("5.lia");
  10817. dlg.DoModal();
  10818. }
  10819. else
  10820. {
  10821. Login3 dlg;
  10822. dlg.SetLiaPath("5.lia");
  10823. dlg.DoModal();
  10824. }
  10825. g_pMainWnd2->RefreshOutlookBar();
  10826. g_pMainWnd2->DrawLogin();
  10827. g_path1 = g_path1bak;
  10828. g_path2 = g_path2bak;
  10829. g_path3 = g_path3bak;
  10830. g_path4 = g_path4bak;
  10831. g_path5 = g_path5bak;
  10832. g_path6 = g_path6bak;
  10833. g_path7 = g_path7bak;
  10834. g_pMainWnd2->EnableBtns(1);
  10835. }
  10836. else
  10837. {
  10838. BOOL bNeedCheckRights = 1;
  10839. if (g_user.bLongin && g_branchname == "")//无需登陆本店判断其访问分店权限
  10840. {
  10841. bNeedCheckRights = 0;
  10842. }
  10843. #ifndef SQLSERVER_VERSION
  10844. if ((g_menubranchname.GetSize() * 2) == nID - 2000)//多店数据汇总
  10845. #else
  10846. if ((g_menubranchname.GetSize()) == nID - 2000)//多店数据汇总
  10847. #endif
  10848. {
  10849. g_branchname.Empty();
  10850. g_branchip.Empty();
  10851. g_bBranchModify = 0;
  10852. if (bNeedCheckRights)
  10853. {
  10854. g_user.bLongin = 0;
  10855. if (g_user.bLongin == 0)
  10856. {
  10857. if (g_bNoLoginLia)
  10858. {
  10859. Login dlg;
  10860. dlg.SetLiaPath("5.lia");
  10861. dlg.DoModal();
  10862. }
  10863. else
  10864. {
  10865. Login3 dlg;
  10866. dlg.SetLiaPath("5.lia");
  10867. dlg.DoModal();
  10868. }
  10869. if (g_user.bLongin == 0)return;
  10870. }
  10871. }
  10872. if (IsHasRightsnew(28) == 0)
  10873. {
  10874. return;
  10875. }
  10876. g_bAllBranch = 1; g_pMainWnd2->ShowBar(0);
  10877. g_pMainWnd2->RefreshOutlookBar2();
  10878. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10879. g_branchname.Empty();
  10880. g_branchip.Empty();
  10881. g_bBranchModify = 0;
  10882. g_pMainWnd2->DrawLogin();
  10883. g_pMainWnd2->EnableBtns(0);
  10884. g_path1 = g_path1bak;
  10885. g_path2 = g_path2bak;
  10886. g_path3 = g_path3bak;
  10887. g_path4 = g_path4bak;
  10888. g_path5 = g_path5bak;
  10889. g_path6 = g_path6bak;
  10890. g_path7 = g_path7bak;
  10891. }
  10892. else
  10893. {
  10894. if (bNeedCheckRights)
  10895. {
  10896. g_branchname.Empty();
  10897. g_branchip.Empty();
  10898. g_bBranchModify = 0;
  10899. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_UNCHECKED);
  10900. g_user.bLongin = 0;
  10901. if (g_pMainWnd2)
  10902. {
  10903. g_pMainWnd2->DrawLogin();
  10904. g_pMainWnd2->ShowBar(0);
  10905. }
  10906. if (g_bNoLoginLia)
  10907. {
  10908. Login dlg;
  10909. dlg.SetLiaPath("5.lia");
  10910. dlg.DoModal();
  10911. }
  10912. else
  10913. {
  10914. Login3 dlg;
  10915. dlg.SetLiaPath("5.lia");
  10916. dlg.DoModal();
  10917. }
  10918. if (g_user.bLongin == 0)return;
  10919. }
  10920. if (IsHasRightsnew(28) == 0)
  10921. {
  10922. return;
  10923. }
  10924. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10925. #ifndef SQLSERVER_VERSION
  10926. if (nID % 2 == 0)
  10927. g_branchname = g_menubranchname.ElementAt((nID - 2000) / 2);
  10928. else
  10929. g_branchname = g_menubranchname.ElementAt((nID - 2001) / 2);
  10930. #else
  10931. g_branchname = g_menubranchname.ElementAt(nID - 2000);
  10932. #endif
  10933. //printf("选择分店:%s\n", g_branchname);
  10934. g_branchip.Empty();
  10935. CString domainname = "";
  10936. for (int i = 0; i < g_brancharray.GetSize(); i++)
  10937. {
  10938. /*
  10939. for(int j=0; j<g_brancharray.GetSize(); j++)
  10940. printf("%s\n", g_brancharray.ElementAt(i).ElementAt(j));
  10941. */
  10942. if (g_branchname == g_brancharray.ElementAt(i).ElementAt(0))
  10943. {
  10944. g_branchip = g_brancharray.ElementAt(i).ElementAt(1);
  10945. g_branchip2 = g_brancharray.ElementAt(i).ElementAt(4);
  10946. domainname = g_brancharray.ElementAt(i).ElementAt(2);
  10947. }
  10948. }
  10949. g_path1 = g_path1bak;
  10950. g_path2 = g_path2bak;
  10951. g_path3 = g_path3bak;
  10952. g_path4 = g_path4bak;
  10953. g_path5 = g_path5bak;
  10954. g_path6 = g_path6bak;
  10955. g_path7 = g_path7bak;
  10956. if (domainname.IsEmpty())
  10957. {
  10958. g_path1 = g_path2 = g_path3 = g_path4 = g_path5 = g_path6 = g_path7 = "xxx";
  10959. }
  10960. else
  10961. {
  10962. g_path1 += "\\" + domainname;
  10963. g_path2 += "\\" + domainname;
  10964. g_path3 += "\\" + domainname;
  10965. g_path4 += "\\" + domainname;
  10966. g_path5 += "\\" + domainname;
  10967. g_path6 += "\\" + domainname;
  10968. g_path7 += "\\" + domainname;
  10969. }
  10970. g_bBranchModify = 1;
  10971. /* CArray<CStringArray, CStringArray>yeararray;
  10972. for( i=0; i<g_brancharray.GetSize (); i++)
  10973. {
  10974. if(g_brancharray.ElementAt (i).ElementAt (0).Find (g_branchname)!=-1 && g_branchname!=g_brancharray.ElementAt (i).ElementAt (0))
  10975. {
  10976. int size=yeararray.GetSize ();
  10977. yeararray.SetSize(size+1,1);
  10978. CString str=g_brancharray.ElementAt (i).ElementAt (0);
  10979. str.Delete (0, g_branchname.GetLength ());
  10980. yeararray.ElementAt (size).Add (str);
  10981. }
  10982. }
  10983. AddHistoryMenu(&yeararray);*/
  10984. if (g_bBranchModify)OnDisconnect();
  10985. if (1)
  10986. {
  10987. g_user.bLongin = 0;
  10988. g_user.name.Empty();
  10989. g_user.rights.Empty();
  10990. g_user.account.Empty();
  10991. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  10992. g_pMainWnd2->RefreshOutlookBar();
  10993. m_Mdi.CloseAll();
  10994. if (g_pMainWnd2)
  10995. {
  10996. g_pMainWnd2->DrawLogin();
  10997. g_pMainWnd2->ShowBar(0);
  10998. }
  10999. if (g_bNoLoginLia)
  11000. {
  11001. Login dlg;
  11002. dlg.SetLiaPath("5.lia");
  11003. dlg.DoModal();
  11004. }
  11005. else
  11006. {
  11007. Login3 dlg;
  11008. dlg.SetLiaPath("5.lia");
  11009. dlg.DoModal();
  11010. }
  11011. if (g_user.bLongin == 0)return;
  11012. if (g_pMainWnd2)g_pMainWnd2->ShowBar(1);
  11013. }
  11014. g_pMainWnd2->DrawLogin();
  11015. g_pMainWnd2->EnableBtns(1);
  11016. }
  11017. g_nYearpos = -1;
  11018. }
  11019. #endif
  11020. }
  11021. void CMainFrame::OnStaffAchievementShow() //Jeff:此机只用于员工看业绩;
  11022. {
  11023. // TODO: Add your command handler code here
  11024. if (g_user.bLongin == 0) // 是否登陆系统;
  11025. {
  11026. if (g_bNoLoginLia)
  11027. {
  11028. Login dlg;
  11029. dlg.SetLiaPath("5.lia");
  11030. dlg.DoModal();
  11031. }
  11032. else
  11033. {
  11034. Login3 dlg;
  11035. dlg.SetLiaPath("5.lia");
  11036. dlg.DoModal();
  11037. }
  11038. if (g_user.bLongin == 0)return;
  11039. }
  11040. if (IsHasRightsnew(49) == 0)return;// 是否有权限进行设置;
  11041. CMenu *pMenu = GetMenu();
  11042. CMenu* submenu = pMenu->GetSubMenu(1);
  11043. UINT status = submenu->GetMenuState(IDM_StaffAchievementShow, MF_BYCOMMAND);
  11044. if (status&MF_CHECKED)
  11045. {
  11046. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_UNCHECKED);
  11047. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status2", 0);
  11048. g_bStaffAchievementShow = 0;
  11049. TCHAR szKey[MAX_PATH];
  11050. TCHAR szDir[MAX_PATH];
  11051. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  11052. HKEY hKey = 0;
  11053. DWORD disp = 0;
  11054. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  11055. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  11056. if (lResult == ERROR_SUCCESS)
  11057. {
  11058. RegDeleteValue(hKey, "YLGLMAINAUTORUN");
  11059. RegDeleteKey(hKey, "YLGLMAINAUTORUN");
  11060. RegCloseKey(hKey);
  11061. }
  11062. }
  11063. else
  11064. {
  11065. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  11066. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status2", 1);
  11067. g_bStaffAchievementShow = 1;
  11068. TCHAR szKey[MAX_PATH];
  11069. TCHAR szDir[MAX_PATH];
  11070. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  11071. HKEY hKey = 0;
  11072. DWORD disp = 0;
  11073. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  11074. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  11075. if (lResult == ERROR_SUCCESS)
  11076. {
  11077. lResult = RegSetValueEx(hKey, "YLGLMAINAUTORUN", 0, REG_SZ, (const unsigned char*)szDir, lstrlen(szDir));
  11078. RegCloseKey(hKey);
  11079. }
  11080. StaffAchievementSet dlg;
  11081. dlg.DoModal();
  11082. }
  11083. }
  11084. void CMainFrame::PrintDinDan2(CString m_id)
  11085. {
  11086. #ifdef MODERN_VERSION
  11087. SelContent seldlg;
  11088. if (seldlg.DoModal() != IDOK)return;
  11089. CPrintRX m_Print;
  11090. m_Print.InitToPrint(NULL, 1);
  11091. m_Print.StartPrint();
  11092. m_Print.StartPage();
  11093. // CRect StrRect(0,0,560,818);
  11094. LoadRect load;
  11095. LoadRect load2;
  11096. LoadRect load3;
  11097. load.SetLiaPath ("9.lia");
  11098. load.SetMargins(-14,0);
  11099. if(!load.Load ())return;
  11100. int i;
  11101. //////////////////////////////////////////////////////////////
  11102. CStringArray txarray;
  11103. CString filter="id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"'";
  11104. g_sendhead.code[0]=11;
  11105. g_sendhead.code[1]=52;
  11106. g_sendhead.code[2]=50;
  11107. g_sendhead.code[3]=38;
  11108. g_sendhead.code[4]=27;
  11109. g_sendhead.tabcount=5;
  11110. g_sendhead.bsql=0;
  11111. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  11112. CArray<CStringArray, CStringArray>sparray;
  11113. CArray<CStringArray, CStringArray>clientarray;
  11114. CArray<CStringArray, CStringArray>phonearray;
  11115. CArray<CStringArray, CStringArray>bukuan2array;
  11116. CArray<CStringArray, CStringArray>bukuanarray;
  11117. DataToArray(&g_List1array, &clientarray, &sparray, &bukuan2array, &bukuanarray);
  11118. CTime tm=CTime::GetCurrentTime ();
  11119. CString str;
  11120. CString m_money1 = g_List1array.ElementAt (0).ElementAt (1);
  11121. CString m_money2 = g_List1array.ElementAt (0).ElementAt (2);
  11122. CString m_money3 = g_List1array.ElementAt (0).ElementAt (3);
  11123. CString m_name1 = g_List1array.ElementAt (0).ElementAt (4);
  11124. CString m_name2 = g_List1array.ElementAt (0).ElementAt (5);
  11125. CString m_taoxiname= g_List1array.ElementAt (0).ElementAt (7);
  11126. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (8);
  11127. CString m_zs = g_List1array.ElementAt (0).ElementAt (9);
  11128. CString m_time1 = g_List1array.ElementAt (0).ElementAt (10);
  11129. CString m_time2 = g_List1array.ElementAt (0).ElementAt (11);
  11130. CString m_time3 = g_List1array.ElementAt (0).ElementAt (12);
  11131. CString m_ren = g_List1array.ElementAt (0).ElementAt (14);
  11132. CString m_discount = g_List1array.ElementAt (0).ElementAt (15);
  11133. CString m_payed1 = g_List1array.ElementAt (0).ElementAt (16);
  11134. CString m_payed2 = g_List1array.ElementAt (0).ElementAt (17);
  11135. CString m_payed3 = g_List1array.ElementAt (0).ElementAt (18);
  11136. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (19);
  11137. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (20);
  11138. CString m_time4 = g_List1array.ElementAt (0).ElementAt (21);
  11139. CString m_time5 = g_List1array.ElementAt (0).ElementAt (22);
  11140. CString m_clothescount = g_List1array.ElementAt (0).ElementAt (26);
  11141. CString m_clothescount2 = g_List1array.ElementAt (0).ElementAt (27);
  11142. CString m_outside = g_List1array.ElementAt (0).ElementAt (28);
  11143. CString m_outside2 = g_List1array.ElementAt (0).ElementAt (29);
  11144. CString m_style = g_List1array.ElementAt (0).ElementAt (30);
  11145. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (34);
  11146. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (35);
  11147. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (37);
  11148. CString m_bz = g_List1array.ElementAt (0).ElementAt (38);
  11149. CString m_phone1=clientarray.ElementAt (0).ElementAt (3);
  11150. CString m_phone2=clientarray.ElementAt (0).ElementAt (4);
  11151. CString m_addr1=clientarray.ElementAt (0).ElementAt (7);
  11152. CString m_addr2=clientarray.ElementAt (0).ElementAt (8);
  11153. CString m_occupation1=clientarray.ElementAt (0).ElementAt (9);
  11154. CString m_occupation2=clientarray.ElementAt (0).ElementAt (10);
  11155. filter="name='"+m_ren+"'";
  11156. g_sendhead.code[0]=5;
  11157. g_sendhead.tabcount=1;
  11158. g_sendhead.bsql=0;
  11159. int g_nYearposTemp=g_nYearpos;
  11160. g_nYearpos=-1;
  11161. g_pMainWnd->ProcessChatMessageRequest2(filter);
  11162. g_nYearpos=g_nYearposTemp;
  11163. if(g_bSendOK==0)return;
  11164. DataToArray(&phonearray);
  11165. m_money2.Format ("%f", atof(m_payed5)+atof(m_money1));
  11166. m_money1.Format ("%f", atof(m_taoxijiage)+atof(m_payed4));
  11167. m_money3.Format ("%f", atof(m_money1)-atof(m_money2));
  11168. ConvertToPrice(m_money1);
  11169. ConvertToPrice(m_money2);
  11170. ConvertToPrice(m_money3);
  11171. ////////////////////////////////////////////////////////////////
  11172. int rcpos=-1;
  11173. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  11174. Image *pImg=NULL;
  11175. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo2.jpg");
  11176. if(seldlg.m_bFrame)
  11177. m_Print.DrawImage(pImg, StrRect);
  11178. delete pImg;
  11179. m_Print.SetFontFace(16, 1, "黑体");
  11180. StrRect=load.m_rcarray .ElementAt (++rcpos);
  11181. if(seldlg.m_bFrame)
  11182. ///////////////////////////////不用改
  11183. m_Print.DrawText((LPTSTR)(LPCTSTR)"摩登新娘工作流程单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11184. m_Print.SetFontFace(10, 1, "宋体");
  11185. for( i=3; i<=6; i++)
  11186. {
  11187. StrRect=load.m_rcarray .ElementAt (i-1);
  11188. if(seldlg.m_bFrame)
  11189. m_Print.DrawRect2(StrRect, 1);
  11190. }
  11191. CStringArray strarray;
  11192. if(seldlg.m_bBooking==0)
  11193. {
  11194. m_name1.Empty ();
  11195. m_name2.Empty ();
  11196. m_phone1.Empty ();
  11197. m_phone2.Empty ();
  11198. m_addr1.Empty ();
  11199. m_addr2.Empty ();
  11200. m_taoxiname.Empty ();
  11201. m_taoxijiage.Empty ();
  11202. }
  11203. if(seldlg.m_bFrame )
  11204. {
  11205. strarray.Add("新郎:"+m_name1);
  11206. strarray.Add("H");
  11207. strarray.Add("O");
  11208. strarray.Add("手机:"+m_phone1);
  11209. strarray.Add("新娘:"+m_name2);
  11210. strarray.Add("H");
  11211. strarray.Add("O");
  11212. strarray.Add("手机:"+m_phone2);
  11213. }
  11214. else
  11215. {
  11216. strarray.Add(" "+m_name1);
  11217. strarray.Add("");
  11218. strarray.Add("");
  11219. strarray.Add(" "+m_phone1);
  11220. strarray.Add(" "+m_name2);
  11221. strarray.Add("");
  11222. strarray.Add("");
  11223. strarray.Add(" "+m_phone2);
  11224. }
  11225. for( i=7; i<=14; i++)
  11226. {
  11227. StrRect=load.m_rcarray .ElementAt (i-1);
  11228. StrRect.left +=2;
  11229. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11230. }
  11231. StrRect=load.m_rcarray .ElementAt (3);
  11232. StrRect.left +=2;
  11233. if(seldlg.m_bFrame)
  11234. str="地址:"+m_addr1;
  11235. else
  11236. str=" "+m_addr1;
  11237. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11238. StrRect=load.m_rcarray .ElementAt (5);
  11239. StrRect.left +=2;
  11240. if(seldlg.m_bFrame)
  11241. str="地址:"+m_addr2;
  11242. else
  11243. str=" "+m_addr2;
  11244. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11245. //////////////////////////////////////////////////////
  11246. StrRect=load.m_rcarray .ElementAt (14);
  11247. str="预\r\n约";
  11248. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11249. StrRect.top +=46;
  11250. StrRect.left +=2;
  11251. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11252. m_Print.SetFontFace(10, 1, "宋体");
  11253. StrRect=load.m_rcarray .ElementAt (15);
  11254. if(seldlg.m_bFrame)
  11255. str="套系名称:"+m_taoxiname;
  11256. else
  11257. str=" "+m_taoxiname;
  11258. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11259. StrRect.left +=4;
  11260. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11261. StrRect=load.m_rcarray .ElementAt (16);
  11262. if(seldlg.m_bFrame)
  11263. str="单价:"+m_taoxijiage;
  11264. else
  11265. str=" "+m_taoxijiage;
  11266. StrRect.left +=2;
  11267. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11268. StrRect=load.m_rcarray .ElementAt (21);
  11269. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11270. str="新人签名:";
  11271. StrRect.left +=2;
  11272. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11273. StrRect=load.m_rcarray .ElementAt (22);
  11274. if(seldlg.m_bBooking==0)
  11275. {
  11276. if(seldlg.m_bFrame)
  11277. str="未付款:";
  11278. else
  11279. str=" ";
  11280. }
  11281. else
  11282. {
  11283. if(seldlg.m_bFrame)
  11284. str="未付款:"+m_money3;
  11285. else
  11286. str=" "+m_money3;
  11287. }
  11288. StrRect.left +=2;
  11289. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11290. StrRect=load.m_rcarray .ElementAt (23);
  11291. str="结婚秘书:";
  11292. StrRect.left +=2;
  11293. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11294. StrRect=load.m_rcarray .ElementAt (24);
  11295. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11296. StrRect.left +=3;
  11297. StrRect.top +=3;
  11298. StrRect.right -=2;
  11299. StrRect.bottom -=2;
  11300. int realpos=0;str="";
  11301. for(i=0; i<sparray.GetSize (); i++)
  11302. {
  11303. if(atoi(sparray.ElementAt (i).ElementAt (4))!=1)continue;
  11304. str+=sparray.ElementAt (i).ElementAt (5);
  11305. str+=" 数量:";
  11306. str+=sparray.ElementAt (i).ElementAt (3);
  11307. if(realpos%2)
  11308. str+="\r\n";
  11309. else
  11310. str+=" ";
  11311. realpos++;
  11312. }
  11313. str.TrimRight ("\r\n");
  11314. str.TrimRight (" ");
  11315. if(seldlg.m_bBooking)AutoDraw(m_Print, StrRect, str, 1.4);
  11316. ///////////////////////////////////////////////////////////
  11317. StrRect=load.m_rcarray .ElementAt (14);
  11318. StrRect.top +=1*122;
  11319. StrRect.bottom +=1*122;
  11320. str="拍\r\n照";
  11321. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11322. StrRect.top +=46;
  11323. StrRect.left +=2;
  11324. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11325. m_Print.SetFontFace(10, 1, "宋体");
  11326. StrRect=load.m_rcarray .ElementAt (15);
  11327. StrRect.top +=1*122;
  11328. StrRect.bottom +=1*122;
  11329. str="拍照内容: 白 晚 特 便";
  11330. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11331. StrRect.left +=4;
  11332. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11333. StrRect=load.m_rcarray .ElementAt (21);
  11334. StrRect.top +=1*122;
  11335. StrRect.bottom +=1*122;
  11336. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11337. str=" 新人签名:";
  11338. StrRect.left +=2;
  11339. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11340. StrRect=load.m_rcarray .ElementAt (22);
  11341. StrRect.top +=1*122;
  11342. StrRect.bottom +=1*122;
  11343. if(seldlg.m_bTake)
  11344. {
  11345. if(seldlg.m_bFrame)
  11346. str="未付款:"+m_money3;
  11347. else
  11348. str=" "+m_money3;
  11349. }
  11350. else
  11351. {
  11352. if(seldlg.m_bFrame)
  11353. str="未付款:";
  11354. else
  11355. str=" ";
  11356. }
  11357. StrRect.left +=2;
  11358. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11359. StrRect=load.m_rcarray .ElementAt (23);
  11360. StrRect.top +=1*122;
  11361. StrRect.bottom +=1*122;
  11362. str="结婚秘书:";
  11363. StrRect.left +=2;
  11364. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11365. StrRect=load.m_rcarray .ElementAt (24);
  11366. StrRect.top +=1*122;
  11367. StrRect.bottom +=1*122;
  11368. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11369. StrRect.left +=3;
  11370. StrRect.top +=3;
  11371. StrRect.right -=2;
  11372. StrRect.bottom -=2;
  11373. if(seldlg.m_bTake)
  11374. {
  11375. str="";
  11376. for(i=0; i<bukuan2array.GetSize (); i++)
  11377. {
  11378. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=1)continue;
  11379. str+="加挑: ";
  11380. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11381. str+="\r\n";
  11382. }
  11383. str.TrimRight ("\r\n");
  11384. str.TrimRight (" ");
  11385. AutoDraw(m_Print, StrRect, str, 1.4);
  11386. }
  11387. ///////////////////////////////////////////////////////////
  11388. StrRect=load.m_rcarray .ElementAt (14);
  11389. StrRect.top +=2*122;
  11390. StrRect.bottom +=2*122;
  11391. str="选\r\n样";
  11392. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11393. StrRect.top +=46;
  11394. StrRect.left +=2;
  11395. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11396. m_Print.SetFontFace(10, 1, "宋体");
  11397. StrRect=load.m_rcarray .ElementAt (15);
  11398. StrRect.top +=2*122;
  11399. StrRect.bottom +=2*122;
  11400. str="选片内容:";
  11401. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11402. StrRect.left +=4;
  11403. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11404. StrRect=load.m_rcarray .ElementAt (21);
  11405. StrRect.top +=2*122;
  11406. StrRect.bottom +=2*122;
  11407. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11408. str=" 新人签名:";
  11409. StrRect.left +=2;
  11410. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11411. StrRect=load.m_rcarray .ElementAt (22);
  11412. StrRect.top +=2*122;
  11413. StrRect.bottom +=2*122;
  11414. if(seldlg.m_bChoose)
  11415. {
  11416. if(seldlg.m_bFrame)
  11417. str="未付款:"+m_money3;
  11418. else
  11419. str=" "+m_money3;
  11420. }
  11421. else
  11422. {
  11423. if(seldlg.m_bFrame)
  11424. str="未付款:";
  11425. else
  11426. str=" ";
  11427. }
  11428. StrRect.left +=2;
  11429. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11430. StrRect=load.m_rcarray .ElementAt (23);
  11431. StrRect.top +=2*122;
  11432. StrRect.bottom +=2*122;
  11433. str="结婚秘书:";
  11434. StrRect.left +=2;
  11435. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11436. StrRect=load.m_rcarray .ElementAt (24);
  11437. StrRect.top +=2*122;
  11438. StrRect.bottom +=2*122;
  11439. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11440. if(seldlg.m_bChoose)
  11441. {
  11442. StrRect.left +=3;
  11443. StrRect.top +=3;
  11444. StrRect.right -=2;
  11445. StrRect.bottom -=2;
  11446. str="";
  11447. for(i=0; i<bukuan2array.GetSize (); i++)
  11448. {
  11449. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=2)continue;
  11450. str+="加挑: ";
  11451. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11452. str+="\r\n";
  11453. }
  11454. str.TrimRight ("\r\n");
  11455. str.TrimRight (" ");
  11456. AutoDraw(m_Print, StrRect, str, 1.4);
  11457. }
  11458. ///////////////////////////////////////////////////////////
  11459. StrRect=load.m_rcarray .ElementAt (14);
  11460. StrRect.top +=3*122;
  11461. StrRect.bottom +=3*122;
  11462. str="结\r\n婚";
  11463. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11464. StrRect.top +=46;
  11465. StrRect.left +=2;
  11466. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11467. m_Print.SetFontFace(10, 1, "宋体");
  11468. StrRect=load.m_rcarray .ElementAt (15);
  11469. StrRect.top +=3*122;
  11470. StrRect.bottom +=3*122;
  11471. str="结婚内容: 区 白 晚 押金:";
  11472. if(seldlg.m_bFrame) m_Print.DrawRect2(StrRect, 1);
  11473. StrRect.left +=4;
  11474. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11475. StrRect=load.m_rcarray .ElementAt (21);
  11476. StrRect.top +=3*122;
  11477. StrRect.bottom +=3*122;
  11478. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11479. str=" 新人签名:";
  11480. StrRect.left +=2;
  11481. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11482. StrRect=load.m_rcarray .ElementAt (22);
  11483. StrRect.top +=3*122;
  11484. StrRect.bottom +=3*122;
  11485. if(seldlg.m_bBooking)
  11486. {
  11487. if(seldlg.m_bFrame)
  11488. str="未付款:"+m_money3;
  11489. else
  11490. str=" "+m_money3;
  11491. }
  11492. else
  11493. {
  11494. if(seldlg.m_bFrame)
  11495. str="未付款:";
  11496. else
  11497. str=" ";
  11498. }
  11499. StrRect.left +=2;
  11500. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11501. StrRect=load.m_rcarray .ElementAt (23);
  11502. StrRect.top +=3*122;
  11503. StrRect.bottom +=3*122;
  11504. str="结婚秘书:";
  11505. StrRect.left +=2;
  11506. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11507. StrRect=load.m_rcarray .ElementAt (24);
  11508. StrRect.top +=3*122;
  11509. StrRect.bottom +=3*122;
  11510. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11511. if(seldlg.m_bBooking)
  11512. {
  11513. StrRect.left +=3;
  11514. StrRect.top +=3;
  11515. StrRect.right -=2;
  11516. StrRect.bottom -=2;
  11517. realpos=0;str="";
  11518. for(i=0; i<sparray.GetSize (); i++)
  11519. {
  11520. if(atoi(sparray.ElementAt (i).ElementAt (4))!=2)continue;
  11521. str+=sparray.ElementAt (i).ElementAt (5);
  11522. str+=" 数量:";
  11523. str+=sparray.ElementAt (i).ElementAt (3);
  11524. if(realpos%2)
  11525. str+="\r\n";
  11526. else
  11527. str+=" ";
  11528. realpos++;
  11529. }
  11530. str.TrimRight ("\r\n");
  11531. str.TrimRight (" ");
  11532. AutoDraw(m_Print, StrRect, str, 1.4);
  11533. }
  11534. ///////////////////////////////////////
  11535. strarray.RemoveAll ();
  11536. if(seldlg.m_bFrame)
  11537. {
  11538. strarray.Add ("项目");
  11539. strarray.Add ("万");
  11540. strarray.Add ("千");
  11541. strarray.Add ("百");
  11542. strarray.Add ("十");
  11543. strarray.Add ("个");
  11544. strarray.Add ("收 银");
  11545. }
  11546. else
  11547. {
  11548. strarray.Add ("");
  11549. strarray.Add ("");
  11550. strarray.Add ("");
  11551. strarray.Add ("");
  11552. strarray.Add ("");
  11553. strarray.Add ("");
  11554. strarray.Add ("");
  11555. }
  11556. CStringArray strarray2;
  11557. float ftotal=0;
  11558. int realcount=0;
  11559. if(seldlg.m_bBooking)
  11560. {
  11561. for(i=0; i<bukuanarray.GetSize (); i++)
  11562. {
  11563. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=3 && atoi(bukuanarray.ElementAt (i).ElementAt (6))!=4)continue;
  11564. realcount++;
  11565. if(realcount>6)break;
  11566. str=bukuanarray.ElementAt (i).ElementAt (1);
  11567. ftotal+=atof(str);
  11568. strarray2.Add (GetW(str));
  11569. strarray2.Add (GetK(str));
  11570. strarray2.Add (GetB(str));
  11571. strarray2.Add (GetS(str));
  11572. strarray2.Add (GetG(str));
  11573. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11574. }
  11575. }
  11576. while(strarray2.GetSize ()<36)
  11577. strarray2.Add ("");
  11578. str.Format ("%f", ftotal);
  11579. strarray2.Add (GetW(str));
  11580. strarray2.Add (GetK(str));
  11581. strarray2.Add (GetB(str));
  11582. strarray2.Add (GetS(str));
  11583. strarray2.Add (GetG(str));
  11584. strarray2.Add ("");
  11585. //拍照
  11586. ftotal=0;
  11587. realcount=0;
  11588. if(seldlg.m_bTake)
  11589. {
  11590. for(i=0; i<bukuanarray.GetSize (); i++)
  11591. {
  11592. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=1)continue;
  11593. realcount++;
  11594. if(realcount>6)break;
  11595. str=bukuanarray.ElementAt (i).ElementAt (1);
  11596. ftotal+=atof(str);
  11597. strarray2.Add (GetW(str));
  11598. strarray2.Add (GetK(str));
  11599. strarray2.Add (GetB(str));
  11600. strarray2.Add (GetS(str));
  11601. strarray2.Add (GetG(str));
  11602. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11603. }
  11604. }
  11605. while(strarray2.GetSize ()<42+36)
  11606. strarray2.Add ("");
  11607. str.Format ("%f", ftotal);
  11608. strarray2.Add (GetW(str));
  11609. strarray2.Add (GetK(str));
  11610. strarray2.Add (GetB(str));
  11611. strarray2.Add (GetS(str));
  11612. strarray2.Add (GetG(str));
  11613. strarray2.Add ("");
  11614. //选片
  11615. ftotal=0;
  11616. realcount=0;
  11617. if(seldlg.m_bChoose)
  11618. {
  11619. for(i=0; i<bukuanarray.GetSize (); i++)
  11620. {
  11621. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=2)continue;
  11622. realcount++;
  11623. if(realcount>6)break;
  11624. str=bukuanarray.ElementAt (i).ElementAt (1);
  11625. ftotal+=atof(str);
  11626. strarray2.Add (GetW(str));
  11627. strarray2.Add (GetK(str));
  11628. strarray2.Add (GetB(str));
  11629. strarray2.Add (GetS(str));
  11630. strarray2.Add (GetG(str));
  11631. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11632. }
  11633. }
  11634. while(strarray2.GetSize ()<42*2+36)
  11635. strarray2.Add ("");
  11636. str.Format ("%f", ftotal);
  11637. strarray2.Add (GetW(str));
  11638. strarray2.Add (GetK(str));
  11639. strarray2.Add (GetB(str));
  11640. strarray2.Add (GetS(str));
  11641. strarray2.Add (GetG(str));
  11642. strarray2.Add ("");
  11643. /////////////////////////////
  11644. CRect temprc;
  11645. for(int n=0; n<4; n++)
  11646. {
  11647. StrRect=load.m_rcarray .ElementAt (17);
  11648. StrRect.top +=n*122;
  11649. StrRect.bottom +=n*122;
  11650. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11651. StrRect=load.m_rcarray .ElementAt (18);
  11652. if(n)
  11653. {
  11654. StrRect.left +=36;
  11655. StrRect.right +=36;
  11656. }
  11657. StrRect.top +=n*122;
  11658. StrRect.bottom +=n*122;
  11659. if(seldlg.m_bFrame)
  11660. str.Format("%d年", tm.GetYear ());
  11661. else
  11662. str.Format("%d ", tm.GetYear ());
  11663. 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))
  11664. {
  11665. if(seldlg.m_bFrame)
  11666. str=" 年";
  11667. else
  11668. str=" ";
  11669. }
  11670. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11671. StrRect=load.m_rcarray .ElementAt (19);
  11672. if(n)
  11673. {
  11674. StrRect.left +=38;
  11675. StrRect.right +=38;
  11676. }
  11677. StrRect.top +=n*122;
  11678. StrRect.bottom +=n*122;
  11679. if(seldlg.m_bFrame)
  11680. str.Format("%02d月", tm.GetMonth ());
  11681. else
  11682. str.Format("%02d ", tm.GetMonth ());
  11683. 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))
  11684. {
  11685. if(seldlg.m_bFrame)
  11686. str=" 月";
  11687. else
  11688. str=" ";
  11689. }
  11690. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11691. StrRect=load.m_rcarray .ElementAt (20);
  11692. if(n)
  11693. {
  11694. StrRect.left +=36;
  11695. StrRect.right +=36;
  11696. }
  11697. StrRect.top +=n*122;
  11698. StrRect.bottom +=n*122;
  11699. if(seldlg.m_bFrame)
  11700. str.Format("%02d日", tm.GetDay ());
  11701. else
  11702. str.Format("%02d ", tm.GetDay ());
  11703. 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))
  11704. {
  11705. if(seldlg.m_bFrame)
  11706. str=" 日";
  11707. else
  11708. str=" ";
  11709. }
  11710. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11711. for(i=26; i<=32; i++)
  11712. {
  11713. StrRect=load.m_rcarray .ElementAt (i-1);
  11714. StrRect.bottom -=14;
  11715. for(int j=0; j<8; j++)
  11716. {
  11717. StrRect.top=StrRect.bottom;
  11718. if(j>2)
  11719. {
  11720. StrRect.bottom =StrRect.top+14;
  11721. }
  11722. else
  11723. {
  11724. StrRect.bottom =StrRect.top+13;
  11725. }
  11726. temprc=StrRect;
  11727. StrRect.top +=n*122;
  11728. StrRect.bottom +=n*122;
  11729. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11730. if(i==26 && j==4 && seldlg.m_bFrame)
  11731. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11732. else if(i==26 && j==5 && seldlg.m_bFrame)
  11733. m_Print.DrawText((LPTSTR)(LPCTSTR)"付款", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11734. else if(i==26 && j==7 && seldlg.m_bFrame)
  11735. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11736. else if(j==0)
  11737. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-26), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11738. else if(j && i>26 && n<3)
  11739. {
  11740. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray2.ElementAt ((j-1)*6+(i-27)+n*42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11741. }
  11742. StrRect=temprc;
  11743. }
  11744. }
  11745. }
  11746. if(seldlg.m_bFrame)
  11747. {
  11748. StrRect=load.m_rcarray .ElementAt (32);
  11749. str="注\r\n意\r\n事\r\n项";
  11750. StrRect.top +=367;
  11751. StrRect.bottom +=367;
  11752. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11753. StrRect.top +=17;
  11754. StrRect.left +=2;
  11755. AutoDraw(m_Print, StrRect, str, 1.4);
  11756. StrRect=load.m_rcarray .ElementAt (33);
  11757. str="1: 本预约单自预定日期起一年内有效.定金在拍照套系金额中扣出.预定金一概不退\r\n\
  11758. 2: 多拍照片只供筛选.恕不奉送.版权所有.不得私自拷贝\r\n\
  11759. 3: 拍照款请于拍照时一次付清\r\n\
  11760. 4: 新娘装AM8:00前钟点费另计.婚纱礼服出租押金500-2000元\r\n\
  11761. 5: 本公司设有豪华VIP礼服区.及皇家御用礼服展区.但需另外加价.详情请咨本店人员\r\n\
  11762. 6: 安瓶, 美甲一次性化妆用具等均属增值服务部分,则需另外加价,详情咨询本店工作人员\r\n\
  11763. 7: 本电脑机械故障导致文件资料丢失.本公司只提供补拍服务\r\n\
  11764. 8: 每次前来请务必携带本单交给工作人员.本单是您在摩登新娘拍照的凭证.办理有关手续凭本单办理盖\r\n\
  11765. 章后方可生效";
  11766. StrRect.top +=367;
  11767. StrRect.bottom +=367;
  11768. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11769. StrRect.top +=4;
  11770. StrRect.left +=2;
  11771. AutoDraw(m_Print, StrRect, str, 1.0);
  11772. StrRect=load.m_rcarray .ElementAt (34);
  11773. 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)";
  11774. AutoDraw(m_Print, StrRect, str, 1.0);
  11775. m_Print.SetFontFace(13, 1, "宋体");
  11776. StrRect=load.m_rcarray .ElementAt (35);
  11777. str="地 址: 汉口 . 解放大道 . 头道街东部购物公园C栋二,三层";
  11778. StrRect.top +=367;
  11779. StrRect.bottom +=367;
  11780. StrRect.left +=2;
  11781. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11782. StrRect=load.m_rcarray .ElementAt (36);
  11783. str="喜讯热线: 027-81888799 81888599 81888699";
  11784. StrRect.top +=367;
  11785. StrRect.bottom +=367;
  11786. StrRect.left +=2;
  11787. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11788. }
  11789. PrintPreview dlg;
  11790. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  11791. dlg.m_pDC =m_Print.GetPDC() ;
  11792. if(dlg.DoModal ()!=IDOK)return;
  11793. //结束打印
  11794. m_Print.EndPage();
  11795. m_Print.EndPrint();
  11796. #endif
  11797. }
  11798. extern CString GetHMoney(CString str);
  11799. void CMainFrame::PrintReceipt3(CString strOrderNumber, CStringArray *pArray, float money)
  11800. {
  11801. int printcot = 1;
  11802. for (int aa = 0; aa < printcot; aa++)
  11803. {
  11804. g_sendhead.bsql = 0;
  11805. g_sendhead.code[0] = 24;
  11806. g_sendhead.tabcount = 1;
  11807. int g_nYearposTemp = g_nYearpos;
  11808. g_nYearpos = -1;
  11809. g_pMainWnd->ProcessChatMessageRequest2(1);
  11810. g_nYearpos = g_nYearposTemp;
  11811. if (0 == g_bSendOK)return;
  11812. DataToArray(&g_cominfoarray);
  11813. CString SerialNo;
  11814. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  11815. CPrintRX m_Print;
  11816. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  11817. {
  11818. m_Print.InitToPrint(NULL, 1);
  11819. }
  11820. else
  11821. {
  11822. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  11823. if (name.IsEmpty())
  11824. m_Print.InitToPrint(NULL, 1);
  11825. else
  11826. {
  11827. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  11828. if (nret == -1 && aa == 0)
  11829. {
  11830. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  11831. }
  11832. }
  11833. }
  11834. m_Print.StartPrint();
  11835. m_Print.StartPage();
  11836. LoadRect load;
  11837. load.SetLiaPath("15.lia");
  11838. load.SetMargins(0, 0);
  11839. if (!load.Load())return;
  11840. int i;
  11841. //////////////////////////////////////////////////////////////
  11842. CStringArray txarray;
  11843. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  11844. g_sendhead.code[0] = 11;
  11845. g_sendhead.code[1] = 52;
  11846. g_sendhead.tabcount = 2;
  11847. g_sendhead.bsql = 0;
  11848. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  11849. CArray<CStringArray, CStringArray>sparray;
  11850. CArray<CStringArray, CStringArray>clientarray;
  11851. DataToArray(&g_List1array, &clientarray);
  11852. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  11853. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  11854. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  11855. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  11856. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  11857. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  11858. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  11859. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  11860. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  11861. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  11862. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  11863. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  11864. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  11865. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  11866. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  11867. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  11868. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  11869. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  11870. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  11871. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  11872. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  11873. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  11874. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  11875. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  11876. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  11877. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  11878. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  11879. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  11880. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  11881. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  11882. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  11883. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  11884. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  11885. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  11886. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  11887. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  11888. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  11889. CString m_addr = m_addr1 + ";";
  11890. m_addr.TrimLeft(";");
  11891. m_addr += m_addr2;
  11892. CString m_qq = m_qq1 + ";";
  11893. m_qq.TrimLeft(";");
  11894. m_qq += m_qq2;
  11895. m_money1.Format("%f", atof(m_taoxijiage));
  11896. m_money2.Format("%f", atof(m_payed1));
  11897. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  11898. ConvertToPrice(m_money1);
  11899. ConvertToPrice(m_money2);
  11900. ConvertToPrice(m_money3);
  11901. ////////////////////////////////////////////////////////////////
  11902. int rcpos = -1;
  11903. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  11904. m_Print.SetFontFace(17, 1, "宋体");
  11905. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11906. StrRect.top -= 0;
  11907. StrRect.bottom -= 10;
  11908. StrRect.left -= 140;
  11909. StrRect.right = StrRect.left + 48;
  11910. m_Print.SetFontFace(15, 1, "宋体");
  11911. m_Print.SetColor(0xffffff);
  11912. m_Print.DrawRect(StrRect, 0);
  11913. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11914. StrRect.left = StrRect.right;
  11915. StrRect.right = StrRect.left + 48;
  11916. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  11917. m_Print.SetColor(0, RGB(255, 0, 0));
  11918. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11919. m_Print.SetColor(0);
  11920. m_Print.SetFontFace(12, 1, "宋体");
  11921. StrRect.left -= 48;
  11922. int hei = StrRect.Height();
  11923. StrRect.top = StrRect.bottom + 2;
  11924. StrRect.bottom += hei + 2;
  11925. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11926. StrRect.top = StrRect.bottom - 2;
  11927. StrRect.bottom += hei - 5;
  11928. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  11929. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11930. m_Print.SetFontFace(12, 1, "宋体");
  11931. m_Print.DrawText((LPTSTR)(LPCTSTR)"收款单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11932. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11933. m_Print.SetFontFace(9, 1, "宋体");
  11934. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11935. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11936. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11937. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11938. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11939. m_Print.DrawRect2(StrRect, 2);
  11940. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11941. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11942. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11943. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11944. m_Print.DrawRect2(StrRect, 2);
  11945. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11946. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11947. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11948. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11949. m_Print.DrawRect2(StrRect, 2);
  11950. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11951. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约地点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11952. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11953. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11954. m_Print.DrawRect2(StrRect, 2);
  11955. ////////////
  11956. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11957. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11958. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11959. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11960. m_Print.DrawRect2(StrRect, 2);
  11961. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11962. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11963. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11964. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11965. m_Print.DrawRect2(StrRect, 2);
  11966. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11967. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11968. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11969. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11970. m_Print.DrawRect2(StrRect, 2);
  11971. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11972. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11973. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11974. m_Print.DrawText((LPTSTR)(LPCTSTR)g_date, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11975. m_Print.DrawRect2(StrRect, 2);
  11976. for (i = 19; i < 49; i++)
  11977. {
  11978. if (i >= 44)
  11979. {
  11980. StrRect = load.m_rcarray.ElementAt(i - 5);
  11981. int hei = StrRect.Height();
  11982. StrRect.top += hei;
  11983. StrRect.bottom += hei;
  11984. }
  11985. else
  11986. StrRect = load.m_rcarray.ElementAt(i);
  11987. m_Print.DrawRect2(StrRect, 1);
  11988. }
  11989. float fmoney = 0;
  11990. for (i = 19; i < 49; i++)
  11991. {
  11992. if (i >= 44)
  11993. {
  11994. StrRect = load.m_rcarray.ElementAt(i - 5);
  11995. int hei = StrRect.Height();
  11996. StrRect.top += hei;
  11997. StrRect.bottom += hei;
  11998. }
  11999. else
  12000. StrRect = load.m_rcarray.ElementAt(i);
  12001. StrRect.left += 2;
  12002. /* if((i-19)%5==2)
  12003. {
  12004. fmoney+=atof(pArray->ElementAt (i-19));
  12005. }*/
  12006. m_Print.DrawText((LPTSTR)(LPCTSTR)(pArray->ElementAt(i - 19)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12007. }
  12008. m_money2.Format("%f", money);
  12009. ConvertToPrice(m_money2);
  12010. StrRect = load.m_rcarray.ElementAt(44);
  12011. CString str;
  12012. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 实收¥: %s 元 收银员: %s", \
  12013. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  12014. m_money2, g_user.name);
  12015. m_Print.DrawRect2(StrRect, 1);
  12016. StrRect.left += 3;
  12017. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12018. StrRect = load.m_rcarray.ElementAt(46);
  12019. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12020. StrRect = load.m_rcarray.ElementAt(47);
  12021. m_Print.DrawRect2(StrRect, 2);
  12022. StrRect = load.m_rcarray.ElementAt(48);
  12023. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12024. StrRect = load.m_rcarray.ElementAt(45);
  12025. str = "\
  12026. 顾客须知\r\n\
  12027. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  12028. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  12029. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  12030. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  12031. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  12032. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  12033. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  12034. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12035. AutoDraw(m_Print, StrRect, str, 1.8);
  12036. PrintPreview dlg;
  12037. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12038. dlg.m_pDC = m_Print.GetPDC();
  12039. if (aa == 0)
  12040. {
  12041. if (dlg.DoModal() != IDOK)
  12042. return;
  12043. printcot = dlg.m_num;
  12044. }
  12045. //结束打印
  12046. m_Print.EndPage();
  12047. m_Print.EndPrint();
  12048. }
  12049. }
  12050. void CMainFrame::PrintReceipt2(CString strOrderNumber)
  12051. {
  12052. int printcot = 1;
  12053. for (int aa = 0; aa < printcot; aa++)
  12054. {
  12055. g_sendhead.bsql = 0;
  12056. g_sendhead.code[0] = 24;
  12057. g_sendhead.tabcount = 1;
  12058. int g_nYearposTemp = g_nYearpos;
  12059. g_nYearpos = -1;
  12060. g_pMainWnd->ProcessChatMessageRequest2(1);
  12061. g_nYearpos = g_nYearposTemp;
  12062. if (0 == g_bSendOK)return;
  12063. DataToArray(&g_cominfoarray);
  12064. CString SerialNo;
  12065. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  12066. CPrintRX m_Print;
  12067. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12068. {
  12069. m_Print.InitToPrint(NULL, 1);
  12070. }
  12071. else
  12072. {
  12073. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  12074. if (name.IsEmpty())
  12075. m_Print.InitToPrint(NULL, 1);
  12076. else
  12077. {
  12078. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12079. if (nret == -1 && aa == 0)
  12080. {
  12081. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12082. }
  12083. }
  12084. }
  12085. m_Print.StartPrint();
  12086. m_Print.StartPage();
  12087. LoadRect load;
  12088. load.SetLiaPath("14.lia");
  12089. load.SetMargins(0, 0);
  12090. if (!load.Load())return;
  12091. int i;
  12092. //////////////////////////////////////////////////////////////
  12093. CStringArray txarray;
  12094. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  12095. g_sendhead.code[0] = 11;
  12096. g_sendhead.code[1] = 52;
  12097. g_sendhead.code[2] = 93;
  12098. g_sendhead.tabcount = 3;
  12099. g_sendhead.bsql = 0;
  12100. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12101. CArray<CStringArray, CStringArray>sparray;
  12102. CArray<CStringArray, CStringArray>clientarray;
  12103. CArray<CStringArray, CStringArray>moneyarray;
  12104. DataToArray(&g_List1array, &clientarray, &moneyarray);
  12105. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12106. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12107. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12108. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12109. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12110. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  12111. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12112. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12113. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12114. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12115. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12116. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12117. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12118. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12119. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12120. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12121. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12122. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12123. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12124. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12125. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12126. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12127. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12128. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12129. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12130. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12131. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12132. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12133. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  12134. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12135. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12136. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  12137. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  12138. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  12139. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  12140. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  12141. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  12142. CString m_addr = m_addr1 + ";";
  12143. m_addr.TrimLeft(";");
  12144. m_addr += m_addr2;
  12145. CString m_qq = m_qq1 + ";";
  12146. m_qq.TrimLeft(";");
  12147. m_qq += m_qq2;
  12148. m_money1.Format("%f", atof(m_taoxijiage));
  12149. m_money2 = "0";
  12150. for (i = 0; i < moneyarray.GetSize(); i++)
  12151. {
  12152. if (moneyarray.ElementAt(i).ElementAt(5) == "预约收款")
  12153. m_money2 = moneyarray.ElementAt(i).ElementAt(1);
  12154. }
  12155. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  12156. ConvertToPrice(m_money1);
  12157. ConvertToPrice(m_money2);
  12158. ConvertToPrice(m_money3);
  12159. ////////////////////////////////////////////////////////////////
  12160. int rcpos = -1;
  12161. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12162. m_Print.SetFontFace(17, 1, "宋体");
  12163. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12164. StrRect.top -= 0;
  12165. StrRect.bottom -= 10;
  12166. StrRect.left -= 140;
  12167. StrRect.right = StrRect.left + 48;
  12168. m_Print.SetFontFace(15, 1, "宋体");
  12169. m_Print.SetColor(0xffffff);
  12170. m_Print.DrawRect(StrRect, 0);
  12171. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12172. StrRect.left = StrRect.right;
  12173. StrRect.right = StrRect.left + 48;
  12174. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12175. m_Print.SetColor(0, RGB(255, 0, 0));
  12176. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12177. m_Print.SetColor(0);
  12178. m_Print.SetFontFace(12, 1, "宋体");
  12179. StrRect.left -= 48;
  12180. int hei = StrRect.Height();
  12181. StrRect.top = StrRect.bottom + 2;
  12182. StrRect.bottom += hei + 2;
  12183. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12184. StrRect.top = StrRect.bottom - 2;
  12185. StrRect.bottom += hei - 5;
  12186. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12187. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12188. m_Print.SetFontFace(12, 1, "宋体");
  12189. m_Print.DrawText((LPTSTR)(LPCTSTR)"定金单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12190. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12191. m_Print.SetFontFace(9, 1, "宋体");
  12192. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12193. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12194. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12195. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12196. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12197. m_Print.DrawRect2(StrRect, 2);
  12198. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12199. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12200. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12201. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12202. m_Print.DrawRect2(StrRect, 2);
  12203. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12204. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12205. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12206. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12207. m_Print.DrawRect2(StrRect, 2);
  12208. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12209. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约地点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12210. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12211. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12212. m_Print.DrawRect2(StrRect, 2);
  12213. ////////////
  12214. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12215. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12216. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12217. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12218. m_Print.DrawRect2(StrRect, 2);
  12219. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12220. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12221. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12222. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12223. m_Print.DrawRect2(StrRect, 2);
  12224. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12225. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12226. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12227. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12228. m_Print.DrawRect2(StrRect, 2);
  12229. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12230. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12231. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12232. m_Print.DrawText((LPTSTR)(LPCTSTR)g_date, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12233. m_Print.DrawRect2(StrRect, 2);
  12234. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12235. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客地址:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12236. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12237. m_Print.DrawText((LPTSTR)(LPCTSTR)m_addr, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12238. m_Print.DrawRect2(StrRect, 2);
  12239. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12240. m_Print.DrawText((LPTSTR)(LPCTSTR)"大婚时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12241. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12242. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12243. m_Print.DrawRect2(StrRect, 2);
  12244. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12245. m_Print.DrawText((LPTSTR)(LPCTSTR)"QQ/MSN:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12246. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12247. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12248. m_Print.DrawRect2(StrRect, 2);
  12249. CStringArray strarray;
  12250. strarray.Add("套系名称");
  12251. strarray.Add("总 额");
  12252. strarray.Add("定 金");
  12253. strarray.Add("余 款");
  12254. strarray.Add("摄影日期");
  12255. strarray.Add(m_taoxiname);
  12256. strarray.Add(m_money1);
  12257. strarray.Add(m_money2);
  12258. strarray.Add(m_money3);
  12259. strarray.Add(m_time2);
  12260. for (i = 25; i < 37; i++)
  12261. {
  12262. StrRect = load.m_rcarray.ElementAt(i);
  12263. m_Print.DrawRect2(StrRect, 1);
  12264. }
  12265. for (i = 25; i < 35; i++)
  12266. {
  12267. StrRect = load.m_rcarray.ElementAt(i);
  12268. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 25), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12269. }
  12270. StrRect = load.m_rcarray.ElementAt(35);
  12271. StrRect.left += 5;
  12272. StrRect.top += 5;
  12273. m_Print.DrawText((LPTSTR)(LPCTSTR)" 备 注:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  12274. StrRect = load.m_rcarray.ElementAt(36);
  12275. CString str;
  12276. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 ¥: %s 元 收银员: %s", \
  12277. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  12278. m_money2, g_user.name);
  12279. StrRect.left += 3;
  12280. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12281. StrRect = load.m_rcarray.ElementAt(38);
  12282. m_Print.DrawText((LPTSTR)(LPCTSTR)"营业员:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12283. StrRect = load.m_rcarray.ElementAt(39);
  12284. m_Print.DrawText((LPTSTR)(LPCTSTR)m_ren, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12285. m_Print.DrawRect2(StrRect, 2);
  12286. StrRect = load.m_rcarray.ElementAt(40);
  12287. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12288. StrRect = load.m_rcarray.ElementAt(41);
  12289. m_Print.DrawRect2(StrRect, 2);
  12290. StrRect = load.m_rcarray.ElementAt(42);
  12291. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12292. StrRect = load.m_rcarray.ElementAt(37);
  12293. str = "\
  12294. 顾客须知\r\n\
  12295. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  12296. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  12297. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  12298. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  12299. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  12300. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  12301. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  12302. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12303. AutoDraw(m_Print, StrRect, str, 1.8);
  12304. PrintPreview dlg;
  12305. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12306. dlg.m_pDC = m_Print.GetPDC();
  12307. if (aa == 0)
  12308. {
  12309. if (dlg.DoModal() != IDOK)
  12310. return;
  12311. printcot = dlg.m_num;
  12312. }
  12313. //结束打印
  12314. m_Print.EndPage();
  12315. m_Print.EndPrint();
  12316. }
  12317. }
  12318. void CMainFrame::OnAutodelphoto()
  12319. {
  12320. // TODO: Add your command handler code here
  12321. if (g_user.bLongin == 0)
  12322. {
  12323. if (g_bNoLoginLia)
  12324. {
  12325. Login dlg;
  12326. dlg.SetLiaPath("5.lia");
  12327. dlg.DoModal();
  12328. }
  12329. else
  12330. {
  12331. Login3 dlg;
  12332. dlg.SetLiaPath("5.lia");
  12333. dlg.DoModal();
  12334. }
  12335. if (g_user.bLongin == 0)return;
  12336. }
  12337. if (IsHasRightsnew(49) == 0)return;
  12338. DelPhotoSet dlg;
  12339. dlg.DoModal();
  12340. }
  12341. void CMainFrame::Onphotomanage() // 客照管理中心;
  12342. {
  12343. if (g_user.bLongin == 0)
  12344. {
  12345. if (g_bNoLoginLia)
  12346. {
  12347. Login dlg;
  12348. dlg.SetLiaPath("5.lia");
  12349. dlg.DoModal();
  12350. }
  12351. else
  12352. {
  12353. Login3 dlg;
  12354. dlg.SetLiaPath("5.lia");
  12355. dlg.DoModal();
  12356. }
  12357. if (g_user.bLongin == 0)return;
  12358. }
  12359. if (IsHasRightsnew(49) == 0)return;
  12360. ShowPic3 dlg;
  12361. dlg.DoModal();
  12362. }
  12363. void CMainFrame::OnCompanyinfo()
  12364. {
  12365. // TODO: Add your command handler code here
  12366. if (g_user.bLongin == 0)
  12367. {
  12368. if (g_bNoLoginLia)
  12369. {
  12370. Login dlg;
  12371. dlg.SetLiaPath("5.lia");
  12372. dlg.DoModal();
  12373. }
  12374. else
  12375. {
  12376. Login3 dlg;
  12377. dlg.SetLiaPath("5.lia");
  12378. dlg.DoModal();
  12379. }
  12380. if (g_user.bLongin == 0)return;
  12381. }
  12382. if (IsHasRightsnew(49) == 0)return;
  12383. CompanyInfo dlg;
  12384. dlg.DoModal();
  12385. }
  12386. void CMainFrame::OnTaoxifg()
  12387. {
  12388. // TODO: Add your command handler code here
  12389. if (g_user.bLongin == 0)
  12390. {
  12391. if (g_bNoLoginLia)
  12392. {
  12393. Login dlg;
  12394. dlg.SetLiaPath("5.lia");
  12395. dlg.DoModal();
  12396. }
  12397. else
  12398. {
  12399. Login3 dlg;
  12400. dlg.SetLiaPath("5.lia");
  12401. dlg.DoModal();
  12402. }
  12403. if (g_user.bLongin == 0)return;
  12404. }
  12405. if (IsHasRightsnew(49) == 0)return;
  12406. TXFG dlg;
  12407. dlg.DoModal();
  12408. }
  12409. void CMainFrame::OnHelpfile()
  12410. {
  12411. // TODO: Add your command handler code here
  12412. // ShellExecute(NULL, _T("open"), _T(g_mainpath+"\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  12413. // if(::PathFileExists (g_mainpath+"\\zx.dll"))
  12414. // ShellExecute(NULL, _T("open"), _T("www.zcsmkj.com"), "", NULL, SW_SHOWNORMAL);
  12415. // else
  12416. ShellExecute(NULL, _T("open"), _T("www.lyfz.net"), "", NULL, SW_SHOWNORMAL);
  12417. }
  12418. void CMainFrame::OnPhotobak()
  12419. {
  12420. // TODO: Add your command handler code here
  12421. if (g_user.bLongin == 0)
  12422. {
  12423. if (g_bNoLoginLia)
  12424. {
  12425. Login dlg;
  12426. dlg.SetLiaPath("5.lia");
  12427. dlg.DoModal();
  12428. }
  12429. else
  12430. {
  12431. Login3 dlg;
  12432. dlg.SetLiaPath("5.lia");
  12433. dlg.DoModal();
  12434. }
  12435. if (g_user.bLongin == 0)return;
  12436. }
  12437. if (IsHasRightsnew(49) == 0)return;
  12438. PhotoBak dlg;
  12439. dlg.DoModal();
  12440. }
  12441. //客户报表
  12442. void CMainFrame::OnClose2()
  12443. { // TODO: Add your message handler code here and/or call default
  12444. if (AfxMessageBox("是否退出系统?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  12445. if(g_user.bLongin)
  12446. WriteLog("退出系统!", "退出系统!");
  12447. g_bShowBar = 0;
  12448. if (m_Mdi.MainClose())
  12449. CMDIFrameWnd::OnClose();
  12450. }
  12451. //
  12452. void CMainFrame::ResetTimer()
  12453. {
  12454. }
  12455. void CMainFrame::LinkClick(CString str, int nParent)
  12456. {
  12457. g_pMainWnd2->m_bar.LinkClick(str);
  12458. }
  12459. void CMainFrame::PrintFlowChart2(CString m_id)
  12460. {
  12461. CPrintRX m_Print;
  12462. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12463. {
  12464. m_Print.InitToPrint(NULL, 1);
  12465. }
  12466. else
  12467. {
  12468. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  12469. if (name.IsEmpty())
  12470. m_Print.InitToPrint(NULL, 1);
  12471. else
  12472. {
  12473. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12474. if (nret == -1)
  12475. {
  12476. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12477. }
  12478. }
  12479. }
  12480. m_Print.StartPrint();
  12481. m_Print.StartPage();
  12482. LoadRect load;
  12483. load.SetLiaPath("16.lia");
  12484. load.SetMargins(0, 0);
  12485. if (!load.Load())return;
  12486. LoadRect load2;
  12487. load2.SetLiaPath("17.lia");
  12488. load2.SetMargins(0, 660);
  12489. if (!load2.Load())return;
  12490. int i;
  12491. //////////////////////////////////////////////////////////////
  12492. CStringArray txarray;
  12493. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and kind<>'2'";
  12494. g_sendhead.code[0] = 11;
  12495. g_sendhead.code[1] = 52;
  12496. g_sendhead.code[2] = 223;
  12497. g_sendhead.tabcount = 3;
  12498. g_sendhead.bsql = 0;
  12499. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12500. CArray<CStringArray, CStringArray>sparray;
  12501. CArray<CStringArray, CStringArray>clientarray;
  12502. DataToArray(&g_List1array, &clientarray, &sparray);
  12503. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12504. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12505. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12506. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12507. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12508. CString m_photocount = g_List1array.ElementAt(0).ElementAt(9);
  12509. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12510. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12511. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12512. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12513. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12514. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12515. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12516. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12517. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12518. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12519. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12520. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12521. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12522. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12523. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12524. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12525. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12526. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12527. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12528. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12529. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12530. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12531. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(39) + g_List1array.ElementAt(0).ElementAt(75);
  12532. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12533. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12534. CString spno;
  12535. for (i = 0; i < sparray.GetSize(); i++)
  12536. {
  12537. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  12538. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  12539. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  12540. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12541. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12542. spno += sparray.ElementAt(i).ElementAt(5);
  12543. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12544. spno += "; ";
  12545. else
  12546. {
  12547. spno += ":";
  12548. spno += sparray.ElementAt(i).ElementAt(6);
  12549. spno += "; ";
  12550. }
  12551. }
  12552. spno += " 加挑:";
  12553. for (i = 0; i < sparray.GetSize(); i++)
  12554. {
  12555. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  12556. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  12557. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  12558. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12559. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12560. spno += sparray.ElementAt(i).ElementAt(5);
  12561. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12562. spno += "; ";
  12563. else
  12564. {
  12565. spno += ":";
  12566. spno += sparray.ElementAt(i).ElementAt(6);
  12567. spno += "; ";
  12568. }
  12569. }
  12570. if (spno.Right(6) == " 加挑:")
  12571. {
  12572. spno = spno.Left(spno.GetLength() - 6);
  12573. }
  12574. ////////////////////////////////////////////////////////////////
  12575. int rcpos = -1;
  12576. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12577. m_Print.SetFontFace(17, 1, "宋体");
  12578. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12579. StrRect.top -= 0;
  12580. StrRect.bottom -= 10;
  12581. StrRect.left -= 140;
  12582. StrRect.right = StrRect.left + 48;
  12583. m_Print.SetFontFace(15, 1, "宋体");
  12584. m_Print.SetColor(0xffffff);
  12585. m_Print.DrawRect(StrRect, 0);
  12586. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12587. StrRect.left = StrRect.right;
  12588. StrRect.right = StrRect.left + 48;
  12589. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12590. m_Print.SetColor(0, RGB(255, 0, 0));
  12591. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12592. m_Print.SetColor(0);
  12593. m_Print.SetFontFace(12, 1, "宋体");
  12594. StrRect.left -= 48;
  12595. int hei = StrRect.Height();
  12596. StrRect.top = StrRect.bottom + 2;
  12597. StrRect.bottom += hei + 2;
  12598. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12599. StrRect.top = StrRect.bottom - 2;
  12600. StrRect.bottom += hei - 5;
  12601. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12602. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12603. m_Print.SetFontFace(12, 1, "宋体");
  12604. m_Print.DrawText((LPTSTR)(LPCTSTR)"加做取件单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12605. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12606. m_Print.SetFontFace(11, 1, "宋体");
  12607. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + m_id), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12608. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12609. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12610. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12611. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12612. m_Print.DrawRect2(StrRect, 2);
  12613. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12614. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12615. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12616. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12617. m_Print.DrawRect2(StrRect, 2);
  12618. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12619. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12620. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12621. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time4, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12622. m_Print.DrawRect2(StrRect, 2);
  12623. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12624. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12625. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12626. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time5, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12627. m_Print.DrawRect2(StrRect, 2);
  12628. ////////////
  12629. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12630. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12631. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12632. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12633. m_Print.DrawRect2(StrRect, 2);
  12634. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12635. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12636. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12637. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12638. m_Print.DrawRect2(StrRect, 2);
  12639. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12640. m_Print.DrawText((LPTSTR)(LPCTSTR)"赠送张数:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12641. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12642. m_Print.DrawText((LPTSTR)(LPCTSTR)m_photocount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12643. m_Print.DrawRect2(StrRect, 2);
  12644. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12645. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12646. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12647. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12648. m_Print.DrawRect2(StrRect, 2);
  12649. ////////////
  12650. ///////////spno
  12651. CRect sprc[22];
  12652. StrRect = load.m_rcarray.ElementAt(19);
  12653. StrRect.left += 4; StrRect.right -= 3;
  12654. hei = StrRect.Height();
  12655. for (i = 0; i < 22; i++)
  12656. {
  12657. sprc[i] = StrRect;
  12658. m_Print.DrawRect2(StrRect, 1);
  12659. if (i == 0)
  12660. {
  12661. StrRect.left += 5;
  12662. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12663. StrRect.left -= 5;
  12664. }
  12665. StrRect.top = StrRect.bottom;
  12666. StrRect.bottom = StrRect.top + hei;
  12667. sprc[i].left += 4; sprc[i].right -= 3;
  12668. }
  12669. StrRect.bottom = StrRect.top + 60;
  12670. m_Print.DrawRect2(StrRect, 1);
  12671. StrRect.left += 3; StrRect.top += 3;
  12672. StrRect.right -= 3; StrRect.bottom -= 3;
  12673. AutoDraw(m_Print, StrRect, m_bz, 1.8);
  12674. CString temp, tempspno, tempbz;
  12675. CSize size;
  12676. BOOL bRun = 0;
  12677. int fontsize = 12;
  12678. ll: tempspno = spno;
  12679. m_Print.SetFontFace(fontsize, 1, "宋体");
  12680. for (i = 1; i<22; i++)
  12681. {
  12682. if (!tempspno.IsEmpty())
  12683. {
  12684. temp = tempspno;
  12685. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12686. int right = 0;
  12687. CRect temprc = sprc[i];
  12688. while (size.cx>temprc.Width())
  12689. {
  12690. right++;
  12691. temp = tempspno.Left(tempspno.GetLength() - (right));
  12692. if (GIsHalfHZ(temp))
  12693. {
  12694. right++;
  12695. temp.Delete(temp.GetLength() - 1);
  12696. }
  12697. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12698. }
  12699. if (bRun)
  12700. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12701. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  12702. if (tempspno.IsEmpty())i++;
  12703. }
  12704. }
  12705. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  12706. {
  12707. fontsize--;
  12708. goto ll;
  12709. }
  12710. if (bRun == 0)
  12711. {
  12712. bRun = 1;
  12713. goto ll;
  12714. }
  12715. m_Print.SetFontFace(12, 1, "宋体");
  12716. StrRect = load2.m_rcarray.ElementAt(1);
  12717. m_Print.DrawText((LPTSTR)(LPCTSTR)"喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12718. StrRect = load2.m_rcarray.ElementAt(2);
  12719. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12720. StrRect = load2.m_rcarray.ElementAt(3);
  12721. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12722. StrRect = load2.m_rcarray.ElementAt(4);
  12723. m_Print.DrawRect2(StrRect, 2);
  12724. StrRect = load2.m_rcarray.ElementAt(0);
  12725. CString str = "\
  12726. 爱心提示:如对制作有任何要求请清楚列出,所有制作内容一经确认将按要求制作。\r\n\
  12727. 选样文件从拍摄日期计算将保留二个月;套相成品按取件日期保留三个月,逾期不做保留。\r\n\
  12728. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12729. AutoDraw(m_Print, StrRect, str, 1.8);
  12730. PrintPreview dlg; dlg.m_mode = 2;
  12731. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12732. dlg.m_pDC = m_Print.GetPDC();
  12733. if (dlg.DoModal() != IDOK)return;
  12734. //结束打印
  12735. m_Print.EndPage();
  12736. m_Print.EndPrint();
  12737. }
  12738. //分店
  12739. CString CMainFrame::GetDanWei(CString name, CArray<CStringArray, CStringArray>*array)
  12740. {
  12741. for (int i = 0; i < array->GetSize(); i++)
  12742. {
  12743. if (name == array->ElementAt(i).ElementAt(1))
  12744. return array->ElementAt(i).ElementAt(2);
  12745. }
  12746. return "";
  12747. }
  12748. //g_sendhead
  12749. int CMainFrame::GetPort()
  12750. {
  12751. static int aaa = -1;
  12752. if (aaa == -1)
  12753. {
  12754. aaa = CTime::GetCurrentTime().GetSecond() % 7;
  12755. }
  12756. aaa++;
  12757. if (aaa >= 7)aaa = 0;
  12758. return 8387 + aaa;
  12759. }
  12760. void CMainFrame::OnShowBakState()
  12761. {
  12762. // TODO: Add your command handler code here
  12763. g_sendhead.bsql = 0;
  12764. g_sendhead.code[0] = 171;
  12765. g_sendhead.tabcount = 1;
  12766. g_pMainWnd->ProcessChatMessageRequest2(1);
  12767. if (g_bSendOK == 0)
  12768. {
  12769. return;
  12770. }
  12771. CArray<CStringArray, CStringArray>g_bakstatearray;
  12772. DataToArray(&g_bakstatearray);
  12773. while (g_bakstatearray.GetSize() > 7)
  12774. {
  12775. g_bakstatearray.RemoveAt(0);
  12776. }
  12777. int photocount = 0;
  12778. int infocount = 0;
  12779. for (int i = 0; i < g_bakstatearray.GetSize(); i++)
  12780. {
  12781. if (g_bakstatearray.ElementAt(i).ElementAt(1) != "1")photocount++;
  12782. if (g_bakstatearray.ElementAt(i).ElementAt(2) != "1")infocount++;
  12783. }
  12784. ShowBakState dlg;
  12785. dlg.m_pArray = &g_bakstatearray;
  12786. dlg.DoModal();
  12787. }
  12788. void CMainFrame::PrintReceipt2(CStringArray *pArray)
  12789. {
  12790. int i = 0;
  12791. int printcot = 1;
  12792. for (int aa = 0; aa < printcot; aa++)
  12793. {
  12794. g_sendhead.bsql = 0;
  12795. g_sendhead.code[0] = 24;
  12796. g_sendhead.tabcount = 1;
  12797. int g_nYearposTemp = g_nYearpos;
  12798. g_nYearpos = -1;
  12799. g_pMainWnd->ProcessChatMessageRequest2(1);
  12800. g_nYearpos = g_nYearposTemp;
  12801. if (0 == g_bSendOK)return;
  12802. DataToArray(&g_cominfoarray);
  12803. CString SerialNo;
  12804. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  12805. CPrintRX m_Print;
  12806. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12807. {
  12808. m_Print.InitToPrint(NULL, 1);
  12809. }
  12810. else
  12811. {
  12812. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  12813. if (name.IsEmpty())
  12814. m_Print.InitToPrint(NULL, 1);
  12815. else
  12816. {
  12817. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12818. if (nret == -1 && aa == 0)
  12819. {
  12820. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12821. }
  12822. }
  12823. }
  12824. m_Print.StartPrint();
  12825. m_Print.StartPage();
  12826. LoadRect load;
  12827. BOOL bSmall = 0;
  12828. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  12829. {
  12830. bSmall = 1;
  12831. load.SetLiaPath("20.lia");
  12832. }
  12833. else
  12834. load.SetLiaPath("10.lia");
  12835. if (bSmall)
  12836. load.SetMargins(-10, 0);
  12837. else
  12838. load.SetMargins(10, 0);
  12839. if (!load.Load())return;
  12840. int rcpos = -1;
  12841. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12842. Image *pImg = NULL;
  12843. #ifdef MNLS_VERSION
  12844. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  12845. #else
  12846. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  12847. #endif
  12848. // m_Print.DrawImage(pImg, StrRect);
  12849. delete pImg;
  12850. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  12851. {
  12852. Image *pImg = NULL;
  12853. g_nSendCode = 31;
  12854. int g_nYearposTemp = g_nYearpos;
  12855. g_nYearpos = -1;
  12856. g_pMainWnd->ProcessChatMessageRequest2(1);
  12857. g_nYearpos = g_nYearposTemp;
  12858. g_nSendCode = 0;
  12859. if (g_bSendOK == 0)return;
  12860. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  12861. if (pImg)
  12862. {
  12863. StrRect.left = 65;
  12864. if (bSmall)StrRect.left = 55;
  12865. StrRect.top = 10;
  12866. StrRect.right = StrRect.left + 58;
  12867. StrRect.bottom = StrRect.top + 58;
  12868. m_Print.DrawImage(pImg, StrRect);
  12869. delete pImg; pImg = NULL;
  12870. }
  12871. }
  12872. if (bSmall)
  12873. {
  12874. m_Print.SetFontFace(18, 1, "黑体");
  12875. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12876. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12877. m_Print.SetFontFace(9, 1, "宋体");
  12878. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12879. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12880. m_Print.SetFontFace(6, 1, "宋体");
  12881. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12882. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12883. m_Print.SetFontFace(9, 1, "宋体");
  12884. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12885. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12886. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12887. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12888. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12889. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12890. int hei = StrRect.Height();
  12891. StrRect.bottom = StrRect.top;
  12892. StrRect.top -= 8;
  12893. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  12894. m_Print.SetFontFace(10, 1, "宋体");
  12895. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12896. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12897. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12898. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12899. m_Print.SetFontFace(9, 1, "宋体");
  12900. for ( i = 7; i < 24; i++)
  12901. {
  12902. StrRect = load.m_rcarray.ElementAt(i);
  12903. m_Print.DrawRect2(StrRect, 1);
  12904. }
  12905. for (i = 9; i < 24; i++)
  12906. {
  12907. StrRect = load.m_rcarray.ElementAt(i);
  12908. StrRect.left += 2;
  12909. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12910. }
  12911. m_Print.SetFontFace(6, 1, "宋体");
  12912. for (i = 24; i < 26; i++)
  12913. {
  12914. StrRect = load.m_rcarray.ElementAt(i);
  12915. StrRect.left += 2;
  12916. if (i == 24)
  12917. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12918. else
  12919. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12920. }
  12921. }
  12922. else//大单
  12923. {
  12924. m_Print.SetFontFace(20, 1, "黑体");
  12925. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12926. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12927. m_Print.SetFontFace(11, 1, "宋体");
  12928. // StrRect=load.m_rcarray .ElementAt (++rcpos);
  12929. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12930. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15;
  12931. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12932. int hei = StrRect.Height();
  12933. StrRect.bottom = StrRect.top;
  12934. StrRect.top -= 10;
  12935. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  12936. m_Print.SetFontFace(8, 1, "宋体");
  12937. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12938. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12939. m_Print.SetFontFace(11, 1, "宋体");
  12940. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12941. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12942. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12943. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12944. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12945. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12946. m_Print.SetFontFace(13, 1, "宋体");
  12947. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12948. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12949. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12950. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12951. m_Print.SetFontFace(11, 1, "宋体");
  12952. for ( i = 7; i < 24; i++)
  12953. {
  12954. StrRect = load.m_rcarray.ElementAt(i);
  12955. m_Print.DrawRect2(StrRect, 1);
  12956. }
  12957. for (i = 9; i < 24; i++)
  12958. {
  12959. StrRect = load.m_rcarray.ElementAt(i);
  12960. StrRect.left += 2;
  12961. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12962. }
  12963. m_Print.SetFontFace(8, 1, "宋体");
  12964. for (i = 24; i < 27; i++)
  12965. {
  12966. StrRect = load.m_rcarray.ElementAt(i);
  12967. StrRect.left += 2;
  12968. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12969. }
  12970. }
  12971. PrintPreview dlg;
  12972. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12973. dlg.m_pDC = m_Print.GetPDC();
  12974. if (aa == 0)
  12975. {
  12976. if (dlg.DoModal() != IDOK)
  12977. return;
  12978. printcot = dlg.m_num;
  12979. }
  12980. //结束打印
  12981. m_Print.EndPage();
  12982. m_Print.EndPrint();
  12983. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  12984. CString sql;
  12985. sql.Format("update version set [serialno2]='%s'", SerialNo);
  12986. g_sendhead.bsql = 1;
  12987. g_nYearposTemp = g_nYearpos;
  12988. g_nYearpos = -1;
  12989. g_pMainWnd->ProcessChatMessageRequest2(sql);
  12990. g_nYearpos = g_nYearposTemp;
  12991. }
  12992. }
  12993. //出生年月
  12994. //第一联
  12995. void CMainFrame::OnLog()
  12996. {
  12997. // TODO: Add your command handler code here OnShowBakState
  12998. if (IsHasRightsnew(49) == 0)return;
  12999. ShowLOg dlg;
  13000. dlg.DoModal();
  13001. }
  13002. // www.lyfz.net 8888
  13003. void CMainFrame::PrintDinDan6(CString m_id)
  13004. {
  13005. // TODO: Add your control notification handler code here 预约订单
  13006. int printcot = 1;
  13007. for (int aa = 0; aa < printcot; aa++)
  13008. {
  13009. PrintPreview dlg;
  13010. CPrintRX m_Print;
  13011. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13012. {
  13013. m_Print.InitToPrint(NULL, 1);
  13014. }
  13015. else
  13016. {
  13017. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  13018. if (name.IsEmpty())
  13019. m_Print.InitToPrint(NULL, 1);
  13020. else
  13021. {
  13022. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13023. if (nret == -1 && aa == 0)
  13024. {
  13025. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  13026. }
  13027. }
  13028. }
  13029. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  13030. {
  13031. m_Print.StartPrint();
  13032. m_Print.StartPage();
  13033. LoadRect load;
  13034. load.SetLiaPath("6.lia");
  13035. load.SetMargins(-14, 15);
  13036. if (!load.Load())return;
  13037. LoadRect load2;
  13038. load2.SetLiaPath("7.lia");
  13039. load2.SetMargins(-14, 216 + 15);
  13040. if (!load2.Load())return;
  13041. LoadRect load3;
  13042. load3.SetLiaPath("8.lia");
  13043. load3.SetMargins(-14, 705 + 15);
  13044. if (!load3.Load())return;
  13045. int i;
  13046. //////////////////////////////////////////////////////////////
  13047. CStringArray txarray;
  13048. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  13049. g_sendhead.code[0] = 11;
  13050. g_sendhead.code[1] = 52;
  13051. g_sendhead.code[2] = 50;
  13052. g_sendhead.code[3] = 150;
  13053. g_sendhead.code[4] = 77;
  13054. g_sendhead.code[5] = 4;
  13055. g_sendhead.tabcount = 6;
  13056. g_sendhead.bsql = 0;
  13057. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  13058. CArray<CStringArray, CStringArray>sparray;
  13059. CArray<CStringArray, CStringArray>clientarray;
  13060. CArray<CStringArray, CStringArray>phonearray;
  13061. CArray<CStringArray, CStringArray>fgarray;
  13062. CArray<CStringArray, CStringArray>danweiarray;
  13063. CArray<CStringArray, CStringArray>jdarray;
  13064. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  13065. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  13066. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  13067. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  13068. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  13069. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  13070. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  13071. CString m_taoxiname;
  13072. if (m_zs.Find("\\") != -1)
  13073. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  13074. else
  13075. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  13076. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  13077. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  13078. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  13079. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  13080. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  13081. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  13082. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  13083. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  13084. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  13085. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  13086. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  13087. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  13088. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  13089. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  13090. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  13091. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  13092. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  13093. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  13094. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  13095. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  13096. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  13097. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  13098. if (jdarray.GetSize())
  13099. {
  13100. if (m_bz.IsEmpty() == 0)
  13101. m_bz = "\r\n" + m_bz;
  13102. m_bz += "景点:";
  13103. }
  13104. for (i = 0; i < jdarray.GetSize(); i++)
  13105. {
  13106. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  13107. }
  13108. m_bz.TrimRight(";");
  13109. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  13110. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13111. if (IsHasRights2new(31) == 0)
  13112. {
  13113. m_phone1 = "***";
  13114. m_phone2 = "***";
  13115. }
  13116. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  13117. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13118. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  13119. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  13120. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  13121. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  13122. filter = "name='" + m_ren + "'";
  13123. g_sendhead.code[0] = 5;
  13124. g_sendhead.tabcount = 1;
  13125. g_sendhead.bsql = 0;
  13126. int g_nYearposTemp = g_nYearpos;
  13127. g_nYearpos = -1;
  13128. g_pMainWnd->ProcessChatMessageRequest2(filter);
  13129. g_nYearpos = g_nYearposTemp;
  13130. if (g_bSendOK == 0)return;
  13131. DataToArray(&phonearray);
  13132. m_money1.Format("%f", atof(m_taoxijiage));
  13133. m_money2.Format("%f", atof(m_payed1));
  13134. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  13135. ConvertToPrice(m_money1);
  13136. ConvertToPrice(m_money2);
  13137. ConvertToPrice(m_money3);
  13138. ////////////////////////////////////////////////////////////////
  13139. int rcpos = -1;
  13140. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13141. StrRect.top -= 15; StrRect.bottom -= 15;
  13142. Image *pImg = NULL;
  13143. #ifdef MNLS_VERSION
  13144. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  13145. #else
  13146. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  13147. #endif
  13148. m_Print.DrawImage(pImg, StrRect);
  13149. delete pImg;
  13150. m_Print.SetFontFace(11, 1, "宋体");
  13151. StrRect = load.m_rcarray.ElementAt(20);
  13152. StrRect.right = load.m_rcarray.ElementAt(23).right;
  13153. StrRect.top -= 18; StrRect.bottom -= 18;
  13154. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  13155. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13156. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  13157. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13158. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13159. StrRect.top -= 15; StrRect.bottom -= 15;
  13160. #ifdef MNLS_VERSION
  13161. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13162. #endif
  13163. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13164. StrRect.top -= 15; StrRect.bottom -= 15;
  13165. #ifdef MNLS_VERSION
  13166. m_Print.DrawRect(StrRect);
  13167. #endif
  13168. m_Print.SetFontFace(7, 1, "黑体");
  13169. m_Print.SetColor(0xffffff);
  13170. #ifdef MNLS_VERSION
  13171. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13172. #endif
  13173. m_Print.SetColor(0);
  13174. m_Print.SetFontFace(15, 1, "宋体");
  13175. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13176. StrRect.top -= 15; StrRect.bottom -= 15;
  13177. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同拍摄单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13178. CStringArray strarray;
  13179. strarray.Add("NO: " + m_id);
  13180. CString date;
  13181. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  13182. strarray.Add(date);
  13183. strarray.Add("喜爱");
  13184. strarray.Add("格调");
  13185. if (fgarray.GetSize() == 12)
  13186. {
  13187. for (int i = 0; i < 12; i++)
  13188. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  13189. }
  13190. else
  13191. {
  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. strarray.Add("清纯可爱");
  13204. }
  13205. strarray.Add("姓名");
  13206. // strarray.Add("职业");
  13207. strarray.Add("");
  13208. strarray.Add("地址");
  13209. strarray.Add("电话");
  13210. #ifdef CHILD_VERSION
  13211. strarray.Add("家长");
  13212. strarray.Add("宝宝");
  13213. #else
  13214. strarray.Add("先生");
  13215. strarray.Add("女士");
  13216. #endif
  13217. m_Print.SetFontFace(11, 1, "宋体");
  13218. for (i = 0; i < strarray.GetSize(); i++)
  13219. {
  13220. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13221. if (i < 2)
  13222. {
  13223. StrRect.top -= 15; StrRect.bottom -= 15;
  13224. }
  13225. if (i>15)
  13226. m_Print.DrawRect2(StrRect, 1);
  13227. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13228. }
  13229. for (i = 29; i <= 40; i++)
  13230. {
  13231. if (m_style.GetLength() <= (i - 29))continue;
  13232. if (m_style.GetAt(i - 29) != '1')continue;
  13233. StrRect = load.m_rcarray.ElementAt(i - 1);
  13234. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13235. }
  13236. for (i = 27; i <= 48; i++)
  13237. {
  13238. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13239. m_Print.DrawRect2(StrRect, 1);
  13240. }
  13241. #ifdef CHILD_VERSION
  13242. StrRect = load.m_rcarray.ElementAt(45);
  13243. StrRect.right = StrRect.left + 62;
  13244. m_Print.DrawRect2(StrRect, 1);
  13245. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13246. StrRect.left = StrRect.right;
  13247. StrRect.right = StrRect.left + 62;
  13248. m_Print.DrawRect2(StrRect, 1);
  13249. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13250. StrRect.left = StrRect.right;
  13251. StrRect.right = StrRect.left + 62;
  13252. m_Print.DrawRect2(StrRect, 1);
  13253. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13254. StrRect.left = StrRect.right;
  13255. StrRect.right = StrRect.left + 62;
  13256. m_Print.DrawRect2(StrRect, 1);
  13257. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13258. #endif
  13259. /////////////////////////
  13260. strarray.RemoveAll();
  13261. CString temp;
  13262. temp.Format("拍摄 选 %d 款,其中", atoi(m_outside) + atoi(m_outside2));
  13263. strarray.Add(temp);
  13264. temp.Format("内景 %d 款,外景 %d 款.", atoi(m_outside2), atoi(m_outside));
  13265. strarray.Add(temp);
  13266. strarray.Add("化妆");
  13267. strarray.Add("造型");
  13268. #ifdef CHILD_VERSION
  13269. strarray.Add("");
  13270. #else
  13271. strarray.Add("婚纱");
  13272. #endif
  13273. strarray.Add("服饰");
  13274. strarray.Add("配");
  13275. strarray.Add("置");
  13276. strarray.Add("其");
  13277. strarray.Add("它");
  13278. strarray.Add("套系名称");
  13279. strarray.Add("镜款");
  13280. strarray.Add("套系总价");
  13281. strarray.Add("主摄影师");
  13282. strarray.Add("拍摄日期");
  13283. strarray.Add("定金");
  13284. #ifdef CHILD_VERSION
  13285. strarray.Add("主引导师");
  13286. #else
  13287. strarray.Add("主化妆师");
  13288. #endif
  13289. strarray.Add("看样日期");
  13290. strarray.Add("补 余 款");
  13291. strarray.Add("总监");
  13292. strarray.Add("取件日期");
  13293. rcpos = -1;
  13294. for (i = 0; i < strarray.GetSize(); i++)
  13295. {
  13296. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13297. if (i>9)
  13298. m_Print.DrawRect2(StrRect, 1);
  13299. #ifdef CHILD_VERSION
  13300. if (i == 5)
  13301. StrRect.top -= StrRect.Height();
  13302. #endif
  13303. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13304. }
  13305. for (i = 22; i <= 41; i++)
  13306. {
  13307. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13308. m_Print.DrawRect2(StrRect, 1);
  13309. }
  13310. /////////////////////////////
  13311. strarray.RemoveAll();
  13312. #ifdef CHILD_VERSION
  13313. strarray.Add("顾客方 家长:");
  13314. strarray.Add("宝宝:");
  13315. #else
  13316. strarray.Add("顾客方 先生:");
  13317. strarray.Add("女士:");
  13318. #endif
  13319. strarray.Add("电话:");
  13320. strarray.Add("影楼方 店长:");
  13321. strarray.Add("接单人:");
  13322. strarray.Add("电话:");
  13323. rcpos = -1;
  13324. for (i = 0; i < strarray.GetSize(); i++)
  13325. {
  13326. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13327. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13328. }
  13329. for (i = 7; i <= 12; i++)
  13330. {
  13331. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13332. // if(i!=10)
  13333. m_Print.DrawRect2(StrRect, 2);
  13334. }
  13335. //////////////////////////////////////
  13336. //开始打数据
  13337. strarray.RemoveAll();
  13338. strarray.Add(m_name1);
  13339. strarray.Add(m_name2);
  13340. strarray.Add("");
  13341. strarray.Add("");
  13342. strarray.Add(m_addr1);
  13343. #ifdef CHILD_VERSION
  13344. strarray.Add("");
  13345. #else
  13346. strarray.Add(m_addr2);
  13347. #endif
  13348. strarray.Add(m_phone1);
  13349. strarray.Add(m_phone2);
  13350. for (i = 41; i <= 48; i++)
  13351. {
  13352. StrRect = load.m_rcarray.ElementAt(i - 1);
  13353. StrRect.left += 4;
  13354. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13355. }
  13356. ///////////////////////////////
  13357. strarray.RemoveAll();
  13358. strarray.Add(m_money1);
  13359. strarray.Add(m_waiter1);
  13360. strarray.Add(m_time2);
  13361. strarray.Add(m_money2);
  13362. strarray.Add(m_waiter2);
  13363. strarray.Add(m_time4);
  13364. strarray.Add(m_money3);
  13365. strarray.Add("");
  13366. strarray.Add(m_time5);
  13367. for (i = 32; i <= 40; i++)
  13368. {
  13369. StrRect = load2.m_rcarray.ElementAt(i - 1);
  13370. StrRect.left += 4;
  13371. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13372. }
  13373. ///////////////////////////////
  13374. strarray.RemoveAll();
  13375. strarray.Add("");//m_name1);
  13376. strarray.Add("");//m_name2);
  13377. CString phone;
  13378. if (m_phone1.IsEmpty() == 0)
  13379. phone = m_phone1 + ",";
  13380. phone += m_phone2;
  13381. phone.TrimRight(",");
  13382. strarray.Add("");//phone);
  13383. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  13384. strarray.Add(m_ren);
  13385. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13386. for (i = 7; i <= 12; i++)
  13387. {
  13388. StrRect = load3.m_rcarray.ElementAt(i - 1);
  13389. StrRect.left += 4;
  13390. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13391. }
  13392. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  13393. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13394. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  13395. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13396. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  13397. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13398. //////////////////////////////
  13399. //开始画文字
  13400. StrRect = load2.m_rcarray.ElementAt(30);
  13401. StrRect.left += 3;
  13402. StrRect.top += 3;
  13403. StrRect.right -= 2;
  13404. StrRect.bottom -= 2;
  13405. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  13406. StrRect = load2.m_rcarray.ElementAt(29);
  13407. StrRect.left += 3;
  13408. StrRect.top += 3;
  13409. StrRect.right -= 2;
  13410. StrRect.bottom -= 2;
  13411. str = "";
  13412. for (i = 0; i < sparray.GetSize(); i++)
  13413. {
  13414. str += sparray.ElementAt(i).ElementAt(5);
  13415. str += " 数量:";
  13416. str += sparray.ElementAt(i).ElementAt(3);
  13417. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  13418. str += "\r\n";
  13419. }
  13420. str.TrimRight("\r\n");
  13421. AutoDraw(m_Print, StrRect, str, 1.4);
  13422. StrRect = load2.m_rcarray.ElementAt(40);
  13423. StrRect.top += 8;
  13424. m_Print.SetFontFace(12, 1, "黑体");
  13425. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  13426. StrRect.left += 3;
  13427. StrRect.top += 30;
  13428. StrRect.right -= 2;
  13429. StrRect.bottom -= 2;
  13430. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  13431. if (str.IsEmpty())
  13432. {
  13433. str = "\
  13434. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  13435. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  13436. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  13437. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  13438. 持良好的心境.\r\n\
  13439. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  13440. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  13441. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  13442. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  13443. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  13444. 勿进影室, 以免影响拍摄.\r\n\
  13445. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  13446. 师或店长沟通.\r\n\
  13447. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  13448. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  13449. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  13450. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  13451. 9. 本合同余额欠款须在拍照前付清.\r\n\
  13452. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  13453. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  13454. 还.";
  13455. }
  13456. AutoDraw(m_Print, StrRect, str, 1.8);
  13457. }
  13458. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13459. dlg.m_pDC = m_Print.GetPDC();
  13460. dlg.m_mode = 1;
  13461. if (aa == 0)
  13462. {
  13463. if (dlg.DoModal() != IDOK)
  13464. return;
  13465. printcot = dlg.m_num;
  13466. }
  13467. //结束打印
  13468. m_Print.EndPage();
  13469. m_Print.EndPrint();
  13470. }
  13471. }
  13472. void CMainFrame::InsideMsg()
  13473. {
  13474. ///内部消息
  13475. CString str;
  13476. g_sendhead.bsql = 0;
  13477. g_sendhead.code[0] = 126;
  13478. g_sendhead.tabcount = 1;
  13479. g_bNoConnDlg = 1;
  13480. g_pMainWnd->ProcessChatMessageRequest2(1); g_bNoConnDlg = 0;
  13481. if (g_bSendOK == 0)return;
  13482. CArray<CStringArray, CStringArray>m_List1array;
  13483. DataToArray(&g_List1array);//, &m_List1array);
  13484. int i = 0;
  13485. m_List1array.SetSize(g_List1array.GetSize());
  13486. for ( i = 0; i < g_List1array.GetSize(); i++)
  13487. {
  13488. m_List1array.ElementAt(i).Copy(g_List1array.ElementAt(i));
  13489. }
  13490. str = "," + g_user.name + ",";
  13491. for (i = g_List1array.GetSize() - 1; i >= 0; i--)
  13492. {
  13493. CString receivers2 = g_List1array.ElementAt(i).ElementAt(4);
  13494. receivers2.TrimLeft(",");
  13495. receivers2.TrimRight(",");
  13496. receivers2 = "," + receivers2 + ",";
  13497. CString receivers = g_List1array.ElementAt(i).ElementAt(3);
  13498. receivers.TrimLeft(",");
  13499. receivers.TrimRight(",");
  13500. receivers = "," + receivers + ",";
  13501. if (receivers.Find(str) == -1)
  13502. g_List1array.RemoveAt(i);
  13503. else if (receivers2.Find(str) != -1)
  13504. g_List1array.RemoveAt(i);
  13505. }
  13506. if (g_List1array.GetSize())
  13507. {
  13508. ShowMsg dlg;
  13509. dlg.DoModal();
  13510. }
  13511. for (i = m_List1array.GetSize() - 1; i >= 0; i--)
  13512. {
  13513. CString receivers2 = m_List1array.ElementAt(i).ElementAt(4);
  13514. receivers2.TrimLeft(",");
  13515. receivers2.TrimRight(",");
  13516. receivers2 = "," + receivers2 + ",";
  13517. CString receivers = m_List1array.ElementAt(i).ElementAt(3);
  13518. if (receivers != "")
  13519. m_List1array.RemoveAt(i);
  13520. else if (receivers2.Find(str) != -1)
  13521. m_List1array.RemoveAt(i);
  13522. }
  13523. if (m_List1array.GetSize())
  13524. {
  13525. SendInsideMsg2 dlg;
  13526. dlg.m_bShow = 1;
  13527. dlg.m_pArray = &m_List1array;
  13528. dlg.DoModal();
  13529. }
  13530. }
  13531. //定金
  13532. /************************************************************************/
  13533. /*
  13534. 函数:PrintHireDress
  13535. 描述:打印礼服出租单;
  13536. 参数:
  13537. strOrderNumber 礼服订单号;
  13538. 注意:
  13539. */
  13540. /************************************************************************/
  13541. void CMainFrame::PrintHireDress(CString strOrderNumber) // 打印礼服出租单;
  13542. {
  13543. int printcot = 1;
  13544. for (int aa = 0; aa < printcot; aa++)
  13545. {
  13546. CPrintRX m_Print;
  13547. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13548. {
  13549. m_Print.InitToPrint(NULL, 1);
  13550. }
  13551. else
  13552. {
  13553. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13554. if (name.IsEmpty())
  13555. m_Print.InitToPrint(NULL, 1);
  13556. else
  13557. {
  13558. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13559. if (nret == -1 && aa == 0)
  13560. {
  13561. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  13562. }
  13563. }
  13564. }
  13565. m_Print.StartPrint();
  13566. m_Print.StartPage();
  13567. LoadRect load;
  13568. load.SetLiaPath("21.lia");
  13569. load.SetMargins(0, 0);
  13570. if (!load.Load())
  13571. {
  13572. return;
  13573. }
  13574. int i;
  13575. //////////////////////////////////////////////////////////////
  13576. //CString filter="id='"+strOrderNumber+"';id='"+strOrderNumber+"';id='"+strOrderNumber+"'";
  13577. CString strFilter;
  13578. strFilter.Format("id='%s';id='%s';id='%s'", strOrderNumber, strOrderNumber, strOrderNumber);
  13579. g_sendhead.bsql = 0;
  13580. g_sendhead.code[0] = 73;
  13581. g_sendhead.code[1] = 74;
  13582. g_sendhead.code[2] = 52;
  13583. g_sendhead.tabcount = 3;
  13584. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  13585. if (g_bSendOK == 0)
  13586. {
  13587. return;
  13588. }
  13589. CArray<CStringArray, CStringArray>dresshirearray;
  13590. CArray<CStringArray, CStringArray>dresshiredataarray;
  13591. CArray<CStringArray, CStringArray>clientarray;
  13592. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13593. if (dresshirearray.GetSize() == 0)
  13594. {
  13595. return;
  13596. }
  13597. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10);
  13598. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7);
  13599. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8);
  13600. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6);
  13601. if (clientarray.GetSize() == 0)
  13602. {
  13603. return;
  13604. }
  13605. //AfxMessageBox("打印礼服出租单-()");
  13606. CString m_name2 = clientarray.ElementAt(0).ElementAt(2);
  13607. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13608. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13609. CString m_time3 = clientarray.ElementAt(0).ElementAt(20);
  13610. //#if JEFF_TEST
  13611. // if ( dresshiredataarray.GetSize() == 0 )
  13612. // {
  13613. // AfxMessageBox("没衣服");
  13614. // }
  13615. //#endif
  13616. CString sItem;
  13617. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13618. {
  13619. sItem += "编号:";
  13620. sItem += dresshiredataarray.ElementAt(i).ElementAt(1);
  13621. sItem += " ";
  13622. sItem += " 名称:";
  13623. sItem += dresshiredataarray.ElementAt(i).ElementAt(2);
  13624. sItem += " 数量:";
  13625. sItem += dresshiredataarray.ElementAt(i).ElementAt(3) + "\r\n";
  13626. }
  13627. sItem += "金额:";
  13628. sItem += dresshirearray.ElementAt(0).ElementAt(1);
  13629. sItem += " ";
  13630. sItem += " 押金:";
  13631. sItem += dresshirearray.ElementAt(0).ElementAt(2) + "\r\n";
  13632. ////////////////////////////////////////////////////////////////
  13633. int rcpos = -1;
  13634. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13635. m_Print.SetFontFace(17, 1, "宋体");
  13636. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13637. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13638. m_Print.SetFontFace(10, 1, "宋体");
  13639. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13640. CStringArray strarray;
  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. strarray.Add("客户签名");
  13651. for (i = 2; i < 12; i++)
  13652. {
  13653. StrRect = load.m_rcarray.ElementAt(i);
  13654. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13655. }
  13656. strarray.RemoveAll();
  13657. strarray.Add(m_name2);
  13658. strarray.Add(m_phone2);
  13659. strarray.Add(m_inputdate);
  13660. strarray.Add(m_time3);
  13661. strarray.Add(m_date1);
  13662. strarray.Add(m_date2);
  13663. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13664. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13665. strarray.Add(m_addr2);
  13666. strarray.Add("");
  13667. for (i = 12; i < 22; i++)
  13668. {
  13669. StrRect = load.m_rcarray.ElementAt(i);
  13670. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13671. m_Print.DrawRect2(StrRect, 2);
  13672. }
  13673. for (i = 25; i < 30; i++)
  13674. {
  13675. StrRect = load.m_rcarray.ElementAt(i);
  13676. m_Print.DrawRect2(StrRect, 1);
  13677. }
  13678. StrRect = load.m_rcarray.ElementAt(22);
  13679. StrRect.top += 7;
  13680. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13681. StrRect = load.m_rcarray.ElementAt(23);
  13682. StrRect.top += 7;
  13683. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13684. StrRect = load.m_rcarray.ElementAt(24);
  13685. StrRect.top += 7;
  13686. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13687. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13688. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13689. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13690. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13691. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13692. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13693. if (str.IsEmpty())
  13694. {
  13695. str = "\
  13696. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13697. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13698. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13699. 4. 如有破损酌情赔偿.";
  13700. }
  13701. AutoDraw(m_Print, StrRect, str, 1.5);
  13702. PrintPreview dlg;
  13703. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13704. dlg.m_pDC = m_Print.GetPDC();
  13705. if (aa == 0)
  13706. {
  13707. if (dlg.DoModal() != IDOK)
  13708. return;
  13709. printcot = dlg.m_num;
  13710. }
  13711. //结束打印
  13712. m_Print.EndPage();
  13713. m_Print.EndPrint();
  13714. }
  13715. }
  13716. void CMainFrame::PrintHireDress_01(CString strOrderNumber) // 打印礼服出租单,无法改变结构,需要修改21.lia才能改变打印的布局;
  13717. {
  13718. int printcot = 1;
  13719. for (int aa = 0; aa < printcot; aa++)
  13720. {
  13721. CPrintRX m_Print;
  13722. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13723. {
  13724. m_Print.InitToPrint(NULL, 1);
  13725. }
  13726. else
  13727. {
  13728. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13729. if (name.IsEmpty())
  13730. m_Print.InitToPrint(NULL, 1);
  13731. else
  13732. {
  13733. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13734. if (nret == -1 && aa == 0)
  13735. {
  13736. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  13737. m_Print.InitToPrint(NULL, 1);
  13738. }
  13739. }
  13740. }
  13741. m_Print.StartPrint();
  13742. m_Print.StartPage();
  13743. LoadRect load;
  13744. load.SetLiaPath("21.lia");
  13745. load.SetMargins(0, 0);
  13746. if (!load.Load())return;
  13747. int i;
  13748. //////////////////////////////////////////////////////////////
  13749. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  13750. g_sendhead.bsql = 0;
  13751. g_sendhead.code[0] = 73; // dresshire表;
  13752. g_sendhead.code[1] = 74; // dresshiredata表;
  13753. g_sendhead.code[2] = 52; // client表;
  13754. g_sendhead.tabcount = 3;
  13755. g_pMainWnd->ProcessChatMessageRequest2(filter);
  13756. if (g_bSendOK == 0)
  13757. {
  13758. return;
  13759. }
  13760. CArray<CStringArray, CStringArray>dresshirearray;
  13761. CArray<CStringArray, CStringArray>dresshiredataarray;
  13762. CArray<CStringArray, CStringArray>clientarray;
  13763. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13764. if (dresshirearray.GetSize() == 0)return;
  13765. // dresshire;
  13766. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10); // 备注;
  13767. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7); // 取衣日期;
  13768. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8); // 还衣日期;
  13769. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6); // 记录日期;
  13770. CString strPrice = dresshirearray.ElementAt(0).ElementAt(1); // 金额;
  13771. CString strDeposit = dresshirearray.ElementAt(0).ElementAt(2); // 押金;
  13772. // client表;
  13773. if (clientarray.GetSize() == 0)return;
  13774. CString m_name2 = clientarray.ElementAt(0).ElementAt(2); // 女宾姓名;
  13775. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4); // 女宾手机;
  13776. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8); // 女宾地址;
  13777. CString m_time3 = clientarray.ElementAt(0).ElementAt(20); // 婚期;
  13778. // dresshiredata表;
  13779. CString sItem;
  13780. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13781. {
  13782. sItem += dresshiredataarray.ElementAt(i).ElementAt(1); // 礼服编号;
  13783. sItem += " ";
  13784. sItem += dresshiredataarray.ElementAt(i).ElementAt(2); // 礼服名称;
  13785. sItem += " 数量:";
  13786. sItem += dresshiredataarray.ElementAt(i).ElementAt(3) + "\r\n"; // 礼服数量;
  13787. }
  13788. sItem += " 金额:";
  13789. sItem += dresshirearray.ElementAt(0).ElementAt(1); // 出租金额;
  13790. sItem += " 押金:";
  13791. sItem += dresshirearray.ElementAt(0).ElementAt(2) + "\r\n"; // 押金;
  13792. ////////////////////////////////////////////////////////////////
  13793. int rcpos = -1;
  13794. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13795. m_Print.SetFontFace(17, 1, "宋体");
  13796. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13797. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13798. m_Print.SetFontFace(10, 1, "宋体");
  13799. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13800. CStringArray strarray;
  13801. strarray.Add("客户姓名"); // 1.
  13802. strarray.Add("客户电话");
  13803. strarray.Add("预定日期");
  13804. strarray.Add("结婚日期");
  13805. strarray.Add("取件日期"); // 5.
  13806. strarray.Add("归还日期");
  13807. strarray.Add("本店地址");
  13808. strarray.Add("电 话");
  13809. strarray.Add("客户地址");
  13810. strarray.Add("客户签名"); // 10.
  13811. //strarray.Add("金额");
  13812. //strarray.Add("押金");
  13813. for( i=2; i<12; i++)
  13814. //for (i = 2; i < 14; i++)
  13815. {
  13816. StrRect = load.m_rcarray.ElementAt(i);
  13817. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13818. }
  13819. strarray.RemoveAll();
  13820. strarray.Add(m_name2);
  13821. strarray.Add(m_phone2);
  13822. strarray.Add(m_inputdate);
  13823. strarray.Add(m_time3);
  13824. strarray.Add(m_date1);
  13825. strarray.Add(m_date2);
  13826. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13827. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13828. strarray.Add(m_addr2);
  13829. strarray.Add("");
  13830. strarray.Add(strPrice); // 金额;
  13831. strarray.Add(strDeposit); // 押金;
  13832. for( i=12; i<22; i++)
  13833. //for (i = 14; i < 24; i++)
  13834. {
  13835. StrRect = load.m_rcarray.ElementAt(i);
  13836. //m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i-12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13837. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 14), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13838. m_Print.DrawRect2(StrRect, 2);
  13839. }
  13840. for (i = 25; i < 30; i++)
  13841. {
  13842. StrRect = load.m_rcarray.ElementAt(i);
  13843. m_Print.DrawRect2(StrRect, 1);
  13844. }
  13845. StrRect = load.m_rcarray.ElementAt(22);
  13846. StrRect.top += 7;
  13847. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13848. StrRect = load.m_rcarray.ElementAt(23);
  13849. StrRect.top += 7;
  13850. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13851. StrRect = load.m_rcarray.ElementAt(24);
  13852. StrRect.top += 7;
  13853. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13854. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13855. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13856. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13857. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13858. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13859. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13860. if (str.IsEmpty())
  13861. {
  13862. str = "\
  13863. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13864. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13865. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13866. 4. 如有破损酌情赔偿.";
  13867. }
  13868. AutoDraw(m_Print, StrRect, str, 1.5);
  13869. PrintPreview dlg;
  13870. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13871. dlg.m_pDC = m_Print.GetPDC();
  13872. if (aa == 0)
  13873. {
  13874. if (dlg.DoModal() != IDOK)
  13875. return;
  13876. printcot = dlg.m_num;
  13877. }
  13878. //结束打印
  13879. m_Print.EndPage();
  13880. m_Print.EndPrint();
  13881. }
  13882. }
  13883. // ****************************************************************************
  13884. // Jeff:
  13885. // 函数:PrintHireDress2
  13886. // 无参;
  13887. // 调用者:DinDanFrom.cpp
  13888. // void DinDanFrom::GetData(),订单报表调用时,判断订单数是否大于1000
  13889. // 当订单数大于1000,设置连接公司服务器开关量为真;
  13890. // -----------------------------------------------------------------------------
  13891. // 修改:Jeff
  13892. // 时间:2014.10.18
  13893. // 内容:将 g_ncot 比较值改为100;
  13894. // ****************************************************************************
  13895. void CMainFrame::PrintHireDress2()
  13896. {
  13897. if (g_ncot > 100) g_bSendLYFZ = 1;
  13898. // g_pMainWnd->SetTimer (7, 3000, NULL);
  13899. }
  13900. void CMainFrame::PrintTakeForm2(CArray<CStringArray, CStringArray>*Listarray)
  13901. {
  13902. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "选片客人明细表";
  13903. int pages = Listarray->GetSize() / 46;
  13904. if (Listarray->GetSize() % 46)pages++;
  13905. for (int aa = 0; aa < pages; aa++)
  13906. {
  13907. PrintPreview dlg;
  13908. CPrintRX m_Print;
  13909. m_Print.InitToPrint(NULL, 1);
  13910. m_Print.StartPrint();
  13911. m_Print.StartPage();
  13912. CRect mainrc(0, 0, 560, 793);
  13913. float fscale;
  13914. {
  13915. int w, h;
  13916. m_Print.GetWidHei(w, h);
  13917. fscale = (float)w / (float)h;
  13918. }
  13919. mainrc.DeflateRect(25, 40, 10, 0);
  13920. CRect rc, rc2;
  13921. rc = mainrc;
  13922. rc.bottom = rc.top;
  13923. rc.top -= 20;
  13924. m_Print.SetFontFace(16, 1, "黑体");
  13925. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13926. m_Print.SetFontFace(9, 1, "宋体");
  13927. CString str;
  13928. int wid[5] = { 200, 110, 70, 85, 62 };
  13929. int hei = 16;
  13930. if (fscale > 0.71)hei = 15;
  13931. rc = mainrc;
  13932. rc.bottom = rc.top + hei;
  13933. for (int i = 0; i < 47; i++)
  13934. {
  13935. rc2.top = rc.top + i*hei;
  13936. rc2.bottom = rc.bottom + i*hei;
  13937. rc2.left = rc.left;
  13938. rc2.right = rc.left + wid[0];
  13939. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  13940. for (int j = 0; j<5; j++)
  13941. {
  13942. m_Print.DrawRect2(rc2, 1);
  13943. if (Listarray->GetSize()>aa * 46 + i)
  13944. {
  13945. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  13946. rc2.left += 3;
  13947. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13948. rc2.left -= 3;
  13949. }
  13950. rc2.left += wid[j];
  13951. rc2.right = rc2.left + wid[j + 1];
  13952. }
  13953. }
  13954. rc2.top += 2;
  13955. rc2.left += 2; rc2.right = mainrc.right + 4;
  13956. m_Print.SetFontFace(8, 1, "宋体");
  13957. str.Format(" 页:%d/%d", aa + 1, pages);
  13958. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  13959. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13960. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13961. dlg.m_pDC = m_Print.GetPDC();
  13962. // dlg.m_mode=1;
  13963. if (aa == 0)
  13964. {
  13965. if (dlg.DoModal() != IDOK)
  13966. return;
  13967. }
  13968. //结束打印
  13969. m_Print.EndPage();
  13970. m_Print.EndPrint();
  13971. }
  13972. }
  13973. void CMainFrame::PrintTakeForm3(CArray<CStringArray, CStringArray>*Listarray)
  13974. {
  13975. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "看设计客人明细表";
  13976. int pages = Listarray->GetSize() / 46;
  13977. if (Listarray->GetSize() % 46)pages++;
  13978. for (int aa = 0; aa < pages; aa++)
  13979. {
  13980. PrintPreview dlg;
  13981. CPrintRX m_Print;
  13982. m_Print.InitToPrint(NULL, 1);
  13983. m_Print.StartPrint();
  13984. m_Print.StartPage();
  13985. CRect mainrc(0, 0, 560, 793);
  13986. float fscale;
  13987. {
  13988. int w, h;
  13989. m_Print.GetWidHei(w, h);
  13990. fscale = (float)w / (float)h;
  13991. }
  13992. mainrc.DeflateRect(25, 40, 10, 0);
  13993. CRect rc, rc2;
  13994. rc = mainrc;
  13995. rc.bottom = rc.top;
  13996. rc.top -= 20;
  13997. m_Print.SetFontFace(16, 1, "黑体");
  13998. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13999. m_Print.SetFontFace(9, 1, "宋体");
  14000. CString str;
  14001. int wid[5] = { 200, 110, 70, 85, 62 };
  14002. int hei = 16;
  14003. if (fscale > 0.71)hei = 15;
  14004. rc = mainrc;
  14005. rc.bottom = rc.top + hei;
  14006. for (int i = 0; i < 47; i++)
  14007. {
  14008. rc2.top = rc.top + i*hei;
  14009. rc2.bottom = rc.bottom + i*hei;
  14010. rc2.left = rc.left;
  14011. rc2.right = rc.left + wid[0];
  14012. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14013. for (int j = 0; j<5; j++)
  14014. {
  14015. m_Print.DrawRect2(rc2, 1);
  14016. if (Listarray->GetSize()>aa * 46 + i)
  14017. {
  14018. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14019. rc2.left += 3;
  14020. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14021. rc2.left -= 3;
  14022. }
  14023. rc2.left += wid[j];
  14024. rc2.right = rc2.left + wid[j + 1];
  14025. }
  14026. }
  14027. rc2.top += 2;
  14028. rc2.left += 2; rc2.right = mainrc.right + 4;
  14029. m_Print.SetFontFace(8, 1, "宋体");
  14030. str.Format(" 页:%d/%d", aa + 1, pages);
  14031. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14032. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14033. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14034. dlg.m_pDC = m_Print.GetPDC();
  14035. // dlg.m_mode=1;
  14036. if (aa == 0)
  14037. {
  14038. if (dlg.DoModal() != IDOK)
  14039. return;
  14040. }
  14041. //结束打印
  14042. m_Print.EndPage();
  14043. m_Print.EndPrint();
  14044. }
  14045. }
  14046. void CMainFrame::PrintTakeForm4(CArray<CStringArray, CStringArray>*Listarray)
  14047. {
  14048. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "取件客人明细表";
  14049. int pages = Listarray->GetSize() / 46;
  14050. if (Listarray->GetSize() % 46)pages++;
  14051. for (int aa = 0; aa < pages; aa++)
  14052. {
  14053. PrintPreview dlg;
  14054. CPrintRX m_Print;
  14055. m_Print.InitToPrint(NULL, 1);
  14056. m_Print.StartPrint();
  14057. m_Print.StartPage();
  14058. CRect mainrc(0, 0, 560, 793);
  14059. float fscale;
  14060. {
  14061. int w, h;
  14062. m_Print.GetWidHei(w, h);
  14063. fscale = (float)w / (float)h;
  14064. }
  14065. mainrc.DeflateRect(25, 40, 10, 0);
  14066. CRect rc, rc2;
  14067. rc = mainrc;
  14068. rc.bottom = rc.top;
  14069. rc.top -= 20;
  14070. m_Print.SetFontFace(16, 1, "黑体");
  14071. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14072. m_Print.SetFontFace(9, 1, "宋体");
  14073. CString str;
  14074. int wid[5] = { 200, 110, 70, 85, 62 };
  14075. int hei = 16;
  14076. if (fscale > 0.71)hei = 15;
  14077. rc = mainrc;
  14078. rc.bottom = rc.top + hei;
  14079. for (int i = 0; i < 47; i++)
  14080. {
  14081. rc2.top = rc.top + i*hei;
  14082. rc2.bottom = rc.bottom + i*hei;
  14083. rc2.left = rc.left;
  14084. rc2.right = rc.left + wid[0];
  14085. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14086. for (int j = 0; j<5; j++)
  14087. {
  14088. m_Print.DrawRect2(rc2, 1);
  14089. if (Listarray->GetSize()>aa * 46 + i)
  14090. {
  14091. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14092. rc2.left += 3;
  14093. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14094. rc2.left -= 3;
  14095. }
  14096. rc2.left += wid[j];
  14097. rc2.right = rc2.left + wid[j + 1];
  14098. }
  14099. }
  14100. rc2.top += 2;
  14101. rc2.left += 2; rc2.right = mainrc.right + 4;
  14102. m_Print.SetFontFace(8, 1, "宋体");
  14103. str.Format(" 页:%d/%d", aa + 1, pages);
  14104. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14105. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14106. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14107. dlg.m_pDC = m_Print.GetPDC();
  14108. // dlg.m_mode=1;
  14109. if (aa == 0)
  14110. {
  14111. if (dlg.DoModal() != IDOK)
  14112. return;
  14113. }
  14114. //结束打印
  14115. m_Print.EndPage();
  14116. m_Print.EndPrint();
  14117. }
  14118. }
  14119. void CMainFrame::PrintTakeForm5(CArray<CStringArray, CStringArray>*Listarray)
  14120. {
  14121. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "婚庆客人明细表";
  14122. int pages = Listarray->GetSize() / 46;
  14123. if (Listarray->GetSize() % 46)pages++;
  14124. for (int aa = 0; aa < pages; aa++)
  14125. {
  14126. PrintPreview dlg;
  14127. CPrintRX m_Print;
  14128. m_Print.InitToPrint(NULL, 1);
  14129. m_Print.StartPrint();
  14130. m_Print.StartPage();
  14131. CRect mainrc(0, 0, 560, 793);
  14132. float fscale;
  14133. {
  14134. int w, h;
  14135. m_Print.GetWidHei(w, h);
  14136. fscale = (float)w / (float)h;
  14137. }
  14138. mainrc.DeflateRect(25, 40, 10, 0);
  14139. CRect rc, rc2;
  14140. rc = mainrc;
  14141. rc.bottom = rc.top;
  14142. rc.top -= 20;
  14143. m_Print.SetFontFace(16, 1, "黑体");
  14144. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14145. m_Print.SetFontFace(8, 1, "宋体");
  14146. CString str;
  14147. int wid[7] = { 165, 90, 90, 45, 45, 60, 35 };
  14148. int hei = 16;
  14149. if (fscale > 0.71)hei = 15;
  14150. rc = mainrc;
  14151. rc.bottom = rc.top + hei;
  14152. for (int i = 0; i < 47; i++)
  14153. {
  14154. rc2.top = rc.top + i*hei;
  14155. rc2.bottom = rc.bottom + i*hei;
  14156. rc2.left = rc.left;
  14157. rc2.right = rc.left + wid[0];
  14158. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14159. for (int j = 0; j<7; j++)
  14160. {
  14161. m_Print.DrawRect2(rc2, 1);
  14162. if (Listarray->GetSize()>aa * 46 + i)
  14163. {
  14164. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14165. rc2.left += 3;
  14166. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14167. rc2.left -= 3;
  14168. }
  14169. rc2.left += wid[j];
  14170. rc2.right = rc2.left + wid[j + 1];
  14171. }
  14172. }
  14173. rc2.top += 2;
  14174. rc2.left += 2; rc2.right = mainrc.right + 4;
  14175. m_Print.SetFontFace(8, 1, "宋体");
  14176. str.Format(" 页:%d/%d", aa + 1, pages);
  14177. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14178. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14179. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14180. dlg.m_pDC = m_Print.GetPDC();
  14181. // dlg.m_mode=1;
  14182. if (aa == 0)
  14183. {
  14184. if (dlg.DoModal() != IDOK)
  14185. return;
  14186. }
  14187. //结束打印
  14188. m_Print.EndPage();
  14189. m_Print.EndPrint();
  14190. }
  14191. }
  14192. void CMainFrame::PrintTakeForm1(CArray<CStringArray, CStringArray>*Listarray)
  14193. {
  14194. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "拍照客人明细表";
  14195. int pages = Listarray->GetSize() / 46;
  14196. if (Listarray->GetSize() % 46)pages++;
  14197. for (int aa = 0; aa < pages; aa++)
  14198. {
  14199. PrintPreview dlg;
  14200. CPrintRX m_Print;
  14201. m_Print.InitToPrint(NULL, 1);
  14202. m_Print.StartPrint();
  14203. m_Print.StartPage();
  14204. CRect mainrc(0, 0, 560, 793);
  14205. float fscale;
  14206. {
  14207. int w, h;
  14208. m_Print.GetWidHei(w, h);
  14209. fscale = (float)w / (float)h;
  14210. }
  14211. mainrc.DeflateRect(25, 40, 10, 0);
  14212. CRect rc, rc2;
  14213. rc = mainrc;
  14214. rc.bottom = rc.top;
  14215. rc.top -= 20;
  14216. m_Print.SetFontFace(16, 1, "黑体");
  14217. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14218. m_Print.SetFontFace(8, 1, "宋体");
  14219. CString str;
  14220. int wid[7] = { 165, 60, 90, 60, 60, 60, 35 };
  14221. int hei = 16;
  14222. if (fscale > 0.71)hei = 15;
  14223. rc = mainrc;
  14224. rc.bottom = rc.top + hei;
  14225. for (int i = 0; i < 47; i++)
  14226. {
  14227. rc2.top = rc.top + i*hei;
  14228. rc2.bottom = rc.bottom + i*hei;
  14229. rc2.left = rc.left;
  14230. rc2.right = rc.left + wid[0];
  14231. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14232. for (int j = 0; j<7; j++)
  14233. {
  14234. m_Print.DrawRect2(rc2, 1);
  14235. if (Listarray->GetSize()>aa * 46 + i)
  14236. {
  14237. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14238. rc2.left += 3;
  14239. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14240. rc2.left -= 3;
  14241. }
  14242. rc2.left += wid[j];
  14243. rc2.right = rc2.left + wid[j + 1];
  14244. }
  14245. }
  14246. rc2.top += 2;
  14247. rc2.left += 2; rc2.right = mainrc.right + 4;
  14248. m_Print.SetFontFace(8, 1, "宋体");
  14249. str.Format(" 页:%d/%d", aa + 1, pages);
  14250. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14251. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14252. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14253. dlg.m_pDC = m_Print.GetPDC();
  14254. // dlg.m_mode=1;
  14255. if (aa == 0)
  14256. {
  14257. if (dlg.DoModal() != IDOK)
  14258. return;
  14259. }
  14260. //结束打印
  14261. m_Print.EndPage();
  14262. m_Print.EndPrint();
  14263. }
  14264. }
  14265. void CMainFrame::ShowMonthForm2()
  14266. {
  14267. }
  14268. // dlg;