MainFrm.cpp 455 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509
  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 WriteClientLog(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 (g_user.bLongin && g_pMainWnd2)
  1884. {
  1885. g_pMainWnd2->ShowBar(TRUE,TRUE);
  1886. InsideMsg();
  1887. }
  1888. #else
  1889. ShowWindow(SW_SHOW);
  1890. if (g_bNoLoginLia)
  1891. {
  1892. Login dlg;
  1893. dlg.SetLiaPath ("5.lia");
  1894. dlg.DoModal();
  1895. }
  1896. else
  1897. {
  1898. Login3 dlg;
  1899. dlg.SetLiaPath ("5.lia");
  1900. dlg.DoModal();
  1901. }
  1902. #endif
  1903. }
  1904. if (g_hmouse == NULL)
  1905. {
  1906. g_hmouse = SetWindowsHookEx(WH_MOUSE, MouseProc, 0, ::GetCurrentThreadId());
  1907. }
  1908. }
  1909. else if (2 == nIDEvent) //29秒后,若连接和发送未完成,将关闭连接和发送框;
  1910. {
  1911. KillTimer(2);
  1912. if (g_hConnectWnd)
  1913. ::PostMessage(g_hConnectWnd, WM_CLOSE, 0, 0);
  1914. if (g_hSendWnd)
  1915. ::PostMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1916. if (g_bStaffAchievementShow == 0 && g_bConnLYFZ == 0)
  1917. {
  1918. if (g_bGenBranchData == 0)
  1919. {
  1920. if (g_branchip != "")
  1921. AfxMessageBox("连接分店:" + g_branchname + "失败!", MB_ICONINFORMATION);
  1922. else
  1923. AfxMessageBox("连接服务器失败!", MB_ICONINFORMATION);
  1924. }
  1925. OnDisconnect();
  1926. }
  1927. g_bSendOK = 0;
  1928. g_bNeedCoon = 1;
  1929. }
  1930. else if (3 == nIDEvent)
  1931. {
  1932. KillTimer(3);
  1933. #ifdef NEW_SKIN
  1934. Welcome weldlg;
  1935. weldlg.DoModal();
  1936. #endif
  1937. ShowWindow(SW_SHOW);
  1938. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1939. g_sendhead.bsql = 0;
  1940. g_sendhead.code[0] = 24;
  1941. g_sendhead.code[1] = 1;
  1942. g_sendhead.tabcount = 2;
  1943. g_pMainWnd->ProcessChatMessageRequest2(1);
  1944. if (g_bSendOK == 0)
  1945. {
  1946. return;
  1947. }
  1948. CArray<CStringArray, CStringArray>patharray;
  1949. CArray<CStringArray, CStringArray>userarray;
  1950. DataToArray(&g_cominfoarray, &g_hisyeararray);
  1951. g_userarray.SetSize(userarray.GetSize(), 1);
  1952. int count = 0;
  1953. for (int ii = 0; ii < userarray.GetSize(); ii++)
  1954. {
  1955. if (userarray.ElementAt(ii).ElementAt(10) == "在职")
  1956. g_userarray.ElementAt(count++).Copy(userarray.ElementAt(ii));
  1957. }
  1958. g_userarray.SetSize(count, 1);
  1959. StaffAchievementShowAll dlg;
  1960. g_pMainWnd->GetOcx();
  1961. dlg.DoModal();
  1962. }
  1963. else if (5 == nIDEvent)
  1964. {
  1965. if (g_bInSkin)
  1966. {
  1967. OutputDebugString("使用皮肤\n");
  1968. return;
  1969. }
  1970. if (g_nAutoShowStaffAchievement == 1){
  1971. OutputDebugString("用于选片\n");
  1972. return;
  1973. }
  1974. if (g_bAllBranch){
  1975. OutputDebugString("多店汇总当中\n");
  1976. return;
  1977. }
  1978. if (g_user.bLongin)
  1979. {
  1980. // m_Mdi.CloseAll();
  1981. g_pMainWnd->OnCommandMenu(IDM_Logout);
  1982. }
  1983. /* g_nAutoShowStaffAchievement=1;
  1984. KillTimer(5);
  1985. StaffAchievementShowAll dlg;
  1986. g_pMainWnd->GetOcx();
  1987. dlg.DoModal ();*/
  1988. }
  1989. else if (6 == nIDEvent)
  1990. {
  1991. static BOOL bDouble = 0;
  1992. bDouble = !bDouble;
  1993. if (bDouble)
  1994. g_pMainWnd->OnCommandMenu(IDM_TAKEAWAYBOOK);
  1995. else
  1996. g_pMainWnd->OnCommandMenu(IDM_CLIENTMONEY);
  1997. }
  1998. else if (7 == nIDEvent)
  1999. {
  2000. // Jeff,当g_bSendLYFZ==TRUE时;
  2001. // 向lijiafz.vicp.net发送影楼信息,防止有盗版用户;
  2002. KillTimer(7);
  2003. if (g_bInSkin)return;
  2004. if (g_nAutoShowStaffAchievement == 1)return;
  2005. if (g_bAllBranch)return;
  2006. CString str = g_sInfo;
  2007. g_bConnLYFZ = 1; // Jeff指示连接的服务器为lijiafz.vicp.net
  2008. // 断开当前连接;
  2009. OnDisconnect();
  2010. BYTE *pData = new BYTE[str.GetLength()];
  2011. memcpy(pData, str.GetBuffer(0), str.GetLength());
  2012. str.ReleaseBuffer();
  2013. EncryptFile2(pData, str.GetLength(), "888666333");
  2014. g_nSendCode = 16;
  2015. g_pMainWnd->ProcessChatMessageRequest2(pData, str.GetLength());
  2016. g_nSendCode = 0;
  2017. delete[]pData;
  2018. OnDisconnect();
  2019. g_bSendLYFZ = 0;
  2020. g_bConnLYFZ = 0;
  2021. if (g_bSendOK)
  2022. {
  2023. char *pStr = new char[g_nLeng + 1];
  2024. memset(pStr, 0, g_nLeng + 1);
  2025. memcpy(pStr, g_pData, g_nLeng);
  2026. CString str = pStr;
  2027. delete[]pStr;
  2028. if (str == "g_bInSkin")
  2029. {
  2030. g_sendhead.bsql = 1;
  2031. g_pMainWnd->ProcessChatMessageRequest2("update version set [setcheck1]='ok'");
  2032. }
  2033. }
  2034. }
  2035. }
  2036. void CMainFrame::OnOutbarNotify(CString strMsg)
  2037. {
  2038. if (g_user.bLongin == 0)
  2039. {
  2040. if (g_bNoLoginLia)
  2041. {
  2042. Login dlg;
  2043. dlg.SetLiaPath("5.lia");
  2044. dlg.DoModal();
  2045. }
  2046. else
  2047. {
  2048. Login3 dlg;
  2049. dlg.SetLiaPath("5.lia");
  2050. dlg.DoModal();
  2051. }
  2052. return;
  2053. if (g_user.bLongin == 0)return;
  2054. }
  2055. else
  2056. {
  2057. InsideMsg();
  2058. }
  2059. ResetTimer();
  2060. if (strMsg == "开单")
  2061. {
  2062. if (IsHasRights(0) == 0)return;
  2063. Booking2 dlg;
  2064. dlg.DoModal();
  2065. return;
  2066. }
  2067. else if (strMsg == "拍照")
  2068. {
  2069. if (IsHasRights(1) == 0)return;
  2070. UINT nID = 1;
  2071. LPSTR pName;
  2072. pName = (LPSTR)(LPCSTR)"拍照";
  2073. OPEN_MENU(TakeFrom);
  2074. return;
  2075. }
  2076. else if (strMsg == "修片")
  2077. {
  2078. if (IsHasRights(1) == 0)return;
  2079. UINT nID = 1;
  2080. LPSTR pName;
  2081. pName = (LPSTR)(LPCSTR)"修片";
  2082. OPEN_MENU(BeautifySkinFrom);
  2083. return;
  2084. }
  2085. else if (strMsg == "选片")
  2086. {
  2087. if (IsHasRights(2) == 0)return;
  2088. UINT nID = 1;
  2089. LPSTR pName;
  2090. pName = (LPSTR)(LPCSTR)"选片";
  2091. OPEN_MENU(ChoosePhotoForm);
  2092. return;
  2093. }
  2094. else if (strMsg == "精修")
  2095. {
  2096. if (IsHasRights(2) == 0)return;
  2097. UINT nID = 1;
  2098. LPSTR pName;
  2099. pName = (LPSTR)(LPCSTR)"精修";
  2100. OPEN_MENU(BeautifySkinFrom2);
  2101. return;
  2102. }
  2103. else if (strMsg == "设计")
  2104. {
  2105. if (IsHasRights(2) == 0)return;
  2106. UINT nID = 1;
  2107. LPSTR pName;
  2108. pName = (LPSTR)(LPCSTR)"设计";
  2109. OPEN_MENU(DesignFrom);
  2110. return;
  2111. }
  2112. else if (strMsg == "数码安排")
  2113. {
  2114. UINT nID = 1;
  2115. LPSTR pName;
  2116. pName = (LPSTR)(LPCSTR)"数码安排";
  2117. OPEN_MENU(DigitalWork);
  2118. return;
  2119. }
  2120. else if (strMsg == "刻盘")
  2121. {
  2122. UINT nID = 1;
  2123. LPSTR pName;
  2124. pName = (LPSTR)(LPCSTR)"刻盘";
  2125. OPEN_MENU(BurnCD);
  2126. return;
  2127. }
  2128. else if (strMsg == "相片冲印")
  2129. {
  2130. UINT nID = 1;
  2131. LPSTR pName;
  2132. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  2133. OPEN_MENU(PhotoPrintFrom);
  2134. return;
  2135. }
  2136. else if (strMsg == "发片/取件")
  2137. {
  2138. if (IsHasRights(3) == 0)return;
  2139. UINT nID = 1;
  2140. LPSTR pName;
  2141. pName = (LPSTR)(LPCSTR)"发片/取件";
  2142. OPEN_MENU(outsourcing);
  2143. return;
  2144. }
  2145. else if (strMsg == "满意度")
  2146. {
  2147. UINT nID = 1;
  2148. LPSTR pName;
  2149. pName = (LPSTR)(LPCSTR)"满意度";
  2150. OPEN_MENU(Satisfaction);
  2151. return;
  2152. }
  2153. else if (strMsg == "满意度汇总")
  2154. {
  2155. UINT nID = 1;
  2156. LPSTR pName;
  2157. pName = (LPSTR)(LPCSTR)"满意度汇总";
  2158. OPEN_MENU(SatisfactionReportForm);
  2159. return;
  2160. }
  2161. #if JEFF_DELETE_ON // 2014.11.14-PM 16:20
  2162. else if (strMsg == "回复统计")
  2163. {
  2164. UINT nID = 1;
  2165. LPSTR pName;
  2166. pName = (LPSTR)(LPCSTR)"回复统计";
  2167. OPEN_MENU(MsgReg2);
  2168. return;
  2169. }
  2170. #endif
  2171. /* else if(strMsg=="取件")
  2172. {
  2173. if(IsHasRights(3)==0)return;
  2174. UINT nID=1;
  2175. LPSTR pName ;
  2176. pName = (LPSTR)(LPCSTR)"取件";
  2177. OPEN_MENU(TakeAwayFrom);
  2178. return;
  2179. }*/
  2180. else if (strMsg == "其它收入")
  2181. {
  2182. if (IsHasRightsnew(16) == 0)return;
  2183. // if(IsHasRightsnew(48)==0)return;
  2184. UINT nID = 1;
  2185. LPSTR pName;
  2186. pName = (LPSTR)(LPCSTR)"其它收入";
  2187. OPEN_MENU(IncomeInput);
  2188. return;
  2189. }
  2190. else if (strMsg == "其它二销")
  2191. {
  2192. if (IsHasRightsnew(16) == 0)return;
  2193. UINT nID = 1;
  2194. LPSTR pName;
  2195. pName = (LPSTR)(LPCSTR)"其它二销";
  2196. OPEN_MENU(IncomeInput2);
  2197. return;
  2198. }
  2199. else if (strMsg == "员工奖罚")
  2200. {
  2201. if (IsHasRightsnew(16) == 0)return;
  2202. UINT nID = 1;
  2203. LPSTR pName;
  2204. pName = (LPSTR)(LPCSTR)"员工奖罚";
  2205. OPEN_MENU(IncomeInput3);
  2206. return;
  2207. }
  2208. else if (strMsg == "员工奖惩")
  2209. {
  2210. if (IsHasRightsnew(16) == 0)return;
  2211. UINT nID = 1;
  2212. LPSTR pName;
  2213. pName = (LPSTR)(LPCSTR)"员工奖惩";
  2214. OPEN_MENU(IncomeInput4);
  2215. return;
  2216. }
  2217. else if (strMsg == "订单收款")
  2218. {
  2219. if (IsHasRights(17) == 0)return;
  2220. UINT nID = 1;
  2221. LPSTR pName;
  2222. pName = (LPSTR)(LPCSTR)"订单收款";
  2223. OPEN_MENU(FinanceForm);
  2224. return;
  2225. }
  2226. else if (strMsg == "日财务表")
  2227. {
  2228. if (IsHasRightsnew(22) == 0)return;
  2229. UINT nID = 2;
  2230. LPSTR pName;
  2231. pName = (LPSTR)(LPCSTR)"日财务表";
  2232. OPEN_MENU(DailyForm);
  2233. return;
  2234. }
  2235. else if (strMsg == "提成比例")
  2236. {
  2237. #ifndef ENTERPRISE_VERSION
  2238. #ifndef CHILD_VERSION
  2239. #ifdef BASIC_VERSION
  2240. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2241. {
  2242. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2243. exit(0);return;
  2244. }
  2245. #else
  2246. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2247. {
  2248. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2249. exit(0);return;
  2250. }
  2251. #endif
  2252. #else
  2253. #ifdef BASIC_VERSION
  2254. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2255. {
  2256. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2257. exit(0);return;
  2258. }
  2259. #else
  2260. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2261. {
  2262. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2263. exit(0); return;
  2264. }
  2265. #endif
  2266. #endif
  2267. #else
  2268. #ifndef CHILD_VERSION
  2269. #ifdef BASIC_VERSION
  2270. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2271. {
  2272. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2273. exit(0); return;
  2274. }
  2275. #else
  2276. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2277. {
  2278. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2279. exit(0); return;
  2280. }
  2281. #endif
  2282. #else
  2283. #ifdef BASIC_VERSION
  2284. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2285. {
  2286. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2287. exit(0);return;
  2288. }
  2289. #else
  2290. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2291. {
  2292. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2293. exit(0); return;
  2294. }
  2295. #endif
  2296. #endif
  2297. #endif
  2298. UINT nID = 2;
  2299. LPSTR pName;
  2300. pName = (LPSTR)(LPCSTR)"提成比例";
  2301. OPEN_MENU(SalarySet2);
  2302. return;
  2303. }
  2304. //else if(strMsg=="员工工作")
  2305. else if (strMsg == "计件提成")
  2306. {
  2307. UINT nID = 2;
  2308. LPSTR pName;
  2309. //pName = (LPSTR)(LPCSTR)"员工工作";
  2310. pName = (LPSTR)(LPCSTR)"计件提成";
  2311. OPEN_MENU(SalarySet3);
  2312. return;
  2313. }
  2314. else if (strMsg == "工资管理")
  2315. {
  2316. #ifndef ENTERPRISE_VERSION
  2317. #ifndef CHILD_VERSION
  2318. #ifdef BASIC_VERSION
  2319. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2320. {
  2321. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2322. exit(0);return;
  2323. }
  2324. #else
  2325. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2326. {
  2327. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2328. exit(0);return;
  2329. }
  2330. #endif
  2331. #else
  2332. #ifdef BASIC_VERSION
  2333. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2334. {
  2335. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2336. exit(0);return;
  2337. }
  2338. #else
  2339. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2340. {
  2341. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2342. exit(0); return;
  2343. }
  2344. #endif
  2345. #endif
  2346. #else
  2347. #ifndef CHILD_VERSION
  2348. #ifdef BASIC_VERSION
  2349. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2350. {
  2351. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2352. exit(0); return;
  2353. }
  2354. #else
  2355. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2356. {
  2357. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2358. exit(0); return;
  2359. }
  2360. #endif
  2361. #else
  2362. #ifdef BASIC_VERSION
  2363. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2364. {
  2365. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2366. exit(0);return;
  2367. }
  2368. #else
  2369. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2370. {
  2371. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2372. exit(0); return;
  2373. }
  2374. #endif
  2375. #endif
  2376. #endif
  2377. UINT nID = 2;
  2378. LPSTR pName;
  2379. pName = (LPSTR)(LPCSTR)"工资管理";
  2380. OPEN_MENU(MySalary);
  2381. return;
  2382. }
  2383. else if (strMsg == "客人付款")
  2384. {
  2385. UINT nID = 2;
  2386. LPSTR pName;
  2387. pName = (LPSTR)(LPCSTR)"客人付款";
  2388. OPEN_MENU(ClientMoney);
  2389. return;
  2390. }
  2391. else if (strMsg == "工资报表")
  2392. {
  2393. #ifndef ENTERPRISE_VERSION
  2394. #ifndef CHILD_VERSION
  2395. #ifdef BASIC_VERSION
  2396. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2397. {
  2398. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2399. exit(0);return;
  2400. }
  2401. #else
  2402. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2403. {
  2404. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2405. exit(0);return;
  2406. }
  2407. #endif
  2408. #else
  2409. #ifdef BASIC_VERSION
  2410. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2411. {
  2412. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2413. exit(0);return;
  2414. }
  2415. #else
  2416. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2417. {
  2418. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2419. exit(0); return;
  2420. }
  2421. #endif
  2422. #endif
  2423. #else
  2424. #ifndef CHILD_VERSION
  2425. #ifdef BASIC_VERSION
  2426. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2427. {
  2428. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2429. exit(0); return;
  2430. }
  2431. #else
  2432. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2433. {
  2434. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2435. exit(0); return;
  2436. }
  2437. #endif
  2438. #else
  2439. #ifdef BASIC_VERSION
  2440. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2441. {
  2442. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2443. exit(0);return;
  2444. }
  2445. #else
  2446. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2447. {
  2448. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2449. exit(0); return;
  2450. }
  2451. #endif
  2452. #endif
  2453. #endif
  2454. if (IsHasRightsnew(25) == 0)return;
  2455. UINT nID = 2;
  2456. LPSTR pName;
  2457. pName = (LPSTR)(LPCSTR)"工资报表";
  2458. g_ncount = 100;
  2459. OPEN_MENU(MySalary);
  2460. return;
  2461. }
  2462. else if (strMsg == "员工业绩")
  2463. {
  2464. #ifndef ENTERPRISE_VERSION
  2465. #ifndef CHILD_VERSION
  2466. #ifdef BASIC_VERSION
  2467. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2468. {
  2469. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2470. exit(0);return;
  2471. }
  2472. #else
  2473. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2474. {
  2475. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2476. exit(0);return;
  2477. }
  2478. #endif
  2479. #else
  2480. #ifdef BASIC_VERSION
  2481. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2482. {
  2483. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2484. exit(0);return;
  2485. }
  2486. #else
  2487. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2488. {
  2489. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2490. exit(0); return;
  2491. }
  2492. #endif
  2493. #endif
  2494. #else
  2495. #ifndef CHILD_VERSION
  2496. #ifdef BASIC_VERSION
  2497. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2498. {
  2499. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2500. exit(0); return;
  2501. }
  2502. #else
  2503. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2504. {
  2505. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2506. exit(0); return;
  2507. }
  2508. #endif
  2509. #else
  2510. #ifdef BASIC_VERSION
  2511. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2512. {
  2513. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2514. exit(0);return;
  2515. }
  2516. #else
  2517. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2518. {
  2519. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2520. exit(0); return;
  2521. }
  2522. #endif
  2523. #endif
  2524. #endif
  2525. if (IsHasRightsnew(33) == 0)return;
  2526. UINT nID = 2;
  2527. LPSTR pName;
  2528. pName = (LPSTR)(LPCSTR)"员工业绩";
  2529. OPEN_MENU(StaffAchievement);
  2530. return;
  2531. }
  2532. else if (strMsg == "订单客户")
  2533. {
  2534. UINT nID = 2;
  2535. LPSTR pName;
  2536. pName = (LPSTR)(LPCSTR)"订单客户";
  2537. g_dx += 10000;
  2538. OPEN_MENU(CClientForm);
  2539. if (g_dx >= 10000)g_dx -= 10000;
  2540. return;
  2541. }
  2542. else if (strMsg == "意向客户")
  2543. {
  2544. UINT nID = 2;
  2545. LPSTR pName;
  2546. pName = (LPSTR)(LPCSTR)"意向客户";
  2547. OPEN_MENU(Client2Form);
  2548. return;
  2549. }
  2550. else if (strMsg == "老客户")
  2551. {
  2552. UINT nID = 2;
  2553. LPSTR pName;
  2554. pName = (LPSTR)(LPCSTR)"老客户";
  2555. OPEN_MENU(OldClient);
  2556. return;
  2557. }
  2558. else if (strMsg == "客户来电")
  2559. {
  2560. UINT nID = 2;
  2561. LPSTR pName;
  2562. pName = (LPSTR)(LPCSTR)"客户来电";
  2563. OPEN_MENU(PhoneRecord);
  2564. return;
  2565. }
  2566. else if (strMsg == "拨出电话")
  2567. {
  2568. UINT nID = 2;
  2569. LPSTR pName;
  2570. pName = (LPSTR)(LPCSTR)"拨出电话";
  2571. OPEN_MENU(PhoneRecordOut);
  2572. return;
  2573. }
  2574. else if (strMsg == "未接来电")
  2575. {
  2576. UINT nID = 2;
  2577. LPSTR pName;
  2578. pName = (LPSTR)(LPCSTR)"未接来电";
  2579. OPEN_MENU(MissCall);
  2580. return;
  2581. }
  2582. else if (strMsg == "客户流失")
  2583. {
  2584. UINT nID = 2;
  2585. LPSTR pName;
  2586. pName = (LPSTR)(LPCSTR)"客户流失";
  2587. OPEN_MENU(ClientReasonChart);
  2588. return;
  2589. }
  2590. else if (strMsg == "客户来源")
  2591. {
  2592. UINT nID = 2;
  2593. LPSTR pName;
  2594. pName = (LPSTR)(LPCSTR)"客户来源";
  2595. OPEN_MENU(ClientFromChart);
  2596. return;
  2597. }
  2598. else if (strMsg == "月财务表")
  2599. {
  2600. if (IsHasRightsnew(23) == 0)return;
  2601. UINT nID = 2;
  2602. LPSTR pName;
  2603. pName = (LPSTR)(LPCSTR)"月财务表";
  2604. OPEN_MENU(MonthForm);
  2605. return;
  2606. }
  2607. else if (strMsg == "支出报表")
  2608. {
  2609. if (IsHasRightsnew(23) == 0)return;
  2610. UINT nID = 2;
  2611. LPSTR pName;
  2612. pName = (LPSTR)(LPCSTR)"支出报表";
  2613. OPEN_MENU(MonthForm2);
  2614. return;
  2615. }
  2616. else if (strMsg == "年财务表")
  2617. {
  2618. if (IsHasRightsnew(24) == 0)return;
  2619. UINT nID = 2;
  2620. LPSTR pName;
  2621. pName = (LPSTR)(LPCSTR)"年财务表";
  2622. OPEN_MENU(YearForm);
  2623. return;
  2624. }
  2625. else if (strMsg == "年财务图表")
  2626. {
  2627. if (IsHasRightsnew(24) == 0)return;
  2628. GetOcx();
  2629. UINT nID = 2;
  2630. LPSTR pName;
  2631. pName = (LPSTR)(LPCSTR)"年财务图表";
  2632. OPEN_MENU(YearForm2);
  2633. return;
  2634. }
  2635. else if (strMsg == "订单图表")
  2636. {
  2637. GetOcx();
  2638. UINT nID = 2;
  2639. LPSTR pName;
  2640. pName = (LPSTR)(LPCSTR)"订单图表";
  2641. OPEN_MENU(DinDanForm);
  2642. return;
  2643. }
  2644. #ifdef ENTERPRISE_VERSION
  2645. else if (strMsg == "订单报表")
  2646. {
  2647. GetOcx();
  2648. UINT nID = 2;
  2649. LPSTR pName;
  2650. pName = (LPSTR)(LPCSTR)"订单报表2";
  2651. OPEN_MENU(DinDanFromBranch);
  2652. return;
  2653. }
  2654. else if (strMsg == "财务图表")
  2655. {
  2656. GetOcx();
  2657. UINT nID = 2;
  2658. LPSTR pName;
  2659. pName = (LPSTR)(LPCSTR)"财务图表";
  2660. OPEN_MENU(YearFormBranch);
  2661. return;
  2662. }
  2663. else if (strMsg == "订单图表")
  2664. {
  2665. GetOcx();
  2666. UINT nID = 2;
  2667. LPSTR pName;
  2668. pName = (LPSTR)(LPCSTR)"订单图表";
  2669. OPEN_MENU(YearFormBranch2);
  2670. return;
  2671. }
  2672. else if (strMsg == "摄控安排")
  2673. {
  2674. UINT nID = 2;
  2675. LPSTR pName;
  2676. pName = (LPSTR)(LPCSTR)"摄控安排";
  2677. g_bookingtype = 0;
  2678. OPEN_MENU(TodayForm);
  2679. return;
  2680. }
  2681. else if (strMsg == "选片预约")
  2682. {
  2683. UINT nID = 2;
  2684. LPSTR pName;
  2685. pName = (LPSTR)(LPCSTR)"选片预约";
  2686. g_bookingtype = 1;
  2687. OPEN_MENU(TodayForm);
  2688. return;
  2689. }
  2690. else if (strMsg == "看样预约")
  2691. {
  2692. UINT nID = 2;
  2693. LPSTR pName;
  2694. pName = (LPSTR)(LPCSTR)"看样预约";
  2695. g_bookingtype = 2;
  2696. OPEN_MENU(TodayForm);
  2697. return;
  2698. }
  2699. else if (strMsg == "取件预约")
  2700. {
  2701. UINT nID = 2;
  2702. LPSTR pName;
  2703. pName = (LPSTR)(LPCSTR)"取件预约";
  2704. g_bookingtype = 3;
  2705. OPEN_MENU(TodayForm);
  2706. return;
  2707. }
  2708. else if (strMsg == "婚庆安排")
  2709. {
  2710. UINT nID = 2;
  2711. LPSTR pName;
  2712. pName = (LPSTR)(LPCSTR)"婚庆安排";
  2713. g_bookingtype = 4;
  2714. OPEN_MENU(TodayForm);
  2715. return;
  2716. }
  2717. #endif
  2718. else if (strMsg == "员工资料")
  2719. {
  2720. UINT nID = 2;
  2721. LPSTR pName;
  2722. pName = (LPSTR)(LPCSTR)"员工资料";
  2723. if (g_bAllBranch)
  2724. OPEN_MENU(EmployeeForm2);
  2725. else
  2726. OPEN_MENU(EmployeeForm);
  2727. return;
  2728. }
  2729. else if (strMsg == "客户区域")
  2730. {
  2731. // if(IsHasRightsnew(48)==0)return;
  2732. GetOcx();
  2733. UINT nID = 2;
  2734. LPSTR pName;
  2735. pName = (LPSTR)(LPCSTR)"客户区域";
  2736. OPEN_MENU(AreaClient);
  2737. return;
  2738. }
  2739. else if (strMsg == "客户报表")
  2740. {
  2741. UINT nID = 3;
  2742. LPSTR pName;
  2743. pName = (LPSTR)(LPCSTR)"客户报表";
  2744. OPEN_MENU(CClientForm);
  2745. return;
  2746. }
  2747. else if (strMsg == "现金支出")
  2748. {
  2749. if (IsHasRightsnew(16) == 0)return;
  2750. UINT nID = 3;
  2751. LPSTR pName;
  2752. pName = (LPSTR)(LPCSTR)"现金支出";
  2753. OPEN_MENU(PayOutInput);
  2754. return;
  2755. }
  2756. else if (strMsg == "短信群发")
  2757. {
  2758. UINT nID = 3;
  2759. LPSTR pName;
  2760. pName = (LPSTR)(LPCSTR)"短信群发";
  2761. OPEN_MENU(SendMsg);
  2762. return;
  2763. }
  2764. else if (strMsg == "短信发送")
  2765. {
  2766. UINT nID = 3;
  2767. LPSTR pName;
  2768. pName = (LPSTR)(LPCSTR)"客户报表";
  2769. OPEN_MENU(CClientForm);
  2770. return;
  2771. }
  2772. else if (strMsg == "流程短信")
  2773. {
  2774. UINT nID = 3;
  2775. LPSTR pName;
  2776. pName = (LPSTR)(LPCSTR)"流程短信";
  2777. OPEN_MENU(WorkMsg);
  2778. return;
  2779. }
  2780. else if (strMsg == "员工短信")
  2781. {
  2782. UINT nID = 3;
  2783. LPSTR pName;
  2784. pName = (LPSTR)(LPCSTR)"员工短信";
  2785. OPEN_MENU(EmployeeMsg);
  2786. return;
  2787. }
  2788. else if (strMsg == "发送记录")
  2789. {
  2790. UINT nID = 3;
  2791. LPSTR pName;
  2792. pName = (LPSTR)(LPCSTR)"发送记录";
  2793. OPEN_MENU(MsgReg);
  2794. return;
  2795. }
  2796. else if (strMsg == "短信设置")
  2797. {
  2798. if (IsHasRightsnew(49) == 0)return;
  2799. MsgSet dlg;
  2800. dlg.DoModal();
  2801. return;
  2802. }
  2803. else if (strMsg == "金卡会员")
  2804. {
  2805. #ifndef ENTERPRISE_VERSION
  2806. #ifndef CHILD_VERSION
  2807. #ifdef BASIC_VERSION
  2808. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2809. {
  2810. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2811. exit(0);return;
  2812. }
  2813. #else
  2814. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2815. {
  2816. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2817. exit(0);return;
  2818. }
  2819. #endif
  2820. #else
  2821. #ifdef BASIC_VERSION
  2822. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2823. {
  2824. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2825. exit(0);return;
  2826. }
  2827. #else
  2828. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2829. {
  2830. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2831. exit(0); return;
  2832. }
  2833. #endif
  2834. #endif
  2835. #else
  2836. #ifndef CHILD_VERSION
  2837. #ifdef BASIC_VERSION
  2838. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2839. {
  2840. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2841. exit(0); return;
  2842. }
  2843. #else
  2844. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2845. {
  2846. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2847. exit(0); return;
  2848. }
  2849. #endif
  2850. #else
  2851. #ifdef BASIC_VERSION
  2852. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2853. {
  2854. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2855. exit(0);return;
  2856. }
  2857. #else
  2858. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2859. {
  2860. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2861. exit(0); return;
  2862. }
  2863. #endif
  2864. #endif
  2865. #endif
  2866. UINT nID = 3;
  2867. LPSTR pName;
  2868. pName = (LPSTR)(LPCSTR)"金卡会员";
  2869. OPEN_MENU(ShowMember);
  2870. return;
  2871. }
  2872. else if (strMsg == "现金子卡")
  2873. {
  2874. UINT nID = 3;
  2875. LPSTR pName;
  2876. pName = (LPSTR)(LPCSTR)"现金子卡";
  2877. OPEN_MENU(ShowMember2);
  2878. return;
  2879. }
  2880. else if (strMsg == "蓝钻会员")
  2881. {
  2882. #ifndef ENTERPRISE_VERSION
  2883. #ifndef CHILD_VERSION
  2884. #ifdef BASIC_VERSION
  2885. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2886. {
  2887. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2888. exit(0);return;
  2889. }
  2890. #else
  2891. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2892. {
  2893. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2894. exit(0);return;
  2895. }
  2896. #endif
  2897. #else
  2898. #ifdef BASIC_VERSION
  2899. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2900. {
  2901. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2902. exit(0);return;
  2903. }
  2904. #else
  2905. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2906. {
  2907. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2908. exit(0); return;
  2909. }
  2910. #endif
  2911. #endif
  2912. #else
  2913. #ifndef CHILD_VERSION
  2914. #ifdef BASIC_VERSION
  2915. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2916. {
  2917. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2918. exit(0); return;
  2919. }
  2920. #else
  2921. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2922. {
  2923. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2924. exit(0); return;
  2925. }
  2926. #endif
  2927. #else
  2928. #ifdef BASIC_VERSION
  2929. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2930. {
  2931. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2932. exit(0);return;
  2933. }
  2934. #else
  2935. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2936. {
  2937. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2938. exit(0); return;
  2939. }
  2940. #endif
  2941. #endif
  2942. #endif
  2943. UINT nID = 3;
  2944. LPSTR pName;
  2945. pName = (LPSTR)(LPCSTR)"蓝钻会员";
  2946. OPEN_MENU(ShowMemberBlue);
  2947. return;
  2948. }
  2949. else if (strMsg == "转介绍积分")
  2950. {
  2951. #ifndef ENTERPRISE_VERSION
  2952. #ifndef CHILD_VERSION
  2953. #ifdef BASIC_VERSION
  2954. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2955. {
  2956. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2957. exit(0);return;
  2958. }
  2959. #else
  2960. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2961. {
  2962. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2963. exit(0);return;
  2964. }
  2965. #endif
  2966. #else
  2967. #ifdef BASIC_VERSION
  2968. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2969. {
  2970. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2971. exit(0);return;
  2972. }
  2973. #else
  2974. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  2975. {
  2976. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2977. exit(0); return;
  2978. }
  2979. #endif
  2980. #endif
  2981. #else
  2982. #ifndef CHILD_VERSION
  2983. #ifdef BASIC_VERSION
  2984. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2985. {
  2986. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2987. exit(0); return;
  2988. }
  2989. #else
  2990. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2991. {
  2992. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2993. exit(0); return;
  2994. }
  2995. #endif
  2996. #else
  2997. #ifdef BASIC_VERSION
  2998. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2999. {
  3000. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3001. exit(0);return;
  3002. }
  3003. #else
  3004. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3005. {
  3006. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3007. exit(0); return;
  3008. }
  3009. #endif
  3010. #endif
  3011. #endif
  3012. UINT nID = 3;
  3013. LPSTR pName;
  3014. pName = (LPSTR)(LPCSTR)"转介绍积分";
  3015. OPEN_MENU(Card2Reg);
  3016. return;
  3017. }
  3018. /* else if(strMsg=="转介绍图表")
  3019. {
  3020. #ifndef ENTERPRISE_VERSION
  3021. #ifndef CHILD_VERSION
  3022. #ifdef BASIC_VERSION
  3023. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="0")
  3024. {
  3025. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3026. exit(0);return;
  3027. }
  3028. #else
  3029. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3030. {
  3031. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3032. exit(0);return;
  3033. }
  3034. #endif
  3035. #else
  3036. #ifdef BASIC_VERSION
  3037. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3038. {
  3039. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3040. exit(0);return;
  3041. }
  3042. #else
  3043. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  3044. {
  3045. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3046. exit(0);return;
  3047. }
  3048. #endif
  3049. #endif
  3050. #else
  3051. #ifndef CHILD_VERSION
  3052. #ifdef BASIC_VERSION
  3053. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3054. {
  3055. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3056. exit(0);return;
  3057. }
  3058. #else
  3059. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="5")
  3060. {
  3061. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3062. exit(0);return;
  3063. }
  3064. #endif
  3065. #else
  3066. #ifdef BASIC_VERSION
  3067. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="6")
  3068. {
  3069. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3070. exit(0);return;
  3071. }
  3072. #else
  3073. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="7")
  3074. {
  3075. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3076. exit(0);return;
  3077. }
  3078. #endif
  3079. #endif
  3080. #endif
  3081. UINT nID=3;
  3082. LPSTR pName ;
  3083. pName = (LPSTR)(LPCSTR)"转介绍图表";
  3084. OPEN_MENU(Card2RegChart);
  3085. return;
  3086. }*/
  3087. else if (strMsg == "金卡图表")
  3088. {
  3089. UINT nID = 3;
  3090. LPSTR pName;
  3091. pName = (LPSTR)(LPCSTR)"金卡图表";
  3092. OPEN_MENU(MemberChart);
  3093. return;
  3094. }
  3095. else if (strMsg == "积分短信")
  3096. {
  3097. UINT nID = 3;
  3098. LPSTR pName;
  3099. pName = (LPSTR)(LPCSTR)"积分短信";
  3100. OPEN_MENU(ShowMemberMsg);
  3101. return;
  3102. }
  3103. else if (strMsg == "转介绍返现")
  3104. {
  3105. #ifndef ENTERPRISE_VERSION
  3106. #ifndef CHILD_VERSION
  3107. #ifdef BASIC_VERSION
  3108. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3109. {
  3110. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3111. exit(0);return;
  3112. }
  3113. #else
  3114. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3115. {
  3116. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3117. exit(0);return;
  3118. }
  3119. #endif
  3120. #else
  3121. #ifdef BASIC_VERSION
  3122. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3123. {
  3124. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3125. exit(0);return;
  3126. }
  3127. #else
  3128. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3129. {
  3130. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3131. exit(0); return;
  3132. }
  3133. #endif
  3134. #endif
  3135. #else
  3136. #ifndef CHILD_VERSION
  3137. #ifdef BASIC_VERSION
  3138. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3139. {
  3140. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3141. exit(0); return;
  3142. }
  3143. #else
  3144. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3145. {
  3146. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3147. exit(0); return;
  3148. }
  3149. #endif
  3150. #else
  3151. #ifdef BASIC_VERSION
  3152. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3153. {
  3154. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3155. exit(0);return;
  3156. }
  3157. #else
  3158. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3159. {
  3160. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3161. exit(0); return;
  3162. }
  3163. #endif
  3164. #endif
  3165. #endif
  3166. UINT nID = 3;
  3167. LPSTR pName;
  3168. pName = (LPSTR)(LPCSTR)"转介绍返现";
  3169. OPEN_MENU(Card2RegBlue);
  3170. return;
  3171. }
  3172. else if (strMsg == "转介绍图表")
  3173. {
  3174. #ifndef ENTERPRISE_VERSION
  3175. #ifndef CHILD_VERSION
  3176. #ifdef BASIC_VERSION
  3177. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3178. {
  3179. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3180. exit(0);return;
  3181. }
  3182. #else
  3183. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3184. {
  3185. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3186. exit(0);return;
  3187. }
  3188. #endif
  3189. #else
  3190. #ifdef BASIC_VERSION
  3191. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3192. {
  3193. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3194. exit(0);return;
  3195. }
  3196. #else
  3197. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3198. {
  3199. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3200. exit(0); return;
  3201. }
  3202. #endif
  3203. #endif
  3204. #else
  3205. #ifndef CHILD_VERSION
  3206. #ifdef BASIC_VERSION
  3207. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3208. {
  3209. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3210. exit(0); return;
  3211. }
  3212. #else
  3213. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3214. {
  3215. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3216. exit(0); return;
  3217. }
  3218. #endif
  3219. #else
  3220. #ifdef BASIC_VERSION
  3221. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3222. {
  3223. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3224. exit(0);return;
  3225. }
  3226. #else
  3227. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3228. {
  3229. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3230. exit(0); return;
  3231. }
  3232. #endif
  3233. #endif
  3234. #endif
  3235. UINT nID = 3;
  3236. LPSTR pName;
  3237. pName = (LPSTR)(LPCSTR)"转介绍图表";
  3238. OPEN_MENU(Card2RegChartBlue);
  3239. return;
  3240. }
  3241. else if (strMsg == "积分设置")
  3242. {
  3243. if (IsHasRightsnew(49) == 0)return;
  3244. MemberSet dlg;
  3245. dlg.DoModal();
  3246. return;
  3247. }
  3248. else if (strMsg == "礼服录入")
  3249. {
  3250. if (IsHasRightsnew(39) == 0)return;
  3251. UINT nID = 3;
  3252. LPSTR pName;
  3253. pName = (LPSTR)(LPCSTR)"礼服录入";
  3254. OPEN_MENU(DressManage);
  3255. return;
  3256. }
  3257. else if (strMsg == "礼服查看")
  3258. {
  3259. #ifndef ENTERPRISE_VERSION
  3260. #ifndef CHILD_VERSION
  3261. #ifdef BASIC_VERSION
  3262. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3263. {
  3264. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3265. exit(0);return;
  3266. }
  3267. #else
  3268. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3269. {
  3270. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3271. exit(0);return;
  3272. }
  3273. #endif
  3274. #else
  3275. #ifdef BASIC_VERSION
  3276. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3277. {
  3278. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3279. exit(0);return;
  3280. }
  3281. #else
  3282. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3283. {
  3284. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3285. exit(0); return;
  3286. }
  3287. #endif
  3288. #endif
  3289. #else
  3290. #ifndef CHILD_VERSION
  3291. #ifdef BASIC_VERSION
  3292. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3293. {
  3294. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3295. exit(0); return;
  3296. }
  3297. #else
  3298. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3299. {
  3300. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3301. exit(0); return;
  3302. }
  3303. #endif
  3304. #else
  3305. #ifdef BASIC_VERSION
  3306. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3307. {
  3308. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3309. exit(0);return;
  3310. }
  3311. #else
  3312. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3313. {
  3314. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3315. exit(0); return;
  3316. }
  3317. #endif
  3318. #endif
  3319. #endif
  3320. if (IsHasRightsnew(40) == 0)return;
  3321. UINT nID = 3;
  3322. LPSTR pName;
  3323. pName = (LPSTR)(LPCSTR)"礼服查看";
  3324. OPEN_MENU(ShowDress);
  3325. return;
  3326. }
  3327. else if (strMsg == "撞期预警")
  3328. {
  3329. UINT nID = 3;
  3330. LPSTR pName;
  3331. pName = (LPSTR)(LPCSTR)"撞期预警";
  3332. OPEN_MENU(DressEarlyWarning);
  3333. return;
  3334. }
  3335. else if (strMsg == "礼服出租")
  3336. {
  3337. UINT nID = 3;
  3338. LPSTR pName;
  3339. pName = (LPSTR)(LPCSTR)"礼服出租";
  3340. OPEN_MENU(ShowHireReg);
  3341. return;
  3342. }
  3343. else if (strMsg == "礼服图片")
  3344. {
  3345. ShowPic dlg;
  3346. dlg.m_mode = 4;
  3347. //dlg.m_path = g_path5 + "\\";
  3348. dlg.m_id = g_path5 + "\\";
  3349. dlg.DoModal();
  3350. return;
  3351. }
  3352. else if (strMsg == "商品类别设置")
  3353. {
  3354. if (IsHasRightsnew(29) == 0)return;
  3355. SPLBDlg dlg;
  3356. dlg.DoModal();
  3357. return;
  3358. }
  3359. else if (strMsg == "商品名称设置")
  3360. {
  3361. if (IsHasRightsnew(29) == 0)return;
  3362. UINT nID = 3;
  3363. LPSTR pName;
  3364. pName = (LPSTR)(LPCSTR)"商品设置";
  3365. OPEN_MENU(ShangPin);
  3366. return;
  3367. }
  3368. else if (strMsg == "固定资产管理")
  3369. {
  3370. UINT nID = 3;
  3371. LPSTR pName;
  3372. pName = (LPSTR)(LPCSTR)"固定资产管理";
  3373. OPEN_MENU(FixedAssets);
  3374. return;
  3375. }
  3376. else if (strMsg == "入库单")
  3377. {
  3378. if (IsHasRightsnew(44) == 0)return;
  3379. InputGoods dlg;
  3380. dlg.DoModal();
  3381. return;
  3382. }
  3383. else if (strMsg == "出库单")
  3384. {
  3385. #ifndef ENTERPRISE_VERSION
  3386. #ifndef CHILD_VERSION
  3387. #ifdef BASIC_VERSION
  3388. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3389. {
  3390. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3391. exit(0);return;
  3392. }
  3393. #else
  3394. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3395. {
  3396. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3397. exit(0);return;
  3398. }
  3399. #endif
  3400. #else
  3401. #ifdef BASIC_VERSION
  3402. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3403. {
  3404. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3405. exit(0);return;
  3406. }
  3407. #else
  3408. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3409. {
  3410. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3411. exit(0); return;
  3412. }
  3413. #endif
  3414. #endif
  3415. #else
  3416. #ifndef CHILD_VERSION
  3417. #ifdef BASIC_VERSION
  3418. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3419. {
  3420. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3421. exit(0); return;
  3422. }
  3423. #else
  3424. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3425. {
  3426. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3427. exit(0); return;
  3428. }
  3429. #endif
  3430. #else
  3431. #ifdef BASIC_VERSION
  3432. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3433. {
  3434. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3435. exit(0);return;
  3436. }
  3437. #else
  3438. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3439. {
  3440. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3441. exit(0); return;
  3442. }
  3443. #endif
  3444. #endif
  3445. #endif
  3446. if (IsHasRightsnew(45) == 0)return;
  3447. InputGoods dlg;
  3448. dlg.m_mode = 1;
  3449. dlg.DoModal();
  3450. return;
  3451. }
  3452. else if (strMsg == "库存查询")
  3453. {
  3454. #ifndef ENTERPRISE_VERSION
  3455. #ifndef CHILD_VERSION
  3456. #ifdef BASIC_VERSION
  3457. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3458. {
  3459. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3460. exit(0);return;
  3461. }
  3462. #else
  3463. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3464. {
  3465. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3466. exit(0);return;
  3467. }
  3468. #endif
  3469. #else
  3470. #ifdef BASIC_VERSION
  3471. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3472. {
  3473. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3474. exit(0);return;
  3475. }
  3476. #else
  3477. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "3")
  3478. {
  3479. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3480. exit(0); return;
  3481. }
  3482. #endif
  3483. #endif
  3484. #else
  3485. #ifndef CHILD_VERSION
  3486. #ifdef BASIC_VERSION
  3487. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3488. {
  3489. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3490. exit(0); return;
  3491. }
  3492. #else
  3493. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3494. {
  3495. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3496. exit(0); return;
  3497. }
  3498. #endif
  3499. #else
  3500. #ifdef BASIC_VERSION
  3501. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3502. {
  3503. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3504. exit(0);return;
  3505. }
  3506. #else
  3507. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3508. {
  3509. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3510. exit(0); return;
  3511. }
  3512. #endif
  3513. #endif
  3514. #endif
  3515. UINT nID = 3;
  3516. LPSTR pName;
  3517. pName = (LPSTR)(LPCSTR)"库存查询";
  3518. OPEN_MENU(ShowGoods);
  3519. return;
  3520. }
  3521. else if (strMsg == "商品图表")
  3522. {
  3523. UINT nID = 3;
  3524. LPSTR pName;
  3525. pName = (LPSTR)(LPCSTR)"商品图表";
  3526. OPEN_MENU(StoreInfoChart);
  3527. return;
  3528. }
  3529. else if (strMsg == "成本核算")
  3530. {
  3531. UINT nID = 3;
  3532. LPSTR pName;
  3533. pName = (LPSTR)(LPCSTR)"成本核算";
  3534. OPEN_MENU(CostCal);
  3535. return;
  3536. }
  3537. else if (strMsg == "考勤记录")
  3538. {
  3539. UINT nID = 3;
  3540. LPSTR pName;
  3541. pName = (LPSTR)(LPCSTR)"考勤记录";
  3542. OPEN_MENU(LoginReg);
  3543. return;
  3544. }
  3545. else if (strMsg == "月统计")
  3546. {
  3547. UINT nID = 3;
  3548. LPSTR pName;
  3549. pName = (LPSTR)(LPCSTR)"月统计";
  3550. OPEN_MENU(LoginReg2);
  3551. return;
  3552. }
  3553. else if (strMsg == "时间设置")
  3554. {
  3555. if (IsHasRightsnew(21) == 0)return;
  3556. SetLoginTime dlg;
  3557. dlg.DoModal();
  3558. return;
  3559. }
  3560. else if (strMsg == "排班设置")
  3561. {
  3562. if (IsHasRightsnew(21) == 0)return;
  3563. SetLoginBan dlg;
  3564. dlg.DoModal();
  3565. return;
  3566. }
  3567. else if (strMsg == "意向查询")
  3568. {
  3569. UINT nID = 3;
  3570. LPSTR pName;
  3571. pName = (LPSTR)(LPCSTR)"意向查询";
  3572. OPEN_MENU(HospitalClient);
  3573. return;
  3574. }
  3575. else if (strMsg == "今日提醒")
  3576. {
  3577. UINT nID = 3;
  3578. LPSTR pName;
  3579. pName = (LPSTR)(LPCSTR)"今日提醒";
  3580. OPEN_MENU(HospitalClientAlarm);
  3581. return;
  3582. }
  3583. else if (strMsg == "跟踪短信")
  3584. {
  3585. UINT nID = 3;
  3586. LPSTR pName;
  3587. pName = (LPSTR)(LPCSTR)"跟踪短信";
  3588. OPEN_MENU(HospitalClientMsg);
  3589. return;
  3590. }
  3591. else if (strMsg == "意向单录入")
  3592. {
  3593. AddHospitalClient dlg;
  3594. dlg.DoModal();
  3595. return;
  3596. }
  3597. else if (strMsg == "资料设置")
  3598. {
  3599. HospitalInfoSet dlg;
  3600. dlg.DoModal();
  3601. return;
  3602. }
  3603. AfxMessageBox(strMsg + ",开发中...");
  3604. }
  3605. // Jeff.当版本号不一致时,调用AutoUpdate.exe来升级YLGL.exe
  3606. void CMainFrame::AutoUpdate()
  3607. {
  3608. if (g_bBranchModify)
  3609. {
  3610. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3611. return;
  3612. }
  3613. else if (g_branchname != "")
  3614. {
  3615. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3616. return;
  3617. }
  3618. g_ntimeout = 30000;
  3619. if (!::PathFileExists(g_mainpath + "\\AutoUpdate.exe"))
  3620. {
  3621. g_sendhead.bsql = 0;
  3622. g_sendhead.code[0] = 99;
  3623. g_sendhead.tabcount = 1;
  3624. g_pMainWnd->ProcessChatMessageRequest2(99);
  3625. if (g_bSendOK == 0)
  3626. goto failed;
  3627. CFile fp;
  3628. fp.Open(g_mainpath + "\\AutoUpdate.exe", CFile::modeWrite | CFile::modeCreate);
  3629. fp.Write(g_pData, g_nLeng);
  3630. fp.Close();
  3631. }
  3632. {
  3633. ::DeleteFile(g_mainpath + "\\YLGL2.exe"); // 删除ylgl.exe;
  3634. g_sendhead.bsql = 0;
  3635. g_sendhead.code[0] = 98;
  3636. g_sendhead.tabcount = 1;
  3637. g_pMainWnd->ProcessChatMessageRequest2(99); if (g_bSendOK == 0)goto failed;
  3638. CFile fp;
  3639. fp.Open(g_mainpath + "\\YLGL2.exe", CFile::modeWrite | CFile::modeCreate);
  3640. fp.Write(g_pData, g_nLeng);
  3641. fp.Close();
  3642. }
  3643. AfxMessageBox("自动升级成功!", MB_ICONINFORMATION);
  3644. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\AutoUpdate.exe"), "12345", NULL, SW_SHOWNORMAL);
  3645. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3646. exit(0);
  3647. return;
  3648. failed:
  3649. AfxMessageBox("自动升级失败!", MB_ICONINFORMATION);
  3650. if (g_ntimeout == 30000)//非远程
  3651. {
  3652. AfxMessageBox("提醒:升级过程中需要传输较多的数据,如果网速慢可能导致远程升级失败!\r\n\
  3653. 可拷贝店内客户端用QQ传过来覆盖除dbconfig.dat的文件即可。", MB_ICONINFORMATION);
  3654. }
  3655. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3656. }
  3657. void CMainFrame::Onchoosephotoskin() //Jeff:此机用于选片菜单项;不在使用2014.06.16
  3658. {
  3659. if (g_user.bLongin == 0)
  3660. {
  3661. if (g_bNoLoginLia)
  3662. {
  3663. Login dlg;
  3664. dlg.SetLiaPath("5.lia");
  3665. dlg.DoModal();
  3666. }
  3667. else
  3668. {
  3669. Login3 dlg;
  3670. dlg.SetLiaPath("5.lia");
  3671. dlg.DoModal();
  3672. }
  3673. if (g_user.bLongin == 0)return;
  3674. }
  3675. // TODO: Add your command handler code here
  3676. CMenu *pMenu = GetMenu();
  3677. CMenu* submenu = pMenu->GetSubMenu(1);
  3678. UINT status = submenu->GetMenuState(IDM_choosephotoskin, MF_BYCOMMAND);
  3679. if (status&MF_CHECKED)
  3680. {
  3681. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_UNCHECKED);
  3682. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status", 0);
  3683. }
  3684. else
  3685. {
  3686. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  3687. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status", 1);
  3688. }
  3689. }
  3690. /*BOOL g_bInSkin = 0;*/
  3691. BOOL CMainFrame::IsCtrlDown()
  3692. {
  3693. short state = GetKeyState(VK_LCONTROL);
  3694. BYTE sta = (BYTE)(state >> 8);
  3695. state = GetKeyState(VK_RCONTROL);
  3696. BYTE sta2 = (BYTE)(state >> 8);
  3697. if (sta || sta2)
  3698. return 1;
  3699. else
  3700. return 0;
  3701. }//IsShiftDown
  3702. BOOL CMainFrame::IsShiftDown()
  3703. {
  3704. short state = GetKeyState(VK_LSHIFT);
  3705. BYTE sta = (BYTE)(state >> 8);
  3706. state = GetKeyState(VK_RSHIFT);
  3707. BYTE sta2 = (BYTE)(state >> 8);
  3708. if (sta || sta2)
  3709. return 1;
  3710. else
  3711. return 0;
  3712. }
  3713. BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
  3714. {
  3715. // TODO: Add your specialized code here and/or call the base class IDM_Logout
  3716. if (pMsg->message == WM_KEYDOWN)
  3717. {
  3718. switch (pMsg->wParam)
  3719. {
  3720. case VK_F12:
  3721. g_pMainWnd->OnCommandMenu(IDM_Logout);
  3722. return 1;
  3723. case VK_F1:
  3724. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  3725. return 1;
  3726. case VK_F2: // 此机用于选片和选设计;
  3727. {
  3728. if (g_pMainWnd->m_bCheckF2F3 && (IsShiftDown() == 0 || IsCtrlDown() == 0))return 1;
  3729. m_Mdi.MainClose();
  3730. if (g_user.bLongin)
  3731. {
  3732. SearchClient dlg;
  3733. dlg.SetLiaPath("2.lia");
  3734. if (dlg.DoModal() != IDOK)
  3735. {
  3736. if (dlg.m_bLogout)
  3737. {
  3738. g_user.bLongin = 0;
  3739. g_user.name.Empty();
  3740. g_user.rights.Empty();
  3741. g_user.account.Empty();
  3742. goto ll;
  3743. }
  3744. PostMessage(WM_QUIT);
  3745. return 1;
  3746. }
  3747. if (dlg.m_exitcode == 3)
  3748. {
  3749. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3750. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3751. }
  3752. else
  3753. {
  3754. ShowWindow(SW_SHOW);
  3755. #ifdef NEW_SKIN
  3756. if (m_pMainFrimDlg2 == NULL)
  3757. {
  3758. m_pMainFrimDlg2 = new MainFrimDlg2;
  3759. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3760. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3761. }
  3762. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3763. g_bInSkin = 0;
  3764. #endif
  3765. }
  3766. }
  3767. else
  3768. {
  3769. ll:
  3770. ChoosePhotoSkin dlg;
  3771. dlg.SetLiaPath("1.lia");
  3772. if (dlg.DoModal() != IDOK)
  3773. {
  3774. PostMessage(WM_QUIT);
  3775. return 1;
  3776. }
  3777. if (dlg.m_exitcode == 3)
  3778. {
  3779. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3780. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3781. }
  3782. else
  3783. {
  3784. ShowWindow(SW_SHOW);
  3785. #ifdef NEW_SKIN
  3786. if (m_pMainFrimDlg2 == NULL)
  3787. {
  3788. m_pMainFrimDlg2 = new MainFrimDlg2;
  3789. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3790. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3791. }
  3792. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3793. g_bInSkin = 0;
  3794. #endif
  3795. }
  3796. }
  3797. }
  3798. return 1;
  3799. case VK_F3: // 此机用于选片和选设计;
  3800. {
  3801. if (g_pMainWnd->m_bCheckF2F3 && (g_pMainWnd->IsShiftDown() == 0 || g_pMainWnd->IsCtrlDown() == 0))return 1;
  3802. m_Mdi.MainClose();
  3803. if (g_user.bLongin)
  3804. {
  3805. SearchClient dlg;
  3806. dlg.m_mode = 1;
  3807. dlg.SetLiaPath("2.lia");
  3808. if (dlg.DoModal() != IDOK)
  3809. {
  3810. if (dlg.m_bLogout)
  3811. {
  3812. g_user.bLongin = 0;
  3813. g_user.name.Empty();
  3814. g_user.rights.Empty();
  3815. g_user.account.Empty();
  3816. goto mm;
  3817. }
  3818. PostMessage(WM_QUIT);
  3819. return 1;
  3820. }
  3821. if (dlg.m_exitcode == 2)
  3822. {
  3823. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3824. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3825. }
  3826. else
  3827. {
  3828. ShowWindow(SW_SHOW);
  3829. #ifdef NEW_SKIN
  3830. if (m_pMainFrimDlg2 == NULL)
  3831. {
  3832. m_pMainFrimDlg2 = new MainFrimDlg2;
  3833. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3834. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3835. }
  3836. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3837. g_bInSkin = 0;
  3838. #endif
  3839. }
  3840. }
  3841. else
  3842. {
  3843. mm:
  3844. ChoosePhotoSkin dlg;
  3845. dlg.m_mode = 1;
  3846. dlg.SetLiaPath("1.lia");
  3847. if (dlg.DoModal() != IDOK)
  3848. {
  3849. PostMessage(WM_QUIT);
  3850. return 1;
  3851. }
  3852. if (dlg.m_exitcode == 2)
  3853. {
  3854. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3855. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3856. }
  3857. else
  3858. {
  3859. ShowWindow(SW_SHOW);
  3860. #ifdef NEW_SKIN
  3861. if (m_pMainFrimDlg2 == NULL)
  3862. {
  3863. m_pMainFrimDlg2 = new MainFrimDlg2;
  3864. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3865. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3866. }
  3867. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3868. g_bInSkin = 0;
  3869. #endif
  3870. }
  3871. }
  3872. }
  3873. return 1;
  3874. //#if 0 // 2015-05-30 禁用F11功能;
  3875. // case VK_F11:
  3876. // if (g_bInSkin)return 1;
  3877. // if (g_user.bLongin)
  3878. // {
  3879. // SqlDlg dlg;
  3880. // dlg.DoModal();
  3881. // }
  3882. // break;
  3883. //#endif
  3884. }
  3885. }
  3886. return CMDIFrameWnd::PreTranslateMessage(pMsg);
  3887. }
  3888. void CMainFrame::GetSkin()
  3889. {
  3890. return;
  3891. #ifdef MNLS_VERSION
  3892. if (::PathFileExists(g_mainpath + "\\skin\\4.lia"))
  3893. {
  3894. CFile fp;
  3895. fp.Open(g_mainpath + "\\skin\\4.lia", CFile::modeRead);
  3896. DWORD leng=fp.GetLength ();
  3897. fp.Close ();
  3898. if(leng!=194987)
  3899. ::DeleteFile (g_mainpath+"\\skin\\4.lia"); // 删除4.lia
  3900. }
  3901. if(!::PathFileExists (g_mainpath+"\\skin\\4.lia"))
  3902. {
  3903. ::CreateDirectory (g_mainpath+"\\skin", NULL);
  3904. g_sendhead.bsql=0;
  3905. g_sendhead.code[0]=100;
  3906. g_sendhead.tabcount=1;
  3907. g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return;
  3908. CFile fp;
  3909. fp.Open (g_mainpath+"\\skin\\4.lia", CFile::modeWrite|CFile::modeCreate);
  3910. fp.Write (g_pData, g_nLeng);
  3911. fp.Close ();
  3912. }
  3913. #endif
  3914. }
  3915. void AutoDraw(CPrintRX &m_Print, CRect &StrRect, CString &str, float fscale)
  3916. {
  3917. CString tempbz =_T(""), temp = _T("");
  3918. BOOL bRun = 0;
  3919. CSize size;
  3920. int fontsize = 12;
  3921. int i = 0;
  3922. ll: tempbz = str;
  3923. i = 0;
  3924. m_Print.SetFontFace(fontsize, 1, "宋体");
  3925. while (1)
  3926. {
  3927. if (!tempbz.IsEmpty())
  3928. {
  3929. temp = tempbz;
  3930. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  3931. int right = 0;
  3932. CRect temprc = StrRect;
  3933. temprc.top += i*(fontsize*fscale); i++;
  3934. temprc.bottom = temprc.top + fontsize;
  3935. if (temprc.bottom > StrRect.bottom)break;
  3936. while (size.cx > temprc.Width())
  3937. {
  3938. right++;
  3939. temp = tempbz.Left(tempbz.GetLength() - (right));
  3940. if (GIsHalfHZ(temp))
  3941. {
  3942. right++;
  3943. temp.Delete(temp.GetLength() - 1);
  3944. }
  3945. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  3946. }
  3947. // 判断最后的字符是否还含有半个汉字;
  3948. if ( GIsHalfHZ(temp) )
  3949. {
  3950. right++;
  3951. temp.Delete(temp.GetLength() -1);
  3952. temp = tempbz.Left(tempbz.GetLength() - (right));
  3953. }
  3954. if (temp.Find("\r\n") != -1)
  3955. {
  3956. temp = temp.Left(temp.Find("\r\n"));//i++;
  3957. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength() - 2);
  3958. }
  3959. else
  3960. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  3961. if (bRun)
  3962. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, temprc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3963. }
  3964. else
  3965. break;
  3966. }
  3967. if (tempbz.IsEmpty() == 0)
  3968. {
  3969. fontsize--;
  3970. goto ll;
  3971. }
  3972. if (bRun == 0)
  3973. {
  3974. bRun = 1;
  3975. goto ll;
  3976. }
  3977. }
  3978. void CMainFrame::PrintDinDan3(CString strOrderNumber)
  3979. {
  3980. // TODO: Add your control notification handler code here
  3981. CPrintRX m_Print;
  3982. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  3983. {
  3984. m_Print.InitToPrint(NULL, 1);
  3985. }
  3986. else
  3987. {
  3988. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  3989. if (name.IsEmpty())
  3990. m_Print.InitToPrint(NULL, 1);
  3991. else
  3992. {
  3993. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  3994. if (nret == -1)
  3995. {
  3996. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  3997. }
  3998. }
  3999. }
  4000. m_Print.StartPrint();
  4001. m_Print.StartPage();
  4002. LoadRect load;
  4003. load.SetLiaPath("11.lia");
  4004. load.SetMargins(0, 0);
  4005. if (!load.Load())return;
  4006. LoadRect load2;
  4007. load2.SetLiaPath("12.lia");
  4008. load2.SetMargins(0, 0);
  4009. if (!load2.Load())return;
  4010. LoadRect load3;
  4011. load3.SetLiaPath("13.lia");
  4012. load3.SetMargins(-6, 520);
  4013. if (!load3.Load())return;
  4014. int i;
  4015. //////////////////////////////////////////////////////////////
  4016. CStringArray txarray;
  4017. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "'";
  4018. g_sendhead.code[0] = 11;
  4019. g_sendhead.code[1] = 52;
  4020. g_sendhead.code[2] = 50;
  4021. g_sendhead.code[3] = 150;
  4022. g_sendhead.tabcount = 4;
  4023. g_sendhead.bsql = 0;
  4024. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  4025. CArray<CStringArray, CStringArray>sparray;
  4026. CArray<CStringArray, CStringArray>clientarray;
  4027. CArray<CStringArray, CStringArray>jdarray;
  4028. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray);
  4029. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  4030. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  4031. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  4032. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  4033. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  4034. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  4035. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  4036. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  4037. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  4038. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  4039. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  4040. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  4041. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  4042. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  4043. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  4044. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  4045. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  4046. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  4047. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  4048. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  4049. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  4050. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  4051. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  4052. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  4053. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  4054. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  4055. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  4056. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  4057. CString m_bz = "其它要求: " + g_List1array.ElementAt(0).ElementAt(38);
  4058. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  4059. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  4060. if (IsHasRights2new(31) == 0)
  4061. {
  4062. m_phone1 = "***";
  4063. m_phone2 = "***";
  4064. }
  4065. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  4066. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  4067. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  4068. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  4069. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  4070. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  4071. CString m_addr = m_addr1 + ";";
  4072. m_addr.TrimLeft(";");
  4073. m_addr += m_addr2;
  4074. CString m_qq = m_qq1 + ";";
  4075. m_qq.TrimLeft(";");
  4076. m_qq += m_qq2;
  4077. CString m_jd;
  4078. for (i = 0; i < jdarray.GetSize(); i++)
  4079. {
  4080. m_jd += jdarray.ElementAt(i).ElementAt(1);
  4081. m_jd += ";";
  4082. }
  4083. m_jd.TrimRight(";");
  4084. m_money1.Format("%f", atof(m_taoxijiage));
  4085. m_money2.Format("%f", atof(m_payed1));
  4086. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  4087. ConvertToPrice(m_money1);
  4088. ConvertToPrice(m_money2);
  4089. ConvertToPrice(m_money3);
  4090. ////////////////////////////////////////////////////////////////
  4091. int rcpos = -1;
  4092. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  4093. m_Print.SetFontFace(17, 1, "宋体");
  4094. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4095. StrRect.top -= 0;
  4096. StrRect.bottom -= 10;
  4097. StrRect.left -= 140;
  4098. StrRect.right = StrRect.left + 48;
  4099. m_Print.SetFontFace(15, 1, "宋体");
  4100. m_Print.SetColor(0xffffff);
  4101. m_Print.DrawRect(StrRect, 0);
  4102. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4103. StrRect.left = StrRect.right;
  4104. StrRect.right = StrRect.left + 48;
  4105. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  4106. m_Print.SetColor(0, RGB(255, 0, 0));
  4107. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4108. m_Print.SetColor(0);
  4109. m_Print.SetFontFace(12, 1, "宋体");
  4110. StrRect.left -= 48;
  4111. int hei = StrRect.Height();
  4112. StrRect.top = StrRect.bottom + 2;
  4113. StrRect.bottom += hei + 2;
  4114. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4115. StrRect.top = StrRect.bottom - 2;
  4116. StrRect.bottom += hei - 5;
  4117. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  4118. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4119. m_Print.SetFontFace(12, 1, "宋体");
  4120. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4121. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4122. m_Print.SetFontFace(11, 1, "宋体");
  4123. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4124. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4125. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4126. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4127. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4128. m_Print.DrawRect2(StrRect, 2);
  4129. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4130. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4131. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4132. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4133. m_Print.DrawRect2(StrRect, 2);
  4134. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4135. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4136. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4137. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4138. m_Print.DrawRect2(StrRect, 2);
  4139. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4140. m_Print.DrawText((LPTSTR)(LPCTSTR)"约单时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4141. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4142. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4143. m_Print.DrawRect2(StrRect, 2);
  4144. ////////////
  4145. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4146. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4147. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4148. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4149. m_Print.DrawRect2(StrRect, 2);
  4150. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4151. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4152. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4153. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4154. m_Print.DrawRect2(StrRect, 2);
  4155. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4156. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4157. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4158. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4159. m_Print.DrawRect2(StrRect, 2);
  4160. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4161. m_Print.DrawText((LPTSTR)(LPCTSTR)"大婚时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4162. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4163. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4164. m_Print.DrawRect2(StrRect, 2);
  4165. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4166. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客地址:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4167. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4168. m_Print.DrawText((LPTSTR)(LPCTSTR)m_addr, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4169. m_Print.DrawRect2(StrRect, 2);
  4170. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4171. m_Print.DrawText((LPTSTR)(LPCTSTR)"QQ/邮箱:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4172. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4173. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4174. m_Print.DrawRect2(StrRect, 2);
  4175. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4176. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系金额:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4177. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4178. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4179. m_Print.DrawRect2(StrRect, 2);
  4180. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4181. m_Print.DrawText((LPTSTR)(LPCTSTR)"定金:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4182. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4183. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4184. m_Print.DrawRect2(StrRect, 2);
  4185. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4186. m_Print.DrawText((LPTSTR)(LPCTSTR)"余额:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4187. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4188. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4189. m_Print.DrawRect2(StrRect, 2);
  4190. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4191. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4192. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4193. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4194. m_Print.DrawRect2(StrRect, 2);
  4195. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4196. m_Print.DrawText((LPTSTR)(LPCTSTR)"拍摄景点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4197. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4198. m_Print.DrawText((LPTSTR)(LPCTSTR)m_jd, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4199. m_Print.DrawRect2(StrRect, 2);
  4200. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4201. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内容提供: 男士服装:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4202. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4203. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4204. m_Print.DrawRect2(StrRect, 2);
  4205. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4206. m_Print.DrawText((LPTSTR)(LPCTSTR)"套", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4207. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4208. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4209. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4210. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_HCENTER | 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)"套系内提供拍摄区服装/头饰造型", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4216. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4217. m_Print.DrawText((LPTSTR)(LPCTSTR)"其它:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4218. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4219. m_Print.DrawText((LPTSTR)(LPCTSTR)" ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4220. m_Print.DrawRect2(StrRect, 2);
  4221. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4222. m_Print.DrawText((LPTSTR)(LPCTSTR)"专业数码拍摄:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4223. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4224. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4225. m_Print.DrawRect2(StrRect, 2);
  4226. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4227. m_Print.DrawText((LPTSTR)(LPCTSTR)"张", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4228. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4229. m_Print.DrawText((LPTSTR)(LPCTSTR)"(JPG格式数据)", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4230. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4231. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内赠送:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4232. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4233. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_List1array.ElementAt(0).ElementAt(9)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4234. m_Print.DrawRect2(StrRect, 2);
  4235. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4236. m_Print.DrawText((LPTSTR)(LPCTSTR)"张设计排版精修入册", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4237. //////////////////////load2
  4238. rcpos = -1;
  4239. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4240. m_Print.DrawText((LPTSTR)(LPCTSTR)"原始数据套系内张数JPG格式光盘壹只", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4241. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4242. m_Print.DrawText((LPTSTR)(LPCTSTR)"其它:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4243. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4244. // m_Print.DrawText((LPTSTR)(LPCTSTR)"", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4245. // AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4246. m_Print.DrawRect2(StrRect, 2);
  4247. m_Print.SetFontFace(11, 1, "宋体");
  4248. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4249. m_Print.DrawText((LPTSTR)(LPCTSTR)"客人产品:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4250. int rowcount = sparray.GetSize() / 8;
  4251. int needaddrow = 0;
  4252. while (sparray.GetSize() > rowcount * 8 + needaddrow)
  4253. needaddrow++;
  4254. int pos = 0;
  4255. CString str = "";
  4256. int addcount = 0;
  4257. if (needaddrow > 0)
  4258. addcount = 1;
  4259. else
  4260. addcount = 0;
  4261. needaddrow--;
  4262. str.Empty();
  4263. for (i = 0; i < rowcount + addcount; i++)
  4264. {
  4265. str += sparray.ElementAt(pos).ElementAt(5);
  4266. str += " 数量:";
  4267. str += sparray.ElementAt(pos).ElementAt(3);
  4268. str += ";";
  4269. pos++;
  4270. }
  4271. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4272. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4273. m_Print.DrawRect2(StrRect, 2);
  4274. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4275. if (needaddrow > 0)
  4276. addcount = 1;
  4277. else
  4278. addcount = 0;
  4279. needaddrow--;
  4280. str.Empty();
  4281. for (i = 0; i < rowcount + addcount; i++)
  4282. {
  4283. str += sparray.ElementAt(pos).ElementAt(5);
  4284. str += " 数量:";
  4285. str += sparray.ElementAt(pos).ElementAt(3);
  4286. str += ";";
  4287. pos++;
  4288. }
  4289. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4290. m_Print.DrawRect2(StrRect, 2);
  4291. StrRect = load2.m_rcarray.ElementAt(++rcpos);//7
  4292. if (needaddrow > 0)
  4293. addcount = 1;
  4294. else
  4295. addcount = 0;
  4296. needaddrow--;
  4297. str.Empty();
  4298. for (i = 0; i < rowcount + addcount; i++)
  4299. {
  4300. str += sparray.ElementAt(pos).ElementAt(5);
  4301. str += " 数量:";
  4302. str += sparray.ElementAt(pos).ElementAt(3);
  4303. str += ";";
  4304. pos++;
  4305. }
  4306. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4307. m_Print.DrawRect2(StrRect, 2);
  4308. StrRect = load2.m_rcarray.ElementAt(++rcpos);//8
  4309. if (needaddrow > 0)
  4310. addcount = 1;
  4311. else
  4312. addcount = 0;
  4313. needaddrow--;
  4314. str.Empty();
  4315. for (i = 0; i < rowcount + addcount; i++)
  4316. {
  4317. str += sparray.ElementAt(pos).ElementAt(5);
  4318. str += " 数量:";
  4319. str += sparray.ElementAt(pos).ElementAt(3);
  4320. str += ";";
  4321. pos++;
  4322. }
  4323. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4324. m_Print.DrawRect2(StrRect, 2);
  4325. StrRect = load2.m_rcarray.ElementAt(++rcpos);//9
  4326. if (needaddrow > 0)
  4327. addcount = 1;
  4328. else
  4329. addcount = 0;
  4330. needaddrow--;
  4331. str.Empty();
  4332. for (i = 0; i < rowcount + addcount; i++)
  4333. {
  4334. str += sparray.ElementAt(pos).ElementAt(5);
  4335. str += " 数量:";
  4336. str += sparray.ElementAt(pos).ElementAt(3);
  4337. str += ";";
  4338. pos++;
  4339. }
  4340. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4341. m_Print.DrawRect2(StrRect, 2);
  4342. StrRect = load2.m_rcarray.ElementAt(++rcpos);//10
  4343. if (needaddrow > 0)
  4344. addcount = 1;
  4345. else
  4346. addcount = 0;
  4347. needaddrow--;
  4348. str.Empty();
  4349. for (i = 0; i < rowcount + addcount; i++)
  4350. {
  4351. str += sparray.ElementAt(pos).ElementAt(5);
  4352. str += " 数量:";
  4353. str += sparray.ElementAt(pos).ElementAt(3);
  4354. str += ";";
  4355. pos++;
  4356. }
  4357. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4358. m_Print.DrawRect2(StrRect, 2);
  4359. StrRect = load2.m_rcarray.ElementAt(++rcpos);//11
  4360. if (needaddrow > 0)
  4361. addcount = 1;
  4362. else
  4363. addcount = 0;
  4364. needaddrow--;
  4365. str.Empty();
  4366. for (i = 0; i < rowcount + addcount; i++)
  4367. {
  4368. str += sparray.ElementAt(pos).ElementAt(5);
  4369. str += " 数量:";
  4370. str += sparray.ElementAt(pos).ElementAt(3);
  4371. str += ";";
  4372. pos++;
  4373. }
  4374. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4375. m_Print.DrawRect2(StrRect, 2);
  4376. StrRect = load2.m_rcarray.ElementAt(++rcpos);//12
  4377. if (needaddrow > 0)
  4378. addcount = 1;
  4379. else
  4380. addcount = 0;
  4381. needaddrow--;
  4382. str.Empty();
  4383. for (i = 0; i < rowcount + addcount; i++)
  4384. {
  4385. str += sparray.ElementAt(pos).ElementAt(5);
  4386. str += " 数量:";
  4387. str += sparray.ElementAt(pos).ElementAt(3);
  4388. str += ";";
  4389. pos++;
  4390. }
  4391. AutoDraw(m_Print, StrRect, str, 1.4f); m_Print.SetFontFace(11, 1, "宋体");
  4392. m_Print.DrawRect2(StrRect, 2);
  4393. /* StrRect=load2.m_rcarray .ElementAt (++rcpos);//12
  4394. if(needaddrow>0)
  4395. addcount=1;
  4396. else
  4397. addcount=0;
  4398. needaddrow--;
  4399. str.Empty ();
  4400. for( i=0; i<rowcount+addcount; i++)
  4401. {
  4402. str+=sparray.ElementAt (pos).ElementAt (5);
  4403. str+=" 数量:";
  4404. str+=sparray.ElementAt (pos).ElementAt (3);
  4405. str+=";";
  4406. pos++;
  4407. }
  4408. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4409. m_Print.DrawRect2(StrRect, 2);
  4410. StrRect=load2.m_rcarray .ElementAt (++rcpos);//14
  4411. if(needaddrow>0)
  4412. addcount=1;
  4413. else
  4414. addcount=0;
  4415. needaddrow--;
  4416. str.Empty ();
  4417. for( i=0; i<rowcount+addcount; i++)
  4418. {
  4419. str+=sparray.ElementAt (pos).ElementAt (5);
  4420. str+=" 数量:";
  4421. str+=sparray.ElementAt (pos).ElementAt (3);
  4422. str+=";";
  4423. pos++;
  4424. }
  4425. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4426. m_Print.DrawRect2(StrRect, 2);*/
  4427. CRect sprc[2];
  4428. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4429. // AutoDraw(m_Print, StrRect, m_bz.Left (leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4430. m_Print.DrawRect2(StrRect, 2);
  4431. sprc[0] = StrRect;
  4432. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4433. // AutoDraw(m_Print, StrRect, m_bz.Right (leng-leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4434. m_Print.DrawRect2(StrRect, 2);
  4435. sprc[1] = StrRect;
  4436. //AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4437. {
  4438. CString temp, tempspno, tempbz;
  4439. CSize size;
  4440. BOOL bRun = 0;
  4441. int fontsize = 12;
  4442. ll: tempspno = m_bz;
  4443. m_Print.SetFontFace(fontsize, 1, "宋体");
  4444. for (i = 0; i<2; i++)
  4445. {
  4446. if (!tempspno.IsEmpty())
  4447. {
  4448. temp = tempspno;
  4449. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4450. int right = 0;
  4451. CRect temprc = sprc[i];
  4452. while (size.cx>temprc.Width())
  4453. {
  4454. right++;
  4455. temp = tempspno.Left(tempspno.GetLength() - (right));
  4456. if (GIsHalfHZ(temp))
  4457. {
  4458. right++;
  4459. temp.Delete(temp.GetLength() - 1);
  4460. }
  4461. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4462. }
  4463. if (bRun)
  4464. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4465. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  4466. if (tempspno.IsEmpty())i++;
  4467. }
  4468. }
  4469. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  4470. {
  4471. fontsize--;
  4472. goto ll;
  4473. }
  4474. if (bRun == 0)
  4475. {
  4476. bRun = 1;
  4477. goto ll;
  4478. }
  4479. }
  4480. m_Print.SetFontFace(11, 1, "宋体");
  4481. //////////////////////load3
  4482. rcpos = -1;
  4483. for (i = 0; i < 24; i++)
  4484. {
  4485. StrRect = load3.m_rcarray.ElementAt(i);
  4486. m_Print.DrawRect2(StrRect, 1);
  4487. }
  4488. CStringArray strarray;
  4489. strarray.Add("营业员");
  4490. strarray.Add("前台接待");
  4491. strarray.Add("化妆师");
  4492. strarray.Add("礼服师");
  4493. strarray.Add("摄影师");
  4494. strarray.Add("摄影助理");
  4495. strarray.Add("美工师");
  4496. strarray.Add("设计师");
  4497. for (i = 0; i < 8; i++)
  4498. {
  4499. StrRect = load3.m_rcarray.ElementAt(i);
  4500. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4501. }
  4502. strarray.RemoveAll();
  4503. strarray.Add(m_ren);
  4504. strarray.Add(g_List1array.ElementAt(0).ElementAt(49));
  4505. strarray.Add(m_waiter2);
  4506. strarray.Add(g_List1array.ElementAt(0).ElementAt(51));
  4507. strarray.Add(m_waiter1);
  4508. strarray.Add(g_List1array.ElementAt(0).ElementAt(50));
  4509. strarray.Add("");
  4510. strarray.Add(m_waiter4);
  4511. for (i = 8; i < 16; i++)
  4512. {
  4513. StrRect = load3.m_rcarray.ElementAt(i);
  4514. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 8), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4515. }
  4516. StrRect = load3.m_rcarray.ElementAt(27);
  4517. m_Print.DrawText((LPTSTR)(LPCTSTR)"客户电话: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4518. StrRect = load3.m_rcarray.ElementAt(28);
  4519. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4520. m_Print.SetFontFace(13, 1, "宋体");
  4521. StrRect = load3.m_rcarray.ElementAt(25);
  4522. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4523. StrRect = load3.m_rcarray.ElementAt(26);
  4524. m_Print.DrawRect2(StrRect, 2);
  4525. StrRect = load3.m_rcarray.ElementAt(24);
  4526. str = "\
  4527. 顾客须知\r\n\
  4528. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  4529. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  4530. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  4531. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  4532. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  4533. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  4534. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  4535. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  4536. AutoDraw(m_Print, StrRect, str, 1.8f);
  4537. PrintPreview dlg;
  4538. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4539. dlg.m_pDC = m_Print.GetPDC();
  4540. if (dlg.DoModal() != IDOK)return;
  4541. //结束打印
  4542. m_Print.EndPage();
  4543. m_Print.EndPrint();
  4544. }
  4545. void CMainFrame::PrintDailyForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4546. {
  4547. // TODO: Add your control notification handler code here
  4548. int pages = Listarray->GetSize() / 46;
  4549. if (Listarray->GetSize() % 46)pages++;
  4550. for (int aa = 0; aa < pages; aa++)
  4551. {
  4552. PrintPreview dlg;
  4553. CPrintRX m_Print;
  4554. m_Print.InitToPrint(NULL, 1);
  4555. m_Print.StartPrint();
  4556. m_Print.StartPage();
  4557. CRect mainrc(0, 0, 560, 793);
  4558. float fscale;
  4559. {
  4560. int w, h;
  4561. m_Print.GetWidHei(w, h);
  4562. fscale = (float)w / (float)h;
  4563. }
  4564. mainrc.DeflateRect(25, 40, 10, 0);
  4565. CRect rc, rc2;
  4566. rc = mainrc;
  4567. rc.bottom = rc.top;
  4568. rc.top -= 20;
  4569. m_Print.SetFontFace(16, 1, "黑体");
  4570. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4571. m_Print.SetFontFace(9, 1, "宋体");
  4572. CString str;
  4573. int wid[4] = { 320, 60, 60, 90 };
  4574. int hei = 16;
  4575. if (fscale > 0.71)hei = 15;
  4576. rc = mainrc;
  4577. rc.bottom = rc.top + hei;
  4578. for (int i = 0; i < 47; i++)
  4579. {
  4580. rc2.top = rc.top + i*hei;
  4581. rc2.bottom = rc.bottom + i*hei;
  4582. rc2.left = rc.left;
  4583. rc2.right = rc.left + wid[0];
  4584. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  4585. for (int j = 0; j<4; j++)
  4586. {
  4587. m_Print.DrawRect2(rc2, 1);
  4588. if (Listarray->GetSize()>aa * 46 + i)
  4589. {
  4590. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  4591. rc2.left += 3;
  4592. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4593. rc2.left -= 3;
  4594. }
  4595. rc2.left += wid[j];
  4596. rc2.right = rc2.left + wid[j + 1];
  4597. }
  4598. }
  4599. rc2.top += 2;
  4600. rc2.left += 2; rc2.right = mainrc.right + 4;
  4601. m_Print.SetFontFace(8, 1, "宋体");
  4602. int infopos = info.Find("***");
  4603. if (infopos != -1)
  4604. {
  4605. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Left(infopos), rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4606. CRect rc3 = rc2;
  4607. rc3.top = rc2.bottom - 4;
  4608. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Right(info.GetLength() - infopos - 3), rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4609. }
  4610. else
  4611. m_Print.DrawText((LPTSTR)(LPCTSTR)info, rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4612. str.Format(" 页:%d/%d", aa + 1, pages);
  4613. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4614. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  4615. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4616. dlg.m_pDC = m_Print.GetPDC();
  4617. // dlg.m_mode=1;
  4618. if (aa == 0)
  4619. {
  4620. if (dlg.DoModal() != IDOK)
  4621. return;
  4622. }
  4623. //结束打印
  4624. m_Print.EndPage();
  4625. m_Print.EndPrint();
  4626. }
  4627. }
  4628. void CMainFrame::PrintLoginForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4629. {
  4630. // TODO: Add your control notification handler code here
  4631. int sinlecount = 33 * 6;
  4632. int pages = Listarray->GetSize() / sinlecount;
  4633. if (Listarray->GetSize() % sinlecount)pages++;
  4634. for (int aa = 0; aa < pages; aa++)
  4635. {
  4636. PrintPreview dlg;
  4637. CPrintRX m_Print;
  4638. m_Print.InitToPrint(NULL, 1);
  4639. m_Print.StartPrint();
  4640. m_Print.StartPage();
  4641. CRect mainrc(0, 0, 560, 793);
  4642. float fscale;
  4643. {
  4644. int w, h;
  4645. m_Print.GetWidHei(w, h);
  4646. fscale = (float)w / (float)h;
  4647. }
  4648. mainrc.DeflateRect(25, 40, 10, 0);
  4649. CString str;
  4650. CRect rc, rc2;
  4651. rc = mainrc;
  4652. rc.bottom = rc.top;
  4653. rc.top -= 20;
  4654. rc.left -= 20;
  4655. m_Print.SetFontFace(12, 1, "黑体");
  4656. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4657. m_Print.SetFontFace(6, 1, "宋体");
  4658. str.Format(" 页:%d/%d", aa + 1, pages);
  4659. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4660. rc.right = mainrc.right + 20;
  4661. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4662. int wid[2] = { 50, 110 };
  4663. int hei = 11;
  4664. rc = mainrc;
  4665. rc.bottom = rc.top + hei;
  4666. rc.top += 10;
  4667. rc.bottom += 10;
  4668. int dtx = rc.Width() / 3 + 18;
  4669. int dty = 380;
  4670. for (int j = 0; j < 6; j++)
  4671. {
  4672. if (Listarray->GetSize() < aa*sinlecount + 33 * (j + 1))continue;
  4673. for (int i = 0; i < 33; i++)
  4674. {
  4675. rc2.top = rc.top + i*hei;
  4676. rc2.bottom = rc.bottom + i*hei;
  4677. rc2.left = rc.left;
  4678. rc2.right = rc.left + wid[0];
  4679. if (i == 0)
  4680. {
  4681. // rc2.left +=wid[1];
  4682. rc2.right += wid[1];
  4683. }
  4684. if (j == 1 || j == 4)
  4685. {
  4686. rc2.left += dtx;
  4687. rc2.right += dtx;
  4688. }
  4689. if (j == 2 || j == 5)
  4690. {
  4691. rc2.left += dtx * 2;
  4692. rc2.right += dtx * 2;
  4693. }
  4694. if (j == 3 || j == 4 || j == 5)
  4695. {
  4696. rc2.top += dty;
  4697. rc2.bottom += dty;
  4698. }
  4699. m_Print.DrawRect2(rc2, 1);
  4700. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4701. {
  4702. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(0);
  4703. rc2.left += 3;
  4704. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4705. rc2.left -= 3;
  4706. }
  4707. if (i == 0)continue;
  4708. rc2.left = rc2.right;
  4709. rc2.right += wid[1];
  4710. m_Print.DrawRect2(rc2, 1);
  4711. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4712. {
  4713. if (Listarray->ElementAt(aa*sinlecount + 33 * j + i).GetSize() > 1)
  4714. {
  4715. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(1);
  4716. rc2.left += 3;
  4717. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4718. rc2.left -= 3;
  4719. }
  4720. }
  4721. /* if(Listarray->GetSize ()>aa*46+i)
  4722. {
  4723. str=Listarray->ElementAt (aa*46+i).ElementAt (j);
  4724. rc2.left +=3;
  4725. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4726. rc2.left -=3;
  4727. }
  4728. rc2.left +=wid[j];
  4729. rc2.right =rc2.left+wid[j+1];*/
  4730. }
  4731. }
  4732. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4733. dlg.m_pDC = m_Print.GetPDC();
  4734. if (aa == 0)
  4735. {
  4736. if (dlg.DoModal() != IDOK)
  4737. return;
  4738. }
  4739. //结束打印
  4740. m_Print.EndPage();
  4741. m_Print.EndPrint();
  4742. }
  4743. }
  4744. void CMainFrame::PrintTakeForm(CArray<CStringArray, CStringArray>*Listarray)
  4745. {
  4746. CString title;
  4747. CString info;
  4748. // TODO: Add your control notification handler code here
  4749. int sinlecount = 4;
  4750. int pages = Listarray->GetSize() / sinlecount;
  4751. if (Listarray->GetSize() % sinlecount)pages++;
  4752. for (int aa = 0; aa < pages; aa++)
  4753. {
  4754. PrintPreview dlg;
  4755. CPrintRX m_Print;
  4756. m_Print.InitToPrint(NULL, 1);
  4757. m_Print.StartPrint();
  4758. m_Print.StartPage();
  4759. CRect mainrc(0, 0, 560, 793);
  4760. float fscale;
  4761. {
  4762. int w, h;
  4763. m_Print.GetWidHei(w, h);
  4764. fscale = (float)w / (float)h;
  4765. }
  4766. mainrc.DeflateRect(25, 40, 10, 0);
  4767. CString str;
  4768. CRect rc, rc2;
  4769. rc = mainrc;
  4770. rc.bottom = rc.top;
  4771. rc.top -= 20;
  4772. rc.left -= 20;
  4773. m_Print.SetFontFace(6, 1, "宋体");
  4774. str.Format(" 页:%d/%d", aa + 1, pages);
  4775. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4776. rc.right = mainrc.right + 10;
  4777. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4778. m_Print.SetFontFace(12, 1, "宋体");
  4779. int wid[2] = { 70, 190 };
  4780. int hei = 22;
  4781. rc = mainrc;
  4782. rc.bottom = rc.top + hei;
  4783. rc.top += 10;
  4784. rc.bottom += 10;
  4785. int dtx = rc.Width() / 2 + 18;
  4786. int dty = 380;
  4787. int arraysize = Listarray->ElementAt(0).GetSize();
  4788. for (int j = 0; j < 4; j++)
  4789. {
  4790. if (Listarray->GetSize() <= aa*sinlecount + j)continue;
  4791. for (int i = 0; i < arraysize; i++)
  4792. {
  4793. rc2.top = rc.top + i / 2 * hei;
  4794. rc2.bottom = rc.bottom + i / 2 * hei;
  4795. rc2.left = rc.left;
  4796. rc2.right = rc.left + wid[0];
  4797. if (i % 2)
  4798. {
  4799. rc2.left = rc2.right;
  4800. rc2.right += wid[1];
  4801. }
  4802. if (j == 1 || j == 3)
  4803. {
  4804. rc2.left += dtx;
  4805. rc2.right += dtx;
  4806. }
  4807. if (j == 2 || j == 3)
  4808. {
  4809. rc2.top += dty;
  4810. rc2.bottom += dty;
  4811. }
  4812. if (i == arraysize - 1 || i == arraysize - 2)
  4813. {
  4814. rc2.bottom += hei * 2;
  4815. }
  4816. m_Print.DrawRect2(rc2, 1);
  4817. {
  4818. str = Listarray->ElementAt(aa*sinlecount + j).ElementAt(i);
  4819. if (i == arraysize - 1)
  4820. {
  4821. CRect rc3 = rc2;
  4822. rc3.left += 3;
  4823. rc3.top += 3;
  4824. AutoDraw(m_Print, rc3, str, 1.4f);
  4825. }
  4826. else if (i == arraysize - 2)
  4827. {
  4828. CRect rc3 = rc2;
  4829. rc3.left += 3;
  4830. rc3.top += 3;
  4831. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4832. }
  4833. else
  4834. {
  4835. rc2.left += 3;
  4836. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4837. rc2.left -= 3;
  4838. }
  4839. }
  4840. }
  4841. }
  4842. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4843. dlg.m_pDC = m_Print.GetPDC();
  4844. if (aa == 0)
  4845. {
  4846. if (dlg.DoModal() != IDOK)
  4847. return;
  4848. }
  4849. //结束打印
  4850. m_Print.EndPage();
  4851. m_Print.EndPrint();
  4852. }
  4853. }
  4854. void CMainFrame::PrintThumbNail(CStringArray *array, CString client, BOOL bDir, CString m_size)
  4855. {
  4856. // TODO: Add your control notification handler code here
  4857. CStringArray titlearray;
  4858. CStringArray namearray;
  4859. CStringArray noarray;
  4860. CArray<CRect, CRect>rcarray;
  4861. CArray<CRect, CRect>widtharray;
  4862. if (m_size != "")
  4863. {
  4864. int pos = m_size.Find(";");
  4865. while (pos != -1)
  4866. {
  4867. CString size = m_size.Left(pos);
  4868. int pos2 = size.Find(":");
  4869. if (pos2 != -1)
  4870. {
  4871. CString str;
  4872. CRect rc;
  4873. str = size.Left(pos2);
  4874. noarray.Add(str);
  4875. str = size.Right(size.GetLength() - pos2 - 1);
  4876. pos2 = str.Find(",");
  4877. namearray.Add(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4878. pos2 = str.Find(",");
  4879. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4880. pos2 = str.Find(",");
  4881. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4882. widtharray.Add(rc);
  4883. pos2 = str.Find(",");
  4884. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4885. pos2 = str.Find(",");
  4886. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4887. pos2 = str.Find(",");
  4888. rc.right = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4889. rc.bottom = atoi(str);
  4890. rcarray.Add(rc);
  4891. }
  4892. m_size = m_size.Right(m_size.GetLength() - pos - 1);
  4893. pos = m_size.Find(";");
  4894. }
  4895. }
  4896. PrintPreview dlg;
  4897. CPrintRX m_Print;
  4898. m_Print.InitToPrint(NULL, 1);
  4899. m_Print.StartPrint();
  4900. m_Print.StartPage();
  4901. CRect mainrc(0, 0, 560, 793);
  4902. mainrc.DeflateRect(25, 50, 10, 0);
  4903. m_Print.SetFontFace(10, 1, "宋体");
  4904. CRect rc, rc2;
  4905. rc = mainrc;
  4906. rc.bottom = rc.top;
  4907. rc.top -= 20;
  4908. m_Print.DrawText((LPTSTR)(LPCTSTR)client, rc, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4909. rc.bottom -= 5;
  4910. m_Print.DrawRect2(rc, 2);
  4911. if (array->GetSize() > 130)m_Print.SetFontFace(8, 1, "宋体");
  4912. if (bDir)m_Print.SetFontFace(6, 1, "宋体");
  4913. ////////////////////////////////////////////////////////////////
  4914. int imgcount = array->GetSize();
  4915. int dtx = 5;
  4916. int dty = 15;
  4917. int cx, cy;
  4918. int countx = 5;
  4919. int county = 1;
  4920. while (1)
  4921. {
  4922. if (countx*county >= imgcount)
  4923. {
  4924. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  4925. cy = cx * 4 / 3;
  4926. break;
  4927. }
  4928. else
  4929. {
  4930. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  4931. cy = cx * 4 / 3;
  4932. if (cy*(county + 1) + dty*county < mainrc.Height())//Y方向可以增加一个
  4933. {
  4934. county++;
  4935. }
  4936. else//Y方向不能加,X方向加
  4937. {
  4938. countx++;
  4939. county = 1;
  4940. }
  4941. }
  4942. }
  4943. int imgpos = 0;
  4944. CString stemp;
  4945. CPen pen(PS_SOLID, 1, RGB(255, 0, 0));
  4946. CPen *oldpen = m_Print.m_DC.SelectObject(&pen);
  4947. CPen *oldpen2 = m_Print.m_memdc.SelectObject(&pen);
  4948. for (int i = 0; i < county; i++)
  4949. {
  4950. for (int j = 0; j < countx; j++)
  4951. {
  4952. rc = mainrc;
  4953. rc.top += i*(cy + dty);
  4954. rc.left += j*(cx + dtx);
  4955. rc.right = rc.left + cx;
  4956. rc.bottom = rc.top + cy;
  4957. Image *pImg = NULL;
  4958. if (imgpos >= array->GetSize())break;
  4959. CString str = array->ElementAt(imgpos);
  4960. CString spath = str.Left(str.ReverseFind('\\') + 1);
  4961. spath += "m";
  4962. spath += str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  4963. if (PathFileExists(spath))
  4964. ::LoadImageFromBuf(&pImg, spath);
  4965. else
  4966. {
  4967. ::LoadImageFromBuf(&pImg, str);
  4968. if (pImg == NULL)continue;
  4969. int orientation = GetOrientation(pImg);
  4970. if (orientation == 8)
  4971. pImg->RotateFlip(Rotate270FlipNone);
  4972. else if (orientation == 6)
  4973. pImg->RotateFlip(Rotate90FlipNone);
  4974. }
  4975. if (pImg == NULL)continue;
  4976. rc2 = rc;
  4977. RectFitDes(pImg->GetWidth(), pImg->GetHeight(), rc);
  4978. imgpos++;
  4979. m_Print.DrawImage(pImg, rc);
  4980. int imgwidth = pImg->GetWidth();
  4981. delete pImg;
  4982. rc2.top = rc2.bottom + 3;
  4983. rc2.bottom += 10;
  4984. if (bDir == 0)
  4985. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  4986. else
  4987. {
  4988. stemp = str.Left(str.ReverseFind('\\'));
  4989. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  4990. if (stemp.ReverseFind('\\') != -1)
  4991. {
  4992. stemp = stemp.Right(stemp.GetLength() - stemp.ReverseFind('\\') - 1);
  4993. str = stemp + "\\" + str;
  4994. }
  4995. }
  4996. if (str.Find(".") != -1)
  4997. str = str.Left(str.Find("."));
  4998. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  4999. if (noarray.GetSize())
  5000. {
  5001. rc2 = rc;
  5002. for (int aa = 0; aa < noarray.GetSize(); aa++)
  5003. {
  5004. float scale = (float)rc2.Width() / (float)imgwidth;
  5005. if (noarray.ElementAt(aa) == str)
  5006. {
  5007. int nIndex = aa;
  5008. CRect rc = rcarray.ElementAt(nIndex);
  5009. int wid = widtharray.ElementAt(nIndex).left;
  5010. int hei = widtharray.ElementAt(nIndex).top;
  5011. scale *= (float)imgwidth / (float)wid;
  5012. rc.left *= scale;
  5013. rc.right *= scale;
  5014. rc.top *= scale;
  5015. rc.bottom *= scale;
  5016. rc.left += rc2.left;
  5017. rc.right += rc2.left;
  5018. rc.top += rc2.top;
  5019. rc.bottom += rc2.top;
  5020. if (rc.left < rc2.left)rc.left = rc2.left;
  5021. if (rc.right > rc2.right)rc.right = rc2.right;
  5022. if (rc.top < rc2.top)rc.top = rc2.top;
  5023. if (rc.bottom > rc2.bottom)rc.bottom = rc2.bottom;
  5024. m_Print.DrawRect2(rc, 1);
  5025. }
  5026. }
  5027. }
  5028. }
  5029. }
  5030. m_Print.m_DC.SelectObject(oldpen);
  5031. m_Print.m_memdc.SelectObject(oldpen2);
  5032. /* CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  5033. StrRect.top -=15;StrRect.bottom -=15;
  5034. Image *pImg=NULL;
  5035. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  5036. m_Print.DrawImage(pImg, StrRect);
  5037. delete pImg;
  5038. m_Print.SetFontFace(10, 1, "宋体");
  5039. StrRect=load.m_rcarray .ElementAt (20);
  5040. StrRect.right=load.m_rcarray .ElementAt (23).right;
  5041. StrRect.top -=18;StrRect.bottom -=18;
  5042. CString str="地址:"+g_cominfoarray.ElementAt (0).ElementAt (12);
  5043. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5044. */
  5045. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  5046. dlg.m_pDC = m_Print.GetPDC();
  5047. if (dlg.DoModal() != IDOK)
  5048. return;
  5049. //结束打印
  5050. m_Print.EndPage();
  5051. m_Print.EndPrint();
  5052. }
  5053. // remark by Jeff
  5054. // 函数:PrintDinDan
  5055. // 参数:
  5056. // strOrderNumber:订单单号;(Order number)
  5057. // 返回:void
  5058. // 注意:#
  5059. void CMainFrame::PrintDinDan(CString strOrderNumber)//打印订单报表;
  5060. {
  5061. int printcot = 1;
  5062. for (int aa = 0; aa < printcot; aa++)
  5063. {
  5064. PrintPreview dlg;
  5065. CPrintRX m_Print;
  5066. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  5067. {
  5068. m_Print.InitToPrint(NULL, 1);
  5069. }
  5070. else
  5071. {
  5072. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  5073. if (name.IsEmpty())
  5074. m_Print.InitToPrint(NULL, 1);
  5075. else
  5076. {
  5077. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  5078. if (nret == -1 && aa == 0)
  5079. {
  5080. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  5081. }
  5082. }
  5083. }
  5084. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 0)
  5085. {
  5086. #ifdef ZHIAI_VERSION
  5087. PrintDinDan3(strOrderNumber);
  5088. return;
  5089. #endif
  5090. #ifdef SZBLCT_VERSION
  5091. PrintDinDan4(strOrderNumber);
  5092. return;
  5093. #endif
  5094. m_Print.StartPrint();
  5095. m_Print.StartPage();
  5096. LoadRect load;
  5097. load.SetLiaPath("6.lia");
  5098. load.SetMargins(-14, 15);
  5099. if (!load.Load())return;
  5100. LoadRect load2;
  5101. load2.SetLiaPath("7.lia");
  5102. load2.SetMargins(-14, 216 + 15);
  5103. if (!load2.Load())return;
  5104. LoadRect load3;
  5105. load3.SetLiaPath("8.lia");
  5106. load3.SetMargins(-14, 705 + 15);
  5107. if (!load3.Load())return;
  5108. int i;
  5109. //////////////////////////////////////////////////////////////
  5110. CStringArray txarray;
  5111. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  5112. g_sendhead.code[0] = 11;
  5113. g_sendhead.code[1] = 52;
  5114. g_sendhead.code[2] = 50;
  5115. g_sendhead.code[3] = 150;
  5116. g_sendhead.code[4] = 77;
  5117. g_sendhead.code[5] = 4;
  5118. g_sendhead.tabcount = 6;
  5119. g_sendhead.bsql = 0;
  5120. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5121. CArray<CStringArray, CStringArray>sparray;
  5122. CArray<CStringArray, CStringArray>clientarray;
  5123. CArray<CStringArray, CStringArray>phonearray;
  5124. CArray<CStringArray, CStringArray>fgarray;
  5125. CArray<CStringArray, CStringArray>danweiarray;
  5126. CArray<CStringArray, CStringArray>jdarray;
  5127. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5128. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5129. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5130. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5131. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5132. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5133. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5134. CString m_taoxiname;
  5135. if (m_zs.Find("\\") != -1)
  5136. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  5137. else
  5138. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  5139. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5140. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5141. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5142. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5143. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5144. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5145. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5146. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5147. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5148. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5149. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5150. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5151. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5152. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5153. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5154. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5155. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5156. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5157. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5158. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5159. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5160. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5161. if (jdarray.GetSize())
  5162. {
  5163. if (m_bz.IsEmpty() == 0)
  5164. m_bz = "\r\n" + m_bz;
  5165. m_bz += "景点:";
  5166. }
  5167. #ifdef DDF_VERSION
  5168. m_bz += "219店:219路馨园小区对面\r\n";
  5169. m_bz += "金色店:万科金色家园小区东门南走20米荣光社区一楼\r\n";
  5170. m_bz += "万泰店:万泰锦绣华城小区正门\r\n";
  5171. #else
  5172. for (i = 0; i < jdarray.GetSize(); i++)
  5173. {
  5174. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5175. }
  5176. m_bz.TrimRight(";");
  5177. #endif
  5178. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5179. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5180. if (IsHasRights2new(31) == 0)
  5181. {
  5182. m_phone1 = "***";
  5183. m_phone2 = "***";
  5184. }
  5185. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5186. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5187. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  5188. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  5189. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  5190. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  5191. filter = "name='" + m_ren + "'";
  5192. g_sendhead.code[0] = 5;
  5193. g_sendhead.tabcount = 1;
  5194. g_sendhead.bsql = 0;
  5195. int g_nYearposTemp = g_nYearpos;
  5196. g_nYearpos = -1;
  5197. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5198. g_nYearpos = g_nYearposTemp;
  5199. if (g_bSendOK == 0)return;
  5200. DataToArray(&phonearray);
  5201. m_money1.Format("%f", atof(m_taoxijiage));
  5202. m_money2.Format("%f", atof(m_payed1));
  5203. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5204. ConvertToPrice(m_money1);
  5205. ConvertToPrice(m_money2);
  5206. ConvertToPrice(m_money3);
  5207. ////////////////////////////////////////////////////////////////
  5208. int rcpos = -1;
  5209. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  5210. StrRect.top -= 15; StrRect.bottom -= 15;
  5211. Image *pImg = NULL;
  5212. #ifdef MNLS_VERSION
  5213. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  5214. #else
  5215. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  5216. #endif
  5217. m_Print.DrawImage(pImg, StrRect);
  5218. delete pImg;
  5219. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5220. {
  5221. Image *pImg = NULL;
  5222. g_nSendCode = 31;
  5223. int g_nYearposTemp = g_nYearpos;
  5224. g_nYearpos = -1;
  5225. g_pMainWnd->ProcessChatMessageRequest2(1);
  5226. g_nYearpos = g_nYearposTemp;
  5227. g_nSendCode = 0;
  5228. if (g_bSendOK == 0)return;
  5229. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5230. if (pImg)
  5231. {
  5232. StrRect.left = 30;
  5233. StrRect.top = 12;
  5234. StrRect.right = StrRect.left + 60;
  5235. StrRect.bottom = StrRect.top + 60;
  5236. m_Print.DrawImage(pImg, StrRect);
  5237. delete pImg; pImg = NULL;
  5238. }
  5239. }
  5240. m_Print.SetFontFace(11, 1, "宋体");
  5241. StrRect = load.m_rcarray.ElementAt(20);
  5242. StrRect.right = load.m_rcarray.ElementAt(23).right;
  5243. StrRect.top -= 18; StrRect.bottom -= 18;
  5244. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  5245. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5246. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  5247. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5248. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5249. StrRect.top -= 15; StrRect.bottom -= 15;
  5250. #ifdef MNLS_VERSION
  5251. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5252. #endif
  5253. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5254. StrRect.top -= 15; StrRect.bottom -= 15;
  5255. #ifdef MNLS_VERSION
  5256. m_Print.DrawRect(StrRect);
  5257. #endif
  5258. m_Print.SetFontFace(7, 1, "黑体");
  5259. m_Print.SetColor(0xffffff);
  5260. #ifdef MNLS_VERSION
  5261. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5262. #endif
  5263. m_Print.SetColor(0);
  5264. m_Print.SetFontFace(15, 1, "宋体");
  5265. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5266. StrRect.top -= 15; StrRect.bottom -= 15;
  5267. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同预约订单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5268. CStringArray strarray;
  5269. strarray.Add("NO: " + strOrderNumber);
  5270. CString date;
  5271. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  5272. strarray.Add(date);
  5273. strarray.Add("喜爱");
  5274. strarray.Add("格调");
  5275. if (fgarray.GetSize() == 12)
  5276. {
  5277. for (int i = 0; i < 12; i++)
  5278. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  5279. }
  5280. else
  5281. {
  5282. strarray.Add("复古典雅");
  5283. strarray.Add("温文尔雅");
  5284. strarray.Add("豪华艳丽");
  5285. strarray.Add("传统大方");
  5286. strarray.Add("新潮个性");
  5287. strarray.Add("浪漫奔放");
  5288. strarray.Add("简单素雅");
  5289. strarray.Add("活泼俏丽");
  5290. strarray.Add("妩媚温馨");
  5291. strarray.Add("温柔贤惠");
  5292. strarray.Add("成熟感性");
  5293. strarray.Add("清纯可爱");
  5294. }
  5295. strarray.Add("姓名");
  5296. // strarray.Add("职业");
  5297. strarray.Add("");
  5298. strarray.Add("地址");
  5299. strarray.Add("电话");
  5300. #ifdef CHILD_VERSION
  5301. strarray.Add("家长");
  5302. strarray.Add("宝宝");
  5303. #else
  5304. strarray.Add("先生");
  5305. strarray.Add("女士");
  5306. #endif
  5307. m_Print.SetFontFace(11, 1, "宋体");
  5308. for (i = 0; i < strarray.GetSize(); i++)
  5309. {
  5310. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5311. if (i < 2)
  5312. {
  5313. StrRect.top -= 15; StrRect.bottom -= 15;
  5314. }
  5315. if (i>15)
  5316. m_Print.DrawRect2(StrRect, 1);
  5317. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5318. }
  5319. for (i = 29; i <= 40; i++)
  5320. {
  5321. if (m_style.GetLength() <= (i - 29))continue;
  5322. if (m_style.GetAt(i - 29) != '1')continue;
  5323. StrRect = load.m_rcarray.ElementAt(i - 1);
  5324. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5325. }
  5326. for (i = 27; i <= 48; i++)
  5327. {
  5328. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5329. m_Print.DrawRect2(StrRect, 1);
  5330. }
  5331. #ifdef CHILD_VERSION
  5332. StrRect = load.m_rcarray.ElementAt(45);
  5333. StrRect.right = StrRect.left + 62;
  5334. m_Print.DrawRect2(StrRect, 1);
  5335. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5336. StrRect.left = StrRect.right;
  5337. StrRect.right = StrRect.left + 62;
  5338. m_Print.DrawRect2(StrRect, 1);
  5339. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5340. StrRect.left = StrRect.right;
  5341. StrRect.right = StrRect.left + 62;
  5342. m_Print.DrawRect2(StrRect, 1);
  5343. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5344. StrRect.left = StrRect.right;
  5345. StrRect.right = StrRect.left + 62;
  5346. m_Print.DrawRect2(StrRect, 1);
  5347. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5348. #endif
  5349. /////////////////////////
  5350. strarray.RemoveAll();
  5351. CString temp;
  5352. temp.Format("拍摄多款选 %d 款,其中影", atoi(m_outside) + atoi(m_outside2));
  5353. strarray.Add(temp);
  5354. temp.Format("棚景 %d 款,景点 %d 款.", atoi(m_outside2), atoi(m_outside));
  5355. strarray.Add(temp);
  5356. strarray.Add("化妆");
  5357. strarray.Add("造型");
  5358. #ifdef CHILD_VERSION
  5359. strarray.Add("");
  5360. #else
  5361. strarray.Add("婚纱");
  5362. #endif
  5363. strarray.Add("服饰");
  5364. strarray.Add("配");
  5365. strarray.Add("置");
  5366. strarray.Add("其");
  5367. strarray.Add("它");
  5368. strarray.Add("套系名称");
  5369. strarray.Add("镜款");
  5370. strarray.Add("套系总价");
  5371. strarray.Add("主摄影师");
  5372. strarray.Add("拍摄日期");
  5373. strarray.Add("定金");
  5374. #ifdef CHILD_VERSION
  5375. strarray.Add("主引导师");
  5376. #else
  5377. strarray.Add("主化妆师");
  5378. #endif
  5379. strarray.Add("看样日期");
  5380. strarray.Add("欠款余额");
  5381. strarray.Add("总监");
  5382. strarray.Add("取件日期");
  5383. rcpos = -1;
  5384. for (i = 0; i < strarray.GetSize(); i++)
  5385. {
  5386. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5387. if (i>9)
  5388. m_Print.DrawRect2(StrRect, 1);
  5389. #ifdef CHILD_VERSION
  5390. if (i == 5)
  5391. StrRect.top -= StrRect.Height();
  5392. #endif
  5393. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5394. }
  5395. for (i = 22; i <= 41; i++)
  5396. {
  5397. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5398. m_Print.DrawRect2(StrRect, 1);
  5399. }
  5400. /////////////////////////////
  5401. strarray.RemoveAll();
  5402. #ifdef CHILD_VERSION
  5403. strarray.Add("顾客方 家长:");
  5404. strarray.Add("宝宝:");
  5405. #else
  5406. strarray.Add("顾客方 先生:");
  5407. strarray.Add("女士:");
  5408. #endif
  5409. strarray.Add("电话:");
  5410. strarray.Add("影楼方 店长:");
  5411. strarray.Add("接单人:");
  5412. strarray.Add("电话:");
  5413. rcpos = -1;
  5414. for (i = 0; i < strarray.GetSize(); i++)
  5415. {
  5416. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5417. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5418. }
  5419. for (i = 7; i <= 12; i++)
  5420. {
  5421. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5422. // if(i!=10)
  5423. m_Print.DrawRect2(StrRect, 2);
  5424. }
  5425. //////////////////////////////////////
  5426. //开始打数据
  5427. strarray.RemoveAll();
  5428. strarray.Add(m_name1);
  5429. strarray.Add(m_name2);
  5430. /// strarray.Add (m_occupation1);
  5431. // strarray.Add (m_occupation2);
  5432. strarray.Add("");
  5433. strarray.Add("");
  5434. strarray.Add(m_addr1);
  5435. #ifdef CHILD_VERSION
  5436. strarray.Add("");
  5437. #else
  5438. strarray.Add(m_addr2);
  5439. #endif
  5440. strarray.Add(m_phone1);
  5441. strarray.Add(m_phone2);
  5442. for (i = 41; i <= 48; i++)
  5443. {
  5444. StrRect = load.m_rcarray.ElementAt(i - 1);
  5445. StrRect.left += 4;
  5446. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5447. }
  5448. ///////////////////////////////
  5449. strarray.RemoveAll();
  5450. strarray.Add(m_money1);
  5451. strarray.Add(m_waiter1);
  5452. strarray.Add(m_time2);
  5453. strarray.Add(m_money2);
  5454. strarray.Add(m_waiter2);
  5455. strarray.Add(m_time4);
  5456. strarray.Add(m_money3);
  5457. strarray.Add("");
  5458. strarray.Add(m_time5);
  5459. for (i = 32; i <= 40; i++)
  5460. {
  5461. StrRect = load2.m_rcarray.ElementAt(i - 1);
  5462. StrRect.left += 4;
  5463. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5464. }
  5465. ///////////////////////////////
  5466. strarray.RemoveAll();
  5467. strarray.Add(m_name1);
  5468. strarray.Add(m_name2);
  5469. CString phone;
  5470. if (m_phone1.IsEmpty() == 0)
  5471. phone = m_phone1 + ",";
  5472. phone += m_phone2;
  5473. phone.TrimRight(",");
  5474. strarray.Add(phone);
  5475. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  5476. strarray.Add(m_ren);
  5477. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  5478. for (i = 7; i <= 12; i++)
  5479. {
  5480. StrRect = load3.m_rcarray.ElementAt(i - 1);
  5481. StrRect.left += 4;
  5482. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5483. }
  5484. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  5485. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5486. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  5487. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5488. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  5489. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5490. //////////////////////////////
  5491. //开始画文字
  5492. StrRect = load2.m_rcarray.ElementAt(30);
  5493. StrRect.left += 3;
  5494. StrRect.top += 3;
  5495. StrRect.right -= 2;
  5496. StrRect.bottom -= 2;
  5497. AutoDraw(m_Print, StrRect, m_bz, 1.4f);
  5498. StrRect = load2.m_rcarray.ElementAt(29);
  5499. StrRect.left += 3;
  5500. StrRect.top += 3;
  5501. StrRect.right -= 2;
  5502. StrRect.bottom -= 2;
  5503. str = "";
  5504. for (i = 0; i < sparray.GetSize(); i++)
  5505. {
  5506. str += sparray.ElementAt(i).ElementAt(5);
  5507. str += " 数量:";
  5508. str += sparray.ElementAt(i).ElementAt(3);
  5509. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5510. str += "\r\n";
  5511. }
  5512. str.TrimRight("\r\n");
  5513. AutoDraw(m_Print, StrRect, str, 1.4);
  5514. StrRect = load2.m_rcarray.ElementAt(40);
  5515. StrRect.top += 8;
  5516. m_Print.SetFontFace(12, 1, "黑体");
  5517. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5518. StrRect.left += 3;
  5519. StrRect.top += 30;
  5520. StrRect.right -= 2;
  5521. StrRect.bottom -= 2;
  5522. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5523. if (str.IsEmpty())
  5524. {
  5525. str = "\
  5526. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5527. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5528. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5529. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5530. 持良好的心境.\r\n\
  5531. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5532. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5533. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5534. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5535. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5536. 勿进影室, 以免影响拍摄.\r\n\
  5537. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5538. 师或店长沟通.\r\n\
  5539. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5540. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5541. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5542. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5543. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5544. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5545. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5546. 还.";
  5547. }
  5548. AutoDraw(m_Print, StrRect, str, 1.8);
  5549. }
  5550. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 1)
  5551. {//AfxMessageBox("yyy");
  5552. m_Print.StartPrint();
  5553. m_Print.StartPage();
  5554. LoadRect load;
  5555. load.SetLiaPath("6-2.lia");
  5556. load.SetMargins(0, 0);
  5557. if (!load.Load())return;
  5558. int i;
  5559. //////////////////////////////////////////////////////////////
  5560. CStringArray txarray;
  5561. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  5562. g_sendhead.code[0] = 11;
  5563. g_sendhead.code[1] = 52;
  5564. g_sendhead.code[2] = 50;
  5565. g_sendhead.code[3] = 150;
  5566. g_sendhead.code[4] = 77;
  5567. g_sendhead.code[5] = 4;
  5568. g_sendhead.tabcount = 6;
  5569. g_sendhead.bsql = 0;
  5570. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5571. CArray<CStringArray, CStringArray>sparray;
  5572. CArray<CStringArray, CStringArray>clientarray;
  5573. CArray<CStringArray, CStringArray>phonearray;
  5574. CArray<CStringArray, CStringArray>fgarray;
  5575. CArray<CStringArray, CStringArray>danweiarray;
  5576. CArray<CStringArray, CStringArray>jdarray;
  5577. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5578. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5579. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5580. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5581. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5582. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5583. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  5584. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5585. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5586. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5587. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5588. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5589. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5590. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5591. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5592. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5593. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5594. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5595. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5596. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5597. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5598. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5599. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5600. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5601. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5602. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5603. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5604. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5605. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5606. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5607. if (jdarray.GetSize())
  5608. {
  5609. if (m_bz.IsEmpty() == 0)
  5610. m_bz = "\r\n" + m_bz;
  5611. m_bz += "景点:";
  5612. }
  5613. for (i = 0; i < jdarray.GetSize(); i++)
  5614. {
  5615. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5616. }
  5617. m_bz.TrimRight(";");
  5618. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5619. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5620. if (IsHasRights2new(31) == 0)
  5621. {
  5622. m_phone1 = "***";
  5623. m_phone2 = "***";
  5624. }
  5625. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5626. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5627. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  5628. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  5629. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  5630. CString str;
  5631. filter = "name='" + m_ren + "'";
  5632. g_sendhead.code[0] = 5;
  5633. g_sendhead.tabcount = 1;
  5634. g_sendhead.bsql = 0;
  5635. int g_nYearposTemp = g_nYearpos;
  5636. g_nYearpos = -1;
  5637. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5638. g_nYearpos = g_nYearposTemp;
  5639. if (g_bSendOK == 0)return;
  5640. DataToArray(&phonearray);
  5641. m_money1.Format("%f", atof(m_taoxijiage));
  5642. m_money2.Format("%f", atof(m_payed1));
  5643. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5644. ConvertToPrice(m_money1);
  5645. ConvertToPrice(m_money2);
  5646. ConvertToPrice(m_money3);
  5647. ////////////////////////////////////////////////////////////////
  5648. int rcpos = -1;
  5649. CRect StrRect = load.m_rcarray.ElementAt(0);
  5650. m_Print.SetFontFace(25, 1, "黑体");
  5651. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "预约单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5652. m_Print.SetFontFace(11, 1, "宋体");
  5653. StrRect = load.m_rcarray.ElementAt(1);
  5654. if (m_time1.GetLength() == 10)
  5655. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  5656. else
  5657. str = "开单日期:";
  5658. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5659. StrRect = load.m_rcarray.ElementAt(2);
  5660. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + strOrderNumber), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5661. CStringArray strarray;
  5662. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5663. {
  5664. Image *pImg = NULL;
  5665. g_nSendCode = 31;
  5666. int g_nYearposTemp = g_nYearpos;
  5667. g_nYearpos = -1;
  5668. g_pMainWnd->ProcessChatMessageRequest2(1);
  5669. g_nYearpos = g_nYearposTemp;
  5670. g_nSendCode = 0;
  5671. if (g_bSendOK == 0)return;
  5672. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5673. if (pImg)
  5674. {
  5675. StrRect.left = 47;
  5676. StrRect.top = 12;
  5677. StrRect.right = StrRect.left + 60;
  5678. StrRect.bottom = StrRect.top + 60;
  5679. m_Print.DrawImage(pImg, StrRect);
  5680. delete pImg; pImg = NULL;
  5681. }
  5682. }
  5683. #ifdef CHILD_VERSION
  5684. strarray.Add("家长姓名");
  5685. strarray.Add("宝宝姓名");
  5686. #else
  5687. strarray.Add("先生姓名");
  5688. strarray.Add("女士姓名");
  5689. #endif
  5690. strarray.Add("服装套数");
  5691. // strarray.Add ("拍摄张数");
  5692. #ifdef CHILD_VERSION
  5693. strarray.Add("出生日期");
  5694. #else
  5695. strarray.Add("结婚日期");
  5696. #endif
  5697. strarray.Add("拍摄日期");
  5698. strarray.Add("联系电话");
  5699. strarray.Add("联系电话");
  5700. strarray.Add("造型套数");
  5701. if (m_zs.Find("\\") != -1)
  5702. strarray.Add("入底\\入册");
  5703. else
  5704. strarray.Add("入底张数");
  5705. strarray.Add("选片日期");
  5706. strarray.Add("QQ/邮箱");
  5707. strarray.Add("套系总额");
  5708. strarray.Add("定金");
  5709. strarray.Add("余款金额");
  5710. strarray.Add("取件日期");
  5711. strarray.Add(m_name1);
  5712. strarray.Add(m_name2);
  5713. strarray.Add(m_clothescount);
  5714. // str.Format("%d", atoi(m_zs)*3);
  5715. // strarray.Add (str);
  5716. #ifdef CHILD_VERSION
  5717. strarray.Add(m_birthday1);
  5718. #else
  5719. strarray.Add(m_time3);
  5720. #endif
  5721. strarray.Add(m_time2);
  5722. strarray.Add(m_phone1);
  5723. strarray.Add(m_phone2);
  5724. strarray.Add(m_clothescount2);
  5725. strarray.Add(m_zs);
  5726. strarray.Add(m_time4);
  5727. strarray.Add(m_qq1);
  5728. strarray.Add(m_money1);
  5729. strarray.Add(m_money2);
  5730. strarray.Add(m_money3);
  5731. strarray.Add(m_time5);
  5732. for (i = 4; i <= 33; i++)
  5733. {
  5734. StrRect = load.m_rcarray.ElementAt(i - 1);
  5735. m_Print.DrawRect2(StrRect, 1);
  5736. if (strarray.GetSize() > (i - 4))
  5737. {
  5738. if (i <= 18)
  5739. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5740. else
  5741. {
  5742. StrRect.left += 4;
  5743. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5744. }
  5745. }
  5746. }
  5747. int dt = 413;
  5748. StrRect = load.m_rcarray.ElementAt(36); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5749. m_Print.DrawText((LPTSTR)(LPCTSTR)"门市签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5750. StrRect = load.m_rcarray.ElementAt(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5751. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5752. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5753. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5754. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  5755. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5756. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  5757. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5758. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  5759. m_Print.DrawText((LPTSTR)(LPCTSTR)("网址:" + g_cominfoarray.ElementAt(0).ElementAt(13)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5760. //////////////////////////////
  5761. //开始画文字
  5762. StrRect = load.m_rcarray.ElementAt(7);
  5763. int hei = StrRect.Height();
  5764. StrRect.top += hei;
  5765. StrRect.bottom += hei;
  5766. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5767. StrRect.top += dt;
  5768. StrRect.bottom += dt;
  5769. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5770. StrRect = load.m_rcarray.ElementAt(17);
  5771. StrRect.top += hei;
  5772. StrRect.bottom += hei;
  5773. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5774. StrRect = load.m_rcarray.ElementAt(33);
  5775. StrRect.bottom = StrRect.top + dt; m_Print.DrawRect2(StrRect, 1);
  5776. StrRect.top += hei;
  5777. StrRect.left += 3;
  5778. StrRect.top += 3;
  5779. StrRect.right -= 2;
  5780. StrRect.bottom -= 2;
  5781. str = "";
  5782. for (i = 0; i < sparray.GetSize(); i++)
  5783. {
  5784. str += sparray.ElementAt(i).ElementAt(5);
  5785. str += " 数量:";
  5786. str += sparray.ElementAt(i).ElementAt(3);
  5787. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5788. str += "\r\n";
  5789. }
  5790. str.TrimRight("\r\n");
  5791. AutoDraw(m_Print, StrRect, str, 1.4);
  5792. StrRect = load.m_rcarray.ElementAt(33);
  5793. StrRect.top += dt;
  5794. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5795. StrRect.top += hei;
  5796. StrRect.left += 3;
  5797. StrRect.top += 3;
  5798. StrRect.right -= 2;
  5799. StrRect.bottom -= 2;
  5800. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  5801. StrRect = load.m_rcarray.ElementAt(34);
  5802. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5803. StrRect.top += hei;
  5804. StrRect.left += 3;
  5805. StrRect.top += 3;
  5806. StrRect.right -= 2;
  5807. StrRect.bottom -= 2;
  5808. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5809. if (str.IsEmpty())
  5810. {
  5811. str = "\
  5812. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5813. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5814. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5815. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5816. 持良好的心境.\r\n\
  5817. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5818. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5819. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5820. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5821. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5822. 勿进影室, 以免影响拍摄.\r\n\
  5823. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5824. 师或店长沟通.\r\n\
  5825. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5826. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5827. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5828. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5829. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5830. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5831. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5832. 还.";
  5833. }
  5834. AutoDraw(m_Print, StrRect, str, 1.8);
  5835. StrRect = load.m_rcarray.ElementAt(35);
  5836. StrRect.bottom += 100;
  5837. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  5838. 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∨";
  5839. // AutoDraw(m_Print, StrRect, str, 1.4);
  5840. }
  5841. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 2)
  5842. {
  5843. PrintDinDan5(strOrderNumber);
  5844. return;
  5845. }
  5846. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  5847. {
  5848. PrintDinDan6(strOrderNumber);
  5849. return;
  5850. }
  5851. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  5852. dlg.m_pDC = m_Print.GetPDC();
  5853. dlg.m_mode = 1;
  5854. if (aa == 0)
  5855. {
  5856. if (dlg.DoModal() != IDOK)
  5857. return;
  5858. printcot = dlg.m_num;
  5859. }
  5860. //结束打印
  5861. m_Print.EndPage();
  5862. m_Print.EndPrint();
  5863. }
  5864. }
  5865. void CovertDate2(CString date, CString &date2)
  5866. {
  5867. try
  5868. {
  5869. if (date == "2013-04-09")
  5870. {
  5871. date2 = "2013-02-29";
  5872. return;
  5873. }
  5874. ///////////////////////////////////
  5875. date2 = date;
  5876. GongToLong(date2);
  5877. ////////////////////////////////////
  5878. return;
  5879. CCalendarConvert m_CalendarConvert;
  5880. SYSTEMTIME src = { 0 };
  5881. SYSTEMTIME dst = { 0 };
  5882. COleDateTime m_timeLunar(atoi(date.Mid(0, 4)), atoi(date.Mid(5, 2)), atoi(date.Mid(8, 2)), 0, 0, 0);
  5883. COleDateTime m_timeGregorian;
  5884. m_timeLunar.GetAsSystemTime(src);
  5885. BOOL bEmbolism = 0;
  5886. if (m_CalendarConvert.Gregorian2Lunar(&src, &dst, &bEmbolism))
  5887. {
  5888. m_timeGregorian = m_CalendarConvert.ConvertSysTime2OleDateTime(&dst);
  5889. date2.Format("%04d-%02d-%02d", m_timeGregorian.GetYear(), m_timeGregorian.GetMonth(), m_timeGregorian.GetDay());
  5890. if (m_timeGregorian.GetYear() == -1)date2 = "2000-13-32";
  5891. }
  5892. else
  5893. {
  5894. date2.Empty();
  5895. }
  5896. }
  5897. catch (...)
  5898. {
  5899. }
  5900. }
  5901. void CMainFrame::PrintDinDan5(CString m_id)
  5902. {
  5903. int printcot = 1;
  5904. for (int aa = 0; aa < printcot; aa++)
  5905. {
  5906. PrintPreview dlg;
  5907. CPrintRX m_Print;
  5908. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  5909. {
  5910. m_Print.InitToPrint(NULL, 1);
  5911. }
  5912. else
  5913. {
  5914. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  5915. if (name.IsEmpty())
  5916. m_Print.InitToPrint(NULL, 1);
  5917. else
  5918. {
  5919. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  5920. if (nret == -1 && aa == 0)
  5921. {
  5922. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  5923. }
  5924. }
  5925. }
  5926. {
  5927. m_Print.StartPrint();
  5928. m_Print.StartPage();
  5929. LoadRect load;
  5930. load.SetLiaPath("19.lia");
  5931. load.SetMargins(0, -20);
  5932. if (!load.Load())return;
  5933. int i;
  5934. //////////////////////////////////////////////////////////////
  5935. CStringArray txarray;
  5936. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  5937. g_sendhead.code[0] = 11;
  5938. g_sendhead.code[1] = 52;
  5939. g_sendhead.code[2] = 50;
  5940. g_sendhead.code[3] = 150;
  5941. g_sendhead.code[4] = 77;
  5942. g_sendhead.code[5] = 4;
  5943. g_sendhead.tabcount = 6;
  5944. g_sendhead.bsql = 0;
  5945. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5946. CArray<CStringArray, CStringArray>sparray;
  5947. CArray<CStringArray, CStringArray>clientarray;
  5948. CArray<CStringArray, CStringArray>phonearray;
  5949. CArray<CStringArray, CStringArray>fgarray;
  5950. CArray<CStringArray, CStringArray>danweiarray;
  5951. CArray<CStringArray, CStringArray>jdarray;
  5952. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5953. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5954. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5955. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5956. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5957. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5958. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  5959. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5960. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5961. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5962. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5963. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5964. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5965. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5966. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5967. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5968. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5969. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5970. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5971. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5972. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5973. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5974. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5975. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5976. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5977. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5978. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5979. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5980. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(36);
  5981. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5982. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5983. CString m_txtype = g_List1array.ElementAt(0).ElementAt(52);
  5984. CString m_memberno = g_List1array.ElementAt(0).ElementAt(47);
  5985. CString str;
  5986. if (jdarray.GetSize())
  5987. {
  5988. if (m_bz.IsEmpty() == 0)
  5989. m_bz = "\r\n" + m_bz;
  5990. m_bz += "景点:";
  5991. }
  5992. for (i = 0; i < jdarray.GetSize(); i++)
  5993. {
  5994. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5995. }
  5996. m_bz.TrimRight(";");
  5997. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5998. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5999. if (IsHasRights2new(31) == 0)
  6000. {
  6001. m_phone1 = "***";
  6002. m_phone2 = "***";
  6003. }
  6004. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  6005. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  6006. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  6007. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  6008. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  6009. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  6010. BOOL check1 = atoi(clientarray.ElementAt(0).ElementAt(15));
  6011. filter = "name='" + m_ren + "'";
  6012. g_sendhead.code[0] = 5;
  6013. g_sendhead.tabcount = 1;
  6014. g_sendhead.bsql = 0;
  6015. int g_nYearposTemp = g_nYearpos;
  6016. g_nYearpos = -1;
  6017. g_pMainWnd->ProcessChatMessageRequest2(filter);
  6018. g_nYearpos = g_nYearposTemp;
  6019. if (g_bSendOK == 0)return;
  6020. DataToArray(&phonearray);
  6021. m_money1.Format("%f", atof(m_taoxijiage));
  6022. m_money2.Format("%f", atof(m_payed1));
  6023. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  6024. ConvertToPrice(m_money1);
  6025. ConvertToPrice(m_money2);
  6026. ConvertToPrice(m_money3);
  6027. ////////////////////////////////////////////////////////////////
  6028. int rcpos = -1;
  6029. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6030. //Image *pImg=NULL;
  6031. // ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  6032. // m_Print.DrawImage(pImg, StrRect);
  6033. // delete pImg;
  6034. m_Print.SetFontFace(20, 1, "宋体");
  6035. StrRect = load.m_rcarray.ElementAt(1);
  6036. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "定单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6037. m_Print.SetFontFace(12, 1, "宋体");
  6038. StrRect = load.m_rcarray.ElementAt(2);
  6039. m_Print.DrawText((LPTSTR)(LPCTSTR)("NO." + m_id), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6040. StrRect = load.m_rcarray.ElementAt(3);
  6041. str.Format("%s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  6042. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6043. StrRect = load.m_rcarray.ElementAt(4);
  6044. m_Print.DrawText((LPTSTR)(LPCTSTR)("联系人:" + m_name1), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6045. CStringArray strarray;
  6046. strarray.Add("姓名");
  6047. strarray.Add("性别");
  6048. strarray.Add("年龄");
  6049. strarray.Add("出生年月");
  6050. strarray.Add("套系价格");
  6051. strarray.Add("定金");
  6052. strarray.Add("欠款");
  6053. strarray.Add("拍摄类型");
  6054. strarray.Add("会员卡号");
  6055. strarray.Add("定单人");
  6056. strarray.Add("入底\\入册");
  6057. strarray.Add("联系电话");
  6058. for (i = 6; i <= 17; i++)
  6059. {
  6060. StrRect = load.m_rcarray.ElementAt(i - 1);
  6061. m_Print.DrawRect2(StrRect, 1);
  6062. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 6), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6063. }
  6064. strarray.RemoveAll();
  6065. strarray.Add(m_name2);
  6066. strarray.Add(m_sex);
  6067. if (m_birthday.GetLength() != 10)
  6068. strarray.Add("");
  6069. else
  6070. {
  6071. int year = 0;
  6072. if (check1)
  6073. {
  6074. CString date2;
  6075. CovertDate2(g_date, date2);
  6076. year = atoi(date2.Left(4)) - atoi(m_birthday.Left(4));
  6077. if (date2.Right(5) >= m_birthday.Right(5))
  6078. year++;
  6079. }
  6080. else
  6081. {
  6082. year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  6083. if (g_date.Right(5) >= m_birthday.Right(5))
  6084. year++;
  6085. }
  6086. str.Format("%d", year);
  6087. strarray.Add(str);
  6088. }
  6089. strarray.Add(m_birthday);
  6090. strarray.Add(m_money1);
  6091. strarray.Add(m_money2);
  6092. strarray.Add(m_money3);
  6093. strarray.Add(m_txtype);
  6094. strarray.Add(m_memberno);
  6095. strarray.Add(m_ren);
  6096. strarray.Add(m_zs);
  6097. if (!m_phone1.IsEmpty())
  6098. strarray.Add(m_phone1);
  6099. else
  6100. strarray.Add(m_phone2);
  6101. for (i = 18; i <= 29; i++)
  6102. {
  6103. StrRect = load.m_rcarray.ElementAt(i - 1);
  6104. m_Print.DrawRect2(StrRect, 1);
  6105. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6106. }
  6107. strarray.RemoveAll();
  6108. strarray.Add("摄影师");
  6109. strarray.Add("拍照时间");
  6110. strarray.Add("选片人");
  6111. strarray.Add("选片时间");
  6112. strarray.Add("引导师");
  6113. strarray.Add("设计师");
  6114. strarray.Add("取件时间");
  6115. strarray.Add("顾客签字");
  6116. for (i = 34; i <= 41; i++)
  6117. {
  6118. StrRect = load.m_rcarray.ElementAt(i - 1);
  6119. m_Print.DrawRect2(StrRect, 1);
  6120. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 34), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6121. }
  6122. strarray.RemoveAll();
  6123. strarray.Add(m_waiter1);
  6124. strarray.Add(m_time2);
  6125. strarray.Add(m_waiter3);
  6126. strarray.Add(m_time4);
  6127. strarray.Add(m_waiter2);
  6128. strarray.Add(m_waiter4);
  6129. strarray.Add(m_time5);
  6130. strarray.Add("");
  6131. for (i = 42; i <= 49; i++)
  6132. {
  6133. StrRect = load.m_rcarray.ElementAt(i - 1);
  6134. m_Print.DrawRect2(StrRect, 1);
  6135. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6136. }
  6137. m_Print.SetFontFace(15, 1, "宋体");
  6138. StrRect = load.m_rcarray.ElementAt(29);
  6139. m_Print.DrawRect2(StrRect, 1);
  6140. StrRect.top += 45;
  6141. m_Print.DrawText((LPTSTR)(LPCTSTR)"拍", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6142. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6143. m_Print.DrawText((LPTSTR)(LPCTSTR)"内", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6144. m_Print.DrawText((LPTSTR)(LPCTSTR)"容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  6145. StrRect = load.m_rcarray.ElementAt(30);
  6146. m_Print.DrawRect2(StrRect, 1);
  6147. StrRect.top += 45;
  6148. m_Print.DrawText((LPTSTR)(LPCTSTR)"友", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6149. m_Print.DrawText((LPTSTR)(LPCTSTR)"情", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6150. m_Print.DrawText((LPTSTR)(LPCTSTR)"提", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  6151. m_Print.DrawText((LPTSTR)(LPCTSTR)"示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  6152. m_Print.SetFontFace(10, 1, "宋体");
  6153. StrRect = load.m_rcarray.ElementAt(37); StrRect.top = StrRect.bottom + 2;
  6154. str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  6155. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  6156. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  6157. StrRect = load.m_rcarray.ElementAt(48); StrRect.top = StrRect.bottom + 2; StrRect.left -= 200;
  6158. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  6159. //开始画文字
  6160. StrRect = load.m_rcarray.ElementAt(31);
  6161. StrRect.left += 3;
  6162. StrRect.top += 3;
  6163. StrRect.right -= 2;
  6164. StrRect.bottom -= 2;
  6165. str = "";
  6166. for (i = 0; i < sparray.GetSize(); i++)
  6167. {
  6168. str += sparray.ElementAt(i).ElementAt(5);
  6169. str += " 数量:";
  6170. str += sparray.ElementAt(i).ElementAt(3);
  6171. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6172. str += "\r\n";
  6173. }
  6174. str.TrimRight("\r\n");
  6175. m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6176. m_bz.TrimLeft();
  6177. if (m_bz != "")
  6178. {
  6179. str += "\r\n"; str += "\r\n";
  6180. str += "备注:" + m_bz;
  6181. }
  6182. AutoDraw(m_Print, StrRect, str, 1.4);
  6183. StrRect = load.m_rcarray.ElementAt(32); m_Print.DrawRect2(StrRect, 1);
  6184. StrRect.left += 3;
  6185. StrRect.top += 3;
  6186. StrRect.right -= 2;
  6187. StrRect.bottom -= 2;
  6188. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6189. if (str.IsEmpty())
  6190. {
  6191. str = "\
  6192. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6193. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6194. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6195. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6196. 持良好的心境.\r\n\
  6197. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6198. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6199. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6200. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6201. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6202. 勿进影室, 以免影响拍摄.\r\n\
  6203. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6204. 师或店长沟通.\r\n\
  6205. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6206. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6207. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6208. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6209. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6210. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6211. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6212. 还.";
  6213. }
  6214. AutoDraw(m_Print, StrRect, str, 1.8);
  6215. }
  6216. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6217. dlg.m_pDC = m_Print.GetPDC();
  6218. dlg.m_mode = 1;
  6219. if (aa == 0)
  6220. {
  6221. if (dlg.DoModal() != IDOK)
  6222. return;
  6223. printcot = dlg.m_num;
  6224. }
  6225. //结束打印
  6226. m_Print.EndPage();
  6227. m_Print.EndPrint();
  6228. }
  6229. }
  6230. void CMainFrame::PrintDinDan4(CString m_id)
  6231. {
  6232. // TODO: Add your control notification handler code here
  6233. CPrintRX m_Print;
  6234. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6235. {
  6236. m_Print.InitToPrint(NULL, 1);
  6237. }
  6238. else
  6239. {
  6240. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  6241. if (name.IsEmpty())
  6242. m_Print.InitToPrint(NULL, 1);
  6243. else
  6244. {
  6245. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6246. if (nret == -1)
  6247. {
  6248. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6249. }
  6250. }
  6251. }
  6252. m_Print.StartPrint();
  6253. m_Print.StartPage();
  6254. LoadRect load;
  6255. load.SetLiaPath("6-2.lia");
  6256. load.SetMargins(0, 0);
  6257. if (!load.Load())return;
  6258. int i;
  6259. //////////////////////////////////////////////////////////////
  6260. CStringArray txarray;
  6261. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  6262. g_sendhead.code[0] = 11;
  6263. g_sendhead.code[1] = 52;
  6264. g_sendhead.code[2] = 50;
  6265. g_sendhead.code[3] = 150;
  6266. g_sendhead.code[4] = 77;
  6267. g_sendhead.code[5] = 4;
  6268. g_sendhead.tabcount = 6;
  6269. g_sendhead.bsql = 0;
  6270. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  6271. CArray<CStringArray, CStringArray>sparray;
  6272. CArray<CStringArray, CStringArray>clientarray;
  6273. CArray<CStringArray, CStringArray>phonearray;
  6274. CArray<CStringArray, CStringArray>fgarray;
  6275. CArray<CStringArray, CStringArray>danweiarray;
  6276. CArray<CStringArray, CStringArray>jdarray;
  6277. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  6278. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  6279. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  6280. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  6281. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  6282. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  6283. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  6284. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  6285. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  6286. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  6287. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  6288. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  6289. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  6290. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  6291. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  6292. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  6293. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  6294. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  6295. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  6296. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  6297. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  6298. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  6299. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  6300. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  6301. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  6302. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  6303. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  6304. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  6305. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  6306. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6307. if (jdarray.GetSize())
  6308. {
  6309. if (m_bz.IsEmpty() == 0)
  6310. m_bz = "\r\n" + m_bz;
  6311. m_bz += "景点:";
  6312. }
  6313. for (i = 0; i < jdarray.GetSize(); i++)
  6314. {
  6315. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  6316. }
  6317. m_bz.TrimRight(";");
  6318. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  6319. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  6320. if (IsHasRights2new(31) == 0)
  6321. {
  6322. m_phone1 = "***";
  6323. m_phone2 = "***";
  6324. }
  6325. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  6326. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  6327. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  6328. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  6329. CString str;
  6330. filter = "name='" + m_ren + "'";
  6331. g_sendhead.code[0] = 5;
  6332. g_sendhead.tabcount = 1;
  6333. g_sendhead.bsql = 0;
  6334. int g_nYearposTemp = g_nYearpos;
  6335. g_nYearpos = -1;
  6336. g_pMainWnd->ProcessChatMessageRequest2(filter);
  6337. g_nYearpos = g_nYearposTemp;
  6338. if (g_bSendOK == 0)return;
  6339. DataToArray(&phonearray);
  6340. m_money1.Format("%f", atof(m_taoxijiage));
  6341. m_money2.Format("%f", atof(m_payed1));
  6342. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  6343. ConvertToPrice(m_money1);
  6344. ConvertToPrice(m_money2);
  6345. ConvertToPrice(m_money3);
  6346. ////////////////////////////////////////////////////////////////
  6347. int rcpos = -1;
  6348. CRect StrRect = load.m_rcarray.ElementAt(0);
  6349. m_Print.SetFontFace(25, 1, "黑体");
  6350. m_Print.DrawText((LPTSTR)(LPCTSTR)"巴黎春天婚纱摄影预约单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6351. m_Print.SetFontFace(11, 1, "宋体");
  6352. StrRect = load.m_rcarray.ElementAt(1);
  6353. if (m_time1.GetLength() == 10)
  6354. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  6355. else
  6356. str = "开单日期:";
  6357. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6358. StrRect = load.m_rcarray.ElementAt(2);
  6359. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + m_id), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6360. CStringArray strarray;
  6361. strarray.Add("先生姓名");
  6362. strarray.Add("女士姓名");
  6363. strarray.Add("服装套数");
  6364. strarray.Add("拍摄张数");
  6365. strarray.Add("拍摄日期");
  6366. strarray.Add("联系电话");
  6367. strarray.Add("联系电话");
  6368. strarray.Add("造型套数");
  6369. strarray.Add("入册张数");
  6370. strarray.Add("选片日期");
  6371. strarray.Add("QQ/邮箱");
  6372. strarray.Add("套系总额");
  6373. strarray.Add("定金");
  6374. strarray.Add("余款金额");
  6375. strarray.Add("取件日期");
  6376. strarray.Add(m_name1);
  6377. strarray.Add(m_name2);
  6378. strarray.Add(m_clothescount);
  6379. str.Format("%d", atoi(m_zs) * 3);
  6380. strarray.Add(str);
  6381. strarray.Add(m_time2);
  6382. strarray.Add(m_phone1);
  6383. strarray.Add(m_phone2);
  6384. strarray.Add(m_clothescount2);
  6385. strarray.Add(m_zs);
  6386. strarray.Add(m_time4);
  6387. strarray.Add(m_qq1);
  6388. strarray.Add(m_money1);
  6389. strarray.Add(m_money2);
  6390. strarray.Add(m_money3);
  6391. strarray.Add(m_time5);
  6392. for (i = 4; i <= 33; i++)
  6393. {
  6394. StrRect = load.m_rcarray.ElementAt(i - 1);
  6395. m_Print.DrawRect2(StrRect, 1);
  6396. if (strarray.GetSize() > (i - 4))
  6397. {
  6398. if (i <= 18)
  6399. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6400. else
  6401. {
  6402. StrRect.left += 4;
  6403. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6404. }
  6405. }
  6406. }
  6407. int dt = 413;
  6408. StrRect = load.m_rcarray.ElementAt(36); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6409. m_Print.DrawText((LPTSTR)(LPCTSTR)"门市签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6410. StrRect = load.m_rcarray.ElementAt(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6411. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6412. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6413. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6414. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  6415. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址:深圳市红岭中路中深国际大厦首层,二十二层", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6416. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  6417. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:0755-61308198 61308199 25860696 25860697", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6418. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  6419. m_Print.DrawText((LPTSTR)(LPCTSTR)"网址:www.paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6420. StrRect = load.m_rcarray.ElementAt(43); StrRect.top += dt; StrRect.bottom += dt;
  6421. m_Print.DrawText((LPTSTR)(LPCTSTR)"邮箱:blct@paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6422. //////////////////////////////
  6423. //开始画文字
  6424. StrRect = load.m_rcarray.ElementAt(7);
  6425. int hei = StrRect.Height();
  6426. StrRect.top += hei;
  6427. StrRect.bottom += hei;
  6428. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6429. StrRect.top += dt;
  6430. StrRect.bottom += dt;
  6431. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6432. StrRect = load.m_rcarray.ElementAt(17);
  6433. StrRect.top += hei;
  6434. StrRect.bottom += hei;
  6435. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6436. StrRect = load.m_rcarray.ElementAt(33);
  6437. StrRect.bottom = StrRect.top + dt; m_Print.DrawRect2(StrRect, 1);
  6438. StrRect.top += hei;
  6439. StrRect.left += 3;
  6440. StrRect.top += 3;
  6441. StrRect.right -= 2;
  6442. StrRect.bottom -= 2;
  6443. str = "";
  6444. for (i = 0; i < sparray.GetSize(); i++)
  6445. {
  6446. str += sparray.ElementAt(i).ElementAt(5);
  6447. str += " 数量:";
  6448. str += sparray.ElementAt(i).ElementAt(3);
  6449. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6450. str += "\r\n";
  6451. }
  6452. str.TrimRight("\r\n");
  6453. AutoDraw(m_Print, StrRect, str, 1.4);
  6454. StrRect = load.m_rcarray.ElementAt(33);
  6455. StrRect.top += dt;
  6456. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6457. StrRect.top += hei;
  6458. StrRect.left += 3;
  6459. StrRect.top += 3;
  6460. StrRect.right -= 2;
  6461. StrRect.bottom -= 2;
  6462. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  6463. StrRect = load.m_rcarray.ElementAt(34);
  6464. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6465. StrRect.top += hei;
  6466. StrRect.left += 3;
  6467. StrRect.top += 3;
  6468. StrRect.right -= 2;
  6469. StrRect.bottom -= 2;
  6470. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6471. if (str.IsEmpty())
  6472. {
  6473. str = "\
  6474. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6475. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6476. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6477. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6478. 持良好的心境.\r\n\
  6479. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6480. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6481. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6482. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6483. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6484. 勿进影室, 以免影响拍摄.\r\n\
  6485. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6486. 师或店长沟通.\r\n\
  6487. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6488. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6489. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6490. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6491. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6492. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6493. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6494. 还.";
  6495. }
  6496. AutoDraw(m_Print, StrRect, str, 1.8);
  6497. StrRect = load.m_rcarray.ElementAt(35);
  6498. StrRect.bottom += 100;
  6499. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  6500. 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∨";
  6501. AutoDraw(m_Print, StrRect, str, 1.4);
  6502. PrintPreview dlg;
  6503. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6504. dlg.m_pDC = m_Print.GetPDC();
  6505. if (dlg.DoModal() != IDOK)return;
  6506. //结束打印
  6507. m_Print.EndPage();
  6508. m_Print.EndPrint();
  6509. }
  6510. int CalHeight_01(CRect &rc, CStringArray *saContent, CPrintRX *Print, int FORMAT)
  6511. {
  6512. CSize size;
  6513. int nMaxheight = 0;
  6514. CString strTemp;
  6515. CString strContent;
  6516. int nSize = saContent->GetSize();
  6517. int nRow = 0; // 行数;
  6518. for (int i = 0; i < nSize; i++)
  6519. {
  6520. strTemp = "";
  6521. strContent = saContent->ElementAt(i);
  6522. while (FALSE == strContent.IsEmpty())
  6523. {
  6524. strContent = strContent.Mid(strTemp.GetLength());
  6525. if (strContent.IsEmpty())
  6526. break;
  6527. Print->GetStrSize((LPTSTR)(LPCTSTR)strContent, size);
  6528. if (size.cx <= rc.Width())
  6529. {
  6530. CRect rc2 = rc;
  6531. rc2.top += nRow*(size.cy + 1);
  6532. rc2.bottom = rc2.top + (size.cy + 1);
  6533. Print->DrawText((LPTSTR)(LPCTSTR)strContent, rc2, 0, 0, FORMAT | FORMAT_UP);
  6534. nMaxheight = max(nMaxheight, rc2.bottom);
  6535. nRow++;
  6536. break;
  6537. }
  6538. int right = 0;
  6539. while (size.cx > rc.Width())
  6540. {
  6541. right++;
  6542. strTemp = strContent.Left(strContent.GetLength() - (right));
  6543. if (GIsHalfHZ(strTemp))
  6544. {
  6545. right++;
  6546. strTemp.Delete(strTemp.GetLength() - 1);
  6547. }
  6548. Print->GetStrSize((LPTSTR)(LPCTSTR)strTemp, size);
  6549. }
  6550. CRect rc2 = rc;
  6551. rc2.top += nRow*(size.cy + 1);
  6552. rc2.bottom = rc2.top + (size.cy + 1);
  6553. Print->DrawText((LPTSTR)(LPCTSTR)strTemp, rc2, 0, 0, FORMAT | FORMAT_UP); //printf("Jeff:str=%s\n\n",str);// Jeff Printf;
  6554. nRow++;
  6555. nMaxheight = max(nMaxheight, rc2.bottom);
  6556. }
  6557. }
  6558. return (nMaxheight == 0) ? (rc.bottom + 1) : (nMaxheight + 1);
  6559. }
  6560. /************************************************************************/
  6561. /*
  6562. 多字节字符编码下的CaleHeight函数;
  6563. 函数:CaleHeight
  6564. 描述:计算出一行高度可变,宽度特定的表格(CArray<CRect,CRect>),在输入指定内容时(CStringArray),表格高度变化最大的值。
  6565. 参数:
  6566. aRowRect: 一行表格,CArray::GetSize()表示表格列数;
  6567. aRowStr: 与表格对应的一行字符,CStringArray::GetSize()大小与CArray::GetSize()一致。
  6568. pPrinter: 打印机实例指针;
  6569. nFormat: 字符串的显示格式。
  6570. 返回:返回最大的表格高度;
  6571. 注意:只能多字节下使用,因为函数GIsHalfHZ。
  6572. */
  6573. /************************************************************************/
  6574. INT CalcHeight( IN CArray<CRect, CRect> &aRowRect, IN CStringArray &aRowStr, IN CPrintRX *pPrinter, IN CONST INT& nFormat)
  6575. {
  6576. // 参数有效性;
  6577. if( aRowRect.GetSize() != aRowStr.GetSize() )
  6578. {
  6579. OutputDebugString(_T("表格列数与字符列数不等!\n"));
  6580. return -1;
  6581. }
  6582. if( pPrinter == NULL )
  6583. {
  6584. OutputDebugString(_T("打印机句柄指针无效\n"));
  6585. return -1;
  6586. }
  6587. // 表格字串长度;
  6588. CSize size;
  6589. // 当前表格字体高度;
  6590. INT nGridFontHeight = 0;
  6591. // 当前表格区域;
  6592. CRect curGrid;
  6593. // 当前表格字符串;
  6594. CString strGridContent;
  6595. // 最大值高底;
  6596. INT nMaxHeigth = 0;
  6597. // 当前换行数;
  6598. INT nWrapRows = 0;
  6599. // 当前换行字串;
  6600. CString strWrapRow = _T("");
  6601. // 表格列数;
  6602. INT nColumns = aRowRect.GetSize();
  6603. // 临时表格;
  6604. CRect rcGrid;
  6605. // 循环计算每个表格的高度;
  6606. for( INT i = 0; i < nColumns; i++ )
  6607. {
  6608. nWrapRows = 0;
  6609. strWrapRow.Empty();
  6610. curGrid = aRowRect.ElementAt(i);
  6611. strGridContent = aRowStr.ElementAt(i);
  6612. nMaxHeigth = max(nMaxHeigth, curGrid.bottom);
  6613. while( !strGridContent.IsEmpty() )
  6614. {
  6615. strGridContent = strGridContent.Right(strGridContent.GetLength() - strWrapRow.GetLength());
  6616. if ( strGridContent.IsEmpty() )
  6617. {
  6618. OutputDebugString(_T("表格字符已空\n"));
  6619. break;
  6620. }
  6621. pPrinter->GetStrSize((LPTSTR)(LPCTSTR)strGridContent, size);
  6622. nGridFontHeight = size.cy + 1;
  6623. // 字串长度 <= 表格宽度;
  6624. if( size.cx <= curGrid.Width() )
  6625. {
  6626. rcGrid = curGrid;
  6627. rcGrid.top += nWrapRows*nGridFontHeight;
  6628. rcGrid.bottom = rcGrid.top + nGridFontHeight;
  6629. nMaxHeigth = max(nMaxHeigth, rcGrid.bottom);
  6630. pPrinter->DrawText((LPTSTR)(LPCTSTR)strGridContent, rcGrid, 0, 0, nFormat|FORMAT_UP);
  6631. break;
  6632. }
  6633. else
  6634. {// 字串长度 >= 表格宽度;
  6635. INT nRight = 0; // 字串右位置;
  6636. // 从右边开始逐个字符取出,直到左边字串小于表格宽度;
  6637. while( size.cx > curGrid.Width() )
  6638. {
  6639. nRight++;
  6640. strWrapRow = strGridContent.Left(strGridContent.GetLength() - nRight);
  6641. if( GIsHalfHZ(strWrapRow) )
  6642. {// 判断字串最后一个字符是否是汉字;
  6643. nRight++;
  6644. strWrapRow.Delete(strWrapRow.GetLength() - 1);
  6645. }
  6646. pPrinter->GetStrSize((LPTSTR)(LPCTSTR)strWrapRow, size);
  6647. }
  6648. rcGrid = curGrid;
  6649. rcGrid.top += nWrapRows*nGridFontHeight;
  6650. rcGrid.bottom = rcGrid.top + nGridFontHeight;
  6651. nMaxHeigth = max(nMaxHeigth, rcGrid.bottom);
  6652. pPrinter->DrawText((LPTSTR)(LPCTSTR)strWrapRow, rcGrid, 0, 0, nFormat|FORMAT_UP);
  6653. // 换行加+1;
  6654. nWrapRows++;
  6655. }
  6656. }
  6657. }
  6658. return nMaxHeigth + 1;
  6659. }
  6660. void CMainFrame::PrintReceipt(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  6661. {
  6662. //AfxMessageBox("abce");
  6663. int i = 0;
  6664. int printcot = 1;
  6665. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  6666. {
  6667. g_sendhead.bsql = 0;
  6668. g_sendhead.code[0] = 24;
  6669. g_sendhead.tabcount = 1;
  6670. int g_nYearposTemp = g_nYearpos;
  6671. g_nYearpos = -1;
  6672. g_pMainWnd->ProcessChatMessageRequest2(1);
  6673. g_nYearpos = g_nYearposTemp;
  6674. if (0 == g_bSendOK)return;
  6675. DataToArray(&g_cominfoarray);
  6676. CString SerialNo;
  6677. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6678. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  6679. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6680. CString sql;
  6681. sql.Format("update version set [serialno]='%s'", SerialNo);
  6682. g_sendhead.bsql=1;
  6683. g_nYearposTemp=g_nYearpos;
  6684. g_nYearpos=-1;
  6685. g_pMainWnd->ProcessChatMessageRequest2(sql);
  6686. g_nYearpos=g_nYearposTemp;
  6687. #endif
  6688. // 1.创建打印对象
  6689. CPrintRX m_Print;
  6690. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6691. {
  6692. m_Print.InitToPrint(NULL, 1);
  6693. }
  6694. else
  6695. {
  6696. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  6697. if (name.IsEmpty())
  6698. m_Print.InitToPrint(NULL, 1);
  6699. else
  6700. {
  6701. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6702. if (nret == -1 && aa == 0)
  6703. {
  6704. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6705. }
  6706. }
  6707. }
  6708. // 2.开始打印
  6709. m_Print.StartPrint();
  6710. m_Print.StartPage();
  6711. LoadRect load;
  6712. BOOL bSmall = 0;
  6713. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  6714. {
  6715. bSmall = 1;
  6716. load.SetLiaPath("20.lia");
  6717. }
  6718. else
  6719. load.SetLiaPath("10.lia");
  6720. if (bSmall)
  6721. load.SetMargins(0, 0);
  6722. else
  6723. load.SetMargins(10, 0);
  6724. if (!load.Load())return;
  6725. int rcpos = -1;
  6726. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6727. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  6728. {
  6729. Image *pImg = NULL;
  6730. g_nSendCode = 31;
  6731. int g_nYearposTemp = g_nYearpos;
  6732. g_nYearpos = -1;
  6733. g_pMainWnd->ProcessChatMessageRequest2(1);
  6734. g_nYearpos = g_nYearposTemp;
  6735. g_nSendCode = 0;
  6736. if (g_bSendOK == 0)return;
  6737. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  6738. if (pImg)
  6739. {
  6740. StrRect.left = 65;
  6741. if (bSmall) StrRect.left = 55;
  6742. StrRect.top = 10;
  6743. StrRect.right = StrRect.left + 58;
  6744. StrRect.bottom = StrRect.top + 58;
  6745. // 3.打印2维码图像;
  6746. m_Print.DrawImage(pImg, StrRect);
  6747. delete pImg;
  6748. pImg = NULL;
  6749. }
  6750. }
  6751. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  6752. if (bSmall)
  6753. {
  6754. m_Print.SetFontFace(18, 1, "黑体");
  6755. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6756. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6757. m_Print.SetFontFace(9, 1, "宋体");
  6758. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6759. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6760. m_Print.SetFontFace(6, 1, "宋体");
  6761. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6762. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6763. m_Print.SetFontFace(9, 1, "宋体");
  6764. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6765. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6766. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6767. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6768. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6769. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6770. int hei = StrRect.Height();
  6771. StrRect.bottom = StrRect.top;
  6772. StrRect.top -= 8;
  6773. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6774. m_Print.SetFontFace(11, 1, "宋体");
  6775. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6776. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6777. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6778. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6779. m_Print.SetFontFace(8, 1, "宋体");
  6780. for (i = 7; i < 24; i++)
  6781. {
  6782. StrRect = load.m_rcarray.ElementAt(i);
  6783. m_Print.DrawRect2(StrRect, 1);
  6784. }
  6785. for (i = 9; i < 24; i++)
  6786. {
  6787. StrRect = load.m_rcarray.ElementAt(i);
  6788. StrRect.left += 2;
  6789. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6790. }
  6791. m_Print.SetFontFace(6, 1, "宋体");
  6792. for (i = 24; i < 26; i++)
  6793. {
  6794. StrRect = load.m_rcarray.ElementAt(i);
  6795. StrRect.left += 2;
  6796. if (i == 24)
  6797. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6798. else
  6799. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6800. }
  6801. // StrRect=load.m_rcarray .ElementAt (27);
  6802. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  6803. }
  6804. else//大单
  6805. {
  6806. // 1.打印表头(蒙娜丽莎收款单)
  6807. m_Print.SetFontFace(20, 1, "黑体");
  6808. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6809. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6810. m_Print.SetFontFace(11, 1, "宋体");
  6811. // 2.打印订单号(NO.20140608-001)
  6812. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6813. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6814. // 3.打印SerialNo(SerialNo.01062)
  6815. int hei = StrRect.Height();
  6816. StrRect.bottom = StrRect.top;
  6817. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6818. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6819. // 4.打印影楼地址信息、电话;
  6820. m_Print.SetFontFace(8, 1, "宋体");
  6821. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6822. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6823. m_Print.SetFontFace(11, 1, "宋体");
  6824. // 5.打印客户姓名
  6825. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6826. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6827. // 6.打印客户联系电话
  6828. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6829. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6830. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6831. // 7.打印开单日期
  6832. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6833. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6834. // 8.打印列字段:收款项目
  6835. m_Print.SetFontFace(13, 1, "宋体");
  6836. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6837. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6838. //printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6839. // 9.打印列字段:金额
  6840. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6841. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6842. //printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6843. // 10.打印列字段:开单人
  6844. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6845. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6846. //printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6847. // 11.画表格-画3列;
  6848. m_Print.SetFontFace(11, 1, "宋体");
  6849. for (i = 7; i < 10; i++)
  6850. {
  6851. StrRect = load.m_rcarray.ElementAt(i);
  6852. m_Print.DrawRect2(StrRect, 1);
  6853. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6854. }
  6855. // 12.打印详细内容
  6856. int dty = 0;
  6857. int dtytemp = 0;
  6858. // for( i=10; i<14; i+=3)
  6859. for (i = 10; i<22; i += 3) // 循环4次,再画
  6860. {
  6861. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  6862. CArray<CRect, CRect>rcarray;
  6863. CStringArray strarray2;
  6864. StrRect = load.m_rcarray.ElementAt(i);
  6865. StrRect.top += dty;
  6866. StrRect.bottom += dty;
  6867. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  6868. {
  6869. StrRect = load.m_rcarray.ElementAt(i - 1);
  6870. StrRect.top += dty;
  6871. StrRect.bottom += dty;
  6872. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  6873. break;
  6874. }
  6875. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  6876. StrRect.left += 2;
  6877. StrRect.right -= 2;
  6878. StrRect.top += 4;
  6879. rcarray.Add(StrRect);
  6880. strarray2.Add(pArray->ElementAt(i));
  6881. // 指定格子宽度,计算字符串占几行(高度).
  6882. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  6883. dtytemp = bottom - StrRect.bottom;
  6884. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  6885. // 重新获取表格大小,并画出表格;
  6886. StrRect = load.m_rcarray.ElementAt(i);
  6887. StrRect.bottom += dtytemp;
  6888. StrRect.top += dty;
  6889. StrRect.bottom += dty;
  6890. m_Print.DrawRect2(StrRect, 1);
  6891. // 获取下一表格大小,并画出表格;
  6892. StrRect = load.m_rcarray.ElementAt(i + 1);
  6893. StrRect.top += dty;
  6894. StrRect.bottom += dty;
  6895. StrRect.bottom += dtytemp;
  6896. m_Print.DrawRect2(StrRect, 1);
  6897. StrRect.left += 2;
  6898. // 打印出金额字段内容
  6899. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6900. //printf("Jeff:%d:%s\n\n",i+1,pArray->ElementAt(i+1));//Jeff Printf;
  6901. StrRect = load.m_rcarray.ElementAt(i + 2);
  6902. StrRect.top += dty;
  6903. StrRect.bottom += dty;
  6904. StrRect.bottom += dtytemp;
  6905. m_Print.DrawRect2(StrRect, 1);
  6906. StrRect.left += 2;
  6907. // 打印开单人字段内容
  6908. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6909. //printf("Jeff:%d:%s\n\n",i+2,pArray->ElementAt(i+2));//Jeff Printf;
  6910. dty += dtytemp;
  6911. }
  6912. //.打印->付款情况 应付 实付 欠款.
  6913. i = 22;
  6914. StrRect = load.m_rcarray.ElementAt(i);
  6915. StrRect.top += dty;
  6916. StrRect.bottom += dty;
  6917. m_Print.DrawRect2(StrRect, 1);
  6918. StrRect.left += 2;
  6919. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6920. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  6921. //.打印->合计人民币(大写):.......
  6922. i = 23;
  6923. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  6924. m_Print.DrawRect2(StrRect, 1);
  6925. StrRect.left += 2;
  6926. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6927. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  6928. m_Print.SetFontFace(7, 1, "宋体");
  6929. for (i = 24; i < 27; i++)
  6930. {
  6931. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  6932. StrRect.left += 2;
  6933. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6934. }
  6935. StrRect = load.m_rcarray.ElementAt(24); StrRect.top += dty; StrRect.bottom += dty;
  6936. hei = StrRect.Height();
  6937. StrRect.top += hei;
  6938. StrRect.bottom += hei;
  6939. StrRect.right += 100;
  6940. StrRect.left += 2;
  6941. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  6942. AutoDraw(m_Print, StrRect, pArray->ElementAt(27), 1.0);
  6943. }
  6944. PrintPreview dlg;
  6945. dlg.m_mode = 3;
  6946. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6947. dlg.m_pDC = m_Print.GetPDC();
  6948. if (aa == 0)
  6949. {
  6950. if (dlg.DoModal() != IDOK)
  6951. return;
  6952. printcot = dlg.m_num;
  6953. }
  6954. //结束打印
  6955. m_Print.EndPage();
  6956. m_Print.EndPrint();
  6957. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  6958. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6959. CString sql;
  6960. sql.Format("update version set [serialno]='%s'", SerialNo);
  6961. g_sendhead.bsql = 1;
  6962. g_nYearposTemp = g_nYearpos;
  6963. g_nYearpos = -1;
  6964. g_pMainWnd->ProcessChatMessageRequest2(sql);
  6965. g_nYearpos = g_nYearposTemp;
  6966. #endif
  6967. }
  6968. }
  6969. /************************************************************************/
  6970. /*
  6971. 函数:PrintRechargeRecord
  6972. 描述:打印会员卡充值记录;
  6973. 参数:
  6974. pArryRechargeRecod[IN]:要打印的数据;
  6975. 返回:
  6976. 注意:
  6977. 示例:
  6978. */
  6979. /************************************************************************/
  6980. void CMainFrame::PrintRechargeRecord(CStringArray *pArryRechargeRecod)
  6981. {
  6982. }
  6983. void CMainFrame::PrintReceipt_01(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  6984. {
  6985. //AfxMessageBox("abce");
  6986. int i = 0;
  6987. int printcot = 1;
  6988. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  6989. {
  6990. g_sendhead.bsql = 0;
  6991. g_sendhead.code[0] = 24;
  6992. g_sendhead.tabcount = 1;
  6993. int g_nYearposTemp = g_nYearpos;
  6994. g_nYearpos = -1;
  6995. g_pMainWnd->ProcessChatMessageRequest2(1);
  6996. g_nYearpos = g_nYearposTemp;
  6997. if (0 == g_bSendOK)return;
  6998. DataToArray(&g_cominfoarray);
  6999. CString SerialNo;
  7000. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7001. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7002. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7003. CString sql;
  7004. sql.Format("update version set [serialno]='%s'", SerialNo);
  7005. g_sendhead.bsql=1;
  7006. g_nYearposTemp=g_nYearpos;
  7007. g_nYearpos=-1;
  7008. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7009. g_nYearpos=g_nYearposTemp;
  7010. #endif
  7011. // 1.创建打印对象
  7012. CPrintRX m_Print;
  7013. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7014. {
  7015. m_Print.InitToPrint(NULL, 1);
  7016. }
  7017. else
  7018. {
  7019. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  7020. if (name.IsEmpty())
  7021. m_Print.InitToPrint(NULL, 1);
  7022. else
  7023. {
  7024. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  7025. if (nret == -1 && aa == 0)
  7026. {
  7027. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  7028. m_Print.InitToPrint(NULL, 1);
  7029. }
  7030. }
  7031. }
  7032. // 2.开始打印
  7033. m_Print.StartPrint();
  7034. m_Print.StartPage();
  7035. LoadRect load;
  7036. BOOL bSmall = 0;
  7037. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  7038. {
  7039. bSmall = 1;
  7040. load.SetLiaPath("20.lia");
  7041. }
  7042. else
  7043. load.SetLiaPath("10.lia");
  7044. if (bSmall)
  7045. load.SetMargins(0, 0);
  7046. else
  7047. load.SetMargins(10, 0);
  7048. if (!load.Load())return;
  7049. int rcpos = -1;
  7050. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7051. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  7052. {
  7053. Image *pImg = NULL;
  7054. g_nSendCode = 31;
  7055. int g_nYearposTemp = g_nYearpos;
  7056. g_nYearpos = -1;
  7057. g_pMainWnd->ProcessChatMessageRequest2(1);
  7058. g_nYearpos = g_nYearposTemp;
  7059. g_nSendCode = 0;
  7060. if (g_bSendOK == 0)return;
  7061. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7062. if (pImg)
  7063. {
  7064. StrRect.left = 65;
  7065. if (bSmall) StrRect.left = 55;
  7066. StrRect.top = 10;
  7067. StrRect.right = StrRect.left + 58;
  7068. StrRect.bottom = StrRect.top + 58;
  7069. // 3.打印2维码图像;
  7070. m_Print.DrawImage(pImg, StrRect);
  7071. delete pImg;
  7072. pImg = NULL;
  7073. }
  7074. }
  7075. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  7076. if (bSmall)
  7077. {
  7078. m_Print.SetFontFace(18, 1, "黑体");
  7079. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7080. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7081. m_Print.SetFontFace(9, 1, "宋体");
  7082. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7083. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7084. m_Print.SetFontFace(6, 1, "宋体");
  7085. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7086. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7087. m_Print.SetFontFace(9, 1, "宋体");
  7088. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7089. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7090. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7091. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7092. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7093. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7094. int hei = StrRect.Height();
  7095. StrRect.bottom = StrRect.top;
  7096. StrRect.top -= 8;
  7097. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7098. m_Print.SetFontFace(11, 1, "宋体");
  7099. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7100. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7101. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7102. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7103. m_Print.SetFontFace(8, 1, "宋体");
  7104. for ( i = 7; i < 24; i++)
  7105. {
  7106. StrRect = load.m_rcarray.ElementAt(i);
  7107. m_Print.DrawRect2(StrRect, 1);
  7108. }
  7109. for (i = 9; i < 24; i++)
  7110. {
  7111. StrRect = load.m_rcarray.ElementAt(i);
  7112. StrRect.left += 2;
  7113. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7114. }
  7115. m_Print.SetFontFace(6, 1, "宋体");
  7116. for (i = 24; i < 26; i++)
  7117. {
  7118. StrRect = load.m_rcarray.ElementAt(i);
  7119. StrRect.left += 2;
  7120. if (i == 24)
  7121. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7122. else
  7123. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7124. }
  7125. // StrRect=load.m_rcarray .ElementAt (27);
  7126. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  7127. }
  7128. else//大单
  7129. {
  7130. // 1.打印表头(蒙娜丽莎收款单)
  7131. m_Print.SetFontFace(20, 1, "黑体");
  7132. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7133. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7134. m_Print.SetFontFace(11, 1, "宋体");
  7135. // 2.打印订单号(NO.20140608-001)
  7136. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7137. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7138. // 3.打印SerialNo(SerialNo.01062)
  7139. int hei = StrRect.Height();
  7140. StrRect.bottom = StrRect.top;
  7141. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7142. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7143. // 4.打印影楼地址信息、电话;
  7144. m_Print.SetFontFace(8, 1, "宋体");
  7145. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7146. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7147. m_Print.SetFontFace(11, 1, "宋体");
  7148. // 5.打印客户姓名
  7149. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7150. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7151. // 6.打印客户联系电话
  7152. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7153. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7154. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7155. // 7.打印开单日期
  7156. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7157. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7158. #if 0 // Original Edition
  7159. // 8.打印列字段:收款项目
  7160. m_Print.SetFontFace(13, 1, "宋体");
  7161. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7162. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7163. printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7164. // 9.打印列字段:金额
  7165. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7166. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7167. printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7168. // 10.打印列字段:开单人
  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_LEFT | FORMAT_VCENTER);
  7171. printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7172. #else
  7173. // 8.打印列字段:收款项目
  7174. m_Print.SetFontFace(13, 1, "宋体");
  7175. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7176. StrRect = CRect(66, 85, 280, 105);
  7177. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7178. //m_Print.DrawText("收款项目",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7179. // 8.1 Jeff add:支付方式
  7180. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7181. StrRect = CRect(280, 85, 350, 105);
  7182. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7183. //m_Print.DrawText("支付方式",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7184. // 9.打印列字段:金额
  7185. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7186. StrRect = CRect(350, 85, 442, 105);
  7187. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7188. //m_Print.DrawText("金额",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7189. // 10.打印列字段:开单人
  7190. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7191. StrRect = CRect(442, 85, 535, 105);
  7192. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7193. //m_Print.DrawText("开单人",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7194. //rcpos += 3;
  7195. #endif
  7196. // 11.画表格-画3列;old
  7197. // 11.draw 4 column
  7198. m_Print.SetFontFace(11, 1, "宋体");
  7199. //for( i=7; i<10; i++)
  7200. //{
  7201. // StrRect=load.m_rcarray.ElementAt(i);
  7202. // m_Print.DrawRect2(StrRect, 1);
  7203. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7204. //}
  7205. m_Print.DrawRect2(CRect(66, 85, 280, 105), 1);
  7206. m_Print.DrawRect2(CRect(280, 85, 350, 105), 1);
  7207. m_Print.DrawRect2(CRect(350, 85, 442, 105), 1);
  7208. m_Print.DrawRect2(CRect(442, 85, 535, 105), 1);
  7209. // 12.打印详细内容
  7210. int dty = 0;
  7211. int dtytemp = 0;
  7212. // for( i=10; i<14; i+=3)
  7213. //for( i=10; i<22; i+=3) // 循环4次,再画
  7214. int j = 0;
  7215. for (i = 10, j = 11; i<22; i += 3, j += 4) // 循环4次,再画
  7216. {
  7217. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  7218. CArray<CRect, CRect>rcarray;
  7219. CStringArray strarray2;
  7220. StrRect = load.m_rcarray.ElementAt(i);
  7221. StrRect.top += dty;
  7222. StrRect.bottom += dty;
  7223. StrRect.right -= 70; // Jeff add
  7224. //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;
  7225. /*
  7226. 4次的CRect
  7227. 66,105,350,125
  7228. 66,126,350,146
  7229. 66,147,350,167
  7230. 66,168,350,188
  7231. */
  7232. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  7233. {
  7234. StrRect = load.m_rcarray.ElementAt(i - 1);
  7235. StrRect.top += dty;
  7236. StrRect.bottom += dty;
  7237. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  7238. break;
  7239. }
  7240. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  7241. StrRect.left += 2;
  7242. StrRect.right -= 2;
  7243. StrRect.top += 4;
  7244. rcarray.Add(StrRect);
  7245. //strarray2.Add(pArray->ElementAt(i+1));
  7246. strarray2.Add(pArray->ElementAt(j));
  7247. //printf("Jeff:%d:%s\n\n",j,pArray->ElementAt(j));//Jeff Printf;
  7248. // 指定格子宽度,计算字符串占几行(高度).
  7249. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  7250. dtytemp = bottom - StrRect.bottom;
  7251. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7252. // 重新获取表格大小,并画出表格;
  7253. /*
  7254. CRect(66,85,280,105),
  7255. CRect(280,85,350,105)
  7256. CRect(350,85,442,105)
  7257. CRect(442,85,535,105)
  7258. CRect(66,105,350,125),
  7259. CRect(66,126,350,146)
  7260. CRect(66,147,350,167)
  7261. CRect(66,168,350,188)
  7262. */
  7263. // 画收款项目框及打印内容;
  7264. StrRect = load.m_rcarray.ElementAt(i);
  7265. //StrRect=CRect(66,85,280,105);
  7266. StrRect.bottom += dtytemp;
  7267. StrRect.top += dty;
  7268. StrRect.bottom += dty;
  7269. //StrRect.left -= 70; // Jeff add
  7270. StrRect.right -= 70; // Jeff add
  7271. //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;
  7272. m_Print.DrawRect2(StrRect, 1);
  7273. // 画支付方式框及打印内容;
  7274. StrRect = load.m_rcarray.ElementAt(i);
  7275. //StrRect=CRect(280,85,350,105);
  7276. StrRect.bottom += dtytemp;
  7277. StrRect.top += dty;
  7278. StrRect.bottom += dty;
  7279. StrRect.left += StrRect.Width() - 70;
  7280. //StrRect.right += 70; // Jeff add
  7281. //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;
  7282. m_Print.DrawRect2(StrRect, 1);
  7283. StrRect.left += 2;
  7284. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7285. //printf("Jeff:%d:%s\n\n",j+1,pArray->ElementAt(j+1));//Jeff Printf;
  7286. // 画金额框及打印内容;
  7287. StrRect = load.m_rcarray.ElementAt(i + 1);
  7288. //StrRect=CRect(350,85,442,105);
  7289. StrRect.top += dty;
  7290. StrRect.bottom += dty;
  7291. StrRect.bottom += dtytemp;
  7292. //StrRect.right -= 70; // Jeff add
  7293. //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;
  7294. m_Print.DrawRect2(StrRect, 1);
  7295. StrRect.left += 2;
  7296. // 打印出金额字段内容
  7297. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7298. //printf("Jeff:%d:%s\n\n",j+2,pArray->ElementAt(j+2));//Jeff Printf;
  7299. // 画开单人框及打印内容;
  7300. StrRect = load.m_rcarray.ElementAt(i + 2);
  7301. //StrRect=CRect(442,85,535,105);
  7302. StrRect.top += dty;
  7303. StrRect.bottom += dty;
  7304. StrRect.bottom += dtytemp;
  7305. //StrRect.right -= 70; // Jeff add
  7306. //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;
  7307. m_Print.DrawRect2(StrRect, 1);
  7308. StrRect.left += 2;
  7309. // 打印开单人字段内容
  7310. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 3), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7311. //printf("Jeff:%d:%s\n\n",j+3,pArray->ElementAt(j+3));//Jeff Printf;
  7312. dty += dtytemp;
  7313. }
  7314. //.打印->付款情况 应付 实付 欠款.
  7315. i = 22;
  7316. j = 27;
  7317. StrRect = load.m_rcarray.ElementAt(i);
  7318. StrRect.top += dty;
  7319. StrRect.bottom += dty;
  7320. m_Print.DrawRect2(StrRect, 1);
  7321. StrRect.left += 2;
  7322. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7323. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7324. //.打印->合计人民币(大写):.......
  7325. i = 23;
  7326. j = 28;
  7327. StrRect = load.m_rcarray.ElementAt(i);
  7328. StrRect.top += dty;
  7329. StrRect.bottom += dty;
  7330. m_Print.DrawRect2(StrRect, 1);
  7331. StrRect.left += 2;
  7332. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7333. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7334. // 打印总金额;
  7335. m_Print.SetFontFace(7, 1, "宋体");
  7336. for (i = 24, j = 29; i < 27; i++, j++)
  7337. {
  7338. StrRect = load.m_rcarray.ElementAt(i);
  7339. StrRect.top += dty;
  7340. StrRect.bottom += dty;
  7341. StrRect.left += 2;
  7342. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7343. }
  7344. StrRect = load.m_rcarray.ElementAt(24);
  7345. StrRect.top += dty;
  7346. StrRect.bottom += dty;
  7347. hei = StrRect.Height();
  7348. StrRect.top += hei;
  7349. StrRect.bottom += hei;
  7350. StrRect.right += 100;
  7351. StrRect.left += 2;
  7352. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  7353. AutoDraw(m_Print, StrRect, pArray->ElementAt(32), 1.0);
  7354. }
  7355. PrintPreview dlg;
  7356. dlg.m_mode = 3;
  7357. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  7358. dlg.m_pDC = m_Print.GetPDC();
  7359. if (aa == 0)
  7360. {
  7361. if (dlg.DoModal() != IDOK)
  7362. {
  7363. return;
  7364. }
  7365. printcot = dlg.m_num;
  7366. }
  7367. //结束打印
  7368. m_Print.EndPage();
  7369. m_Print.EndPrint();
  7370. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7371. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7372. CString sql;
  7373. sql.Format("update version set [serialno]='%s'", SerialNo);
  7374. g_sendhead.bsql = 1;
  7375. g_nYearposTemp = g_nYearpos;
  7376. g_nYearpos = -1;
  7377. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7378. g_nYearpos = g_nYearposTemp;
  7379. #endif
  7380. }
  7381. }
  7382. void CMainFrame::PrintReceipt_02(CStringArray *pArray, CPrintRX *pPrinter, const int &nCount, const BOOL bPrintImmediately) // 打印订单*预约收款、预约补款*
  7383. {
  7384. //AfxMessageBox("abce");
  7385. int printcot = 1;
  7386. // for(int aa=0; aa<printcot; aa++) // Jeff, printcot=1....
  7387. // {
  7388. g_sendhead.bsql = 0;
  7389. g_sendhead.code[0] = 24;
  7390. g_sendhead.tabcount = 1;
  7391. int g_nYearposTemp = g_nYearpos;
  7392. g_nYearpos = -1;
  7393. g_pMainWnd->ProcessChatMessageRequest2(1);
  7394. g_nYearpos = g_nYearposTemp;
  7395. if (0 == g_bSendOK)return;
  7396. DataToArray(&g_cominfoarray);
  7397. CString SerialNo;
  7398. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7399. CPrintRX *tagPrinter = NULL;
  7400. if (pPrinter == NULL)
  7401. {
  7402. // 1.创建打印对象
  7403. tagPrinter = new CPrintRX;
  7404. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7405. {
  7406. tagPrinter->InitToPrint(NULL, 1);
  7407. }
  7408. else
  7409. {
  7410. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  7411. if (name.IsEmpty())
  7412. {
  7413. tagPrinter->InitToPrint(NULL, 1);
  7414. }
  7415. else
  7416. {
  7417. int nret = tagPrinter->InitToPrint((char*)(LPCTSTR)name, 1);
  7418. ///if(nret==-1 && aa==0)
  7419. if (nret == -1)
  7420. {
  7421. if (bPrintImmediately == FALSE)
  7422. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  7423. tagPrinter->InitToPrint(NULL, 1);
  7424. }
  7425. }
  7426. }
  7427. // 2.开始打印
  7428. tagPrinter->StartPrint();
  7429. tagPrinter->StartPage();
  7430. }
  7431. else
  7432. {
  7433. //SerialNo.Format ("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126))+1);
  7434. tagPrinter = pPrinter;
  7435. }
  7436. LoadRect load;
  7437. BOOL bSmall = 0;
  7438. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  7439. {
  7440. bSmall = 1;
  7441. load.SetLiaPath("20.lia");
  7442. }
  7443. else
  7444. load.SetLiaPath("10.lia");
  7445. if (bSmall)
  7446. load.SetMargins(0, 0);
  7447. else
  7448. load.SetMargins(10, 0);
  7449. if (!load.Load())return;
  7450. int rcpos = -1;
  7451. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7452. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  7453. {
  7454. Image *pImg = NULL;
  7455. g_nSendCode = 31;
  7456. int g_nYearposTemp = g_nYearpos;
  7457. g_nYearpos = -1;
  7458. g_pMainWnd->ProcessChatMessageRequest2(1);
  7459. g_nYearpos = g_nYearposTemp;
  7460. g_nSendCode = 0;
  7461. if (g_bSendOK == 0)return;
  7462. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7463. if (pImg)
  7464. {
  7465. StrRect.left = 65;
  7466. if (bSmall) StrRect.left = 55;
  7467. StrRect.top = 10;
  7468. StrRect.right = StrRect.left + 58;
  7469. StrRect.bottom = StrRect.top + 58;
  7470. // 3.打印2维码图像;
  7471. tagPrinter->DrawImage(pImg, StrRect);
  7472. delete pImg;
  7473. pImg = NULL;
  7474. }
  7475. }
  7476. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  7477. if (bSmall)
  7478. {
  7479. tagPrinter->SetFontFace(18, 1, "黑体");
  7480. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7481. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7482. tagPrinter->SetFontFace(9, 1, "宋体");
  7483. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7484. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7485. tagPrinter->SetFontFace(6, 1, "宋体");
  7486. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7487. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7488. tagPrinter->SetFontFace(9, 1, "宋体");
  7489. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7490. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7491. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7492. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7493. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7494. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7495. int hei = StrRect.Height();
  7496. StrRect.bottom = StrRect.top;
  7497. StrRect.top -= 8;
  7498. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7499. tagPrinter->SetFontFace(11, 1, "宋体");
  7500. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7501. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7502. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7503. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7504. tagPrinter->SetFontFace(8, 1, "宋体");
  7505. int i = 0;
  7506. for (i = 7; i < 24; i++)
  7507. {
  7508. StrRect = load.m_rcarray.ElementAt(i);
  7509. tagPrinter->DrawRect2(StrRect, 1);
  7510. }
  7511. for (i = 9; i < 24; i++)
  7512. {
  7513. StrRect = load.m_rcarray.ElementAt(i);
  7514. StrRect.left += 2;
  7515. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7516. }
  7517. tagPrinter->SetFontFace(6, 1, "宋体");
  7518. for (i = 24; i < 26; i++)
  7519. {
  7520. StrRect = load.m_rcarray.ElementAt(i);
  7521. StrRect.left += 2;
  7522. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7523. }
  7524. StrRect = load.m_rcarray.ElementAt(22);
  7525. int nH = StrRect.Height();
  7526. int nW = StrRect.Width();
  7527. int nlen = load.m_rcarray.GetSize();
  7528. int nLeft = StrRect.left;
  7529. int j = 0;
  7530. for (i = 27; i<32; i++)
  7531. {
  7532. CRect rct = StrRect;
  7533. if(i == 31)
  7534. {
  7535. rct.top = rct.top + (nH*(j - 1));
  7536. rct.bottom = rct.top + nH;
  7537. rct.left = rct.left + 200;
  7538. rct.right = rct.left + 200;
  7539. }
  7540. else
  7541. {
  7542. rct.top = rct.top + (nH*j);
  7543. rct.bottom = rct.top + nH;
  7544. rct.left = rct.left + 2;
  7545. rct.right = rct.left + 200;
  7546. }
  7547. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), rct, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7548. j++;
  7549. }
  7550. }
  7551. else//大单
  7552. {
  7553. // 1.打印表头(蒙娜丽莎收款单)
  7554. tagPrinter->SetFontFace(20, 1, "黑体");
  7555. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7556. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7557. tagPrinter->SetFontFace(11, 1, "宋体");
  7558. // 2.打印订单号(NO.20140608-001)
  7559. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7560. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7561. // 3.打印SerialNo(SerialNo.01062)
  7562. int hei = StrRect.Height();
  7563. StrRect.bottom = StrRect.top;
  7564. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7565. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7566. // 4.打印影楼地址信息、电话;
  7567. tagPrinter->SetFontFace(8, 1, "宋体");
  7568. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7569. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7570. tagPrinter->SetFontFace(11, 1, "宋体");
  7571. // 5.打印客户姓名
  7572. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7573. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7574. // 6.打印客户联系电话
  7575. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7576. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7577. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7578. // 7.打印开单日期
  7579. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7580. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7581. #if 0 // Original Edition
  7582. // 8.打印列字段:收款项目
  7583. tagPrinter->SetFontFace(13, 1, "宋体");
  7584. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7585. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7586. printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7587. // 9.打印列字段:金额
  7588. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7589. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7590. printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7591. // 10.打印列字段:开单人
  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_LEFT | FORMAT_VCENTER);
  7594. printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7595. #else
  7596. // 8.打印列字段:收款项目
  7597. tagPrinter->SetFontFace(13, 1, "宋体");
  7598. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7599. StrRect = CRect(66, 85, 280, 105);
  7600. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7601. //m_Print.DrawText("收款项目",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7602. // 8.1 Jeff add:支付方式
  7603. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7604. StrRect = CRect(280, 85, 350, 105);
  7605. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7606. //m_Print.DrawText("支付方式",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7607. // 9.打印列字段:金额
  7608. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7609. StrRect = CRect(350, 85, 442, 105);
  7610. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7611. //m_Print.DrawText("金额",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7612. // 10.打印列字段:开单人
  7613. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7614. StrRect = CRect(442, 85, 535, 105);
  7615. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7616. //m_Print.DrawText("开单人",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7617. //rcpos += 3;
  7618. #endif
  7619. // 11.画表格-画3列;old
  7620. // 11.draw 4 column
  7621. tagPrinter->SetFontFace(11, 1, "宋体");
  7622. int i;
  7623. //for( i=7; i<10; i++)
  7624. //{
  7625. // StrRect=load.m_rcarray.ElementAt(i);
  7626. // m_Print.DrawRect2(StrRect, 1);
  7627. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7628. //}
  7629. tagPrinter->DrawRect2(CRect(66, 85, 280, 105), 1);
  7630. tagPrinter->DrawRect2(CRect(280, 85, 350, 105), 1);
  7631. tagPrinter->DrawRect2(CRect(350, 85, 442, 105), 1);
  7632. tagPrinter->DrawRect2(CRect(442, 85, 535, 105), 1);
  7633. // 12.打印详细内容
  7634. int dty = 0;
  7635. int dtytemp = 0;
  7636. // for( i=10; i<14; i+=3)
  7637. //for( i=10; i<22; i+=3) // 循环4次,再画
  7638. int j = 0;
  7639. for (i = 10, j = 11; i<22; i += 3, j += 4) // 循环4次,再画
  7640. {
  7641. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  7642. CArray<CRect, CRect>rcarray;
  7643. CStringArray strarray2;
  7644. StrRect = load.m_rcarray.ElementAt(i);
  7645. StrRect.top += dty;
  7646. StrRect.bottom += dty;
  7647. StrRect.right -= 70; // Jeff add
  7648. //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;
  7649. /*
  7650. 4次的CRect
  7651. 66,105,350,125
  7652. 66,126,350,146
  7653. 66,147,350,167
  7654. 66,168,350,188
  7655. */
  7656. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  7657. {
  7658. StrRect = load.m_rcarray.ElementAt(i - 1);
  7659. StrRect.top += dty;
  7660. StrRect.bottom += dty;
  7661. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  7662. break;
  7663. }
  7664. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  7665. StrRect.left += 2;
  7666. StrRect.right -= 2;
  7667. StrRect.top += 4;
  7668. rcarray.Add(StrRect);
  7669. //strarray2.Add(pArray->ElementAt(i+1));
  7670. strarray2.Add(pArray->ElementAt(j));
  7671. //printf("Jeff:%d:%s\n\n",j,pArray->ElementAt(j));//Jeff Printf;
  7672. // 指定格子宽度,计算字符串占几行(高度).
  7673. INT bottom = CalcHeight(rcarray, strarray2, tagPrinter, FORMAT_LEFT);
  7674. dtytemp = bottom - StrRect.bottom;
  7675. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7676. // 重新获取表格大小,并画出表格;
  7677. /*
  7678. CRect(66,85,280,105),
  7679. CRect(280,85,350,105)
  7680. CRect(350,85,442,105)
  7681. CRect(442,85,535,105)
  7682. CRect(66,105,350,125),
  7683. CRect(66,126,350,146)
  7684. CRect(66,147,350,167)
  7685. CRect(66,168,350,188)
  7686. */
  7687. // 画收款项目框及打印内容;
  7688. StrRect = load.m_rcarray.ElementAt(i);
  7689. //StrRect=CRect(66,85,280,105);
  7690. StrRect.bottom += dtytemp;
  7691. StrRect.top += dty;
  7692. StrRect.bottom += dty;
  7693. //StrRect.left -= 70; // Jeff add
  7694. StrRect.right -= 70; // Jeff add
  7695. //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;
  7696. tagPrinter->DrawRect2(StrRect, 1);
  7697. // 画支付方式框及打印内容;
  7698. StrRect = load.m_rcarray.ElementAt(i);
  7699. //StrRect=CRect(280,85,350,105);
  7700. StrRect.bottom += dtytemp;
  7701. StrRect.top += dty;
  7702. StrRect.bottom += dty;
  7703. StrRect.left += StrRect.Width() - 70;
  7704. //StrRect.right += 70; // Jeff add
  7705. //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;
  7706. tagPrinter->DrawRect2(StrRect, 1);
  7707. StrRect.left += 2;
  7708. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7709. //printf("Jeff:%d:%s\n\n",j+1,pArray->ElementAt(j+1));//Jeff Printf;
  7710. // 画金额框及打印内容;
  7711. StrRect = load.m_rcarray.ElementAt(i + 1);
  7712. //StrRect=CRect(350,85,442,105);
  7713. StrRect.top += dty;
  7714. StrRect.bottom += dty;
  7715. StrRect.bottom += dtytemp;
  7716. //StrRect.right -= 70; // Jeff add
  7717. //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;
  7718. tagPrinter->DrawRect2(StrRect, 1);
  7719. StrRect.left += 2;
  7720. // 打印出金额字段内容
  7721. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7722. //printf("Jeff:%d:%s\n\n",j+2,pArray->ElementAt(j+2));//Jeff Printf;
  7723. // 画开单人框及打印内容;
  7724. StrRect = load.m_rcarray.ElementAt(i + 2);
  7725. //StrRect=CRect(442,85,535,105);
  7726. StrRect.top += dty;
  7727. StrRect.bottom += dty;
  7728. StrRect.bottom += dtytemp;
  7729. //StrRect.right -= 70; // Jeff add
  7730. //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;
  7731. tagPrinter->DrawRect2(StrRect, 1);
  7732. StrRect.left += 2;
  7733. // 打印开单人字段内容
  7734. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 3), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7735. //printf("Jeff:%d:%s\n\n",j+3,pArray->ElementAt(j+3));//Jeff Printf;
  7736. dty += dtytemp;
  7737. }
  7738. //.打印->付款情况 应付 实付 欠款.
  7739. i = 22;
  7740. j = 27;
  7741. StrRect = load.m_rcarray.ElementAt(i);
  7742. StrRect.top += dty;
  7743. StrRect.bottom += dty;
  7744. tagPrinter->DrawRect2(StrRect, 1);
  7745. StrRect.left += 2;
  7746. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7747. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7748. //.打印->合计人民币(大写):.......
  7749. i = 23;
  7750. j = 28;
  7751. StrRect = load.m_rcarray.ElementAt(i);
  7752. StrRect.top += dty;
  7753. StrRect.bottom += dty;
  7754. tagPrinter->DrawRect2(StrRect, 1);
  7755. StrRect.left += 2;
  7756. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7757. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7758. // 打印总金额;
  7759. tagPrinter->SetFontFace(7, 1, "宋体");
  7760. for (i = 24, j = 29; i < 27; i++, j++)
  7761. {
  7762. StrRect = load.m_rcarray.ElementAt(i);
  7763. StrRect.top += dty;
  7764. StrRect.bottom += dty;
  7765. StrRect.left += 2;
  7766. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7767. }
  7768. StrRect = load.m_rcarray.ElementAt(24);
  7769. StrRect.top += dty;
  7770. StrRect.bottom += dty;
  7771. hei = StrRect.Height();
  7772. StrRect.top += hei;
  7773. StrRect.bottom += hei;
  7774. StrRect.right += 100;
  7775. StrRect.left += 2;
  7776. StrRect = load.m_rcarray.ElementAt(27);
  7777. StrRect.top += dty;
  7778. StrRect.bottom += dty;
  7779. AutoDraw(*tagPrinter, StrRect, pArray->ElementAt(32), 1.0);
  7780. }
  7781. if (bPrintImmediately == TRUE)
  7782. {
  7783. printcot = nCount;
  7784. ////结束打印
  7785. tagPrinter->EndPage();
  7786. tagPrinter->EndPrint();
  7787. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7788. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7789. CString sql;
  7790. sql.Format("update version set [serialno]='%s'", SerialNo);
  7791. g_sendhead.bsql = 1;
  7792. g_nYearposTemp = g_nYearpos;
  7793. g_nYearpos = -1;
  7794. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7795. g_nYearpos = g_nYearposTemp;
  7796. #endif
  7797. }
  7798. else
  7799. {
  7800. PrintPreview dlg;
  7801. dlg.m_mode = 3;
  7802. tagPrinter->GetWidHei(dlg.m_w, dlg.m_h);
  7803. dlg.m_pDC = tagPrinter->GetPDC();
  7804. //if(aa==0)
  7805. //{
  7806. if (dlg.DoModal() != IDOK)
  7807. {
  7808. return;
  7809. }
  7810. else
  7811. {
  7812. printcot = dlg.m_num;
  7813. //m_Print.deletePrinter();
  7814. for (int i = 0; i < printcot; i++)
  7815. {
  7816. //tagPrinter->EndPage();
  7817. //tagPrinter->m_DC.AbortDoc(); // 结束清空由StartDoc写入的内容;2014-09-15;
  7818. //tagPrinter->m_DC.EndDoc();
  7819. //Sleep(10000);
  7820. //tagPrinter->StartPrint();
  7821. //tagPrinter->NewPage();
  7822. //PrintReceipt_02(pArray,/*tagPrinter*/NULL,printcot,TRUE);
  7823. PrintReceipt_02(pArray, tagPrinter, printcot, TRUE);
  7824. }
  7825. }
  7826. if (tagPrinter) delete tagPrinter;
  7827. //}
  7828. }
  7829. //}
  7830. }
  7831. void CMainFrame::PrintFlowChart(CString strOrderNumber) // 选片打单;
  7832. {
  7833. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(75)))
  7834. {
  7835. // Jeff 使用风格2打印;
  7836. //PrintFlowChart3_20151116(strOrderNumber);
  7837. PrintFlowChart3(strOrderNumber);
  7838. return;
  7839. }
  7840. #ifdef ZHIAI_VERSION
  7841. PrintFlowChart2(strOrderNumber);
  7842. return;
  7843. #endif
  7844. int i = 0;
  7845. int printcot = 1;
  7846. for (int aa = 0; aa < printcot; aa++)
  7847. {
  7848. CPrintRX m_Print;
  7849. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7850. {
  7851. m_Print.InitToPrint(NULL, 1);
  7852. }
  7853. else
  7854. {
  7855. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  7856. if (name.IsEmpty())
  7857. m_Print.InitToPrint(NULL, 1);
  7858. else
  7859. {
  7860. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  7861. if (nret == -1 && aa == 0)
  7862. {
  7863. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  7864. }
  7865. }
  7866. }
  7867. m_Print.StartPrint();
  7868. m_Print.StartPage();
  7869. // CRect StrRect(0,0,560,818);
  7870. LoadRect load;
  7871. load.SetLiaPath("4.lia");
  7872. load.SetMargins(-14, -14);
  7873. if (!load.Load())return;
  7874. LoadRect load2;
  7875. load2.SetMargins(-14, 472 + 27 - 14);
  7876. load2.SetLiaPath("5.lia");
  7877. if (!load2.Load())return;
  7878. //////////////////////////////////////////////////////////////
  7879. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2'";
  7880. g_sendhead.code[0] = 54;
  7881. g_sendhead.code[1] = 223;
  7882. g_sendhead.tabcount = 2;
  7883. g_sendhead.bsql = 0;
  7884. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  7885. CArray<CStringArray, CStringArray>sparray;
  7886. DataToArray(&g_List1array, &sparray);
  7887. CString spno;
  7888. for ( i = 0; i < sparray.GetSize(); i++)
  7889. {
  7890. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  7891. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  7892. if (sparray.ElementAt(i).ElementAt(5) == "入册" && sparray.ElementAt(i).ElementAt(5) == "入底" && sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  7893. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  7894. spno += sparray.ElementAt(i).ElementAt(5);
  7895. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  7896. spno += "; ";
  7897. else
  7898. {
  7899. spno += ":";
  7900. spno += sparray.ElementAt(i).ElementAt(6);
  7901. spno += "; ";
  7902. }
  7903. }
  7904. spno += " 加挑:";
  7905. for (i = 0; i < sparray.GetSize(); i++)
  7906. {
  7907. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  7908. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  7909. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  7910. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  7911. spno += sparray.ElementAt(i).ElementAt(5);
  7912. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  7913. spno += "; ";
  7914. else
  7915. {
  7916. spno += ":";
  7917. spno += sparray.ElementAt(i).ElementAt(6);
  7918. spno += "; ";
  7919. }
  7920. }
  7921. if (spno.Right(6) == " 加挑:")
  7922. {
  7923. spno = spno.Left(spno.GetLength() - 6);
  7924. }
  7925. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  7926. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  7927. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  7928. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  7929. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  7930. if (m_urgent.IsEmpty())m_urgent = "否";
  7931. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  7932. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  7933. // CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  7934. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  7935. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  7936. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  7937. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  7938. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  7939. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  7940. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  7941. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  7942. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(17) + g_List1array.ElementAt(0).ElementAt(29);
  7943. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  7944. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  7945. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  7946. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  7947. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  7948. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  7949. CString m_sum3;
  7950. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  7951. ::ConvertToPrice(m_sum3);
  7952. if (m_money3.IsEmpty())m_money3 = "0";
  7953. // m_money3=m_money3+"/"+m_sum3;
  7954. CString name;
  7955. if (!m_name1.IsEmpty())
  7956. name = m_name1 + ",";
  7957. name += m_name2;
  7958. name.TrimRight(",");
  7959. CString phone;
  7960. if (!m_phone1.IsEmpty())
  7961. phone = m_phone1 + ",";
  7962. phone += m_phone2; phone.TrimRight(",");
  7963. if (IsHasRights2new(31) == 0)
  7964. phone = "***";
  7965. CStringArray strarray;
  7966. strarray.Add(m_urgent);
  7967. strarray.Add(m_ren);
  7968. strarray.Add(m_waiter3);
  7969. strarray.Add(name);
  7970. strarray.Add(m_time2);
  7971. strarray.Add(m_time4);
  7972. strarray.Add(m_money3);
  7973. strarray.Add(m_sum3);
  7974. strarray.Add(m_takezs);
  7975. strarray.Add(m_taoxizs);
  7976. strarray.Add(m_choosezs);
  7977. strarray.Add(strOrderNumber);
  7978. strarray.Add(phone);
  7979. ////////////////////////////////////////////////////////////////
  7980. int rcpos = -1;
  7981. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7982. Image *pImg = NULL;
  7983. #ifdef MNLS_VERSION
  7984. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  7985. #else
  7986. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  7987. #endif
  7988. m_Print.DrawImage(pImg, StrRect);
  7989. delete pImg;
  7990. m_Print.SetFontFace(11, 1, "宋体");
  7991. StrRect = load2.m_rcarray.ElementAt(7);
  7992. StrRect.top = load2.m_rcarray.ElementAt(15).top - 15;
  7993. StrRect.bottom = load2.m_rcarray.ElementAt(15).bottom - 15;
  7994. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  7995. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7996. StrRect.top += 15;
  7997. StrRect.bottom += 15;
  7998. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  7999. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8000. m_Print.SetFontFace(15, 1, "宋体");
  8001. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8002. #ifdef MNLS_VERSION
  8003. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8004. #endif
  8005. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8006. #ifdef MNLS_VERSION
  8007. m_Print.DrawRect(StrRect);
  8008. #endif
  8009. m_Print.SetFontFace(7, 1, "黑体");
  8010. m_Print.SetColor(0xffffff);
  8011. #ifdef MNLS_VERSION
  8012. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8013. #endif
  8014. m_Print.SetColor(0);
  8015. m_Print.SetFontFace(25, 1, "黑体");
  8016. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8017. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8018. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  8019. {
  8020. Image *pImg = NULL;
  8021. g_nSendCode = 31;
  8022. int g_nYearposTemp = g_nYearpos;
  8023. g_nYearpos = -1;
  8024. g_pMainWnd->ProcessChatMessageRequest2(1);
  8025. g_nYearpos = g_nYearposTemp;
  8026. g_nSendCode = 0;
  8027. if (g_bSendOK == 0)return;
  8028. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8029. if (pImg)
  8030. {
  8031. StrRect.left = 450;
  8032. StrRect.top = 22;
  8033. StrRect.right = StrRect.left + 60;
  8034. StrRect.bottom = StrRect.top + 60;
  8035. m_Print.DrawImage(pImg, StrRect);
  8036. delete pImg; pImg = NULL;
  8037. }
  8038. }
  8039. #ifdef CHILD_VERSION
  8040. CString title[13] = { "是否加急:", "接单门市:", \
  8041. "选样人员:", "客人姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  8042. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:"
  8043. };
  8044. #else
  8045. CString title[13] = { "是否加急:", "接单门市:", \
  8046. "选样人员:", "新郎新娘姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  8047. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:" };
  8048. #endif
  8049. m_Print.SetFontFace(12, 1, "宋体");
  8050. for (i = 0; i < 13; i++)
  8051. {
  8052. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8053. if (i < 3)
  8054. m_Print.DrawRect2(StrRect, 0);
  8055. else
  8056. m_Print.DrawRect2(StrRect, 1);
  8057. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8058. }
  8059. for (i = 18; i <= 37; i++)
  8060. {
  8061. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8062. if (i >= 19 && i <= 21)
  8063. m_Print.DrawRect2(StrRect, 2);
  8064. /* else if(i==26)
  8065. {
  8066. CRect rc=StrRect;
  8067. CRect rc2=rc;
  8068. rc.right -=rc2.Width ()/2;
  8069. m_Print.DrawRect2(rc, 1);
  8070. rc2.left +=rc.Width ();
  8071. m_Print.DrawRect2(rc2, 1);
  8072. }*/
  8073. else
  8074. m_Print.DrawRect2(StrRect, 1);
  8075. if (i == 18)
  8076. {
  8077. StrRect.left += 5;
  8078. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8079. }
  8080. }
  8081. //////////////////////////////////////
  8082. rcpos = -1;
  8083. for (i = 0; i < 8; i++)
  8084. {
  8085. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8086. m_Print.DrawRect2(StrRect, 1);
  8087. }
  8088. #ifdef CHILD_VERSION
  8089. CString title2[4] = { "引导师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  8090. #else
  8091. CString title2[4] = { "化妆师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  8092. #endif
  8093. for (i = 0; i < 4; i++)
  8094. {
  8095. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8096. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8097. }
  8098. for (i = 0; i < 4; i++)
  8099. {
  8100. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  8101. m_Print.DrawRect2(StrRect, 2);
  8102. }
  8103. StrRect = load2.m_rcarray.ElementAt(11);
  8104. StrRect.top -= 15;
  8105. StrRect.bottom -= 15;
  8106. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客选片签名:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8107. StrRect = load2.m_rcarray.ElementAt(15);
  8108. StrRect.top -= 15;
  8109. StrRect.bottom -= 15;
  8110. m_Print.DrawRect2(StrRect, 2);
  8111. ///////////////////////////////////////////
  8112. for (i = 19; i <= 31; i++)
  8113. {
  8114. StrRect = load.m_rcarray.ElementAt(i - 1);
  8115. StrRect.left += 4;
  8116. if (i == 31)
  8117. {
  8118. if (m_phone1.IsEmpty() == 0 && m_phone2.IsEmpty() == 0)
  8119. {
  8120. StrRect.top += 2;
  8121. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  8122. StrRect.top += 8;
  8123. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8124. }
  8125. else
  8126. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8127. }
  8128. /* else if((i-19)==7)
  8129. {
  8130. CRect rc=StrRect;
  8131. CRect rc2=rc;
  8132. rc.right -=rc2.Width ()/2;
  8133. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8134. rc2.left +=rc.Width ()+3;
  8135. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8136. }*/
  8137. else
  8138. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8139. }
  8140. strarray.RemoveAll();
  8141. strarray.Add(m_waiter2);
  8142. strarray.Add(m_waiter1);
  8143. strarray.Add(m_waiter4);
  8144. for (i = 13; i <= 15; i++)
  8145. {
  8146. StrRect = load2.m_rcarray.ElementAt(i - 1);
  8147. StrRect.left += 4;
  8148. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8149. }
  8150. ///////////spno
  8151. CRect sprc[14];
  8152. for (i = 0; i < 14; i++)
  8153. {
  8154. if (i < 7)
  8155. {
  8156. if (i == 0)
  8157. {
  8158. StrRect = load.m_rcarray.ElementAt(17); StrRect.left += 94; StrRect.right -= 3;
  8159. }
  8160. else
  8161. {
  8162. StrRect = load.m_rcarray.ElementAt(30 + i); StrRect.left += 4; StrRect.right -= 3;
  8163. }
  8164. }
  8165. else
  8166. {
  8167. StrRect = load2.m_rcarray.ElementAt(i - 7); StrRect.left += 4; StrRect.right -= 3;
  8168. }
  8169. sprc[i] = StrRect;
  8170. }
  8171. CString temp, tempspno, tempbz;
  8172. CSize size;
  8173. BOOL bRun = 0;
  8174. int fontsize = 12;
  8175. ll: tempspno = spno;
  8176. tempbz = m_bz;
  8177. m_Print.SetFontFace(fontsize, 1, "宋体");
  8178. for (i = 0; i<14; i++)
  8179. {
  8180. if (!tempspno.IsEmpty())
  8181. {
  8182. temp = tempspno;
  8183. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8184. int right = 0;
  8185. CRect temprc = sprc[i];
  8186. while (size.cx>temprc.Width())
  8187. {
  8188. right++;
  8189. temp = tempspno.Left(tempspno.GetLength() - (right));
  8190. if (GIsHalfHZ(temp))
  8191. {
  8192. right++;
  8193. temp.Delete(temp.GetLength() - 1);
  8194. }
  8195. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8196. }
  8197. if (bRun)
  8198. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8199. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  8200. if (tempspno.IsEmpty())i++;
  8201. }
  8202. else if (!tempbz.IsEmpty())
  8203. {
  8204. temp = tempbz;
  8205. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8206. int right = 0;
  8207. CRect temprc = sprc[i];
  8208. while (size.cx > temprc.Width())
  8209. {
  8210. right++;
  8211. temp = tempbz.Left(tempbz.GetLength() - (right));
  8212. if (GIsHalfHZ(temp))
  8213. {
  8214. right++;
  8215. temp.Delete(temp.GetLength() - 1);
  8216. }
  8217. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8218. }
  8219. if (bRun)
  8220. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8221. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  8222. }
  8223. }
  8224. if (tempspno.IsEmpty() == 0 || tempbz.IsEmpty() == 0)
  8225. {
  8226. fontsize--;
  8227. goto ll;
  8228. }
  8229. if (bRun == 0)
  8230. {
  8231. bRun = 1;
  8232. goto ll;
  8233. }
  8234. PrintPreview dlg;
  8235. dlg.m_mode = 2;
  8236. dlg.m_name = name;
  8237. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8238. dlg.m_pDC = m_Print.GetPDC();
  8239. if (aa == 0)
  8240. {
  8241. if (dlg.DoModal() != IDOK)
  8242. return;
  8243. printcot = dlg.m_num;
  8244. }
  8245. //结束打印
  8246. m_Print.EndPage();
  8247. m_Print.EndPrint();
  8248. }
  8249. }
  8250. void CMainFrame::PrintFlowChart3LKAY(CString strOrderNumber)
  8251. {
  8252. int i = 0;
  8253. int printcot = 1;
  8254. for (int aa = 0; aa < printcot; aa++)
  8255. {
  8256. CPrintRX m_Print;
  8257. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  8258. {
  8259. m_Print.InitToPrint(NULL, 1);
  8260. }
  8261. else
  8262. {
  8263. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  8264. if (name.IsEmpty())
  8265. m_Print.InitToPrint(NULL, 1);
  8266. else
  8267. {
  8268. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8269. if (nret == -1 && aa == 0)
  8270. {
  8271. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8272. }
  8273. }
  8274. }
  8275. m_Print.StartPrint();
  8276. m_Print.StartPage();
  8277. LoadRect load;
  8278. load.SetLiaPath("18.lia");
  8279. load.SetMargins(10, 0);
  8280. if (!load.Load())return;
  8281. CString str;
  8282. int rcpos = -1;
  8283. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8284. m_Print.SetFontFace(25, 1, "宋体");
  8285. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8286. m_Print.SetFontFace(15, 1, "宋体");
  8287. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8288. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8289. m_Print.SetFontFace(9, 1, "宋体");
  8290. //////////////////////////////////////////////////////////////
  8291. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8292. g_sendhead.code[0] = 54;
  8293. g_sendhead.code[1] = 223;
  8294. g_sendhead.code[2] = 52;
  8295. g_sendhead.tabcount = 3;
  8296. g_sendhead.bsql = 0;
  8297. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  8298. CArray<CStringArray, CStringArray>sparray;
  8299. CArray<CStringArray, CStringArray>clientarray;
  8300. DataToArray(&g_List1array, &sparray, &clientarray);
  8301. CString spno;
  8302. CStringArray sparray2;
  8303. for ( i = 0; i < sparray.GetSize(); i++)
  8304. {
  8305. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8306. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8307. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8308. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8309. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8310. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8311. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8312. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8313. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8314. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8315. }
  8316. for (i = 0; i < sparray.GetSize(); i++)
  8317. {
  8318. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8319. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8320. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8321. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8322. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8323. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8324. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8325. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8326. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8327. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8328. }
  8329. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8330. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8331. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8332. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8333. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8334. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8335. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8336. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8337. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8338. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8339. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8340. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8341. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8342. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8343. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8344. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8345. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8346. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8347. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8348. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8349. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8350. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8351. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8352. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8353. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8354. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8355. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8356. CString m_sum3;
  8357. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8358. ::ConvertToPrice(m_sum3);
  8359. if (m_money3.IsEmpty())m_money3 = "0";
  8360. int dty = 0;
  8361. CString name;
  8362. if (!m_name1.IsEmpty())
  8363. name = m_name1 + ",";
  8364. name += m_name2;
  8365. name.TrimRight(",");
  8366. CString phone;
  8367. if (!m_phone1.IsEmpty())
  8368. phone = m_phone1 + ",";
  8369. phone += m_phone2; phone.TrimRight(",");
  8370. if (IsHasRights2new(31) == 0)
  8371. phone = "***";
  8372. CStringArray strarray;
  8373. #ifdef CHILD_VERSION
  8374. if (m_birthday.IsEmpty())
  8375. strarray.Add("姓名/性别");
  8376. else
  8377. strarray.Add("姓名/性别/年龄");
  8378. #else
  8379. strarray.Add("客人姓名");
  8380. #endif
  8381. strarray.Add("电话");
  8382. strarray.Add("单号");
  8383. strarray.Add("套系");
  8384. strarray.Add("选样");
  8385. strarray.Add("余款/加挑");
  8386. strarray.Add("选片/日期");
  8387. #ifdef CHILD_VERSION
  8388. if (m_birthday.IsEmpty())
  8389. strarray.Add(name + "/" + m_sex);
  8390. else
  8391. {
  8392. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8393. m_birthday.Format("%d", year + 1);
  8394. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8395. }
  8396. #else
  8397. strarray.Add(name);
  8398. #endif
  8399. strarray.Add(phone);
  8400. strarray.Add(strOrderNumber);
  8401. strarray.Add(m_taoxiname);
  8402. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8403. strarray.Add(str);
  8404. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8405. strarray.Add(str);
  8406. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8407. for (i = 3; i <= 16; i++)
  8408. {
  8409. StrRect = load.m_rcarray.ElementAt(i - 1);
  8410. if (i < 10)
  8411. {
  8412. m_Print.DrawRect2(StrRect, 1);
  8413. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8414. }
  8415. }
  8416. StrRect = load.m_rcarray.ElementAt(29);
  8417. m_Print.DrawRect2(StrRect, 1);
  8418. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8419. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  8420. {
  8421. Image *pImg = NULL;
  8422. g_nSendCode = 31;
  8423. int g_nYearposTemp = g_nYearpos;
  8424. g_nYearpos = -1;
  8425. g_pMainWnd->ProcessChatMessageRequest2(1);
  8426. g_nYearpos = g_nYearposTemp;
  8427. g_nSendCode = 0;
  8428. if (g_bSendOK == 0)return;
  8429. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8430. if (pImg)
  8431. {
  8432. StrRect.left = 485;
  8433. StrRect.top = 12;
  8434. StrRect.right = StrRect.left + 60;
  8435. StrRect.bottom = StrRect.top + 60;
  8436. m_Print.DrawImage(pImg, StrRect);
  8437. delete pImg; pImg = NULL;
  8438. }
  8439. }
  8440. CArray<CRect, CRect>rcarray;
  8441. CStringArray strarray2;
  8442. for (i = 10; i <= 16; i++)
  8443. {
  8444. StrRect = load.m_rcarray.ElementAt(i - 1);
  8445. StrRect.left += 2;
  8446. StrRect.right -= 2;
  8447. StrRect.top += 2;
  8448. rcarray.Add(StrRect);
  8449. strarray2.Add(strarray.ElementAt(7 + i - 10));
  8450. }
  8451. if (1)
  8452. {
  8453. StrRect = load.m_rcarray.ElementAt(30);
  8454. StrRect.left += 2;
  8455. StrRect.right -= 2;
  8456. StrRect.top += 2;
  8457. rcarray.Add(StrRect);
  8458. strarray2.Add(m_time6 + "/" + m_time5);
  8459. }
  8460. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8461. for (i = 10; i <= 16; i++)
  8462. {
  8463. StrRect = load.m_rcarray.ElementAt(i - 1);
  8464. if (i == 10)
  8465. {
  8466. dty += bottom - StrRect.bottom;
  8467. }
  8468. StrRect.bottom = bottom;
  8469. m_Print.DrawRect2(StrRect, 1);
  8470. }
  8471. if (1)
  8472. {
  8473. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  8474. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  8475. // m_Print.DrawText((LPTSTR)(LPCTSTR)(m_time6+"/"+m_time5), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER );
  8476. }
  8477. m_Print.SetFontFace(15, 1, "宋体");
  8478. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  8479. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8480. m_Print.SetFontFace(9, 1, "宋体");
  8481. strarray.RemoveAll();
  8482. strarray.Add("产品名称");
  8483. strarray.Add("数量");
  8484. strarray.Add("P数");
  8485. strarray.Add("张数");
  8486. strarray.Add("照片编号");
  8487. CArray<CRect, CRect>rc2array;
  8488. int wid = 25;
  8489. for (i = 18; i <= 22; i++)
  8490. {
  8491. StrRect = load.m_rcarray.ElementAt(i - 1);
  8492. if (i == 19)
  8493. {
  8494. StrRect.right = StrRect.left + wid;
  8495. }
  8496. if (i == 20)
  8497. {
  8498. StrRect = load.m_rcarray.ElementAt(i - 2);
  8499. StrRect.left += wid; StrRect.right = StrRect.left;
  8500. StrRect.right += wid;
  8501. }
  8502. if (i == 21)
  8503. {
  8504. StrRect = load.m_rcarray.ElementAt(i - 3);
  8505. StrRect.left += wid * 2; StrRect.right = StrRect.left;
  8506. StrRect.right += wid;
  8507. wid = StrRect.right;
  8508. }
  8509. if (i == 22)
  8510. {
  8511. StrRect = load.m_rcarray.ElementAt(i - 3);
  8512. StrRect.left = wid;
  8513. }
  8514. StrRect.top += dty; StrRect.bottom += dty;
  8515. m_Print.DrawRect2(StrRect, 1);
  8516. StrRect.left += 2;
  8517. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8518. StrRect.left -= 2;
  8519. StrRect.top = StrRect.bottom;
  8520. StrRect.bottom += 18;
  8521. rc2array.Add(StrRect);
  8522. }
  8523. int curypos = 0;
  8524. for (i = 0; i < sparray2.GetSize(); i += 5)
  8525. {
  8526. rcarray.RemoveAll();
  8527. strarray2.RemoveAll();
  8528. int j = 0;
  8529. for ( j = 0; j < 5; j++)
  8530. {
  8531. StrRect = rc2array.ElementAt(j);
  8532. StrRect.left += 2;
  8533. StrRect.right -= 2;
  8534. StrRect.top += 2;
  8535. rcarray.Add(StrRect);
  8536. strarray2.Add(sparray2.ElementAt(i + j));
  8537. }
  8538. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8539. rcarray.RemoveAll();
  8540. for (j = 0; j < 5; j++)
  8541. {
  8542. StrRect = rc2array.ElementAt(j);
  8543. if (j == 0)
  8544. {
  8545. dty += bottom - StrRect.bottom;
  8546. }
  8547. StrRect.bottom = bottom;
  8548. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8549. StrRect.top = StrRect.bottom;
  8550. StrRect.bottom += 18;
  8551. rcarray.Add(StrRect);
  8552. }
  8553. rc2array.RemoveAll();
  8554. rc2array.Copy(rcarray);
  8555. }
  8556. m_Print.SetFontFace(15, 1, "宋体");
  8557. StrRect = load.m_rcarray.ElementAt(20);
  8558. dty = curypos - StrRect.bottom + 35;
  8559. StrRect.top += dty; StrRect.bottom += dty;
  8560. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8561. m_Print.SetFontFace(9, 1, "宋体");
  8562. rcarray.RemoveAll();
  8563. strarray2.RemoveAll();
  8564. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8565. StrRect.left += 2;
  8566. StrRect.right -= 2;
  8567. StrRect.top += 2;
  8568. rcarray.Add(StrRect);
  8569. strarray2.Add(m_bz);
  8570. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8571. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8572. dty += bottom - StrRect.bottom;
  8573. StrRect.bottom = bottom;
  8574. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8575. m_Print.SetFontFace(10, 1, "宋体");
  8576. StrRect = load.m_rcarray.ElementAt(22);
  8577. dty = curypos - StrRect.bottom + 25;
  8578. StrRect.top += dty; StrRect.bottom += dty;
  8579. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  8580. if (m_edit9.IsEmpty())
  8581. {
  8582. m_edit9 = "\
  8583. 经确认后的照片均排入制作流程,\r\n\
  8584. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  8585. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  8586. }
  8587. CString info1, info2, info3;
  8588. int newlinepos = m_edit9.Find("\r\n");
  8589. if (newlinepos != -1)
  8590. {
  8591. info1 = m_edit9.Left(newlinepos);
  8592. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8593. }
  8594. newlinepos = m_edit9.Find("\r\n");
  8595. if (newlinepos != -1)
  8596. {
  8597. info2 = m_edit9.Left(newlinepos);
  8598. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8599. info3 = m_edit9;
  8600. }
  8601. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8602. StrRect = load.m_rcarray.ElementAt(23);
  8603. StrRect.top += dty; StrRect.bottom += dty;
  8604. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8605. StrRect = load.m_rcarray.ElementAt(24);
  8606. StrRect.top += dty; StrRect.bottom += dty;
  8607. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8608. StrRect.top += 15;
  8609. StrRect.bottom += 15;
  8610. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8611. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  8612. StrRect = load.m_rcarray.ElementAt(25);
  8613. StrRect.top += dty - dy;
  8614. StrRect.bottom += dty - dy;
  8615. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8616. StrRect = load.m_rcarray.ElementAt(26);
  8617. StrRect.top += dty - dy;
  8618. StrRect.bottom += dty - dy;
  8619. m_Print.DrawRect2(StrRect, 2);
  8620. StrRect = load.m_rcarray.ElementAt(25);
  8621. StrRect.top += dty + 15 - dy;
  8622. StrRect.bottom += dty + 15 - dy;
  8623. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8624. StrRect = load.m_rcarray.ElementAt(26);
  8625. StrRect.top += dty + 15 - dy;
  8626. StrRect.bottom += dty + 15 - dy;
  8627. m_Print.DrawRect2(StrRect, 2);
  8628. StrRect = load.m_rcarray.ElementAt(25);
  8629. StrRect.top += dty + 15 * 2 - dy;
  8630. StrRect.bottom += dty + 15 * 2 - dy;
  8631. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8632. StrRect = load.m_rcarray.ElementAt(26);
  8633. StrRect.top += dty + 15 * 2 - dy;
  8634. StrRect.bottom += dty + 15 * 2 - dy;
  8635. m_Print.DrawRect2(StrRect, 2);
  8636. PrintPreview dlg; dlg.m_mode = 2;
  8637. dlg.m_name = name;
  8638. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8639. dlg.m_pDC = m_Print.GetPDC();
  8640. if (aa == 0)
  8641. {
  8642. if (dlg.DoModal() != IDOK)
  8643. return;
  8644. printcot = dlg.m_num;
  8645. }
  8646. //结束打印
  8647. m_Print.EndPage();
  8648. m_Print.EndPrint();
  8649. }
  8650. }
  8651. void CMainFrame::PrintFlowChart3(CString strOrderNumber) // 选片打单 风格2;
  8652. {
  8653. #ifdef LKAY_VERSION
  8654. PrintFlowChart3LKAY(strOrderNumber);
  8655. return;
  8656. #endif
  8657. int i = 0;
  8658. int j = 0;
  8659. int printcot = 1;
  8660. for (int aa = 0; aa < printcot; aa++)
  8661. {
  8662. BOOL bSecondPage = 0;
  8663. int nPrintedPos = 0;
  8664. for (int bb = 0; bb < 2; bb++)
  8665. {
  8666. if (bb && bSecondPage == 0)break;
  8667. CPrintRX m_Print;
  8668. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58))) // 58-[version].[setcheck1] ==1,使用默认打印机;
  8669. {
  8670. m_Print.InitToPrint(NULL, 1);
  8671. }
  8672. else // 否则使用指定的打印机;
  8673. {
  8674. CString name = g_cominfoarray.ElementAt(0).ElementAt(64); // 64-[version].[printer2] 制作单打印机;
  8675. if (name.IsEmpty())
  8676. m_Print.InitToPrint(NULL, 1);
  8677. else
  8678. {
  8679. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8680. if (nret == -1 && aa == 0)
  8681. {
  8682. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8683. }
  8684. }
  8685. }
  8686. m_Print.StartPrint();
  8687. m_Print.StartPage();
  8688. LoadRect load;
  8689. load.SetLiaPath("18.lia");
  8690. load.SetMargins(10, 0);
  8691. if (!load.Load())return;
  8692. CString str;
  8693. int rcpos = -1;
  8694. // ■■■■■■从18.lia获取到第一个区域大小 - 1.显示店名;
  8695. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8696. if ((bb == 0 && bSecondPage == 0))
  8697. {
  8698. m_Print.SetFontFace(25, 1, "宋体");
  8699. // 10-[version].[info1] 店名;
  8700. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8701. m_Print.SetFontFace(15, 1, "宋体");
  8702. // ■■■■■■从18.lia获取第二个区域大小 - 2.显示"基本资料";
  8703. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8704. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8705. m_Print.SetFontFace(9, 1, "宋体");
  8706. }
  8707. //////////////////////////////////////////////////////////////
  8708. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8709. g_sendhead.code[0] = 54; // dindan;
  8710. g_sendhead.code[1] = 223; // dindanspview2; shangpin+dindansp;
  8711. g_sendhead.code[2] = 52; // client;
  8712. g_sendhead.tabcount = 3;
  8713. g_sendhead.bsql = 0;
  8714. g_pMainWnd->ProcessChatMessageRequest2(filter);
  8715. if (g_bSendOK == 0)return;
  8716. CArray<CStringArray, CStringArray>sparray;
  8717. CArray<CStringArray, CStringArray>clientarray;
  8718. DataToArray(&g_List1array, &sparray, &clientarray);
  8719. CString spno;
  8720. CStringArray sparray2;
  8721. for ( i = 0; i < sparray.GetSize(); i++)
  8722. {
  8723. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8724. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8725. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8726. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8727. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8728. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8729. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8730. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8731. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8732. }
  8733. for (i = 0; i < sparray.GetSize(); i++)
  8734. {
  8735. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8736. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8737. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8738. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8739. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8740. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8741. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8742. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8743. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8744. }
  8745. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8746. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8747. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8748. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8749. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8750. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8751. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8752. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8753. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8754. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8755. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8756. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8757. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8758. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8759. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8760. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8761. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8762. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8763. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  8764. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8765. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8766. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8767. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8768. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8769. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8770. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8771. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8772. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8773. CString m_sum3;
  8774. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8775. ::ConvertToPrice(m_sum3);
  8776. if (m_money3.IsEmpty())m_money3 = "0";
  8777. int dty = 0;
  8778. CString name;
  8779. if (!m_name1.IsEmpty())
  8780. name = m_name1 + ",";
  8781. name += m_name2;
  8782. name.TrimRight(",");
  8783. CString phone;
  8784. if (!m_phone1.IsEmpty())
  8785. phone = m_phone1 + ",";
  8786. phone += m_phone2; phone.TrimRight(",");
  8787. if (IsHasRights2new(31) == 0)
  8788. phone = "***";
  8789. CStringArray strarray;
  8790. CArray<CRect, CRect>rcarray;
  8791. CStringArray strarray2; CArray<CRect, CRect>rc2array;
  8792. int bottom;
  8793. if ((bb == 0 && bSecondPage == 0))
  8794. {
  8795. #ifdef CHILD_VERSION
  8796. if (m_birthday.IsEmpty())
  8797. strarray.Add("姓名/性别");
  8798. else
  8799. strarray.Add("姓名/性别/年龄");
  8800. #else
  8801. strarray.Add("客人姓名"); // 第3.1区域 -3.显示客人姓名;
  8802. #endif
  8803. strarray.Add("电话");
  8804. strarray.Add("单号");
  8805. strarray.Add("套系");
  8806. strarray.Add("选样");
  8807. strarray.Add("余款/加挑");
  8808. strarray.Add("选片/日期");
  8809. #ifdef CHILD_VERSION
  8810. if (m_birthday.IsEmpty())
  8811. strarray.Add(name + "/" + m_sex);
  8812. else
  8813. {
  8814. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8815. m_birthday.Format("%d", year + 1);
  8816. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8817. }
  8818. #else
  8819. strarray.Add(name); // 第4.1区域 -3.显示客人姓名;
  8820. #endif
  8821. strarray.Add(phone);
  8822. strarray.Add(strOrderNumber);
  8823. strarray.Add(m_taoxiname);
  8824. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8825. strarray.Add(str);
  8826. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8827. strarray.Add(str);
  8828. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8829. for (i = 3; i <= 16; i++)
  8830. {
  8831. // ■■■■■■从18.lia中获取第3~16的区域大小;
  8832. StrRect = load.m_rcarray.ElementAt(i - 1);
  8833. if (i < 10)
  8834. {
  8835. m_Print.DrawRect2(StrRect, 1);
  8836. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8837. }
  8838. }
  8839. // ■■■■■■从18.lia中获取第30的区域大小;
  8840. StrRect = load.m_rcarray.ElementAt(29);
  8841. m_Print.DrawRect2(StrRect, 1);
  8842. BOOL bPrintDate = 1;
  8843. #ifdef DDF_VERSION
  8844. // bPrintDate=0;
  8845. #else
  8846. if (m_time5 == "" && m_time6 == "")
  8847. bPrintDate = 0;
  8848. #endif
  8849. if (bPrintDate)
  8850. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8851. else
  8852. {
  8853. #ifdef CHILD_VERSION
  8854. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/引导", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8855. #else
  8856. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/化妆", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8857. #endif
  8858. }
  8859. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138))) // [version].[reverse3]
  8860. {
  8861. Image *pImg = NULL;
  8862. g_nSendCode = 31;
  8863. int g_nYearposTemp = g_nYearpos;
  8864. g_nYearpos = -1;
  8865. g_pMainWnd->ProcessChatMessageRequest2(1);
  8866. g_nYearpos = g_nYearposTemp;
  8867. g_nSendCode = 0;
  8868. if (g_bSendOK == 0)return;
  8869. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8870. // Jeff二维码的区域不是从18.lia里获取的,是固定在右上角指定区域;
  8871. if (pImg)
  8872. {
  8873. StrRect.left = 485;
  8874. StrRect.top = 12;
  8875. StrRect.right = StrRect.left + 60;
  8876. StrRect.bottom = StrRect.top + 60;
  8877. m_Print.DrawImage(pImg, StrRect);
  8878. delete pImg; pImg = NULL;
  8879. }
  8880. }
  8881. // CArray<CRect,CRect>rcarray;
  8882. // CStringArray strarray2;
  8883. // ■■■■■■从18.lia中获取第10的区域大小;
  8884. for (i = 10; i <= 16; i++)
  8885. {
  8886. StrRect = load.m_rcarray.ElementAt(i - 1);
  8887. StrRect.left += 2;
  8888. StrRect.right -= 2;
  8889. StrRect.top += 2;
  8890. rcarray.Add(StrRect);
  8891. strarray2.Add(strarray.ElementAt(7 + i - 10));
  8892. }
  8893. if (1)
  8894. {
  8895. // ■■■■■■从18.lia中获取第31的区域大小;
  8896. StrRect = load.m_rcarray.ElementAt(30);
  8897. StrRect.left += 2;
  8898. StrRect.right -= 2;
  8899. StrRect.top += 2;
  8900. rcarray.Add(StrRect);
  8901. if (bPrintDate)
  8902. strarray2.Add(m_time6 + "/" + m_time5);
  8903. else
  8904. {
  8905. strarray2.Add(m_waiter1 + "/" + m_waiter2);
  8906. }
  8907. }
  8908. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  8909. for (i = 10; i <= 16; i++)
  8910. {
  8911. StrRect = load.m_rcarray.ElementAt(i - 1);
  8912. if (i == 10)
  8913. {
  8914. dty += bottom - StrRect.bottom;
  8915. }
  8916. StrRect.bottom = bottom;
  8917. m_Print.DrawRect2(StrRect, 1);
  8918. }
  8919. if (1)
  8920. {
  8921. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  8922. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  8923. }
  8924. m_Print.SetFontFace(15, 1, "宋体");
  8925. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  8926. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8927. }
  8928. int curypos = 0;
  8929. int oldpos = 0;
  8930. if (bb == 1)
  8931. {
  8932. dty = -100;
  8933. oldpos = nPrintedPos;
  8934. if (oldpos == 0)oldpos = 10000;
  8935. }
  8936. m_Print.SetFontFace(9, 1, "宋体");
  8937. strarray.RemoveAll();
  8938. if ((oldpos != 10000 && oldpos < sparray2.GetSize()) || bb == 0)
  8939. {
  8940. strarray.Add("产品名称");
  8941. strarray.Add("数量");
  8942. strarray.Add("照片编号");
  8943. for (i = 18; i <= 20; i++)
  8944. {
  8945. StrRect = load.m_rcarray.ElementAt(i - 1);
  8946. StrRect.top += dty;
  8947. StrRect.bottom += dty;
  8948. m_Print.DrawRect2(StrRect, 1);
  8949. StrRect.left += 2;
  8950. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8951. StrRect.left -= 2;
  8952. StrRect.top = StrRect.bottom;
  8953. StrRect.bottom += 18;
  8954. rc2array.Add(StrRect);
  8955. }
  8956. }
  8957. for (i = oldpos; i < sparray2.GetSize(); i += 3)
  8958. {
  8959. rcarray.RemoveAll();
  8960. strarray2.RemoveAll();
  8961. for ( j = 0; j < 3; j++)
  8962. {
  8963. StrRect = rc2array.ElementAt(j);
  8964. StrRect.left += 2;
  8965. StrRect.right -= 2;
  8966. StrRect.top += 2;
  8967. rcarray.Add(StrRect);
  8968. #if JEFF_TEST_ON
  8969. if (2 == j)
  8970. {
  8971. CString strImg = sparray2.ElementAt(i + 2);
  8972. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  8973. if (nImgCount != 0)
  8974. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  8975. else if (!strImg.IsEmpty())
  8976. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  8977. strarray2.Add(strImg);
  8978. }
  8979. else
  8980. strarray2.Add(sparray2.ElementAt(i + j));
  8981. #else
  8982. strarray2.Add(sparray2.ElementAt(i + j));
  8983. #endif
  8984. }
  8985. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  8986. rcarray.RemoveAll();
  8987. for (j = 0; j < 3; j++)
  8988. {
  8989. StrRect = rc2array.ElementAt(j);
  8990. if (j == 0)
  8991. {
  8992. dty += bottom - StrRect.bottom;
  8993. }
  8994. StrRect.bottom = bottom;
  8995. m_Print.DrawRect2(StrRect, 1);
  8996. curypos = StrRect.bottom;
  8997. StrRect.top = StrRect.bottom;
  8998. StrRect.bottom += 18;
  8999. rcarray.Add(StrRect);
  9000. }
  9001. rc2array.RemoveAll();
  9002. rc2array.Copy(rcarray);
  9003. if (bottom > 750)
  9004. {
  9005. bSecondPage = 1;
  9006. nPrintedPos = i + 3;
  9007. break;
  9008. }
  9009. }
  9010. if ((bb == 0 && bSecondPage == 0) || (bb == 1 && bSecondPage == 1))
  9011. {
  9012. m_Print.SetFontFace(15, 1, "宋体");
  9013. StrRect = load.m_rcarray.ElementAt(20);
  9014. dty = curypos - StrRect.bottom + 35;
  9015. StrRect.top += dty;
  9016. StrRect.bottom += dty;
  9017. if (StrRect.bottom > 700 && bb == 0)
  9018. {
  9019. bSecondPage = 1;
  9020. }
  9021. else
  9022. {
  9023. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9024. m_Print.SetFontFace(9, 1, "宋体");
  9025. rcarray.RemoveAll();
  9026. strarray2.RemoveAll();
  9027. StrRect = load.m_rcarray.ElementAt(21);
  9028. StrRect.top += dty;
  9029. StrRect.bottom += dty;
  9030. StrRect.left += 2;
  9031. StrRect.right -= 2;
  9032. StrRect.top += 2;
  9033. rcarray.Add(StrRect);
  9034. #if JEFF_TEST_ON
  9035. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9036. strarray2.RemoveAll();
  9037. CString strFind = "要求:";
  9038. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  9039. do
  9040. {
  9041. int nIndex = strbz3.Find(strFind, 1);
  9042. if (nIndex != -1)
  9043. {
  9044. CString strbz = strbz3.Left(nIndex);
  9045. strbz3 = strbz3.Mid(nIndex);
  9046. strarray2.Add(strbz);
  9047. }
  9048. else
  9049. {
  9050. strarray2.Add(strbz3);
  9051. strbz3 = "";
  9052. }
  9053. } while (strbz3.Find(strFind) != -1);
  9054. strarray2.Add(g_List1array.ElementAt(0).ElementAt(29));
  9055. strarray2.Add(g_List1array.ElementAt(0).ElementAt(23));
  9056. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  9057. #else
  9058. strarray2.Add(m_bz);
  9059. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9060. #endif
  9061. StrRect = load.m_rcarray.ElementAt(21);
  9062. StrRect.top += dty;
  9063. StrRect.bottom += dty;
  9064. dty += bottom - StrRect.bottom;
  9065. StrRect.bottom = bottom;
  9066. m_Print.DrawRect2(StrRect, 1);
  9067. curypos = StrRect.bottom;
  9068. m_Print.SetFontFace(10, 1, "宋体");
  9069. StrRect = load.m_rcarray.ElementAt(22);
  9070. dty = curypos - StrRect.bottom + 25;
  9071. StrRect.top += dty;
  9072. StrRect.bottom += dty;
  9073. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  9074. if (m_edit9.IsEmpty())
  9075. {
  9076. m_edit9 = "\
  9077. 经确认后的照片均排入制作流程,\r\n\
  9078. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9079. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9080. }
  9081. CString info1, info2, info3;
  9082. int newlinepos = m_edit9.Find("\r\n");
  9083. if (newlinepos != -1)
  9084. {
  9085. info1 = m_edit9.Left(newlinepos);
  9086. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9087. }
  9088. newlinepos = m_edit9.Find("\r\n");
  9089. if (newlinepos != -1)
  9090. {
  9091. info2 = m_edit9.Left(newlinepos);
  9092. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9093. info3 = m_edit9;
  9094. }
  9095. #ifdef QCH_VERSION
  9096. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9097. StrRect = load.m_rcarray.ElementAt(23);
  9098. StrRect.top += dty; StrRect.bottom += dty;
  9099. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9100. StrRect=load.m_rcarray .ElementAt (24);
  9101. StrRect.top +=dty;StrRect.bottom +=dty;
  9102. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9103. StrRect.top +=15;
  9104. StrRect.bottom +=15;
  9105. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9106. #else
  9107. if (1)
  9108. {
  9109. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9110. StrRect = load.m_rcarray.ElementAt(23);
  9111. StrRect.top += dty; StrRect.bottom += dty;
  9112. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9113. StrRect = load.m_rcarray.ElementAt(24);
  9114. StrRect.top += dty; StrRect.bottom += dty;
  9115. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9116. }
  9117. else
  9118. {
  9119. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9120. StrRect = load.m_rcarray.ElementAt(23);
  9121. StrRect.top += dty; StrRect.bottom += dty;
  9122. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9123. StrRect = load.m_rcarray.ElementAt(24);
  9124. StrRect.top += dty; StrRect.bottom += dty;
  9125. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9126. }
  9127. StrRect.top += 15;
  9128. StrRect.bottom += 15;
  9129. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9130. #endif
  9131. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  9132. StrRect = load.m_rcarray.ElementAt(25);
  9133. StrRect.top += dty - dy;
  9134. StrRect.bottom += dty - dy;
  9135. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9136. StrRect = load.m_rcarray.ElementAt(26);
  9137. StrRect.top += dty - dy;
  9138. StrRect.bottom += dty - dy;
  9139. m_Print.DrawRect2(StrRect, 2);
  9140. StrRect = load.m_rcarray.ElementAt(25);
  9141. StrRect.top += dty + 15 - dy;
  9142. StrRect.bottom += dty + 15 - dy;
  9143. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9144. StrRect = load.m_rcarray.ElementAt(26);
  9145. StrRect.top += dty + 15 - dy;
  9146. StrRect.bottom += dty + 15 - dy;
  9147. m_Print.DrawRect2(StrRect, 2);
  9148. StrRect = load.m_rcarray.ElementAt(25);
  9149. StrRect.top += dty + 15 * 2 - dy;
  9150. StrRect.bottom += dty + 15 * 2 - dy;
  9151. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9152. StrRect = load.m_rcarray.ElementAt(26);
  9153. StrRect.top += dty + 15 * 2 - dy;
  9154. StrRect.bottom += dty + 15 * 2 - dy;
  9155. m_Print.DrawRect2(StrRect, 2);
  9156. }
  9157. }
  9158. PrintPreview dlg; dlg.m_mode = 2;
  9159. dlg.m_name = name;
  9160. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  9161. dlg.m_pDC = m_Print.GetPDC();
  9162. if (aa == 0)
  9163. {
  9164. if (dlg.DoModal() != IDOK)
  9165. return;
  9166. printcot = dlg.m_num;
  9167. }
  9168. //结束打印
  9169. m_Print.EndPage();
  9170. m_Print.EndPrint();
  9171. }
  9172. }
  9173. }
  9174. void CMainFrame::PrintFlowChart3_20151116(CString strOrderNumber) // 选片打单 风格2;
  9175. {
  9176. #ifdef LKAY_VERSION
  9177. PrintFlowChart3LKAY(strOrderNumber);
  9178. return;
  9179. #endif
  9180. int i = 0;
  9181. int j = 0;
  9182. int printcot = 1;
  9183. for (int aa = 0; aa < printcot; aa++)
  9184. {
  9185. BOOL bSecondPage = 0;
  9186. int nPrintedPos = 0;
  9187. for (int bb = 0; bb < 3; bb++)
  9188. {
  9189. if (bb && bSecondPage == 0)break;
  9190. CPrintRX m_Print;
  9191. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58))) // 58-[version].[setcheck1] ==1,使用默认打印机;
  9192. {
  9193. m_Print.InitToPrint(NULL, 1);
  9194. }
  9195. else // 否则使用指定的打印机;
  9196. {
  9197. CString name = g_cominfoarray.ElementAt(0).ElementAt(64); // 64-[version].[printer2] 制作单打印机;
  9198. if (name.IsEmpty())
  9199. m_Print.InitToPrint(NULL, 1);
  9200. else
  9201. {
  9202. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9203. if (nret == -1 && aa == 0)
  9204. {
  9205. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9206. }
  9207. }
  9208. }
  9209. m_Print.StartPrint();
  9210. m_Print.StartPage();
  9211. LoadRect load;
  9212. load.SetLiaPath("18.lia");
  9213. load.SetMargins(10, 0);
  9214. if (!load.Load())return;
  9215. CString str;
  9216. int rcpos = -1;
  9217. // ■■■■■■从18.lia获取到第一个区域大小 - 1.显示店名;
  9218. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  9219. if ((bb == 0 && bSecondPage == 0))
  9220. {
  9221. m_Print.SetFontFace(25, 1, "宋体");
  9222. // 10-[version].[info1] 店名;
  9223. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9224. m_Print.SetFontFace(15, 1, "宋体");
  9225. // ■■■■■■从18.lia获取第二个区域大小 - 2.显示"基本资料";
  9226. StrRect = load.m_rcarray.ElementAt(++rcpos);
  9227. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9228. m_Print.SetFontFace(9, 1, "宋体");
  9229. }
  9230. //////////////////////////////////////////////////////////////////////////
  9231. // 获取打印所需要的数据,并布局好;
  9232. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  9233. g_sendhead.code[0] = 54; // dindan;
  9234. g_sendhead.code[1] = 223; // dindanspview2; shangpin+dindansp;
  9235. g_sendhead.code[2] = 52; // client;
  9236. g_sendhead.tabcount = 3;
  9237. g_sendhead.bsql = 0;
  9238. g_pMainWnd->ProcessChatMessageRequest2(filter);
  9239. if (g_bSendOK == 0)return;
  9240. CArray<CStringArray, CStringArray>sparray;
  9241. CArray<CStringArray, CStringArray>clientarray;
  9242. DataToArray(&g_List1array, &sparray, &clientarray);
  9243. CString spno;
  9244. CStringArray sparray2;
  9245. for ( i = 0; i < sparray.GetSize(); i++)
  9246. {
  9247. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  9248. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  9249. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  9250. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9251. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  9252. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9253. sparray2.Add(sparray.ElementAt(i).ElementAt(5)); // 商品名称;
  9254. sparray2.Add(sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  9255. sparray2.Add(sparray.ElementAt(i).ElementAt(6)); // 选中的相片串;
  9256. sparray2.Add(sparray.ElementAt(i).ElementAt(10)); // 商品备注;
  9257. }
  9258. for (i = 0; i < sparray.GetSize(); i++)
  9259. {
  9260. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  9261. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  9262. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  9263. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9264. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  9265. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9266. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+"); // 商品名称;
  9267. sparray2.Add(sparray.ElementAt(i).ElementAt(3)); // 商品数量;
  9268. sparray2.Add(sparray.ElementAt(i).ElementAt(6)); // 选中的相片串;
  9269. sparray2.Add(sparray.ElementAt(i).ElementAt(10)); // 商品备注;
  9270. }
  9271. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  9272. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  9273. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  9274. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  9275. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  9276. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  9277. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  9278. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  9279. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  9280. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  9281. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  9282. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  9283. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  9284. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  9285. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  9286. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  9287. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  9288. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  9289. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9290. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  9291. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  9292. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  9293. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  9294. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  9295. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  9296. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  9297. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  9298. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  9299. CString m_sum3;
  9300. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  9301. ::ConvertToPrice(m_sum3);
  9302. if (m_money3.IsEmpty())m_money3 = "0";
  9303. int dty = 0;
  9304. CString name;
  9305. if (!m_name1.IsEmpty())
  9306. name = m_name1 + ",";
  9307. name += m_name2;
  9308. name.TrimRight(",");
  9309. CString phone;
  9310. if (!m_phone1.IsEmpty())
  9311. phone = m_phone1 + ",";
  9312. phone += m_phone2; phone.TrimRight(",");
  9313. if (IsHasRights2new(31) == 0)
  9314. phone = "***";
  9315. CStringArray strarray;
  9316. CArray<CRect, CRect>rcarray;
  9317. CStringArray strarray2; CArray<CRect, CRect>rc2array;
  9318. int bottom;
  9319. //////////////////////////////////////////////////////////////////////////
  9320. // 开始画打印DC;
  9321. if ((bb == 0 && bSecondPage == 0))
  9322. {
  9323. #ifdef CHILD_VERSION
  9324. if (m_birthday.IsEmpty())
  9325. strarray.Add("姓名/性别");
  9326. else
  9327. strarray.Add("姓名/性别/年龄");
  9328. #else
  9329. strarray.Add("客人姓名"); // 第3.1区域 -3.显示客人姓名;
  9330. #endif
  9331. strarray.Add("电话");
  9332. strarray.Add("单号");
  9333. strarray.Add("套系");
  9334. strarray.Add("选样");
  9335. strarray.Add("余款/加挑");
  9336. strarray.Add("选片/日期");
  9337. #ifdef CHILD_VERSION
  9338. if (m_birthday.IsEmpty())
  9339. strarray.Add(name + "/" + m_sex);
  9340. else
  9341. {
  9342. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  9343. m_birthday.Format("%d", year + 1);
  9344. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  9345. }
  9346. #else
  9347. strarray.Add(name); // 第4.1区域 -3.显示客人姓名;
  9348. #endif
  9349. strarray.Add(phone);
  9350. strarray.Add(strOrderNumber);
  9351. strarray.Add(m_taoxiname);
  9352. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9353. strarray.Add(str);
  9354. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  9355. strarray.Add(str);
  9356. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  9357. for (i = 3; i <= 16; i++)
  9358. {
  9359. // ■■■■■■从18.lia中获取第3~16的区域大小;
  9360. StrRect = load.m_rcarray.ElementAt(i - 1);
  9361. if (i < 10)
  9362. {
  9363. m_Print.DrawRect2(StrRect, 1);
  9364. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9365. }
  9366. }
  9367. // ■■■■■■从18.lia中获取第30的区域大小;
  9368. StrRect = load.m_rcarray.ElementAt(29);
  9369. m_Print.DrawRect2(StrRect, 1);
  9370. BOOL bPrintDate = 1;
  9371. #ifdef DDF_VERSION
  9372. // bPrintDate=0;
  9373. #else
  9374. if (m_time5 == "" && m_time6 == "")
  9375. bPrintDate = 0;
  9376. #endif
  9377. if (bPrintDate)
  9378. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9379. else
  9380. {
  9381. #ifdef CHILD_VERSION
  9382. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/引导", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9383. #else
  9384. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/化妆", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9385. #endif
  9386. }
  9387. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138))) // [version].[reverse3]
  9388. {
  9389. Image *pImg = NULL;
  9390. g_nSendCode = 31;
  9391. int g_nYearposTemp = g_nYearpos;
  9392. g_nYearpos = -1;
  9393. g_pMainWnd->ProcessChatMessageRequest2(1);
  9394. g_nYearpos = g_nYearposTemp;
  9395. g_nSendCode = 0;
  9396. if (g_bSendOK == 0)return;
  9397. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  9398. // Jeff二维码的区域不是从18.lia里获取的,是固定在右上角指定区域;
  9399. if (pImg)
  9400. {
  9401. StrRect.left = 485;
  9402. StrRect.top = 12;
  9403. StrRect.right = StrRect.left + 60;
  9404. StrRect.bottom = StrRect.top + 60;
  9405. m_Print.DrawImage(pImg, StrRect);
  9406. delete pImg; pImg = NULL;
  9407. }
  9408. }
  9409. // CArray<CRect,CRect>rcarray;
  9410. // CStringArray strarray2;
  9411. // ■■■■■■从18.lia中获取第10的区域大小;
  9412. for (i = 10; i <= 16; i++)
  9413. {
  9414. StrRect = load.m_rcarray.ElementAt(i - 1);
  9415. StrRect.left += 2;
  9416. StrRect.right -= 2;
  9417. StrRect.top += 2;
  9418. rcarray.Add(StrRect);
  9419. strarray2.Add(strarray.ElementAt(7 + i - 10));
  9420. }
  9421. if (1)
  9422. {
  9423. // ■■■■■■从18.lia中获取第31的区域大小;
  9424. StrRect = load.m_rcarray.ElementAt(30);
  9425. StrRect.left += 2;
  9426. StrRect.right -= 2;
  9427. StrRect.top += 2;
  9428. rcarray.Add(StrRect);
  9429. if (bPrintDate)
  9430. strarray2.Add(m_time6 + "/" + m_time5);
  9431. else
  9432. {
  9433. strarray2.Add(m_waiter1 + "/" + m_waiter2);
  9434. }
  9435. }
  9436. int bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  9437. for (i = 10; i <= 16; i++)
  9438. {
  9439. StrRect = load.m_rcarray.ElementAt(i - 1);
  9440. if (i == 10)
  9441. {
  9442. dty += bottom - StrRect.bottom;
  9443. }
  9444. StrRect.bottom = bottom;
  9445. m_Print.DrawRect2(StrRect, 1);
  9446. }
  9447. if (1)
  9448. {
  9449. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  9450. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  9451. }
  9452. m_Print.SetFontFace(15, 1, "宋体");
  9453. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  9454. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9455. }
  9456. int curypos = 0;
  9457. int oldpos = 0;
  9458. if (bb == 1)
  9459. {
  9460. dty = -100;
  9461. oldpos = nPrintedPos;
  9462. if (oldpos == 0)oldpos = 10000;
  9463. }
  9464. m_Print.SetFontFace(9, 1, "宋体");
  9465. strarray.RemoveAll();
  9466. if ((oldpos != 10000 && oldpos < sparray2.GetSize()) || bb == 0)
  9467. {
  9468. strarray.Add("产品名称");
  9469. strarray.Add("数量");
  9470. strarray.Add("照片编号");
  9471. strarray.Add(_T("备注"));
  9472. CRect mycr[4] = {
  9473. CRect(39,172,130,189), // 产品名称;
  9474. CRect(130,172,157,189), // 产品数量;
  9475. CRect(157,172,407,189), // 相片;
  9476. CRect(407,172,546,189) // 备注;
  9477. };
  9478. for (i = 0; i <= 3; i++)
  9479. {
  9480. StrRect = mycr[i];
  9481. StrRect.top += dty;
  9482. StrRect.bottom += dty;
  9483. m_Print.DrawRect2(StrRect, 1);
  9484. StrRect.left += 2;
  9485. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9486. StrRect.left -= 2;
  9487. StrRect.top = StrRect.bottom;
  9488. StrRect.bottom += 18;
  9489. rc2array.Add(StrRect);
  9490. }
  9491. }
  9492. for (i = oldpos; i < sparray2.GetSize(); i += 4)
  9493. {
  9494. rcarray.RemoveAll();
  9495. strarray2.RemoveAll();
  9496. for ( j = 0; j < 4; j++)
  9497. {
  9498. StrRect = rc2array.ElementAt(j);
  9499. StrRect.left += 2;
  9500. StrRect.right -= 2;
  9501. StrRect.top += 2;
  9502. rcarray.Add(StrRect);
  9503. #if JEFF_TEST_ON
  9504. if (2 == j)
  9505. {
  9506. CString strImg = sparray2.ElementAt(i + 2);
  9507. //int nImgCount = strImg.Replace(",", ",");
  9508. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  9509. if (nImgCount != 0)
  9510. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  9511. else if (!strImg.IsEmpty())
  9512. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  9513. strarray2.Add(strImg);
  9514. }
  9515. else
  9516. strarray2.Add(sparray2.ElementAt(i + j));
  9517. #else
  9518. strarray2.Add(sparray2.ElementAt(i + j));
  9519. #endif
  9520. }
  9521. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9522. rcarray.RemoveAll();
  9523. for (j = 0; j < 4; j++)
  9524. {
  9525. StrRect = rc2array.ElementAt(j);
  9526. if (j == 0)
  9527. {
  9528. dty += bottom - StrRect.bottom;
  9529. }
  9530. StrRect.bottom = bottom;
  9531. m_Print.DrawRect2(StrRect, 1);
  9532. curypos = StrRect.bottom;
  9533. StrRect.top = StrRect.bottom;
  9534. StrRect.bottom += 18;
  9535. rcarray.Add(StrRect);
  9536. }
  9537. rc2array.RemoveAll();
  9538. rc2array.Copy(rcarray);
  9539. if (bottom > 750)
  9540. {
  9541. bSecondPage = 1;
  9542. nPrintedPos = i + 3;
  9543. break;
  9544. }
  9545. }
  9546. if ((bb == 0 && bSecondPage == 0) || (bb == 1 && bSecondPage == 1))
  9547. {
  9548. m_Print.SetFontFace(15, 1, "宋体");
  9549. StrRect = load.m_rcarray.ElementAt(20);
  9550. dty = curypos - StrRect.bottom + 35;
  9551. StrRect.top += dty;
  9552. StrRect.bottom += dty;
  9553. if (StrRect.bottom > 700 && bb == 0)
  9554. {
  9555. bSecondPage = 1;
  9556. }
  9557. else
  9558. {
  9559. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9560. m_Print.SetFontFace(9, 1, "宋体");
  9561. rcarray.RemoveAll();
  9562. strarray2.RemoveAll();
  9563. StrRect = load.m_rcarray.ElementAt(21);
  9564. StrRect.top += dty;
  9565. StrRect.bottom += dty;
  9566. StrRect.left += 2;
  9567. StrRect.right -= 2;
  9568. StrRect.top += 2;
  9569. rcarray.Add(StrRect);
  9570. #if JEFF_TEST_ON
  9571. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9572. strarray2.RemoveAll();
  9573. CString strFind = "要求:";
  9574. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  9575. do
  9576. {
  9577. int nIndex = strbz3.Find(strFind, 1);
  9578. if (nIndex != -1)
  9579. {
  9580. CString strbz = strbz3.Left(nIndex);
  9581. strbz3 = strbz3.Mid(nIndex);
  9582. strarray2.Add(strbz);
  9583. }
  9584. else
  9585. {
  9586. strarray2.Add(strbz3);
  9587. strbz3 = "";
  9588. }
  9589. } while (strbz3.Find(strFind) != -1);
  9590. strarray2.Add(g_List1array.ElementAt(0).ElementAt(29));
  9591. strarray2.Add(g_List1array.ElementAt(0).ElementAt(23));
  9592. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  9593. #else
  9594. strarray2.Add(m_bz);
  9595. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  9596. #endif
  9597. StrRect = load.m_rcarray.ElementAt(21);
  9598. StrRect.top += dty;
  9599. StrRect.bottom += dty;
  9600. dty += bottom - StrRect.bottom;
  9601. StrRect.bottom = bottom;
  9602. m_Print.DrawRect2(StrRect, 1);
  9603. curypos = StrRect.bottom;
  9604. m_Print.SetFontFace(10, 1, "宋体");
  9605. StrRect = load.m_rcarray.ElementAt(22);
  9606. dty = curypos - StrRect.bottom + 25;
  9607. StrRect.top += dty;
  9608. StrRect.bottom += dty;
  9609. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  9610. if (m_edit9.IsEmpty())
  9611. {
  9612. m_edit9 = "\
  9613. 经确认后的照片均排入制作流程,\r\n\
  9614. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9615. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9616. }
  9617. CString info1, info2, info3;
  9618. int newlinepos = m_edit9.Find("\r\n");
  9619. if (newlinepos != -1)
  9620. {
  9621. info1 = m_edit9.Left(newlinepos);
  9622. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9623. }
  9624. newlinepos = m_edit9.Find("\r\n");
  9625. if (newlinepos != -1)
  9626. {
  9627. info2 = m_edit9.Left(newlinepos);
  9628. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9629. info3 = m_edit9;
  9630. }
  9631. #ifdef QCH_VERSION
  9632. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9633. StrRect = load.m_rcarray.ElementAt(23);
  9634. StrRect.top += dty; StrRect.bottom += dty;
  9635. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9636. StrRect=load.m_rcarray .ElementAt (24);
  9637. StrRect.top +=dty;StrRect.bottom +=dty;
  9638. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9639. StrRect.top +=15;
  9640. StrRect.bottom +=15;
  9641. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9642. #else
  9643. if (1)
  9644. {
  9645. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9646. StrRect = load.m_rcarray.ElementAt(23);
  9647. StrRect.top += dty; StrRect.bottom += dty;
  9648. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9649. StrRect = load.m_rcarray.ElementAt(24);
  9650. StrRect.top += dty; StrRect.bottom += dty;
  9651. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9652. }
  9653. else
  9654. {
  9655. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9656. StrRect = load.m_rcarray.ElementAt(23);
  9657. StrRect.top += dty; StrRect.bottom += dty;
  9658. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9659. StrRect = load.m_rcarray.ElementAt(24);
  9660. StrRect.top += dty; StrRect.bottom += dty;
  9661. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9662. }
  9663. StrRect.top += 15;
  9664. StrRect.bottom += 15;
  9665. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9666. #endif
  9667. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  9668. StrRect = load.m_rcarray.ElementAt(25);
  9669. StrRect.top += dty - dy;
  9670. StrRect.bottom += dty - dy;
  9671. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9672. StrRect = load.m_rcarray.ElementAt(26);
  9673. StrRect.top += dty - dy;
  9674. StrRect.bottom += dty - dy;
  9675. m_Print.DrawRect2(StrRect, 2);
  9676. StrRect = load.m_rcarray.ElementAt(25);
  9677. StrRect.top += dty + 15 - dy;
  9678. StrRect.bottom += dty + 15 - dy;
  9679. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9680. StrRect = load.m_rcarray.ElementAt(26);
  9681. StrRect.top += dty + 15 - dy;
  9682. StrRect.bottom += dty + 15 - dy;
  9683. m_Print.DrawRect2(StrRect, 2);
  9684. StrRect = load.m_rcarray.ElementAt(25);
  9685. StrRect.top += dty + 15 * 2 - dy;
  9686. StrRect.bottom += dty + 15 * 2 - dy;
  9687. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9688. StrRect = load.m_rcarray.ElementAt(26);
  9689. StrRect.top += dty + 15 * 2 - dy;
  9690. StrRect.bottom += dty + 15 * 2 - dy;
  9691. m_Print.DrawRect2(StrRect, 2);
  9692. }
  9693. }
  9694. PrintPreview dlg; dlg.m_mode = 2;
  9695. dlg.m_name = name;
  9696. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  9697. dlg.m_pDC = m_Print.GetPDC();
  9698. if (aa == 0)
  9699. {
  9700. if (dlg.DoModal() != IDOK)
  9701. return;
  9702. printcot = dlg.m_num;
  9703. }
  9704. //结束打印
  9705. m_Print.EndPage();
  9706. m_Print.EndPrint();
  9707. }
  9708. }
  9709. }
  9710. //void CMainFrame::PrintFlowChart4(CString m_id) // 选设计打单函数;
  9711. void CMainFrame::PrintFlowChart4(CString strOrderNumber) // 选设计打单函数,使用18.lia文件;
  9712. {
  9713. int i = 0;
  9714. int j = 0;
  9715. int printcot = 1;
  9716. for (int aa = 0; aa < printcot; aa++)
  9717. {
  9718. CPrintRX m_Print;
  9719. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  9720. {
  9721. m_Print.InitToPrint(NULL, 1);
  9722. }
  9723. else
  9724. {
  9725. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  9726. if (name.IsEmpty())
  9727. m_Print.InitToPrint(NULL, 1);
  9728. else
  9729. {
  9730. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9731. if (nret == -1 && aa == 0)
  9732. {
  9733. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9734. }
  9735. }
  9736. }
  9737. m_Print.StartPrint();
  9738. m_Print.StartPage();
  9739. LoadRect load;
  9740. load.SetLiaPath("18.lia");
  9741. load.SetMargins(10, 0);
  9742. if (!load.Load())return;
  9743. CString str;
  9744. int rcpos = -1;
  9745. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  9746. m_Print.SetFontFace(25, 1, "宋体");
  9747. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9748. m_Print.SetFontFace(15, 1, "宋体");
  9749. StrRect = load.m_rcarray.ElementAt(++rcpos);
  9750. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9751. m_Print.SetFontFace(9, 1, "宋体");
  9752. //////////////////////////////////////////////////////////////
  9753. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  9754. g_sendhead.code[0] = 54;
  9755. g_sendhead.code[1] = 223;
  9756. g_sendhead.code[2] = 52;
  9757. g_sendhead.tabcount = 3;
  9758. g_sendhead.bsql = 0;
  9759. g_pMainWnd->ProcessChatMessageRequest2(filter);
  9760. if (g_bSendOK == 0)return;
  9761. CArray<CStringArray, CStringArray>sparray;
  9762. CArray<CStringArray, CStringArray>clientarray;
  9763. DataToArray(&g_List1array, &sparray, &clientarray);
  9764. CString spno;
  9765. CStringArray sparray2;
  9766. for ( i = 0; i < sparray.GetSize(); i++)
  9767. {
  9768. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  9769. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(8).IsEmpty())continue;
  9770. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9771. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9772. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  9773. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9774. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9775. }
  9776. for (i = 0; i < sparray.GetSize(); i++)
  9777. {
  9778. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  9779. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  9780. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  9781. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9782. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9783. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  9784. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9785. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9786. }
  9787. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  9788. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  9789. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  9790. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  9791. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  9792. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  9793. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  9794. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  9795. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  9796. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  9797. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  9798. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  9799. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  9800. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  9801. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  9802. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  9803. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  9804. CString m_bz = g_List1array.ElementAt(0).ElementAt(17);
  9805. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(25);
  9806. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  9807. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  9808. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  9809. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  9810. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  9811. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  9812. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  9813. CString m_waiter8 = g_List1array.ElementAt(0).ElementAt(27);
  9814. CString m_replace = g_List1array.ElementAt(0).ElementAt(28);
  9815. if (!m_replace.IsEmpty())
  9816. {
  9817. m_replace = "设计替换照片:" + m_replace;
  9818. m_replace.Replace("$", ";");
  9819. m_replace.TrimLeft(";");
  9820. m_bz += ";";
  9821. m_bz += m_replace;
  9822. }
  9823. CString m_sum3;
  9824. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  9825. ::ConvertToPrice(m_sum3);
  9826. if (m_money3.IsEmpty())m_money3 = "0";
  9827. int dty = 0;
  9828. CString name;
  9829. if (!m_name1.IsEmpty())
  9830. name = m_name1 + ",";
  9831. name += m_name2;
  9832. name.TrimRight(",");
  9833. CString phone;
  9834. if (!m_phone1.IsEmpty())
  9835. phone = m_phone1 + ",";
  9836. phone += m_phone2; phone.TrimRight(",");
  9837. if (IsHasRights2new(31) == 0)
  9838. phone = "***";
  9839. CStringArray strarray;
  9840. #ifdef CHILD_VERSION
  9841. if (m_birthday.IsEmpty())
  9842. strarray.Add("姓名/性别");
  9843. else
  9844. strarray.Add("姓名/性别/年龄");
  9845. #else
  9846. strarray.Add("客人姓名");
  9847. #endif
  9848. strarray.Add("电话");
  9849. strarray.Add("单号");
  9850. strarray.Add("套系");
  9851. strarray.Add("");
  9852. strarray.Add("余款/加挑");
  9853. strarray.Add("看设计/日期");
  9854. #ifdef CHILD_VERSION
  9855. if (m_birthday.IsEmpty())
  9856. strarray.Add(name + "/" + m_sex);
  9857. else
  9858. {
  9859. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  9860. m_birthday.Format("%d", year + 1);
  9861. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  9862. }
  9863. #else
  9864. strarray.Add(name);
  9865. #endif
  9866. strarray.Add(phone);
  9867. strarray.Add(strOrderNumber);
  9868. strarray.Add(m_taoxiname);
  9869. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9870. strarray.Add("");
  9871. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  9872. strarray.Add(str);
  9873. strarray.Add(m_waiter8 + "/" + m_time6);
  9874. //////////////////////////////////////////////
  9875. if (1)
  9876. {
  9877. StrRect = load.m_rcarray.ElementAt(6);
  9878. int addwid = StrRect.Width() / 6;
  9879. for (i = 3; i <= 6; i++)
  9880. {
  9881. StrRect = load.m_rcarray.ElementAt(i - 1);
  9882. StrRect.left += (i - 3)*addwid;
  9883. StrRect.right += (i - 2)*addwid;
  9884. load.m_rcarray.SetAt(i - 1, StrRect);
  9885. }
  9886. StrRect.left = StrRect.right = -1;
  9887. load.m_rcarray.SetAt(6, StrRect);
  9888. for (i = 10; i <= 13; i++)
  9889. {
  9890. StrRect = load.m_rcarray.ElementAt(i - 1);
  9891. StrRect.left += (i - 10)*addwid;
  9892. StrRect.right += (i - 9)*addwid;
  9893. load.m_rcarray.SetAt(i - 1, StrRect);
  9894. }
  9895. StrRect.left = StrRect.right = -1;
  9896. load.m_rcarray.SetAt(13, StrRect);
  9897. StrRect = load.m_rcarray.ElementAt(7);
  9898. int rcwid = StrRect.Width();
  9899. StrRect.left = load.m_rcarray.ElementAt(5).right;
  9900. StrRect.right = StrRect.left + rcwid + addwid;
  9901. load.m_rcarray.SetAt(7, StrRect);
  9902. StrRect = load.m_rcarray.ElementAt(8);
  9903. StrRect.left = load.m_rcarray.ElementAt(7).right;
  9904. StrRect.right = load.m_rcarray.ElementAt(29).left;
  9905. load.m_rcarray.SetAt(8, StrRect);
  9906. StrRect = load.m_rcarray.ElementAt(14);
  9907. rcwid = StrRect.Width();
  9908. StrRect.left = load.m_rcarray.ElementAt(12).right;
  9909. StrRect.right = StrRect.left + rcwid + addwid;
  9910. load.m_rcarray.SetAt(14, StrRect);
  9911. StrRect = load.m_rcarray.ElementAt(15);
  9912. StrRect.left = load.m_rcarray.ElementAt(14).right;
  9913. StrRect.right = load.m_rcarray.ElementAt(29).left;
  9914. load.m_rcarray.SetAt(15, StrRect);
  9915. }
  9916. ////////////////////////////////////////////////
  9917. for (i = 3; i <= 16; i++)
  9918. {
  9919. StrRect = load.m_rcarray.ElementAt(i - 1);
  9920. if (i < 10)
  9921. {
  9922. m_Print.DrawRect2(StrRect, 1);
  9923. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9924. }
  9925. }
  9926. StrRect = load.m_rcarray.ElementAt(29);
  9927. m_Print.DrawRect2(StrRect, 1);
  9928. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9929. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  9930. {
  9931. Image *pImg = NULL;
  9932. g_nSendCode = 31;
  9933. int g_nYearposTemp = g_nYearpos;
  9934. g_nYearpos = -1;
  9935. g_pMainWnd->ProcessChatMessageRequest2(1);
  9936. g_nYearpos = g_nYearposTemp;
  9937. g_nSendCode = 0;
  9938. if (g_bSendOK == 0)return;
  9939. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  9940. if (pImg)
  9941. {
  9942. StrRect.left = 485;
  9943. StrRect.top = 12;
  9944. StrRect.right = StrRect.left + 60;
  9945. StrRect.bottom = StrRect.top + 60;
  9946. m_Print.DrawImage(pImg, StrRect);
  9947. delete pImg; pImg = NULL;
  9948. }
  9949. }
  9950. CArray<CRect, CRect>rcarray;
  9951. CStringArray strarray2;
  9952. for (i = 10; i <= 16; i++)
  9953. {
  9954. StrRect = load.m_rcarray.ElementAt(i - 1);
  9955. StrRect.left += 2;
  9956. StrRect.right -= 2;
  9957. StrRect.top += 2;
  9958. rcarray.Add(StrRect);
  9959. strarray2.Add(strarray.ElementAt(7 + i - 10));
  9960. }
  9961. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_HCENTER);
  9962. for (i = 10; i <= 16; i++)
  9963. {
  9964. StrRect = load.m_rcarray.ElementAt(i - 1);
  9965. if (i == 10)
  9966. {
  9967. dty += bottom - StrRect.bottom;
  9968. }
  9969. StrRect.bottom = bottom;
  9970. m_Print.DrawRect2(StrRect, 1);
  9971. }
  9972. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  9973. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  9974. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time5, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  9975. m_Print.SetFontFace(15, 1, "宋体");
  9976. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  9977. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9978. m_Print.SetFontFace(9, 1, "宋体");
  9979. strarray.RemoveAll();
  9980. strarray.Add("产品名称");
  9981. strarray.Add("数量");
  9982. strarray.Add("照片编号");
  9983. CArray<CRect, CRect>rc2array;
  9984. for (i = 18; i <= 20; i++)
  9985. {
  9986. StrRect = load.m_rcarray.ElementAt(i - 1); StrRect.top += dty; StrRect.bottom += dty;
  9987. m_Print.DrawRect2(StrRect, 1);
  9988. StrRect.left += 2;
  9989. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9990. StrRect.left -= 2;
  9991. StrRect.top = StrRect.bottom;
  9992. StrRect.bottom += 18;
  9993. rc2array.Add(StrRect);
  9994. }
  9995. int curypos = 0;
  9996. for (i = 0; i < sparray2.GetSize(); i += 3)
  9997. {
  9998. rcarray.RemoveAll();
  9999. strarray2.RemoveAll();
  10000. for ( j = 0; j < 3; j++)
  10001. {
  10002. StrRect = rc2array.ElementAt(j);
  10003. StrRect.left += 2;
  10004. StrRect.right -= 2;
  10005. StrRect.top += 2;
  10006. rcarray.Add(StrRect);
  10007. #if JEFF_TEST_ON
  10008. if (2 == j)
  10009. {
  10010. CString strImg = sparray2.ElementAt(i + 2);
  10011. //int nImgCount = strImg.Replace(",", ",");
  10012. int nImgCount = strImg.Replace(SEPS_VEB, SEPS_VEB);
  10013. if (nImgCount != 0)
  10014. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  10015. else if (!strImg.IsEmpty())
  10016. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  10017. strarray2.Add(strImg);
  10018. }
  10019. else
  10020. strarray2.Add(sparray2.ElementAt(i + j));
  10021. #else
  10022. strarray2.Add(sparray2.ElementAt(i + j));
  10023. #endif
  10024. }
  10025. INT bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  10026. rcarray.RemoveAll();
  10027. for (j = 0; j < 3; j++)
  10028. {
  10029. StrRect = rc2array.ElementAt(j);
  10030. if (j == 0)
  10031. {
  10032. dty += bottom - StrRect.bottom;
  10033. }
  10034. StrRect.bottom = bottom;
  10035. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  10036. StrRect.top = StrRect.bottom;
  10037. StrRect.bottom += 18;
  10038. rcarray.Add(StrRect);
  10039. }
  10040. rc2array.RemoveAll();
  10041. rc2array.Copy(rcarray);
  10042. }
  10043. m_Print.SetFontFace(15, 1, "宋体");
  10044. StrRect = load.m_rcarray.ElementAt(20);
  10045. dty = curypos - StrRect.bottom + 35;
  10046. StrRect.top += dty; StrRect.bottom += dty;
  10047. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10048. m_Print.SetFontFace(9, 1, "宋体");
  10049. rcarray.RemoveAll();
  10050. strarray2.RemoveAll();
  10051. StrRect = load.m_rcarray.ElementAt(21);
  10052. StrRect.top += dty;
  10053. StrRect.bottom += dty;
  10054. StrRect.left += 2;
  10055. StrRect.right -= 2;
  10056. StrRect.top += 2;
  10057. rcarray.Add(StrRect);
  10058. #if JEFF_TEST_ON
  10059. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  10060. strarray2.RemoveAll();
  10061. CString strFind = "要求:";
  10062. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  10063. do
  10064. {
  10065. int nIndex = strbz3.Find(strFind, 1);
  10066. if (nIndex != -1)
  10067. {
  10068. CString strbz = strbz3.Left(nIndex);
  10069. strbz3 = strbz3.Mid(nIndex);
  10070. strarray2.Add(strbz);
  10071. }
  10072. else
  10073. {
  10074. strarray2.Add(strbz3);
  10075. strbz3 = "";
  10076. }
  10077. } while (strbz3.Find(strFind) != -1);
  10078. strarray2.Add(g_List1array.ElementAt(0).ElementAt(25));
  10079. if (!m_replace.IsEmpty())
  10080. {
  10081. m_replace = "设计替换照片:" + m_replace;
  10082. m_replace.Replace("$", ";");
  10083. m_replace.TrimLeft(";");
  10084. }
  10085. strarray2.Add(m_replace);
  10086. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  10087. #else
  10088. strarray2.Add(m_bz);
  10089. bottom = CalcHeight(rcarray, strarray2, &m_Print, FORMAT_LEFT);
  10090. #endif
  10091. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  10092. dty += bottom - StrRect.bottom;
  10093. StrRect.bottom = bottom;
  10094. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  10095. m_Print.SetFontFace(10, 1, "宋体");
  10096. StrRect = load.m_rcarray.ElementAt(22);
  10097. dty = curypos - StrRect.bottom + 25;
  10098. StrRect.top += dty; StrRect.bottom += dty;
  10099. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  10100. if (m_edit9.IsEmpty())
  10101. {
  10102. m_edit9 = "\
  10103. 经确认后的照片均排入制作流程,\r\n\
  10104. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  10105. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  10106. }
  10107. CString info1, info2, info3;
  10108. int newlinepos = m_edit9.Find("\r\n");
  10109. if (newlinepos != -1)
  10110. {
  10111. info1 = m_edit9.Left(newlinepos);
  10112. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  10113. }
  10114. newlinepos = m_edit9.Find("\r\n");
  10115. if (newlinepos != -1)
  10116. {
  10117. info2 = m_edit9.Left(newlinepos);
  10118. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  10119. info3 = m_edit9;
  10120. }
  10121. if (1)
  10122. {
  10123. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10124. StrRect = load.m_rcarray.ElementAt(23);
  10125. StrRect.top += dty; StrRect.bottom += dty;
  10126. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10127. StrRect = load.m_rcarray.ElementAt(24);
  10128. StrRect.top += dty; StrRect.bottom += dty;
  10129. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10130. }
  10131. else
  10132. {
  10133. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10134. StrRect = load.m_rcarray.ElementAt(23);
  10135. StrRect.top += dty; StrRect.bottom += dty;
  10136. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10137. StrRect = load.m_rcarray.ElementAt(24);
  10138. StrRect.top += dty; StrRect.bottom += dty;
  10139. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10140. }
  10141. StrRect = load.m_rcarray.ElementAt(25);
  10142. StrRect.top += dty; StrRect.bottom += dty;
  10143. m_Print.DrawText((LPTSTR)(LPCTSTR)"贵宾签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10144. StrRect = load.m_rcarray.ElementAt(26);
  10145. StrRect.top += dty; StrRect.bottom += dty;
  10146. m_Print.DrawRect2(StrRect, 2);
  10147. m_Print.SetFontFace(9, 1, "宋体");
  10148. StrRect = load.m_rcarray.ElementAt(27);
  10149. StrRect.top += dty; StrRect.bottom += dty;
  10150. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10151. StrRect = load.m_rcarray.ElementAt(28);
  10152. StrRect.top += dty; StrRect.bottom += dty;
  10153. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  10154. PrintPreview dlg;//dlg.m_mode=2;
  10155. dlg.m_name = name;
  10156. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  10157. dlg.m_pDC = m_Print.GetPDC();
  10158. if (aa == 0)
  10159. {
  10160. if (dlg.DoModal() != IDOK)
  10161. return;
  10162. printcot = dlg.m_num;
  10163. }
  10164. //结束打印
  10165. m_Print.EndPage();
  10166. m_Print.EndPrint();
  10167. }
  10168. }
  10169. /*
  10170. void CMainFrame::PrintFlowChart(CString m_id)
  10171. {
  10172. CPrintRX m_Print;
  10173. m_Print.InitToPrint(NULL, 1);
  10174. m_Print.StartPrint();
  10175. m_Print.StartPage();
  10176. // CRect StrRect(0,0,560,818);
  10177. LoadRect load;
  10178. load.SetLiaPath ("4.lia");
  10179. load.SetMargins(-14,-14);
  10180. if(!load.Load ())return;
  10181. LoadRect load2;
  10182. load2.SetMargins(-14,472+27-14);
  10183. load2.SetLiaPath ("5.lia");
  10184. if(!load2.Load ())return;
  10185. //////////////////////////////////////////////////////////////
  10186. CString filter="id='"+m_id+"';id='"+m_id+"'";
  10187. g_sendhead.code[0]=54;
  10188. g_sendhead.code[1]=50;
  10189. g_sendhead.tabcount=2;
  10190. g_sendhead.bsql=0;
  10191. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  10192. CArray<CStringArray, CStringArray>sparray;
  10193. DataToArray(&g_List1array,&sparray);
  10194. CString spno;
  10195. for(int i=0; i<sparray.GetSize (); i++)
  10196. {
  10197. if(sparray.ElementAt (i).ElementAt (4)=="4" && sparray.ElementAt (i).ElementAt (5)!="入册")continue;
  10198. if(sparray.ElementAt (i).ElementAt (5)=="入册"&&sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  10199. spno+=sparray.ElementAt (i).ElementAt (5);
  10200. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  10201. spno+=";";
  10202. else
  10203. {
  10204. spno+=":";
  10205. spno+=sparray.ElementAt (i).ElementAt (6);
  10206. spno+=";";
  10207. }
  10208. }
  10209. spno+=" 加挑:";
  10210. for( i=0; i<sparray.GetSize (); i++)
  10211. {
  10212. if(sparray.ElementAt (i).ElementAt (4)!="4")continue;
  10213. if(sparray.ElementAt (i).ElementAt (5)=="入册")continue;
  10214. spno+=sparray.ElementAt (i).ElementAt (5);
  10215. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  10216. spno+=";";
  10217. else
  10218. {
  10219. spno+=":";
  10220. spno+=sparray.ElementAt (i).ElementAt (6);
  10221. spno+=";";
  10222. }
  10223. }
  10224. if(spno.Right (6)==" 加挑:")
  10225. {
  10226. spno=spno.Left (spno.GetLength ()-6);
  10227. }
  10228. CString m_name1 = g_List1array.ElementAt (0).ElementAt (1);
  10229. CString m_name2 = g_List1array.ElementAt (0).ElementAt (2);
  10230. CString m_phone1=g_List1array.ElementAt (0).ElementAt (3);
  10231. CString m_phone2=g_List1array.ElementAt (0).ElementAt (4);
  10232. CString m_urgent=g_List1array.ElementAt (0).ElementAt (5);
  10233. if(m_urgent.IsEmpty ())m_urgent="否";
  10234. CString m_time2 = g_List1array.ElementAt (0).ElementAt (6);
  10235. CString m_time4 = g_List1array.ElementAt (0).ElementAt (7);
  10236. CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  10237. CString m_takezs = g_List1array.ElementAt (0).ElementAt (9);
  10238. CString m_taoxizs = g_List1array.ElementAt (0).ElementAt (10);
  10239. CString m_choosezs = g_List1array.ElementAt (0).ElementAt (11);
  10240. CString m_ren = g_List1array.ElementAt (0).ElementAt (12);
  10241. CString m_waiter3 = g_List1array.ElementAt (0).ElementAt (13);
  10242. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (14);
  10243. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (15);
  10244. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (16);
  10245. CString m_bz = "客人要求: "+g_List1array.ElementAt (0).ElementAt (17);
  10246. CString m_money3 = g_List1array.ElementAt (0).ElementAt (18);
  10247. CString m_money1 = g_List1array.ElementAt (0).ElementAt (19);
  10248. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (20);
  10249. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (21);
  10250. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (22);
  10251. CString m_sum3;
  10252. m_sum3.Format ("%0.2f", atof(m_taoxijiage)+atof(m_payed4)-(atof(m_payed5)+atof(m_money1)));
  10253. ::ConvertToPrice (m_sum3);
  10254. if(m_money3.IsEmpty ())m_money3="0";
  10255. // m_money3=m_money3+"/"+m_sum3;
  10256. CString name;
  10257. if(!m_name1.IsEmpty ())
  10258. name=m_name1+",";
  10259. name+=m_name2;
  10260. name.TrimRight (",");
  10261. CString phone;
  10262. if(!m_phone1.IsEmpty ())
  10263. phone=m_phone1+",";
  10264. phone+=m_phone2;phone.TrimRight (",");
  10265. CStringArray strarray;
  10266. strarray.Add (m_urgent);
  10267. strarray.Add (m_ren);
  10268. strarray.Add (m_waiter3);
  10269. strarray.Add (name);
  10270. strarray.Add (m_time2);
  10271. strarray.Add (m_time4);
  10272. strarray.Add (m_time5);
  10273. strarray.Add (m_money3);
  10274. strarray.Add (m_takezs);
  10275. strarray.Add (m_taoxizs);
  10276. strarray.Add (m_choosezs);
  10277. strarray.Add (m_id);
  10278. strarray.Add (phone);
  10279. ////////////////////////////////////////////////////////////////
  10280. int rcpos=-1;
  10281. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  10282. Image *pImg=NULL;
  10283. #ifdef MNLS_VERSION
  10284. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG") );
  10285. #else
  10286. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  10287. #endif
  10288. m_Print.DrawImage(pImg, StrRect);
  10289. delete pImg;
  10290. m_Print.SetFontFace(15, 1, "宋体");
  10291. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10292. #ifdef MNLS_VERSION
  10293. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10294. #endif
  10295. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10296. #ifdef MNLS_VERSION
  10297. m_Print.DrawRect(StrRect);
  10298. #endif
  10299. m_Print.SetFontFace(7, 1, "黑体");
  10300. m_Print.SetColor(0xffffff);
  10301. #ifdef MNLS_VERSION
  10302. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10303. #endif
  10304. m_Print.SetColor(0);
  10305. m_Print.SetFontFace(25, 1, "黑体");
  10306. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10307. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10308. CString title[13]={"是否加急:","接单门市:","选样人员:","新郎新娘姓名:","拍照日期:","选片日期:","取件日期:","加挑/余款:","拍摄总张数:","应挑选张数:","额外加挑张数:","票号:","客户联系电话:"};
  10309. m_Print.SetFontFace(12, 1, "宋体");
  10310. for( i=0; i<13; i++)
  10311. {
  10312. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10313. if(i<3)
  10314. m_Print.DrawRect2(StrRect, 0);
  10315. else
  10316. m_Print.DrawRect2(StrRect, 1);
  10317. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10318. }
  10319. for( i=18; i<=37; i++)
  10320. {
  10321. StrRect=load.m_rcarray .ElementAt (++rcpos);
  10322. if(i>=19&&i<=21)
  10323. m_Print.DrawRect2(StrRect, 2);
  10324. else if(i==26)
  10325. {
  10326. CRect rc=StrRect;
  10327. CRect rc2=rc;
  10328. rc.right -=rc2.Width ()/2;
  10329. m_Print.DrawRect2(rc, 1);
  10330. rc2.left +=rc.Width ();
  10331. m_Print.DrawRect2(rc2, 1);
  10332. }
  10333. else
  10334. m_Print.DrawRect2(StrRect, 1);
  10335. if(i==18)
  10336. {
  10337. StrRect.left +=5;
  10338. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10339. }
  10340. }
  10341. //////////////////////////////////////
  10342. rcpos=-1;
  10343. for( i=0; i<8; i++)
  10344. {
  10345. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10346. m_Print.DrawRect2(StrRect, 1);
  10347. }
  10348. CString title2[4]={"化妆师:","摄影师:","数码设计师:","顾客签名:"};
  10349. for( i=0; i<4; i++)
  10350. {
  10351. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10352. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  10353. }
  10354. for( i=0; i<4; i++)
  10355. {
  10356. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10357. m_Print.DrawRect2(StrRect, 2);
  10358. }
  10359. ///////////////////////////////////////////
  10360. for( i=19; i<=31; i++)
  10361. {
  10362. StrRect=load.m_rcarray .ElementAt (i-1);
  10363. StrRect.left +=4;
  10364. if(i==31)
  10365. {
  10366. if(m_phone1.IsEmpty ()==0 && m_phone2.IsEmpty ()==0)
  10367. {
  10368. StrRect.top +=2;
  10369. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  10370. StrRect.top +=8;
  10371. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10372. }
  10373. else
  10374. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10375. }
  10376. else if((i-19)==7)
  10377. {
  10378. CRect rc=StrRect;
  10379. CRect rc2=rc;
  10380. rc.right -=rc2.Width ()/2;
  10381. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10382. rc2.left +=rc.Width ()+3;
  10383. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10384. }
  10385. else
  10386. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10387. }
  10388. strarray.RemoveAll ();
  10389. strarray.Add (m_waiter2);
  10390. strarray.Add (m_waiter1);
  10391. strarray.Add (m_waiter4);
  10392. for( i=13; i<=15; i++)
  10393. {
  10394. StrRect=load2.m_rcarray .ElementAt (i-1);
  10395. StrRect.left +=4;
  10396. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10397. }
  10398. ///////////spno
  10399. CRect sprc[14];
  10400. for(i=0; i<14; i++)
  10401. {
  10402. if(i<7)
  10403. {
  10404. if(i==0)
  10405. {
  10406. StrRect=load.m_rcarray .ElementAt (17);StrRect.left +=94;StrRect.right -=3;
  10407. }
  10408. else
  10409. {
  10410. StrRect=load.m_rcarray .ElementAt (30+i);StrRect.left +=4;StrRect.right -=3;
  10411. }
  10412. }
  10413. else
  10414. {
  10415. StrRect=load2.m_rcarray .ElementAt (i-7);StrRect.left +=4;StrRect.right -=3;
  10416. }
  10417. sprc[i]=StrRect;
  10418. // m_Print.DrawText((LPTSTR)(LPCTSTR)"xxx", sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10419. }
  10420. CString temp,tempspno,tempbz;
  10421. CSize size;
  10422. BOOL bRun=0;
  10423. int fontsize=12;
  10424. ll: tempspno=spno;
  10425. tempbz=m_bz;
  10426. m_Print.SetFontFace(fontsize, 1, "宋体");
  10427. for( i=0; i<14; i++)
  10428. {
  10429. if(!tempspno.IsEmpty ())
  10430. {
  10431. temp=tempspno;
  10432. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10433. int right=0;
  10434. CRect temprc=sprc[i];
  10435. while(size.cx>temprc.Width ())
  10436. {
  10437. right++;
  10438. temp=tempspno.Left (tempspno.GetLength ()-(right));
  10439. if(GIsHalfHZ(temp))
  10440. {
  10441. right++;
  10442. temp.Delete (temp.GetLength ()-1);
  10443. }
  10444. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10445. }
  10446. if(bRun)
  10447. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10448. tempspno=tempspno.Right (tempspno.GetLength ()-temp.GetLength ());
  10449. if(tempspno.IsEmpty ())i++;
  10450. }
  10451. else if(!tempbz.IsEmpty ())
  10452. {
  10453. temp=tempbz;
  10454. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10455. int right=0;
  10456. CRect temprc=sprc[i];
  10457. while(size.cx>temprc.Width ())
  10458. {
  10459. right++;
  10460. temp=tempbz.Left (tempbz.GetLength ()-(right));
  10461. if(GIsHalfHZ(temp))
  10462. {
  10463. right++;
  10464. temp.Delete (temp.GetLength ()-1);
  10465. }
  10466. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10467. }
  10468. if(bRun)
  10469. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10470. tempbz=tempbz.Right (tempbz.GetLength ()-temp.GetLength ());
  10471. }
  10472. }
  10473. if(tempspno.IsEmpty ()==0 || tempbz.IsEmpty ()==0)
  10474. {
  10475. fontsize--;
  10476. goto ll;
  10477. }
  10478. if(bRun==0)
  10479. {
  10480. bRun=1;
  10481. goto ll;
  10482. }
  10483. PrintPreview dlg;
  10484. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  10485. dlg.m_pDC =m_Print.GetPDC() ;
  10486. if(dlg.DoModal ()!=IDOK)return;
  10487. //结束打印
  10488. m_Print.EndPage();
  10489. m_Print.EndPrint();
  10490. }
  10491. void CMainFrame::SetSelFolder(int pos)
  10492. {
  10493. m_wndToolBar2.SetSelFolder(pos);
  10494. }*/
  10495. void CMainFrame::ToPhotoPrint()
  10496. {
  10497. UINT nID = 1;
  10498. LPSTR pName;
  10499. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  10500. OPEN_MENU(PhotoPrintFrom);
  10501. }
  10502. void CMainFrame::GetOcx()
  10503. {
  10504. char path[MAX_PATH];
  10505. ::GetSystemDirectory(path, MAX_PATH);
  10506. CString syspath = path;
  10507. try
  10508. {
  10509. if (!::PathFileExists(syspath + "\\MSCHRT20.OCX"))
  10510. {
  10511. g_sendhead.bsql = 0;
  10512. g_sendhead.code[0] = 103;
  10513. g_sendhead.tabcount = 1;
  10514. g_pMainWnd->ProcessChatMessageRequest2(1); if (g_bSendOK == 0)return;
  10515. CFile fp;
  10516. if (fp.Open(syspath + "\\MSCHRT20.OCX", CFile::modeWrite | CFile::modeCreate))
  10517. {
  10518. fp.Write(g_pData, g_nLeng);
  10519. fp.Close();
  10520. ::Sleep(1000);
  10521. }
  10522. }
  10523. CString temp;
  10524. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10525. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10526. }
  10527. catch (...)
  10528. {
  10529. }
  10530. try
  10531. {
  10532. CString temp;
  10533. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10534. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10535. }
  10536. catch (...)
  10537. {
  10538. }
  10539. }
  10540. void CMainFrame::OnServer()
  10541. {
  10542. // TODO: Add your command handler code here
  10543. DBConfig dlg;
  10544. dlg.DoModal();
  10545. }
  10546. void CMainFrame::OnPath()
  10547. {
  10548. // TODO: Add your command handler code here
  10549. if (g_user.bLongin == 0)
  10550. {
  10551. if (g_bNoLoginLia)
  10552. {
  10553. Login dlg;
  10554. dlg.SetLiaPath("5.lia");
  10555. dlg.DoModal();
  10556. }
  10557. else
  10558. {
  10559. Login3 dlg;
  10560. dlg.SetLiaPath("5.lia");
  10561. dlg.DoModal();
  10562. }
  10563. if (g_user.bLongin == 0)return;
  10564. }
  10565. if (IsHasRightsnew(49) == 0)return;
  10566. SetPathDlg2 dlg;
  10567. dlg.DoModal();
  10568. }
  10569. void CMainFrame::OnShowhis()
  10570. {
  10571. // TODO: Add your command handler code here
  10572. if (g_user.bLongin == 0)
  10573. {
  10574. if (g_bNoLoginLia)
  10575. {
  10576. Login dlg;
  10577. dlg.SetLiaPath("5.lia");
  10578. dlg.DoModal();
  10579. }
  10580. else
  10581. {
  10582. Login3 dlg;
  10583. dlg.SetLiaPath("5.lia");
  10584. dlg.DoModal();
  10585. }
  10586. if (g_user.bLongin == 0)return;
  10587. }
  10588. if (IsHasRightsnew(52) == 0)return;
  10589. CMenu *pMenu = GetMenu();
  10590. CMenu* submenu = pMenu->GetSubMenu(2);
  10591. UINT status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10592. if (status&MF_CHECKED)
  10593. {
  10594. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_UNCHECKED);
  10595. g_bShowOK = 1;
  10596. }
  10597. else
  10598. {
  10599. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  10600. g_bShowOK = 0;
  10601. } m_Mdi.CloseAll();
  10602. }
  10603. void CMainFrame::AddHistoryMenu(CArray<CStringArray, CStringArray>*hisyeararray) // 添加历史数据库菜单;
  10604. {
  10605. #ifdef NEW_SKIN
  10606. CMenu* m_menuXP = GetMenu();
  10607. CMenu* submenu = m_menuXP->GetSubMenu(2);
  10608. // 删除原有菜单;
  10609. int i = 0;
  10610. for ( i = 0; i < 100; i++)
  10611. {
  10612. submenu->DeleteMenu(1000 + i, MF_BYCOMMAND);
  10613. }
  10614. // 重创菜单,从资源ID1000开始;
  10615. for (i = 0; i < hisyeararray->GetSize(); i++)
  10616. {
  10617. submenu->AppendMenu(MF_STRING, 1000 + i, "查看历史数据:" + hisyeararray->ElementAt(i).ElementAt(0)); // 第一项菜单项;
  10618. }
  10619. g_nYearpos = -1;
  10620. #else
  10621. HMENU hMenu = ::GetMenu(m_hWnd);
  10622. m_menuXP.Attach(hMenu);
  10623. BCMenu* submenu = (BCMenu*)m_menuXP.GetSubMenu(2);
  10624. for (int i = 0; i < 100; i++)
  10625. {
  10626. submenu->DeleteMenu (1000+i, MF_BYCOMMAND);
  10627. }
  10628. for( i=0; i<hisyeararray->GetSize (); i++)
  10629. {
  10630. submenu->AppendMenu(MF_STRING, 1000+i, "查看历史数据:"+hisyeararray->ElementAt (i).ElementAt (0)); // 第一项菜单项
  10631. }
  10632. m_menuXP.Detach ();
  10633. g_nYearpos = -1;
  10634. #endif
  10635. }
  10636. /************************************************************************/
  10637. /*
  10638. Jeff
  10639. 函数:AddBranchMenu()
  10640. 参数:CArray<CStringArray, CStringArray> *branchArray
  10641. 返回:void
  10642. 注意:
  10643. 调用关系:
  10644. */
  10645. /************************************************************************/
  10646. void CMainFrame::AddBranchMenu(CArray<CStringArray, CStringArray>*branchArray)
  10647. {
  10648. //WriteClientLog("AddBranchMenu,添加集团版菜单");
  10649. #ifdef ENTERPRISE_VERSION
  10650. CMenu *m_menuXP = GetMenu();
  10651. CMenu* submenu = m_menuXP->GetSubMenu(0);
  10652. int i = 0;
  10653. for ( i = 0; i < 100; i++)
  10654. {
  10655. submenu->DeleteMenu(2000 + i, MF_BYCOMMAND);
  10656. }
  10657. g_menubranchname.RemoveAll();
  10658. CString name;
  10659. int a = 0;
  10660. #if 0 // Jeff.add for test
  10661. CString strCount;
  10662. strCount.Format("历史数据库个数=%d", branchArray->GetSize());
  10663. WriteClientLog(strCount);
  10664. #endif
  10665. for (i = 0; i < branchArray->GetSize() - 1; i++)
  10666. {
  10667. //WriteClientLog("111");
  10668. //WriteClientLog(hisyeararray->ElementAt(i).ElementAt(0));
  10669. //WriteClientLog(name);
  10670. if (name == "")
  10671. {
  10672. name = branchArray->ElementAt(i).ElementAt(0);
  10673. #ifndef SQLSERVER_VERSION
  10674. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10675. a++;
  10676. #endif
  10677. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10678. a++;
  10679. g_menubranchname.Add(name);
  10680. continue;
  10681. }
  10682. else if (branchArray->ElementAt(i).ElementAt(0).Find(name) != -1 && ((branchArray->ElementAt(i).ElementAt(0).GetLength() - name.GetLength()) == 4))
  10683. {
  10684. continue;
  10685. }
  10686. name = branchArray->ElementAt(i).ElementAt(0);
  10687. #ifndef SQLSERVER_VERSION
  10688. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10689. a++;
  10690. #endif
  10691. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10692. g_menubranchname.Add(name);
  10693. a++;
  10694. //WriteClientLog("222");
  10695. }
  10696. if ((branchArray->GetSize() - 1) > 0)
  10697. {
  10698. if (branchArray->ElementAt(0).ElementAt(3) == "总店")
  10699. submenu->AppendMenu(MF_STRING, 2000 + a, "多店数据汇总");
  10700. }
  10701. #endif
  10702. }
  10703. // Jeff:如果选择了历史数据库,则开单的数据会录入到该历史数据库中,而非当前数据库;
  10704. // g_nYearpos==-1,表示当前主数据库,其他>=0的值表示历史数据库在g_historydb中的索引值;
  10705. void CMainFrame::OnHistory(UINT nID) // 选择历史数据库菜单响应;
  10706. {
  10707. CMenu* pMenu = GetMenu();
  10708. CMenu* submenu = pMenu->GetSubMenu(2);
  10709. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10710. if (g_user.bLongin == 0)
  10711. {
  10712. if (g_bNoLoginLia)
  10713. {
  10714. Login dlg;
  10715. dlg.SetLiaPath("5.lia");
  10716. dlg.DoModal();
  10717. }
  10718. else
  10719. {
  10720. Login3 dlg;
  10721. dlg.SetLiaPath("5.lia");
  10722. dlg.DoModal();
  10723. }
  10724. if (g_user.bLongin == 0)return;
  10725. }
  10726. if (IsHasRightsnew(52) == 0)return;
  10727. m_Mdi.CloseAll();
  10728. for (int i = 0; i < 100; i++)
  10729. {
  10730. submenu->CheckMenuItem(1000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10731. }
  10732. if (status&MF_CHECKED)
  10733. {
  10734. g_nYearpos = -1;
  10735. status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10736. if (status&MF_CHECKED)
  10737. g_bShowOK = 0;
  10738. else
  10739. g_bShowOK = 1;
  10740. }
  10741. else
  10742. {
  10743. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10744. g_nYearpos = nID - 1000;
  10745. g_bShowOK = 1;
  10746. }
  10747. }
  10748. void CMainFrame::OnBranchData(UINT nID)
  10749. {
  10750. #ifdef ENTERPRISE_VERSION
  10751. #ifdef SQLSERVER_VERSION
  10752. OnBranchData2(nID);
  10753. return;
  10754. #endif
  10755. #endif
  10756. }
  10757. void CMainFrame::OnBranchData2(UINT nID)
  10758. {
  10759. #ifdef ENTERPRISE_VERSION
  10760. g_bAllBranch = 0;
  10761. m_Mdi.CloseAll();
  10762. OnDisconnect();
  10763. CMenu *pMenu = GetMenu();
  10764. CMenu* submenu = pMenu->GetSubMenu(0);
  10765. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10766. for (int i = 0; i < 100; i++)
  10767. {
  10768. submenu->CheckMenuItem(2000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10769. }
  10770. if (status&MF_CHECKED)
  10771. {
  10772. g_branchname.Empty();
  10773. g_branchip.Empty();
  10774. g_bBranchModify = 0;
  10775. g_user.bLongin = 0;
  10776. if (g_bNoLoginLia)
  10777. {
  10778. Login dlg;
  10779. dlg.SetLiaPath("5.lia");
  10780. dlg.DoModal();
  10781. }
  10782. else
  10783. {
  10784. Login3 dlg;
  10785. dlg.SetLiaPath("5.lia");
  10786. dlg.DoModal();
  10787. }
  10788. g_pMainWnd2->RefreshOutlookBar();
  10789. g_pMainWnd2->DrawLogin();
  10790. g_path1 = g_path1bak;
  10791. g_path2 = g_path2bak;
  10792. g_path3 = g_path3bak;
  10793. g_path4 = g_path4bak;
  10794. g_path5 = g_path5bak;
  10795. g_path6 = g_path6bak;
  10796. g_path7 = g_path7bak;
  10797. g_pMainWnd2->EnableBtns(1);
  10798. }
  10799. else
  10800. {
  10801. BOOL bNeedCheckRights = 1;
  10802. if (g_user.bLongin && g_branchname == "")//无需登陆本店判断其访问分店权限
  10803. {
  10804. bNeedCheckRights = 0;
  10805. }
  10806. #ifndef SQLSERVER_VERSION
  10807. if ((g_menubranchname.GetSize() * 2) == nID - 2000)//多店数据汇总
  10808. #else
  10809. if ((g_menubranchname.GetSize()) == nID - 2000)//多店数据汇总
  10810. #endif
  10811. {
  10812. g_branchname.Empty();
  10813. g_branchip.Empty();
  10814. g_bBranchModify = 0;
  10815. if (bNeedCheckRights)
  10816. {
  10817. g_user.bLongin = 0;
  10818. if (g_user.bLongin == 0)
  10819. {
  10820. if (g_bNoLoginLia)
  10821. {
  10822. Login dlg;
  10823. dlg.SetLiaPath("5.lia");
  10824. dlg.DoModal();
  10825. }
  10826. else
  10827. {
  10828. Login3 dlg;
  10829. dlg.SetLiaPath("5.lia");
  10830. dlg.DoModal();
  10831. }
  10832. if (g_user.bLongin == 0)return;
  10833. }
  10834. }
  10835. if (IsHasRightsnew(28) == 0)
  10836. {
  10837. return;
  10838. }
  10839. g_bAllBranch = 1; g_pMainWnd2->ShowBar(0);
  10840. g_pMainWnd2->RefreshOutlookBar2();
  10841. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10842. g_branchname.Empty();
  10843. g_branchip.Empty();
  10844. g_bBranchModify = 0;
  10845. g_pMainWnd2->DrawLogin();
  10846. g_pMainWnd2->EnableBtns(0);
  10847. g_path1 = g_path1bak;
  10848. g_path2 = g_path2bak;
  10849. g_path3 = g_path3bak;
  10850. g_path4 = g_path4bak;
  10851. g_path5 = g_path5bak;
  10852. g_path6 = g_path6bak;
  10853. g_path7 = g_path7bak;
  10854. }
  10855. else
  10856. {
  10857. if (bNeedCheckRights)
  10858. {
  10859. g_branchname.Empty();
  10860. g_branchip.Empty();
  10861. g_bBranchModify = 0;
  10862. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_UNCHECKED);
  10863. g_user.bLongin = 0;
  10864. if (g_pMainWnd2)
  10865. {
  10866. g_pMainWnd2->DrawLogin();
  10867. g_pMainWnd2->ShowBar(0);
  10868. }
  10869. if (g_bNoLoginLia)
  10870. {
  10871. Login dlg;
  10872. dlg.SetLiaPath("5.lia");
  10873. dlg.DoModal();
  10874. }
  10875. else
  10876. {
  10877. Login3 dlg;
  10878. dlg.SetLiaPath("5.lia");
  10879. dlg.DoModal();
  10880. }
  10881. if (g_user.bLongin == 0)return;
  10882. }
  10883. if (IsHasRightsnew(28) == 0)
  10884. {
  10885. return;
  10886. }
  10887. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10888. #ifndef SQLSERVER_VERSION
  10889. if (nID % 2 == 0)
  10890. g_branchname = g_menubranchname.ElementAt((nID - 2000) / 2);
  10891. else
  10892. g_branchname = g_menubranchname.ElementAt((nID - 2001) / 2);
  10893. #else
  10894. g_branchname = g_menubranchname.ElementAt(nID - 2000);
  10895. #endif
  10896. //printf("选择分店:%s\n", g_branchname);
  10897. g_branchip.Empty();
  10898. CString domainname = "";
  10899. for (int i = 0; i < g_brancharray.GetSize(); i++)
  10900. {
  10901. /*
  10902. for(int j=0; j<g_brancharray.GetSize(); j++)
  10903. printf("%s\n", g_brancharray.ElementAt(i).ElementAt(j));
  10904. */
  10905. if (g_branchname == g_brancharray.ElementAt(i).ElementAt(0))
  10906. {
  10907. g_branchip = g_brancharray.ElementAt(i).ElementAt(1);
  10908. g_branchip2 = g_brancharray.ElementAt(i).ElementAt(4);
  10909. domainname = g_brancharray.ElementAt(i).ElementAt(2);
  10910. }
  10911. }
  10912. g_path1 = g_path1bak;
  10913. g_path2 = g_path2bak;
  10914. g_path3 = g_path3bak;
  10915. g_path4 = g_path4bak;
  10916. g_path5 = g_path5bak;
  10917. g_path6 = g_path6bak;
  10918. g_path7 = g_path7bak;
  10919. if (domainname.IsEmpty())
  10920. {
  10921. g_path1 = g_path2 = g_path3 = g_path4 = g_path5 = g_path6 = g_path7 = "xxx";
  10922. }
  10923. else
  10924. {
  10925. g_path1 += "\\" + domainname;
  10926. g_path2 += "\\" + domainname;
  10927. g_path3 += "\\" + domainname;
  10928. g_path4 += "\\" + domainname;
  10929. g_path5 += "\\" + domainname;
  10930. g_path6 += "\\" + domainname;
  10931. g_path7 += "\\" + domainname;
  10932. }
  10933. g_bBranchModify = 1;
  10934. /* CArray<CStringArray, CStringArray>yeararray;
  10935. for( i=0; i<g_brancharray.GetSize (); i++)
  10936. {
  10937. if(g_brancharray.ElementAt (i).ElementAt (0).Find (g_branchname)!=-1 && g_branchname!=g_brancharray.ElementAt (i).ElementAt (0))
  10938. {
  10939. int size=yeararray.GetSize ();
  10940. yeararray.SetSize(size+1,1);
  10941. CString str=g_brancharray.ElementAt (i).ElementAt (0);
  10942. str.Delete (0, g_branchname.GetLength ());
  10943. yeararray.ElementAt (size).Add (str);
  10944. }
  10945. }
  10946. AddHistoryMenu(&yeararray);*/
  10947. if (g_bBranchModify)OnDisconnect();
  10948. if (1)
  10949. {
  10950. g_user.bLongin = 0;
  10951. g_user.name.Empty();
  10952. g_user.rights.Empty();
  10953. g_user.account.Empty();
  10954. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  10955. g_pMainWnd2->RefreshOutlookBar();
  10956. m_Mdi.CloseAll();
  10957. if (g_pMainWnd2)
  10958. {
  10959. g_pMainWnd2->DrawLogin();
  10960. g_pMainWnd2->ShowBar(0);
  10961. }
  10962. if (g_bNoLoginLia)
  10963. {
  10964. Login dlg;
  10965. dlg.SetLiaPath("5.lia");
  10966. dlg.DoModal();
  10967. }
  10968. else
  10969. {
  10970. Login3 dlg;
  10971. dlg.SetLiaPath("5.lia");
  10972. dlg.DoModal();
  10973. }
  10974. if (g_user.bLongin == 0)return;
  10975. if (g_pMainWnd2)g_pMainWnd2->ShowBar(1);
  10976. }
  10977. g_pMainWnd2->DrawLogin();
  10978. g_pMainWnd2->EnableBtns(1);
  10979. }
  10980. g_nYearpos = -1;
  10981. }
  10982. #endif
  10983. }
  10984. void CMainFrame::OnStaffAchievementShow() //Jeff:此机只用于员工看业绩;
  10985. {
  10986. // TODO: Add your command handler code here
  10987. if (g_user.bLongin == 0) // 是否登陆系统;
  10988. {
  10989. if (g_bNoLoginLia)
  10990. {
  10991. Login dlg;
  10992. dlg.SetLiaPath("5.lia");
  10993. dlg.DoModal();
  10994. }
  10995. else
  10996. {
  10997. Login3 dlg;
  10998. dlg.SetLiaPath("5.lia");
  10999. dlg.DoModal();
  11000. }
  11001. if (g_user.bLongin == 0)return;
  11002. }
  11003. if (IsHasRightsnew(49) == 0)return;// 是否有权限进行设置;
  11004. CMenu *pMenu = GetMenu();
  11005. CMenu* submenu = pMenu->GetSubMenu(1);
  11006. UINT status = submenu->GetMenuState(IDM_StaffAchievementShow, MF_BYCOMMAND);
  11007. if (status&MF_CHECKED)
  11008. {
  11009. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_UNCHECKED);
  11010. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status2", 0);
  11011. g_bStaffAchievementShow = 0;
  11012. TCHAR szKey[MAX_PATH];
  11013. TCHAR szDir[MAX_PATH];
  11014. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  11015. HKEY hKey = 0;
  11016. DWORD disp = 0;
  11017. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  11018. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  11019. if (lResult == ERROR_SUCCESS)
  11020. {
  11021. RegDeleteValue(hKey, "YLGLMAINAUTORUN");
  11022. RegDeleteKey(hKey, "YLGLMAINAUTORUN");
  11023. RegCloseKey(hKey);
  11024. }
  11025. }
  11026. else
  11027. {
  11028. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  11029. AfxGetApp()->WriteProfileInt(LYFZVERSION, "status2", 1);
  11030. g_bStaffAchievementShow = 1;
  11031. TCHAR szKey[MAX_PATH];
  11032. TCHAR szDir[MAX_PATH];
  11033. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  11034. HKEY hKey = 0;
  11035. DWORD disp = 0;
  11036. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  11037. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  11038. if (lResult == ERROR_SUCCESS)
  11039. {
  11040. lResult = RegSetValueEx(hKey, "YLGLMAINAUTORUN", 0, REG_SZ, (const unsigned char*)szDir, lstrlen(szDir));
  11041. RegCloseKey(hKey);
  11042. }
  11043. StaffAchievementSet dlg;
  11044. dlg.DoModal();
  11045. }
  11046. }
  11047. void CMainFrame::PrintDinDan2(CString m_id)
  11048. {
  11049. #ifdef MODERN_VERSION
  11050. SelContent seldlg;
  11051. if (seldlg.DoModal() != IDOK)return;
  11052. CPrintRX m_Print;
  11053. m_Print.InitToPrint(NULL, 1);
  11054. m_Print.StartPrint();
  11055. m_Print.StartPage();
  11056. // CRect StrRect(0,0,560,818);
  11057. LoadRect load;
  11058. LoadRect load2;
  11059. LoadRect load3;
  11060. load.SetLiaPath ("9.lia");
  11061. load.SetMargins(-14,0);
  11062. if(!load.Load ())return;
  11063. int i;
  11064. //////////////////////////////////////////////////////////////
  11065. CStringArray txarray;
  11066. CString filter="id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"'";
  11067. g_sendhead.code[0]=11;
  11068. g_sendhead.code[1]=52;
  11069. g_sendhead.code[2]=50;
  11070. g_sendhead.code[3]=38;
  11071. g_sendhead.code[4]=27;
  11072. g_sendhead.tabcount=5;
  11073. g_sendhead.bsql=0;
  11074. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  11075. CArray<CStringArray, CStringArray>sparray;
  11076. CArray<CStringArray, CStringArray>clientarray;
  11077. CArray<CStringArray, CStringArray>phonearray;
  11078. CArray<CStringArray, CStringArray>bukuan2array;
  11079. CArray<CStringArray, CStringArray>bukuanarray;
  11080. DataToArray(&g_List1array, &clientarray, &sparray, &bukuan2array, &bukuanarray);
  11081. CTime tm=CTime::GetCurrentTime ();
  11082. CString str;
  11083. CString m_money1 = g_List1array.ElementAt (0).ElementAt (1);
  11084. CString m_money2 = g_List1array.ElementAt (0).ElementAt (2);
  11085. CString m_money3 = g_List1array.ElementAt (0).ElementAt (3);
  11086. CString m_name1 = g_List1array.ElementAt (0).ElementAt (4);
  11087. CString m_name2 = g_List1array.ElementAt (0).ElementAt (5);
  11088. CString m_taoxiname= g_List1array.ElementAt (0).ElementAt (7);
  11089. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (8);
  11090. CString m_zs = g_List1array.ElementAt (0).ElementAt (9);
  11091. CString m_time1 = g_List1array.ElementAt (0).ElementAt (10);
  11092. CString m_time2 = g_List1array.ElementAt (0).ElementAt (11);
  11093. CString m_time3 = g_List1array.ElementAt (0).ElementAt (12);
  11094. CString m_ren = g_List1array.ElementAt (0).ElementAt (14);
  11095. CString m_discount = g_List1array.ElementAt (0).ElementAt (15);
  11096. CString m_payed1 = g_List1array.ElementAt (0).ElementAt (16);
  11097. CString m_payed2 = g_List1array.ElementAt (0).ElementAt (17);
  11098. CString m_payed3 = g_List1array.ElementAt (0).ElementAt (18);
  11099. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (19);
  11100. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (20);
  11101. CString m_time4 = g_List1array.ElementAt (0).ElementAt (21);
  11102. CString m_time5 = g_List1array.ElementAt (0).ElementAt (22);
  11103. CString m_clothescount = g_List1array.ElementAt (0).ElementAt (26);
  11104. CString m_clothescount2 = g_List1array.ElementAt (0).ElementAt (27);
  11105. CString m_outside = g_List1array.ElementAt (0).ElementAt (28);
  11106. CString m_outside2 = g_List1array.ElementAt (0).ElementAt (29);
  11107. CString m_style = g_List1array.ElementAt (0).ElementAt (30);
  11108. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (34);
  11109. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (35);
  11110. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (37);
  11111. CString m_bz = g_List1array.ElementAt (0).ElementAt (38);
  11112. CString m_phone1=clientarray.ElementAt (0).ElementAt (3);
  11113. CString m_phone2=clientarray.ElementAt (0).ElementAt (4);
  11114. CString m_addr1=clientarray.ElementAt (0).ElementAt (7);
  11115. CString m_addr2=clientarray.ElementAt (0).ElementAt (8);
  11116. CString m_occupation1=clientarray.ElementAt (0).ElementAt (9);
  11117. CString m_occupation2=clientarray.ElementAt (0).ElementAt (10);
  11118. filter="name='"+m_ren+"'";
  11119. g_sendhead.code[0]=5;
  11120. g_sendhead.tabcount=1;
  11121. g_sendhead.bsql=0;
  11122. int g_nYearposTemp=g_nYearpos;
  11123. g_nYearpos=-1;
  11124. g_pMainWnd->ProcessChatMessageRequest2(filter);
  11125. g_nYearpos=g_nYearposTemp;
  11126. if(g_bSendOK==0)return;
  11127. DataToArray(&phonearray);
  11128. m_money2.Format ("%f", atof(m_payed5)+atof(m_money1));
  11129. m_money1.Format ("%f", atof(m_taoxijiage)+atof(m_payed4));
  11130. m_money3.Format ("%f", atof(m_money1)-atof(m_money2));
  11131. ConvertToPrice(m_money1);
  11132. ConvertToPrice(m_money2);
  11133. ConvertToPrice(m_money3);
  11134. ////////////////////////////////////////////////////////////////
  11135. int rcpos=-1;
  11136. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  11137. Image *pImg=NULL;
  11138. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo2.jpg");
  11139. if(seldlg.m_bFrame)
  11140. m_Print.DrawImage(pImg, StrRect);
  11141. delete pImg;
  11142. m_Print.SetFontFace(16, 1, "黑体");
  11143. StrRect=load.m_rcarray .ElementAt (++rcpos);
  11144. if(seldlg.m_bFrame)
  11145. ///////////////////////////////不用改
  11146. m_Print.DrawText((LPTSTR)(LPCTSTR)"摩登新娘工作流程单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11147. m_Print.SetFontFace(10, 1, "宋体");
  11148. for( i=3; i<=6; i++)
  11149. {
  11150. StrRect=load.m_rcarray .ElementAt (i-1);
  11151. if(seldlg.m_bFrame)
  11152. m_Print.DrawRect2(StrRect, 1);
  11153. }
  11154. CStringArray strarray;
  11155. if(seldlg.m_bBooking==0)
  11156. {
  11157. m_name1.Empty ();
  11158. m_name2.Empty ();
  11159. m_phone1.Empty ();
  11160. m_phone2.Empty ();
  11161. m_addr1.Empty ();
  11162. m_addr2.Empty ();
  11163. m_taoxiname.Empty ();
  11164. m_taoxijiage.Empty ();
  11165. }
  11166. if(seldlg.m_bFrame )
  11167. {
  11168. strarray.Add("新郎:"+m_name1);
  11169. strarray.Add("H");
  11170. strarray.Add("O");
  11171. strarray.Add("手机:"+m_phone1);
  11172. strarray.Add("新娘:"+m_name2);
  11173. strarray.Add("H");
  11174. strarray.Add("O");
  11175. strarray.Add("手机:"+m_phone2);
  11176. }
  11177. else
  11178. {
  11179. strarray.Add(" "+m_name1);
  11180. strarray.Add("");
  11181. strarray.Add("");
  11182. strarray.Add(" "+m_phone1);
  11183. strarray.Add(" "+m_name2);
  11184. strarray.Add("");
  11185. strarray.Add("");
  11186. strarray.Add(" "+m_phone2);
  11187. }
  11188. for( i=7; i<=14; i++)
  11189. {
  11190. StrRect=load.m_rcarray .ElementAt (i-1);
  11191. StrRect.left +=2;
  11192. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11193. }
  11194. StrRect=load.m_rcarray .ElementAt (3);
  11195. StrRect.left +=2;
  11196. if(seldlg.m_bFrame)
  11197. str="地址:"+m_addr1;
  11198. else
  11199. str=" "+m_addr1;
  11200. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11201. StrRect=load.m_rcarray .ElementAt (5);
  11202. StrRect.left +=2;
  11203. if(seldlg.m_bFrame)
  11204. str="地址:"+m_addr2;
  11205. else
  11206. str=" "+m_addr2;
  11207. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11208. //////////////////////////////////////////////////////
  11209. StrRect=load.m_rcarray .ElementAt (14);
  11210. str="预\r\n约";
  11211. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11212. StrRect.top +=46;
  11213. StrRect.left +=2;
  11214. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11215. m_Print.SetFontFace(10, 1, "宋体");
  11216. StrRect=load.m_rcarray .ElementAt (15);
  11217. if(seldlg.m_bFrame)
  11218. str="套系名称:"+m_taoxiname;
  11219. else
  11220. str=" "+m_taoxiname;
  11221. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11222. StrRect.left +=4;
  11223. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11224. StrRect=load.m_rcarray .ElementAt (16);
  11225. if(seldlg.m_bFrame)
  11226. str="单价:"+m_taoxijiage;
  11227. else
  11228. str=" "+m_taoxijiage;
  11229. StrRect.left +=2;
  11230. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11231. StrRect=load.m_rcarray .ElementAt (21);
  11232. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11233. str="新人签名:";
  11234. StrRect.left +=2;
  11235. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11236. StrRect=load.m_rcarray .ElementAt (22);
  11237. if(seldlg.m_bBooking==0)
  11238. {
  11239. if(seldlg.m_bFrame)
  11240. str="未付款:";
  11241. else
  11242. str=" ";
  11243. }
  11244. else
  11245. {
  11246. if(seldlg.m_bFrame)
  11247. str="未付款:"+m_money3;
  11248. else
  11249. str=" "+m_money3;
  11250. }
  11251. StrRect.left +=2;
  11252. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11253. StrRect=load.m_rcarray .ElementAt (23);
  11254. str="结婚秘书:";
  11255. StrRect.left +=2;
  11256. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11257. StrRect=load.m_rcarray .ElementAt (24);
  11258. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11259. StrRect.left +=3;
  11260. StrRect.top +=3;
  11261. StrRect.right -=2;
  11262. StrRect.bottom -=2;
  11263. int realpos=0;str="";
  11264. for(i=0; i<sparray.GetSize (); i++)
  11265. {
  11266. if(atoi(sparray.ElementAt (i).ElementAt (4))!=1)continue;
  11267. str+=sparray.ElementAt (i).ElementAt (5);
  11268. str+=" 数量:";
  11269. str+=sparray.ElementAt (i).ElementAt (3);
  11270. if(realpos%2)
  11271. str+="\r\n";
  11272. else
  11273. str+=" ";
  11274. realpos++;
  11275. }
  11276. str.TrimRight ("\r\n");
  11277. str.TrimRight (" ");
  11278. if(seldlg.m_bBooking)AutoDraw(m_Print, StrRect, str, 1.4);
  11279. ///////////////////////////////////////////////////////////
  11280. StrRect=load.m_rcarray .ElementAt (14);
  11281. StrRect.top +=1*122;
  11282. StrRect.bottom +=1*122;
  11283. str="拍\r\n照";
  11284. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11285. StrRect.top +=46;
  11286. StrRect.left +=2;
  11287. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11288. m_Print.SetFontFace(10, 1, "宋体");
  11289. StrRect=load.m_rcarray .ElementAt (15);
  11290. StrRect.top +=1*122;
  11291. StrRect.bottom +=1*122;
  11292. str="拍照内容: 白 晚 特 便";
  11293. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11294. StrRect.left +=4;
  11295. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11296. StrRect=load.m_rcarray .ElementAt (21);
  11297. StrRect.top +=1*122;
  11298. StrRect.bottom +=1*122;
  11299. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11300. str=" 新人签名:";
  11301. StrRect.left +=2;
  11302. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11303. StrRect=load.m_rcarray .ElementAt (22);
  11304. StrRect.top +=1*122;
  11305. StrRect.bottom +=1*122;
  11306. if(seldlg.m_bTake)
  11307. {
  11308. if(seldlg.m_bFrame)
  11309. str="未付款:"+m_money3;
  11310. else
  11311. str=" "+m_money3;
  11312. }
  11313. else
  11314. {
  11315. if(seldlg.m_bFrame)
  11316. str="未付款:";
  11317. else
  11318. str=" ";
  11319. }
  11320. StrRect.left +=2;
  11321. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11322. StrRect=load.m_rcarray .ElementAt (23);
  11323. StrRect.top +=1*122;
  11324. StrRect.bottom +=1*122;
  11325. str="结婚秘书:";
  11326. StrRect.left +=2;
  11327. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11328. StrRect=load.m_rcarray .ElementAt (24);
  11329. StrRect.top +=1*122;
  11330. StrRect.bottom +=1*122;
  11331. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11332. StrRect.left +=3;
  11333. StrRect.top +=3;
  11334. StrRect.right -=2;
  11335. StrRect.bottom -=2;
  11336. if(seldlg.m_bTake)
  11337. {
  11338. str="";
  11339. for(i=0; i<bukuan2array.GetSize (); i++)
  11340. {
  11341. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=1)continue;
  11342. str+="加挑: ";
  11343. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11344. str+="\r\n";
  11345. }
  11346. str.TrimRight ("\r\n");
  11347. str.TrimRight (" ");
  11348. AutoDraw(m_Print, StrRect, str, 1.4);
  11349. }
  11350. ///////////////////////////////////////////////////////////
  11351. StrRect=load.m_rcarray .ElementAt (14);
  11352. StrRect.top +=2*122;
  11353. StrRect.bottom +=2*122;
  11354. str="选\r\n样";
  11355. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11356. StrRect.top +=46;
  11357. StrRect.left +=2;
  11358. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11359. m_Print.SetFontFace(10, 1, "宋体");
  11360. StrRect=load.m_rcarray .ElementAt (15);
  11361. StrRect.top +=2*122;
  11362. StrRect.bottom +=2*122;
  11363. str="选片内容:";
  11364. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11365. StrRect.left +=4;
  11366. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11367. StrRect=load.m_rcarray .ElementAt (21);
  11368. StrRect.top +=2*122;
  11369. StrRect.bottom +=2*122;
  11370. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11371. str=" 新人签名:";
  11372. StrRect.left +=2;
  11373. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11374. StrRect=load.m_rcarray .ElementAt (22);
  11375. StrRect.top +=2*122;
  11376. StrRect.bottom +=2*122;
  11377. if(seldlg.m_bChoose)
  11378. {
  11379. if(seldlg.m_bFrame)
  11380. str="未付款:"+m_money3;
  11381. else
  11382. str=" "+m_money3;
  11383. }
  11384. else
  11385. {
  11386. if(seldlg.m_bFrame)
  11387. str="未付款:";
  11388. else
  11389. str=" ";
  11390. }
  11391. StrRect.left +=2;
  11392. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11393. StrRect=load.m_rcarray .ElementAt (23);
  11394. StrRect.top +=2*122;
  11395. StrRect.bottom +=2*122;
  11396. str="结婚秘书:";
  11397. StrRect.left +=2;
  11398. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11399. StrRect=load.m_rcarray .ElementAt (24);
  11400. StrRect.top +=2*122;
  11401. StrRect.bottom +=2*122;
  11402. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11403. if(seldlg.m_bChoose)
  11404. {
  11405. StrRect.left +=3;
  11406. StrRect.top +=3;
  11407. StrRect.right -=2;
  11408. StrRect.bottom -=2;
  11409. str="";
  11410. for(i=0; i<bukuan2array.GetSize (); i++)
  11411. {
  11412. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=2)continue;
  11413. str+="加挑: ";
  11414. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11415. str+="\r\n";
  11416. }
  11417. str.TrimRight ("\r\n");
  11418. str.TrimRight (" ");
  11419. AutoDraw(m_Print, StrRect, str, 1.4);
  11420. }
  11421. ///////////////////////////////////////////////////////////
  11422. StrRect=load.m_rcarray .ElementAt (14);
  11423. StrRect.top +=3*122;
  11424. StrRect.bottom +=3*122;
  11425. str="结\r\n婚";
  11426. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11427. StrRect.top +=46;
  11428. StrRect.left +=2;
  11429. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11430. m_Print.SetFontFace(10, 1, "宋体");
  11431. StrRect=load.m_rcarray .ElementAt (15);
  11432. StrRect.top +=3*122;
  11433. StrRect.bottom +=3*122;
  11434. str="结婚内容: 区 白 晚 押金:";
  11435. if(seldlg.m_bFrame) m_Print.DrawRect2(StrRect, 1);
  11436. StrRect.left +=4;
  11437. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11438. StrRect=load.m_rcarray .ElementAt (21);
  11439. StrRect.top +=3*122;
  11440. StrRect.bottom +=3*122;
  11441. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11442. str=" 新人签名:";
  11443. StrRect.left +=2;
  11444. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11445. StrRect=load.m_rcarray .ElementAt (22);
  11446. StrRect.top +=3*122;
  11447. StrRect.bottom +=3*122;
  11448. if(seldlg.m_bBooking)
  11449. {
  11450. if(seldlg.m_bFrame)
  11451. str="未付款:"+m_money3;
  11452. else
  11453. str=" "+m_money3;
  11454. }
  11455. else
  11456. {
  11457. if(seldlg.m_bFrame)
  11458. str="未付款:";
  11459. else
  11460. str=" ";
  11461. }
  11462. StrRect.left +=2;
  11463. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11464. StrRect=load.m_rcarray .ElementAt (23);
  11465. StrRect.top +=3*122;
  11466. StrRect.bottom +=3*122;
  11467. str="结婚秘书:";
  11468. StrRect.left +=2;
  11469. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11470. StrRect=load.m_rcarray .ElementAt (24);
  11471. StrRect.top +=3*122;
  11472. StrRect.bottom +=3*122;
  11473. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11474. if(seldlg.m_bBooking)
  11475. {
  11476. StrRect.left +=3;
  11477. StrRect.top +=3;
  11478. StrRect.right -=2;
  11479. StrRect.bottom -=2;
  11480. realpos=0;str="";
  11481. for(i=0; i<sparray.GetSize (); i++)
  11482. {
  11483. if(atoi(sparray.ElementAt (i).ElementAt (4))!=2)continue;
  11484. str+=sparray.ElementAt (i).ElementAt (5);
  11485. str+=" 数量:";
  11486. str+=sparray.ElementAt (i).ElementAt (3);
  11487. if(realpos%2)
  11488. str+="\r\n";
  11489. else
  11490. str+=" ";
  11491. realpos++;
  11492. }
  11493. str.TrimRight ("\r\n");
  11494. str.TrimRight (" ");
  11495. AutoDraw(m_Print, StrRect, str, 1.4);
  11496. }
  11497. ///////////////////////////////////////
  11498. strarray.RemoveAll ();
  11499. if(seldlg.m_bFrame)
  11500. {
  11501. strarray.Add ("项目");
  11502. strarray.Add ("万");
  11503. strarray.Add ("千");
  11504. strarray.Add ("百");
  11505. strarray.Add ("十");
  11506. strarray.Add ("个");
  11507. strarray.Add ("收 银");
  11508. }
  11509. else
  11510. {
  11511. strarray.Add ("");
  11512. strarray.Add ("");
  11513. strarray.Add ("");
  11514. strarray.Add ("");
  11515. strarray.Add ("");
  11516. strarray.Add ("");
  11517. strarray.Add ("");
  11518. }
  11519. CStringArray strarray2;
  11520. float ftotal=0;
  11521. int realcount=0;
  11522. if(seldlg.m_bBooking)
  11523. {
  11524. for(i=0; i<bukuanarray.GetSize (); i++)
  11525. {
  11526. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=3 && atoi(bukuanarray.ElementAt (i).ElementAt (6))!=4)continue;
  11527. realcount++;
  11528. if(realcount>6)break;
  11529. str=bukuanarray.ElementAt (i).ElementAt (1);
  11530. ftotal+=atof(str);
  11531. strarray2.Add (GetW(str));
  11532. strarray2.Add (GetK(str));
  11533. strarray2.Add (GetB(str));
  11534. strarray2.Add (GetS(str));
  11535. strarray2.Add (GetG(str));
  11536. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11537. }
  11538. }
  11539. while(strarray2.GetSize ()<36)
  11540. strarray2.Add ("");
  11541. str.Format ("%f", ftotal);
  11542. strarray2.Add (GetW(str));
  11543. strarray2.Add (GetK(str));
  11544. strarray2.Add (GetB(str));
  11545. strarray2.Add (GetS(str));
  11546. strarray2.Add (GetG(str));
  11547. strarray2.Add ("");
  11548. //拍照
  11549. ftotal=0;
  11550. realcount=0;
  11551. if(seldlg.m_bTake)
  11552. {
  11553. for(i=0; i<bukuanarray.GetSize (); i++)
  11554. {
  11555. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=1)continue;
  11556. realcount++;
  11557. if(realcount>6)break;
  11558. str=bukuanarray.ElementAt (i).ElementAt (1);
  11559. ftotal+=atof(str);
  11560. strarray2.Add (GetW(str));
  11561. strarray2.Add (GetK(str));
  11562. strarray2.Add (GetB(str));
  11563. strarray2.Add (GetS(str));
  11564. strarray2.Add (GetG(str));
  11565. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11566. }
  11567. }
  11568. while(strarray2.GetSize ()<42+36)
  11569. strarray2.Add ("");
  11570. str.Format ("%f", ftotal);
  11571. strarray2.Add (GetW(str));
  11572. strarray2.Add (GetK(str));
  11573. strarray2.Add (GetB(str));
  11574. strarray2.Add (GetS(str));
  11575. strarray2.Add (GetG(str));
  11576. strarray2.Add ("");
  11577. //选片
  11578. ftotal=0;
  11579. realcount=0;
  11580. if(seldlg.m_bChoose)
  11581. {
  11582. for(i=0; i<bukuanarray.GetSize (); i++)
  11583. {
  11584. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=2)continue;
  11585. realcount++;
  11586. if(realcount>6)break;
  11587. str=bukuanarray.ElementAt (i).ElementAt (1);
  11588. ftotal+=atof(str);
  11589. strarray2.Add (GetW(str));
  11590. strarray2.Add (GetK(str));
  11591. strarray2.Add (GetB(str));
  11592. strarray2.Add (GetS(str));
  11593. strarray2.Add (GetG(str));
  11594. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11595. }
  11596. }
  11597. while(strarray2.GetSize ()<42*2+36)
  11598. strarray2.Add ("");
  11599. str.Format ("%f", ftotal);
  11600. strarray2.Add (GetW(str));
  11601. strarray2.Add (GetK(str));
  11602. strarray2.Add (GetB(str));
  11603. strarray2.Add (GetS(str));
  11604. strarray2.Add (GetG(str));
  11605. strarray2.Add ("");
  11606. /////////////////////////////
  11607. CRect temprc;
  11608. for(int n=0; n<4; n++)
  11609. {
  11610. StrRect=load.m_rcarray .ElementAt (17);
  11611. StrRect.top +=n*122;
  11612. StrRect.bottom +=n*122;
  11613. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11614. StrRect=load.m_rcarray .ElementAt (18);
  11615. if(n)
  11616. {
  11617. StrRect.left +=36;
  11618. StrRect.right +=36;
  11619. }
  11620. StrRect.top +=n*122;
  11621. StrRect.bottom +=n*122;
  11622. if(seldlg.m_bFrame)
  11623. str.Format("%d年", tm.GetYear ());
  11624. else
  11625. str.Format("%d ", tm.GetYear ());
  11626. 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))
  11627. {
  11628. if(seldlg.m_bFrame)
  11629. str=" 年";
  11630. else
  11631. str=" ";
  11632. }
  11633. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11634. StrRect=load.m_rcarray .ElementAt (19);
  11635. if(n)
  11636. {
  11637. StrRect.left +=38;
  11638. StrRect.right +=38;
  11639. }
  11640. StrRect.top +=n*122;
  11641. StrRect.bottom +=n*122;
  11642. if(seldlg.m_bFrame)
  11643. str.Format("%02d月", tm.GetMonth ());
  11644. else
  11645. str.Format("%02d ", tm.GetMonth ());
  11646. 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))
  11647. {
  11648. if(seldlg.m_bFrame)
  11649. str=" 月";
  11650. else
  11651. str=" ";
  11652. }
  11653. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11654. StrRect=load.m_rcarray .ElementAt (20);
  11655. if(n)
  11656. {
  11657. StrRect.left +=36;
  11658. StrRect.right +=36;
  11659. }
  11660. StrRect.top +=n*122;
  11661. StrRect.bottom +=n*122;
  11662. if(seldlg.m_bFrame)
  11663. str.Format("%02d日", tm.GetDay ());
  11664. else
  11665. str.Format("%02d ", tm.GetDay ());
  11666. 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))
  11667. {
  11668. if(seldlg.m_bFrame)
  11669. str=" 日";
  11670. else
  11671. str=" ";
  11672. }
  11673. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11674. for(i=26; i<=32; i++)
  11675. {
  11676. StrRect=load.m_rcarray .ElementAt (i-1);
  11677. StrRect.bottom -=14;
  11678. for(int j=0; j<8; j++)
  11679. {
  11680. StrRect.top=StrRect.bottom;
  11681. if(j>2)
  11682. {
  11683. StrRect.bottom =StrRect.top+14;
  11684. }
  11685. else
  11686. {
  11687. StrRect.bottom =StrRect.top+13;
  11688. }
  11689. temprc=StrRect;
  11690. StrRect.top +=n*122;
  11691. StrRect.bottom +=n*122;
  11692. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11693. if(i==26 && j==4 && seldlg.m_bFrame)
  11694. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11695. else if(i==26 && j==5 && seldlg.m_bFrame)
  11696. m_Print.DrawText((LPTSTR)(LPCTSTR)"付款", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11697. else if(i==26 && j==7 && seldlg.m_bFrame)
  11698. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11699. else if(j==0)
  11700. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-26), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11701. else if(j && i>26 && n<3)
  11702. {
  11703. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray2.ElementAt ((j-1)*6+(i-27)+n*42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11704. }
  11705. StrRect=temprc;
  11706. }
  11707. }
  11708. }
  11709. if(seldlg.m_bFrame)
  11710. {
  11711. StrRect=load.m_rcarray .ElementAt (32);
  11712. str="注\r\n意\r\n事\r\n项";
  11713. StrRect.top +=367;
  11714. StrRect.bottom +=367;
  11715. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11716. StrRect.top +=17;
  11717. StrRect.left +=2;
  11718. AutoDraw(m_Print, StrRect, str, 1.4);
  11719. StrRect=load.m_rcarray .ElementAt (33);
  11720. str="1: 本预约单自预定日期起一年内有效.定金在拍照套系金额中扣出.预定金一概不退\r\n\
  11721. 2: 多拍照片只供筛选.恕不奉送.版权所有.不得私自拷贝\r\n\
  11722. 3: 拍照款请于拍照时一次付清\r\n\
  11723. 4: 新娘装AM8:00前钟点费另计.婚纱礼服出租押金500-2000元\r\n\
  11724. 5: 本公司设有豪华VIP礼服区.及皇家御用礼服展区.但需另外加价.详情请咨本店人员\r\n\
  11725. 6: 安瓶, 美甲一次性化妆用具等均属增值服务部分,则需另外加价,详情咨询本店工作人员\r\n\
  11726. 7: 本电脑机械故障导致文件资料丢失.本公司只提供补拍服务\r\n\
  11727. 8: 每次前来请务必携带本单交给工作人员.本单是您在摩登新娘拍照的凭证.办理有关手续凭本单办理盖\r\n\
  11728. 章后方可生效";
  11729. StrRect.top +=367;
  11730. StrRect.bottom +=367;
  11731. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11732. StrRect.top +=4;
  11733. StrRect.left +=2;
  11734. AutoDraw(m_Print, StrRect, str, 1.0);
  11735. StrRect=load.m_rcarray .ElementAt (34);
  11736. 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)";
  11737. AutoDraw(m_Print, StrRect, str, 1.0);
  11738. m_Print.SetFontFace(13, 1, "宋体");
  11739. StrRect=load.m_rcarray .ElementAt (35);
  11740. str="地 址: 汉口 . 解放大道 . 头道街东部购物公园C栋二,三层";
  11741. StrRect.top +=367;
  11742. StrRect.bottom +=367;
  11743. StrRect.left +=2;
  11744. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11745. StrRect=load.m_rcarray .ElementAt (36);
  11746. str="喜讯热线: 027-81888799 81888599 81888699";
  11747. StrRect.top +=367;
  11748. StrRect.bottom +=367;
  11749. StrRect.left +=2;
  11750. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11751. }
  11752. PrintPreview dlg;
  11753. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  11754. dlg.m_pDC =m_Print.GetPDC() ;
  11755. if(dlg.DoModal ()!=IDOK)return;
  11756. //结束打印
  11757. m_Print.EndPage();
  11758. m_Print.EndPrint();
  11759. #endif
  11760. }
  11761. extern CString GetHMoney(CString str);
  11762. void CMainFrame::PrintReceipt3(CString strOrderNumber, CStringArray *pArray, float money)
  11763. {
  11764. int printcot = 1;
  11765. for (int aa = 0; aa < printcot; aa++)
  11766. {
  11767. g_sendhead.bsql = 0;
  11768. g_sendhead.code[0] = 24;
  11769. g_sendhead.tabcount = 1;
  11770. int g_nYearposTemp = g_nYearpos;
  11771. g_nYearpos = -1;
  11772. g_pMainWnd->ProcessChatMessageRequest2(1);
  11773. g_nYearpos = g_nYearposTemp;
  11774. if (0 == g_bSendOK)return;
  11775. DataToArray(&g_cominfoarray);
  11776. CString SerialNo;
  11777. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  11778. CPrintRX m_Print;
  11779. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  11780. {
  11781. m_Print.InitToPrint(NULL, 1);
  11782. }
  11783. else
  11784. {
  11785. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  11786. if (name.IsEmpty())
  11787. m_Print.InitToPrint(NULL, 1);
  11788. else
  11789. {
  11790. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  11791. if (nret == -1 && aa == 0)
  11792. {
  11793. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  11794. }
  11795. }
  11796. }
  11797. m_Print.StartPrint();
  11798. m_Print.StartPage();
  11799. LoadRect load;
  11800. load.SetLiaPath("15.lia");
  11801. load.SetMargins(0, 0);
  11802. if (!load.Load())return;
  11803. int i;
  11804. //////////////////////////////////////////////////////////////
  11805. CStringArray txarray;
  11806. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  11807. g_sendhead.code[0] = 11;
  11808. g_sendhead.code[1] = 52;
  11809. g_sendhead.tabcount = 2;
  11810. g_sendhead.bsql = 0;
  11811. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  11812. CArray<CStringArray, CStringArray>sparray;
  11813. CArray<CStringArray, CStringArray>clientarray;
  11814. DataToArray(&g_List1array, &clientarray);
  11815. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  11816. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  11817. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  11818. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  11819. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  11820. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  11821. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  11822. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  11823. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  11824. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  11825. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  11826. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  11827. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  11828. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  11829. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  11830. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  11831. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  11832. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  11833. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  11834. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  11835. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  11836. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  11837. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  11838. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  11839. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  11840. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  11841. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  11842. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  11843. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  11844. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  11845. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  11846. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  11847. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  11848. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  11849. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  11850. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  11851. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  11852. CString m_addr = m_addr1 + ";";
  11853. m_addr.TrimLeft(";");
  11854. m_addr += m_addr2;
  11855. CString m_qq = m_qq1 + ";";
  11856. m_qq.TrimLeft(";");
  11857. m_qq += m_qq2;
  11858. m_money1.Format("%f", atof(m_taoxijiage));
  11859. m_money2.Format("%f", atof(m_payed1));
  11860. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  11861. ConvertToPrice(m_money1);
  11862. ConvertToPrice(m_money2);
  11863. ConvertToPrice(m_money3);
  11864. ////////////////////////////////////////////////////////////////
  11865. int rcpos = -1;
  11866. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  11867. m_Print.SetFontFace(17, 1, "宋体");
  11868. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11869. StrRect.top -= 0;
  11870. StrRect.bottom -= 10;
  11871. StrRect.left -= 140;
  11872. StrRect.right = StrRect.left + 48;
  11873. m_Print.SetFontFace(15, 1, "宋体");
  11874. m_Print.SetColor(0xffffff);
  11875. m_Print.DrawRect(StrRect, 0);
  11876. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11877. StrRect.left = StrRect.right;
  11878. StrRect.right = StrRect.left + 48;
  11879. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  11880. m_Print.SetColor(0, RGB(255, 0, 0));
  11881. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11882. m_Print.SetColor(0);
  11883. m_Print.SetFontFace(12, 1, "宋体");
  11884. StrRect.left -= 48;
  11885. int hei = StrRect.Height();
  11886. StrRect.top = StrRect.bottom + 2;
  11887. StrRect.bottom += hei + 2;
  11888. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11889. StrRect.top = StrRect.bottom - 2;
  11890. StrRect.bottom += hei - 5;
  11891. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  11892. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11893. m_Print.SetFontFace(12, 1, "宋体");
  11894. m_Print.DrawText((LPTSTR)(LPCTSTR)"收款单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11895. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11896. m_Print.SetFontFace(9, 1, "宋体");
  11897. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11898. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11899. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11900. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11901. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11902. m_Print.DrawRect2(StrRect, 2);
  11903. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11904. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11905. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11906. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11907. m_Print.DrawRect2(StrRect, 2);
  11908. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11909. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11910. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11911. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11912. m_Print.DrawRect2(StrRect, 2);
  11913. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11914. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约地点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11915. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11916. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11917. m_Print.DrawRect2(StrRect, 2);
  11918. ////////////
  11919. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11920. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11921. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11922. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11923. m_Print.DrawRect2(StrRect, 2);
  11924. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11925. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11926. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11927. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11928. m_Print.DrawRect2(StrRect, 2);
  11929. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11930. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11931. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11932. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11933. m_Print.DrawRect2(StrRect, 2);
  11934. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11935. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11936. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11937. m_Print.DrawText((LPTSTR)(LPCTSTR)g_date, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11938. m_Print.DrawRect2(StrRect, 2);
  11939. for (i = 19; i < 49; i++)
  11940. {
  11941. if (i >= 44)
  11942. {
  11943. StrRect = load.m_rcarray.ElementAt(i - 5);
  11944. int hei = StrRect.Height();
  11945. StrRect.top += hei;
  11946. StrRect.bottom += hei;
  11947. }
  11948. else
  11949. StrRect = load.m_rcarray.ElementAt(i);
  11950. m_Print.DrawRect2(StrRect, 1);
  11951. }
  11952. float fmoney = 0;
  11953. for (i = 19; i < 49; i++)
  11954. {
  11955. if (i >= 44)
  11956. {
  11957. StrRect = load.m_rcarray.ElementAt(i - 5);
  11958. int hei = StrRect.Height();
  11959. StrRect.top += hei;
  11960. StrRect.bottom += hei;
  11961. }
  11962. else
  11963. StrRect = load.m_rcarray.ElementAt(i);
  11964. StrRect.left += 2;
  11965. /* if((i-19)%5==2)
  11966. {
  11967. fmoney+=atof(pArray->ElementAt (i-19));
  11968. }*/
  11969. m_Print.DrawText((LPTSTR)(LPCTSTR)(pArray->ElementAt(i - 19)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11970. }
  11971. m_money2.Format("%f", money);
  11972. ConvertToPrice(m_money2);
  11973. StrRect = load.m_rcarray.ElementAt(44);
  11974. CString str;
  11975. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 实收¥: %s 元 收银员: %s", \
  11976. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  11977. m_money2, g_user.name);
  11978. m_Print.DrawRect2(StrRect, 1);
  11979. StrRect.left += 3;
  11980. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11981. StrRect = load.m_rcarray.ElementAt(46);
  11982. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11983. StrRect = load.m_rcarray.ElementAt(47);
  11984. m_Print.DrawRect2(StrRect, 2);
  11985. StrRect = load.m_rcarray.ElementAt(48);
  11986. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11987. StrRect = load.m_rcarray.ElementAt(45);
  11988. str = "\
  11989. 顾客须知\r\n\
  11990. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  11991. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  11992. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  11993. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  11994. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  11995. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  11996. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  11997. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  11998. AutoDraw(m_Print, StrRect, str, 1.8);
  11999. PrintPreview dlg;
  12000. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12001. dlg.m_pDC = m_Print.GetPDC();
  12002. if (aa == 0)
  12003. {
  12004. if (dlg.DoModal() != IDOK)
  12005. return;
  12006. printcot = dlg.m_num;
  12007. }
  12008. //结束打印
  12009. m_Print.EndPage();
  12010. m_Print.EndPrint();
  12011. }
  12012. }
  12013. void CMainFrame::PrintReceipt2(CString strOrderNumber)
  12014. {
  12015. int printcot = 1;
  12016. for (int aa = 0; aa < printcot; aa++)
  12017. {
  12018. g_sendhead.bsql = 0;
  12019. g_sendhead.code[0] = 24;
  12020. g_sendhead.tabcount = 1;
  12021. int g_nYearposTemp = g_nYearpos;
  12022. g_nYearpos = -1;
  12023. g_pMainWnd->ProcessChatMessageRequest2(1);
  12024. g_nYearpos = g_nYearposTemp;
  12025. if (0 == g_bSendOK)return;
  12026. DataToArray(&g_cominfoarray);
  12027. CString SerialNo;
  12028. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  12029. CPrintRX m_Print;
  12030. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12031. {
  12032. m_Print.InitToPrint(NULL, 1);
  12033. }
  12034. else
  12035. {
  12036. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  12037. if (name.IsEmpty())
  12038. m_Print.InitToPrint(NULL, 1);
  12039. else
  12040. {
  12041. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12042. if (nret == -1 && aa == 0)
  12043. {
  12044. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12045. }
  12046. }
  12047. }
  12048. m_Print.StartPrint();
  12049. m_Print.StartPage();
  12050. LoadRect load;
  12051. load.SetLiaPath("14.lia");
  12052. load.SetMargins(0, 0);
  12053. if (!load.Load())return;
  12054. int i;
  12055. //////////////////////////////////////////////////////////////
  12056. CStringArray txarray;
  12057. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  12058. g_sendhead.code[0] = 11;
  12059. g_sendhead.code[1] = 52;
  12060. g_sendhead.code[2] = 93;
  12061. g_sendhead.tabcount = 3;
  12062. g_sendhead.bsql = 0;
  12063. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12064. CArray<CStringArray, CStringArray>sparray;
  12065. CArray<CStringArray, CStringArray>clientarray;
  12066. CArray<CStringArray, CStringArray>moneyarray;
  12067. DataToArray(&g_List1array, &clientarray, &moneyarray);
  12068. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12069. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12070. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12071. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12072. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12073. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  12074. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12075. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12076. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12077. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12078. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12079. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12080. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12081. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12082. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12083. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12084. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12085. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12086. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12087. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12088. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12089. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12090. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12091. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12092. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12093. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12094. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12095. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12096. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  12097. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12098. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12099. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  12100. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  12101. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  12102. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  12103. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  12104. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  12105. CString m_addr = m_addr1 + ";";
  12106. m_addr.TrimLeft(";");
  12107. m_addr += m_addr2;
  12108. CString m_qq = m_qq1 + ";";
  12109. m_qq.TrimLeft(";");
  12110. m_qq += m_qq2;
  12111. m_money1.Format("%f", atof(m_taoxijiage));
  12112. m_money2 = "0";
  12113. for (i = 0; i < moneyarray.GetSize(); i++)
  12114. {
  12115. if (moneyarray.ElementAt(i).ElementAt(5) == "预约收款")
  12116. m_money2 = moneyarray.ElementAt(i).ElementAt(1);
  12117. }
  12118. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  12119. ConvertToPrice(m_money1);
  12120. ConvertToPrice(m_money2);
  12121. ConvertToPrice(m_money3);
  12122. ////////////////////////////////////////////////////////////////
  12123. int rcpos = -1;
  12124. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12125. m_Print.SetFontFace(17, 1, "宋体");
  12126. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12127. StrRect.top -= 0;
  12128. StrRect.bottom -= 10;
  12129. StrRect.left -= 140;
  12130. StrRect.right = StrRect.left + 48;
  12131. m_Print.SetFontFace(15, 1, "宋体");
  12132. m_Print.SetColor(0xffffff);
  12133. m_Print.DrawRect(StrRect, 0);
  12134. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12135. StrRect.left = StrRect.right;
  12136. StrRect.right = StrRect.left + 48;
  12137. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12138. m_Print.SetColor(0, RGB(255, 0, 0));
  12139. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12140. m_Print.SetColor(0);
  12141. m_Print.SetFontFace(12, 1, "宋体");
  12142. StrRect.left -= 48;
  12143. int hei = StrRect.Height();
  12144. StrRect.top = StrRect.bottom + 2;
  12145. StrRect.bottom += hei + 2;
  12146. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12147. StrRect.top = StrRect.bottom - 2;
  12148. StrRect.bottom += hei - 5;
  12149. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12150. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12151. m_Print.SetFontFace(12, 1, "宋体");
  12152. m_Print.DrawText((LPTSTR)(LPCTSTR)"定金单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12153. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12154. m_Print.SetFontFace(9, 1, "宋体");
  12155. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12156. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12157. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12158. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12159. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12160. m_Print.DrawRect2(StrRect, 2);
  12161. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12162. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12163. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12164. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12165. m_Print.DrawRect2(StrRect, 2);
  12166. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12167. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12168. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12169. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12170. m_Print.DrawRect2(StrRect, 2);
  12171. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12172. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约地点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12173. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12174. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12175. m_Print.DrawRect2(StrRect, 2);
  12176. ////////////
  12177. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12178. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12179. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12180. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12181. m_Print.DrawRect2(StrRect, 2);
  12182. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12183. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12184. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12185. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12186. m_Print.DrawRect2(StrRect, 2);
  12187. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12188. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12189. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12190. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12191. m_Print.DrawRect2(StrRect, 2);
  12192. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12193. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12194. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12195. m_Print.DrawText((LPTSTR)(LPCTSTR)g_date, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12196. m_Print.DrawRect2(StrRect, 2);
  12197. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12198. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客地址:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12199. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12200. m_Print.DrawText((LPTSTR)(LPCTSTR)m_addr, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12201. m_Print.DrawRect2(StrRect, 2);
  12202. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12203. m_Print.DrawText((LPTSTR)(LPCTSTR)"大婚时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12204. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12205. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12206. m_Print.DrawRect2(StrRect, 2);
  12207. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12208. m_Print.DrawText((LPTSTR)(LPCTSTR)"QQ/MSN:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12209. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12210. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12211. m_Print.DrawRect2(StrRect, 2);
  12212. CStringArray strarray;
  12213. strarray.Add("套系名称");
  12214. strarray.Add("总 额");
  12215. strarray.Add("定 金");
  12216. strarray.Add("余 款");
  12217. strarray.Add("摄影日期");
  12218. strarray.Add(m_taoxiname);
  12219. strarray.Add(m_money1);
  12220. strarray.Add(m_money2);
  12221. strarray.Add(m_money3);
  12222. strarray.Add(m_time2);
  12223. for (i = 25; i < 37; i++)
  12224. {
  12225. StrRect = load.m_rcarray.ElementAt(i);
  12226. m_Print.DrawRect2(StrRect, 1);
  12227. }
  12228. for (i = 25; i < 35; i++)
  12229. {
  12230. StrRect = load.m_rcarray.ElementAt(i);
  12231. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 25), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12232. }
  12233. StrRect = load.m_rcarray.ElementAt(35);
  12234. StrRect.left += 5;
  12235. StrRect.top += 5;
  12236. m_Print.DrawText((LPTSTR)(LPCTSTR)" 备 注:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  12237. StrRect = load.m_rcarray.ElementAt(36);
  12238. CString str;
  12239. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 ¥: %s 元 收银员: %s", \
  12240. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  12241. m_money2, g_user.name);
  12242. StrRect.left += 3;
  12243. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12244. StrRect = load.m_rcarray.ElementAt(38);
  12245. m_Print.DrawText((LPTSTR)(LPCTSTR)"营业员:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12246. StrRect = load.m_rcarray.ElementAt(39);
  12247. m_Print.DrawText((LPTSTR)(LPCTSTR)m_ren, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12248. m_Print.DrawRect2(StrRect, 2);
  12249. StrRect = load.m_rcarray.ElementAt(40);
  12250. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12251. StrRect = load.m_rcarray.ElementAt(41);
  12252. m_Print.DrawRect2(StrRect, 2);
  12253. StrRect = load.m_rcarray.ElementAt(42);
  12254. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12255. StrRect = load.m_rcarray.ElementAt(37);
  12256. str = "\
  12257. 顾客须知\r\n\
  12258. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  12259. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  12260. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  12261. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  12262. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  12263. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  12264. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  12265. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12266. AutoDraw(m_Print, StrRect, str, 1.8);
  12267. PrintPreview dlg;
  12268. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12269. dlg.m_pDC = m_Print.GetPDC();
  12270. if (aa == 0)
  12271. {
  12272. if (dlg.DoModal() != IDOK)
  12273. return;
  12274. printcot = dlg.m_num;
  12275. }
  12276. //结束打印
  12277. m_Print.EndPage();
  12278. m_Print.EndPrint();
  12279. }
  12280. }
  12281. void CMainFrame::OnAutodelphoto()
  12282. {
  12283. // TODO: Add your command handler code here
  12284. if (g_user.bLongin == 0)
  12285. {
  12286. if (g_bNoLoginLia)
  12287. {
  12288. Login dlg;
  12289. dlg.SetLiaPath("5.lia");
  12290. dlg.DoModal();
  12291. }
  12292. else
  12293. {
  12294. Login3 dlg;
  12295. dlg.SetLiaPath("5.lia");
  12296. dlg.DoModal();
  12297. }
  12298. if (g_user.bLongin == 0)return;
  12299. }
  12300. if (IsHasRightsnew(49) == 0)return;
  12301. DelPhotoSet dlg;
  12302. dlg.DoModal();
  12303. }
  12304. void CMainFrame::Onphotomanage() // 客照管理中心;
  12305. {
  12306. if (g_user.bLongin == 0)
  12307. {
  12308. if (g_bNoLoginLia)
  12309. {
  12310. Login dlg;
  12311. dlg.SetLiaPath("5.lia");
  12312. dlg.DoModal();
  12313. }
  12314. else
  12315. {
  12316. Login3 dlg;
  12317. dlg.SetLiaPath("5.lia");
  12318. dlg.DoModal();
  12319. }
  12320. if (g_user.bLongin == 0)return;
  12321. }
  12322. if (IsHasRightsnew(49) == 0)return;
  12323. ShowPic3 dlg;
  12324. dlg.DoModal();
  12325. }
  12326. void CMainFrame::OnCompanyinfo()
  12327. {
  12328. // TODO: Add your command handler code here
  12329. if (g_user.bLongin == 0)
  12330. {
  12331. if (g_bNoLoginLia)
  12332. {
  12333. Login dlg;
  12334. dlg.SetLiaPath("5.lia");
  12335. dlg.DoModal();
  12336. }
  12337. else
  12338. {
  12339. Login3 dlg;
  12340. dlg.SetLiaPath("5.lia");
  12341. dlg.DoModal();
  12342. }
  12343. if (g_user.bLongin == 0)return;
  12344. }
  12345. if (IsHasRightsnew(49) == 0)return;
  12346. CompanyInfo dlg;
  12347. dlg.DoModal();
  12348. }
  12349. void CMainFrame::OnTaoxifg()
  12350. {
  12351. // TODO: Add your command handler code here
  12352. if (g_user.bLongin == 0)
  12353. {
  12354. if (g_bNoLoginLia)
  12355. {
  12356. Login dlg;
  12357. dlg.SetLiaPath("5.lia");
  12358. dlg.DoModal();
  12359. }
  12360. else
  12361. {
  12362. Login3 dlg;
  12363. dlg.SetLiaPath("5.lia");
  12364. dlg.DoModal();
  12365. }
  12366. if (g_user.bLongin == 0)return;
  12367. }
  12368. if (IsHasRightsnew(49) == 0)return;
  12369. TXFG dlg;
  12370. dlg.DoModal();
  12371. }
  12372. void CMainFrame::OnHelpfile()
  12373. {
  12374. // TODO: Add your command handler code here
  12375. // ShellExecute(NULL, _T("open"), _T(g_mainpath+"\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  12376. // if(::PathFileExists (g_mainpath+"\\zx.dll"))
  12377. // ShellExecute(NULL, _T("open"), _T("www.zcsmkj.com"), "", NULL, SW_SHOWNORMAL);
  12378. // else
  12379. ShellExecute(NULL, _T("open"), _T("www.lyfz.net"), "", NULL, SW_SHOWNORMAL);
  12380. }
  12381. void CMainFrame::OnPhotobak()
  12382. {
  12383. // TODO: Add your command handler code here
  12384. if (g_user.bLongin == 0)
  12385. {
  12386. if (g_bNoLoginLia)
  12387. {
  12388. Login dlg;
  12389. dlg.SetLiaPath("5.lia");
  12390. dlg.DoModal();
  12391. }
  12392. else
  12393. {
  12394. Login3 dlg;
  12395. dlg.SetLiaPath("5.lia");
  12396. dlg.DoModal();
  12397. }
  12398. if (g_user.bLongin == 0)return;
  12399. }
  12400. if (IsHasRightsnew(49) == 0)return;
  12401. PhotoBak dlg;
  12402. dlg.DoModal();
  12403. }
  12404. //客户报表
  12405. void CMainFrame::OnClose2()
  12406. { // TODO: Add your message handler code here and/or call default
  12407. if (AfxMessageBox("是否退出系统?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  12408. if(g_user.bLongin)
  12409. WriteLog("退出系统!", "退出系统!");
  12410. g_bShowBar = 0;
  12411. if (m_Mdi.MainClose())
  12412. CMDIFrameWnd::OnClose();
  12413. }
  12414. //
  12415. void CMainFrame::ResetTimer()
  12416. {
  12417. }
  12418. void CMainFrame::LinkClick(CString str, int nParent)
  12419. {
  12420. g_pMainWnd2->m_bar.LinkClick(str);
  12421. }
  12422. void CMainFrame::PrintFlowChart2(CString m_id)
  12423. {
  12424. CPrintRX m_Print;
  12425. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12426. {
  12427. m_Print.InitToPrint(NULL, 1);
  12428. }
  12429. else
  12430. {
  12431. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  12432. if (name.IsEmpty())
  12433. m_Print.InitToPrint(NULL, 1);
  12434. else
  12435. {
  12436. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12437. if (nret == -1)
  12438. {
  12439. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12440. }
  12441. }
  12442. }
  12443. m_Print.StartPrint();
  12444. m_Print.StartPage();
  12445. LoadRect load;
  12446. load.SetLiaPath("16.lia");
  12447. load.SetMargins(0, 0);
  12448. if (!load.Load())return;
  12449. LoadRect load2;
  12450. load2.SetLiaPath("17.lia");
  12451. load2.SetMargins(0, 660);
  12452. if (!load2.Load())return;
  12453. int i;
  12454. //////////////////////////////////////////////////////////////
  12455. CStringArray txarray;
  12456. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and kind<>'2'";
  12457. g_sendhead.code[0] = 11;
  12458. g_sendhead.code[1] = 52;
  12459. g_sendhead.code[2] = 223;
  12460. g_sendhead.tabcount = 3;
  12461. g_sendhead.bsql = 0;
  12462. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12463. CArray<CStringArray, CStringArray>sparray;
  12464. CArray<CStringArray, CStringArray>clientarray;
  12465. DataToArray(&g_List1array, &clientarray, &sparray);
  12466. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12467. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12468. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12469. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12470. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12471. CString m_photocount = g_List1array.ElementAt(0).ElementAt(9);
  12472. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12473. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12474. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12475. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12476. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12477. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12478. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12479. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12480. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12481. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12482. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12483. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12484. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12485. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12486. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12487. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12488. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12489. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12490. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12491. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12492. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12493. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12494. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(39) + g_List1array.ElementAt(0).ElementAt(75);
  12495. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12496. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12497. CString spno;
  12498. for (i = 0; i < sparray.GetSize(); i++)
  12499. {
  12500. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  12501. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  12502. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  12503. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12504. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12505. spno += sparray.ElementAt(i).ElementAt(5);
  12506. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12507. spno += "; ";
  12508. else
  12509. {
  12510. spno += ":";
  12511. spno += sparray.ElementAt(i).ElementAt(6);
  12512. spno += "; ";
  12513. }
  12514. }
  12515. spno += " 加挑:";
  12516. for (i = 0; i < sparray.GetSize(); i++)
  12517. {
  12518. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  12519. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  12520. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  12521. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12522. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12523. spno += sparray.ElementAt(i).ElementAt(5);
  12524. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12525. spno += "; ";
  12526. else
  12527. {
  12528. spno += ":";
  12529. spno += sparray.ElementAt(i).ElementAt(6);
  12530. spno += "; ";
  12531. }
  12532. }
  12533. if (spno.Right(6) == " 加挑:")
  12534. {
  12535. spno = spno.Left(spno.GetLength() - 6);
  12536. }
  12537. ////////////////////////////////////////////////////////////////
  12538. int rcpos = -1;
  12539. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12540. m_Print.SetFontFace(17, 1, "宋体");
  12541. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12542. StrRect.top -= 0;
  12543. StrRect.bottom -= 10;
  12544. StrRect.left -= 140;
  12545. StrRect.right = StrRect.left + 48;
  12546. m_Print.SetFontFace(15, 1, "宋体");
  12547. m_Print.SetColor(0xffffff);
  12548. m_Print.DrawRect(StrRect, 0);
  12549. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12550. StrRect.left = StrRect.right;
  12551. StrRect.right = StrRect.left + 48;
  12552. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12553. m_Print.SetColor(0, RGB(255, 0, 0));
  12554. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12555. m_Print.SetColor(0);
  12556. m_Print.SetFontFace(12, 1, "宋体");
  12557. StrRect.left -= 48;
  12558. int hei = StrRect.Height();
  12559. StrRect.top = StrRect.bottom + 2;
  12560. StrRect.bottom += hei + 2;
  12561. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12562. StrRect.top = StrRect.bottom - 2;
  12563. StrRect.bottom += hei - 5;
  12564. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12565. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12566. m_Print.SetFontFace(12, 1, "宋体");
  12567. m_Print.DrawText((LPTSTR)(LPCTSTR)"加做取件单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12568. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12569. m_Print.SetFontFace(11, 1, "宋体");
  12570. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + m_id), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12571. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12572. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12573. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12574. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12575. m_Print.DrawRect2(StrRect, 2);
  12576. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12577. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12578. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12579. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12580. m_Print.DrawRect2(StrRect, 2);
  12581. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12582. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12583. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12584. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time4, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12585. m_Print.DrawRect2(StrRect, 2);
  12586. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12587. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12588. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12589. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time5, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12590. m_Print.DrawRect2(StrRect, 2);
  12591. ////////////
  12592. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12593. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12594. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12595. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12596. m_Print.DrawRect2(StrRect, 2);
  12597. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12598. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12599. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12600. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12601. m_Print.DrawRect2(StrRect, 2);
  12602. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12603. m_Print.DrawText((LPTSTR)(LPCTSTR)"赠送张数:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12604. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12605. m_Print.DrawText((LPTSTR)(LPCTSTR)m_photocount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12606. m_Print.DrawRect2(StrRect, 2);
  12607. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12608. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12609. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12610. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12611. m_Print.DrawRect2(StrRect, 2);
  12612. ////////////
  12613. ///////////spno
  12614. CRect sprc[22];
  12615. StrRect = load.m_rcarray.ElementAt(19);
  12616. StrRect.left += 4; StrRect.right -= 3;
  12617. hei = StrRect.Height();
  12618. for (i = 0; i < 22; i++)
  12619. {
  12620. sprc[i] = StrRect;
  12621. m_Print.DrawRect2(StrRect, 1);
  12622. if (i == 0)
  12623. {
  12624. StrRect.left += 5;
  12625. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12626. StrRect.left -= 5;
  12627. }
  12628. StrRect.top = StrRect.bottom;
  12629. StrRect.bottom = StrRect.top + hei;
  12630. sprc[i].left += 4; sprc[i].right -= 3;
  12631. }
  12632. StrRect.bottom = StrRect.top + 60;
  12633. m_Print.DrawRect2(StrRect, 1);
  12634. StrRect.left += 3; StrRect.top += 3;
  12635. StrRect.right -= 3; StrRect.bottom -= 3;
  12636. AutoDraw(m_Print, StrRect, m_bz, 1.8);
  12637. CString temp, tempspno, tempbz;
  12638. CSize size;
  12639. BOOL bRun = 0;
  12640. int fontsize = 12;
  12641. ll: tempspno = spno;
  12642. m_Print.SetFontFace(fontsize, 1, "宋体");
  12643. for (i = 1; i<22; i++)
  12644. {
  12645. if (!tempspno.IsEmpty())
  12646. {
  12647. temp = tempspno;
  12648. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12649. int right = 0;
  12650. CRect temprc = sprc[i];
  12651. while (size.cx>temprc.Width())
  12652. {
  12653. right++;
  12654. temp = tempspno.Left(tempspno.GetLength() - (right));
  12655. if (GIsHalfHZ(temp))
  12656. {
  12657. right++;
  12658. temp.Delete(temp.GetLength() - 1);
  12659. }
  12660. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12661. }
  12662. if (bRun)
  12663. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12664. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  12665. if (tempspno.IsEmpty())i++;
  12666. }
  12667. }
  12668. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  12669. {
  12670. fontsize--;
  12671. goto ll;
  12672. }
  12673. if (bRun == 0)
  12674. {
  12675. bRun = 1;
  12676. goto ll;
  12677. }
  12678. m_Print.SetFontFace(12, 1, "宋体");
  12679. StrRect = load2.m_rcarray.ElementAt(1);
  12680. m_Print.DrawText((LPTSTR)(LPCTSTR)"喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12681. StrRect = load2.m_rcarray.ElementAt(2);
  12682. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12683. StrRect = load2.m_rcarray.ElementAt(3);
  12684. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12685. StrRect = load2.m_rcarray.ElementAt(4);
  12686. m_Print.DrawRect2(StrRect, 2);
  12687. StrRect = load2.m_rcarray.ElementAt(0);
  12688. CString str = "\
  12689. 爱心提示:如对制作有任何要求请清楚列出,所有制作内容一经确认将按要求制作。\r\n\
  12690. 选样文件从拍摄日期计算将保留二个月;套相成品按取件日期保留三个月,逾期不做保留。\r\n\
  12691. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12692. AutoDraw(m_Print, StrRect, str, 1.8);
  12693. PrintPreview dlg; dlg.m_mode = 2;
  12694. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12695. dlg.m_pDC = m_Print.GetPDC();
  12696. if (dlg.DoModal() != IDOK)return;
  12697. //结束打印
  12698. m_Print.EndPage();
  12699. m_Print.EndPrint();
  12700. }
  12701. //分店
  12702. CString CMainFrame::GetDanWei(CString name, CArray<CStringArray, CStringArray>*array)
  12703. {
  12704. for (int i = 0; i < array->GetSize(); i++)
  12705. {
  12706. if (name == array->ElementAt(i).ElementAt(1))
  12707. return array->ElementAt(i).ElementAt(2);
  12708. }
  12709. return "";
  12710. }
  12711. //g_sendhead
  12712. int CMainFrame::GetPort()
  12713. {
  12714. static int aaa = -1;
  12715. if (aaa == -1)
  12716. {
  12717. aaa = CTime::GetCurrentTime().GetSecond() % 7;
  12718. }
  12719. aaa++;
  12720. if (aaa >= 7)aaa = 0;
  12721. return 8387 + aaa;
  12722. }
  12723. void CMainFrame::OnShowBakState()
  12724. {
  12725. // TODO: Add your command handler code here
  12726. g_sendhead.bsql = 0;
  12727. g_sendhead.code[0] = 171;
  12728. g_sendhead.tabcount = 1;
  12729. g_pMainWnd->ProcessChatMessageRequest2(1);
  12730. if (g_bSendOK == 0)
  12731. {
  12732. return;
  12733. }
  12734. CArray<CStringArray, CStringArray>g_bakstatearray;
  12735. DataToArray(&g_bakstatearray);
  12736. while (g_bakstatearray.GetSize() > 7)
  12737. {
  12738. g_bakstatearray.RemoveAt(0);
  12739. }
  12740. int photocount = 0;
  12741. int infocount = 0;
  12742. for (int i = 0; i < g_bakstatearray.GetSize(); i++)
  12743. {
  12744. if (g_bakstatearray.ElementAt(i).ElementAt(1) != "1")photocount++;
  12745. if (g_bakstatearray.ElementAt(i).ElementAt(2) != "1")infocount++;
  12746. }
  12747. ShowBakState dlg;
  12748. dlg.m_pArray = &g_bakstatearray;
  12749. dlg.DoModal();
  12750. }
  12751. void CMainFrame::PrintReceipt2(CStringArray *pArray)
  12752. {
  12753. int i = 0;
  12754. int printcot = 1;
  12755. for (int aa = 0; aa < printcot; aa++)
  12756. {
  12757. g_sendhead.bsql = 0;
  12758. g_sendhead.code[0] = 24;
  12759. g_sendhead.tabcount = 1;
  12760. int g_nYearposTemp = g_nYearpos;
  12761. g_nYearpos = -1;
  12762. g_pMainWnd->ProcessChatMessageRequest2(1);
  12763. g_nYearpos = g_nYearposTemp;
  12764. if (0 == g_bSendOK)return;
  12765. DataToArray(&g_cominfoarray);
  12766. CString SerialNo;
  12767. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  12768. CPrintRX m_Print;
  12769. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12770. {
  12771. m_Print.InitToPrint(NULL, 1);
  12772. }
  12773. else
  12774. {
  12775. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  12776. if (name.IsEmpty())
  12777. m_Print.InitToPrint(NULL, 1);
  12778. else
  12779. {
  12780. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12781. if (nret == -1 && aa == 0)
  12782. {
  12783. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12784. }
  12785. }
  12786. }
  12787. m_Print.StartPrint();
  12788. m_Print.StartPage();
  12789. LoadRect load;
  12790. BOOL bSmall = 0;
  12791. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  12792. {
  12793. bSmall = 1;
  12794. load.SetLiaPath("20.lia");
  12795. }
  12796. else
  12797. load.SetLiaPath("10.lia");
  12798. if (bSmall)
  12799. load.SetMargins(-10, 0);
  12800. else
  12801. load.SetMargins(10, 0);
  12802. if (!load.Load())return;
  12803. int rcpos = -1;
  12804. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12805. Image *pImg = NULL;
  12806. #ifdef MNLS_VERSION
  12807. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  12808. #else
  12809. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  12810. #endif
  12811. // m_Print.DrawImage(pImg, StrRect);
  12812. delete pImg;
  12813. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  12814. {
  12815. Image *pImg = NULL;
  12816. g_nSendCode = 31;
  12817. int g_nYearposTemp = g_nYearpos;
  12818. g_nYearpos = -1;
  12819. g_pMainWnd->ProcessChatMessageRequest2(1);
  12820. g_nYearpos = g_nYearposTemp;
  12821. g_nSendCode = 0;
  12822. if (g_bSendOK == 0)return;
  12823. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  12824. if (pImg)
  12825. {
  12826. StrRect.left = 65;
  12827. if (bSmall)StrRect.left = 55;
  12828. StrRect.top = 10;
  12829. StrRect.right = StrRect.left + 58;
  12830. StrRect.bottom = StrRect.top + 58;
  12831. m_Print.DrawImage(pImg, StrRect);
  12832. delete pImg; pImg = NULL;
  12833. }
  12834. }
  12835. if (bSmall)
  12836. {
  12837. m_Print.SetFontFace(18, 1, "黑体");
  12838. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12839. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12840. m_Print.SetFontFace(9, 1, "宋体");
  12841. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12842. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12843. m_Print.SetFontFace(6, 1, "宋体");
  12844. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12845. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12846. m_Print.SetFontFace(9, 1, "宋体");
  12847. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12848. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12849. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12850. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12851. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12852. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12853. int hei = StrRect.Height();
  12854. StrRect.bottom = StrRect.top;
  12855. StrRect.top -= 8;
  12856. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  12857. m_Print.SetFontFace(10, 1, "宋体");
  12858. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12859. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12860. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12861. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12862. m_Print.SetFontFace(9, 1, "宋体");
  12863. for ( i = 7; i < 24; i++)
  12864. {
  12865. StrRect = load.m_rcarray.ElementAt(i);
  12866. m_Print.DrawRect2(StrRect, 1);
  12867. }
  12868. for (i = 9; i < 24; i++)
  12869. {
  12870. StrRect = load.m_rcarray.ElementAt(i);
  12871. StrRect.left += 2;
  12872. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12873. }
  12874. m_Print.SetFontFace(6, 1, "宋体");
  12875. for (i = 24; i < 26; i++)
  12876. {
  12877. StrRect = load.m_rcarray.ElementAt(i);
  12878. StrRect.left += 2;
  12879. if (i == 24)
  12880. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12881. else
  12882. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12883. }
  12884. }
  12885. else//大单
  12886. {
  12887. m_Print.SetFontFace(20, 1, "黑体");
  12888. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12889. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12890. m_Print.SetFontFace(11, 1, "宋体");
  12891. // StrRect=load.m_rcarray .ElementAt (++rcpos);
  12892. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12893. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15;
  12894. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12895. int hei = StrRect.Height();
  12896. StrRect.bottom = StrRect.top;
  12897. StrRect.top -= 10;
  12898. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  12899. m_Print.SetFontFace(8, 1, "宋体");
  12900. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12901. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12902. m_Print.SetFontFace(11, 1, "宋体");
  12903. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12904. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12905. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12906. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12907. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12908. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12909. m_Print.SetFontFace(13, 1, "宋体");
  12910. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12911. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12912. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12913. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12914. m_Print.SetFontFace(11, 1, "宋体");
  12915. for ( i = 7; i < 24; i++)
  12916. {
  12917. StrRect = load.m_rcarray.ElementAt(i);
  12918. m_Print.DrawRect2(StrRect, 1);
  12919. }
  12920. for (i = 9; i < 24; i++)
  12921. {
  12922. StrRect = load.m_rcarray.ElementAt(i);
  12923. StrRect.left += 2;
  12924. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12925. }
  12926. m_Print.SetFontFace(8, 1, "宋体");
  12927. for (i = 24; i < 27; i++)
  12928. {
  12929. StrRect = load.m_rcarray.ElementAt(i);
  12930. StrRect.left += 2;
  12931. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12932. }
  12933. }
  12934. PrintPreview dlg;
  12935. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12936. dlg.m_pDC = m_Print.GetPDC();
  12937. if (aa == 0)
  12938. {
  12939. if (dlg.DoModal() != IDOK)
  12940. return;
  12941. printcot = dlg.m_num;
  12942. }
  12943. //结束打印
  12944. m_Print.EndPage();
  12945. m_Print.EndPrint();
  12946. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  12947. CString sql;
  12948. sql.Format("update version set [serialno2]='%s'", SerialNo);
  12949. g_sendhead.bsql = 1;
  12950. g_nYearposTemp = g_nYearpos;
  12951. g_nYearpos = -1;
  12952. g_pMainWnd->ProcessChatMessageRequest2(sql);
  12953. g_nYearpos = g_nYearposTemp;
  12954. }
  12955. }
  12956. //出生年月
  12957. //第一联
  12958. void CMainFrame::OnLog()
  12959. {
  12960. // TODO: Add your command handler code here OnShowBakState
  12961. if (IsHasRightsnew(49) == 0)return;
  12962. ShowLOg dlg;
  12963. dlg.DoModal();
  12964. }
  12965. // www.lyfz.net 8888
  12966. void CMainFrame::PrintDinDan6(CString m_id)
  12967. {
  12968. // TODO: Add your control notification handler code here 预约订单
  12969. int printcot = 1;
  12970. for (int aa = 0; aa < printcot; aa++)
  12971. {
  12972. PrintPreview dlg;
  12973. CPrintRX m_Print;
  12974. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12975. {
  12976. m_Print.InitToPrint(NULL, 1);
  12977. }
  12978. else
  12979. {
  12980. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  12981. if (name.IsEmpty())
  12982. m_Print.InitToPrint(NULL, 1);
  12983. else
  12984. {
  12985. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12986. if (nret == -1 && aa == 0)
  12987. {
  12988. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12989. }
  12990. }
  12991. }
  12992. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  12993. {
  12994. m_Print.StartPrint();
  12995. m_Print.StartPage();
  12996. LoadRect load;
  12997. load.SetLiaPath("6.lia");
  12998. load.SetMargins(-14, 15);
  12999. if (!load.Load())return;
  13000. LoadRect load2;
  13001. load2.SetLiaPath("7.lia");
  13002. load2.SetMargins(-14, 216 + 15);
  13003. if (!load2.Load())return;
  13004. LoadRect load3;
  13005. load3.SetLiaPath("8.lia");
  13006. load3.SetMargins(-14, 705 + 15);
  13007. if (!load3.Load())return;
  13008. int i;
  13009. //////////////////////////////////////////////////////////////
  13010. CStringArray txarray;
  13011. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  13012. g_sendhead.code[0] = 11;
  13013. g_sendhead.code[1] = 52;
  13014. g_sendhead.code[2] = 50;
  13015. g_sendhead.code[3] = 150;
  13016. g_sendhead.code[4] = 77;
  13017. g_sendhead.code[5] = 4;
  13018. g_sendhead.tabcount = 6;
  13019. g_sendhead.bsql = 0;
  13020. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  13021. CArray<CStringArray, CStringArray>sparray;
  13022. CArray<CStringArray, CStringArray>clientarray;
  13023. CArray<CStringArray, CStringArray>phonearray;
  13024. CArray<CStringArray, CStringArray>fgarray;
  13025. CArray<CStringArray, CStringArray>danweiarray;
  13026. CArray<CStringArray, CStringArray>jdarray;
  13027. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  13028. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  13029. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  13030. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  13031. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  13032. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  13033. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  13034. CString m_taoxiname;
  13035. if (m_zs.Find("\\") != -1)
  13036. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  13037. else
  13038. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  13039. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  13040. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  13041. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  13042. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  13043. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  13044. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  13045. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  13046. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  13047. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  13048. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  13049. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  13050. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  13051. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  13052. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  13053. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  13054. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  13055. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  13056. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  13057. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  13058. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  13059. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  13060. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  13061. if (jdarray.GetSize())
  13062. {
  13063. if (m_bz.IsEmpty() == 0)
  13064. m_bz = "\r\n" + m_bz;
  13065. m_bz += "景点:";
  13066. }
  13067. for (i = 0; i < jdarray.GetSize(); i++)
  13068. {
  13069. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  13070. }
  13071. m_bz.TrimRight(";");
  13072. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  13073. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13074. if (IsHasRights2new(31) == 0)
  13075. {
  13076. m_phone1 = "***";
  13077. m_phone2 = "***";
  13078. }
  13079. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  13080. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13081. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  13082. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  13083. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  13084. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  13085. filter = "name='" + m_ren + "'";
  13086. g_sendhead.code[0] = 5;
  13087. g_sendhead.tabcount = 1;
  13088. g_sendhead.bsql = 0;
  13089. int g_nYearposTemp = g_nYearpos;
  13090. g_nYearpos = -1;
  13091. g_pMainWnd->ProcessChatMessageRequest2(filter);
  13092. g_nYearpos = g_nYearposTemp;
  13093. if (g_bSendOK == 0)return;
  13094. DataToArray(&phonearray);
  13095. m_money1.Format("%f", atof(m_taoxijiage));
  13096. m_money2.Format("%f", atof(m_payed1));
  13097. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  13098. ConvertToPrice(m_money1);
  13099. ConvertToPrice(m_money2);
  13100. ConvertToPrice(m_money3);
  13101. ////////////////////////////////////////////////////////////////
  13102. int rcpos = -1;
  13103. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13104. StrRect.top -= 15; StrRect.bottom -= 15;
  13105. Image *pImg = NULL;
  13106. #ifdef MNLS_VERSION
  13107. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  13108. #else
  13109. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  13110. #endif
  13111. m_Print.DrawImage(pImg, StrRect);
  13112. delete pImg;
  13113. m_Print.SetFontFace(11, 1, "宋体");
  13114. StrRect = load.m_rcarray.ElementAt(20);
  13115. StrRect.right = load.m_rcarray.ElementAt(23).right;
  13116. StrRect.top -= 18; StrRect.bottom -= 18;
  13117. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  13118. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13119. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  13120. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13121. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13122. StrRect.top -= 15; StrRect.bottom -= 15;
  13123. #ifdef MNLS_VERSION
  13124. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13125. #endif
  13126. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13127. StrRect.top -= 15; StrRect.bottom -= 15;
  13128. #ifdef MNLS_VERSION
  13129. m_Print.DrawRect(StrRect);
  13130. #endif
  13131. m_Print.SetFontFace(7, 1, "黑体");
  13132. m_Print.SetColor(0xffffff);
  13133. #ifdef MNLS_VERSION
  13134. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13135. #endif
  13136. m_Print.SetColor(0);
  13137. m_Print.SetFontFace(15, 1, "宋体");
  13138. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13139. StrRect.top -= 15; StrRect.bottom -= 15;
  13140. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同拍摄单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13141. CStringArray strarray;
  13142. strarray.Add("NO: " + m_id);
  13143. CString date;
  13144. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  13145. strarray.Add(date);
  13146. strarray.Add("喜爱");
  13147. strarray.Add("格调");
  13148. if (fgarray.GetSize() == 12)
  13149. {
  13150. for (int i = 0; i < 12; i++)
  13151. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  13152. }
  13153. else
  13154. {
  13155. strarray.Add("复古典雅");
  13156. strarray.Add("温文尔雅");
  13157. strarray.Add("豪华艳丽");
  13158. strarray.Add("传统大方");
  13159. strarray.Add("新潮个性");
  13160. strarray.Add("浪漫奔放");
  13161. strarray.Add("简单素雅");
  13162. strarray.Add("活泼俏丽");
  13163. strarray.Add("妩媚温馨");
  13164. strarray.Add("温柔贤惠");
  13165. strarray.Add("成熟感性");
  13166. strarray.Add("清纯可爱");
  13167. }
  13168. strarray.Add("姓名");
  13169. // strarray.Add("职业");
  13170. strarray.Add("");
  13171. strarray.Add("地址");
  13172. strarray.Add("电话");
  13173. #ifdef CHILD_VERSION
  13174. strarray.Add("家长");
  13175. strarray.Add("宝宝");
  13176. #else
  13177. strarray.Add("先生");
  13178. strarray.Add("女士");
  13179. #endif
  13180. m_Print.SetFontFace(11, 1, "宋体");
  13181. for (i = 0; i < strarray.GetSize(); i++)
  13182. {
  13183. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13184. if (i < 2)
  13185. {
  13186. StrRect.top -= 15; StrRect.bottom -= 15;
  13187. }
  13188. if (i>15)
  13189. m_Print.DrawRect2(StrRect, 1);
  13190. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13191. }
  13192. for (i = 29; i <= 40; i++)
  13193. {
  13194. if (m_style.GetLength() <= (i - 29))continue;
  13195. if (m_style.GetAt(i - 29) != '1')continue;
  13196. StrRect = load.m_rcarray.ElementAt(i - 1);
  13197. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13198. }
  13199. for (i = 27; i <= 48; i++)
  13200. {
  13201. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13202. m_Print.DrawRect2(StrRect, 1);
  13203. }
  13204. #ifdef CHILD_VERSION
  13205. StrRect = load.m_rcarray.ElementAt(45);
  13206. StrRect.right = StrRect.left + 62;
  13207. m_Print.DrawRect2(StrRect, 1);
  13208. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13209. StrRect.left = StrRect.right;
  13210. StrRect.right = StrRect.left + 62;
  13211. m_Print.DrawRect2(StrRect, 1);
  13212. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13213. StrRect.left = StrRect.right;
  13214. StrRect.right = StrRect.left + 62;
  13215. m_Print.DrawRect2(StrRect, 1);
  13216. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13217. StrRect.left = StrRect.right;
  13218. StrRect.right = StrRect.left + 62;
  13219. m_Print.DrawRect2(StrRect, 1);
  13220. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13221. #endif
  13222. /////////////////////////
  13223. strarray.RemoveAll();
  13224. CString temp;
  13225. temp.Format("拍摄 选 %d 款,其中", atoi(m_outside) + atoi(m_outside2));
  13226. strarray.Add(temp);
  13227. temp.Format("内景 %d 款,外景 %d 款.", atoi(m_outside2), atoi(m_outside));
  13228. strarray.Add(temp);
  13229. strarray.Add("化妆");
  13230. strarray.Add("造型");
  13231. #ifdef CHILD_VERSION
  13232. strarray.Add("");
  13233. #else
  13234. strarray.Add("婚纱");
  13235. #endif
  13236. strarray.Add("服饰");
  13237. strarray.Add("配");
  13238. strarray.Add("置");
  13239. strarray.Add("其");
  13240. strarray.Add("它");
  13241. strarray.Add("套系名称");
  13242. strarray.Add("镜款");
  13243. strarray.Add("套系总价");
  13244. strarray.Add("主摄影师");
  13245. strarray.Add("拍摄日期");
  13246. strarray.Add("定金");
  13247. #ifdef CHILD_VERSION
  13248. strarray.Add("主引导师");
  13249. #else
  13250. strarray.Add("主化妆师");
  13251. #endif
  13252. strarray.Add("看样日期");
  13253. strarray.Add("补 余 款");
  13254. strarray.Add("总监");
  13255. strarray.Add("取件日期");
  13256. rcpos = -1;
  13257. for (i = 0; i < strarray.GetSize(); i++)
  13258. {
  13259. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13260. if (i>9)
  13261. m_Print.DrawRect2(StrRect, 1);
  13262. #ifdef CHILD_VERSION
  13263. if (i == 5)
  13264. StrRect.top -= StrRect.Height();
  13265. #endif
  13266. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13267. }
  13268. for (i = 22; i <= 41; i++)
  13269. {
  13270. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13271. m_Print.DrawRect2(StrRect, 1);
  13272. }
  13273. /////////////////////////////
  13274. strarray.RemoveAll();
  13275. #ifdef CHILD_VERSION
  13276. strarray.Add("顾客方 家长:");
  13277. strarray.Add("宝宝:");
  13278. #else
  13279. strarray.Add("顾客方 先生:");
  13280. strarray.Add("女士:");
  13281. #endif
  13282. strarray.Add("电话:");
  13283. strarray.Add("影楼方 店长:");
  13284. strarray.Add("接单人:");
  13285. strarray.Add("电话:");
  13286. rcpos = -1;
  13287. for (i = 0; i < strarray.GetSize(); i++)
  13288. {
  13289. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13290. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13291. }
  13292. for (i = 7; i <= 12; i++)
  13293. {
  13294. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13295. // if(i!=10)
  13296. m_Print.DrawRect2(StrRect, 2);
  13297. }
  13298. //////////////////////////////////////
  13299. //开始打数据
  13300. strarray.RemoveAll();
  13301. strarray.Add(m_name1);
  13302. strarray.Add(m_name2);
  13303. strarray.Add("");
  13304. strarray.Add("");
  13305. strarray.Add(m_addr1);
  13306. #ifdef CHILD_VERSION
  13307. strarray.Add("");
  13308. #else
  13309. strarray.Add(m_addr2);
  13310. #endif
  13311. strarray.Add(m_phone1);
  13312. strarray.Add(m_phone2);
  13313. for (i = 41; i <= 48; i++)
  13314. {
  13315. StrRect = load.m_rcarray.ElementAt(i - 1);
  13316. StrRect.left += 4;
  13317. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13318. }
  13319. ///////////////////////////////
  13320. strarray.RemoveAll();
  13321. strarray.Add(m_money1);
  13322. strarray.Add(m_waiter1);
  13323. strarray.Add(m_time2);
  13324. strarray.Add(m_money2);
  13325. strarray.Add(m_waiter2);
  13326. strarray.Add(m_time4);
  13327. strarray.Add(m_money3);
  13328. strarray.Add("");
  13329. strarray.Add(m_time5);
  13330. for (i = 32; i <= 40; i++)
  13331. {
  13332. StrRect = load2.m_rcarray.ElementAt(i - 1);
  13333. StrRect.left += 4;
  13334. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13335. }
  13336. ///////////////////////////////
  13337. strarray.RemoveAll();
  13338. strarray.Add("");//m_name1);
  13339. strarray.Add("");//m_name2);
  13340. CString phone;
  13341. if (m_phone1.IsEmpty() == 0)
  13342. phone = m_phone1 + ",";
  13343. phone += m_phone2;
  13344. phone.TrimRight(",");
  13345. strarray.Add("");//phone);
  13346. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  13347. strarray.Add(m_ren);
  13348. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13349. for (i = 7; i <= 12; i++)
  13350. {
  13351. StrRect = load3.m_rcarray.ElementAt(i - 1);
  13352. StrRect.left += 4;
  13353. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13354. }
  13355. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  13356. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13357. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  13358. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13359. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  13360. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13361. //////////////////////////////
  13362. //开始画文字
  13363. StrRect = load2.m_rcarray.ElementAt(30);
  13364. StrRect.left += 3;
  13365. StrRect.top += 3;
  13366. StrRect.right -= 2;
  13367. StrRect.bottom -= 2;
  13368. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  13369. StrRect = load2.m_rcarray.ElementAt(29);
  13370. StrRect.left += 3;
  13371. StrRect.top += 3;
  13372. StrRect.right -= 2;
  13373. StrRect.bottom -= 2;
  13374. str = "";
  13375. for (i = 0; i < sparray.GetSize(); i++)
  13376. {
  13377. str += sparray.ElementAt(i).ElementAt(5);
  13378. str += " 数量:";
  13379. str += sparray.ElementAt(i).ElementAt(3);
  13380. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  13381. str += "\r\n";
  13382. }
  13383. str.TrimRight("\r\n");
  13384. AutoDraw(m_Print, StrRect, str, 1.4);
  13385. StrRect = load2.m_rcarray.ElementAt(40);
  13386. StrRect.top += 8;
  13387. m_Print.SetFontFace(12, 1, "黑体");
  13388. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  13389. StrRect.left += 3;
  13390. StrRect.top += 30;
  13391. StrRect.right -= 2;
  13392. StrRect.bottom -= 2;
  13393. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  13394. if (str.IsEmpty())
  13395. {
  13396. str = "\
  13397. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  13398. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  13399. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  13400. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  13401. 持良好的心境.\r\n\
  13402. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  13403. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  13404. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  13405. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  13406. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  13407. 勿进影室, 以免影响拍摄.\r\n\
  13408. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  13409. 师或店长沟通.\r\n\
  13410. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  13411. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  13412. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  13413. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  13414. 9. 本合同余额欠款须在拍照前付清.\r\n\
  13415. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  13416. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  13417. 还.";
  13418. }
  13419. AutoDraw(m_Print, StrRect, str, 1.8);
  13420. }
  13421. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13422. dlg.m_pDC = m_Print.GetPDC();
  13423. dlg.m_mode = 1;
  13424. if (aa == 0)
  13425. {
  13426. if (dlg.DoModal() != IDOK)
  13427. return;
  13428. printcot = dlg.m_num;
  13429. }
  13430. //结束打印
  13431. m_Print.EndPage();
  13432. m_Print.EndPrint();
  13433. }
  13434. }
  13435. void CMainFrame::InsideMsg()
  13436. {
  13437. ///内部消息
  13438. CString str;
  13439. g_sendhead.bsql = 0;
  13440. g_sendhead.code[0] = 126;
  13441. g_sendhead.tabcount = 1;
  13442. g_bNoConnDlg = 1;
  13443. g_pMainWnd->ProcessChatMessageRequest2(1); g_bNoConnDlg = 0;
  13444. if (g_bSendOK == 0)return;
  13445. CArray<CStringArray, CStringArray>m_List1array;
  13446. DataToArray(&g_List1array);//, &m_List1array);
  13447. int i = 0;
  13448. m_List1array.SetSize(g_List1array.GetSize());
  13449. for ( i = 0; i < g_List1array.GetSize(); i++)
  13450. {
  13451. m_List1array.ElementAt(i).Copy(g_List1array.ElementAt(i));
  13452. }
  13453. str = "," + g_user.name + ",";
  13454. for (i = g_List1array.GetSize() - 1; i >= 0; i--)
  13455. {
  13456. CString receivers2 = g_List1array.ElementAt(i).ElementAt(4);
  13457. receivers2.TrimLeft(",");
  13458. receivers2.TrimRight(",");
  13459. receivers2 = "," + receivers2 + ",";
  13460. CString receivers = g_List1array.ElementAt(i).ElementAt(3);
  13461. receivers.TrimLeft(",");
  13462. receivers.TrimRight(",");
  13463. receivers = "," + receivers + ",";
  13464. if (receivers.Find(str) == -1)
  13465. g_List1array.RemoveAt(i);
  13466. else if (receivers2.Find(str) != -1)
  13467. g_List1array.RemoveAt(i);
  13468. }
  13469. if (g_List1array.GetSize())
  13470. {
  13471. ShowMsg dlg;
  13472. dlg.DoModal();
  13473. }
  13474. for (i = m_List1array.GetSize() - 1; i >= 0; i--)
  13475. {
  13476. CString receivers2 = m_List1array.ElementAt(i).ElementAt(4);
  13477. receivers2.TrimLeft(",");
  13478. receivers2.TrimRight(",");
  13479. receivers2 = "," + receivers2 + ",";
  13480. CString receivers = m_List1array.ElementAt(i).ElementAt(3);
  13481. if (receivers != "")
  13482. m_List1array.RemoveAt(i);
  13483. else if (receivers2.Find(str) != -1)
  13484. m_List1array.RemoveAt(i);
  13485. }
  13486. if (m_List1array.GetSize())
  13487. {
  13488. SendInsideMsg2 dlg;
  13489. dlg.m_bShow = 1;
  13490. dlg.m_pArray = &m_List1array;
  13491. dlg.DoModal();
  13492. }
  13493. }
  13494. //定金
  13495. /************************************************************************/
  13496. /*
  13497. 函数:PrintHireDress
  13498. 描述:打印礼服出租单;
  13499. 参数:
  13500. strOrderNumber 礼服订单号;
  13501. 注意:
  13502. */
  13503. /************************************************************************/
  13504. void CMainFrame::PrintHireDress(CString strOrderNumber) // 打印礼服出租单;
  13505. {
  13506. int printcot = 1;
  13507. for (int aa = 0; aa < printcot; aa++)
  13508. {
  13509. CPrintRX m_Print;
  13510. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13511. {
  13512. m_Print.InitToPrint(NULL, 1);
  13513. }
  13514. else
  13515. {
  13516. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13517. if (name.IsEmpty())
  13518. m_Print.InitToPrint(NULL, 1);
  13519. else
  13520. {
  13521. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13522. if (nret == -1 && aa == 0)
  13523. {
  13524. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  13525. }
  13526. }
  13527. }
  13528. m_Print.StartPrint();
  13529. m_Print.StartPage();
  13530. LoadRect load;
  13531. load.SetLiaPath("21.lia");
  13532. load.SetMargins(0, 0);
  13533. if (!load.Load())
  13534. {
  13535. return;
  13536. }
  13537. int i;
  13538. //////////////////////////////////////////////////////////////
  13539. //CString filter="id='"+strOrderNumber+"';id='"+strOrderNumber+"';id='"+strOrderNumber+"'";
  13540. CString strFilter;
  13541. strFilter.Format("id='%s';id='%s';id='%s'", strOrderNumber, strOrderNumber, strOrderNumber);
  13542. g_sendhead.bsql = 0;
  13543. g_sendhead.code[0] = 73;
  13544. g_sendhead.code[1] = 74;
  13545. g_sendhead.code[2] = 52;
  13546. g_sendhead.tabcount = 3;
  13547. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  13548. if (g_bSendOK == 0)
  13549. {
  13550. return;
  13551. }
  13552. CArray<CStringArray, CStringArray>dresshirearray;
  13553. CArray<CStringArray, CStringArray>dresshiredataarray;
  13554. CArray<CStringArray, CStringArray>clientarray;
  13555. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13556. if (dresshirearray.GetSize() == 0)
  13557. {
  13558. return;
  13559. }
  13560. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10);
  13561. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7);
  13562. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8);
  13563. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6);
  13564. if (clientarray.GetSize() == 0)
  13565. {
  13566. return;
  13567. }
  13568. //AfxMessageBox("打印礼服出租单-()");
  13569. CString m_name2 = clientarray.ElementAt(0).ElementAt(2);
  13570. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13571. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13572. CString m_time3 = clientarray.ElementAt(0).ElementAt(20);
  13573. //#if JEFF_TEST
  13574. // if ( dresshiredataarray.GetSize() == 0 )
  13575. // {
  13576. // AfxMessageBox("没衣服");
  13577. // }
  13578. //#endif
  13579. CString sItem;
  13580. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13581. {
  13582. sItem += "编号:";
  13583. sItem += dresshiredataarray.ElementAt(i).ElementAt(1);
  13584. sItem += " ";
  13585. sItem += " 名称:";
  13586. sItem += dresshiredataarray.ElementAt(i).ElementAt(2);
  13587. sItem += " 数量:";
  13588. sItem += dresshiredataarray.ElementAt(i).ElementAt(3) + "\r\n";
  13589. }
  13590. sItem += "金额:";
  13591. sItem += dresshirearray.ElementAt(0).ElementAt(1);
  13592. sItem += " ";
  13593. sItem += " 押金:";
  13594. sItem += dresshirearray.ElementAt(0).ElementAt(2) + "\r\n";
  13595. ////////////////////////////////////////////////////////////////
  13596. int rcpos = -1;
  13597. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13598. m_Print.SetFontFace(17, 1, "宋体");
  13599. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13600. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13601. m_Print.SetFontFace(10, 1, "宋体");
  13602. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13603. CStringArray strarray;
  13604. strarray.Add("客户姓名");
  13605. strarray.Add("客户电话");
  13606. strarray.Add("预定日期");
  13607. strarray.Add("结婚日期");
  13608. strarray.Add("取件日期");
  13609. strarray.Add("归还日期");
  13610. strarray.Add("本店地址");
  13611. strarray.Add("电 话");
  13612. strarray.Add("客户地址");
  13613. strarray.Add("客户签名");
  13614. for (i = 2; i < 12; i++)
  13615. {
  13616. StrRect = load.m_rcarray.ElementAt(i);
  13617. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13618. }
  13619. strarray.RemoveAll();
  13620. strarray.Add(m_name2);
  13621. strarray.Add(m_phone2);
  13622. strarray.Add(m_inputdate);
  13623. strarray.Add(m_time3);
  13624. strarray.Add(m_date1);
  13625. strarray.Add(m_date2);
  13626. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13627. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13628. strarray.Add(m_addr2);
  13629. strarray.Add("");
  13630. for (i = 12; i < 22; i++)
  13631. {
  13632. StrRect = load.m_rcarray.ElementAt(i);
  13633. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13634. m_Print.DrawRect2(StrRect, 2);
  13635. }
  13636. for (i = 25; i < 30; i++)
  13637. {
  13638. StrRect = load.m_rcarray.ElementAt(i);
  13639. m_Print.DrawRect2(StrRect, 1);
  13640. }
  13641. StrRect = load.m_rcarray.ElementAt(22);
  13642. StrRect.top += 7;
  13643. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13644. StrRect = load.m_rcarray.ElementAt(23);
  13645. StrRect.top += 7;
  13646. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13647. StrRect = load.m_rcarray.ElementAt(24);
  13648. StrRect.top += 7;
  13649. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13650. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13651. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13652. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13653. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13654. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13655. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13656. if (str.IsEmpty())
  13657. {
  13658. str = "\
  13659. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13660. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13661. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13662. 4. 如有破损酌情赔偿.";
  13663. }
  13664. AutoDraw(m_Print, StrRect, str, 1.5);
  13665. PrintPreview dlg;
  13666. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13667. dlg.m_pDC = m_Print.GetPDC();
  13668. if (aa == 0)
  13669. {
  13670. if (dlg.DoModal() != IDOK)
  13671. return;
  13672. printcot = dlg.m_num;
  13673. }
  13674. //结束打印
  13675. m_Print.EndPage();
  13676. m_Print.EndPrint();
  13677. }
  13678. }
  13679. void CMainFrame::PrintHireDress_01(CString strOrderNumber) // 打印礼服出租单,无法改变结构,需要修改21.lia才能改变打印的布局;
  13680. {
  13681. int printcot = 1;
  13682. for (int aa = 0; aa < printcot; aa++)
  13683. {
  13684. CPrintRX m_Print;
  13685. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13686. {
  13687. m_Print.InitToPrint(NULL, 1);
  13688. }
  13689. else
  13690. {
  13691. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13692. if (name.IsEmpty())
  13693. m_Print.InitToPrint(NULL, 1);
  13694. else
  13695. {
  13696. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13697. if (nret == -1 && aa == 0)
  13698. {
  13699. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  13700. m_Print.InitToPrint(NULL, 1);
  13701. }
  13702. }
  13703. }
  13704. m_Print.StartPrint();
  13705. m_Print.StartPage();
  13706. LoadRect load;
  13707. load.SetLiaPath("21.lia");
  13708. load.SetMargins(0, 0);
  13709. if (!load.Load())return;
  13710. int i;
  13711. //////////////////////////////////////////////////////////////
  13712. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  13713. g_sendhead.bsql = 0;
  13714. g_sendhead.code[0] = 73; // dresshire表;
  13715. g_sendhead.code[1] = 74; // dresshiredata表;
  13716. g_sendhead.code[2] = 52; // client表;
  13717. g_sendhead.tabcount = 3;
  13718. g_pMainWnd->ProcessChatMessageRequest2(filter);
  13719. if (g_bSendOK == 0)
  13720. {
  13721. return;
  13722. }
  13723. CArray<CStringArray, CStringArray>dresshirearray;
  13724. CArray<CStringArray, CStringArray>dresshiredataarray;
  13725. CArray<CStringArray, CStringArray>clientarray;
  13726. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13727. if (dresshirearray.GetSize() == 0)return;
  13728. // dresshire;
  13729. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10); // 备注;
  13730. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7); // 取衣日期;
  13731. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8); // 还衣日期;
  13732. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6); // 记录日期;
  13733. CString strPrice = dresshirearray.ElementAt(0).ElementAt(1); // 金额;
  13734. CString strDeposit = dresshirearray.ElementAt(0).ElementAt(2); // 押金;
  13735. // client表;
  13736. if (clientarray.GetSize() == 0)return;
  13737. CString m_name2 = clientarray.ElementAt(0).ElementAt(2); // 女宾姓名;
  13738. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4); // 女宾手机;
  13739. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8); // 女宾地址;
  13740. CString m_time3 = clientarray.ElementAt(0).ElementAt(20); // 婚期;
  13741. // dresshiredata表;
  13742. CString sItem;
  13743. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13744. {
  13745. sItem += dresshiredataarray.ElementAt(i).ElementAt(1); // 礼服编号;
  13746. sItem += " ";
  13747. sItem += dresshiredataarray.ElementAt(i).ElementAt(2); // 礼服名称;
  13748. sItem += " 数量:";
  13749. sItem += dresshiredataarray.ElementAt(i).ElementAt(3) + "\r\n"; // 礼服数量;
  13750. }
  13751. sItem += " 金额:";
  13752. sItem += dresshirearray.ElementAt(0).ElementAt(1); // 出租金额;
  13753. sItem += " 押金:";
  13754. sItem += dresshirearray.ElementAt(0).ElementAt(2) + "\r\n"; // 押金;
  13755. ////////////////////////////////////////////////////////////////
  13756. int rcpos = -1;
  13757. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13758. m_Print.SetFontFace(17, 1, "宋体");
  13759. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13760. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13761. m_Print.SetFontFace(10, 1, "宋体");
  13762. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13763. CStringArray strarray;
  13764. strarray.Add("客户姓名"); // 1.
  13765. strarray.Add("客户电话");
  13766. strarray.Add("预定日期");
  13767. strarray.Add("结婚日期");
  13768. strarray.Add("取件日期"); // 5.
  13769. strarray.Add("归还日期");
  13770. strarray.Add("本店地址");
  13771. strarray.Add("电 话");
  13772. strarray.Add("客户地址");
  13773. strarray.Add("客户签名"); // 10.
  13774. //strarray.Add("金额");
  13775. //strarray.Add("押金");
  13776. for( i=2; i<12; i++)
  13777. //for (i = 2; i < 14; i++)
  13778. {
  13779. StrRect = load.m_rcarray.ElementAt(i);
  13780. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13781. }
  13782. strarray.RemoveAll();
  13783. strarray.Add(m_name2);
  13784. strarray.Add(m_phone2);
  13785. strarray.Add(m_inputdate);
  13786. strarray.Add(m_time3);
  13787. strarray.Add(m_date1);
  13788. strarray.Add(m_date2);
  13789. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13790. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13791. strarray.Add(m_addr2);
  13792. strarray.Add("");
  13793. strarray.Add(strPrice); // 金额;
  13794. strarray.Add(strDeposit); // 押金;
  13795. for( i=12; i<22; i++)
  13796. //for (i = 14; i < 24; i++)
  13797. {
  13798. StrRect = load.m_rcarray.ElementAt(i);
  13799. //m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i-12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13800. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 14), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13801. m_Print.DrawRect2(StrRect, 2);
  13802. }
  13803. for (i = 25; i < 30; i++)
  13804. {
  13805. StrRect = load.m_rcarray.ElementAt(i);
  13806. m_Print.DrawRect2(StrRect, 1);
  13807. }
  13808. StrRect = load.m_rcarray.ElementAt(22);
  13809. StrRect.top += 7;
  13810. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13811. StrRect = load.m_rcarray.ElementAt(23);
  13812. StrRect.top += 7;
  13813. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13814. StrRect = load.m_rcarray.ElementAt(24);
  13815. StrRect.top += 7;
  13816. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13817. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13818. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13819. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13820. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13821. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13822. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13823. if (str.IsEmpty())
  13824. {
  13825. str = "\
  13826. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13827. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13828. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13829. 4. 如有破损酌情赔偿.";
  13830. }
  13831. AutoDraw(m_Print, StrRect, str, 1.5);
  13832. PrintPreview dlg;
  13833. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13834. dlg.m_pDC = m_Print.GetPDC();
  13835. if (aa == 0)
  13836. {
  13837. if (dlg.DoModal() != IDOK)
  13838. return;
  13839. printcot = dlg.m_num;
  13840. }
  13841. //结束打印
  13842. m_Print.EndPage();
  13843. m_Print.EndPrint();
  13844. }
  13845. }
  13846. // ****************************************************************************
  13847. // Jeff:
  13848. // 函数:PrintHireDress2
  13849. // 无参;
  13850. // 调用者:DinDanFrom.cpp
  13851. // void DinDanFrom::GetData(),订单报表调用时,判断订单数是否大于1000
  13852. // 当订单数大于1000,设置连接公司服务器开关量为真;
  13853. // -----------------------------------------------------------------------------
  13854. // 修改:Jeff
  13855. // 时间:2014.10.18
  13856. // 内容:将 g_ncot 比较值改为100;
  13857. // ****************************************************************************
  13858. void CMainFrame::PrintHireDress2()
  13859. {
  13860. if (g_ncot > 100) g_bSendLYFZ = 1;
  13861. // g_pMainWnd->SetTimer (7, 3000, NULL);
  13862. }
  13863. void CMainFrame::PrintTakeForm2(CArray<CStringArray, CStringArray>*Listarray)
  13864. {
  13865. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "选片客人明细表";
  13866. int pages = Listarray->GetSize() / 46;
  13867. if (Listarray->GetSize() % 46)pages++;
  13868. for (int aa = 0; aa < pages; aa++)
  13869. {
  13870. PrintPreview dlg;
  13871. CPrintRX m_Print;
  13872. m_Print.InitToPrint(NULL, 1);
  13873. m_Print.StartPrint();
  13874. m_Print.StartPage();
  13875. CRect mainrc(0, 0, 560, 793);
  13876. float fscale;
  13877. {
  13878. int w, h;
  13879. m_Print.GetWidHei(w, h);
  13880. fscale = (float)w / (float)h;
  13881. }
  13882. mainrc.DeflateRect(25, 40, 10, 0);
  13883. CRect rc, rc2;
  13884. rc = mainrc;
  13885. rc.bottom = rc.top;
  13886. rc.top -= 20;
  13887. m_Print.SetFontFace(16, 1, "黑体");
  13888. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13889. m_Print.SetFontFace(9, 1, "宋体");
  13890. CString str;
  13891. int wid[5] = { 200, 110, 70, 85, 62 };
  13892. int hei = 16;
  13893. if (fscale > 0.71)hei = 15;
  13894. rc = mainrc;
  13895. rc.bottom = rc.top + hei;
  13896. for (int i = 0; i < 47; i++)
  13897. {
  13898. rc2.top = rc.top + i*hei;
  13899. rc2.bottom = rc.bottom + i*hei;
  13900. rc2.left = rc.left;
  13901. rc2.right = rc.left + wid[0];
  13902. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  13903. for (int j = 0; j<5; j++)
  13904. {
  13905. m_Print.DrawRect2(rc2, 1);
  13906. if (Listarray->GetSize()>aa * 46 + i)
  13907. {
  13908. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  13909. rc2.left += 3;
  13910. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13911. rc2.left -= 3;
  13912. }
  13913. rc2.left += wid[j];
  13914. rc2.right = rc2.left + wid[j + 1];
  13915. }
  13916. }
  13917. rc2.top += 2;
  13918. rc2.left += 2; rc2.right = mainrc.right + 4;
  13919. m_Print.SetFontFace(8, 1, "宋体");
  13920. str.Format(" 页:%d/%d", aa + 1, pages);
  13921. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  13922. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13923. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13924. dlg.m_pDC = m_Print.GetPDC();
  13925. // dlg.m_mode=1;
  13926. if (aa == 0)
  13927. {
  13928. if (dlg.DoModal() != IDOK)
  13929. return;
  13930. }
  13931. //结束打印
  13932. m_Print.EndPage();
  13933. m_Print.EndPrint();
  13934. }
  13935. }
  13936. void CMainFrame::PrintTakeForm3(CArray<CStringArray, CStringArray>*Listarray)
  13937. {
  13938. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "看设计客人明细表";
  13939. int pages = Listarray->GetSize() / 46;
  13940. if (Listarray->GetSize() % 46)pages++;
  13941. for (int aa = 0; aa < pages; aa++)
  13942. {
  13943. PrintPreview dlg;
  13944. CPrintRX m_Print;
  13945. m_Print.InitToPrint(NULL, 1);
  13946. m_Print.StartPrint();
  13947. m_Print.StartPage();
  13948. CRect mainrc(0, 0, 560, 793);
  13949. float fscale;
  13950. {
  13951. int w, h;
  13952. m_Print.GetWidHei(w, h);
  13953. fscale = (float)w / (float)h;
  13954. }
  13955. mainrc.DeflateRect(25, 40, 10, 0);
  13956. CRect rc, rc2;
  13957. rc = mainrc;
  13958. rc.bottom = rc.top;
  13959. rc.top -= 20;
  13960. m_Print.SetFontFace(16, 1, "黑体");
  13961. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13962. m_Print.SetFontFace(9, 1, "宋体");
  13963. CString str;
  13964. int wid[5] = { 200, 110, 70, 85, 62 };
  13965. int hei = 16;
  13966. if (fscale > 0.71)hei = 15;
  13967. rc = mainrc;
  13968. rc.bottom = rc.top + hei;
  13969. for (int i = 0; i < 47; i++)
  13970. {
  13971. rc2.top = rc.top + i*hei;
  13972. rc2.bottom = rc.bottom + i*hei;
  13973. rc2.left = rc.left;
  13974. rc2.right = rc.left + wid[0];
  13975. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  13976. for (int j = 0; j<5; j++)
  13977. {
  13978. m_Print.DrawRect2(rc2, 1);
  13979. if (Listarray->GetSize()>aa * 46 + i)
  13980. {
  13981. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  13982. rc2.left += 3;
  13983. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13984. rc2.left -= 3;
  13985. }
  13986. rc2.left += wid[j];
  13987. rc2.right = rc2.left + wid[j + 1];
  13988. }
  13989. }
  13990. rc2.top += 2;
  13991. rc2.left += 2; rc2.right = mainrc.right + 4;
  13992. m_Print.SetFontFace(8, 1, "宋体");
  13993. str.Format(" 页:%d/%d", aa + 1, pages);
  13994. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  13995. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13996. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13997. dlg.m_pDC = m_Print.GetPDC();
  13998. // dlg.m_mode=1;
  13999. if (aa == 0)
  14000. {
  14001. if (dlg.DoModal() != IDOK)
  14002. return;
  14003. }
  14004. //结束打印
  14005. m_Print.EndPage();
  14006. m_Print.EndPrint();
  14007. }
  14008. }
  14009. void CMainFrame::PrintTakeForm4(CArray<CStringArray, CStringArray>*Listarray)
  14010. {
  14011. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "取件客人明细表";
  14012. int pages = Listarray->GetSize() / 46;
  14013. if (Listarray->GetSize() % 46)pages++;
  14014. for (int aa = 0; aa < pages; aa++)
  14015. {
  14016. PrintPreview dlg;
  14017. CPrintRX m_Print;
  14018. m_Print.InitToPrint(NULL, 1);
  14019. m_Print.StartPrint();
  14020. m_Print.StartPage();
  14021. CRect mainrc(0, 0, 560, 793);
  14022. float fscale;
  14023. {
  14024. int w, h;
  14025. m_Print.GetWidHei(w, h);
  14026. fscale = (float)w / (float)h;
  14027. }
  14028. mainrc.DeflateRect(25, 40, 10, 0);
  14029. CRect rc, rc2;
  14030. rc = mainrc;
  14031. rc.bottom = rc.top;
  14032. rc.top -= 20;
  14033. m_Print.SetFontFace(16, 1, "黑体");
  14034. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14035. m_Print.SetFontFace(9, 1, "宋体");
  14036. CString str;
  14037. int wid[5] = { 200, 110, 70, 85, 62 };
  14038. int hei = 16;
  14039. if (fscale > 0.71)hei = 15;
  14040. rc = mainrc;
  14041. rc.bottom = rc.top + hei;
  14042. for (int i = 0; i < 47; i++)
  14043. {
  14044. rc2.top = rc.top + i*hei;
  14045. rc2.bottom = rc.bottom + i*hei;
  14046. rc2.left = rc.left;
  14047. rc2.right = rc.left + wid[0];
  14048. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14049. for (int j = 0; j<5; j++)
  14050. {
  14051. m_Print.DrawRect2(rc2, 1);
  14052. if (Listarray->GetSize()>aa * 46 + i)
  14053. {
  14054. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14055. rc2.left += 3;
  14056. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14057. rc2.left -= 3;
  14058. }
  14059. rc2.left += wid[j];
  14060. rc2.right = rc2.left + wid[j + 1];
  14061. }
  14062. }
  14063. rc2.top += 2;
  14064. rc2.left += 2; rc2.right = mainrc.right + 4;
  14065. m_Print.SetFontFace(8, 1, "宋体");
  14066. str.Format(" 页:%d/%d", aa + 1, pages);
  14067. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14068. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14069. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14070. dlg.m_pDC = m_Print.GetPDC();
  14071. // dlg.m_mode=1;
  14072. if (aa == 0)
  14073. {
  14074. if (dlg.DoModal() != IDOK)
  14075. return;
  14076. }
  14077. //结束打印
  14078. m_Print.EndPage();
  14079. m_Print.EndPrint();
  14080. }
  14081. }
  14082. void CMainFrame::PrintTakeForm5(CArray<CStringArray, CStringArray>*Listarray)
  14083. {
  14084. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "婚庆客人明细表";
  14085. int pages = Listarray->GetSize() / 46;
  14086. if (Listarray->GetSize() % 46)pages++;
  14087. for (int aa = 0; aa < pages; aa++)
  14088. {
  14089. PrintPreview dlg;
  14090. CPrintRX m_Print;
  14091. m_Print.InitToPrint(NULL, 1);
  14092. m_Print.StartPrint();
  14093. m_Print.StartPage();
  14094. CRect mainrc(0, 0, 560, 793);
  14095. float fscale;
  14096. {
  14097. int w, h;
  14098. m_Print.GetWidHei(w, h);
  14099. fscale = (float)w / (float)h;
  14100. }
  14101. mainrc.DeflateRect(25, 40, 10, 0);
  14102. CRect rc, rc2;
  14103. rc = mainrc;
  14104. rc.bottom = rc.top;
  14105. rc.top -= 20;
  14106. m_Print.SetFontFace(16, 1, "黑体");
  14107. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14108. m_Print.SetFontFace(8, 1, "宋体");
  14109. CString str;
  14110. int wid[7] = { 165, 90, 90, 45, 45, 60, 35 };
  14111. int hei = 16;
  14112. if (fscale > 0.71)hei = 15;
  14113. rc = mainrc;
  14114. rc.bottom = rc.top + hei;
  14115. for (int i = 0; i < 47; i++)
  14116. {
  14117. rc2.top = rc.top + i*hei;
  14118. rc2.bottom = rc.bottom + i*hei;
  14119. rc2.left = rc.left;
  14120. rc2.right = rc.left + wid[0];
  14121. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14122. for (int j = 0; j<7; j++)
  14123. {
  14124. m_Print.DrawRect2(rc2, 1);
  14125. if (Listarray->GetSize()>aa * 46 + i)
  14126. {
  14127. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14128. rc2.left += 3;
  14129. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14130. rc2.left -= 3;
  14131. }
  14132. rc2.left += wid[j];
  14133. rc2.right = rc2.left + wid[j + 1];
  14134. }
  14135. }
  14136. rc2.top += 2;
  14137. rc2.left += 2; rc2.right = mainrc.right + 4;
  14138. m_Print.SetFontFace(8, 1, "宋体");
  14139. str.Format(" 页:%d/%d", aa + 1, pages);
  14140. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14141. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14142. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14143. dlg.m_pDC = m_Print.GetPDC();
  14144. // dlg.m_mode=1;
  14145. if (aa == 0)
  14146. {
  14147. if (dlg.DoModal() != IDOK)
  14148. return;
  14149. }
  14150. //结束打印
  14151. m_Print.EndPage();
  14152. m_Print.EndPrint();
  14153. }
  14154. }
  14155. void CMainFrame::PrintTakeForm1(CArray<CStringArray, CStringArray>*Listarray)
  14156. {
  14157. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "拍照客人明细表";
  14158. int pages = Listarray->GetSize() / 46;
  14159. if (Listarray->GetSize() % 46)pages++;
  14160. for (int aa = 0; aa < pages; aa++)
  14161. {
  14162. PrintPreview dlg;
  14163. CPrintRX m_Print;
  14164. m_Print.InitToPrint(NULL, 1);
  14165. m_Print.StartPrint();
  14166. m_Print.StartPage();
  14167. CRect mainrc(0, 0, 560, 793);
  14168. float fscale;
  14169. {
  14170. int w, h;
  14171. m_Print.GetWidHei(w, h);
  14172. fscale = (float)w / (float)h;
  14173. }
  14174. mainrc.DeflateRect(25, 40, 10, 0);
  14175. CRect rc, rc2;
  14176. rc = mainrc;
  14177. rc.bottom = rc.top;
  14178. rc.top -= 20;
  14179. m_Print.SetFontFace(16, 1, "黑体");
  14180. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14181. m_Print.SetFontFace(8, 1, "宋体");
  14182. CString str;
  14183. int wid[7] = { 165, 60, 90, 60, 60, 60, 35 };
  14184. int hei = 16;
  14185. if (fscale > 0.71)hei = 15;
  14186. rc = mainrc;
  14187. rc.bottom = rc.top + hei;
  14188. for (int i = 0; i < 47; i++)
  14189. {
  14190. rc2.top = rc.top + i*hei;
  14191. rc2.bottom = rc.bottom + i*hei;
  14192. rc2.left = rc.left;
  14193. rc2.right = rc.left + wid[0];
  14194. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14195. for (int j = 0; j<7; j++)
  14196. {
  14197. m_Print.DrawRect2(rc2, 1);
  14198. if (Listarray->GetSize()>aa * 46 + i)
  14199. {
  14200. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14201. rc2.left += 3;
  14202. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14203. rc2.left -= 3;
  14204. }
  14205. rc2.left += wid[j];
  14206. rc2.right = rc2.left + wid[j + 1];
  14207. }
  14208. }
  14209. rc2.top += 2;
  14210. rc2.left += 2; rc2.right = mainrc.right + 4;
  14211. m_Print.SetFontFace(8, 1, "宋体");
  14212. str.Format(" 页:%d/%d", aa + 1, pages);
  14213. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14214. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14215. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14216. dlg.m_pDC = m_Print.GetPDC();
  14217. // dlg.m_mode=1;
  14218. if (aa == 0)
  14219. {
  14220. if (dlg.DoModal() != IDOK)
  14221. return;
  14222. }
  14223. //结束打印
  14224. m_Print.EndPage();
  14225. m_Print.EndPrint();
  14226. }
  14227. }
  14228. void CMainFrame::ShowMonthForm2()
  14229. {
  14230. }
  14231. // dlg;