MainFrm.cpp 445 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328
  1. // MainFrm.cpp : implementation of the CMainFrame class 员工工作
  2. #include "stdafx.h"
  3. #include "YLGL.h"
  4. #include "resource.h"
  5. #include "MainFrm.h"
  6. #include <afxinet.h>
  7. #include "ConnectDlg.h"
  8. #include "SendDataDlg.h"
  9. #include "DinDanHistroy.h"
  10. #include "ShangPin.h"
  11. #include "SPLBDlg.h"
  12. #include "BuMenDlg.h"
  13. #include "Worker.h"
  14. #include "ShowPic3.h"
  15. #include "TXDlg.h"
  16. #include "TXSPDlg.h"
  17. #include "MsgReg2.h"
  18. #include "ProviderDlg.h"
  19. #include "Booking.h"
  20. #include "Booking2.h"
  21. #include "PayOutSet.h"
  22. #include "PayOutInput.h"
  23. #include "IncomeInput.h"
  24. #include "IncomeInput2.h"
  25. #include "IncomeInput3.h"
  26. #include "IncomeInput4.h"
  27. #include "DressEarlyWarning.h"
  28. #include "annualfee.h"
  29. #include "DailyForm.h"
  30. #include "MonthForm.h"
  31. #include "ProcessAlarm.h"
  32. #include "MonthForm2.h"
  33. #include "YearForm.h"
  34. #include "ClientForm.h"
  35. #include "ClientForm2.h"
  36. #include "ClientForm3.h"
  37. #include "DinDanFrom.h"
  38. #include "Satisfaction.h"
  39. #include "SatisfactionForm.h"
  40. #include "TodayForm.h"
  41. #include "WorkerReport.h"
  42. #include "TodayForm2.h"
  43. #include "SendInsideMsg2.h"
  44. #include "StoreInfoChart.h"
  45. #include "FixedAssets.h"
  46. #include "SPForm.h"
  47. #include "ShowMsg.h"
  48. #include "Account.h"
  49. #include "Login.h"
  50. #include "Login3.h"
  51. #include "Psw.h"
  52. #include "AreaDlg.h"
  53. #include "TakeFrom.h"
  54. #include "ChoosePhotoForm.h"
  55. #include "BeautifySkinFrom.h"
  56. #include "DesignFrom.h"
  57. #include "outsourcing.h"
  58. #include "ChoosePhotoSkin.h"
  59. #include "SalarySet.h"
  60. #include "SalarySet2.h"
  61. #include "MySalary.h"
  62. #include "PrintRX.h"
  63. #include "LoadRect.h"
  64. #include "PrintPreview.h"
  65. #include "SearchClient.h"
  66. #include "BeautifySkinFrom2.h"
  67. #include "FinanceForm.h"
  68. #include "PhotoPrintFrom.h"
  69. #include "SqlDlg.h"
  70. #include "YearForm2.h"
  71. #include "AreaClient.h"
  72. #include "DBConfig.h"
  73. #include "SetPathDlg2.h"
  74. #include "StaffAchievement.h"
  75. #include "BurnCD.h"
  76. #include "StaffAchievementSet.h"
  77. #include "StaffAchievementShowAll.h"
  78. #include "SelContent.h"
  79. #include "ClientMoney.h"
  80. #include "DelPhotoSet.h"
  81. #include "ompanyInfo.h"
  82. #include "ClientForm.h"
  83. #include "PhotoBak.h"
  84. #include "MsgReg.h"
  85. #include "SendMsg.h"
  86. #include "MsgSet.h"
  87. #include "ShowMember.h"
  88. #include "ShowMember2.h"
  89. #include "MemberSet.h"
  90. #include "DressManage.h"
  91. #include "ShowDress.h"
  92. #include "ShowPic.h"
  93. #include "ShowHireReg.h"
  94. #include "InputGoods.h"
  95. #include "ShowGoods.h"
  96. #include "CostCal.h"
  97. #include "Welcome.h"
  98. #include "EmployeeMsg.h"
  99. #include "TXFG.h"
  100. #include "EmployeeForm.h"
  101. #include "EmployeeForm2.h"
  102. #include "Client2Form.h"
  103. #include "Client2FormLYFZ.h"
  104. #include "OldClient.h"
  105. #include "ClientReasonChart.h"
  106. #include "ClientFromChart.h"
  107. #include "WorkMsg.h"
  108. #include "SetLoginTime.h"
  109. #include "SetLoginBan.h"
  110. #include "LoginReg.h"
  111. #include "LoginReg2.h"
  112. #include "PhoneRecord.h"
  113. #include "PhoneRecordOut.h"
  114. #include "MissCall.h"
  115. #include "InsideMsg.h"
  116. #include "Card2Reg.h"
  117. #include "Card2RegChart.h"
  118. #include "ShowMemberBlue.h"
  119. #include "Card2RegBlue.h"
  120. #include "Card2RegChartBlue.h"
  121. #include "DigitalWork.h"
  122. #include "HideWindow.h"
  123. #include "SalarySet3.h"
  124. #include "YearFormBranch.h"
  125. #include "YearFormBranch2.h"
  126. #include "Set.h"
  127. #include "DinDanFromBranch.h"
  128. #include "MemberChart.h"
  129. #include "ShowMemberMsg.h"
  130. #include "ShowBakState.h"
  131. #include "DinDanForm.h"
  132. #include "CalendarConvert.h"
  133. #include "ShowLOg.h"
  134. #include "HospitalClient.h"
  135. #include "HospitalClientAlarm.h"
  136. #include "HospitalInfoSet.h"
  137. #include "AddHospitalClient.h"
  138. #include "HospitalClientMsg.h"
  139. #include "StaffInfo.h"
  140. #include "DlgServiceTracking.h"
  141. #include "DlgCheckInDaily.h"
  142. #include "DlgServiceRecord.h"
  143. #include "DlgServicesStatistics.h"
  144. #ifdef _DEBUG
  145. #define new DEBUG_NEW
  146. #undef THIS_FILE
  147. static char THIS_FILE[] = __FILE__;
  148. #endif
  149. #ifndef WINVER
  150. #define WINVER 0x0400
  151. #endif
  152. #ifndef _WIN32_WINNT
  153. #define _WIN32_WINNT 0x0400
  154. #endif
  155. #ifndef _WIN32_WINDOWS
  156. #define _WIN32_WINDOWS 0x0410
  157. #endif
  158. #ifndef _WIN32_IE
  159. #define _WIN32_IE 0x0400
  160. #endif
  161. #include "uxtheme.h "
  162. typedef HTHEME(__stdcall * POPENTHEMEDATA)(HWND hwnd, LPCWSTR pszClassList);
  163. typedef HRESULT(__stdcall * PCLOSETHEMEDATA)(HTHEME hTheme);
  164. HHOOK g_hmouse = NULL; //g_sendhead zx.dll
  165. //extern void WriteClientLog(CString str); // Jeff写客户端日志;
  166. // Jeff.remark;
  167. // 函数:MouseProc
  168. // 参数:
  169. // nCode hook code
  170. // wParam message identifier
  171. // lParam mouse coordinates
  172. // 返回:
  173. //
  174. LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam)
  175. {
  176. if (g_pMainWnd)
  177. {
  178. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(133)) && atoi(g_cominfoarray.ElementAt(0).ElementAt(134)) > 1)
  179. {
  180. g_pMainWnd->KillTimer(5);
  181. g_pMainWnd->SetTimer(5, atoi(g_cominfoarray.ElementAt(0).ElementAt(134)) * 60 * 1000, NULL);
  182. }
  183. if (g_bSendLYFZ)
  184. {
  185. g_pMainWnd->KillTimer(7);
  186. g_pMainWnd->SetTimer(7, 5 * 60 * 1000, NULL);
  187. }
  188. }
  189. return CallNextHookEx(g_hmouse, nCode, wParam, lParam);
  190. }
  191. CRect g_rc; // 屏幕坐标值,区域是放置对话框。
  192. CMainFrame *g_pMainWnd = NULL;
  193. extern HWND g_hSendWnd;
  194. extern HWND g_hConnectWnd;
  195. //extern CString newGUID();
  196. /////////////////////////////////////////////////////////////////////////////
  197. // CMainFrame客人付款
  198. /////////////////////////////////////////////////////////////////////////////
  199. /////////////////////////////////////////////////////////////////////////////
  200. static void HandleClientNetEvent(IN SOCKET hSocket,
  201. IN ETransportEvent eEvent,
  202. IN void *pDataBuf,
  203. IN unsigned long nDataLen,
  204. IN int nError,
  205. IN void *pContext)
  206. {
  207. if (nError != TRANSPORT_OK)
  208. return;
  209. CMainFrame *pDlg = (CMainFrame *)pContext;
  210. if (NULL == pDlg)
  211. return;
  212. pDlg->ProcessNetEvent(eEvent, pDataBuf, nDataLen);
  213. }
  214. BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam)
  215. {
  216. CRect rtCtrl, rtWnd; // 子窗口,父窗口;
  217. if (hwnd)
  218. {
  219. ::GetWindowRect(hwnd, &rtCtrl); // 获取控件大小;
  220. ::GetWindowRect(GetParent(hwnd), &rtWnd); // 获取父窗口大小;
  221. // printf("Jeff:g_WidthScale=%d,g_HeightScale=%d,rtWnd.left=%d,rtWnd.top=%d\n\n",g_WidthScale,g_HeightScale,rtWnd.left,rtWnd.top);
  222. // 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);
  223. rtCtrl.OffsetRect(-rtWnd.left, -rtWnd.top);
  224. float temp;
  225. temp = (float)rtCtrl.left*g_WidthScale;
  226. rtCtrl.left = (int)temp + g_dx;
  227. temp = (float)rtCtrl.top*g_HeightScale;
  228. rtCtrl.top = (int)temp + g_dy;
  229. temp = (float)rtCtrl.right*g_WidthScale;
  230. rtCtrl.right = (int)temp + g_dx;
  231. temp = (float)rtCtrl.bottom*g_HeightScale;
  232. rtCtrl.bottom = (int)temp + g_dy;
  233. //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);
  234. ::MoveWindow(hwnd, rtCtrl.left, rtCtrl.top, rtCtrl.Width(), rtCtrl.Height(), TRUE);
  235. return TRUE;
  236. }
  237. else
  238. {
  239. return FALSE;
  240. }
  241. }
  242. IMPLEMENT_DYNCREATE(CMainFrame, CMDIFrameWnd)
  243. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  244. //{{AFX_MSG_MAP(CMainFrame)
  245. ON_WM_CREATE()
  246. ON_WM_DESTROY()
  247. ON_WM_CLOSE()
  248. ON_WM_TIMER()
  249. ON_COMMAND(IDM_choosephotoskin, Onchoosephotoskin)
  250. ON_COMMAND(IDM_PATH, OnPath)
  251. ON_COMMAND(IDM_SERVER, OnServer)
  252. ON_COMMAND(IDM_SHOWHIS, OnShowhis)
  253. ON_COMMAND(IDM_StaffAchievementShow, OnStaffAchievementShow)
  254. ON_COMMAND(IDM_AUTODELPHOTO, OnAutodelphoto)
  255. ON_COMMAND(IDM_PHOTOMANAGE, Onphotomanage)
  256. ON_COMMAND(IDM_COMPANYINFO, OnCompanyinfo)
  257. ON_COMMAND(IDM_HELPFILE, OnHelpfile)
  258. ON_COMMAND(IDM_PHOTOBAK, OnPhotobak)
  259. ON_COMMAND(IDM_TAOXIFG, OnTaoxifg)
  260. ON_COMMAND(IDM_ShowBakState, OnShowBakState)
  261. ON_WM_NCLBUTTONDBLCLK()
  262. ON_WM_NCHITTEST()
  263. ON_COMMAND(IDM_LOG, OnLog)
  264. //}}AFX_MSG_MAP
  265. ON_COMMAND_RANGE(0, 50000, OnCommandMenu)
  266. END_MESSAGE_MAP()
  267. static UINT indicators[] =
  268. {
  269. ID_SEPARATOR, // status line indicator
  270. ID_INDICATOR_CAPS,
  271. ID_INDICATOR_NUM,
  272. ID_INDICATOR_SCRL,
  273. };
  274. /////////////////////////////////////////////////////////////////////////////
  275. // CMainFrame construction/destruction
  276. #if defined(VC70) || defined(VC60)
  277. UINT CMainFrame::OnNcHitTest(CPoint point)
  278. {
  279. if (CWnd::OnNcHitTest(point) == HTRIGHT || CWnd::OnNcHitTest(point) == HTLEFT || CWnd::OnNcHitTest(point) == HTTOP || CWnd::OnNcHitTest(point) == HTBOTTOM)
  280. return HTCLIENT;
  281. return CWnd::OnNcHitTest(point);
  282. }
  283. #else
  284. LRESULT CMainFrame::OnNcHitTest(CPoint point)
  285. {
  286. if (CWnd::OnNcHitTest(point) == HTRIGHT || CWnd::OnNcHitTest(point) == HTLEFT || CWnd::OnNcHitTest(point) == HTTOP || CWnd::OnNcHitTest(point) == HTBOTTOM)
  287. return HTCLIENT;
  288. return CWnd::OnNcHitTest(point);
  289. }
  290. #endif
  291. void CMainFrame::OnNcLButtonDblClk(UINT nFlags, CPoint point)
  292. {
  293. if (nFlags != HTCAPTION)
  294. CMDIFrameWnd::OnNcLButtonDblClk(nFlags, point);
  295. }
  296. CMainFrame::CMainFrame()
  297. {
  298. // TODO: add member initialization code here
  299. SetConnectionID(INVALID_SOCKET);
  300. m_pMainFrimDlg2 = NULL;
  301. CString version = _T("Version 1.0");
  302. m_bCheckF2F3 = AfxGetApp()->GetProfileInt(version, "f2f3", 0);
  303. if (0 == ::PathFileExists(g_mainpath + "\\skin\\5.lia"))
  304. {
  305. g_bNoLoginLia = 1;
  306. }
  307. }
  308. CMainFrame::~CMainFrame()
  309. {
  310. if (m_pMainFrimDlg2)
  311. {
  312. m_pMainFrimDlg2->DestroyWindow();
  313. delete m_pMainFrimDlg2;
  314. }
  315. }
  316. // void LoadImageFromFile(Bitmap **img, CString path)
  317. // {
  318. // try
  319. // {
  320. // if (!PathFileExists(path))return;
  321. // if (*img)delete *img;
  322. // *img = NULL;
  323. // BSTR bstr = path.AllocSysString();
  324. // *img = Bitmap::FromFile(bstr);
  325. // SysFreeString(bstr);
  326. // }
  327. // catch (...)
  328. // {
  329. // }
  330. // }
  331. void InTheMe(HWND m_hWnd)
  332. {
  333. BOOL bXpVisualStyle = FALSE;
  334. OSVERSIONINFO osvi;
  335. osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  336. ::GetVersionEx(&osvi);
  337. if ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) && (osvi.dwMajorVersion >= 5) && (osvi.dwMinorVersion >= 1))
  338. {
  339. HMODULE hUxTheme = ::LoadLibrary(_T("UxTheme.dll"));
  340. POPENTHEMEDATA pOpenThemeData;
  341. PCLOSETHEMEDATA pCloseThemeData;
  342. if (hUxTheme != NULL)
  343. {
  344. pOpenThemeData = (POPENTHEMEDATA)::GetProcAddress(hUxTheme, "OpenThemeData");
  345. pCloseThemeData = (PCLOSETHEMEDATA)::GetProcAddress(hUxTheme, "CloseThemeData");
  346. HTHEME hButtonTheme = (*pOpenThemeData)(m_hWnd, L"BUTTON");
  347. if (hButtonTheme != NULL)
  348. bXpVisualStyle = TRUE;
  349. (*pCloseThemeData)(hButtonTheme);
  350. }
  351. ::FreeLibrary(hUxTheme);
  352. }
  353. if (bXpVisualStyle)
  354. AfxMessageBox(_T("正在使用视觉主题 "));
  355. else
  356. AfxMessageBox(_T("没有使用视觉主题 "));
  357. }
  358. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  359. {
  360. if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  361. {
  362. // Jeff.创建失败的可能性小,加日志输出;
  363. return -1;
  364. }
  365. #if 0 // 超时;
  366. if (g_server.Find(".ly.com") != -1)
  367. {
  368. g_ntimeout = 30000;
  369. }
  370. #endif
  371. if (::PathFileExists(g_mainpath + "\\logo.ico"))
  372. {
  373. Bitmap *bmp = NULL;
  374. LoadImageFromFile(&bmp, g_mainpath + "\\logo.ico");
  375. // m_hIcon = AfxGetApp()->LoadIcon(g_mainpath+"\\logo.ico");
  376. bmp->GetHICON(&m_hIcon);
  377. delete bmp;
  378. SetIcon(m_hIcon, TRUE); // Set big icon
  379. SetIcon(m_hIcon, FALSE); // Set small icon
  380. }
  381. if (!m_wndClient.SubclassWindow(m_hWndMDIClient))
  382. {
  383. // Jeff.创建失败的可能性小,加日志输出;
  384. return -1;
  385. }
  386. if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  387. | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  388. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  389. {
  390. // Jeff.创建失败的可能性小,加日志输出;
  391. TRACE0("Failed to create toolbar\n");
  392. return -1; // fail to create
  393. }
  394. m_wndToolBar.LoadTrueColorToolBar(90, IDB_NORMAL, 0, IDB_DISABLE);
  395. // second toolbar must have different ID
  396. if (!m_wndToolBar2.Create(this, WS_CHILD | WS_VISIBLE | CBRS_LEFT | CBRS_NOALIGN,
  397. AFX_IDW_CONTROLBAR_FIRST + 32) ||
  398. !m_wndToolBar2.LoadToolBar(IDR_TOOLBAR1))
  399. {
  400. // Jeff.创建失败的可能性小,加日志输出;
  401. TRACE0("Failed to create toolbar\n");
  402. return -1; // fail to create
  403. }
  404. #ifndef NEW_SKIN
  405. if (!m_wndStatusBar.Create(this) ||
  406. !m_wndStatusBar.SetIndicators(indicators,
  407. sizeof(indicators)/sizeof(UINT)))
  408. {
  409. // Jeff.创建失败的可能性小,加日志输出;
  410. TRACE0("Failed to create status bar\n");
  411. return -1; // fail to create
  412. }
  413. m_wndStatusBar.SetPaneInfo(1,ID_INDICATOR_USER,SBPS_NORMAL,200);
  414. m_wndStatusBar.SetPaneText(1,"未登录",TRUE);
  415. #endif
  416. // TODO: Delete these three lines if you don't want the toolbar to
  417. // be dockable
  418. NewMenu2();
  419. ::GetWindowRect(this->m_hWndMDIClient, g_rc);
  420. /* CString ss;
  421. ss.Format ("%d,%d,%d,%d", g_rc.left , g_rc.top , g_rc.right , g_rc.bottom );
  422. AfxMessageBox(ss);*/
  423. g_pMainWnd = this;
  424. m_wndToolBar2.Init();
  425. g_rc.top += 38;
  426. g_rc.left += 160;
  427. /* m_WidthScale = (float)g_rc.Width ()/722;
  428. m_HeightScale = (float)g_rc.Height ()/533;*/
  429. g_user.bLongin = 0;
  430. SetTimer(1, 100, NULL);
  431. return 0;
  432. }
  433. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  434. {
  435. if (!CMDIFrameWnd::PreCreateWindow(cs))
  436. return FALSE;
  437. // TODO: Modify the Window class or styles here by modifying
  438. // the CREATESTRUCT cs
  439. cs.style &= ~WS_MAXIMIZEBOX;
  440. cs.style &= ~WS_THICKFRAME;
  441. cs.lpszName = g_title + "影楼管理系统";
  442. cs.style &= ~FWS_ADDTOTITLE;
  443. RECT rect;
  444. HWND hWnd = ::FindWindow("Shell_TrayWnd", 0);
  445. ::GetWindowRect(hWnd, &rect);
  446. cs.x = 0;
  447. cs.y = 0;
  448. cs.cx = GetSystemMetrics(SM_CXSCREEN);
  449. cs.cy = GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top) + 3;
  450. return TRUE;
  451. }
  452. /////////////////////////////////////////////////////////////////////////////
  453. // CMainFrame diagnostics
  454. #ifdef _DEBUG
  455. void CMainFrame::AssertValid() const
  456. {
  457. CMDIFrameWnd::AssertValid();
  458. }
  459. void CMainFrame::Dump(CDumpContext& dc) const
  460. {
  461. CMDIFrameWnd::Dump(dc);
  462. }
  463. #endif //_DEBUG
  464. /////////////////////////////////////////////////////////////////////////////
  465. // CMainFrame message handlers
  466. void CMainFrame::OnDestroy()
  467. {
  468. OnDisconnect();
  469. Transport_UnInit();
  470. m_Mdi.DeleteAll();
  471. if (g_hmouse)UnhookWindowsHookEx(g_hmouse);
  472. CMDIFrameWnd::OnDestroy();
  473. }
  474. void CMainFrame::OnClose()
  475. {
  476. g_bShowBar = 0;
  477. if (m_Mdi.MainClose())
  478. CMDIFrameWnd::OnClose();
  479. }//连接
  480. void CMainFrame::NewMenu2()
  481. {
  482. CMenu *pMemu = GetMenu();
  483. #ifdef BASIC_VERSION
  484. CMenu* submenu = pMemu->GetSubMenu(1);
  485. //submenu->RemoveMenu (IDM_StaffAchievementShow, MF_BYCOMMAND );//Jeff del 2014.06.16
  486. submenu->RemoveMenu (IDM_salaryset, MF_BYCOMMAND );
  487. #endif
  488. #if 0 // 此机用选片菜单项,去掉不用;
  489. {
  490. CString version = _T("Version 1.0");
  491. BOOL checked=AfxGetApp()->GetProfileInt (version, "status", 0);
  492. if(checked)
  493. {
  494. CMenu* submenu = pMemu->GetSubMenu(1);
  495. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  496. }
  497. }
  498. #endif
  499. #ifndef BASIC_VERSION
  500. {
  501. CString version = _T("Version 1.0");
  502. BOOL checked = AfxGetApp()->GetProfileInt(version, "status2", 0);
  503. if (checked)
  504. {
  505. #if 0 // Jeff:去掉菜单,此机用于员工业绩查看的菜单选项;
  506. CMenu* submenu = pMemu->GetSubMenu(1);
  507. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  508. #endif
  509. g_bStaffAchievementShow = 1;
  510. SetTimer(3, 100, NULL);
  511. }
  512. }
  513. #endif
  514. if (g_bShowOK == 0)
  515. {
  516. CMenu* submenu = pMemu->GetSubMenu(2);
  517. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  518. }
  519. }
  520. HMENU CMainFrame::NewMenu()
  521. {
  522. //设置菜单为XP风格 IDM_SHOWHIS
  523. BCMenu::SetMenuDrawMode(1);
  524. //若取消下面这句注释,则可看到菜单的图标栏和文字栏背景颜色为白色,
  525. //文字颜色为蓝色,选中项的前景色为紫红色
  526. //m_menuXP.SetMenuXPItemColor(0x00FFFFFF,0x00FFFFFF,0x00FF0000,0x00FF00FF);
  527. // 设置菜单中图标大小为32×32
  528. // m_menuXP.SetIconSize(32,32);
  529. // 加载菜单资源
  530. m_menuXP.LoadMenu(IDR_MAINFRAME);
  531. // 加载菜单对应的工具栏资源
  532. // m_menuXP.LoadToolbar(IDR_MAINFRAME);
  533. /*由于菜单左边栏中默认的图标大小为16×16,而与之对应的Toolbar中图标大小为32×32,
  534. 因此菜单中图标不能正确显示,只显示出工具栏中图标的左上角部分,所以修改菜单中各
  535. 项对应的图标为24b色位图资源IDB_***,或者在LoadMenu之前调用SetIconSize,设置菜单
  536. 中图标大小为32×32*/
  537. // m_menuXP.SetIconSize(24,24);
  538. // m_menuXP.ModifyODMenu(NULL,IDM_YWBU,IDB_YW); //
  539. /* m_menuXP.ModifyODMenu(NULL,ID_FILE_OPEN,IDB_BITMAP5);
  540. m_menuXP.ModifyODMenu(NULL,ID_FILE_SAVE,IDB_BITMAP7);
  541. m_menuXP.ModifyODMenu(NULL,ID_FILE_PRINT,IDB_BITMAP6);
  542. m_menuXP.ModifyODMenu(NULL,ID_APP_ABOUT,IDB_BITMAP3);
  543. m_menuXP.ModifyODMenu(NULL,ID_APP_EXIT,IDB_BITMAP2);*/
  544. // m_menuXP.EnableMenuItem (0, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  545. // m_menuXP.EnableMenuItem (2, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  546. // m_menuXP.EnableMenuItem (3, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  547. // m_menuXP.EnableMenuItem (4, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  548. // m_menuXP.EnableMenuItem (5, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  549. // m_menuXP.EnableMenuItem (8, MF_BYPOSITION | MF_GRAYED | MF_DISABLED );
  550. #if 0 // Jeff此机用选片菜单项不用;
  551. {
  552. CString version = _T("Version 1.0");
  553. BOOL checked=AfxGetApp()->GetProfileInt (version, "status", 0);
  554. if(checked)
  555. {
  556. CMenu* submenu = m_menuXP.GetSubMenu(1);
  557. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  558. }
  559. }
  560. #endif
  561. {
  562. CString version = _T("Version 1.0");
  563. BOOL checked = AfxGetApp()->GetProfileInt(version, "status2", 0);
  564. if (checked)
  565. {
  566. #if 0 // Jeff:去掉此机用于员工业绩查看的菜单选项;
  567. CMenu* submenu = m_menuXP.GetSubMenu(1);
  568. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  569. #endif
  570. g_bStaffAchievementShow = 1;
  571. SetTimer(3, 100, NULL);
  572. }
  573. }
  574. if (g_bShowOK == 0)
  575. {
  576. CMenu* submenu = m_menuXP.GetSubMenu(2);
  577. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  578. }
  579. return(m_menuXP.Detach());
  580. }
  581. ///////////////////////////////////////////////////////
  582. //减少代码
  583. #define OPEN_MENU(x) m_Mdi.Append(pName, RUNTIME_CLASS(x), IDR_MAINFRAME, this, nID)
  584. //响应菜单命令
  585. void CMainFrame::OnCommandMenu(UINT nID)
  586. {
  587. if (nID >= 2000 && nID <= 2100)
  588. {
  589. OnBranchData(nID);
  590. return;
  591. }
  592. if (g_user.bLongin == 0)
  593. {
  594. if (g_bNoLoginLia)
  595. {
  596. Login dlg;
  597. dlg.SetLiaPath("5.lia");
  598. dlg.DoModal();
  599. }
  600. else
  601. {
  602. Login3 dlg;
  603. dlg.SetLiaPath("5.lia");
  604. dlg.DoModal();
  605. }
  606. return;
  607. if (g_user.bLongin == 0)return;
  608. }
  609. else
  610. {
  611. InsideMsg();
  612. }
  613. ResetTimer();
  614. if (nID >= 1000 && nID <= 1100)
  615. {
  616. OnHistory(nID);
  617. return;
  618. }
  619. LPSTR pName;
  620. //打开窗口
  621. switch (nID)
  622. {
  623. case IDM_PayOutSet:
  624. {
  625. if (IsHasRights(16) == 0)return;
  626. PayOutSet dlg;
  627. dlg.DoModal();
  628. return;
  629. }
  630. case IDM_SPLB:
  631. {
  632. if (IsHasRightsnew(29) == 0)return;
  633. SPLBDlg dlg;
  634. dlg.DoModal();
  635. return;
  636. }
  637. case IDM_JD:
  638. {
  639. if (IsHasRightsnew(49) == 0)return;
  640. SPLBDlg dlg;
  641. dlg.m_mode = 1;
  642. dlg.DoModal();
  643. return;
  644. }
  645. case IDM_AREA:
  646. {
  647. if (IsHasRightsnew(47) == 0)return;
  648. AreaDlg dlg;
  649. dlg.DoModal();
  650. return;
  651. }
  652. case IDM_Psw:
  653. {
  654. Psw dlg;
  655. dlg.DoModal();
  656. return;
  657. }
  658. case IDM_Set:
  659. {
  660. if (IsHasRightsnew(49) == 0)return;
  661. /* if(g_bBranchModify)
  662. {
  663. AfxMessageBox("系统设置不支持远程访问,请直接访问该分店!", MB_ICONINFORMATION);
  664. return;
  665. }*/
  666. Set dlg;
  667. dlg.DoModal();
  668. //if(dlg.DoModal() != IDOK)
  669. //{
  670. //AfxMessageBox("789");
  671. //Set::SetCancle();
  672. //}
  673. return;
  674. }
  675. case IDM_HIDEWINDOW:
  676. {
  677. HideWindow dlg;
  678. dlg.DoModal();
  679. return;
  680. }
  681. case IDM_Logout:// Jeff.注销;
  682. {
  683. WriteLog(_T("普通日志"), _T("退出系统"), g_user.name, _T("退出系统"));
  684. g_user.bLongin = 0;
  685. g_user.name.Empty();
  686. g_user.rights.Empty();
  687. g_user.account.Empty();
  688. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  689. g_pMainWnd2->RefreshOutlookBar();
  690. #ifndef NEW_SKIN
  691. m_wndStatusBar.SetPaneText(1, "未登录", TRUE);
  692. #endif
  693. m_Mdi.CloseAll();
  694. #ifdef ENTERPRISE_VERSION
  695. g_branchname.Empty();
  696. g_branchip.Empty();
  697. g_pMainWnd->OnDisconnect();
  698. g_bBranchModify = 0;
  699. #endif
  700. if (g_pMainWnd2)
  701. {
  702. g_pMainWnd2->DrawLogin();
  703. g_pMainWnd2->ShowBar(0);
  704. }
  705. g_hisyeararray.RemoveAll();
  706. g_pMainWnd->AddHistoryMenu(&g_hisyeararray);
  707. g_brancharray.RemoveAll();
  708. g_pMainWnd->AddBranchMenu(&g_brancharray);
  709. if (g_bNoLoginLia)
  710. {
  711. Login dlg;
  712. dlg.SetLiaPath("5.lia");
  713. dlg.DoModal();
  714. }
  715. else
  716. {
  717. Login3 dlg;
  718. dlg.SetLiaPath("5.lia");
  719. dlg.DoModal();
  720. }
  721. if (g_user.bLongin == 0)
  722. if (g_pMainWnd2)g_pMainWnd2->ShowBar(1);
  723. return;
  724. }
  725. case IDM_TODAY:
  726. pName = (LPSTR)(LPCSTR)"历史订单";
  727. // OPEN_MENU(SalarySet3);
  728. OPEN_MENU(DinDanHistroy);
  729. break;
  730. case IDM_TAKECONTROL:
  731. pName = (LPSTR)(LPCSTR)"摄控表";
  732. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(117)))
  733. OPEN_MENU(TodayForm2);
  734. else
  735. OPEN_MENU(TodayForm);
  736. break;
  737. case IDM_CLIENTMONEY:
  738. pName = (LPSTR)(LPCSTR)"客人付款";
  739. OPEN_MENU(ClientMoney);
  740. break;
  741. case IDM_TAKEAWAYBOOK:
  742. pName = (LPSTR)(LPCSTR)"发片/取件";
  743. OPEN_MENU(outsourcing);
  744. break;
  745. case IDM_CODE:
  746. pName = (LPSTR)(LPCSTR)"商品报表";
  747. OPEN_MENU(SPForm);
  748. break;
  749. case IDM_Daily:
  750. // if(IsHasRightsnew(22)==0)return;
  751. // pName = (LPSTR)(LPCSTR)"日财务表";
  752. // OPEN_MENU(DailyForm);
  753. pName = (LPSTR)(LPCSTR)"沟通助手";
  754. OPEN_MENU(InsideMsg);
  755. break;
  756. case IDM_ProcessAlarm:
  757. pName = (LPSTR)(LPCSTR)"流程监控";
  758. OPEN_MENU(ProcessAlarm);
  759. break;
  760. case IDM_DINDAN:
  761. // if(IsHasRights(7)==0)return;
  762. pName = (LPSTR)(LPCSTR)"订单报表";
  763. OPEN_MENU(DinDanFrom);
  764. break;
  765. case IDM_CLIENT:
  766. //if(IsHasRights(8)==0)return;
  767. pName = (LPSTR)(LPCSTR)"客户报表";
  768. OPEN_MENU(CClientForm);
  769. break;
  770. case IDM_PayOutInput:
  771. if (IsHasRightsnew(20) == 0)return;
  772. pName = (LPSTR)(LPCSTR)"现金支出";
  773. OPEN_MENU(PayOutInput);
  774. break;
  775. case IDM_salaryset:
  776. if (IsHasRightsnew(25) == 0)return;
  777. pName = (LPSTR)(LPCSTR)"工资设置";
  778. OPEN_MENU(SalarySet);
  779. break;
  780. case IDM_mysalary:
  781. if (IsHasRights(16) == 0)return;
  782. pName = (LPSTR)(LPCSTR)"我的工资";
  783. OPEN_MENU(MySalary);
  784. break;
  785. case IDM_SP:
  786. // if(IsHasRightsnew(29)==0)return;
  787. pName = (LPSTR)(LPCSTR)"商品设置";
  788. OPEN_MENU(ShangPin);
  789. break;
  790. case IDM_WORKER:
  791. {
  792. if (IsHasRightsnew(27) == 0)return;
  793. pName = (LPSTR)(LPCSTR)"员工设置";
  794. //OPEN_MENU(Worker);
  795. //OPEN_MENU(CStaffInfo);
  796. CStaffInfo dlg;
  797. dlg.DoModal();
  798. return;
  799. }
  800. break;
  801. case IDM_TAOXI:
  802. if (IsHasRightsnew(30) == 0)return;
  803. pName = (LPSTR)(LPCSTR)"套系设置";
  804. OPEN_MENU(TXDlg);
  805. break;
  806. case IDM_TAOXISP:
  807. if (IsHasRightsnew(30) == 0)return;
  808. pName = (LPSTR)(LPCSTR)"套系赠送商品设置";
  809. OPEN_MENU(TXSPDlg);
  810. break;
  811. case IDM_Provider:
  812. if (IsHasRightsnew(32) == 0)return;
  813. pName = (LPSTR)(LPCSTR)"供应商设置";
  814. OPEN_MENU(ProviderDlg);
  815. break;
  816. case IDM_BUMEN:
  817. {
  818. if (IsHasRightsnew(49) == 0)return;
  819. BuMenDlg dlg;
  820. dlg.DoModal();
  821. return;
  822. }
  823. case IDM_Account:
  824. if (IsHasRightsnew(49) == 0)return;
  825. pName = (LPSTR)(LPCSTR)"账号管理";
  826. OPEN_MENU(Account);
  827. break;
  828. case IDM_YLCD:
  829. {
  830. //AfxMessageBox("IDM_YLCD");
  831. ::CopyFile(_T(g_path7 + "\\接单系统\\Regsvr32.exe"), _T(g_mainpath + "\\Regsvr32.exe"), 0);
  832. ::CopyFile(_T(g_path7 + "\\接单系统\\Flash9f.ocx"), _T(g_mainpath + "\\Flash9f.ocx"), 0);
  833. CString temp;
  834. temp.Format("%s\\regsvr32.exe /s %s\\Flash9f.OCX", g_mainpath, g_mainpath);
  835. WinExec(temp, SW_HIDE);
  836. ::CopyFile(_T(g_path7 + "\\接单系统\\接单系统.exe"), _T(g_mainpath + "\\接单系统.exe"), 0);
  837. ::CopyFile(_T(g_path7 + "\\接单系统\\my32.dll"), _T(g_mainpath + "\\my32.dll"), 0);
  838. ::CopyFile(_T(g_path7 + "\\接单系统\\server.dat"), _T(g_mainpath + "\\server.dat"), 0);
  839. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\接单系统.exe"), g_server, NULL, SW_SHOWNORMAL);
  840. }
  841. break;
  842. case IDM_YLCDMANAGE:
  843. ::CopyFile(_T(g_path7 + "\\接单系统\\资源管理器.exe"), _T(g_mainpath + "\\资源管理器.exe"), 0);
  844. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\资源管理器.exe"), g_server, NULL, SW_SHOWNORMAL);
  845. break;
  846. }
  847. }
  848. //减少代码
  849. ///////////////////////////////////////////////////////////////////////////////
  850. void CMainFrame::OnDisconnect()
  851. {
  852. m_tClientTunnel.net_CloseSocket();
  853. SetConnectionID(INVALID_SOCKET);
  854. }
  855. void CMainFrame::ProcessLoginResponse(void *pLoginResult)
  856. {
  857. //printf("Jeff:ProcessLoginResponse\n\n");//Jeff Printf;
  858. if (NULL == pLoginResult) return;
  859. LOGIN_RESULT_STRU *ptLoginResult = (LOGIN_RESULT_STRU *)pLoginResult;
  860. DWORD dwConnectionID = ptLoginResult->tCommonMsg.dwConnectionID;
  861. SetConnectionID(dwConnectionID);
  862. BYTE byResult = ptLoginResult->byResult;
  863. if (LOGIN_RESULT_SUC == byResult)
  864. {
  865. //AfxMessageBox("登录成功"); // Jeff test;
  866. }
  867. else
  868. {
  869. OnDisconnect();
  870. }
  871. }
  872. //-------------------------------------------------------------------
  873. // Remark by Jeff: 2014.10.18
  874. // 函数:ProcessLoginRequest
  875. // 描述:登陆服务器;
  876. // 参数:
  877. // nSrvType:登陆服务器的协议类型;
  878. // 0000 0000: 表示登陆本地服务器;
  879. // 0000 0001: 表示登陆远程服务器(lijiafz.vicp.net等);
  880. //
  881. // 返回:登陆成功返回TRUE;
  882. //
  883. //-------------------------------------------------------------------
  884. BOOL CMainFrame::ProcessLoginRequest()
  885. {
  886. // 1.设置通信类型MSG_LOGIN_REQ,为登陆请求;
  887. WORD wMessageId = 0;
  888. if (g_conntype == 0 && !g_bConnLYFZ)
  889. wMessageId = (MSG_LOGIN_REQ + 0X1FFF);
  890. else// if (g_bConnLYFZ )
  891. wMessageId = MSG_LOGIN_REQ;
  892. // 2.填充发送数据;
  893. TLOGIN_STRU tLogonInfo = { 0 };
  894. tLogonInfo.tCommonMsg.dwConnectionID = GetConnectionID();//此时m_dwConnectionID为INVALIDE_SOCKET;
  895. tLogonInfo.tCommonMsg.wMessageId = wMessageId;
  896. CString strUserName = newGUID();// 以随机数作为登陆时的用户名称;
  897. strUserName.TrimLeft();
  898. strUserName.TrimRight();
  899. strcpy(tLogonInfo.tUserInfo.szUserName, strUserName);
  900. DWORD dwDataLen = sizeof(TLOGIN_STRU);
  901. // 3.填充数据头;
  902. TMessageHeader tHeader = { 0 };
  903. tHeader.wMessageId = wMessageId;
  904. tHeader.dwDataLen = dwDataLen;
  905. // 4.发送数据;
  906. unsigned long ulSendLen = m_tClientTunnel.net_Send(&tHeader, (void *)&tLogonInfo, dwDataLen);
  907. if (ulSendLen == SOCKET_ERROR)
  908. {
  909. return 0;
  910. }
  911. return 1;
  912. }
  913. DWORD CMainFrame::GetConnectionID()
  914. {
  915. return m_dwConnectionID;
  916. }
  917. void CMainFrame::SetConnectionID(DWORD dwConnection)
  918. {
  919. m_dwConnectionID = dwConnection;
  920. }
  921. //*********************************************//
  922. /*
  923. 函数:ProcessChatMessageRequest2
  924. 参数:BYTE code [IN]
  925. 返回:无
  926. 过程:OnConnect() -> ProcessChatMessageRequest()
  927. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  928. 2.SendDataDlg计时器里调用CConnectDlg对话框
  929. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  930. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  931. 5.关闭对话框和断开连接;
  932. */
  933. //*********************************************//
  934. void CMainFrame::ProcessChatMessageRequest2(BYTE code)
  935. {
  936. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  937. SendDataDlg dlg;
  938. dlg.m_bycode = code;
  939. dlg.DoModal();
  940. }
  941. //*********************************************//
  942. /*
  943. 函数:ProcessChatMessageRequest2
  944. 参数:CString sql [IN]
  945. 返回:无
  946. 过程:OnConnect() -> ProcessChatMessageRequest()
  947. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  948. 2.SendDataDlg计时器里调用CConnectDlg对话框
  949. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  950. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  951. 5.关闭对话框和断开连接;
  952. */
  953. //*********************************************//
  954. void CMainFrame::ProcessChatMessageRequest2(CString sql)
  955. {
  956. if ((sql.Find("insert") != -1 || sql.Find("update") != -1 || sql.Find("delete") != -1) && g_branchname != "" && g_bBranchModify == 0)
  957. {
  958. AfxMessageBox("当前为分店数据查看状态,不能更改分店数据!", MB_ICONSTOP);
  959. g_bSendOK = 0;
  960. return;
  961. }
  962. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  963. SendDataDlg dlg;
  964. dlg.m_strSQL = sql;
  965. dlg.DoModal();
  966. }
  967. //*********************************************//
  968. /*
  969. 函数:ProcessChatMessageRequest2
  970. 参数:BYTE *pData [IN], int length [IN]
  971. 返回:无
  972. 过程:OnConnect() -> ProcessChatMessageRequest()
  973. 1.SetTimer(2)作用:调用计时器,指定超时后关闭SendDataDlg和CConnectDlg对话框,并断开连接;
  974. 2.SendDataDlg计时器里调用CConnectDlg对话框
  975. 3.CConnectDlg计时器调用主框架函数BOOL CMainFrame::OnConnect()进行服务连接工作;
  976. 4.最后SendDataDlg调用主框架函数BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)发送数据;
  977. 5.关闭对话框和断开连接;
  978. */
  979. //*********************************************//
  980. void CMainFrame::ProcessChatMessageRequest2(BYTE *pData, int length)
  981. {
  982. SetTimer(2, g_ntimeout, NULL); // Jeff.限定通信时间为g_ntimeout,超时后关闭连接;
  983. SendDataDlg dlg;
  984. dlg.m_pData = pData;
  985. dlg.m_nlength = length;
  986. dlg.DoModal();
  987. }
  988. /************************************************************************/
  989. /*
  990. 函数:ProcessChatMessageRequest
  991. 描述:对服务发送数据;
  992. 参数:void *szDataBuf[IN], int nDataLen[IN]
  993. 返回:发送成功与否;
  994. */
  995. /************************************************************************/
  996. BOOL CMainFrame::ProcessChatMessageRequest(void *szDataBuf, int nDataLen)
  997. {
  998. // 1.获取当前与服务器连接的id;
  999. DWORD dwFromUserID = GetConnectionID();
  1000. // 2.设置通信类型为MSG_CHATMESSAGE_REQ;
  1001. WORD wMessageId = 0;
  1002. if (g_conntype == 0 && !g_bConnLYFZ)
  1003. wMessageId = (MSG_CHATMESSAGE_REQ + 0X3FFF);
  1004. else
  1005. wMessageId = MSG_CHATMESSAGE_REQ;
  1006. // 3.计算出欲发送的数据的长度 dwDataLen;
  1007. DWORD dwDataLen = sizeof(TCHAT_MESSAGE_STRU) + nDataLen;
  1008. BYTE *pSendData = new BYTE[dwDataLen];
  1009. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU*)pSendData;
  1010. memset(pChatMessage, 0x00, dwDataLen);
  1011. // 3.1.g_nYearpos第一次与服务端通信时为-1;
  1012. if (g_nYearpos == -1)
  1013. g_sendhead.length[99] = g_nYearpos;
  1014. else
  1015. g_sendhead.length[99] = g_nYearpos * 32142953 + 10966236;
  1016. g_sendhead.length[98] = 987123768;
  1017. memcpy(pSendData, &g_sendhead, sizeof(g_sendhead));
  1018. #ifdef ENTERPRISE_VERSION
  1019. if (g_bBranchModify == 0)
  1020. strcpy(pChatMessage->szFromUserName, g_branchname);
  1021. #endif
  1022. // 4.填充发送的数据结构;
  1023. pChatMessage->tCommonMsg.dwConnectionID = GetConnectionID();
  1024. pChatMessage->tCommonMsg.wMessageId = wMessageId;
  1025. pChatMessage->dwFromUserID = dwFromUserID;
  1026. pChatMessage->dwToUserID = g_nSendCode;//▲▲g_nSendCode在服务端同为dwToUserID;
  1027. pChatMessage->wMessageLen = nDataLen;
  1028. memcpy(pChatMessage->byFileContent, szDataBuf, nDataLen);
  1029. // 5.填充数据头;
  1030. TMessageHeader tHeader = { 0 };
  1031. tHeader.wMessageId = wMessageId;
  1032. tHeader.dwDataLen = dwDataLen;
  1033. // 6.发送数据;
  1034. BOOL bRet = 0;
  1035. unsigned long ulSendLen = m_tClientTunnel.net_Send(&tHeader, (void *)pChatMessage, dwDataLen);
  1036. if (ulSendLen != SOCKET_ERROR)
  1037. {
  1038. bRet = 1;
  1039. }
  1040. // 7.发送完毕,释放内存;
  1041. delete[] pSendData;
  1042. return bRet;
  1043. }
  1044. /************************************************************************/
  1045. /*
  1046. 函数:ProcessChatMessageResponse
  1047. 描述:接收服务返回的数据;
  1048. 参数:void *pResponse[IN]
  1049. 返回:无;
  1050. 调用关系:
  1051. 1.由 void CMainFrame::ProcessNetEvent(...)调用
  1052. */
  1053. /************************************************************************/
  1054. void CMainFrame::ProcessChatMessageResponse(void *pResponse)
  1055. {
  1056. //printf("Jeff:ProcessChatMessageResponse**************\n\n");//Jeff Printf;
  1057. // 1.数据空,直接返回;
  1058. if (NULL == pResponse)
  1059. return;
  1060. // 2.数据解析过程;
  1061. //printf("Jeff:ProcessChatMessageResponse**************\数据解析过程\n\n");//Jeff Printf;
  1062. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pResponse;
  1063. int nMessageLen = pChatMessage->wMessageLen;
  1064. int nMessageLen2 = pChatMessage->dwToUserID; // 在服务器中被处理了,一般使dwToUserID=wMessageLen;
  1065. // Jeff.dwFromUserID==8888表示的内容是更新客户端skin界面数据,只有两处dwToUserID==211和dwToUserID==21;
  1066. // Jeff.其余的大多数都是 dwFromUserID = wMessageLen = dwToUserID 三者相等;
  1067. if (nMessageLen == nMessageLen2 && pChatMessage->dwFromUserID != 8888)
  1068. {
  1069. // 2.1.清除全局变量g_pData数据,用于保存接收的实际数据;
  1070. if (g_pData)
  1071. delete[]g_pData;
  1072. g_pData = NULL;
  1073. g_pData = new BYTE[nMessageLen];
  1074. memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
  1075. memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
  1076. g_nLeng = nMessageLen;
  1077. if (nMessageLen <= sizeof(DWORD))
  1078. {
  1079. memcpy(&g_ncount, pChatMessage->byFileContent, sizeof(DWORD));
  1080. }
  1081. KillTimer(2);
  1082. if (g_hSendWnd)
  1083. {
  1084. ::SendMessage(g_hSendWnd, WM_CLOSE, 0, 0);//关闭发送对话框;
  1085. }
  1086. }
  1087. else if (nMessageLen == nMessageLen2 && pChatMessage->dwFromUserID == 8888)
  1088. {
  1089. if (g_pData2)
  1090. delete[]g_pData2;
  1091. g_pData2 = NULL;
  1092. g_pData2 = new BYTE[nMessageLen2];
  1093. memcpy(g_pData2, pChatMessage->byFileContent, nMessageLen2);
  1094. g_nLeng2 = nMessageLen2;
  1095. KillTimer(2);
  1096. if (g_hSendWnd)
  1097. {
  1098. ::SendMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1099. }
  1100. }
  1101. else // 登陆返回;
  1102. {
  1103. if (g_bConnLYFZ)
  1104. {
  1105. if (g_pData)
  1106. delete[]g_pData;
  1107. g_pData = NULL;
  1108. g_pData = new BYTE[nMessageLen];
  1109. memcpy(g_pData, pChatMessage->byFileContent, nMessageLen);
  1110. memcpy(&g_sendhead, pChatMessage, sizeof(g_sendhead));
  1111. g_nLeng = nMessageLen;
  1112. if (nMessageLen <= sizeof(DWORD))
  1113. {
  1114. memcpy(&g_ncount, pChatMessage->byFileContent, sizeof(DWORD));
  1115. }
  1116. KillTimer(2);
  1117. if (g_hSendWnd)
  1118. {
  1119. ::SendMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1120. }
  1121. return;
  1122. }
  1123. if (g_conntype) // Jeff.g_conntype == 1,表示连接公司服务器的返回,用于集团版解析*.ly.com的IP地址;
  1124. {
  1125. // KillTimer(2);
  1126. char *szChatMessage = new char[nMessageLen + 1];
  1127. memset(szChatMessage, 0x00, nMessageLen + 1);
  1128. memcpy(szChatMessage, pChatMessage->byFileContent, nMessageLen);
  1129. g_server = szChatMessage;
  1130. delete[]szChatMessage;
  1131. CStdioFile fp;
  1132. CString path = g_mainpath + "\\ip.txt";
  1133. ::DeleteFile(path);
  1134. fp.Open(path, CFile::modeCreate | CFile::modeWrite);
  1135. fp.WriteString(g_server);
  1136. fp.Close();
  1137. g_conntype = 0;
  1138. // g_serverip=g_server;
  1139. return;
  1140. }
  1141. if (g_pData2 == NULL)
  1142. {
  1143. g_pData2 = new BYTE[nMessageLen2];
  1144. g_nLeng2 = 0;
  1145. }
  1146. memcpy(g_pData2 + g_nLeng2, pChatMessage->byFileContent, nMessageLen);
  1147. g_nLeng2 += nMessageLen;
  1148. if (g_nLeng2 == nMessageLen2)//已收完
  1149. {
  1150. KillTimer(2);
  1151. if (g_hSendWnd)
  1152. {
  1153. ::SendMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1154. }
  1155. }
  1156. else
  1157. {
  1158. KillTimer(2);
  1159. SetTimer(2, g_ntimeout, NULL);
  1160. }
  1161. }
  1162. }
  1163. BOOL CMainFrame::OnConnectBranch()
  1164. {
  1165. if (g_branchip == "")
  1166. {
  1167. return 0;
  1168. }
  1169. g_conntype = 0;
  1170. CString strServerAddress = g_branchip;
  1171. char *szServerAddress = strServerAddress.GetBuffer(0);
  1172. strServerAddress.ReleaseBuffer();
  1173. /*for Client, IP and Port can be 0,
  1174. and for Server, IP is LocalIP, and Port is Listening Port*/
  1175. int nResult = m_tClientTunnel.net_OpenSocket(
  1176. Transport_Client,
  1177. 0,
  1178. HandleClientNetEvent,
  1179. this);
  1180. if (TRANSPORT_OK != nResult)
  1181. {
  1182. // AfxMessageBox("网络初始化失败!");
  1183. return 0;
  1184. }
  1185. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1186. DWORD wPort = g_dwCSPort;
  1187. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1188. if (TRANSPORT_OK != nResult)
  1189. {
  1190. m_tClientTunnel.net_CloseSocket();
  1191. return OnConnectBranch2();
  1192. return 0;
  1193. }
  1194. return ProcessLoginRequest();
  1195. }
  1196. BOOL CMainFrame::OnConnectBranch2()
  1197. {
  1198. if (g_branchip2 == "")
  1199. {
  1200. return 0;
  1201. }
  1202. g_conntype = 0;
  1203. CString strServerAddress = g_branchip2;
  1204. char *szServerAddress = strServerAddress.GetBuffer(0);
  1205. strServerAddress.ReleaseBuffer();
  1206. /*for Client, IP and Port can be 0,
  1207. and for Server, IP is LocalIP, and Port is Listening Port*/
  1208. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1209. 0,
  1210. HandleClientNetEvent,
  1211. this);
  1212. if (TRANSPORT_OK != nResult)
  1213. {
  1214. // AfxMessageBox("网络初始化失败!");
  1215. return 0;
  1216. }
  1217. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1218. DWORD wPort = g_dwCSPort;
  1219. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1220. if (TRANSPORT_OK != nResult)
  1221. {
  1222. m_tClientTunnel.net_CloseSocket();
  1223. return 0;
  1224. }
  1225. return ProcessLoginRequest();
  1226. }
  1227. BOOL CMainFrame::OnConnectIP()
  1228. {
  1229. CString strServerAddress = g_server;
  1230. char *szServerAddress = strServerAddress.GetBuffer(0);
  1231. strServerAddress.ReleaseBuffer();
  1232. /*for Client, IP and Port can be 0,
  1233. and for Server, IP is LocalIP, and Port is Listening Port*/
  1234. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1235. 0,
  1236. HandleClientNetEvent,
  1237. this);
  1238. if (TRANSPORT_OK != nResult)
  1239. {
  1240. // AfxMessageBox("网络初始化失败!");
  1241. return 0;
  1242. }
  1243. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1244. DWORD wPort = g_dwCSPort;
  1245. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1246. if (TRANSPORT_OK != nResult)
  1247. {
  1248. m_tClientTunnel.net_CloseSocket();
  1249. return 0;
  1250. }
  1251. return ProcessLoginRequest();
  1252. }
  1253. //ip.txt
  1254. BOOL CMainFrame::OnConnectLYFZ()
  1255. {
  1256. CString strBranchIP = "lijiafz.vicp.net";
  1257. MyGetIPByName2(strBranchIP);
  1258. if (strBranchIP == "")
  1259. {
  1260. return 0;
  1261. }
  1262. g_conntype = 0; // Jeff.Delete at 2014.10.18
  1263. //g_conntype = 1;
  1264. CString strServerAddress = strBranchIP;
  1265. char *szServerAddress = strServerAddress.GetBuffer(0);
  1266. strServerAddress.ReleaseBuffer();
  1267. /*for Client, IP and Port can be 0,
  1268. and for Server, IP is LocalIP, and Port is Listening Port*/
  1269. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1270. 0,
  1271. HandleClientNetEvent,
  1272. this);
  1273. if (TRANSPORT_OK != nResult)
  1274. {
  1275. return 0;
  1276. }
  1277. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1278. DWORD wPort = GetPort();
  1279. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1280. if (TRANSPORT_OK != nResult)
  1281. {
  1282. m_tClientTunnel.net_CloseSocket();
  1283. return 0;
  1284. }
  1285. return ProcessLoginRequest();
  1286. }
  1287. BOOL CMainFrame::OnConnect()
  1288. {
  1289. // 1.Jeff 断开(如果有在在未关的连接)之前的连接;
  1290. OnDisconnect();
  1291. // 2.根据需要连接指定的服务器;
  1292. if (g_bBranchModify)
  1293. {
  1294. // Jeff.g_bBranchModify在g_bGenBranchData=1时,在welcome::OnTimer里被设置为1;
  1295. return OnConnectBranch();// 连接集团版分店;
  1296. }
  1297. if (g_bConnLYFZ)
  1298. {
  1299. return OnConnectLYFZ();// 连接公司服务端程序;
  1300. }
  1301. g_conntype = 0;
  1302. CString strServerAddress = g_server;
  1303. // 3.如果dbconfig.dat里保存的是*.ly.com的信息,就要读取ip.txt里的IP地址;
  1304. if (g_serverbak.Find(".ly.com") != -1)
  1305. {
  1306. strServerAddress = g_serverbak;
  1307. CStdioFile fp;
  1308. CString path = g_mainpath + "\\ip.txt";
  1309. if (::PathFileExists(path))
  1310. {
  1311. fp.Open(path, CFile::modeRead);
  1312. fp.ReadString(g_server);
  1313. fp.Close();
  1314. if (OnConnectIP())
  1315. {
  1316. // g_serverip=g_server;
  1317. return 1;
  1318. }
  1319. g_server = strServerAddress;
  1320. OnDisconnect();//MessageBox("ip失败");
  1321. }
  1322. g_conntype = 1; // Jeff.连接公司服务器,用于获取集团版*.ly.com的解析IP结果;
  1323. strServerAddress = "lijiafz.vicp.net";
  1324. MyGetIPByName2(strServerAddress);
  1325. if (strServerAddress.IsEmpty())
  1326. {
  1327. return 0;//OnConnect2();
  1328. }
  1329. }
  1330. else if (g_ntimeout == 29000)//非远程 30000
  1331. {
  1332. strServerAddress = g_serverarray.ElementAt(g_conpos);
  1333. }
  1334. // 4.如果没有IP.txt或dbconfig.dat里的不是ly.com信息,而是一般的计算机名称;
  1335. char *szServerAddress = strServerAddress.GetBuffer(0);
  1336. strServerAddress.ReleaseBuffer();
  1337. // AfxMessageBox("连接:"+strServerAddress);
  1338. /*for Client, IP and Port can be 0,
  1339. and for Server, IP is LocalIP, and Port is Listening Port*/
  1340. // 5.创建通信对象连接;
  1341. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1342. 0,
  1343. HandleClientNetEvent,
  1344. this);
  1345. if (TRANSPORT_OK != nResult)
  1346. {
  1347. return 0;
  1348. }
  1349. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1350. DWORD wPort = g_dwCSPort;
  1351. if (g_conntype) wPort = GetPort();
  1352. // 6.连接公司服务器或影楼服务器;
  1353. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1354. if (TRANSPORT_OK != nResult)
  1355. {
  1356. m_tClientTunnel.net_CloseSocket();
  1357. if (g_conntype)// Jeff.连接公司服务器,用于获取集团版*.ly.com的解析IP结果;
  1358. {
  1359. return 0;//OnConnect2();
  1360. }
  1361. if (g_serverarray.GetSize() > 1)
  1362. {
  1363. if (g_conpos < (g_serverarray.GetSize() - 1))
  1364. {
  1365. g_conpos++;
  1366. return OnConnect();
  1367. }
  1368. else
  1369. {
  1370. g_conpos = 0;
  1371. return 0;
  1372. }
  1373. }
  1374. return 0;
  1375. }
  1376. return ProcessLoginRequest();
  1377. }
  1378. BOOL CMainFrame::OnConnect2()
  1379. {
  1380. g_conntype = 2;
  1381. CString server = "http://www.lyfz.net/download/ip.txt";
  1382. char buf[MAX_PATH];
  1383. ::GetTempPath(sizeof(buf), buf);
  1384. CString m_strTempDir = buf;
  1385. DWORD m_dwHttpRequestFlags = HSR_DOWNLOAD | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
  1386. INTERNET_PORT m_dwPort;
  1387. DWORD dwType;
  1388. CInternetSession m_cis;
  1389. CHttpConnection *m_pHttp;
  1390. CString m_strServer;
  1391. CString m_strIniPath;
  1392. AfxParseURL(server, dwType, m_strServer, m_strIniPath, m_dwPort);
  1393. if (dwType != AFX_INET_SERVICE_HTTP)
  1394. {
  1395. return 0;//OnConnect3();
  1396. }
  1397. m_cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5);
  1398. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1399. try
  1400. {
  1401. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1402. }
  1403. catch (CInternetException* pEx)
  1404. {
  1405. return 0;//OnConnect3();
  1406. }
  1407. CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_GET,
  1408. m_strIniPath, NULL, 1, NULL, NULL, m_dwHttpRequestFlags);
  1409. try
  1410. {
  1411. pFile->SendRequest();
  1412. }
  1413. catch (CInternetException* pEx)
  1414. {
  1415. pFile->Close();
  1416. return 0;//OnConnect3();
  1417. }
  1418. if (pFile)
  1419. {
  1420. CStdioFile csf;
  1421. csf.Open(m_strTempDir + "\\ip.txt", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
  1422. char buf[2048];
  1423. int n;
  1424. while ((n = pFile->Read(buf, 2048)) > 0)
  1425. csf.Write(buf, n);
  1426. csf.Close();
  1427. pFile->Close();
  1428. }
  1429. CString strServerAddress;
  1430. CStdioFile fp;
  1431. fp.Open(m_strTempDir + "\\ip.txt", CFile::modeRead);
  1432. fp.ReadString(strServerAddress);
  1433. fp.Close();
  1434. char *szServerAddress = strServerAddress.GetBuffer(0);
  1435. strServerAddress.ReleaseBuffer();
  1436. /*for Client, IP and Port can be 0,
  1437. and for Server, IP is LocalIP, and Port is Listening Port*/
  1438. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1439. 0,
  1440. HandleClientNetEvent,
  1441. this);
  1442. if (TRANSPORT_OK != nResult)
  1443. {
  1444. return 0;
  1445. }
  1446. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1447. DWORD wPort = g_dwCSPort;
  1448. if (g_conntype)wPort = GetPort();
  1449. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1450. if (TRANSPORT_OK != nResult)
  1451. {
  1452. m_tClientTunnel.net_CloseSocket();
  1453. return 0;//OnConnect3();
  1454. }
  1455. return ProcessLoginRequest();
  1456. }
  1457. BOOL CMainFrame::OnConnect3()
  1458. {
  1459. g_conntype = 3;
  1460. CString server = "http://photo.bjlyfz.com/download/ip.txt";
  1461. char buf[MAX_PATH];
  1462. ::GetTempPath(sizeof(buf), buf);
  1463. CString m_strTempDir = buf;
  1464. DWORD m_dwHttpRequestFlags = HSR_DOWNLOAD | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
  1465. INTERNET_PORT m_dwPort;
  1466. DWORD dwType;
  1467. CInternetSession m_cis;
  1468. CHttpConnection *m_pHttp;
  1469. CString m_strServer;
  1470. CString m_strIniPath;
  1471. AfxParseURL(server, dwType, m_strServer, m_strIniPath, m_dwPort);
  1472. if (dwType != AFX_INET_SERVICE_HTTP)
  1473. {
  1474. return FALSE;
  1475. }
  1476. m_cis.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5);
  1477. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1478. try
  1479. {
  1480. m_pHttp = m_cis.GetHttpConnection(m_strServer, m_dwPort);
  1481. }
  1482. catch (CInternetException* pEx)
  1483. {
  1484. return false;
  1485. }
  1486. CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_GET,
  1487. m_strIniPath, NULL, 1, NULL, NULL, m_dwHttpRequestFlags);
  1488. try
  1489. {
  1490. pFile->SendRequest();
  1491. }
  1492. catch (CInternetException* pEx)
  1493. {
  1494. pFile->Close();
  1495. return false;
  1496. }
  1497. if (pFile)
  1498. {
  1499. CStdioFile csf;
  1500. csf.Open(m_strTempDir + "\\ip.txt", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
  1501. char buf[2048];
  1502. int n;
  1503. while ((n = pFile->Read(buf, 2048)) > 0)
  1504. csf.Write(buf, n);
  1505. csf.Close();
  1506. pFile->Close();
  1507. }
  1508. CString strServerAddress;
  1509. CStdioFile fp;
  1510. fp.Open(m_strTempDir + "\\ip.txt", CFile::modeRead);
  1511. fp.ReadString(strServerAddress);
  1512. fp.Close();
  1513. char *szServerAddress = strServerAddress.GetBuffer(0);
  1514. strServerAddress.ReleaseBuffer();
  1515. /*for Client, IP and Port can be 0,
  1516. and for Server, IP is LocalIP, and Port is Listening Port*/
  1517. int nResult = m_tClientTunnel.net_OpenSocket(Transport_Client,
  1518. 0,
  1519. HandleClientNetEvent,
  1520. this);
  1521. if (TRANSPORT_OK != nResult)
  1522. {
  1523. return 0;
  1524. }
  1525. DWORD dwRemoteIPValue = inet_addr(szServerAddress);
  1526. DWORD wPort = g_dwCSPort;
  1527. if (g_conntype)wPort = GetPort();
  1528. nResult = m_tClientTunnel.net_Connect(dwRemoteIPValue, wPort);
  1529. if (TRANSPORT_OK != nResult)
  1530. {
  1531. m_tClientTunnel.net_CloseSocket();
  1532. return 0;
  1533. }
  1534. return ProcessLoginRequest();
  1535. }
  1536. void CMainFrame::ProcessNetEvent(int nEventType, void *pRecvMsg, DWORD dwDataLen)
  1537. {
  1538. //printf("Jeff:ProcessNetEvent\n\n");//Jeff Printf;
  1539. if (Transport_ReadEv == nEventType)
  1540. {
  1541. if (NULL == pRecvMsg) return;
  1542. TMessageHeader* pHeader = (TMessageHeader *)pRecvMsg;
  1543. char *pDataBuf = (char *)pRecvMsg + MESSAGE_HEADER_LEN;
  1544. WORD dwMessageID = pHeader->wMessageId;
  1545. switch (dwMessageID)
  1546. {
  1547. case MSG_LOGIN_RESP:
  1548. case (MSG_LOGIN_RESP + 0X2FFF) :
  1549. {
  1550. LOGIN_RESULT_STRU tLoginResult = { 0 };
  1551. memcpy(&tLoginResult, pDataBuf, sizeof(LOGIN_RESULT_STRU));
  1552. ProcessLoginResponse(&tLoginResult);
  1553. break;
  1554. }
  1555. case MSG_USERINFO_RESP:
  1556. {
  1557. break;
  1558. }
  1559. case MSG_LOGOUT_RESP:
  1560. {
  1561. break;
  1562. }
  1563. case MSG_CHATMESSAGE_RESP:
  1564. case (MSG_CHATMESSAGE_RESP + 0X4FFF) :
  1565. {
  1566. //AfxMessageBox("登陆成功");
  1567. //printf("Jeff:MSG_CHATMESSAGE_RESP\n\n");//Jeff Printf;
  1568. static int i = 0;
  1569. TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pDataBuf;
  1570. ProcessChatMessageResponse((void *)pChatMessage);
  1571. break;
  1572. }
  1573. default:
  1574. {
  1575. break;
  1576. }
  1577. }
  1578. }
  1579. else if (Transport_CloseEv == nEventType)
  1580. {
  1581. OnDisconnect();
  1582. }
  1583. }
  1584. //extern BOOL g_bNeedCoon;
  1585. extern BOOL EncryptFile2(BYTE *buffer, DWORD leng, PCHAR szPassword);
  1586. void CMainFrame::OnTimer(UINT nIDEvent)
  1587. {
  1588. // TODO: Add your message handler code here and/or call default
  1589. if (1 == nIDEvent)
  1590. {
  1591. KillTimer(nIDEvent);
  1592. CString version = _T("Version 1.0");
  1593. BOOL checked = AfxGetApp()->GetProfileInt(version, "status", 0);//status:此机用选片菜单项
  1594. // checked==1:此机用选片菜单项
  1595. // g_bStaffAchievementShow==1:此机用于员工业绩查看
  1596. if (checked && g_bStaffAchievementShow == 0) // .此机用选片菜单项;
  1597. {
  1598. KillTimer(3);
  1599. #ifdef NEW_SKIN
  1600. Welcome weldlg;
  1601. weldlg.DoModal();
  1602. #endif
  1603. ChoosePhotoSkin dlg;
  1604. dlg.SetLiaPath("1.lia");
  1605. if (dlg.DoModal() != IDOK)
  1606. {
  1607. PostMessage(WM_QUIT);
  1608. return;
  1609. }
  1610. if (dlg.m_exitcode == 3)
  1611. {
  1612. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  1613. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  1614. }
  1615. else
  1616. {
  1617. ShowWindow(SW_SHOW);
  1618. #ifdef NEW_SKIN
  1619. if (m_pMainFrimDlg2 == NULL)
  1620. {
  1621. m_pMainFrimDlg2 = new MainFrimDlg2;
  1622. m_pMainFrimDlg2->SetLiaPath("10.lia");
  1623. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  1624. }
  1625. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1626. #endif
  1627. }
  1628. }
  1629. else if (g_bStaffAchievementShow == 0) // .非选片、非查看员工业绩;
  1630. {
  1631. #ifdef NEW_SKIN
  1632. g_bNoConnDlg = 1;
  1633. Welcome weldlg;
  1634. weldlg.DoModal();
  1635. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1636. ShowWindow(SW_SHOW);
  1637. g_bNoConnDlg = 0;
  1638. if (g_bNoLoginLia) // Jeff.OnCreate里判断skin文件有5.lia, g_bNoLoginLia = 0, 无 g_bNoLoginLia = 1;
  1639. {
  1640. Login dlg;
  1641. dlg.SetLiaPath("5.lia");
  1642. dlg.DoModal();
  1643. }
  1644. else
  1645. {
  1646. Login3 dlg;
  1647. dlg.SetLiaPath("5.lia"); // Login3的父类为MyDlg,在BOOL MyDlg::OnInitDialog()里调用了纯虚函数Init();
  1648. dlg.DoModal();
  1649. }
  1650. if (g_user.bLongin && g_pMainWnd2)
  1651. {
  1652. g_pMainWnd2->ShowBar(1);
  1653. InsideMsg();
  1654. }
  1655. #else
  1656. ShowWindow(SW_SHOW);
  1657. if (g_bNoLoginLia)
  1658. {
  1659. Login dlg;
  1660. dlg.SetLiaPath ("5.lia");
  1661. dlg.DoModal();
  1662. }
  1663. else
  1664. {
  1665. Login3 dlg;
  1666. dlg.SetLiaPath ("5.lia");
  1667. dlg.DoModal();
  1668. }
  1669. #endif
  1670. }
  1671. if (g_hmouse == NULL)//&& atoi(g_cominfoarray.ElementAt(0).ElementAt(133)) && atoi(g_cominfoarray.ElementAt(0).ElementAt(134))>1)
  1672. {
  1673. g_hmouse = SetWindowsHookEx(WH_MOUSE, MouseProc, 0, ::GetCurrentThreadId());
  1674. }
  1675. }
  1676. else if (2 == nIDEvent) //29秒后,若连接和发送未完成,将关闭连接和发送框;
  1677. {
  1678. KillTimer(2);
  1679. if (g_hConnectWnd)
  1680. ::SendMessage(g_hConnectWnd, WM_CLOSE, 0, 0);
  1681. if (g_hSendWnd)
  1682. ::SendMessage(g_hSendWnd, WM_CLOSE, 0, 0);
  1683. if (g_bStaffAchievementShow == 0 && g_bConnLYFZ == 0)
  1684. {
  1685. if (g_bGenBranchData == 0)
  1686. {
  1687. if (g_branchip != "")
  1688. AfxMessageBox("连接分店:" + g_branchname + "失败!", MB_ICONINFORMATION);
  1689. else
  1690. AfxMessageBox("连接服务器失败!", MB_ICONINFORMATION);
  1691. }
  1692. OnDisconnect();
  1693. }
  1694. g_bSendOK = 0;
  1695. g_bNeedCoon = 1;
  1696. }
  1697. else if (3 == nIDEvent)
  1698. {
  1699. KillTimer(3);
  1700. #ifdef NEW_SKIN
  1701. Welcome weldlg;
  1702. weldlg.DoModal();
  1703. #endif
  1704. ShowWindow(SW_SHOW);
  1705. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  1706. g_sendhead.bsql = 0;
  1707. g_sendhead.code[0] = 24;
  1708. g_sendhead.code[1] = 1;
  1709. g_sendhead.tabcount = 2;
  1710. g_pMainWnd->ProcessChatMessageRequest2(1);
  1711. if (g_bSendOK == 0)
  1712. {
  1713. return;
  1714. }
  1715. CArray<CStringArray, CStringArray>patharray;
  1716. CArray<CStringArray, CStringArray>userarray;
  1717. DataToArray(&g_cominfoarray, &g_hisyeararray);
  1718. g_AryStaff.SetSize(userarray.GetSize(), 1);
  1719. int count = 0;
  1720. for (int ii = 0; ii < userarray.GetSize(); ii++)
  1721. {
  1722. if (DAL::GetStaffDimission(userarray, ii) == "在职")
  1723. g_AryStaff.ElementAt(count++).Copy(userarray.ElementAt(ii));
  1724. }
  1725. g_AryStaff.SetSize(count, 1);
  1726. StaffAchievementShowAll dlg;
  1727. g_pMainWnd->GetOcx();
  1728. dlg.DoModal();
  1729. }
  1730. else if (5 == nIDEvent)
  1731. {
  1732. if (g_bInSkin)return;
  1733. if (g_nAutoShowStaffAchievement == 1)return;
  1734. if (g_bAllBranch)return;
  1735. if (g_user.bLongin)
  1736. {
  1737. // m_Mdi.CloseAll();
  1738. g_pMainWnd->OnCommandMenu(IDM_Logout);
  1739. }
  1740. /* g_nAutoShowStaffAchievement=1;
  1741. KillTimer(5);
  1742. StaffAchievementShowAll dlg;
  1743. g_pMainWnd->GetOcx();
  1744. dlg.DoModal ();*/
  1745. }
  1746. else if (6 == nIDEvent)
  1747. {
  1748. static BOOL bDouble = 0;
  1749. bDouble = !bDouble;
  1750. if (bDouble)
  1751. g_pMainWnd->OnCommandMenu(IDM_TAKEAWAYBOOK);
  1752. else
  1753. g_pMainWnd->OnCommandMenu(IDM_CLIENTMONEY);
  1754. }
  1755. else if (7 == nIDEvent)
  1756. {
  1757. // Jeff,当g_bSendLYFZ==TRUE时;
  1758. // 向lijiafz.vicp.net发送影楼信息,防止有盗版用户;
  1759. KillTimer(7);
  1760. if (g_bInSkin)return;
  1761. if (g_nAutoShowStaffAchievement == 1)return;
  1762. if (g_bAllBranch)return;
  1763. CString str = g_sInfo;
  1764. g_bConnLYFZ = 1; // Jeff指示连接的服务器为lijiafz.vicp.net
  1765. // 断开当前连接;
  1766. OnDisconnect();
  1767. BYTE *pData = new BYTE[str.GetLength()];
  1768. memcpy(pData, str.GetBuffer(0), str.GetLength());
  1769. str.ReleaseBuffer();
  1770. EncryptFile2(pData, str.GetLength(), "888666333");
  1771. g_nSendCode = 16;
  1772. g_pMainWnd->ProcessChatMessageRequest2(pData, str.GetLength());
  1773. g_nSendCode = 0;
  1774. delete[]pData;
  1775. OnDisconnect();
  1776. g_bSendLYFZ = 0;
  1777. g_bConnLYFZ = 0;
  1778. if (g_bSendOK)
  1779. {
  1780. char *pStr = new char[g_nLeng + 1];
  1781. memset(pStr, 0, g_nLeng + 1);
  1782. memcpy(pStr, g_pData, g_nLeng);
  1783. CString str = pStr;
  1784. delete[]pStr;
  1785. if (str == "g_bInSkin")
  1786. {
  1787. g_sendhead.bsql = 1;
  1788. g_pMainWnd->ProcessChatMessageRequest2("update version set [setcheck1]='ok'");
  1789. }
  1790. }
  1791. }
  1792. /* else if( 4 == nIDEvent )
  1793. {
  1794. if(g_user.bLongin && g_bInSkin==0)
  1795. {
  1796. g_user.bLongin=0;
  1797. g_user.name.Empty ();
  1798. g_user.rights.Empty ();
  1799. #ifndef NEW_SKIN
  1800. m_wndStatusBar.SetPaneText(1,"未登录",TRUE);
  1801. #endif
  1802. m_Mdi.CloseAll();
  1803. if(g_pMainWnd2)g_pMainWnd2->DrawLogin();
  1804. }
  1805. }*/
  1806. }
  1807. void CMainFrame::OnOutbarNotify(CString strMsg)
  1808. {
  1809. if (g_user.bLongin == 0)
  1810. {
  1811. if (g_bNoLoginLia)
  1812. {
  1813. Login dlg;
  1814. dlg.SetLiaPath("5.lia");
  1815. dlg.DoModal();
  1816. }
  1817. else
  1818. {
  1819. Login3 dlg;
  1820. dlg.SetLiaPath("5.lia");
  1821. dlg.DoModal();
  1822. }
  1823. return;
  1824. if (g_user.bLongin == 0)return;
  1825. }
  1826. else
  1827. {
  1828. InsideMsg();
  1829. }
  1830. ResetTimer();
  1831. if (strMsg == "开单")
  1832. {
  1833. if (IsHasRights(0) == 0)return;
  1834. Booking2 dlg;
  1835. dlg.DoModal();
  1836. return;
  1837. }
  1838. else if (strMsg == "拍照")
  1839. {
  1840. if (IsHasRights(1) == 0)return;
  1841. UINT nID = 1;
  1842. LPSTR pName;
  1843. pName = (LPSTR)(LPCSTR)"拍照";
  1844. OPEN_MENU(TakeFrom);
  1845. return;
  1846. }
  1847. else if (strMsg == "服务跟踪")
  1848. {
  1849. if (IsHasRights(1) == 0)return;
  1850. CDlgServiceTracking dlg;
  1851. dlg.DoModal();
  1852. return;
  1853. }
  1854. /*else if (strMsg == "选片")
  1855. {
  1856. if (IsHasRights(2) == 0)return;
  1857. UINT nID = 1;
  1858. LPSTR pName;
  1859. pName = (LPSTR)(LPCSTR)"选片";
  1860. OPEN_MENU(ChoosePhotoForm);
  1861. return;
  1862. }
  1863. else if (strMsg == "精修")
  1864. {
  1865. if (IsHasRights(2) == 0)return;
  1866. UINT nID = 1;
  1867. LPSTR pName;
  1868. pName = (LPSTR)(LPCSTR)"精修";
  1869. OPEN_MENU(BeautifySkinFrom2);
  1870. return;
  1871. }
  1872. else if (strMsg == "设计")
  1873. {
  1874. if (IsHasRights(2) == 0)return;
  1875. UINT nID = 1;
  1876. LPSTR pName;
  1877. pName = (LPSTR)(LPCSTR)"设计";
  1878. OPEN_MENU(DesignFrom);
  1879. return;
  1880. }
  1881. else if (strMsg == "数码安排")
  1882. {
  1883. UINT nID = 1;
  1884. LPSTR pName;
  1885. pName = (LPSTR)(LPCSTR)"数码安排";
  1886. OPEN_MENU(DigitalWork);
  1887. return;
  1888. }
  1889. else if (strMsg == "刻盘")
  1890. {
  1891. UINT nID = 1;
  1892. LPSTR pName;
  1893. pName = (LPSTR)(LPCSTR)"刻盘";
  1894. OPEN_MENU(BurnCD);
  1895. return;
  1896. }
  1897. else if (strMsg == "相片冲印")
  1898. {
  1899. UINT nID = 1;
  1900. LPSTR pName;
  1901. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  1902. OPEN_MENU(PhotoPrintFrom);
  1903. return;
  1904. }
  1905. else if (strMsg == "发片/取件")
  1906. {
  1907. if (IsHasRights(3) == 0)return;
  1908. UINT nID = 1;
  1909. LPSTR pName;
  1910. pName = (LPSTR)(LPCSTR)"发片/取件";
  1911. OPEN_MENU(outsourcing);
  1912. return;
  1913. }*/
  1914. else if (strMsg == "满意度")
  1915. {
  1916. UINT nID = 1;
  1917. LPSTR pName;
  1918. pName = (LPSTR)(LPCSTR)"满意度";
  1919. OPEN_MENU(Satisfaction);
  1920. return;
  1921. }
  1922. else if (strMsg == "满意度图表")
  1923. {
  1924. UINT nID = 1;
  1925. LPSTR pName;
  1926. pName = (LPSTR)(LPCSTR)"满意度图表";
  1927. OPEN_MENU(SatisfactionForm);
  1928. return;
  1929. }
  1930. #if JEFF_DELETE_ON // 2014.11.14-PM 16:20
  1931. else if (strMsg == "回复统计")
  1932. {
  1933. UINT nID = 1;
  1934. LPSTR pName;
  1935. pName = (LPSTR)(LPCSTR)"回复统计";
  1936. OPEN_MENU(MsgReg2);
  1937. return;
  1938. }
  1939. #endif
  1940. /* else if(strMsg=="取件")
  1941. {
  1942. if(IsHasRights(3)==0)return;
  1943. UINT nID=1;
  1944. LPSTR pName ;
  1945. pName = (LPSTR)(LPCSTR)"取件";
  1946. OPEN_MENU(TakeAwayFrom);
  1947. return;
  1948. }*/
  1949. else if (strMsg == "其它收入")
  1950. {
  1951. if (IsHasRightsnew(16) == 0)return;
  1952. // if(IsHasRightsnew(48)==0)return;
  1953. UINT nID = 1;
  1954. LPSTR pName;
  1955. pName = (LPSTR)(LPCSTR)"其它收入";
  1956. OPEN_MENU(IncomeInput);
  1957. return;
  1958. }
  1959. else if (strMsg == "其它二销")
  1960. {
  1961. if (IsHasRightsnew(16) == 0)return;
  1962. UINT nID = 1;
  1963. LPSTR pName;
  1964. pName = (LPSTR)(LPCSTR)"其它二销";
  1965. OPEN_MENU(IncomeInput2);
  1966. return;
  1967. }
  1968. else if (strMsg == "员工奖罚")
  1969. {
  1970. if (IsHasRightsnew(16) == 0)return;
  1971. UINT nID = 1;
  1972. LPSTR pName;
  1973. pName = (LPSTR)(LPCSTR)"员工奖罚";
  1974. OPEN_MENU(IncomeInput3);
  1975. return;
  1976. }
  1977. else if (strMsg == "员工奖惩")
  1978. {
  1979. if (IsHasRightsnew(16) == 0)return;
  1980. UINT nID = 1;
  1981. LPSTR pName;
  1982. pName = (LPSTR)(LPCSTR)"员工奖惩";
  1983. OPEN_MENU(IncomeInput4);
  1984. return;
  1985. }
  1986. else if (strMsg == "订单收款")
  1987. {
  1988. if (IsHasRights(17) == 0)return;
  1989. UINT nID = 1;
  1990. LPSTR pName;
  1991. pName = (LPSTR)(LPCSTR)"订单收款";
  1992. OPEN_MENU(FinanceForm);
  1993. return;
  1994. }
  1995. else if (strMsg == "日财务表")
  1996. {
  1997. if (IsHasRightsnew(22) == 0)return;
  1998. UINT nID = 2;
  1999. LPSTR pName;
  2000. pName = (LPSTR)(LPCSTR)"日财务表";
  2001. OPEN_MENU(DailyForm);
  2002. return;
  2003. }
  2004. else if (strMsg == "提成比例")
  2005. {
  2006. #ifndef ENTERPRISE_VERSION
  2007. #ifndef CHILD_VERSION
  2008. #ifdef BASIC_VERSION
  2009. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2010. {
  2011. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2012. exit(0);return;
  2013. }
  2014. #else
  2015. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2016. {
  2017. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2018. exit(0);return;
  2019. }
  2020. #endif
  2021. #else
  2022. #ifdef BASIC_VERSION
  2023. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2024. {
  2025. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2026. exit(0);return;
  2027. }
  2028. #else
  2029. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  2030. {
  2031. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2032. exit(0);return;
  2033. }
  2034. #endif
  2035. #endif
  2036. #else
  2037. #ifndef CHILD_VERSION
  2038. #ifdef BASIC_VERSION
  2039. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2040. {
  2041. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2042. exit(0); return;
  2043. }
  2044. #else
  2045. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2046. {
  2047. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2048. exit(0); return;
  2049. }
  2050. #endif
  2051. #else
  2052. #ifdef BASIC_VERSION
  2053. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2054. {
  2055. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2056. exit(0);return;
  2057. }
  2058. #else
  2059. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2060. {
  2061. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2062. exit(0); return;
  2063. }
  2064. #endif
  2065. #endif
  2066. #endif
  2067. UINT nID = 2;
  2068. LPSTR pName;
  2069. pName = (LPSTR)(LPCSTR)"提成比例";
  2070. OPEN_MENU(SalarySet2);
  2071. return;
  2072. }
  2073. //else if(strMsg=="员工工作")
  2074. else if (strMsg == "计件提成")
  2075. {
  2076. UINT nID = 2;
  2077. LPSTR pName;
  2078. //pName = (LPSTR)(LPCSTR)"员工工作";
  2079. pName = (LPSTR)(LPCSTR)"计件提成";
  2080. OPEN_MENU(SalarySet3);
  2081. return;
  2082. }
  2083. else if (strMsg == "工资管理")
  2084. {
  2085. #ifndef ENTERPRISE_VERSION
  2086. #ifndef CHILD_VERSION
  2087. #ifdef BASIC_VERSION
  2088. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2089. {
  2090. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2091. exit(0);return;
  2092. }
  2093. #else
  2094. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2095. {
  2096. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2097. exit(0);return;
  2098. }
  2099. #endif
  2100. #else
  2101. #ifdef BASIC_VERSION
  2102. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2103. {
  2104. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2105. exit(0);return;
  2106. }
  2107. #else
  2108. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  2109. {
  2110. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2111. exit(0);return;
  2112. }
  2113. #endif
  2114. #endif
  2115. #else
  2116. #ifndef CHILD_VERSION
  2117. #ifdef BASIC_VERSION
  2118. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2119. {
  2120. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2121. exit(0); return;
  2122. }
  2123. #else
  2124. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2125. {
  2126. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2127. exit(0); return;
  2128. }
  2129. #endif
  2130. #else
  2131. #ifdef BASIC_VERSION
  2132. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2133. {
  2134. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2135. exit(0);return;
  2136. }
  2137. #else
  2138. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2139. {
  2140. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2141. exit(0); return;
  2142. }
  2143. #endif
  2144. #endif
  2145. #endif
  2146. UINT nID = 2;
  2147. LPSTR pName;
  2148. pName = (LPSTR)(LPCSTR)"工资管理";
  2149. OPEN_MENU(MySalary);
  2150. return;
  2151. }
  2152. else if (strMsg == "客人付款")
  2153. {
  2154. UINT nID = 2;
  2155. LPSTR pName;
  2156. pName = (LPSTR)(LPCSTR)"客人付款";
  2157. OPEN_MENU(ClientMoney);
  2158. return;
  2159. }
  2160. else if (strMsg == "工资报表")
  2161. {
  2162. #ifndef ENTERPRISE_VERSION
  2163. #ifndef CHILD_VERSION
  2164. #ifdef BASIC_VERSION
  2165. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2166. {
  2167. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2168. exit(0);return;
  2169. }
  2170. #else
  2171. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2172. {
  2173. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2174. exit(0);return;
  2175. }
  2176. #endif
  2177. #else
  2178. #ifdef BASIC_VERSION
  2179. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2180. {
  2181. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2182. exit(0);return;
  2183. }
  2184. #else
  2185. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  2186. {
  2187. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2188. exit(0);return;
  2189. }
  2190. #endif
  2191. #endif
  2192. #else
  2193. #ifndef CHILD_VERSION
  2194. #ifdef BASIC_VERSION
  2195. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2196. {
  2197. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2198. exit(0); return;
  2199. }
  2200. #else
  2201. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2202. {
  2203. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2204. exit(0); return;
  2205. }
  2206. #endif
  2207. #else
  2208. #ifdef BASIC_VERSION
  2209. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2210. {
  2211. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2212. exit(0);return;
  2213. }
  2214. #else
  2215. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2216. {
  2217. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2218. exit(0); return;
  2219. }
  2220. #endif
  2221. #endif
  2222. #endif
  2223. if (IsHasRightsnew(25) == 0)return;
  2224. UINT nID = 2;
  2225. LPSTR pName;
  2226. pName = (LPSTR)(LPCSTR)"工资报表";
  2227. g_ncount = 100;
  2228. OPEN_MENU(MySalary);
  2229. return;
  2230. }
  2231. else if (strMsg == "员工业绩")
  2232. {
  2233. #ifndef ENTERPRISE_VERSION
  2234. #ifndef CHILD_VERSION
  2235. #ifdef BASIC_VERSION
  2236. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2237. {
  2238. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2239. exit(0);return;
  2240. }
  2241. #else
  2242. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2243. {
  2244. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2245. exit(0);return;
  2246. }
  2247. #endif
  2248. #else
  2249. #ifdef BASIC_VERSION
  2250. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2251. {
  2252. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2253. exit(0);return;
  2254. }
  2255. #else
  2256. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  2257. {
  2258. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2259. exit(0);return;
  2260. }
  2261. #endif
  2262. #endif
  2263. #else
  2264. #ifndef CHILD_VERSION
  2265. #ifdef BASIC_VERSION
  2266. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2267. {
  2268. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2269. exit(0); return;
  2270. }
  2271. #else
  2272. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2273. {
  2274. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2275. exit(0); return;
  2276. }
  2277. #endif
  2278. #else
  2279. #ifdef BASIC_VERSION
  2280. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2281. {
  2282. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2283. exit(0);return;
  2284. }
  2285. #else
  2286. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2287. {
  2288. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2289. exit(0); return;
  2290. }
  2291. #endif
  2292. #endif
  2293. #endif
  2294. if (IsHasRightsnew(33) == 0)return;
  2295. UINT nID = 2;
  2296. LPSTR pName;
  2297. pName = (LPSTR)(LPCSTR)"员工业绩";
  2298. OPEN_MENU(StaffAchievement);
  2299. return;
  2300. }
  2301. else if (strMsg == "订单客户")
  2302. {
  2303. UINT nID = 2;
  2304. LPSTR pName;
  2305. pName = (LPSTR)(LPCSTR)"订单客户";
  2306. g_dx += 10000;
  2307. OPEN_MENU(CClientForm);
  2308. if (g_dx >= 10000)g_dx -= 10000;
  2309. return;
  2310. }
  2311. else if (strMsg == "服务记录")
  2312. {
  2313. UINT nID = 2;
  2314. //LPSTR pName;
  2315. //pName = (LPSTR)(LPCSTR)"服务记录";
  2316. //OPEN_MENU(CClientForm2);
  2317. CDlgServiceRecord dlg;
  2318. dlg.DoModal();
  2319. return;
  2320. }
  2321. else if (strMsg == "服务统计")
  2322. {
  2323. UINT nID = 2;
  2324. LPSTR pName;
  2325. pName = (LPSTR)(LPCSTR)"服务统计";
  2326. OPEN_MENU(CClientForm3);
  2327. //CDlgServicesStatistics dlg;
  2328. //dlg.DoModal();
  2329. return;
  2330. }
  2331. else if (strMsg == "意向客户")
  2332. {
  2333. UINT nID = 2;
  2334. LPSTR pName;
  2335. pName = (LPSTR)(LPCSTR)"意向客户";
  2336. #ifdef LYFZ_VERSION
  2337. OPEN_MENU(Client2FormLYFZ);
  2338. #else
  2339. OPEN_MENU(Client2Form);
  2340. #endif
  2341. return;
  2342. }
  2343. else if (strMsg == "老客户")
  2344. {
  2345. UINT nID = 2;
  2346. LPSTR pName;
  2347. pName = (LPSTR)(LPCSTR)"老客户";
  2348. OPEN_MENU(OldClient);
  2349. return;
  2350. }
  2351. else if (strMsg == "客户来电")
  2352. {
  2353. UINT nID = 2;
  2354. LPSTR pName;
  2355. pName = (LPSTR)(LPCSTR)"客户来电";
  2356. OPEN_MENU(PhoneRecord);
  2357. return;
  2358. }
  2359. else if (strMsg == "拨出电话")
  2360. {
  2361. UINT nID = 2;
  2362. LPSTR pName;
  2363. pName = (LPSTR)(LPCSTR)"拨出电话";
  2364. OPEN_MENU(PhoneRecordOut);
  2365. return;
  2366. }
  2367. else if (strMsg == "未接来电")
  2368. {
  2369. UINT nID = 2;
  2370. LPSTR pName;
  2371. pName = (LPSTR)(LPCSTR)"未接来电";
  2372. OPEN_MENU(MissCall);
  2373. return;
  2374. }
  2375. else if (strMsg == "客户流失")
  2376. {
  2377. UINT nID = 2;
  2378. LPSTR pName;
  2379. pName = (LPSTR)(LPCSTR)"客户流失";
  2380. OPEN_MENU(ClientReasonChart);
  2381. return;
  2382. }
  2383. else if (strMsg == "客户来源")
  2384. {
  2385. UINT nID = 2;
  2386. LPSTR pName;
  2387. pName = (LPSTR)(LPCSTR)"客户来源";
  2388. OPEN_MENU(ClientFromChart);
  2389. return;
  2390. }
  2391. else if (strMsg == "月财务表")
  2392. {
  2393. if (IsHasRightsnew(23) == 0)return;
  2394. UINT nID = 2;
  2395. LPSTR pName;
  2396. pName = (LPSTR)(LPCSTR)"月财务表";
  2397. OPEN_MENU(MonthForm);
  2398. return;
  2399. }
  2400. else if (strMsg == "支出报表")
  2401. {
  2402. if (IsHasRightsnew(23) == 0)return;
  2403. UINT nID = 2;
  2404. LPSTR pName;
  2405. pName = (LPSTR)(LPCSTR)"支出报表";
  2406. OPEN_MENU(MonthForm2);
  2407. return;
  2408. }
  2409. else if (strMsg == "年财务表")
  2410. {
  2411. if (IsHasRightsnew(24) == 0)return;
  2412. UINT nID = 2;
  2413. LPSTR pName;
  2414. pName = (LPSTR)(LPCSTR)"年财务表";
  2415. OPEN_MENU(YearForm);
  2416. return;
  2417. }
  2418. else if (strMsg == "年财务图表")
  2419. {
  2420. if (IsHasRightsnew(24) == 0)return;
  2421. GetOcx();
  2422. UINT nID = 2;
  2423. LPSTR pName;
  2424. pName = (LPSTR)(LPCSTR)"年财务图表";
  2425. OPEN_MENU(YearForm2);
  2426. return;
  2427. }
  2428. else if (strMsg == "订单图表")
  2429. {
  2430. GetOcx();
  2431. UINT nID = 2;
  2432. LPSTR pName;
  2433. pName = (LPSTR)(LPCSTR)"订单图表";
  2434. OPEN_MENU(DinDanForm);
  2435. return;
  2436. }
  2437. #ifdef ENTERPRISE_VERSION
  2438. else if (strMsg == "订单报表")
  2439. {
  2440. GetOcx();
  2441. UINT nID = 2;
  2442. LPSTR pName;
  2443. pName = (LPSTR)(LPCSTR)"订单报表2";
  2444. OPEN_MENU(DinDanFromBranch);
  2445. return;
  2446. }
  2447. else if (strMsg == "财务图表")
  2448. {
  2449. GetOcx();
  2450. UINT nID = 2;
  2451. LPSTR pName;
  2452. pName = (LPSTR)(LPCSTR)"财务图表";
  2453. OPEN_MENU(YearFormBranch);
  2454. return;
  2455. }
  2456. else if (strMsg == "订单图表")
  2457. {
  2458. GetOcx();
  2459. UINT nID = 2;
  2460. LPSTR pName;
  2461. pName = (LPSTR)(LPCSTR)"订单图表";
  2462. OPEN_MENU(YearFormBranch2);
  2463. return;
  2464. }
  2465. else if (strMsg == "摄控安排")
  2466. {
  2467. UINT nID = 2;
  2468. LPSTR pName;
  2469. pName = (LPSTR)(LPCSTR)"摄控安排";
  2470. g_bookingtype = 0;
  2471. OPEN_MENU(TodayForm);
  2472. return;
  2473. }
  2474. else if (strMsg == "选片预约")
  2475. {
  2476. UINT nID = 2;
  2477. LPSTR pName;
  2478. pName = (LPSTR)(LPCSTR)"选片预约";
  2479. g_bookingtype = 1;
  2480. OPEN_MENU(TodayForm);
  2481. return;
  2482. }
  2483. else if (strMsg == "看样预约")
  2484. {
  2485. UINT nID = 2;
  2486. LPSTR pName;
  2487. pName = (LPSTR)(LPCSTR)"看样预约";
  2488. g_bookingtype = 2;
  2489. OPEN_MENU(TodayForm);
  2490. return;
  2491. }
  2492. else if (strMsg == "取件预约")
  2493. {
  2494. UINT nID = 2;
  2495. LPSTR pName;
  2496. pName = (LPSTR)(LPCSTR)"取件预约";
  2497. g_bookingtype = 3;
  2498. OPEN_MENU(TodayForm);
  2499. return;
  2500. }
  2501. else if (strMsg == "婚庆安排")
  2502. {
  2503. UINT nID = 2;
  2504. LPSTR pName;
  2505. pName = (LPSTR)(LPCSTR)"婚庆安排";
  2506. g_bookingtype = 4;
  2507. OPEN_MENU(TodayForm);
  2508. return;
  2509. }
  2510. #endif
  2511. else if (strMsg == "员工资料")
  2512. {
  2513. UINT nID = 2;
  2514. LPSTR pName;
  2515. pName = (LPSTR)(LPCSTR)"员工资料";
  2516. if (g_bAllBranch)
  2517. OPEN_MENU(EmployeeForm2);
  2518. else
  2519. OPEN_MENU(EmployeeForm);
  2520. return;
  2521. }
  2522. else if (strMsg == "客户区域")
  2523. {
  2524. // if(IsHasRightsnew(48)==0)return;
  2525. GetOcx();
  2526. UINT nID = 2;
  2527. LPSTR pName;
  2528. pName = (LPSTR)(LPCSTR)"客户区域";
  2529. OPEN_MENU(AreaClient);
  2530. return;
  2531. }
  2532. else if (strMsg == "客户报表")
  2533. {
  2534. UINT nID = 3;
  2535. LPSTR pName;
  2536. pName = (LPSTR)(LPCSTR)"客户报表";
  2537. OPEN_MENU(CClientForm);
  2538. return;
  2539. }
  2540. else if (strMsg == "每日签到")
  2541. {
  2542. UINT nID = 3;
  2543. //LPSTR pName;
  2544. //pName = (LPSTR)(LPCSTR)"每日签到";
  2545. //OPEN_MENU(WorkerReport);
  2546. CDlgCheckInDaily dlg;
  2547. dlg.DoModal();
  2548. return;
  2549. }
  2550. else if (strMsg == "服务费")
  2551. {
  2552. UINT nID = 3;
  2553. LPSTR pName;
  2554. pName = (LPSTR)(LPCSTR)"服务费";
  2555. OPEN_MENU(annualfee);
  2556. return;
  2557. }
  2558. else if (strMsg == "现金支出")
  2559. {
  2560. if (IsHasRightsnew(16) == 0)return;
  2561. UINT nID = 3;
  2562. LPSTR pName;
  2563. pName = (LPSTR)(LPCSTR)"现金支出";
  2564. OPEN_MENU(PayOutInput);
  2565. return;
  2566. }
  2567. else if (strMsg == "短信群发")
  2568. {
  2569. UINT nID = 3;
  2570. LPSTR pName;
  2571. pName = (LPSTR)(LPCSTR)"短信群发";
  2572. OPEN_MENU(SendMsg);
  2573. return;
  2574. }
  2575. else if (strMsg == "短信发送")
  2576. {
  2577. UINT nID = 3;
  2578. LPSTR pName;
  2579. pName = (LPSTR)(LPCSTR)"客户报表";
  2580. OPEN_MENU(CClientForm);
  2581. return;
  2582. }
  2583. else if (strMsg == "流程短信")
  2584. {
  2585. UINT nID = 3;
  2586. LPSTR pName;
  2587. pName = (LPSTR)(LPCSTR)"流程短信";
  2588. OPEN_MENU(WorkMsg);
  2589. return;
  2590. }
  2591. else if (strMsg == "员工短信")
  2592. {
  2593. UINT nID = 3;
  2594. LPSTR pName;
  2595. pName = (LPSTR)(LPCSTR)"员工短信";
  2596. OPEN_MENU(EmployeeMsg);
  2597. return;
  2598. }
  2599. else if (strMsg == "发送记录")
  2600. {
  2601. UINT nID = 3;
  2602. LPSTR pName;
  2603. pName = (LPSTR)(LPCSTR)"发送记录";
  2604. OPEN_MENU(MsgReg);
  2605. return;
  2606. }
  2607. else if (strMsg == "短信设置")
  2608. {
  2609. if (IsHasRightsnew(49) == 0)return;
  2610. MsgSet dlg;
  2611. dlg.DoModal();
  2612. return;
  2613. }
  2614. else if (strMsg == "金卡会员")
  2615. {
  2616. #ifndef ENTERPRISE_VERSION
  2617. #ifndef CHILD_VERSION
  2618. #ifdef BASIC_VERSION
  2619. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2620. {
  2621. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2622. exit(0);return;
  2623. }
  2624. #else
  2625. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2626. {
  2627. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2628. exit(0);return;
  2629. }
  2630. #endif
  2631. #else
  2632. #ifdef BASIC_VERSION
  2633. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2634. {
  2635. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2636. exit(0);return;
  2637. }
  2638. #else
  2639. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  2640. {
  2641. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2642. exit(0);return;
  2643. }
  2644. #endif
  2645. #endif
  2646. #else
  2647. #ifndef CHILD_VERSION
  2648. #ifdef BASIC_VERSION
  2649. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2650. {
  2651. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2652. exit(0); return;
  2653. }
  2654. #else
  2655. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2656. {
  2657. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2658. exit(0); return;
  2659. }
  2660. #endif
  2661. #else
  2662. #ifdef BASIC_VERSION
  2663. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2664. {
  2665. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2666. exit(0);return;
  2667. }
  2668. #else
  2669. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2670. {
  2671. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2672. exit(0); return;
  2673. }
  2674. #endif
  2675. #endif
  2676. #endif
  2677. UINT nID = 3;
  2678. LPSTR pName;
  2679. pName = (LPSTR)(LPCSTR)"金卡会员";
  2680. OPEN_MENU(ShowMember);
  2681. return;
  2682. }
  2683. else if (strMsg == "现金子卡")
  2684. {
  2685. UINT nID = 3;
  2686. LPSTR pName;
  2687. pName = (LPSTR)(LPCSTR)"现金子卡";
  2688. OPEN_MENU(ShowMember2);
  2689. return;
  2690. }
  2691. else if (strMsg == "蓝钻会员")
  2692. {
  2693. #ifndef ENTERPRISE_VERSION
  2694. #ifndef CHILD_VERSION
  2695. #ifdef BASIC_VERSION
  2696. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2697. {
  2698. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2699. exit(0);return;
  2700. }
  2701. #else
  2702. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2703. {
  2704. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2705. exit(0);return;
  2706. }
  2707. #endif
  2708. #else
  2709. #ifdef BASIC_VERSION
  2710. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2711. {
  2712. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2713. exit(0);return;
  2714. }
  2715. #else
  2716. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  2717. {
  2718. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2719. exit(0);return;
  2720. }
  2721. #endif
  2722. #endif
  2723. #else
  2724. #ifndef CHILD_VERSION
  2725. #ifdef BASIC_VERSION
  2726. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2727. {
  2728. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2729. exit(0); return;
  2730. }
  2731. #else
  2732. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2733. {
  2734. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2735. exit(0); return;
  2736. }
  2737. #endif
  2738. #else
  2739. #ifdef BASIC_VERSION
  2740. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2741. {
  2742. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2743. exit(0);return;
  2744. }
  2745. #else
  2746. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2747. {
  2748. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2749. exit(0); return;
  2750. }
  2751. #endif
  2752. #endif
  2753. #endif
  2754. UINT nID = 3;
  2755. LPSTR pName;
  2756. pName = (LPSTR)(LPCSTR)"蓝钻会员";
  2757. OPEN_MENU(ShowMemberBlue);
  2758. return;
  2759. }
  2760. else if (strMsg == "转介绍积分")
  2761. {
  2762. #ifndef ENTERPRISE_VERSION
  2763. #ifndef CHILD_VERSION
  2764. #ifdef BASIC_VERSION
  2765. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2766. {
  2767. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2768. exit(0);return;
  2769. }
  2770. #else
  2771. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2772. {
  2773. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2774. exit(0);return;
  2775. }
  2776. #endif
  2777. #else
  2778. #ifdef BASIC_VERSION
  2779. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2780. {
  2781. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2782. exit(0);return;
  2783. }
  2784. #else
  2785. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  2786. {
  2787. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2788. exit(0);return;
  2789. }
  2790. #endif
  2791. #endif
  2792. #else
  2793. #ifndef CHILD_VERSION
  2794. #ifdef BASIC_VERSION
  2795. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2796. {
  2797. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2798. exit(0); return;
  2799. }
  2800. #else
  2801. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2802. {
  2803. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2804. exit(0); return;
  2805. }
  2806. #endif
  2807. #else
  2808. #ifdef BASIC_VERSION
  2809. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2810. {
  2811. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2812. exit(0);return;
  2813. }
  2814. #else
  2815. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2816. {
  2817. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2818. exit(0); return;
  2819. }
  2820. #endif
  2821. #endif
  2822. #endif
  2823. UINT nID = 3;
  2824. LPSTR pName;
  2825. pName = (LPSTR)(LPCSTR)"转介绍积分";
  2826. OPEN_MENU(Card2Reg);
  2827. return;
  2828. }
  2829. /* else if(strMsg=="转介绍图表")
  2830. {
  2831. #ifndef ENTERPRISE_VERSION
  2832. #ifndef CHILD_VERSION
  2833. #ifdef BASIC_VERSION
  2834. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="0")
  2835. {
  2836. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2837. exit(0);return;
  2838. }
  2839. #else
  2840. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2841. {
  2842. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2843. exit(0);return;
  2844. }
  2845. #endif
  2846. #else
  2847. #ifdef BASIC_VERSION
  2848. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2849. {
  2850. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2851. exit(0);return;
  2852. }
  2853. #else
  2854. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  2855. {
  2856. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2857. exit(0);return;
  2858. }
  2859. #endif
  2860. #endif
  2861. #else
  2862. #ifndef CHILD_VERSION
  2863. #ifdef BASIC_VERSION
  2864. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2865. {
  2866. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2867. exit(0);return;
  2868. }
  2869. #else
  2870. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="5")
  2871. {
  2872. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2873. exit(0);return;
  2874. }
  2875. #endif
  2876. #else
  2877. #ifdef BASIC_VERSION
  2878. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="6")
  2879. {
  2880. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2881. exit(0);return;
  2882. }
  2883. #else
  2884. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="7")
  2885. {
  2886. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2887. exit(0);return;
  2888. }
  2889. #endif
  2890. #endif
  2891. #endif
  2892. UINT nID=3;
  2893. LPSTR pName ;
  2894. pName = (LPSTR)(LPCSTR)"转介绍图表";
  2895. OPEN_MENU(Card2RegChart);
  2896. return;
  2897. }*/
  2898. else if (strMsg == "金卡图表")
  2899. {
  2900. UINT nID = 3;
  2901. LPSTR pName;
  2902. pName = (LPSTR)(LPCSTR)"金卡图表";
  2903. OPEN_MENU(MemberChart);
  2904. return;
  2905. }
  2906. else if (strMsg == "积分短信")
  2907. {
  2908. UINT nID = 3;
  2909. LPSTR pName;
  2910. pName = (LPSTR)(LPCSTR)"积分短信";
  2911. OPEN_MENU(ShowMemberMsg);
  2912. return;
  2913. }
  2914. else if (strMsg == "转介绍返现")
  2915. {
  2916. #ifndef ENTERPRISE_VERSION
  2917. #ifndef CHILD_VERSION
  2918. #ifdef BASIC_VERSION
  2919. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2920. {
  2921. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2922. exit(0);return;
  2923. }
  2924. #else
  2925. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2926. {
  2927. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2928. exit(0);return;
  2929. }
  2930. #endif
  2931. #else
  2932. #ifdef BASIC_VERSION
  2933. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  2934. {
  2935. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2936. exit(0);return;
  2937. }
  2938. #else
  2939. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  2940. {
  2941. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2942. exit(0);return;
  2943. }
  2944. #endif
  2945. #endif
  2946. #else
  2947. #ifndef CHILD_VERSION
  2948. #ifdef BASIC_VERSION
  2949. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  2950. {
  2951. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2952. exit(0); return;
  2953. }
  2954. #else
  2955. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  2956. {
  2957. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2958. exit(0); return;
  2959. }
  2960. #endif
  2961. #else
  2962. #ifdef BASIC_VERSION
  2963. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  2964. {
  2965. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2966. exit(0);return;
  2967. }
  2968. #else
  2969. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  2970. {
  2971. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2972. exit(0); return;
  2973. }
  2974. #endif
  2975. #endif
  2976. #endif
  2977. UINT nID = 3;
  2978. LPSTR pName;
  2979. pName = (LPSTR)(LPCSTR)"转介绍返现";
  2980. OPEN_MENU(Card2RegBlue);
  2981. return;
  2982. }
  2983. else if (strMsg == "转介绍图表")
  2984. {
  2985. #ifndef ENTERPRISE_VERSION
  2986. #ifndef CHILD_VERSION
  2987. #ifdef BASIC_VERSION
  2988. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  2989. {
  2990. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2991. exit(0);return;
  2992. }
  2993. #else
  2994. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  2995. {
  2996. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  2997. exit(0);return;
  2998. }
  2999. #endif
  3000. #else
  3001. #ifdef BASIC_VERSION
  3002. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3003. {
  3004. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3005. exit(0);return;
  3006. }
  3007. #else
  3008. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  3009. {
  3010. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3011. exit(0);return;
  3012. }
  3013. #endif
  3014. #endif
  3015. #else
  3016. #ifndef CHILD_VERSION
  3017. #ifdef BASIC_VERSION
  3018. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3019. {
  3020. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3021. exit(0); return;
  3022. }
  3023. #else
  3024. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3025. {
  3026. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3027. exit(0); return;
  3028. }
  3029. #endif
  3030. #else
  3031. #ifdef BASIC_VERSION
  3032. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3033. {
  3034. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3035. exit(0);return;
  3036. }
  3037. #else
  3038. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3039. {
  3040. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3041. exit(0); return;
  3042. }
  3043. #endif
  3044. #endif
  3045. #endif
  3046. UINT nID = 3;
  3047. LPSTR pName;
  3048. pName = (LPSTR)(LPCSTR)"转介绍图表";
  3049. OPEN_MENU(Card2RegChartBlue);
  3050. return;
  3051. }
  3052. else if (strMsg == "积分设置")
  3053. {
  3054. if (IsHasRightsnew(49) == 0)return;
  3055. MemberSet dlg;
  3056. dlg.DoModal();
  3057. return;
  3058. }
  3059. else if (strMsg == "礼服录入")
  3060. {
  3061. if (IsHasRightsnew(39) == 0)return;
  3062. UINT nID = 3;
  3063. LPSTR pName;
  3064. pName = (LPSTR)(LPCSTR)"礼服录入";
  3065. OPEN_MENU(DressManage);
  3066. return;
  3067. }
  3068. else if (strMsg == "礼服查看")
  3069. {
  3070. #ifndef ENTERPRISE_VERSION
  3071. #ifndef CHILD_VERSION
  3072. #ifdef BASIC_VERSION
  3073. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3074. {
  3075. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3076. exit(0);return;
  3077. }
  3078. #else
  3079. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3080. {
  3081. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3082. exit(0);return;
  3083. }
  3084. #endif
  3085. #else
  3086. #ifdef BASIC_VERSION
  3087. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3088. {
  3089. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3090. exit(0);return;
  3091. }
  3092. #else
  3093. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  3094. {
  3095. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3096. exit(0);return;
  3097. }
  3098. #endif
  3099. #endif
  3100. #else
  3101. #ifndef CHILD_VERSION
  3102. #ifdef BASIC_VERSION
  3103. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3104. {
  3105. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3106. exit(0); return;
  3107. }
  3108. #else
  3109. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3110. {
  3111. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3112. exit(0); return;
  3113. }
  3114. #endif
  3115. #else
  3116. #ifdef BASIC_VERSION
  3117. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3118. {
  3119. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3120. exit(0);return;
  3121. }
  3122. #else
  3123. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3124. {
  3125. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3126. exit(0); return;
  3127. }
  3128. #endif
  3129. #endif
  3130. #endif
  3131. if (IsHasRightsnew(40) == 0)return;
  3132. UINT nID = 3;
  3133. LPSTR pName;
  3134. pName = (LPSTR)(LPCSTR)"礼服查看";
  3135. OPEN_MENU(ShowDress);
  3136. return;
  3137. }
  3138. else if (strMsg == "撞期预警")
  3139. {
  3140. UINT nID = 3;
  3141. LPSTR pName;
  3142. pName = (LPSTR)(LPCSTR)"撞期预警";
  3143. OPEN_MENU(DressEarlyWarning);
  3144. return;
  3145. }
  3146. else if (strMsg == "礼服出租")
  3147. {
  3148. UINT nID = 3;
  3149. LPSTR pName;
  3150. pName = (LPSTR)(LPCSTR)"礼服出租";
  3151. OPEN_MENU(ShowHireReg);
  3152. return;
  3153. }
  3154. else if (strMsg == "礼服图片")
  3155. {
  3156. ShowPic dlg;
  3157. dlg.m_mode = 4;
  3158. dlg.m_path = g_path5 + "\\";
  3159. dlg.DoModal();
  3160. return;
  3161. }
  3162. else if (strMsg == "商品类别设置")
  3163. {
  3164. if (IsHasRightsnew(29) == 0)return;
  3165. SPLBDlg dlg;
  3166. dlg.DoModal();
  3167. return;
  3168. }
  3169. else if (strMsg == "商品名称设置")
  3170. {
  3171. if (IsHasRightsnew(29) == 0)return;
  3172. UINT nID = 3;
  3173. LPSTR pName;
  3174. pName = (LPSTR)(LPCSTR)"商品设置";
  3175. OPEN_MENU(ShangPin);
  3176. return;
  3177. }
  3178. else if (strMsg == "固定资产管理")
  3179. {
  3180. UINT nID = 3;
  3181. LPSTR pName;
  3182. pName = (LPSTR)(LPCSTR)"固定资产管理";
  3183. OPEN_MENU(FixedAssets);
  3184. return;
  3185. }
  3186. else if (strMsg == "入库单")
  3187. {
  3188. if (IsHasRightsnew(44) == 0)return;
  3189. InputGoods dlg;
  3190. dlg.DoModal();
  3191. return;
  3192. }
  3193. else if (strMsg == "出库单")
  3194. {
  3195. #ifndef ENTERPRISE_VERSION
  3196. #ifndef CHILD_VERSION
  3197. #ifdef BASIC_VERSION
  3198. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3199. {
  3200. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3201. exit(0);return;
  3202. }
  3203. #else
  3204. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3205. {
  3206. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3207. exit(0);return;
  3208. }
  3209. #endif
  3210. #else
  3211. #ifdef BASIC_VERSION
  3212. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3213. {
  3214. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3215. exit(0);return;
  3216. }
  3217. #else
  3218. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  3219. {
  3220. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3221. exit(0);return;
  3222. }
  3223. #endif
  3224. #endif
  3225. #else
  3226. #ifndef CHILD_VERSION
  3227. #ifdef BASIC_VERSION
  3228. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3229. {
  3230. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3231. exit(0); return;
  3232. }
  3233. #else
  3234. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3235. {
  3236. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3237. exit(0); return;
  3238. }
  3239. #endif
  3240. #else
  3241. #ifdef BASIC_VERSION
  3242. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3243. {
  3244. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3245. exit(0);return;
  3246. }
  3247. #else
  3248. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3249. {
  3250. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3251. exit(0); return;
  3252. }
  3253. #endif
  3254. #endif
  3255. #endif
  3256. if (IsHasRightsnew(45) == 0)return;
  3257. InputGoods dlg;
  3258. dlg.m_mode = 1;
  3259. dlg.DoModal();
  3260. return;
  3261. }
  3262. else if (strMsg == "库存查询")
  3263. {
  3264. #ifndef ENTERPRISE_VERSION
  3265. #ifndef CHILD_VERSION
  3266. #ifdef BASIC_VERSION
  3267. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "0")
  3268. {
  3269. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3270. exit(0);return;
  3271. }
  3272. #else
  3273. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  3274. {
  3275. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3276. exit(0);return;
  3277. }
  3278. #endif
  3279. #else
  3280. #ifdef BASIC_VERSION
  3281. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  3282. {
  3283. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3284. exit(0);return;
  3285. }
  3286. #else
  3287. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  3288. {
  3289. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3290. exit(0);return;
  3291. }
  3292. #endif
  3293. #endif
  3294. #else
  3295. #ifndef CHILD_VERSION
  3296. #ifdef BASIC_VERSION
  3297. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  3298. {
  3299. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3300. exit(0); return;
  3301. }
  3302. #else
  3303. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "5")
  3304. {
  3305. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3306. exit(0); return;
  3307. }
  3308. #endif
  3309. #else
  3310. #ifdef BASIC_VERSION
  3311. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "6")
  3312. {
  3313. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3314. exit(0);return;
  3315. }
  3316. #else
  3317. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  3318. {
  3319. AfxMessageBox("您的软件可能为盗版, 请与4006-067068,18665281860,QQ:4006067068联系!", MB_ICONSTOP);
  3320. exit(0); return;
  3321. }
  3322. #endif
  3323. #endif
  3324. #endif
  3325. UINT nID = 3;
  3326. LPSTR pName;
  3327. pName = (LPSTR)(LPCSTR)"库存查询";
  3328. OPEN_MENU(ShowGoods);
  3329. return;
  3330. }
  3331. else if (strMsg == "商品图表")
  3332. {
  3333. UINT nID = 3;
  3334. LPSTR pName;
  3335. pName = (LPSTR)(LPCSTR)"商品图表";
  3336. OPEN_MENU(StoreInfoChart);
  3337. return;
  3338. }
  3339. else if (strMsg == "成本核算")
  3340. {
  3341. UINT nID = 3;
  3342. LPSTR pName;
  3343. pName = (LPSTR)(LPCSTR)"成本核算";
  3344. OPEN_MENU(CostCal);
  3345. return;
  3346. }
  3347. else if (strMsg == "考勤记录")
  3348. {
  3349. UINT nID = 3;
  3350. LPSTR pName;
  3351. pName = (LPSTR)(LPCSTR)"考勤记录";
  3352. OPEN_MENU(LoginReg);
  3353. return;
  3354. }
  3355. else if (strMsg == "月统计")
  3356. {
  3357. UINT nID = 3;
  3358. LPSTR pName;
  3359. pName = (LPSTR)(LPCSTR)"月统计";
  3360. OPEN_MENU(LoginReg2);
  3361. return;
  3362. }
  3363. else if (strMsg == "时间设置")
  3364. {
  3365. if (IsHasRightsnew(21) == 0)return;
  3366. SetLoginTime dlg;
  3367. dlg.DoModal();
  3368. return;
  3369. }
  3370. else if (strMsg == "排班设置")
  3371. {
  3372. if (IsHasRightsnew(21) == 0)return;
  3373. SetLoginBan dlg;
  3374. dlg.DoModal();
  3375. return;
  3376. }
  3377. else if (strMsg == "意向查询")
  3378. {
  3379. UINT nID = 3;
  3380. LPSTR pName;
  3381. pName = (LPSTR)(LPCSTR)"意向查询";
  3382. OPEN_MENU(HospitalClient);
  3383. return;
  3384. }
  3385. else if (strMsg == "今日提醒")
  3386. {
  3387. UINT nID = 3;
  3388. LPSTR pName;
  3389. pName = (LPSTR)(LPCSTR)"今日提醒";
  3390. OPEN_MENU(HospitalClientAlarm);
  3391. return;
  3392. }
  3393. else if (strMsg == "跟踪短信")
  3394. {
  3395. UINT nID = 3;
  3396. LPSTR pName;
  3397. pName = (LPSTR)(LPCSTR)"跟踪短信";
  3398. OPEN_MENU(HospitalClientMsg);
  3399. return;
  3400. }
  3401. else if (strMsg == "意向单录入")
  3402. {
  3403. AddHospitalClient dlg;
  3404. dlg.DoModal();
  3405. return;
  3406. }
  3407. else if (strMsg == "资料设置")
  3408. {
  3409. HospitalInfoSet dlg;
  3410. dlg.DoModal();
  3411. return;
  3412. }
  3413. AfxMessageBox(strMsg + ",开发中...");
  3414. }
  3415. // Jeff.当版本号不一致时,调用AutoUpdate.exe来升级YLGL.exe
  3416. void CMainFrame::AutoUpdate()
  3417. {
  3418. if (g_bBranchModify)
  3419. {
  3420. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3421. return;
  3422. }
  3423. else if (g_branchname != "")
  3424. {
  3425. AfxMessageBox("此店与分店" + g_branchname + "软件版本不同,请同时升级! ");
  3426. return;
  3427. }
  3428. #if 0
  3429. g_ntimeout = 30000;
  3430. #endif
  3431. if (!::PathFileExists(g_mainpath + "\\AutoUpdate.exe"))
  3432. {
  3433. g_sendhead.bsql = 0;
  3434. g_sendhead.code[0] = 99;
  3435. g_sendhead.tabcount = 1;
  3436. g_pMainWnd->ProcessChatMessageRequest2(99);
  3437. if (g_bSendOK == 0)
  3438. goto failed;
  3439. CFile fp;
  3440. fp.Open(g_mainpath + "\\AutoUpdate.exe", CFile::modeWrite | CFile::modeCreate);
  3441. fp.Write(g_pData, g_nLeng);
  3442. fp.Close();
  3443. }
  3444. {
  3445. ::DeleteFile(g_mainpath + "\\YLGL2.exe");
  3446. g_sendhead.bsql = 0;
  3447. g_sendhead.code[0] = 98;
  3448. g_sendhead.tabcount = 1;
  3449. g_pMainWnd->ProcessChatMessageRequest2(99); if (g_bSendOK == 0)goto failed;
  3450. CFile fp;
  3451. fp.Open(g_mainpath + "\\YLGL2.exe", CFile::modeWrite | CFile::modeCreate);
  3452. fp.Write(g_pData, g_nLeng);
  3453. fp.Close();
  3454. }
  3455. AfxMessageBox("自动升级成功!", MB_ICONINFORMATION);
  3456. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\AutoUpdate.exe"), "12345", NULL, SW_SHOWNORMAL);
  3457. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3458. exit(0);
  3459. return;
  3460. failed:
  3461. AfxMessageBox("自动升级失败!", MB_ICONINFORMATION);
  3462. if (g_ntimeout == 30000)//非远程
  3463. {
  3464. AfxMessageBox("提醒:升级过程中需要传输较多的数据,如果网速慢可能导致远程升级失败!\r\n\
  3465. 可拷贝店内客户端用QQ传过来覆盖除dbconfig.dat的文件即可。", MB_ICONINFORMATION);
  3466. }
  3467. g_pMainWnd->SendMessage(WM_CLOSE, 0, 0);
  3468. }
  3469. void CMainFrame::Onchoosephotoskin() //Jeff:此机用于选片菜单项;不在使用2014.06.16
  3470. {
  3471. if (g_user.bLongin == 0)
  3472. {
  3473. if (g_bNoLoginLia)
  3474. {
  3475. Login dlg;
  3476. dlg.SetLiaPath("5.lia");
  3477. dlg.DoModal();
  3478. }
  3479. else
  3480. {
  3481. Login3 dlg;
  3482. dlg.SetLiaPath("5.lia");
  3483. dlg.DoModal();
  3484. }
  3485. if (g_user.bLongin == 0)return;
  3486. }
  3487. // TODO: Add your command handler code here
  3488. CString version = _T("Version 1.0");
  3489. CMenu *pMenu = GetMenu();
  3490. CMenu* submenu = pMenu->GetSubMenu(1);
  3491. UINT status = submenu->GetMenuState(IDM_choosephotoskin, MF_BYCOMMAND);
  3492. if (status&MF_CHECKED)
  3493. {
  3494. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_UNCHECKED);
  3495. AfxGetApp()->WriteProfileInt(version, "status", 0);
  3496. }
  3497. else
  3498. {
  3499. submenu->CheckMenuItem(IDM_choosephotoskin, MF_BYCOMMAND | MF_CHECKED);
  3500. AfxGetApp()->WriteProfileInt(version, "status", 1);
  3501. }
  3502. }
  3503. /*BOOL g_bInSkin = 0;*/
  3504. BOOL CMainFrame::IsCtrlDown()
  3505. {
  3506. short state = GetKeyState(VK_LCONTROL);
  3507. BYTE sta = (BYTE)(state >> 8);
  3508. state = GetKeyState(VK_RCONTROL);
  3509. BYTE sta2 = (BYTE)(state >> 8);
  3510. if (sta || sta2)
  3511. return 1;
  3512. else
  3513. return 0;
  3514. }//IsShiftDown
  3515. BOOL CMainFrame::IsShiftDown()
  3516. {
  3517. short state = GetKeyState(VK_LSHIFT);
  3518. BYTE sta = (BYTE)(state >> 8);
  3519. state = GetKeyState(VK_RSHIFT);
  3520. BYTE sta2 = (BYTE)(state >> 8);
  3521. if (sta || sta2)
  3522. return 1;
  3523. else
  3524. return 0;
  3525. }
  3526. BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
  3527. {
  3528. // TODO: Add your specialized code here and/or call the base class IDM_Logout
  3529. if (pMsg->message == WM_KEYDOWN)
  3530. {
  3531. switch (pMsg->wParam)
  3532. {
  3533. case VK_F12:
  3534. g_pMainWnd->OnCommandMenu(IDM_Logout);
  3535. return 1;
  3536. case VK_F1:
  3537. ShellExecute(NULL, _T("open"), _T(g_mainpath + "\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  3538. return 1;
  3539. case VK_F2:
  3540. {
  3541. if (g_pMainWnd->m_bCheckF2F3 && (IsShiftDown() == 0 || IsCtrlDown() == 0))return 1;
  3542. m_Mdi.MainClose();
  3543. if (g_user.bLongin)
  3544. {
  3545. SearchClient dlg;
  3546. dlg.SetLiaPath("2.lia");
  3547. if (dlg.DoModal() != IDOK)
  3548. {
  3549. if (dlg.m_bLogout)
  3550. {
  3551. g_user.bLongin = 0;
  3552. g_user.name.Empty();
  3553. g_user.rights.Empty();
  3554. g_user.account.Empty();
  3555. goto ll;
  3556. }
  3557. PostMessage(WM_QUIT);
  3558. return 1;
  3559. }
  3560. if (dlg.m_exitcode == 3)
  3561. {
  3562. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3563. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3564. }
  3565. else
  3566. {
  3567. ShowWindow(SW_SHOW);
  3568. #ifdef NEW_SKIN
  3569. if (m_pMainFrimDlg2 == NULL)
  3570. {
  3571. m_pMainFrimDlg2 = new MainFrimDlg2;
  3572. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3573. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3574. }
  3575. m_pMainFrimDlg2->ShowWindow(SW_SHOW);
  3576. g_bInSkin = 0;
  3577. #endif
  3578. }
  3579. }
  3580. else
  3581. {
  3582. ll:
  3583. ChoosePhotoSkin dlg;
  3584. dlg.SetLiaPath("1.lia");
  3585. if (dlg.DoModal() != IDOK)
  3586. {
  3587. PostMessage(WM_QUIT);
  3588. return 1;
  3589. }
  3590. if (dlg.m_exitcode == 3)
  3591. {
  3592. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3593. keybd_event(VK_F3, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3594. }
  3595. else
  3596. {
  3597. ShowWindow(SW_SHOW);
  3598. #ifdef NEW_SKIN
  3599. if (m_pMainFrimDlg2 == NULL)
  3600. {
  3601. m_pMainFrimDlg2 = new MainFrimDlg2;
  3602. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3603. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3604. }
  3605. m_pMainFrimDlg2->ShowWindow(SW_SHOW); g_bInSkin = 0;
  3606. #endif
  3607. }
  3608. }
  3609. }
  3610. return 1;
  3611. case VK_F3:
  3612. {
  3613. if (g_pMainWnd->m_bCheckF2F3 && (g_pMainWnd->IsShiftDown() == 0 || g_pMainWnd->IsCtrlDown() == 0))return 1;
  3614. m_Mdi.MainClose();
  3615. if (g_user.bLongin)
  3616. {
  3617. SearchClient dlg;
  3618. dlg.m_mode = 1;
  3619. dlg.SetLiaPath("2.lia");
  3620. if (dlg.DoModal() != IDOK)
  3621. {
  3622. if (dlg.m_bLogout)
  3623. {
  3624. g_user.bLongin = 0;
  3625. g_user.name.Empty();
  3626. g_user.rights.Empty();
  3627. g_user.account.Empty();
  3628. goto mm;
  3629. }
  3630. PostMessage(WM_QUIT);
  3631. return 1;
  3632. }
  3633. if (dlg.m_exitcode == 2)
  3634. {
  3635. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3636. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3637. }
  3638. else
  3639. {
  3640. ShowWindow(SW_SHOW);
  3641. #ifdef NEW_SKIN
  3642. if (m_pMainFrimDlg2 == NULL)
  3643. {
  3644. m_pMainFrimDlg2 = new MainFrimDlg2;
  3645. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3646. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3647. }
  3648. m_pMainFrimDlg2->ShowWindow(SW_SHOW); g_bInSkin = 0;
  3649. #endif
  3650. }
  3651. }
  3652. else
  3653. {
  3654. mm:
  3655. ChoosePhotoSkin dlg;
  3656. dlg.m_mode = 1;
  3657. dlg.SetLiaPath("1.lia");
  3658. if (dlg.DoModal() != IDOK)
  3659. {
  3660. PostMessage(WM_QUIT);
  3661. return 1;
  3662. }
  3663. if (dlg.m_exitcode == 2)
  3664. {
  3665. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);
  3666. keybd_event(VK_F2, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP | 0, 0);
  3667. }
  3668. else
  3669. {
  3670. ShowWindow(SW_SHOW);
  3671. #ifdef NEW_SKIN
  3672. if (m_pMainFrimDlg2 == NULL)
  3673. {
  3674. m_pMainFrimDlg2 = new MainFrimDlg2;
  3675. m_pMainFrimDlg2->SetLiaPath("10.lia");
  3676. m_pMainFrimDlg2->Create(IDD_DLGmydlg, this);
  3677. }
  3678. m_pMainFrimDlg2->ShowWindow(SW_SHOW); g_bInSkin = 0;
  3679. #endif
  3680. }
  3681. }
  3682. }
  3683. return 1;
  3684. case VK_F11:
  3685. /* if (g_bInSkin)return 1;
  3686. if (g_user.bLongin)
  3687. {
  3688. SqlDlg dlg;
  3689. dlg.DoModal();
  3690. } */
  3691. break;
  3692. #ifdef LYFZ_VERSION
  3693. case VK_F4:
  3694. if (g_user.bLongin)
  3695. {
  3696. g_sendhead.bsql=0;
  3697. g_sendhead.code[0]=199;
  3698. g_sendhead.tabcount=1;
  3699. g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return 0;
  3700. DataToArray(&g_List1array);
  3701. CStdioFile fp;
  3702. CString path=g_mainpath+"\\NullBalance.txt";
  3703. ::DeleteFile (path);
  3704. fp.Open (path, CFile::modeCreate|CFile::modeWrite);
  3705. CString str;
  3706. for(int i=0; i<g_List1array.GetSize (); i++)
  3707. {
  3708. for(int j=0; j<g_List1array.ElementAt (0).GetSize (); j++)
  3709. {
  3710. str=g_List1array.ElementAt (0).ElementAt (j)+"\n";
  3711. str.TrimLeft ();
  3712. fp.WriteString (str);
  3713. }
  3714. }
  3715. fp.Close ();
  3716. ShellExecute(NULL, _T("open"), path, NULL, NULL, SW_SHOWMAXIMIZED);
  3717. }
  3718. break;
  3719. #endif
  3720. }
  3721. }
  3722. return CMDIFrameWnd::PreTranslateMessage(pMsg);
  3723. }
  3724. void CMainFrame::GetSkin()
  3725. {
  3726. return;
  3727. #ifdef MNLS_VERSION
  3728. if (::PathFileExists(g_mainpath + "\\skin\\4.lia"))
  3729. {
  3730. CFile fp;
  3731. fp.Open(g_mainpath + "\\skin\\4.lia", CFile::modeRead);
  3732. DWORD leng=fp.GetLength ();
  3733. fp.Close ();
  3734. if(leng!=194987)
  3735. ::DeleteFile (g_mainpath+"\\skin\\4.lia");
  3736. }
  3737. if(!::PathFileExists (g_mainpath+"\\skin\\4.lia"))
  3738. {
  3739. ::CreateDirectory (g_mainpath+"\\skin", NULL);
  3740. g_sendhead.bsql=0;
  3741. g_sendhead.code[0]=100;
  3742. g_sendhead.tabcount=1;
  3743. g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)return;
  3744. CFile fp;
  3745. fp.Open (g_mainpath+"\\skin\\4.lia", CFile::modeWrite|CFile::modeCreate);
  3746. fp.Write (g_pData, g_nLeng);
  3747. fp.Close ();
  3748. }
  3749. #endif
  3750. }
  3751. void AutoDraw(CPrintRX &m_Print, CRect &StrRect, CString &str, float fscale)
  3752. {
  3753. CString tempbz, temp;
  3754. BOOL bRun = 0;
  3755. CSize size;
  3756. int fontsize = 12;
  3757. int i = 0;
  3758. ll: tempbz = str;
  3759. i = 0;
  3760. m_Print.SetFontFace(fontsize, 1, "宋体");
  3761. while (1)
  3762. {
  3763. if (!tempbz.IsEmpty())
  3764. {
  3765. temp = tempbz;
  3766. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  3767. int right = 0;
  3768. CRect temprc = StrRect;
  3769. temprc.top += i*(fontsize*fscale); i++;
  3770. temprc.bottom = temprc.top + fontsize;
  3771. if (temprc.bottom > StrRect.bottom)break;
  3772. while (size.cx > temprc.Width())
  3773. {
  3774. right++;
  3775. temp = tempbz.Left(tempbz.GetLength() - (right));
  3776. if (GIsHalfHZ(temp))
  3777. {
  3778. right++;
  3779. temp.Delete(temp.GetLength() - 1);
  3780. }
  3781. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  3782. }
  3783. if (temp.Find("\r\n") != -1)
  3784. {
  3785. temp = temp.Left(temp.Find("\r\n"));//i++;
  3786. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength() - 2);
  3787. }
  3788. else
  3789. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  3790. if (bRun)
  3791. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, temprc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3792. }
  3793. else
  3794. break;
  3795. }
  3796. if (tempbz.IsEmpty() == 0)
  3797. {
  3798. fontsize--;
  3799. goto ll;
  3800. }
  3801. if (bRun == 0)
  3802. {
  3803. bRun = 1;
  3804. goto ll;
  3805. }
  3806. }
  3807. void CMainFrame::PrintDinDan3(CString strOrderNumber)
  3808. {
  3809. // TODO: Add your control notification handler code here
  3810. CPrintRX m_Print;
  3811. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  3812. {
  3813. m_Print.InitToPrint(NULL, 1);
  3814. }
  3815. else
  3816. {
  3817. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  3818. if (name.IsEmpty())
  3819. m_Print.InitToPrint(NULL, 1);
  3820. else
  3821. {
  3822. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  3823. if (nret == -1)
  3824. {
  3825. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  3826. }
  3827. }
  3828. }
  3829. m_Print.StartPrint();
  3830. m_Print.StartPage();
  3831. LoadRect load;
  3832. load.SetLiaPath("11.lia");
  3833. load.SetMargins(0, 0);
  3834. if (!load.Load())return;
  3835. LoadRect load2;
  3836. load2.SetLiaPath("12.lia");
  3837. load2.SetMargins(0, 0);
  3838. if (!load2.Load())return;
  3839. LoadRect load3;
  3840. load3.SetLiaPath("13.lia");
  3841. load3.SetMargins(-6, 520);
  3842. if (!load3.Load())return;
  3843. int i;
  3844. //////////////////////////////////////////////////////////////
  3845. CStringArray txarray;
  3846. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "'";
  3847. g_sendhead.code[0] = 11;
  3848. g_sendhead.code[1] = 52;
  3849. g_sendhead.code[2] = 50;
  3850. g_sendhead.code[3] = 150;
  3851. g_sendhead.tabcount = 4;
  3852. g_sendhead.bsql = 0;
  3853. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  3854. CArray<CStringArray, CStringArray>sparray;
  3855. CArray<CStringArray, CStringArray>clientarray;
  3856. CArray<CStringArray, CStringArray>jdarray;
  3857. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray);
  3858. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  3859. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  3860. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  3861. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  3862. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  3863. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  3864. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  3865. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  3866. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  3867. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  3868. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  3869. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  3870. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  3871. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  3872. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  3873. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  3874. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  3875. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  3876. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  3877. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  3878. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  3879. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  3880. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  3881. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  3882. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  3883. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  3884. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  3885. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  3886. CString m_bz = "其它要求: " + g_List1array.ElementAt(0).ElementAt(38);
  3887. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  3888. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  3889. if (IsHasRights2new(31) == 0)
  3890. {
  3891. m_phone1 = "***";
  3892. m_phone2 = "***";
  3893. }
  3894. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  3895. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  3896. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  3897. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  3898. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  3899. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  3900. CString m_addr = m_addr1 + ";";
  3901. m_addr.TrimLeft(";");
  3902. m_addr += m_addr2;
  3903. CString m_qq = m_qq1 + ";";
  3904. m_qq.TrimLeft(";");
  3905. m_qq += m_qq2;
  3906. CString m_jd;
  3907. for (i = 0; i < jdarray.GetSize(); i++)
  3908. {
  3909. m_jd += jdarray.ElementAt(i).ElementAt(1);
  3910. m_jd += ";";
  3911. }
  3912. m_jd.TrimRight(";");
  3913. m_money1.Format("%f", atof(m_taoxijiage));
  3914. m_money2.Format("%f", atof(m_payed1));
  3915. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  3916. ConvertToPrice(m_money1);
  3917. ConvertToPrice(m_money2);
  3918. ConvertToPrice(m_money3);
  3919. ////////////////////////////////////////////////////////////////
  3920. int rcpos = -1;
  3921. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  3922. m_Print.SetFontFace(17, 1, "宋体");
  3923. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  3924. StrRect.top -= 0;
  3925. StrRect.bottom -= 10;
  3926. StrRect.left -= 140;
  3927. StrRect.right = StrRect.left + 48;
  3928. m_Print.SetFontFace(15, 1, "宋体");
  3929. m_Print.SetColor(0xffffff);
  3930. m_Print.DrawRect(StrRect, 0);
  3931. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3932. StrRect.left = StrRect.right;
  3933. StrRect.right = StrRect.left + 48;
  3934. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  3935. m_Print.SetColor(0, RGB(255, 0, 0));
  3936. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3937. m_Print.SetColor(0);
  3938. m_Print.SetFontFace(12, 1, "宋体");
  3939. StrRect.left -= 48;
  3940. int hei = StrRect.Height();
  3941. StrRect.top = StrRect.bottom + 2;
  3942. StrRect.bottom += hei + 2;
  3943. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  3944. StrRect.top = StrRect.bottom - 2;
  3945. StrRect.bottom += hei - 5;
  3946. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  3947. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3948. m_Print.SetFontFace(12, 1, "宋体");
  3949. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  3950. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3951. m_Print.SetFontFace(11, 1, "宋体");
  3952. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3953. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3954. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3955. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3956. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3957. m_Print.DrawRect2(StrRect, 2);
  3958. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3959. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3960. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3961. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3962. m_Print.DrawRect2(StrRect, 2);
  3963. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3964. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3965. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3966. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3967. m_Print.DrawRect2(StrRect, 2);
  3968. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3969. m_Print.DrawText((LPTSTR)(LPCTSTR)"约单时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3970. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3971. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3972. m_Print.DrawRect2(StrRect, 2);
  3973. ////////////
  3974. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3975. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3976. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3977. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3978. m_Print.DrawRect2(StrRect, 2);
  3979. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3980. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3981. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3982. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3983. m_Print.DrawRect2(StrRect, 2);
  3984. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3985. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3986. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3987. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3988. m_Print.DrawRect2(StrRect, 2);
  3989. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3990. m_Print.DrawText((LPTSTR)(LPCTSTR)"大婚时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3991. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3992. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3993. m_Print.DrawRect2(StrRect, 2);
  3994. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3995. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客地址:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3996. StrRect = load.m_rcarray.ElementAt(++rcpos);
  3997. m_Print.DrawText((LPTSTR)(LPCTSTR)m_addr, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  3998. m_Print.DrawRect2(StrRect, 2);
  3999. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4000. m_Print.DrawText((LPTSTR)(LPCTSTR)"QQ/邮箱:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4001. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4002. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4003. m_Print.DrawRect2(StrRect, 2);
  4004. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4005. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系金额:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4006. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4007. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4008. m_Print.DrawRect2(StrRect, 2);
  4009. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4010. m_Print.DrawText((LPTSTR)(LPCTSTR)"定金:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4011. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4012. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4013. m_Print.DrawRect2(StrRect, 2);
  4014. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4015. m_Print.DrawText((LPTSTR)(LPCTSTR)"余额:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4016. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4017. m_Print.DrawText((LPTSTR)(LPCTSTR)m_money3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4018. m_Print.DrawRect2(StrRect, 2);
  4019. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4020. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4021. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4022. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4023. m_Print.DrawRect2(StrRect, 2);
  4024. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4025. m_Print.DrawText((LPTSTR)(LPCTSTR)"拍摄景点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4026. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4027. m_Print.DrawText((LPTSTR)(LPCTSTR)m_jd, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4028. m_Print.DrawRect2(StrRect, 2);
  4029. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4030. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内容提供: 男士服装:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4031. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4032. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4033. m_Print.DrawRect2(StrRect, 2);
  4034. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4035. m_Print.DrawText((LPTSTR)(LPCTSTR)"套", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4036. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4037. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4038. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4039. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4040. m_Print.DrawRect2(StrRect, 2);
  4041. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4042. m_Print.DrawText((LPTSTR)(LPCTSTR)"套", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4043. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4044. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内提供拍摄区服装/头饰造型", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4045. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4046. m_Print.DrawText((LPTSTR)(LPCTSTR)"其它:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4047. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4048. m_Print.DrawText((LPTSTR)(LPCTSTR)" ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4049. m_Print.DrawRect2(StrRect, 2);
  4050. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4051. m_Print.DrawText((LPTSTR)(LPCTSTR)"专业数码拍摄:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4052. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4053. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4054. m_Print.DrawRect2(StrRect, 2);
  4055. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4056. m_Print.DrawText((LPTSTR)(LPCTSTR)"张", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4057. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4058. m_Print.DrawText((LPTSTR)(LPCTSTR)"(JPG格式数据)", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4059. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4060. m_Print.DrawText((LPTSTR)(LPCTSTR)"套系内赠送:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4061. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4062. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_List1array.ElementAt(0).ElementAt(9)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4063. m_Print.DrawRect2(StrRect, 2);
  4064. StrRect = load.m_rcarray.ElementAt(++rcpos);
  4065. m_Print.DrawText((LPTSTR)(LPCTSTR)"张设计排版精修入册", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4066. //////////////////////load2
  4067. rcpos = -1;
  4068. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4069. m_Print.DrawText((LPTSTR)(LPCTSTR)"原始数据套系内张数JPG格式光盘壹只", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4070. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4071. m_Print.DrawText((LPTSTR)(LPCTSTR)"其它:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4072. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4073. // m_Print.DrawText((LPTSTR)(LPCTSTR)"", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4074. // AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4075. m_Print.DrawRect2(StrRect, 2);
  4076. m_Print.SetFontFace(11, 1, "宋体");
  4077. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4078. m_Print.DrawText((LPTSTR)(LPCTSTR)"客人产品:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4079. int rowcount = sparray.GetSize() / 8;
  4080. int needaddrow = 0;
  4081. while (sparray.GetSize() > rowcount * 8 + needaddrow)
  4082. needaddrow++;
  4083. int pos = 0;
  4084. CString str = "";
  4085. int addcount = 0;
  4086. if (needaddrow > 0)
  4087. addcount = 1;
  4088. else
  4089. addcount = 0;
  4090. needaddrow--;
  4091. str.Empty();
  4092. for (i = 0; i < rowcount + addcount; i++)
  4093. {
  4094. str += sparray.ElementAt(pos).ElementAt(5);
  4095. str += " 数量:";
  4096. str += sparray.ElementAt(pos).ElementAt(3);
  4097. str += ";";
  4098. pos++;
  4099. }
  4100. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4101. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4102. m_Print.DrawRect2(StrRect, 2);
  4103. StrRect = load2.m_rcarray.ElementAt(++rcpos);//6
  4104. if (needaddrow > 0)
  4105. addcount = 1;
  4106. else
  4107. addcount = 0;
  4108. needaddrow--;
  4109. str.Empty();
  4110. for (i = 0; i < rowcount + addcount; i++)
  4111. {
  4112. str += sparray.ElementAt(pos).ElementAt(5);
  4113. str += " 数量:";
  4114. str += sparray.ElementAt(pos).ElementAt(3);
  4115. str += ";";
  4116. pos++;
  4117. }
  4118. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4119. m_Print.DrawRect2(StrRect, 2);
  4120. StrRect = load2.m_rcarray.ElementAt(++rcpos);//7
  4121. if (needaddrow > 0)
  4122. addcount = 1;
  4123. else
  4124. addcount = 0;
  4125. needaddrow--;
  4126. str.Empty();
  4127. for (i = 0; i < rowcount + addcount; i++)
  4128. {
  4129. str += sparray.ElementAt(pos).ElementAt(5);
  4130. str += " 数量:";
  4131. str += sparray.ElementAt(pos).ElementAt(3);
  4132. str += ";";
  4133. pos++;
  4134. }
  4135. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4136. m_Print.DrawRect2(StrRect, 2);
  4137. StrRect = load2.m_rcarray.ElementAt(++rcpos);//8
  4138. if (needaddrow > 0)
  4139. addcount = 1;
  4140. else
  4141. addcount = 0;
  4142. needaddrow--;
  4143. str.Empty();
  4144. for (i = 0; i < rowcount + addcount; i++)
  4145. {
  4146. str += sparray.ElementAt(pos).ElementAt(5);
  4147. str += " 数量:";
  4148. str += sparray.ElementAt(pos).ElementAt(3);
  4149. str += ";";
  4150. pos++;
  4151. }
  4152. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4153. m_Print.DrawRect2(StrRect, 2);
  4154. StrRect = load2.m_rcarray.ElementAt(++rcpos);//9
  4155. if (needaddrow > 0)
  4156. addcount = 1;
  4157. else
  4158. addcount = 0;
  4159. needaddrow--;
  4160. str.Empty();
  4161. for (i = 0; i < rowcount + addcount; i++)
  4162. {
  4163. str += sparray.ElementAt(pos).ElementAt(5);
  4164. str += " 数量:";
  4165. str += sparray.ElementAt(pos).ElementAt(3);
  4166. str += ";";
  4167. pos++;
  4168. }
  4169. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4170. m_Print.DrawRect2(StrRect, 2);
  4171. StrRect = load2.m_rcarray.ElementAt(++rcpos);//10
  4172. if (needaddrow > 0)
  4173. addcount = 1;
  4174. else
  4175. addcount = 0;
  4176. needaddrow--;
  4177. str.Empty();
  4178. for (i = 0; i < rowcount + addcount; i++)
  4179. {
  4180. str += sparray.ElementAt(pos).ElementAt(5);
  4181. str += " 数量:";
  4182. str += sparray.ElementAt(pos).ElementAt(3);
  4183. str += ";";
  4184. pos++;
  4185. }
  4186. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4187. m_Print.DrawRect2(StrRect, 2);
  4188. StrRect = load2.m_rcarray.ElementAt(++rcpos);//11
  4189. if (needaddrow > 0)
  4190. addcount = 1;
  4191. else
  4192. addcount = 0;
  4193. needaddrow--;
  4194. str.Empty();
  4195. for (i = 0; i < rowcount + addcount; i++)
  4196. {
  4197. str += sparray.ElementAt(pos).ElementAt(5);
  4198. str += " 数量:";
  4199. str += sparray.ElementAt(pos).ElementAt(3);
  4200. str += ";";
  4201. pos++;
  4202. }
  4203. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4204. m_Print.DrawRect2(StrRect, 2);
  4205. StrRect = load2.m_rcarray.ElementAt(++rcpos);//12
  4206. if (needaddrow > 0)
  4207. addcount = 1;
  4208. else
  4209. addcount = 0;
  4210. needaddrow--;
  4211. str.Empty();
  4212. for (i = 0; i < rowcount + addcount; i++)
  4213. {
  4214. str += sparray.ElementAt(pos).ElementAt(5);
  4215. str += " 数量:";
  4216. str += sparray.ElementAt(pos).ElementAt(3);
  4217. str += ";";
  4218. pos++;
  4219. }
  4220. AutoDraw(m_Print, StrRect, str, 1.4); m_Print.SetFontFace(11, 1, "宋体");
  4221. m_Print.DrawRect2(StrRect, 2);
  4222. /* StrRect=load2.m_rcarray .ElementAt (++rcpos);//12
  4223. if(needaddrow>0)
  4224. addcount=1;
  4225. else
  4226. addcount=0;
  4227. needaddrow--;
  4228. str.Empty ();
  4229. for( i=0; i<rowcount+addcount; i++)
  4230. {
  4231. str+=sparray.ElementAt (pos).ElementAt (5);
  4232. str+=" 数量:";
  4233. str+=sparray.ElementAt (pos).ElementAt (3);
  4234. str+=";";
  4235. pos++;
  4236. }
  4237. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4238. m_Print.DrawRect2(StrRect, 2);
  4239. StrRect=load2.m_rcarray .ElementAt (++rcpos);//14
  4240. if(needaddrow>0)
  4241. addcount=1;
  4242. else
  4243. addcount=0;
  4244. needaddrow--;
  4245. str.Empty ();
  4246. for( i=0; i<rowcount+addcount; i++)
  4247. {
  4248. str+=sparray.ElementAt (pos).ElementAt (5);
  4249. str+=" 数量:";
  4250. str+=sparray.ElementAt (pos).ElementAt (3);
  4251. str+=";";
  4252. pos++;
  4253. }
  4254. AutoDraw(m_Print, StrRect, str, 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4255. m_Print.DrawRect2(StrRect, 2);*/
  4256. CRect sprc[2];
  4257. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4258. // AutoDraw(m_Print, StrRect, m_bz.Left (leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4259. m_Print.DrawRect2(StrRect, 2);
  4260. sprc[0] = StrRect;
  4261. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  4262. // AutoDraw(m_Print, StrRect, m_bz.Right (leng-leng/2), 1.4);m_Print.SetFontFace(11, 1, "宋体");
  4263. m_Print.DrawRect2(StrRect, 2);
  4264. sprc[1] = StrRect;
  4265. //AutoDraw(m_Print, StrRect, m_bz, 1.4);
  4266. {
  4267. CString temp, tempspno, tempbz;
  4268. CSize size;
  4269. BOOL bRun = 0;
  4270. int fontsize = 12;
  4271. ll: tempspno = m_bz;
  4272. m_Print.SetFontFace(fontsize, 1, "宋体");
  4273. for (i = 0; i<2; i++)
  4274. {
  4275. if (!tempspno.IsEmpty())
  4276. {
  4277. temp = tempspno;
  4278. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4279. int right = 0;
  4280. CRect temprc = sprc[i];
  4281. while (size.cx>temprc.Width())
  4282. {
  4283. right++;
  4284. temp = tempspno.Left(tempspno.GetLength() - (right));
  4285. if (GIsHalfHZ(temp))
  4286. {
  4287. right++;
  4288. temp.Delete(temp.GetLength() - 1);
  4289. }
  4290. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  4291. }
  4292. if (bRun)
  4293. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4294. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  4295. if (tempspno.IsEmpty())i++;
  4296. }
  4297. }
  4298. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  4299. {
  4300. fontsize--;
  4301. goto ll;
  4302. }
  4303. if (bRun == 0)
  4304. {
  4305. bRun = 1;
  4306. goto ll;
  4307. }
  4308. }
  4309. m_Print.SetFontFace(11, 1, "宋体");
  4310. //////////////////////load3
  4311. rcpos = -1;
  4312. for (i = 0; i < 24; i++)
  4313. {
  4314. StrRect = load3.m_rcarray.ElementAt(i);
  4315. m_Print.DrawRect2(StrRect, 1);
  4316. }
  4317. CStringArray strarray;
  4318. strarray.Add("营业员");
  4319. strarray.Add("前台接待");
  4320. strarray.Add("化妆师");
  4321. strarray.Add("礼服师");
  4322. strarray.Add("摄影师");
  4323. strarray.Add("摄影助理");
  4324. strarray.Add("美工师");
  4325. strarray.Add("设计师");
  4326. for (i = 0; i < 8; i++)
  4327. {
  4328. StrRect = load3.m_rcarray.ElementAt(i);
  4329. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4330. }
  4331. strarray.RemoveAll();
  4332. strarray.Add(m_ren);
  4333. strarray.Add(g_List1array.ElementAt(0).ElementAt(49));
  4334. strarray.Add(m_waiter2);
  4335. strarray.Add(g_List1array.ElementAt(0).ElementAt(51));
  4336. strarray.Add(m_waiter1);
  4337. strarray.Add(g_List1array.ElementAt(0).ElementAt(50));
  4338. strarray.Add("");
  4339. strarray.Add(m_waiter4);
  4340. for (i = 8; i < 16; i++)
  4341. {
  4342. StrRect = load3.m_rcarray.ElementAt(i);
  4343. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 8), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4344. }
  4345. StrRect = load3.m_rcarray.ElementAt(27);
  4346. m_Print.DrawText((LPTSTR)(LPCTSTR)"客户电话: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4347. StrRect = load3.m_rcarray.ElementAt(28);
  4348. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4349. m_Print.SetFontFace(13, 1, "宋体");
  4350. StrRect = load3.m_rcarray.ElementAt(25);
  4351. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4352. StrRect = load3.m_rcarray.ElementAt(26);
  4353. m_Print.DrawRect2(StrRect, 2);
  4354. StrRect = load3.m_rcarray.ElementAt(24);
  4355. str = "\
  4356. 顾客须知\r\n\
  4357. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  4358. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  4359. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  4360. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  4361. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  4362. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  4363. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  4364. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  4365. AutoDraw(m_Print, StrRect, str, 1.8);
  4366. PrintPreview dlg;
  4367. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4368. dlg.m_pDC = m_Print.GetPDC();
  4369. if (dlg.DoModal() != IDOK)return;
  4370. //结束打印
  4371. m_Print.EndPage();
  4372. m_Print.EndPrint();
  4373. }
  4374. void CMainFrame::PrintDailyForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4375. {
  4376. // TODO: Add your control notification handler code here
  4377. int pages = Listarray->GetSize() / 46;
  4378. if (Listarray->GetSize() % 46)pages++;
  4379. for (int aa = 0; aa < pages; aa++)
  4380. {
  4381. PrintPreview dlg;
  4382. CPrintRX m_Print;
  4383. m_Print.InitToPrint(NULL, 1);
  4384. m_Print.StartPrint();
  4385. m_Print.StartPage();
  4386. CRect mainrc(0, 0, 560, 793);
  4387. float fscale;
  4388. {
  4389. int w, h;
  4390. m_Print.GetWidHei(w, h);
  4391. fscale = (float)w / (float)h;
  4392. }
  4393. mainrc.DeflateRect(25, 40, 10, 0);
  4394. CRect rc, rc2;
  4395. rc = mainrc;
  4396. rc.bottom = rc.top;
  4397. rc.top -= 20;
  4398. m_Print.SetFontFace(16, 1, "黑体");
  4399. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4400. m_Print.SetFontFace(9, 1, "宋体");
  4401. CString str;
  4402. int wid[4] = { 320, 60, 60, 90 };
  4403. int hei = 16;
  4404. if (fscale > 0.71)hei = 15;
  4405. rc = mainrc;
  4406. rc.bottom = rc.top + hei;
  4407. for (int i = 0; i < 47; i++)
  4408. {
  4409. rc2.top = rc.top + i*hei;
  4410. rc2.bottom = rc.bottom + i*hei;
  4411. rc2.left = rc.left;
  4412. rc2.right = rc.left + wid[0];
  4413. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  4414. for (int j = 0; j<4; j++)
  4415. {
  4416. m_Print.DrawRect2(rc2, 1);
  4417. if (Listarray->GetSize()>aa * 46 + i)
  4418. {
  4419. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  4420. rc2.left += 3;
  4421. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4422. rc2.left -= 3;
  4423. }
  4424. rc2.left += wid[j];
  4425. rc2.right = rc2.left + wid[j + 1];
  4426. }
  4427. }
  4428. rc2.top += 2;
  4429. rc2.left += 2; rc2.right = mainrc.right + 4;
  4430. m_Print.SetFontFace(8, 1, "宋体");
  4431. int infopos = info.Find("***");
  4432. if (infopos != -1)
  4433. {
  4434. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Left(infopos), rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4435. CRect rc3 = rc2;
  4436. rc3.top = rc2.bottom - 4;
  4437. m_Print.DrawText((LPTSTR)(LPCTSTR)info.Right(info.GetLength() - infopos - 3), rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4438. }
  4439. else
  4440. m_Print.DrawText((LPTSTR)(LPCTSTR)info, rc2, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4441. str.Format(" 页:%d/%d", aa + 1, pages);
  4442. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4443. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  4444. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4445. dlg.m_pDC = m_Print.GetPDC();
  4446. // dlg.m_mode=1;
  4447. if (aa == 0)
  4448. {
  4449. if (dlg.DoModal() != IDOK)
  4450. return;
  4451. }
  4452. //结束打印
  4453. m_Print.EndPage();
  4454. m_Print.EndPrint();
  4455. }
  4456. }
  4457. void CMainFrame::PrintLoginForm(CArray<CStringArray, CStringArray>*Listarray, CString title, CString info)
  4458. {
  4459. // TODO: Add your control notification handler code here
  4460. int sinlecount = 33 * 6;
  4461. int pages = Listarray->GetSize() / sinlecount;
  4462. if (Listarray->GetSize() % sinlecount)pages++;
  4463. for (int aa = 0; aa < pages; aa++)
  4464. {
  4465. PrintPreview dlg;
  4466. CPrintRX m_Print;
  4467. m_Print.InitToPrint(NULL, 1);
  4468. m_Print.StartPrint();
  4469. m_Print.StartPage();
  4470. CRect mainrc(0, 0, 560, 793);
  4471. float fscale;
  4472. {
  4473. int w, h;
  4474. m_Print.GetWidHei(w, h);
  4475. fscale = (float)w / (float)h;
  4476. }
  4477. mainrc.DeflateRect(25, 40, 10, 0);
  4478. CString str;
  4479. CRect rc, rc2;
  4480. rc = mainrc;
  4481. rc.bottom = rc.top;
  4482. rc.top -= 20;
  4483. rc.left -= 20;
  4484. m_Print.SetFontFace(12, 1, "黑体");
  4485. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  4486. m_Print.SetFontFace(6, 1, "宋体");
  4487. str.Format(" 页:%d/%d", aa + 1, pages);
  4488. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4489. rc.right = mainrc.right + 20;
  4490. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4491. int wid[2] = { 50, 110 };
  4492. int hei = 11;
  4493. rc = mainrc;
  4494. rc.bottom = rc.top + hei;
  4495. rc.top += 10;
  4496. rc.bottom += 10;
  4497. int dtx = rc.Width() / 3 + 18;
  4498. int dty = 380;
  4499. for (int j = 0; j < 6; j++)
  4500. {
  4501. if (Listarray->GetSize() < aa*sinlecount + 33 * (j + 1))continue;
  4502. for (int i = 0; i < 33; i++)
  4503. {
  4504. rc2.top = rc.top + i*hei;
  4505. rc2.bottom = rc.bottom + i*hei;
  4506. rc2.left = rc.left;
  4507. rc2.right = rc.left + wid[0];
  4508. if (i == 0)
  4509. {
  4510. // rc2.left +=wid[1];
  4511. rc2.right += wid[1];
  4512. }
  4513. if (j == 1 || j == 4)
  4514. {
  4515. rc2.left += dtx;
  4516. rc2.right += dtx;
  4517. }
  4518. if (j == 2 || j == 5)
  4519. {
  4520. rc2.left += dtx * 2;
  4521. rc2.right += dtx * 2;
  4522. }
  4523. if (j == 3 || j == 4 || j == 5)
  4524. {
  4525. rc2.top += dty;
  4526. rc2.bottom += dty;
  4527. }
  4528. m_Print.DrawRect2(rc2, 1);
  4529. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4530. {
  4531. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(0);
  4532. rc2.left += 3;
  4533. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4534. rc2.left -= 3;
  4535. }
  4536. if (i == 0)continue;
  4537. rc2.left = rc2.right;
  4538. rc2.right += wid[1];
  4539. m_Print.DrawRect2(rc2, 1);
  4540. if (Listarray->GetSize() > aa*sinlecount + 33 * j + i)
  4541. {
  4542. if (Listarray->ElementAt(aa*sinlecount + 33 * j + i).GetSize() > 1)
  4543. {
  4544. str = Listarray->ElementAt(aa*sinlecount + 33 * j + i).ElementAt(1);
  4545. rc2.left += 3;
  4546. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4547. rc2.left -= 3;
  4548. }
  4549. }
  4550. /* if(Listarray->GetSize ()>aa*46+i)
  4551. {
  4552. str=Listarray->ElementAt (aa*46+i).ElementAt (j);
  4553. rc2.left +=3;
  4554. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4555. rc2.left -=3;
  4556. }
  4557. rc2.left +=wid[j];
  4558. rc2.right =rc2.left+wid[j+1];*/
  4559. }
  4560. }
  4561. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4562. dlg.m_pDC = m_Print.GetPDC();
  4563. if (aa == 0)
  4564. {
  4565. if (dlg.DoModal() != IDOK)
  4566. return;
  4567. }
  4568. //结束打印
  4569. m_Print.EndPage();
  4570. m_Print.EndPrint();
  4571. }
  4572. }
  4573. void CMainFrame::PrintTakeForm(CArray<CStringArray, CStringArray>*Listarray)
  4574. {
  4575. CString title;
  4576. CString info;
  4577. // TODO: Add your control notification handler code here
  4578. int sinlecount = 4;
  4579. int pages = Listarray->GetSize() / sinlecount;
  4580. if (Listarray->GetSize() % sinlecount)pages++;
  4581. for (int aa = 0; aa < pages; aa++)
  4582. {
  4583. PrintPreview dlg;
  4584. CPrintRX m_Print;
  4585. m_Print.InitToPrint(NULL, 1);
  4586. m_Print.StartPrint();
  4587. m_Print.StartPage();
  4588. CRect mainrc(0, 0, 560, 793);
  4589. float fscale;
  4590. {
  4591. int w, h;
  4592. m_Print.GetWidHei(w, h);
  4593. fscale = (float)w / (float)h;
  4594. }
  4595. mainrc.DeflateRect(25, 40, 10, 0);
  4596. CString str;
  4597. CRect rc, rc2;
  4598. rc = mainrc;
  4599. rc.bottom = rc.top;
  4600. rc.top -= 20;
  4601. rc.left -= 20;
  4602. m_Print.SetFontFace(6, 1, "宋体");
  4603. str.Format(" 页:%d/%d", aa + 1, pages);
  4604. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  4605. rc.right = mainrc.right + 10;
  4606. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  4607. m_Print.SetFontFace(12, 1, "宋体");
  4608. int wid[2] = { 70, 190 };
  4609. int hei = 22;
  4610. rc = mainrc;
  4611. rc.bottom = rc.top + hei;
  4612. rc.top += 10;
  4613. rc.bottom += 10;
  4614. int dtx = rc.Width() / 2 + 18;
  4615. int dty = 380;
  4616. int arraysize = Listarray->ElementAt(0).GetSize();
  4617. for (int j = 0; j < 4; j++)
  4618. {
  4619. if (Listarray->GetSize() <= aa*sinlecount + j)continue;
  4620. for (int i = 0; i < arraysize; i++)
  4621. {
  4622. rc2.top = rc.top + i / 2 * hei;
  4623. rc2.bottom = rc.bottom + i / 2 * hei;
  4624. rc2.left = rc.left;
  4625. rc2.right = rc.left + wid[0];
  4626. if (i % 2)
  4627. {
  4628. rc2.left = rc2.right;
  4629. rc2.right += wid[1];
  4630. }
  4631. if (j == 1 || j == 3)
  4632. {
  4633. rc2.left += dtx;
  4634. rc2.right += dtx;
  4635. }
  4636. if (j == 2 || j == 3)
  4637. {
  4638. rc2.top += dty;
  4639. rc2.bottom += dty;
  4640. }
  4641. if (i == arraysize - 1 || i == arraysize - 2)
  4642. {
  4643. rc2.bottom += hei * 2;
  4644. }
  4645. m_Print.DrawRect2(rc2, 1);
  4646. {
  4647. str = Listarray->ElementAt(aa*sinlecount + j).ElementAt(i);
  4648. if (i == arraysize - 1)
  4649. {
  4650. CRect rc3 = rc2;
  4651. rc3.left += 3;
  4652. rc3.top += 3;
  4653. AutoDraw(m_Print, rc3, str, 1.4);
  4654. }
  4655. else if (i == arraysize - 2)
  4656. {
  4657. CRect rc3 = rc2;
  4658. rc3.left += 3;
  4659. rc3.top += 3;
  4660. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc3, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4661. }
  4662. else
  4663. {
  4664. rc2.left += 3;
  4665. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4666. rc2.left -= 3;
  4667. }
  4668. }
  4669. }
  4670. }
  4671. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4672. dlg.m_pDC = m_Print.GetPDC();
  4673. if (aa == 0)
  4674. {
  4675. if (dlg.DoModal() != IDOK)
  4676. return;
  4677. }
  4678. //结束打印
  4679. m_Print.EndPage();
  4680. m_Print.EndPrint();
  4681. }
  4682. }
  4683. void CMainFrame::PrintThumbNail(CStringArray *array, CString client, BOOL bDir, CString m_size)
  4684. {
  4685. // TODO: Add your control notification handler code here
  4686. CStringArray titlearray;
  4687. CStringArray namearray;
  4688. CStringArray noarray;
  4689. CArray<CRect, CRect>rcarray;
  4690. CArray<CRect, CRect>widtharray;
  4691. if (m_size != "")
  4692. {
  4693. int pos = m_size.Find(";");
  4694. while (pos != -1)
  4695. {
  4696. CString size = m_size.Left(pos);
  4697. int pos2 = size.Find(":");
  4698. if (pos2 != -1)
  4699. {
  4700. CString str;
  4701. CRect rc;
  4702. str = size.Left(pos2);
  4703. noarray.Add(str);
  4704. str = size.Right(size.GetLength() - pos2 - 1);
  4705. pos2 = str.Find(",");
  4706. namearray.Add(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4707. pos2 = str.Find(",");
  4708. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4709. pos2 = str.Find(",");
  4710. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4711. widtharray.Add(rc);
  4712. pos2 = str.Find(",");
  4713. rc.left = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4714. pos2 = str.Find(",");
  4715. rc.top = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4716. pos2 = str.Find(",");
  4717. rc.right = atoi(str.Left(pos2)); str.Delete(0, pos2 + 1);
  4718. rc.bottom = atoi(str);
  4719. rcarray.Add(rc);
  4720. }
  4721. m_size = m_size.Right(m_size.GetLength() - pos - 1);
  4722. pos = m_size.Find(";");
  4723. }
  4724. }
  4725. PrintPreview dlg;
  4726. CPrintRX m_Print;
  4727. m_Print.InitToPrint(NULL, 1);
  4728. m_Print.StartPrint();
  4729. m_Print.StartPage();
  4730. CRect mainrc(0, 0, 560, 793);
  4731. mainrc.DeflateRect(25, 50, 10, 0);
  4732. m_Print.SetFontFace(10, 1, "宋体");
  4733. CRect rc, rc2;
  4734. rc = mainrc;
  4735. rc.bottom = rc.top;
  4736. rc.top -= 20;
  4737. m_Print.DrawText((LPTSTR)(LPCTSTR)client, rc, 0, 0, FORMAT_LEFT | FORMAT_UP);
  4738. rc.bottom -= 5;
  4739. m_Print.DrawRect2(rc, 2);
  4740. if (array->GetSize() > 130)m_Print.SetFontFace(8, 1, "宋体");
  4741. if (bDir)m_Print.SetFontFace(6, 1, "宋体");
  4742. ////////////////////////////////////////////////////////////////
  4743. int imgcount = array->GetSize();
  4744. int dtx = 5;
  4745. int dty = 15;
  4746. int cx, cy;
  4747. int countx = 5;
  4748. int county = 1;
  4749. while (1)
  4750. {
  4751. if (countx*county >= imgcount)
  4752. {
  4753. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  4754. cy = cx * 4 / 3;
  4755. break;
  4756. }
  4757. else
  4758. {
  4759. cx = (mainrc.Width() - (countx - 1)*dtx) / countx;
  4760. cy = cx * 4 / 3;
  4761. if (cy*(county + 1) + dty*county < mainrc.Height())//Y方向可以增加一个
  4762. {
  4763. county++;
  4764. }
  4765. else//Y方向不能加,X方向加
  4766. {
  4767. countx++;
  4768. county = 1;
  4769. }
  4770. }
  4771. }
  4772. int imgpos = 0;
  4773. CString stemp;
  4774. CPen pen(PS_SOLID, 1, RGB(255, 0, 0));
  4775. CPen *oldpen = m_Print.m_DC.SelectObject(&pen);
  4776. CPen *oldpen2 = m_Print.m_memdc.SelectObject(&pen);
  4777. for (int i = 0; i < county; i++)
  4778. {
  4779. for (int j = 0; j < countx; j++)
  4780. {
  4781. rc = mainrc;
  4782. rc.top += i*(cy + dty);
  4783. rc.left += j*(cx + dtx);
  4784. rc.right = rc.left + cx;
  4785. rc.bottom = rc.top + cy;
  4786. Image *pImg = NULL;
  4787. if (imgpos >= array->GetSize())break;
  4788. CString str = array->ElementAt(imgpos);
  4789. CString spath = str.Left(str.ReverseFind('\\') + 1);
  4790. spath += "m";
  4791. spath += str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  4792. if (PathFileExists(spath))
  4793. ::LoadImageFromBuf(&pImg, spath);
  4794. else
  4795. {
  4796. ::LoadImageFromBuf(&pImg, str);
  4797. if (pImg == NULL)continue;
  4798. int orientation = GetOrientation(pImg);
  4799. if (orientation == 8)
  4800. pImg->RotateFlip(Rotate270FlipNone);
  4801. else if (orientation == 6)
  4802. pImg->RotateFlip(Rotate90FlipNone);
  4803. }
  4804. if (pImg == NULL)continue;
  4805. rc2 = rc;
  4806. RectFitDes(pImg->GetWidth(), pImg->GetHeight(), rc);
  4807. imgpos++;
  4808. m_Print.DrawImage(pImg, rc);
  4809. int imgwidth = pImg->GetWidth();
  4810. delete pImg;
  4811. rc2.top = rc2.bottom + 3;
  4812. rc2.bottom += 10;
  4813. if (bDir == 0)
  4814. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  4815. else
  4816. {
  4817. stemp = str.Left(str.ReverseFind('\\'));
  4818. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  4819. if (stemp.ReverseFind('\\') != -1)
  4820. {
  4821. stemp = stemp.Right(stemp.GetLength() - stemp.ReverseFind('\\') - 1);
  4822. str = stemp + "\\" + str;
  4823. }
  4824. }
  4825. if (str.Find(".") != -1)
  4826. str = str.Left(str.Find("."));
  4827. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  4828. if (noarray.GetSize())
  4829. {
  4830. rc2 = rc;
  4831. for (int aa = 0; aa < noarray.GetSize(); aa++)
  4832. {
  4833. float scale = (float)rc2.Width() / (float)imgwidth;
  4834. if (noarray.ElementAt(aa) == str)
  4835. {
  4836. int nIndex = aa;
  4837. CRect rc = rcarray.ElementAt(nIndex);
  4838. int wid = widtharray.ElementAt(nIndex).left;
  4839. int hei = widtharray.ElementAt(nIndex).top;
  4840. scale *= (float)imgwidth / (float)wid;
  4841. rc.left *= scale;
  4842. rc.right *= scale;
  4843. rc.top *= scale;
  4844. rc.bottom *= scale;
  4845. rc.left += rc2.left;
  4846. rc.right += rc2.left;
  4847. rc.top += rc2.top;
  4848. rc.bottom += rc2.top;
  4849. if (rc.left < rc2.left)rc.left = rc2.left;
  4850. if (rc.right > rc2.right)rc.right = rc2.right;
  4851. if (rc.top < rc2.top)rc.top = rc2.top;
  4852. if (rc.bottom > rc2.bottom)rc.bottom = rc2.bottom;
  4853. m_Print.DrawRect2(rc, 1);
  4854. }
  4855. }
  4856. }
  4857. }
  4858. }
  4859. m_Print.m_DC.SelectObject(oldpen);
  4860. m_Print.m_memdc.SelectObject(oldpen2);
  4861. /* CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  4862. StrRect.top -=15;StrRect.bottom -=15;
  4863. Image *pImg=NULL;
  4864. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  4865. m_Print.DrawImage(pImg, StrRect);
  4866. delete pImg;
  4867. m_Print.SetFontFace(10, 1, "宋体");
  4868. StrRect=load.m_rcarray .ElementAt (20);
  4869. StrRect.right=load.m_rcarray .ElementAt (23).right;
  4870. StrRect.top -=18;StrRect.bottom -=18;
  4871. CString str="地址:"+g_cominfoarray.ElementAt (0).ElementAt (12);
  4872. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  4873. */
  4874. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  4875. dlg.m_pDC = m_Print.GetPDC();
  4876. if (dlg.DoModal() != IDOK)
  4877. return;
  4878. //结束打印
  4879. m_Print.EndPage();
  4880. m_Print.EndPrint();
  4881. }
  4882. // remark by Jeff
  4883. // 函数:PrintDinDan
  4884. // 参数:
  4885. // strOrderNumber:订单单号;(Order number)
  4886. // 返回:void
  4887. // 注意:#
  4888. void CMainFrame::PrintDinDan(CString strOrderNumber)//打印订单报表;
  4889. {
  4890. int printcot = 1;
  4891. for (int aa = 0; aa < printcot; aa++)
  4892. {
  4893. PrintPreview dlg;
  4894. CPrintRX m_Print;
  4895. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  4896. {
  4897. m_Print.InitToPrint(NULL, 1);
  4898. }
  4899. else
  4900. {
  4901. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  4902. if (name.IsEmpty())
  4903. m_Print.InitToPrint(NULL, 1);
  4904. else
  4905. {
  4906. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  4907. if (nret == -1 && aa == 0)
  4908. {
  4909. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  4910. }
  4911. }
  4912. }
  4913. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 0)
  4914. {
  4915. #ifdef ZHIAI_VERSION
  4916. PrintDinDan3(strOrderNumber);
  4917. return;
  4918. #endif
  4919. #ifdef SZBLCT_VERSION
  4920. PrintDinDan4(strOrderNumber);
  4921. return;
  4922. #endif
  4923. m_Print.StartPrint();
  4924. m_Print.StartPage();
  4925. LoadRect load;
  4926. load.SetLiaPath("6.lia");
  4927. load.SetMargins(-14, 15);
  4928. if (!load.Load())return;
  4929. LoadRect load2;
  4930. load2.SetLiaPath("7.lia");
  4931. load2.SetMargins(-14, 216 + 15);
  4932. if (!load2.Load())return;
  4933. LoadRect load3;
  4934. load3.SetLiaPath("8.lia");
  4935. load3.SetMargins(-14, 705 + 15);
  4936. if (!load3.Load())return;
  4937. int i;
  4938. //////////////////////////////////////////////////////////////
  4939. CStringArray txarray;
  4940. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  4941. g_sendhead.code[0] = 11;
  4942. g_sendhead.code[1] = 52;
  4943. g_sendhead.code[2] = 50;
  4944. g_sendhead.code[3] = 150;
  4945. g_sendhead.code[4] = 77;
  4946. g_sendhead.code[5] = 4;
  4947. g_sendhead.tabcount = 6;
  4948. g_sendhead.bsql = 0;
  4949. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  4950. CArray<CStringArray, CStringArray>sparray;
  4951. CArray<CStringArray, CStringArray>clientarray;
  4952. CArray<CStringArray, CStringArray>phonearray;
  4953. CArray<CStringArray, CStringArray>fgarray;
  4954. CArray<CStringArray, CStringArray>danweiarray;
  4955. CArray<CStringArray, CStringArray>jdarray;
  4956. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  4957. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  4958. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  4959. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  4960. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  4961. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  4962. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  4963. CString m_taoxiname;
  4964. if (m_zs.Find("\\") != -1)
  4965. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  4966. else
  4967. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  4968. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  4969. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  4970. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  4971. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  4972. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  4973. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  4974. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  4975. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  4976. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  4977. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  4978. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  4979. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  4980. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  4981. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  4982. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  4983. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  4984. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  4985. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  4986. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  4987. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  4988. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  4989. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  4990. if (jdarray.GetSize())
  4991. {
  4992. if (m_bz.IsEmpty() == 0)
  4993. m_bz = "\r\n" + m_bz;
  4994. m_bz += "景点:";
  4995. }
  4996. #ifdef DDF_VERSION
  4997. m_bz += "219店:219路馨园小区对面\r\n";
  4998. m_bz += "金色店:万科金色家园小区东门南走20米荣光社区一楼\r\n";
  4999. m_bz += "万泰店:万泰锦绣华城小区正门\r\n";
  5000. #else
  5001. for (i = 0; i < jdarray.GetSize(); i++)
  5002. {
  5003. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5004. }
  5005. m_bz.TrimRight(";");
  5006. #endif
  5007. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5008. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5009. if (IsHasRights2new(31) == 0)
  5010. {
  5011. m_phone1 = "***";
  5012. m_phone2 = "***";
  5013. }
  5014. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5015. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5016. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  5017. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  5018. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  5019. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  5020. filter = "staff_name='" + m_ren + "'";
  5021. g_sendhead.code[0] = 5;
  5022. g_sendhead.tabcount = 1;
  5023. g_sendhead.bsql = 0;
  5024. int g_nYearposTemp = g_nYearpos;
  5025. g_nYearpos = -1;
  5026. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5027. g_nYearpos = g_nYearposTemp;
  5028. if (g_bSendOK == 0)return;
  5029. DataToArray(&phonearray);
  5030. m_money1.Format("%f", atof(m_taoxijiage));
  5031. m_money2.Format("%f", atof(m_payed1));
  5032. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5033. ConvertToPrice(m_money1);
  5034. ConvertToPrice(m_money2);
  5035. ConvertToPrice(m_money3);
  5036. ////////////////////////////////////////////////////////////////
  5037. int rcpos = -1;
  5038. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  5039. StrRect.top -= 15; StrRect.bottom -= 15;
  5040. Image *pImg = NULL;
  5041. #ifdef MNLS_VERSION
  5042. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  5043. #else
  5044. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  5045. #endif
  5046. m_Print.DrawImage(pImg, StrRect);
  5047. delete pImg;
  5048. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5049. {
  5050. Image *pImg = NULL;
  5051. g_nSendCode = 31;
  5052. int g_nYearposTemp = g_nYearpos;
  5053. g_nYearpos = -1;
  5054. g_pMainWnd->ProcessChatMessageRequest2(1);
  5055. g_nYearpos = g_nYearposTemp;
  5056. g_nSendCode = 0;
  5057. if (g_bSendOK == 0)return;
  5058. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5059. if (pImg)
  5060. {
  5061. StrRect.left = 30;
  5062. StrRect.top = 12;
  5063. StrRect.right = StrRect.left + 60;
  5064. StrRect.bottom = StrRect.top + 60;
  5065. m_Print.DrawImage(pImg, StrRect);
  5066. delete pImg; pImg = NULL;
  5067. }
  5068. }
  5069. m_Print.SetFontFace(11, 1, "宋体");
  5070. StrRect = load.m_rcarray.ElementAt(20);
  5071. StrRect.right = load.m_rcarray.ElementAt(23).right;
  5072. StrRect.top -= 18; StrRect.bottom -= 18;
  5073. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  5074. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5075. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  5076. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5077. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5078. StrRect.top -= 15; StrRect.bottom -= 15;
  5079. #ifdef MNLS_VERSION
  5080. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5081. #endif
  5082. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5083. StrRect.top -= 15; StrRect.bottom -= 15;
  5084. #ifdef MNLS_VERSION
  5085. m_Print.DrawRect(StrRect);
  5086. #endif
  5087. m_Print.SetFontFace(7, 1, "黑体");
  5088. m_Print.SetColor(0xffffff);
  5089. #ifdef MNLS_VERSION
  5090. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5091. #endif
  5092. m_Print.SetColor(0);
  5093. m_Print.SetFontFace(15, 1, "宋体");
  5094. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5095. StrRect.top -= 15; StrRect.bottom -= 15;
  5096. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同预约订单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5097. CStringArray strarray;
  5098. strarray.Add("NO: " + strOrderNumber);
  5099. CString date;
  5100. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  5101. strarray.Add(date);
  5102. strarray.Add("喜爱");
  5103. strarray.Add("格调");
  5104. if (fgarray.GetSize() == 12)
  5105. {
  5106. for (int i = 0; i < 12; i++)
  5107. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  5108. }
  5109. else
  5110. {
  5111. strarray.Add("复古典雅");
  5112. strarray.Add("温文尔雅");
  5113. strarray.Add("豪华艳丽");
  5114. strarray.Add("传统大方");
  5115. strarray.Add("新潮个性");
  5116. strarray.Add("浪漫奔放");
  5117. strarray.Add("简单素雅");
  5118. strarray.Add("活泼俏丽");
  5119. strarray.Add("妩媚温馨");
  5120. strarray.Add("温柔贤惠");
  5121. strarray.Add("成熟感性");
  5122. strarray.Add("清纯可爱");
  5123. }
  5124. strarray.Add("姓名");
  5125. // strarray.Add("职业");
  5126. strarray.Add("");
  5127. strarray.Add("地址");
  5128. strarray.Add("电话");
  5129. #ifdef CHILD_VERSION
  5130. strarray.Add("家长");
  5131. strarray.Add("宝宝");
  5132. #else
  5133. strarray.Add("先生");
  5134. strarray.Add("女士");
  5135. #endif
  5136. m_Print.SetFontFace(11, 1, "宋体");
  5137. for (i = 0; i < strarray.GetSize(); i++)
  5138. {
  5139. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5140. if (i < 2)
  5141. {
  5142. StrRect.top -= 15; StrRect.bottom -= 15;
  5143. }
  5144. if (i>15)
  5145. m_Print.DrawRect2(StrRect, 1);
  5146. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5147. }
  5148. for (i = 29; i <= 40; i++)
  5149. {
  5150. if (m_style.GetLength() <= (i - 29))continue;
  5151. if (m_style.GetAt(i - 29) != '1')continue;
  5152. StrRect = load.m_rcarray.ElementAt(i - 1);
  5153. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5154. }
  5155. for (i = 27; i <= 48; i++)
  5156. {
  5157. StrRect = load.m_rcarray.ElementAt(++rcpos);
  5158. m_Print.DrawRect2(StrRect, 1);
  5159. }
  5160. #ifdef CHILD_VERSION
  5161. StrRect = load.m_rcarray.ElementAt(45);
  5162. StrRect.right = StrRect.left + 62;
  5163. m_Print.DrawRect2(StrRect, 1);
  5164. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5165. StrRect.left = StrRect.right;
  5166. StrRect.right = StrRect.left + 62;
  5167. m_Print.DrawRect2(StrRect, 1);
  5168. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5169. StrRect.left = StrRect.right;
  5170. StrRect.right = StrRect.left + 62;
  5171. m_Print.DrawRect2(StrRect, 1);
  5172. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5173. StrRect.left = StrRect.right;
  5174. StrRect.right = StrRect.left + 62;
  5175. m_Print.DrawRect2(StrRect, 1);
  5176. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5177. #endif
  5178. /////////////////////////
  5179. strarray.RemoveAll();
  5180. CString temp;
  5181. temp.Format("拍摄多款选 %d 款,其中影", atoi(m_outside) + atoi(m_outside2));
  5182. strarray.Add(temp);
  5183. temp.Format("棚景 %d 款,景点 %d 款.", atoi(m_outside2), atoi(m_outside));
  5184. strarray.Add(temp);
  5185. strarray.Add("化妆");
  5186. strarray.Add("造型");
  5187. #ifdef CHILD_VERSION
  5188. strarray.Add("");
  5189. #else
  5190. strarray.Add("婚纱");
  5191. #endif
  5192. strarray.Add("服饰");
  5193. strarray.Add("配");
  5194. strarray.Add("置");
  5195. strarray.Add("其");
  5196. strarray.Add("它");
  5197. strarray.Add("套系名称");
  5198. strarray.Add("镜款");
  5199. strarray.Add("套系总价");
  5200. strarray.Add("主摄影师");
  5201. strarray.Add("拍摄日期");
  5202. strarray.Add("定金");
  5203. #ifdef CHILD_VERSION
  5204. strarray.Add("主引导师");
  5205. #else
  5206. strarray.Add("主化妆师");
  5207. #endif
  5208. strarray.Add("看样日期");
  5209. strarray.Add("欠款余额");
  5210. strarray.Add("总监");
  5211. strarray.Add("取件日期");
  5212. rcpos = -1;
  5213. for (i = 0; i < strarray.GetSize(); i++)
  5214. {
  5215. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5216. if (i>9)
  5217. m_Print.DrawRect2(StrRect, 1);
  5218. #ifdef CHILD_VERSION
  5219. if (i == 5)
  5220. StrRect.top -= StrRect.Height();
  5221. #endif
  5222. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5223. }
  5224. for (i = 22; i <= 41; i++)
  5225. {
  5226. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  5227. m_Print.DrawRect2(StrRect, 1);
  5228. }
  5229. /////////////////////////////
  5230. strarray.RemoveAll();
  5231. #ifdef CHILD_VERSION
  5232. strarray.Add("顾客方 家长:");
  5233. strarray.Add("宝宝:");
  5234. #else
  5235. strarray.Add("顾客方 先生:");
  5236. strarray.Add("女士:");
  5237. #endif
  5238. strarray.Add("电话:");
  5239. strarray.Add("影楼方 店长:");
  5240. strarray.Add("接单人:");
  5241. strarray.Add("电话:");
  5242. rcpos = -1;
  5243. for (i = 0; i < strarray.GetSize(); i++)
  5244. {
  5245. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5246. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5247. }
  5248. for (i = 7; i <= 12; i++)
  5249. {
  5250. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  5251. // if(i!=10)
  5252. m_Print.DrawRect2(StrRect, 2);
  5253. }
  5254. //////////////////////////////////////
  5255. //开始打数据
  5256. strarray.RemoveAll();
  5257. strarray.Add(m_name1);
  5258. strarray.Add(m_name2);
  5259. /// strarray.Add (m_occupation1);
  5260. // strarray.Add (m_occupation2);
  5261. strarray.Add("");
  5262. strarray.Add("");
  5263. strarray.Add(m_addr1);
  5264. #ifdef CHILD_VERSION
  5265. strarray.Add("");
  5266. #else
  5267. strarray.Add(m_addr2);
  5268. #endif
  5269. strarray.Add(m_phone1);
  5270. strarray.Add(m_phone2);
  5271. for (i = 41; i <= 48; i++)
  5272. {
  5273. StrRect = load.m_rcarray.ElementAt(i - 1);
  5274. StrRect.left += 4;
  5275. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5276. }
  5277. ///////////////////////////////
  5278. strarray.RemoveAll();
  5279. strarray.Add(m_money1);
  5280. strarray.Add(m_waiter1);
  5281. strarray.Add(m_time2);
  5282. strarray.Add(m_money2);
  5283. strarray.Add(m_waiter2);
  5284. strarray.Add(m_time4);
  5285. strarray.Add(m_money3);
  5286. strarray.Add("");
  5287. strarray.Add(m_time5);
  5288. for (i = 32; i <= 40; i++)
  5289. {
  5290. StrRect = load2.m_rcarray.ElementAt(i - 1);
  5291. StrRect.left += 4;
  5292. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5293. }
  5294. ///////////////////////////////
  5295. strarray.RemoveAll();
  5296. strarray.Add(m_name1);
  5297. strarray.Add(m_name2);
  5298. CString phone;
  5299. if (m_phone1.IsEmpty() == 0)
  5300. phone = m_phone1 + ",";
  5301. phone += m_phone2;
  5302. phone.TrimRight(",");
  5303. strarray.Add(phone);
  5304. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  5305. strarray.Add(m_ren);
  5306. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  5307. for (i = 7; i <= 12; i++)
  5308. {
  5309. StrRect = load3.m_rcarray.ElementAt(i - 1);
  5310. StrRect.left += 4;
  5311. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5312. }
  5313. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  5314. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5315. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  5316. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5317. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  5318. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5319. //////////////////////////////
  5320. //开始画文字
  5321. StrRect = load2.m_rcarray.ElementAt(30);
  5322. StrRect.left += 3;
  5323. StrRect.top += 3;
  5324. StrRect.right -= 2;
  5325. StrRect.bottom -= 2;
  5326. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  5327. StrRect = load2.m_rcarray.ElementAt(29);
  5328. StrRect.left += 3;
  5329. StrRect.top += 3;
  5330. StrRect.right -= 2;
  5331. StrRect.bottom -= 2;
  5332. str = "";
  5333. for (i = 0; i < sparray.GetSize(); i++)
  5334. {
  5335. str += sparray.ElementAt(i).ElementAt(5);
  5336. str += " 数量:";
  5337. str += sparray.ElementAt(i).ElementAt(3);
  5338. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5339. str += "\r\n";
  5340. }
  5341. str.TrimRight("\r\n");
  5342. AutoDraw(m_Print, StrRect, str, 1.4);
  5343. StrRect = load2.m_rcarray.ElementAt(40);
  5344. StrRect.top += 8;
  5345. m_Print.SetFontFace(12, 1, "黑体");
  5346. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5347. StrRect.left += 3;
  5348. StrRect.top += 30;
  5349. StrRect.right -= 2;
  5350. StrRect.bottom -= 2;
  5351. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5352. if (str.IsEmpty())
  5353. {
  5354. str = "\
  5355. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5356. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5357. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5358. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5359. 持良好的心境.\r\n\
  5360. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5361. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5362. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5363. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5364. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5365. 勿进影室, 以免影响拍摄.\r\n\
  5366. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5367. 师或店长沟通.\r\n\
  5368. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5369. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5370. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5371. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5372. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5373. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5374. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5375. 还.";
  5376. }
  5377. AutoDraw(m_Print, StrRect, str, 1.8);
  5378. }
  5379. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 1)
  5380. {//AfxMessageBox("yyy");
  5381. m_Print.StartPrint();
  5382. m_Print.StartPage();
  5383. LoadRect load;
  5384. load.SetLiaPath("6-2.lia");
  5385. load.SetMargins(0, 0);
  5386. if (!load.Load())return;
  5387. int i;
  5388. //////////////////////////////////////////////////////////////
  5389. CStringArray txarray;
  5390. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底';id='" + strOrderNumber + "';;";
  5391. g_sendhead.code[0] = 11;
  5392. g_sendhead.code[1] = 52;
  5393. g_sendhead.code[2] = 50;
  5394. g_sendhead.code[3] = 150;
  5395. g_sendhead.code[4] = 77;
  5396. g_sendhead.code[5] = 4;
  5397. g_sendhead.tabcount = 6;
  5398. g_sendhead.bsql = 0;
  5399. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5400. CArray<CStringArray, CStringArray>sparray;
  5401. CArray<CStringArray, CStringArray>clientarray;
  5402. CArray<CStringArray, CStringArray>phonearray;
  5403. CArray<CStringArray, CStringArray>fgarray;
  5404. CArray<CStringArray, CStringArray>danweiarray;
  5405. CArray<CStringArray, CStringArray>jdarray;
  5406. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5407. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5408. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5409. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5410. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5411. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5412. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  5413. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5414. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5415. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5416. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5417. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5418. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5419. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5420. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5421. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5422. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5423. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5424. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5425. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5426. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5427. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5428. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5429. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5430. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5431. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5432. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5433. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5434. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5435. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5436. if (jdarray.GetSize())
  5437. {
  5438. if (m_bz.IsEmpty() == 0)
  5439. m_bz = "\r\n" + m_bz;
  5440. m_bz += "景点:";
  5441. }
  5442. for (i = 0; i < jdarray.GetSize(); i++)
  5443. {
  5444. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5445. }
  5446. m_bz.TrimRight(";");
  5447. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5448. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5449. if (IsHasRights2new(31) == 0)
  5450. {
  5451. m_phone1 = "***";
  5452. m_phone2 = "***";
  5453. }
  5454. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5455. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5456. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  5457. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  5458. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  5459. CString str;
  5460. filter = "staff_name='" + m_ren + "'";
  5461. g_sendhead.code[0] = 5;
  5462. g_sendhead.tabcount = 1;
  5463. g_sendhead.bsql = 0;
  5464. int g_nYearposTemp = g_nYearpos;
  5465. g_nYearpos = -1;
  5466. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5467. g_nYearpos = g_nYearposTemp;
  5468. if (g_bSendOK == 0)return;
  5469. DataToArray(&phonearray);
  5470. m_money1.Format("%f", atof(m_taoxijiage));
  5471. m_money2.Format("%f", atof(m_payed1));
  5472. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5473. ConvertToPrice(m_money1);
  5474. ConvertToPrice(m_money2);
  5475. ConvertToPrice(m_money3);
  5476. ////////////////////////////////////////////////////////////////
  5477. int rcpos = -1;
  5478. CRect StrRect = load.m_rcarray.ElementAt(0);
  5479. m_Print.SetFontFace(25, 1, "黑体");
  5480. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "预约单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5481. m_Print.SetFontFace(11, 1, "宋体");
  5482. StrRect = load.m_rcarray.ElementAt(1);
  5483. if (m_time1.GetLength() == 10)
  5484. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  5485. else
  5486. str = "开单日期:";
  5487. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5488. StrRect = load.m_rcarray.ElementAt(2);
  5489. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + strOrderNumber), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5490. CStringArray strarray;
  5491. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(137)))
  5492. {
  5493. Image *pImg = NULL;
  5494. g_nSendCode = 31;
  5495. int g_nYearposTemp = g_nYearpos;
  5496. g_nYearpos = -1;
  5497. g_pMainWnd->ProcessChatMessageRequest2(1);
  5498. g_nYearpos = g_nYearposTemp;
  5499. g_nSendCode = 0;
  5500. if (g_bSendOK == 0)return;
  5501. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  5502. if (pImg)
  5503. {
  5504. StrRect.left = 47;
  5505. StrRect.top = 12;
  5506. StrRect.right = StrRect.left + 60;
  5507. StrRect.bottom = StrRect.top + 60;
  5508. m_Print.DrawImage(pImg, StrRect);
  5509. delete pImg; pImg = NULL;
  5510. }
  5511. }
  5512. #ifdef CHILD_VERSION
  5513. strarray.Add("家长姓名");
  5514. strarray.Add("宝宝姓名");
  5515. #else
  5516. strarray.Add("先生姓名");
  5517. strarray.Add("女士姓名");
  5518. #endif
  5519. strarray.Add("服装套数");
  5520. // strarray.Add ("拍摄张数");
  5521. #ifdef CHILD_VERSION
  5522. strarray.Add("出生日期");
  5523. #else
  5524. strarray.Add("结婚日期");
  5525. #endif
  5526. strarray.Add("拍摄日期");
  5527. strarray.Add("联系电话");
  5528. strarray.Add("联系电话");
  5529. strarray.Add("造型套数");
  5530. if (m_zs.Find("\\") != -1)
  5531. strarray.Add("入底\\入册");
  5532. else
  5533. strarray.Add("入底张数");
  5534. strarray.Add("选片日期");
  5535. strarray.Add("QQ/邮箱");
  5536. strarray.Add("套系总额");
  5537. strarray.Add("定金");
  5538. strarray.Add("余款金额");
  5539. strarray.Add("取件日期");
  5540. strarray.Add(m_name1);
  5541. strarray.Add(m_name2);
  5542. strarray.Add(m_clothescount);
  5543. // str.Format("%d", atoi(m_zs)*3);
  5544. // strarray.Add (str);
  5545. #ifdef CHILD_VERSION
  5546. strarray.Add(m_birthday1);
  5547. #else
  5548. strarray.Add(m_time3);
  5549. #endif
  5550. strarray.Add(m_time2);
  5551. strarray.Add(m_phone1);
  5552. strarray.Add(m_phone2);
  5553. strarray.Add(m_clothescount2);
  5554. strarray.Add(m_zs);
  5555. strarray.Add(m_time4);
  5556. strarray.Add(m_qq1);
  5557. strarray.Add(m_money1);
  5558. strarray.Add(m_money2);
  5559. strarray.Add(m_money3);
  5560. strarray.Add(m_time5);
  5561. for (i = 4; i <= 33; i++)
  5562. {
  5563. StrRect = load.m_rcarray.ElementAt(i - 1);
  5564. m_Print.DrawRect2(StrRect, 1);
  5565. if (strarray.GetSize() > (i - 4))
  5566. {
  5567. if (i <= 18)
  5568. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5569. else
  5570. {
  5571. StrRect.left += 4;
  5572. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5573. }
  5574. }
  5575. }
  5576. int dt = 413;
  5577. StrRect = load.m_rcarray.ElementAt(36); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5578. m_Print.DrawText((LPTSTR)(LPCTSTR)"门市签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5579. StrRect = load.m_rcarray.ElementAt(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5580. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5581. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5582. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  5583. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  5584. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5585. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  5586. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5587. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  5588. m_Print.DrawText((LPTSTR)(LPCTSTR)("网址:" + g_cominfoarray.ElementAt(0).ElementAt(13)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  5589. //////////////////////////////
  5590. //开始画文字
  5591. StrRect = load.m_rcarray.ElementAt(7);
  5592. int hei = StrRect.Height();
  5593. StrRect.top += hei;
  5594. StrRect.bottom += hei;
  5595. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5596. StrRect.top += dt;
  5597. StrRect.bottom += dt;
  5598. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5599. StrRect = load.m_rcarray.ElementAt(17);
  5600. StrRect.top += hei;
  5601. StrRect.bottom += hei;
  5602. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5603. StrRect = load.m_rcarray.ElementAt(33);
  5604. StrRect.bottom = StrRect.top + dt; m_Print.DrawRect2(StrRect, 1);
  5605. StrRect.top += hei;
  5606. StrRect.left += 3;
  5607. StrRect.top += 3;
  5608. StrRect.right -= 2;
  5609. StrRect.bottom -= 2;
  5610. str = "";
  5611. for (i = 0; i < sparray.GetSize(); i++)
  5612. {
  5613. str += sparray.ElementAt(i).ElementAt(5);
  5614. str += " 数量:";
  5615. str += sparray.ElementAt(i).ElementAt(3);
  5616. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  5617. str += "\r\n";
  5618. }
  5619. str.TrimRight("\r\n");
  5620. AutoDraw(m_Print, StrRect, str, 1.4);
  5621. StrRect = load.m_rcarray.ElementAt(33);
  5622. StrRect.top += dt;
  5623. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5624. StrRect.top += hei;
  5625. StrRect.left += 3;
  5626. StrRect.top += 3;
  5627. StrRect.right -= 2;
  5628. StrRect.bottom -= 2;
  5629. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  5630. StrRect = load.m_rcarray.ElementAt(34);
  5631. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  5632. StrRect.top += hei;
  5633. StrRect.left += 3;
  5634. StrRect.top += 3;
  5635. StrRect.right -= 2;
  5636. StrRect.bottom -= 2;
  5637. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  5638. if (str.IsEmpty())
  5639. {
  5640. str = "\
  5641. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  5642. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  5643. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  5644. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  5645. 持良好的心境.\r\n\
  5646. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  5647. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  5648. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  5649. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  5650. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  5651. 勿进影室, 以免影响拍摄.\r\n\
  5652. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  5653. 师或店长沟通.\r\n\
  5654. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  5655. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  5656. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  5657. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  5658. 9. 本合同余额欠款须在拍照前付清.\r\n\
  5659. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  5660. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  5661. 还.";
  5662. }
  5663. AutoDraw(m_Print, StrRect, str, 1.8);
  5664. StrRect = load.m_rcarray.ElementAt(35);
  5665. StrRect.bottom += 100;
  5666. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  5667. 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∨";
  5668. // AutoDraw(m_Print, StrRect, str, 1.4);
  5669. }
  5670. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 2)
  5671. {
  5672. PrintDinDan5(strOrderNumber);
  5673. return;
  5674. }
  5675. else if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  5676. {
  5677. PrintDinDan6(strOrderNumber);
  5678. return;
  5679. }
  5680. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  5681. dlg.m_pDC = m_Print.GetPDC();
  5682. dlg.m_mode = 1;
  5683. if (aa == 0)
  5684. {
  5685. if (dlg.DoModal() != IDOK)
  5686. return;
  5687. printcot = dlg.m_num;
  5688. }
  5689. //结束打印
  5690. m_Print.EndPage();
  5691. m_Print.EndPrint();
  5692. }
  5693. }
  5694. void CovertDate2(CString date, CString &date2)
  5695. {
  5696. try
  5697. {
  5698. if (date == "2013-04-09")
  5699. {
  5700. date2 = "2013-02-29";
  5701. return;
  5702. }
  5703. ///////////////////////////////////
  5704. date2 = date;
  5705. GongToLong(date2);
  5706. ////////////////////////////////////
  5707. return;
  5708. CCalendarConvert m_CalendarConvert;
  5709. SYSTEMTIME src = { 0 };
  5710. SYSTEMTIME dst = { 0 };
  5711. COleDateTime m_timeLunar(atoi(date.Mid(0, 4)), atoi(date.Mid(5, 2)), atoi(date.Mid(8, 2)), 0, 0, 0);
  5712. COleDateTime m_timeGregorian;
  5713. m_timeLunar.GetAsSystemTime(src);
  5714. BOOL bEmbolism = 0;
  5715. if (m_CalendarConvert.Gregorian2Lunar(&src, &dst, &bEmbolism))
  5716. {
  5717. m_timeGregorian = m_CalendarConvert.ConvertSysTime2OleDateTime(&dst);
  5718. date2.Format("%04d-%02d-%02d", m_timeGregorian.GetYear(), m_timeGregorian.GetMonth(), m_timeGregorian.GetDay());
  5719. if (m_timeGregorian.GetYear() == -1)date2 = "2000-13-32";
  5720. }
  5721. else
  5722. {
  5723. date2.Empty();
  5724. }
  5725. }
  5726. catch (...)
  5727. {
  5728. }
  5729. }
  5730. void CMainFrame::PrintDinDan5(CString m_id)
  5731. {
  5732. int printcot = 1;
  5733. for (int aa = 0; aa < printcot; aa++)
  5734. {
  5735. PrintPreview dlg;
  5736. CPrintRX m_Print;
  5737. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  5738. {
  5739. m_Print.InitToPrint(NULL, 1);
  5740. }
  5741. else
  5742. {
  5743. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  5744. if (name.IsEmpty())
  5745. m_Print.InitToPrint(NULL, 1);
  5746. else
  5747. {
  5748. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  5749. if (nret == -1 && aa == 0)
  5750. {
  5751. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  5752. }
  5753. }
  5754. }
  5755. {
  5756. m_Print.StartPrint();
  5757. m_Print.StartPage();
  5758. LoadRect load;
  5759. load.SetLiaPath("19.lia");
  5760. load.SetMargins(0, -20);
  5761. if (!load.Load())return;
  5762. int i;
  5763. //////////////////////////////////////////////////////////////
  5764. CStringArray txarray;
  5765. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  5766. g_sendhead.code[0] = 11;
  5767. g_sendhead.code[1] = 52;
  5768. g_sendhead.code[2] = 50;
  5769. g_sendhead.code[3] = 150;
  5770. g_sendhead.code[4] = 77;
  5771. g_sendhead.code[5] = 4;
  5772. g_sendhead.tabcount = 6;
  5773. g_sendhead.bsql = 0;
  5774. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  5775. CArray<CStringArray, CStringArray>sparray;
  5776. CArray<CStringArray, CStringArray>clientarray;
  5777. CArray<CStringArray, CStringArray>phonearray;
  5778. CArray<CStringArray, CStringArray>fgarray;
  5779. CArray<CStringArray, CStringArray>danweiarray;
  5780. CArray<CStringArray, CStringArray>jdarray;
  5781. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  5782. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  5783. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  5784. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  5785. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  5786. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  5787. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 张数:" + g_List1array.ElementAt(0).ElementAt(9);
  5788. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  5789. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  5790. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  5791. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  5792. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  5793. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  5794. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  5795. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  5796. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  5797. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  5798. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  5799. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  5800. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  5801. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  5802. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  5803. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  5804. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  5805. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  5806. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  5807. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  5808. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  5809. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(36);
  5810. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  5811. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  5812. CString m_txtype = g_List1array.ElementAt(0).ElementAt(52);
  5813. CString m_memberno = g_List1array.ElementAt(0).ElementAt(47);
  5814. CString str;
  5815. if (jdarray.GetSize())
  5816. {
  5817. if (m_bz.IsEmpty() == 0)
  5818. m_bz = "\r\n" + m_bz;
  5819. m_bz += "景点:";
  5820. }
  5821. for (i = 0; i < jdarray.GetSize(); i++)
  5822. {
  5823. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  5824. }
  5825. m_bz.TrimRight(";");
  5826. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  5827. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  5828. if (IsHasRights2new(31) == 0)
  5829. {
  5830. m_phone1 = "***";
  5831. m_phone2 = "***";
  5832. }
  5833. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  5834. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  5835. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  5836. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  5837. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  5838. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  5839. BOOL check1 = atoi(clientarray.ElementAt(0).ElementAt(15));
  5840. filter = "staff_name='" + m_ren + "'";
  5841. g_sendhead.code[0] = 5;
  5842. g_sendhead.tabcount = 1;
  5843. g_sendhead.bsql = 0;
  5844. int g_nYearposTemp = g_nYearpos;
  5845. g_nYearpos = -1;
  5846. g_pMainWnd->ProcessChatMessageRequest2(filter);
  5847. g_nYearpos = g_nYearposTemp;
  5848. if (g_bSendOK == 0)return;
  5849. DataToArray(&phonearray);
  5850. m_money1.Format("%f", atof(m_taoxijiage));
  5851. m_money2.Format("%f", atof(m_payed1));
  5852. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  5853. ConvertToPrice(m_money1);
  5854. ConvertToPrice(m_money2);
  5855. ConvertToPrice(m_money3);
  5856. ////////////////////////////////////////////////////////////////
  5857. int rcpos = -1;
  5858. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  5859. //Image *pImg=NULL;
  5860. // ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  5861. // m_Print.DrawImage(pImg, StrRect);
  5862. // delete pImg;
  5863. m_Print.SetFontFace(20, 1, "宋体");
  5864. StrRect = load.m_rcarray.ElementAt(1);
  5865. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "定单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5866. m_Print.SetFontFace(12, 1, "宋体");
  5867. StrRect = load.m_rcarray.ElementAt(2);
  5868. m_Print.DrawText((LPTSTR)(LPCTSTR)("NO." + m_id), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5869. StrRect = load.m_rcarray.ElementAt(3);
  5870. str.Format("%s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  5871. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5872. StrRect = load.m_rcarray.ElementAt(4);
  5873. m_Print.DrawText((LPTSTR)(LPCTSTR)("联系人:" + m_name1), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  5874. CStringArray strarray;
  5875. strarray.Add("姓名");
  5876. strarray.Add("性别");
  5877. strarray.Add("年龄");
  5878. strarray.Add("出生年月");
  5879. strarray.Add("套系价格");
  5880. strarray.Add("定金");
  5881. strarray.Add("欠款");
  5882. strarray.Add("拍摄类型");
  5883. strarray.Add("会员卡号");
  5884. strarray.Add("定单人");
  5885. strarray.Add("入底\\入册");
  5886. strarray.Add("联系电话");
  5887. for (i = 6; i <= 17; i++)
  5888. {
  5889. StrRect = load.m_rcarray.ElementAt(i - 1);
  5890. m_Print.DrawRect2(StrRect, 1);
  5891. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 6), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5892. }
  5893. strarray.RemoveAll();
  5894. strarray.Add(m_name2);
  5895. strarray.Add(m_sex);
  5896. if (m_birthday.GetLength() != 10)
  5897. strarray.Add("");
  5898. else
  5899. {
  5900. int year = 0;
  5901. if (check1)
  5902. {
  5903. CString date2;
  5904. CovertDate2(g_date, date2);
  5905. year = atoi(date2.Left(4)) - atoi(m_birthday.Left(4));
  5906. if (date2.Right(5) >= m_birthday.Right(5))
  5907. year++;
  5908. }
  5909. else
  5910. {
  5911. year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  5912. if (g_date.Right(5) >= m_birthday.Right(5))
  5913. year++;
  5914. }
  5915. str.Format("%d", year);
  5916. strarray.Add(str);
  5917. }
  5918. strarray.Add(m_birthday);
  5919. strarray.Add(m_money1);
  5920. strarray.Add(m_money2);
  5921. strarray.Add(m_money3);
  5922. strarray.Add(m_txtype);
  5923. strarray.Add(m_memberno);
  5924. strarray.Add(m_ren);
  5925. strarray.Add(m_zs);
  5926. if (!m_phone1.IsEmpty())
  5927. strarray.Add(m_phone1);
  5928. else
  5929. strarray.Add(m_phone2);
  5930. for (i = 18; i <= 29; i++)
  5931. {
  5932. StrRect = load.m_rcarray.ElementAt(i - 1);
  5933. m_Print.DrawRect2(StrRect, 1);
  5934. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5935. }
  5936. strarray.RemoveAll();
  5937. strarray.Add("摄影师");
  5938. strarray.Add("拍照时间");
  5939. strarray.Add("选片人");
  5940. strarray.Add("选片时间");
  5941. strarray.Add("引导师");
  5942. strarray.Add("设计师");
  5943. strarray.Add("取件时间");
  5944. strarray.Add("顾客签字");
  5945. for (i = 34; i <= 41; i++)
  5946. {
  5947. StrRect = load.m_rcarray.ElementAt(i - 1);
  5948. m_Print.DrawRect2(StrRect, 1);
  5949. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 34), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5950. }
  5951. strarray.RemoveAll();
  5952. strarray.Add(m_waiter1);
  5953. strarray.Add(m_time2);
  5954. strarray.Add(m_waiter3);
  5955. strarray.Add(m_time4);
  5956. strarray.Add(m_waiter2);
  5957. strarray.Add(m_waiter4);
  5958. strarray.Add(m_time5);
  5959. strarray.Add("");
  5960. for (i = 42; i <= 49; i++)
  5961. {
  5962. StrRect = load.m_rcarray.ElementAt(i - 1);
  5963. m_Print.DrawRect2(StrRect, 1);
  5964. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  5965. }
  5966. m_Print.SetFontFace(15, 1, "宋体");
  5967. StrRect = load.m_rcarray.ElementAt(29);
  5968. m_Print.DrawRect2(StrRect, 1);
  5969. StrRect.top += 45;
  5970. m_Print.DrawText((LPTSTR)(LPCTSTR)"拍", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  5971. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  5972. m_Print.DrawText((LPTSTR)(LPCTSTR)"内", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  5973. m_Print.DrawText((LPTSTR)(LPCTSTR)"容", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5974. StrRect = load.m_rcarray.ElementAt(30);
  5975. m_Print.DrawRect2(StrRect, 1);
  5976. StrRect.top += 45;
  5977. m_Print.DrawText((LPTSTR)(LPCTSTR)"友", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  5978. m_Print.DrawText((LPTSTR)(LPCTSTR)"情", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  5979. m_Print.DrawText((LPTSTR)(LPCTSTR)"提", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP); StrRect.top += 20;
  5980. m_Print.DrawText((LPTSTR)(LPCTSTR)"示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  5981. m_Print.SetFontFace(10, 1, "宋体");
  5982. StrRect = load.m_rcarray.ElementAt(37); StrRect.top = StrRect.bottom + 2;
  5983. str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  5984. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  5985. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  5986. StrRect = load.m_rcarray.ElementAt(48); StrRect.top = StrRect.bottom + 2; StrRect.left -= 200;
  5987. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  5988. //开始画文字
  5989. StrRect = load.m_rcarray.ElementAt(31);
  5990. StrRect.left += 3;
  5991. StrRect.top += 3;
  5992. StrRect.right -= 2;
  5993. StrRect.bottom -= 2;
  5994. str = "";
  5995. for (i = 0; i < sparray.GetSize(); i++)
  5996. {
  5997. str += sparray.ElementAt(i).ElementAt(5);
  5998. str += " 数量:";
  5999. str += sparray.ElementAt(i).ElementAt(3);
  6000. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6001. str += "\r\n";
  6002. }
  6003. str.TrimRight("\r\n");
  6004. m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6005. m_bz.TrimLeft();
  6006. if (m_bz != "")
  6007. {
  6008. str += "\r\n"; str += "\r\n";
  6009. str += "备注:" + m_bz;
  6010. }
  6011. AutoDraw(m_Print, StrRect, str, 1.4);
  6012. StrRect = load.m_rcarray.ElementAt(32); m_Print.DrawRect2(StrRect, 1);
  6013. StrRect.left += 3;
  6014. StrRect.top += 3;
  6015. StrRect.right -= 2;
  6016. StrRect.bottom -= 2;
  6017. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6018. if (str.IsEmpty())
  6019. {
  6020. str = "\
  6021. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6022. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6023. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6024. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6025. 持良好的心境.\r\n\
  6026. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6027. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6028. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6029. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6030. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6031. 勿进影室, 以免影响拍摄.\r\n\
  6032. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6033. 师或店长沟通.\r\n\
  6034. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6035. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6036. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6037. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6038. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6039. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6040. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6041. 还.";
  6042. }
  6043. AutoDraw(m_Print, StrRect, str, 1.8);
  6044. }
  6045. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6046. dlg.m_pDC = m_Print.GetPDC();
  6047. dlg.m_mode = 1;
  6048. if (aa == 0)
  6049. {
  6050. if (dlg.DoModal() != IDOK)
  6051. return;
  6052. printcot = dlg.m_num;
  6053. }
  6054. //结束打印
  6055. m_Print.EndPage();
  6056. m_Print.EndPrint();
  6057. }
  6058. }
  6059. void CMainFrame::PrintDinDan4(CString m_id)
  6060. {
  6061. // TODO: Add your control notification handler code here
  6062. CPrintRX m_Print;
  6063. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6064. {
  6065. m_Print.InitToPrint(NULL, 1);
  6066. }
  6067. else
  6068. {
  6069. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  6070. if (name.IsEmpty())
  6071. m_Print.InitToPrint(NULL, 1);
  6072. else
  6073. {
  6074. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6075. if (nret == -1)
  6076. {
  6077. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6078. }
  6079. }
  6080. }
  6081. m_Print.StartPrint();
  6082. m_Print.StartPage();
  6083. LoadRect load;
  6084. load.SetLiaPath("6-2.lia");
  6085. load.SetMargins(0, 0);
  6086. if (!load.Load())return;
  6087. int i;
  6088. //////////////////////////////////////////////////////////////
  6089. CStringArray txarray;
  6090. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  6091. g_sendhead.code[0] = 11;
  6092. g_sendhead.code[1] = 52;
  6093. g_sendhead.code[2] = 50;
  6094. g_sendhead.code[3] = 150;
  6095. g_sendhead.code[4] = 77;
  6096. g_sendhead.code[5] = 4;
  6097. g_sendhead.tabcount = 6;
  6098. g_sendhead.bsql = 0;
  6099. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  6100. CArray<CStringArray, CStringArray>sparray;
  6101. CArray<CStringArray, CStringArray>clientarray;
  6102. CArray<CStringArray, CStringArray>phonearray;
  6103. CArray<CStringArray, CStringArray>fgarray;
  6104. CArray<CStringArray, CStringArray>danweiarray;
  6105. CArray<CStringArray, CStringArray>jdarray;
  6106. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  6107. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  6108. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  6109. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  6110. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  6111. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  6112. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  6113. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  6114. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  6115. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  6116. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  6117. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  6118. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  6119. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  6120. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  6121. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  6122. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  6123. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  6124. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  6125. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  6126. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  6127. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  6128. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  6129. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  6130. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  6131. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  6132. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  6133. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  6134. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  6135. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  6136. if (jdarray.GetSize())
  6137. {
  6138. if (m_bz.IsEmpty() == 0)
  6139. m_bz = "\r\n" + m_bz;
  6140. m_bz += "景点:";
  6141. }
  6142. for (i = 0; i < jdarray.GetSize(); i++)
  6143. {
  6144. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  6145. }
  6146. m_bz.TrimRight(";");
  6147. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  6148. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  6149. if (IsHasRights2new(31) == 0)
  6150. {
  6151. m_phone1 = "***";
  6152. m_phone2 = "***";
  6153. }
  6154. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  6155. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  6156. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  6157. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  6158. CString str;
  6159. filter = "staff_name='" + m_ren + "'";
  6160. g_sendhead.code[0] = 5;
  6161. g_sendhead.tabcount = 1;
  6162. g_sendhead.bsql = 0;
  6163. int g_nYearposTemp = g_nYearpos;
  6164. g_nYearpos = -1;
  6165. g_pMainWnd->ProcessChatMessageRequest2(filter);
  6166. g_nYearpos = g_nYearposTemp;
  6167. if (g_bSendOK == 0)return;
  6168. DataToArray(&phonearray);
  6169. m_money1.Format("%f", atof(m_taoxijiage));
  6170. m_money2.Format("%f", atof(m_payed1));
  6171. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  6172. ConvertToPrice(m_money1);
  6173. ConvertToPrice(m_money2);
  6174. ConvertToPrice(m_money3);
  6175. ////////////////////////////////////////////////////////////////
  6176. int rcpos = -1;
  6177. CRect StrRect = load.m_rcarray.ElementAt(0);
  6178. m_Print.SetFontFace(25, 1, "黑体");
  6179. m_Print.DrawText((LPTSTR)(LPCTSTR)"巴黎春天婚纱摄影预约单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6180. m_Print.SetFontFace(11, 1, "宋体");
  6181. StrRect = load.m_rcarray.ElementAt(1);
  6182. if (m_time1.GetLength() == 10)
  6183. str.Format("开单日期: %s 年 %s 月 %s 日", m_time1.Left(4), m_time1.Mid(5, 2), m_time1.Mid(8, 2));
  6184. else
  6185. str = "开单日期:";
  6186. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6187. StrRect = load.m_rcarray.ElementAt(2);
  6188. m_Print.DrawText((LPTSTR)(LPCTSTR)("No." + m_id), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6189. CStringArray strarray;
  6190. strarray.Add("先生姓名");
  6191. strarray.Add("女士姓名");
  6192. strarray.Add("服装套数");
  6193. strarray.Add("拍摄张数");
  6194. strarray.Add("拍摄日期");
  6195. strarray.Add("联系电话");
  6196. strarray.Add("联系电话");
  6197. strarray.Add("造型套数");
  6198. strarray.Add("入册张数");
  6199. strarray.Add("选片日期");
  6200. strarray.Add("QQ/邮箱");
  6201. strarray.Add("套系总额");
  6202. strarray.Add("定金");
  6203. strarray.Add("余款金额");
  6204. strarray.Add("取件日期");
  6205. strarray.Add(m_name1);
  6206. strarray.Add(m_name2);
  6207. strarray.Add(m_clothescount);
  6208. str.Format("%d", atoi(m_zs) * 3);
  6209. strarray.Add(str);
  6210. strarray.Add(m_time2);
  6211. strarray.Add(m_phone1);
  6212. strarray.Add(m_phone2);
  6213. strarray.Add(m_clothescount2);
  6214. strarray.Add(m_zs);
  6215. strarray.Add(m_time4);
  6216. strarray.Add(m_qq1);
  6217. strarray.Add(m_money1);
  6218. strarray.Add(m_money2);
  6219. strarray.Add(m_money3);
  6220. strarray.Add(m_time5);
  6221. for (i = 4; i <= 33; i++)
  6222. {
  6223. StrRect = load.m_rcarray.ElementAt(i - 1);
  6224. m_Print.DrawRect2(StrRect, 1);
  6225. if (strarray.GetSize() > (i - 4))
  6226. {
  6227. if (i <= 18)
  6228. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6229. else
  6230. {
  6231. StrRect.left += 4;
  6232. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 4), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6233. }
  6234. }
  6235. }
  6236. int dt = 413;
  6237. StrRect = load.m_rcarray.ElementAt(36); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6238. m_Print.DrawText((LPTSTR)(LPCTSTR)"门市签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6239. StrRect = load.m_rcarray.ElementAt(37); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6240. StrRect = load.m_rcarray.ElementAt(38); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6241. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客签名", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6242. StrRect = load.m_rcarray.ElementAt(39); StrRect.top += dt; StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1); StrRect.left += 4;
  6243. StrRect = load.m_rcarray.ElementAt(40); StrRect.top += dt; StrRect.bottom += dt;
  6244. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址:深圳市红岭中路中深国际大厦首层,二十二层", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6245. StrRect = load.m_rcarray.ElementAt(41); StrRect.top += dt; StrRect.bottom += dt;
  6246. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:0755-61308198 61308199 25860696 25860697", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6247. StrRect = load.m_rcarray.ElementAt(42); StrRect.top += dt; StrRect.bottom += dt;
  6248. m_Print.DrawText((LPTSTR)(LPCTSTR)"网址:www.paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6249. StrRect = load.m_rcarray.ElementAt(43); StrRect.top += dt; StrRect.bottom += dt;
  6250. m_Print.DrawText((LPTSTR)(LPCTSTR)"邮箱:blct@paris-spring.cn", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6251. //////////////////////////////
  6252. //开始画文字
  6253. StrRect = load.m_rcarray.ElementAt(7);
  6254. int hei = StrRect.Height();
  6255. StrRect.top += hei;
  6256. StrRect.bottom += hei;
  6257. m_Print.DrawText((LPTSTR)(LPCTSTR)"详细内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6258. StrRect.top += dt;
  6259. StrRect.bottom += dt;
  6260. m_Print.DrawText((LPTSTR)(LPCTSTR)"备注内容:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6261. StrRect = load.m_rcarray.ElementAt(17);
  6262. StrRect.top += hei;
  6263. StrRect.bottom += hei;
  6264. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6265. StrRect = load.m_rcarray.ElementAt(33);
  6266. StrRect.bottom = StrRect.top + dt; m_Print.DrawRect2(StrRect, 1);
  6267. StrRect.top += hei;
  6268. StrRect.left += 3;
  6269. StrRect.top += 3;
  6270. StrRect.right -= 2;
  6271. StrRect.bottom -= 2;
  6272. str = "";
  6273. for (i = 0; i < sparray.GetSize(); i++)
  6274. {
  6275. str += sparray.ElementAt(i).ElementAt(5);
  6276. str += " 数量:";
  6277. str += sparray.ElementAt(i).ElementAt(3);
  6278. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  6279. str += "\r\n";
  6280. }
  6281. str.TrimRight("\r\n");
  6282. AutoDraw(m_Print, StrRect, str, 1.4);
  6283. StrRect = load.m_rcarray.ElementAt(33);
  6284. StrRect.top += dt;
  6285. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6286. StrRect.top += hei;
  6287. StrRect.left += 3;
  6288. StrRect.top += 3;
  6289. StrRect.right -= 2;
  6290. StrRect.bottom -= 2;
  6291. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  6292. StrRect = load.m_rcarray.ElementAt(34);
  6293. StrRect.bottom += dt; m_Print.DrawRect2(StrRect, 1);
  6294. StrRect.top += hei;
  6295. StrRect.left += 3;
  6296. StrRect.top += 3;
  6297. StrRect.right -= 2;
  6298. StrRect.bottom -= 2;
  6299. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  6300. if (str.IsEmpty())
  6301. {
  6302. str = "\
  6303. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  6304. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  6305. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  6306. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  6307. 持良好的心境.\r\n\
  6308. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  6309. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  6310. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  6311. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  6312. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  6313. 勿进影室, 以免影响拍摄.\r\n\
  6314. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  6315. 师或店长沟通.\r\n\
  6316. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  6317. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  6318. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  6319. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  6320. 9. 本合同余额欠款须在拍照前付清.\r\n\
  6321. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  6322. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  6323. 还.";
  6324. }
  6325. AutoDraw(m_Print, StrRect, str, 1.8);
  6326. StrRect = load.m_rcarray.ElementAt(35);
  6327. StrRect.bottom += 100;
  6328. // str="第一联:存根<白> 第二联:客户<红> 第三联:流程<黄> ";
  6329. 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∨";
  6330. AutoDraw(m_Print, StrRect, str, 1.4);
  6331. PrintPreview dlg;
  6332. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6333. dlg.m_pDC = m_Print.GetPDC();
  6334. if (dlg.DoModal() != IDOK)return;
  6335. //结束打印
  6336. m_Print.EndPage();
  6337. m_Print.EndPrint();
  6338. }
  6339. int CalHeight_01(CRect &rc, CStringArray *saContent, CPrintRX *Print, int FORMAT)
  6340. {
  6341. CSize size;
  6342. int nMaxheight = 0;
  6343. CString strTemp;
  6344. CString strContent;
  6345. int nSize = saContent->GetSize();
  6346. int nRow = 0; // 行数;
  6347. for (int i = 0; i < nSize; i++)
  6348. {
  6349. strTemp = "";
  6350. strContent = saContent->ElementAt(i);
  6351. while (FALSE == strContent.IsEmpty())
  6352. {
  6353. strContent = strContent.Mid(strTemp.GetLength());
  6354. if (strContent.IsEmpty())
  6355. break;
  6356. Print->GetStrSize((LPTSTR)(LPCTSTR)strContent, size);
  6357. if (size.cx <= rc.Width())
  6358. {
  6359. CRect rc2 = rc;
  6360. rc2.top += nRow*(size.cy + 1);
  6361. rc2.bottom = rc2.top + (size.cy + 1);
  6362. Print->DrawText((LPTSTR)(LPCTSTR)strContent, rc2, 0, 0, FORMAT | FORMAT_UP);
  6363. nMaxheight = max(nMaxheight, rc2.bottom);
  6364. nRow++;
  6365. break;
  6366. }
  6367. int right = 0;
  6368. while (size.cx > rc.Width())
  6369. {
  6370. right++;
  6371. strTemp = strContent.Left(strContent.GetLength() - (right));
  6372. if (GIsHalfHZ(strTemp))
  6373. {
  6374. right++;
  6375. strTemp.Delete(strTemp.GetLength() - 1);
  6376. }
  6377. Print->GetStrSize((LPTSTR)(LPCTSTR)strTemp, size);
  6378. }
  6379. CRect rc2 = rc;
  6380. rc2.top += nRow*(size.cy + 1);
  6381. rc2.bottom = rc2.top + (size.cy + 1);
  6382. Print->DrawText((LPTSTR)(LPCTSTR)strTemp, rc2, 0, 0, FORMAT | FORMAT_UP); //printf("Jeff:str=%s\n\n",str);// Jeff Printf;
  6383. nRow++;
  6384. nMaxheight = max(nMaxheight, rc2.bottom);
  6385. }
  6386. }
  6387. return (nMaxheight == 0 ) ? (rc.bottom+1) : (nMaxheight+1);
  6388. }
  6389. int CalHeight(CArray<CRect, CRect>*rcarray, CStringArray *strarray2, CPrintRX *Print, int FORMAT)
  6390. {
  6391. CSize size;
  6392. CString str, temp;
  6393. CRect rc;
  6394. int maxhei = 1;
  6395. int fonthei;
  6396. for (int i = 0; i < rcarray->GetSize(); i++)
  6397. {
  6398. rc = rcarray->ElementAt(i);
  6399. maxhei = max(maxhei, rc.bottom);
  6400. str = strarray2->ElementAt(i);
  6401. temp.Empty();
  6402. int hei = 0;
  6403. while (str.IsEmpty() == 0)
  6404. {
  6405. str = str.Right(str.GetLength() - temp.GetLength());
  6406. if (str.IsEmpty())break;
  6407. Print->GetStrSize((LPTSTR)(LPCTSTR)str, size);
  6408. fonthei = size.cy + 1;
  6409. if (size.cx <= rc.Width())
  6410. {
  6411. CRect rc2 = rc;
  6412. rc2.top += hei*fonthei;
  6413. rc2.bottom = rc2.top + fonthei;
  6414. Print->DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT | FORMAT_UP);
  6415. //printf("Jeff:str=%s\n\n",str);// Jeff Printf;
  6416. maxhei = max(maxhei, rc2.bottom);
  6417. break;
  6418. }
  6419. int right = 0;
  6420. while (size.cx > rc.Width())
  6421. {
  6422. right++;
  6423. temp = str.Left(str.GetLength() - (right));
  6424. if (GIsHalfHZ(temp))
  6425. {
  6426. right++;
  6427. temp.Delete(temp.GetLength() - 1);
  6428. }
  6429. Print->GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  6430. }
  6431. CRect rc2 = rc;
  6432. rc2.top += hei*fonthei;
  6433. rc2.bottom = rc2.top + fonthei;
  6434. Print->DrawText((LPTSTR)(LPCTSTR)temp, rc2, 0, 0, FORMAT | FORMAT_UP); //printf("Jeff:str=%s\n\n",str);// Jeff Printf;
  6435. hei++;
  6436. maxhei = max(maxhei, rc2.bottom);
  6437. }
  6438. }
  6439. return maxhei + 1;
  6440. }
  6441. void CMainFrame::PrintReceipt(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  6442. {
  6443. //AfxMessageBox("abce");
  6444. int printcot = 1;
  6445. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  6446. {
  6447. g_sendhead.bsql = 0;
  6448. g_sendhead.code[0] = 24;
  6449. g_sendhead.tabcount = 1;
  6450. int g_nYearposTemp = g_nYearpos;
  6451. g_nYearpos = -1;
  6452. g_pMainWnd->ProcessChatMessageRequest2(1);
  6453. g_nYearpos = g_nYearposTemp;
  6454. if (0 == g_bSendOK)return;
  6455. DataToArray(&g_cominfoarray);
  6456. CString SerialNo;
  6457. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6458. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  6459. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6460. CString sql;
  6461. sql.Format("update version set [serialno]='%s'", SerialNo);
  6462. g_sendhead.bsql=1;
  6463. g_nYearposTemp=g_nYearpos;
  6464. g_nYearpos=-1;
  6465. g_pMainWnd->ProcessChatMessageRequest2(sql);
  6466. g_nYearpos=g_nYearposTemp;
  6467. #endif
  6468. // 1.创建打印对象
  6469. CPrintRX m_Print;
  6470. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6471. {
  6472. m_Print.InitToPrint(NULL, 1);
  6473. }
  6474. else
  6475. {
  6476. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  6477. if (name.IsEmpty())
  6478. m_Print.InitToPrint(NULL, 1);
  6479. else
  6480. {
  6481. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6482. if (nret == -1 && aa == 0)
  6483. {
  6484. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  6485. }
  6486. }
  6487. }
  6488. // 2.开始打印
  6489. m_Print.StartPrint();
  6490. m_Print.StartPage();
  6491. LoadRect load;
  6492. BOOL bSmall = 0;
  6493. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  6494. {
  6495. bSmall = 1;
  6496. load.SetLiaPath("20.lia");
  6497. }
  6498. else
  6499. load.SetLiaPath("10.lia");
  6500. if (bSmall)
  6501. load.SetMargins(0, 0);
  6502. else
  6503. load.SetMargins(10, 0);
  6504. if (!load.Load())return;
  6505. int rcpos = -1;
  6506. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6507. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  6508. {
  6509. Image *pImg = NULL;
  6510. g_nSendCode = 31;
  6511. int g_nYearposTemp = g_nYearpos;
  6512. g_nYearpos = -1;
  6513. g_pMainWnd->ProcessChatMessageRequest2(1);
  6514. g_nYearpos = g_nYearposTemp;
  6515. g_nSendCode = 0;
  6516. if (g_bSendOK == 0)return;
  6517. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  6518. if (pImg)
  6519. {
  6520. StrRect.left = 65;
  6521. if (bSmall) StrRect.left = 55;
  6522. StrRect.top = 10;
  6523. StrRect.right = StrRect.left + 58;
  6524. StrRect.bottom = StrRect.top + 58;
  6525. // 3.打印2维码图像;
  6526. m_Print.DrawImage(pImg, StrRect);
  6527. delete pImg;
  6528. pImg = NULL;
  6529. }
  6530. }
  6531. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  6532. if (bSmall)
  6533. {
  6534. m_Print.SetFontFace(18, 1, "黑体");
  6535. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6536. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6537. m_Print.SetFontFace(9, 1, "宋体");
  6538. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6539. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6540. m_Print.SetFontFace(6, 1, "宋体");
  6541. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6542. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6543. m_Print.SetFontFace(9, 1, "宋体");
  6544. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6545. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6546. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6547. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6548. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6549. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6550. int hei = StrRect.Height();
  6551. StrRect.bottom = StrRect.top;
  6552. StrRect.top -= 8;
  6553. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6554. m_Print.SetFontFace(11, 1, "宋体");
  6555. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6556. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6557. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6558. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6559. m_Print.SetFontFace(8, 1, "宋体");
  6560. int i = 0;
  6561. for ( i = 7; i < 24; i++)
  6562. {
  6563. StrRect = load.m_rcarray.ElementAt(i);
  6564. m_Print.DrawRect2(StrRect, 1);
  6565. }
  6566. for (i = 9; i < 24; i++)
  6567. {
  6568. StrRect = load.m_rcarray.ElementAt(i);
  6569. StrRect.left += 2;
  6570. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6571. }
  6572. m_Print.SetFontFace(6, 1, "宋体");
  6573. for (i = 24; i < 26; i++)
  6574. {
  6575. StrRect = load.m_rcarray.ElementAt(i);
  6576. StrRect.left += 2;
  6577. if (i == 24)
  6578. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6579. else
  6580. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6581. }
  6582. // StrRect=load.m_rcarray .ElementAt (27);
  6583. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  6584. }
  6585. else//大单
  6586. {
  6587. // 1.打印表头(蒙娜丽莎收款单)
  6588. m_Print.SetFontFace(20, 1, "黑体");
  6589. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6590. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6591. m_Print.SetFontFace(11, 1, "宋体");
  6592. // 2.打印订单号(NO.20140608-001)
  6593. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6594. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6595. // 3.打印SerialNo(SerialNo.01062)
  6596. int hei = StrRect.Height();
  6597. StrRect.bottom = StrRect.top;
  6598. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6599. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6600. // 4.打印影楼地址信息、电话;
  6601. m_Print.SetFontFace(8, 1, "宋体");
  6602. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6603. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6604. #ifdef LYFZ_VERSION
  6605. m_Print.SetFontFace(9, 1, "宋体");
  6606. #else
  6607. m_Print.SetFontFace(11, 1, "宋体");
  6608. #endif
  6609. // 5.打印客户姓名
  6610. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6611. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6612. // 6.打印客户联系电话
  6613. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6614. #ifdef LYFZ_VERSION
  6615. StrRect.left += 30;
  6616. StrRect.right += 30;
  6617. #endif
  6618. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6619. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6620. // 7.打印开单日期
  6621. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6622. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6623. // 8.打印列字段:收款项目
  6624. m_Print.SetFontFace(13, 1, "宋体");
  6625. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6626. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6627. //printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6628. // 9.打印列字段:金额
  6629. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6630. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6631. //printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6632. // 10.打印列字段:开单人
  6633. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6634. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6635. //printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6636. // 11.画表格-画3列;
  6637. m_Print.SetFontFace(11, 1, "宋体");
  6638. int i;
  6639. for (i = 7; i < 10; i++)
  6640. {
  6641. StrRect = load.m_rcarray.ElementAt(i);
  6642. m_Print.DrawRect2(StrRect, 1);
  6643. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6644. }
  6645. // 12.打印详细内容
  6646. int dty = 0;
  6647. int dtytemp = 0;
  6648. // for( i=10; i<14; i+=3)
  6649. for (i = 10; i<22; i += 3) // 循环4次,再画
  6650. {
  6651. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  6652. CArray<CRect, CRect>rcarray;
  6653. CStringArray strarray2;
  6654. StrRect = load.m_rcarray.ElementAt(i);
  6655. StrRect.top += dty;
  6656. StrRect.bottom += dty;
  6657. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  6658. {
  6659. StrRect = load.m_rcarray.ElementAt(i - 1);
  6660. StrRect.top += dty;
  6661. StrRect.bottom += dty;
  6662. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  6663. break;
  6664. }
  6665. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  6666. StrRect.left += 2;
  6667. StrRect.right -= 2;
  6668. StrRect.top += 4;
  6669. rcarray.Add(StrRect);
  6670. strarray2.Add(pArray->ElementAt(i));
  6671. // 指定格子宽度,计算字符串占几行(高度).
  6672. int bottom = CalHeight(&rcarray, &strarray2, &m_Print, FORMAT_LEFT);
  6673. dtytemp = bottom - StrRect.bottom;
  6674. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  6675. // 重新获取表格大小,并画出表格;
  6676. StrRect = load.m_rcarray.ElementAt(i);
  6677. StrRect.bottom += dtytemp;
  6678. StrRect.top += dty;
  6679. StrRect.bottom += dty;
  6680. m_Print.DrawRect2(StrRect, 1);
  6681. // 获取下一表格大小,并画出表格;
  6682. StrRect = load.m_rcarray.ElementAt(i + 1);
  6683. StrRect.top += dty;
  6684. StrRect.bottom += dty;
  6685. StrRect.bottom += dtytemp;
  6686. m_Print.DrawRect2(StrRect, 1);
  6687. StrRect.left += 2;
  6688. // 打印出金额字段内容
  6689. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6690. //printf("Jeff:%d:%s\n\n",i+1,pArray->ElementAt(i+1));//Jeff Printf;
  6691. StrRect = load.m_rcarray.ElementAt(i + 2);
  6692. StrRect.top += dty;
  6693. StrRect.bottom += dty;
  6694. StrRect.bottom += dtytemp;
  6695. m_Print.DrawRect2(StrRect, 1);
  6696. StrRect.left += 2;
  6697. // 打印开单人字段内容
  6698. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6699. //printf("Jeff:%d:%s\n\n",i+2,pArray->ElementAt(i+2));//Jeff Printf;
  6700. dty += dtytemp;
  6701. }
  6702. //.打印->付款情况 应付 实付 欠款.
  6703. i = 22;
  6704. StrRect = load.m_rcarray.ElementAt(i);
  6705. StrRect.top += dty;
  6706. StrRect.bottom += dty;
  6707. m_Print.DrawRect2(StrRect, 1);
  6708. StrRect.left += 2;
  6709. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6710. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  6711. //.打印->合计人民币(大写):.......
  6712. i = 23;
  6713. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  6714. m_Print.DrawRect2(StrRect, 1);
  6715. StrRect.left += 2;
  6716. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6717. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  6718. #ifdef LYFZ_VERSION
  6719. m_Print.SetFontFace(7, 1, "宋体");
  6720. for (i = 24; i < 25; i++)
  6721. {
  6722. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  6723. StrRect.left +=2;
  6724. m_Print.DrawText((LPTSTR)(LPCTSTR)"声明:1.此单作为收据凭证。2.软件免费升级一年服务。3.以上无正当理由定金不退。4.软件加密锁为核心技术,请妥善保管,遗失不补。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6725. }
  6726. #else
  6727. m_Print.SetFontFace(7, 1, "宋体");
  6728. for (i = 24; i < 27; i++)
  6729. {
  6730. StrRect = load.m_rcarray.ElementAt(i); StrRect.top += dty; StrRect.bottom += dty;
  6731. StrRect.left += 2;
  6732. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6733. }
  6734. #endif
  6735. StrRect = load.m_rcarray.ElementAt(24); StrRect.top += dty; StrRect.bottom += dty;
  6736. hei = StrRect.Height();
  6737. StrRect.top += hei;
  6738. StrRect.bottom += hei;
  6739. StrRect.right += 100;
  6740. StrRect.left += 2;
  6741. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  6742. AutoDraw(m_Print, StrRect, pArray->ElementAt(27), 1.0);
  6743. }
  6744. PrintPreview dlg;
  6745. dlg.m_mode = 3;
  6746. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  6747. dlg.m_pDC = m_Print.GetPDC();
  6748. if (aa == 0)
  6749. {
  6750. if (dlg.DoModal() != IDOK)
  6751. return;
  6752. printcot = dlg.m_num;
  6753. }
  6754. //结束打印
  6755. m_Print.EndPage();
  6756. m_Print.EndPrint();
  6757. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  6758. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6759. CString sql;
  6760. sql.Format("update version set [serialno]='%s'", SerialNo);
  6761. g_sendhead.bsql = 1;
  6762. g_nYearposTemp = g_nYearpos;
  6763. g_nYearpos = -1;
  6764. g_pMainWnd->ProcessChatMessageRequest2(sql);
  6765. g_nYearpos = g_nYearposTemp;
  6766. #endif
  6767. }
  6768. }
  6769. void CMainFrame::PrintReceipt_01(CStringArray *pArray) // 打印订单*预约收款、预约补款*
  6770. {
  6771. //AfxMessageBox("abce");
  6772. int printcot = 1;
  6773. for (int aa = 0; aa < printcot; aa++) // Jeff, printcot=1....
  6774. {
  6775. g_sendhead.bsql = 0;
  6776. g_sendhead.code[0] = 24;
  6777. g_sendhead.tabcount = 1;
  6778. int g_nYearposTemp = g_nYearpos;
  6779. g_nYearpos = -1;
  6780. g_pMainWnd->ProcessChatMessageRequest2(1);
  6781. g_nYearpos = g_nYearposTemp;
  6782. if (0 == g_bSendOK)return;
  6783. DataToArray(&g_cominfoarray);
  6784. CString SerialNo;
  6785. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6786. #if 0 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  6787. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  6788. CString sql;
  6789. sql.Format("update version set [serialno]='%s'", SerialNo);
  6790. g_sendhead.bsql=1;
  6791. g_nYearposTemp=g_nYearpos;
  6792. g_nYearpos=-1;
  6793. g_pMainWnd->ProcessChatMessageRequest2(sql);
  6794. g_nYearpos=g_nYearposTemp;
  6795. #endif
  6796. // 1.创建打印对象
  6797. CPrintRX m_Print;
  6798. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  6799. {
  6800. m_Print.InitToPrint(NULL, 1);
  6801. }
  6802. else
  6803. {
  6804. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  6805. if (name.IsEmpty())
  6806. m_Print.InitToPrint(NULL, 1);
  6807. else
  6808. {
  6809. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  6810. if (nret == -1 && aa == 0)
  6811. {
  6812. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  6813. m_Print.InitToPrint(NULL, 1);
  6814. }
  6815. }
  6816. }
  6817. // 2.开始打印
  6818. m_Print.StartPrint();
  6819. m_Print.StartPage();
  6820. LoadRect load;
  6821. BOOL bSmall = 0;
  6822. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  6823. {
  6824. bSmall = 1;
  6825. load.SetLiaPath("20.lia");
  6826. }
  6827. else
  6828. load.SetLiaPath("10.lia");
  6829. if (bSmall)
  6830. load.SetMargins(0, 0);
  6831. else
  6832. load.SetMargins(10, 0);
  6833. if (!load.Load())return;
  6834. int rcpos = -1;
  6835. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  6836. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  6837. {
  6838. Image *pImg = NULL;
  6839. g_nSendCode = 31;
  6840. int g_nYearposTemp = g_nYearpos;
  6841. g_nYearpos = -1;
  6842. g_pMainWnd->ProcessChatMessageRequest2(1);
  6843. g_nYearpos = g_nYearposTemp;
  6844. g_nSendCode = 0;
  6845. if (g_bSendOK == 0)return;
  6846. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  6847. if (pImg)
  6848. {
  6849. StrRect.left = 65;
  6850. if (bSmall) StrRect.left = 55;
  6851. StrRect.top = 10;
  6852. StrRect.right = StrRect.left + 58;
  6853. StrRect.bottom = StrRect.top + 58;
  6854. // 3.打印2维码图像;
  6855. m_Print.DrawImage(pImg, StrRect);
  6856. delete pImg;
  6857. pImg = NULL;
  6858. }
  6859. }
  6860. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  6861. if (bSmall)
  6862. {
  6863. m_Print.SetFontFace(18, 1, "黑体");
  6864. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6865. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6866. m_Print.SetFontFace(9, 1, "宋体");
  6867. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6868. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6869. m_Print.SetFontFace(6, 1, "宋体");
  6870. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6871. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6872. m_Print.SetFontFace(9, 1, "宋体");
  6873. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6874. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6875. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6876. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6877. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6878. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6879. int hei = StrRect.Height();
  6880. StrRect.bottom = StrRect.top;
  6881. StrRect.top -= 8;
  6882. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6883. m_Print.SetFontFace(11, 1, "宋体");
  6884. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6885. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6886. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6887. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6888. m_Print.SetFontFace(8, 1, "宋体");
  6889. int i = 0 ;
  6890. for ( i = 7; i < 24; i++)
  6891. {
  6892. StrRect = load.m_rcarray.ElementAt(i);
  6893. m_Print.DrawRect2(StrRect, 1);
  6894. }
  6895. for (i = 9; i < 24; i++)
  6896. {
  6897. StrRect = load.m_rcarray.ElementAt(i);
  6898. StrRect.left += 2;
  6899. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6900. }
  6901. m_Print.SetFontFace(6, 1, "宋体");
  6902. for (i = 24; i < 26; i++)
  6903. {
  6904. StrRect = load.m_rcarray.ElementAt(i);
  6905. StrRect.left += 2;
  6906. if (i == 24)
  6907. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6908. else
  6909. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6910. }
  6911. // StrRect=load.m_rcarray .ElementAt (27);
  6912. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  6913. }
  6914. else//大单
  6915. {
  6916. // 1.打印表头(蒙娜丽莎收款单)
  6917. m_Print.SetFontFace(20, 1, "黑体");
  6918. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6919. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6920. m_Print.SetFontFace(11, 1, "宋体");
  6921. // 2.打印订单号(NO.20140608-001)
  6922. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6923. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6924. // 3.打印SerialNo(SerialNo.01062)
  6925. int hei = StrRect.Height();
  6926. StrRect.bottom = StrRect.top;
  6927. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6928. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  6929. // 4.打印影楼地址信息、电话;
  6930. m_Print.SetFontFace(8, 1, "宋体");
  6931. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6932. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  6933. #ifdef LYFZ_VERSION
  6934. m_Print.SetFontFace(9, 1, "宋体");
  6935. #else
  6936. m_Print.SetFontFace(11, 1, "宋体");
  6937. #endif
  6938. // 5.打印客户姓名
  6939. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6940. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6941. // 6.打印客户联系电话
  6942. StrRect = load.m_rcarray.ElementAt(++rcpos);
  6943. #ifdef LYFZ_VERSION
  6944. StrRect.left += 30;
  6945. StrRect.right += 30;
  6946. #endif
  6947. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6948. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6949. // 7.打印开单日期
  6950. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6951. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  6952. #if 0 // Original Edition
  6953. // 8.打印列字段:收款项目
  6954. m_Print.SetFontFace(13, 1, "宋体");
  6955. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6956. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6957. printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6958. // 9.打印列字段:金额
  6959. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6960. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6961. printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6962. // 10.打印列字段:开单人
  6963. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6964. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6965. printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6966. #else
  6967. // 8.打印列字段:收款项目
  6968. m_Print.SetFontFace(13, 1, "宋体");
  6969. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6970. StrRect = CRect(66, 85, 280, 105);
  6971. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6972. //m_Print.DrawText("收款项目",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  6973. // 8.1 Jeff add:支付方式
  6974. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6975. StrRect = CRect(280, 85, 350, 105);
  6976. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6977. //m_Print.DrawText("支付方式",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  6978. // 9.打印列字段:金额
  6979. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6980. StrRect = CRect(350, 85, 442, 105);
  6981. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6982. //m_Print.DrawText("金额",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  6983. // 10.打印列字段:开单人
  6984. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  6985. StrRect = CRect(442, 85, 535, 105);
  6986. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  6987. //m_Print.DrawText("开单人",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  6988. //rcpos += 3;
  6989. #endif
  6990. // 11.画表格-画3列;old
  6991. // 11.draw 4 column
  6992. m_Print.SetFontFace(11, 1, "宋体");
  6993. int i;
  6994. //for( i=7; i<10; i++)
  6995. //{
  6996. // StrRect=load.m_rcarray.ElementAt(i);
  6997. // m_Print.DrawRect2(StrRect, 1);
  6998. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  6999. //}
  7000. m_Print.DrawRect2(CRect(66, 85, 280, 105), 1);
  7001. m_Print.DrawRect2(CRect(280, 85, 350, 105), 1);
  7002. m_Print.DrawRect2(CRect(350, 85, 442, 105), 1);
  7003. m_Print.DrawRect2(CRect(442, 85, 535, 105), 1);
  7004. // 12.打印详细内容
  7005. int dty = 0;
  7006. int dtytemp = 0;
  7007. // for( i=10; i<14; i+=3)
  7008. //for( i=10; i<22; i+=3) // 循环4次,再画
  7009. int j = 0;
  7010. for (i = 10, j = 11; i<22; i += 3, j += 4) // 循环4次,再画
  7011. {
  7012. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  7013. CArray<CRect, CRect>rcarray;
  7014. CStringArray strarray2;
  7015. StrRect = load.m_rcarray.ElementAt(i);
  7016. StrRect.top += dty;
  7017. StrRect.bottom += dty;
  7018. StrRect.right -= 70; // Jeff add
  7019. //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;
  7020. /*
  7021. 4次的CRect
  7022. 66,105,350,125
  7023. 66,126,350,146
  7024. 66,147,350,167
  7025. 66,168,350,188
  7026. */
  7027. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  7028. {
  7029. StrRect = load.m_rcarray.ElementAt(i - 1);
  7030. StrRect.top += dty;
  7031. StrRect.bottom += dty;
  7032. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  7033. break;
  7034. }
  7035. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  7036. StrRect.left += 2;
  7037. StrRect.right -= 2;
  7038. StrRect.top += 4;
  7039. rcarray.Add(StrRect);
  7040. //strarray2.Add(pArray->ElementAt(i+1));
  7041. strarray2.Add(pArray->ElementAt(j));
  7042. //printf("Jeff:%d:%s\n\n",j,pArray->ElementAt(j));//Jeff Printf;
  7043. // 指定格子宽度,计算字符串占几行(高度).
  7044. int bottom = CalHeight(&rcarray, &strarray2, &m_Print, FORMAT_LEFT);
  7045. dtytemp = bottom - StrRect.bottom;
  7046. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7047. // 重新获取表格大小,并画出表格;
  7048. /*
  7049. CRect(66,85,280,105),
  7050. CRect(280,85,350,105)
  7051. CRect(350,85,442,105)
  7052. CRect(442,85,535,105)
  7053. CRect(66,105,350,125),
  7054. CRect(66,126,350,146)
  7055. CRect(66,147,350,167)
  7056. CRect(66,168,350,188)
  7057. */
  7058. // 画收款项目框及打印内容;
  7059. StrRect = load.m_rcarray.ElementAt(i);
  7060. //StrRect=CRect(66,85,280,105);
  7061. StrRect.bottom += dtytemp;
  7062. StrRect.top += dty;
  7063. StrRect.bottom += dty;
  7064. //StrRect.left -= 70; // Jeff add
  7065. StrRect.right -= 70; // Jeff add
  7066. //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;
  7067. m_Print.DrawRect2(StrRect, 1);
  7068. // 画支付方式框及打印内容;
  7069. StrRect = load.m_rcarray.ElementAt(i);
  7070. //StrRect=CRect(280,85,350,105);
  7071. StrRect.bottom += dtytemp;
  7072. StrRect.top += dty;
  7073. StrRect.bottom += dty;
  7074. StrRect.left += StrRect.Width() - 70;
  7075. //StrRect.right += 70; // Jeff add
  7076. //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;
  7077. m_Print.DrawRect2(StrRect, 1);
  7078. StrRect.left += 2;
  7079. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7080. //printf("Jeff:%d:%s\n\n",j+1,pArray->ElementAt(j+1));//Jeff Printf;
  7081. // 画金额框及打印内容;
  7082. StrRect = load.m_rcarray.ElementAt(i + 1);
  7083. //StrRect=CRect(350,85,442,105);
  7084. StrRect.top += dty;
  7085. StrRect.bottom += dty;
  7086. StrRect.bottom += dtytemp;
  7087. //StrRect.right -= 70; // Jeff add
  7088. //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;
  7089. m_Print.DrawRect2(StrRect, 1);
  7090. StrRect.left += 2;
  7091. // 打印出金额字段内容
  7092. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7093. //printf("Jeff:%d:%s\n\n",j+2,pArray->ElementAt(j+2));//Jeff Printf;
  7094. // 画开单人框及打印内容;
  7095. StrRect = load.m_rcarray.ElementAt(i + 2);
  7096. //StrRect=CRect(442,85,535,105);
  7097. StrRect.top += dty;
  7098. StrRect.bottom += dty;
  7099. StrRect.bottom += dtytemp;
  7100. //StrRect.right -= 70; // Jeff add
  7101. //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;
  7102. m_Print.DrawRect2(StrRect, 1);
  7103. StrRect.left += 2;
  7104. // 打印开单人字段内容
  7105. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 3), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7106. //printf("Jeff:%d:%s\n\n",j+3,pArray->ElementAt(j+3));//Jeff Printf;
  7107. dty += dtytemp;
  7108. }
  7109. //.打印->付款情况 应付 实付 欠款.
  7110. i = 22;
  7111. j = 27;
  7112. StrRect = load.m_rcarray.ElementAt(i);
  7113. StrRect.top += dty;
  7114. StrRect.bottom += dty;
  7115. m_Print.DrawRect2(StrRect, 1);
  7116. StrRect.left += 2;
  7117. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7118. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7119. //.打印->合计人民币(大写):.......
  7120. i = 23;
  7121. j = 28;
  7122. StrRect = load.m_rcarray.ElementAt(i);
  7123. StrRect.top += dty;
  7124. StrRect.bottom += dty;
  7125. m_Print.DrawRect2(StrRect, 1);
  7126. StrRect.left += 2;
  7127. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7128. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7129. // 打印总金额;
  7130. #ifdef LYFZ_VERSION
  7131. m_Print.SetFontFace(7, 1, "宋体");
  7132. for (i = 24; i < 25; i++)
  7133. {
  7134. StrRect = load.m_rcarray.ElementAt(i);
  7135. StrRect.top +=dty;
  7136. StrRect.bottom +=dty;
  7137. StrRect.left +=2;
  7138. m_Print.DrawText((LPTSTR)(LPCTSTR)"声明:1.此单作为收据凭证。2.软件免费升级一年服务。3.以上无正当理由定金不退。4.软件加密锁为核心技术,请妥善保管,遗失不补。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7139. }
  7140. #else
  7141. m_Print.SetFontFace(7, 1, "宋体");
  7142. for (i = 24, j = 29; i < 27; i++, j++)
  7143. {
  7144. StrRect = load.m_rcarray.ElementAt(i);
  7145. StrRect.top += dty;
  7146. StrRect.bottom += dty;
  7147. StrRect.left += 2;
  7148. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7149. }
  7150. #endif
  7151. StrRect = load.m_rcarray.ElementAt(24);
  7152. StrRect.top += dty;
  7153. StrRect.bottom += dty;
  7154. hei = StrRect.Height();
  7155. StrRect.top += hei;
  7156. StrRect.bottom += hei;
  7157. StrRect.right += 100;
  7158. StrRect.left += 2;
  7159. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  7160. AutoDraw(m_Print, StrRect, pArray->ElementAt(32), 1.0);
  7161. }
  7162. PrintPreview dlg;
  7163. dlg.m_mode = 3;
  7164. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  7165. dlg.m_pDC = m_Print.GetPDC();
  7166. if (aa == 0)
  7167. {
  7168. if (dlg.DoModal() != IDOK)
  7169. {
  7170. return;
  7171. }
  7172. printcot = dlg.m_num;
  7173. }
  7174. //结束打印
  7175. m_Print.EndPage();
  7176. m_Print.EndPrint();
  7177. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7178. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7179. CString sql;
  7180. sql.Format("update version set [serialno]='%s'", SerialNo);
  7181. g_sendhead.bsql = 1;
  7182. g_nYearposTemp = g_nYearpos;
  7183. g_nYearpos = -1;
  7184. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7185. g_nYearpos = g_nYearposTemp;
  7186. #endif
  7187. }
  7188. }
  7189. void CMainFrame::PrintReceipt_02(CStringArray *pArray, CPrintRX *pPrinter, const int &nCount, const BOOL bPrintImmediately) // 打印订单*预约收款、预约补款*
  7190. {
  7191. //AfxMessageBox("abce");
  7192. int printcot = 1;
  7193. // for(int aa=0; aa<printcot; aa++) // Jeff, printcot=1....
  7194. // {
  7195. g_sendhead.bsql = 0;
  7196. g_sendhead.code[0] = 24;
  7197. g_sendhead.tabcount = 1;
  7198. int g_nYearposTemp = g_nYearpos;
  7199. g_nYearpos = -1;
  7200. g_pMainWnd->ProcessChatMessageRequest2(1);
  7201. g_nYearpos = g_nYearposTemp;
  7202. if (0 == g_bSendOK)return;
  7203. DataToArray(&g_cominfoarray);
  7204. CString SerialNo;
  7205. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7206. CPrintRX *tagPrinter = NULL;
  7207. if (pPrinter == NULL)
  7208. {
  7209. // 1.创建打印对象
  7210. tagPrinter = new CPrintRX;
  7211. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7212. {
  7213. tagPrinter->InitToPrint(NULL, 1);
  7214. }
  7215. else
  7216. {
  7217. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  7218. if (name.IsEmpty())
  7219. {
  7220. tagPrinter->InitToPrint(NULL, 1);
  7221. }
  7222. else
  7223. {
  7224. int nret = tagPrinter->InitToPrint((char*)(LPCTSTR)name, 1);
  7225. ///if(nret==-1 && aa==0)
  7226. if (nret == -1)
  7227. {
  7228. if (bPrintImmediately == FALSE)
  7229. AfxMessageBox("没有此找到打印机, 将使用默认打印机!");
  7230. tagPrinter->InitToPrint(NULL, 1);
  7231. }
  7232. }
  7233. }
  7234. // 2.开始打印
  7235. tagPrinter->StartPrint();
  7236. tagPrinter->StartPage();
  7237. }
  7238. else
  7239. {
  7240. //SerialNo.Format ("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126))+1);
  7241. tagPrinter = pPrinter;
  7242. }
  7243. LoadRect load;
  7244. BOOL bSmall = 0;
  7245. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  7246. {
  7247. bSmall = 1;
  7248. load.SetLiaPath("20.lia");
  7249. }
  7250. else
  7251. load.SetLiaPath("10.lia");
  7252. if (bSmall)
  7253. load.SetMargins(0, 0);
  7254. else
  7255. load.SetMargins(10, 0);
  7256. if (!load.Load())return;
  7257. int rcpos = -1;
  7258. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7259. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  7260. {
  7261. Image *pImg = NULL;
  7262. g_nSendCode = 31;
  7263. int g_nYearposTemp = g_nYearpos;
  7264. g_nYearpos = -1;
  7265. g_pMainWnd->ProcessChatMessageRequest2(1);
  7266. g_nYearpos = g_nYearposTemp;
  7267. g_nSendCode = 0;
  7268. if (g_bSendOK == 0)return;
  7269. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7270. if (pImg)
  7271. {
  7272. StrRect.left = 65;
  7273. if (bSmall) StrRect.left = 55;
  7274. StrRect.top = 10;
  7275. StrRect.right = StrRect.left + 58;
  7276. StrRect.bottom = StrRect.top + 58;
  7277. // 3.打印2维码图像;
  7278. tagPrinter->DrawImage(pImg, StrRect);
  7279. delete pImg;
  7280. pImg = NULL;
  7281. }
  7282. }
  7283. //printf("Jeff:bSmall=%d\n\n",bSmall);//Jeff Printf;
  7284. if (bSmall)
  7285. {
  7286. tagPrinter->SetFontFace(18, 1, "黑体");
  7287. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7288. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7289. tagPrinter->SetFontFace(9, 1, "宋体");
  7290. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7291. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7292. tagPrinter->SetFontFace(6, 1, "宋体");
  7293. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7294. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7295. tagPrinter->SetFontFace(9, 1, "宋体");
  7296. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7297. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7298. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7299. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7300. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7301. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7302. int hei = StrRect.Height();
  7303. StrRect.bottom = StrRect.top;
  7304. StrRect.top -= 8;
  7305. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7306. tagPrinter->SetFontFace(11, 1, "宋体");
  7307. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7308. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7309. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7310. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7311. tagPrinter->SetFontFace(8, 1, "宋体");
  7312. int i = 0;
  7313. for ( i = 7; i < 24; i++)
  7314. {
  7315. StrRect = load.m_rcarray.ElementAt(i);
  7316. tagPrinter->DrawRect2(StrRect, 1);
  7317. }
  7318. for (i = 9; i < 24; i++)
  7319. {
  7320. StrRect = load.m_rcarray.ElementAt(i);
  7321. StrRect.left += 2;
  7322. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7323. }
  7324. tagPrinter->SetFontFace(6, 1, "宋体");
  7325. for (i = 24; i < 26; i++)
  7326. {
  7327. StrRect = load.m_rcarray.ElementAt(i);
  7328. StrRect.left += 2;
  7329. if (i == 24)
  7330. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7331. else
  7332. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7333. }
  7334. // StrRect=load.m_rcarray .ElementAt (27);
  7335. // AutoDraw(m_Print, StrRect, pArray->ElementAt (27), 1.0);
  7336. }
  7337. else//大单
  7338. {
  7339. // 1.打印表头(蒙娜丽莎收款单)
  7340. tagPrinter->SetFontFace(20, 1, "黑体");
  7341. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7342. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7343. tagPrinter->SetFontFace(11, 1, "宋体");
  7344. // 2.打印订单号(NO.20140608-001)
  7345. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7346. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7347. // 3.打印SerialNo(SerialNo.01062)
  7348. int hei = StrRect.Height();
  7349. StrRect.bottom = StrRect.top;
  7350. StrRect.top -= 10; //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7351. tagPrinter->DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  7352. // 4.打印影楼地址信息、电话;
  7353. tagPrinter->SetFontFace(8, 1, "宋体");
  7354. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7355. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7356. #ifdef LYFZ_VERSION
  7357. tagPrinter->SetFontFace(9, 1, "宋体");
  7358. #else
  7359. tagPrinter->SetFontFace(11, 1, "宋体");
  7360. #endif
  7361. // 5.打印客户姓名
  7362. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7363. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7364. // 6.打印客户联系电话
  7365. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7366. #ifdef LYFZ_VERSION
  7367. StrRect.left += 30;
  7368. StrRect.right += 30;
  7369. #endif
  7370. //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7371. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7372. // 7.打印开单日期
  7373. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7374. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  7375. #if 0 // Original Edition
  7376. // 8.打印列字段:收款项目
  7377. tagPrinter->SetFontFace(13, 1, "宋体");
  7378. StrRect = load.m_rcarray.ElementAt(++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7379. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7380. printf("Jeff:收款项目:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7381. // 9.打印列字段:金额
  7382. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7383. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7384. printf("Jeff:金额:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7385. // 10.打印列字段:开单人
  7386. StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7387. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7388. printf("Jeff:开单人:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7389. #else
  7390. // 8.打印列字段:收款项目
  7391. tagPrinter->SetFontFace(13, 1, "宋体");
  7392. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7393. StrRect = CRect(66, 85, 280, 105);
  7394. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7395. //m_Print.DrawText("收款项目",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7396. // 8.1 Jeff add:支付方式
  7397. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7398. StrRect = CRect(280, 85, 350, 105);
  7399. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7400. //m_Print.DrawText("支付方式",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7401. // 9.打印列字段:金额
  7402. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7403. StrRect = CRect(350, 85, 442, 105);
  7404. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7405. //m_Print.DrawText("金额",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7406. // 10.打印列字段:开单人
  7407. //StrRect=load.m_rcarray .ElementAt (++rcpos); //printf("Jeff:%d:%s\n\n",rcpos,pArray->ElementAt(rcpos));//Jeff Printf;
  7408. StrRect = CRect(442, 85, 535, 105);
  7409. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(++rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7410. //m_Print.DrawText("开单人",StrRect,0,0,FORMAT_LEFT | FORMAT_VCENTER);
  7411. //rcpos += 3;
  7412. #endif
  7413. // 11.画表格-画3列;old
  7414. // 11.draw 4 column
  7415. tagPrinter->SetFontFace(11, 1, "宋体");
  7416. int i;
  7417. //for( i=7; i<10; i++)
  7418. //{
  7419. // StrRect=load.m_rcarray.ElementAt(i);
  7420. // m_Print.DrawRect2(StrRect, 1);
  7421. //printf("Jeff:left=%d,top=%d,right=%d,bottom=%d.\n\n",StrRect.left,StrRect.top,StrRect.right,StrRect.bottom); // Jeff Printf;
  7422. //}
  7423. tagPrinter->DrawRect2(CRect(66, 85, 280, 105), 1);
  7424. tagPrinter->DrawRect2(CRect(280, 85, 350, 105), 1);
  7425. tagPrinter->DrawRect2(CRect(350, 85, 442, 105), 1);
  7426. tagPrinter->DrawRect2(CRect(442, 85, 535, 105), 1);
  7427. // 12.打印详细内容
  7428. int dty = 0;
  7429. int dtytemp = 0;
  7430. // for( i=10; i<14; i+=3)
  7431. //for( i=10; i<22; i+=3) // 循环4次,再画
  7432. int j = 0;
  7433. for (i = 10, j = 11; i<22; i += 3, j += 4) // 循环4次,再画
  7434. {
  7435. /***************+计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)+***************************/
  7436. CArray<CRect, CRect>rcarray;
  7437. CStringArray strarray2;
  7438. StrRect = load.m_rcarray.ElementAt(i);
  7439. StrRect.top += dty;
  7440. StrRect.bottom += dty;
  7441. StrRect.right -= 70; // Jeff add
  7442. //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;
  7443. /*
  7444. 4次的CRect
  7445. 66,105,350,125
  7446. 66,126,350,146
  7447. 66,147,350,167
  7448. 66,168,350,188
  7449. */
  7450. if (StrRect.bottom > load.m_rcarray.ElementAt(22).top + 5)
  7451. {
  7452. StrRect = load.m_rcarray.ElementAt(i - 1);
  7453. StrRect.top += dty;
  7454. StrRect.bottom += dty;
  7455. dty = StrRect.bottom - load.m_rcarray.ElementAt(22).top;
  7456. break;
  7457. }
  7458. // 文字rect要左缩进2像素,右缩进2像素,上缩进4像素;
  7459. StrRect.left += 2;
  7460. StrRect.right -= 2;
  7461. StrRect.top += 4;
  7462. rcarray.Add(StrRect);
  7463. //strarray2.Add(pArray->ElementAt(i+1));
  7464. strarray2.Add(pArray->ElementAt(j));
  7465. //printf("Jeff:%d:%s\n\n",j,pArray->ElementAt(j));//Jeff Printf;
  7466. // 指定格子宽度,计算字符串占几行(高度).
  7467. int bottom = CalHeight(&rcarray, &strarray2, tagPrinter, FORMAT_LEFT);
  7468. dtytemp = bottom - StrRect.bottom;
  7469. /***************-计算表格内文字将占用多少高度(几行),并打印(收款项目列字段内容)-***************************/
  7470. // 重新获取表格大小,并画出表格;
  7471. /*
  7472. CRect(66,85,280,105),
  7473. CRect(280,85,350,105)
  7474. CRect(350,85,442,105)
  7475. CRect(442,85,535,105)
  7476. CRect(66,105,350,125),
  7477. CRect(66,126,350,146)
  7478. CRect(66,147,350,167)
  7479. CRect(66,168,350,188)
  7480. */
  7481. // 画收款项目框及打印内容;
  7482. StrRect = load.m_rcarray.ElementAt(i);
  7483. //StrRect=CRect(66,85,280,105);
  7484. StrRect.bottom += dtytemp;
  7485. StrRect.top += dty;
  7486. StrRect.bottom += dty;
  7487. //StrRect.left -= 70; // Jeff add
  7488. StrRect.right -= 70; // Jeff add
  7489. //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;
  7490. tagPrinter->DrawRect2(StrRect, 1);
  7491. // 画支付方式框及打印内容;
  7492. StrRect = load.m_rcarray.ElementAt(i);
  7493. //StrRect=CRect(280,85,350,105);
  7494. StrRect.bottom += dtytemp;
  7495. StrRect.top += dty;
  7496. StrRect.bottom += dty;
  7497. StrRect.left += StrRect.Width() - 70;
  7498. //StrRect.right += 70; // Jeff add
  7499. //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;
  7500. tagPrinter->DrawRect2(StrRect, 1);
  7501. StrRect.left += 2;
  7502. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 1), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7503. //printf("Jeff:%d:%s\n\n",j+1,pArray->ElementAt(j+1));//Jeff Printf;
  7504. // 画金额框及打印内容;
  7505. StrRect = load.m_rcarray.ElementAt(i + 1);
  7506. //StrRect=CRect(350,85,442,105);
  7507. StrRect.top += dty;
  7508. StrRect.bottom += dty;
  7509. StrRect.bottom += dtytemp;
  7510. //StrRect.right -= 70; // Jeff add
  7511. //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;
  7512. tagPrinter->DrawRect2(StrRect, 1);
  7513. StrRect.left += 2;
  7514. // 打印出金额字段内容
  7515. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 2), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7516. //printf("Jeff:%d:%s\n\n",j+2,pArray->ElementAt(j+2));//Jeff Printf;
  7517. // 画开单人框及打印内容;
  7518. StrRect = load.m_rcarray.ElementAt(i + 2);
  7519. //StrRect=CRect(442,85,535,105);
  7520. StrRect.top += dty;
  7521. StrRect.bottom += dty;
  7522. StrRect.bottom += dtytemp;
  7523. //StrRect.right -= 70; // Jeff add
  7524. //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;
  7525. tagPrinter->DrawRect2(StrRect, 1);
  7526. StrRect.left += 2;
  7527. // 打印开单人字段内容
  7528. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j + 3), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7529. //printf("Jeff:%d:%s\n\n",j+3,pArray->ElementAt(j+3));//Jeff Printf;
  7530. dty += dtytemp;
  7531. }
  7532. //.打印->付款情况 应付 实付 欠款.
  7533. i = 22;
  7534. j = 27;
  7535. StrRect = load.m_rcarray.ElementAt(i);
  7536. StrRect.top += dty;
  7537. StrRect.bottom += dty;
  7538. tagPrinter->DrawRect2(StrRect, 1);
  7539. StrRect.left += 2;
  7540. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7541. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7542. //.打印->合计人民币(大写):.......
  7543. i = 23;
  7544. j = 28;
  7545. StrRect = load.m_rcarray.ElementAt(i);
  7546. StrRect.top += dty;
  7547. StrRect.bottom += dty;
  7548. tagPrinter->DrawRect2(StrRect, 1);
  7549. StrRect.left += 2;
  7550. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7551. //printf("Jeff:%d:%s\n\n\n\n",i,pArray->ElementAt(i));//Jeff Printf;
  7552. // 打印总金额;
  7553. #ifdef LYFZ_VERSION
  7554. tagPrinter->SetFontFace(7, 1, "宋体");
  7555. for (i = 24; i < 25; i++)
  7556. {
  7557. StrRect = load.m_rcarray.ElementAt(i);
  7558. StrRect.top +=dty;
  7559. StrRect.bottom +=dty;
  7560. StrRect.left +=2;
  7561. tagPrinter->DrawText((LPTSTR)(LPCTSTR)"声明:1.此单作为收据凭证。2.软件免费升级一年服务。3.以上无正当理由定金不退。4.软件加密锁为核心技术,请妥善保管,遗失不补。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7562. }
  7563. #else
  7564. tagPrinter->SetFontFace(7, 1, "宋体");
  7565. for (i = 24, j = 29; i < 27; i++, j++)
  7566. {
  7567. StrRect = load.m_rcarray.ElementAt(i);
  7568. StrRect.top += dty;
  7569. StrRect.bottom += dty;
  7570. StrRect.left += 2;
  7571. tagPrinter->DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(j), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7572. }
  7573. #endif
  7574. StrRect = load.m_rcarray.ElementAt(24);
  7575. StrRect.top += dty;
  7576. StrRect.bottom += dty;
  7577. hei = StrRect.Height();
  7578. StrRect.top += hei;
  7579. StrRect.bottom += hei;
  7580. StrRect.right += 100;
  7581. StrRect.left += 2;
  7582. StrRect = load.m_rcarray.ElementAt(27); StrRect.top += dty; StrRect.bottom += dty;
  7583. AutoDraw(*tagPrinter, StrRect, pArray->ElementAt(32), 1.0);
  7584. }
  7585. if (bPrintImmediately == TRUE)
  7586. {
  7587. printcot = nCount;
  7588. ////结束打印
  7589. tagPrinter->EndPage();
  7590. tagPrinter->EndPrint();
  7591. #if 1 // Jeff.将Serialno的值变化放在获取Serialno后立即改变,以降低Serialno在获取时值保持不变的情况;//2014.09.01
  7592. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  7593. CString sql;
  7594. sql.Format("update version set [serialno]='%s'", SerialNo);
  7595. g_sendhead.bsql = 1;
  7596. g_nYearposTemp = g_nYearpos;
  7597. g_nYearpos = -1;
  7598. g_pMainWnd->ProcessChatMessageRequest2(sql);
  7599. g_nYearpos = g_nYearposTemp;
  7600. #endif
  7601. }
  7602. else
  7603. {
  7604. PrintPreview dlg;
  7605. dlg.m_mode = 3;
  7606. tagPrinter->GetWidHei(dlg.m_w, dlg.m_h);
  7607. dlg.m_pDC = tagPrinter->GetPDC();
  7608. //if(aa==0)
  7609. //{
  7610. if (dlg.DoModal() != IDOK)
  7611. {
  7612. return;
  7613. }
  7614. else
  7615. {
  7616. printcot = dlg.m_num;
  7617. //m_Print.deletePrinter();
  7618. for (int i = 0; i < printcot; i++)
  7619. {
  7620. //tagPrinter->EndPage();
  7621. //tagPrinter->m_DC.AbortDoc(); // 结束清空由StartDoc写入的内容;2014-09-15;
  7622. //tagPrinter->m_DC.EndDoc();
  7623. //Sleep(10000);
  7624. //tagPrinter->StartPrint();
  7625. //tagPrinter->NewPage();
  7626. //PrintReceipt_02(pArray,/*tagPrinter*/NULL,printcot,TRUE);
  7627. PrintReceipt_02(pArray, tagPrinter, printcot, TRUE);
  7628. }
  7629. }
  7630. if (tagPrinter) delete tagPrinter;
  7631. //}
  7632. }
  7633. //}
  7634. }
  7635. void CMainFrame::PrintFlowChart(CString strOrderNumber) // 选片打单;
  7636. {
  7637. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(75)))
  7638. {
  7639. // Jeff 使用风格2打印;
  7640. PrintFlowChart3(strOrderNumber);
  7641. return;
  7642. }
  7643. #ifdef ZHIAI_VERSION
  7644. PrintFlowChart2(strOrderNumber);
  7645. return;
  7646. #endif
  7647. int printcot = 1;
  7648. for (int aa = 0; aa < printcot; aa++)
  7649. {
  7650. CPrintRX m_Print;
  7651. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  7652. {
  7653. m_Print.InitToPrint(NULL, 1);
  7654. }
  7655. else
  7656. {
  7657. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  7658. if (name.IsEmpty())
  7659. m_Print.InitToPrint(NULL, 1);
  7660. else
  7661. {
  7662. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  7663. if (nret == -1 && aa == 0)
  7664. {
  7665. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  7666. }
  7667. }
  7668. }
  7669. m_Print.StartPrint();
  7670. m_Print.StartPage();
  7671. // CRect StrRect(0,0,560,818);
  7672. LoadRect load;
  7673. load.SetLiaPath("4.lia");
  7674. load.SetMargins(-14, -14);
  7675. if (!load.Load())return;
  7676. LoadRect load2;
  7677. load2.SetMargins(-14, 472 + 27 - 14);
  7678. load2.SetLiaPath("5.lia");
  7679. if (!load2.Load())return;
  7680. //////////////////////////////////////////////////////////////
  7681. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2'";
  7682. g_sendhead.code[0] = 54;
  7683. g_sendhead.code[1] = 223;
  7684. g_sendhead.tabcount = 2;
  7685. g_sendhead.bsql = 0;
  7686. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  7687. CArray<CStringArray, CStringArray>sparray;
  7688. DataToArray(&g_List1array, &sparray);
  7689. CString spno;
  7690. int i = 0;
  7691. for ( i = 0; i < sparray.GetSize(); i++)
  7692. {
  7693. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  7694. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  7695. if (sparray.ElementAt(i).ElementAt(5) == "入册" && sparray.ElementAt(i).ElementAt(5) == "入底" && sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  7696. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  7697. spno += sparray.ElementAt(i).ElementAt(5);
  7698. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  7699. spno += "; ";
  7700. else
  7701. {
  7702. spno += ":";
  7703. spno += sparray.ElementAt(i).ElementAt(6);
  7704. spno += "; ";
  7705. }
  7706. }
  7707. spno += " 加挑:";
  7708. for (i = 0; i < sparray.GetSize(); i++)
  7709. {
  7710. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  7711. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  7712. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  7713. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  7714. spno += sparray.ElementAt(i).ElementAt(5);
  7715. if (0)//sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  7716. spno += "; ";
  7717. else
  7718. {
  7719. spno += ":";
  7720. spno += sparray.ElementAt(i).ElementAt(6);
  7721. spno += "; ";
  7722. }
  7723. }
  7724. if (spno.Right(6) == " 加挑:")
  7725. {
  7726. spno = spno.Left(spno.GetLength() - 6);
  7727. }
  7728. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  7729. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  7730. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  7731. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  7732. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  7733. if (m_urgent.IsEmpty())m_urgent = "否";
  7734. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  7735. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  7736. // CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  7737. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  7738. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  7739. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  7740. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  7741. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  7742. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  7743. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  7744. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  7745. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(17) + g_List1array.ElementAt(0).ElementAt(29);
  7746. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  7747. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  7748. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  7749. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  7750. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  7751. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  7752. CString m_sum3;
  7753. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  7754. ::ConvertToPrice(m_sum3);
  7755. if (m_money3.IsEmpty())m_money3 = "0";
  7756. // m_money3=m_money3+"/"+m_sum3;
  7757. CString name;
  7758. if (!m_name1.IsEmpty())
  7759. name = m_name1 + ",";
  7760. name += m_name2;
  7761. name.TrimRight(",");
  7762. CString phone;
  7763. if (!m_phone1.IsEmpty())
  7764. phone = m_phone1 + ",";
  7765. phone += m_phone2; phone.TrimRight(",");
  7766. if (IsHasRights2new(31) == 0)
  7767. phone = "***";
  7768. CStringArray strarray;
  7769. strarray.Add(m_urgent);
  7770. strarray.Add(m_ren);
  7771. strarray.Add(m_waiter3);
  7772. strarray.Add(name);
  7773. strarray.Add(m_time2);
  7774. strarray.Add(m_time4);
  7775. strarray.Add(m_money3);
  7776. strarray.Add(m_sum3);
  7777. strarray.Add(m_takezs);
  7778. strarray.Add(m_taoxizs);
  7779. strarray.Add(m_choosezs);
  7780. strarray.Add(strOrderNumber);
  7781. strarray.Add(phone);
  7782. ////////////////////////////////////////////////////////////////
  7783. int rcpos = -1;
  7784. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  7785. Image *pImg = NULL;
  7786. #ifdef MNLS_VERSION
  7787. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  7788. #else
  7789. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  7790. #endif
  7791. m_Print.DrawImage(pImg, StrRect);
  7792. delete pImg;
  7793. m_Print.SetFontFace(11, 1, "宋体");
  7794. StrRect = load2.m_rcarray.ElementAt(7);
  7795. StrRect.top = load2.m_rcarray.ElementAt(15).top - 15;
  7796. StrRect.bottom = load2.m_rcarray.ElementAt(15).bottom - 15;
  7797. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  7798. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7799. StrRect.top += 15;
  7800. StrRect.bottom += 15;
  7801. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  7802. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7803. m_Print.SetFontFace(15, 1, "宋体");
  7804. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7805. #ifdef MNLS_VERSION
  7806. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7807. #endif
  7808. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7809. #ifdef MNLS_VERSION
  7810. m_Print.DrawRect(StrRect);
  7811. #endif
  7812. m_Print.SetFontFace(7, 1, "黑体");
  7813. m_Print.SetColor(0xffffff);
  7814. #ifdef MNLS_VERSION
  7815. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7816. #endif
  7817. m_Print.SetColor(0);
  7818. m_Print.SetFontFace(25, 1, "黑体");
  7819. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7820. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7821. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  7822. {
  7823. Image *pImg = NULL;
  7824. g_nSendCode = 31;
  7825. int g_nYearposTemp = g_nYearpos;
  7826. g_nYearpos = -1;
  7827. g_pMainWnd->ProcessChatMessageRequest2(1);
  7828. g_nYearpos = g_nYearposTemp;
  7829. g_nSendCode = 0;
  7830. if (g_bSendOK == 0)return;
  7831. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  7832. if (pImg)
  7833. {
  7834. StrRect.left = 450;
  7835. StrRect.top = 22;
  7836. StrRect.right = StrRect.left + 60;
  7837. StrRect.bottom = StrRect.top + 60;
  7838. m_Print.DrawImage(pImg, StrRect);
  7839. delete pImg; pImg = NULL;
  7840. }
  7841. }
  7842. #ifdef CHILD_VERSION
  7843. CString title[13] = { "是否加急:", "接单门市:", \
  7844. "选样人员:", "客人姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  7845. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:"
  7846. };
  7847. #else
  7848. CString title[13] = { "是否加急:", "接单门市:", \
  7849. "选样人员:", "新郎新娘姓名:", "拍照日期:", "选片日期:", "加挑:", "余款:", \
  7850. "拍摄总张数:", "应挑选张数:", "额外加挑张数:", "票号:", "客户联系电话:" };
  7851. #endif
  7852. m_Print.SetFontFace(12, 1, "宋体");
  7853. for (i = 0; i < 13; i++)
  7854. {
  7855. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7856. if (i < 3)
  7857. m_Print.DrawRect2(StrRect, 0);
  7858. else
  7859. m_Print.DrawRect2(StrRect, 1);
  7860. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7861. }
  7862. for (i = 18; i <= 37; i++)
  7863. {
  7864. StrRect = load.m_rcarray.ElementAt(++rcpos);
  7865. if (i >= 19 && i <= 21)
  7866. m_Print.DrawRect2(StrRect, 2);
  7867. /* else if(i==26)
  7868. {
  7869. CRect rc=StrRect;
  7870. CRect rc2=rc;
  7871. rc.right -=rc2.Width ()/2;
  7872. m_Print.DrawRect2(rc, 1);
  7873. rc2.left +=rc.Width ();
  7874. m_Print.DrawRect2(rc2, 1);
  7875. }*/
  7876. else
  7877. m_Print.DrawRect2(StrRect, 1);
  7878. if (i == 18)
  7879. {
  7880. StrRect.left += 5;
  7881. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7882. }
  7883. }
  7884. //////////////////////////////////////
  7885. rcpos = -1;
  7886. for (i = 0; i < 8; i++)
  7887. {
  7888. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  7889. m_Print.DrawRect2(StrRect, 1);
  7890. }
  7891. #ifdef CHILD_VERSION
  7892. CString title2[4] = { "引导师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  7893. #else
  7894. CString title2[4] = { "化妆师:", "摄影师:", "数码设计师:", "顾客设计签名:" };
  7895. #endif
  7896. for (i = 0; i < 4; i++)
  7897. {
  7898. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  7899. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7900. }
  7901. for (i = 0; i < 4; i++)
  7902. {
  7903. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  7904. m_Print.DrawRect2(StrRect, 2);
  7905. }
  7906. StrRect = load2.m_rcarray.ElementAt(11);
  7907. StrRect.top -= 15;
  7908. StrRect.bottom -= 15;
  7909. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客选片签名:", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  7910. StrRect = load2.m_rcarray.ElementAt(15);
  7911. StrRect.top -= 15;
  7912. StrRect.bottom -= 15;
  7913. m_Print.DrawRect2(StrRect, 2);
  7914. ///////////////////////////////////////////
  7915. for (i = 19; i <= 31; i++)
  7916. {
  7917. StrRect = load.m_rcarray.ElementAt(i - 1);
  7918. StrRect.left += 4;
  7919. if (i == 31)
  7920. {
  7921. if (m_phone1.IsEmpty() == 0 && m_phone2.IsEmpty() == 0)
  7922. {
  7923. StrRect.top += 2;
  7924. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  7925. StrRect.top += 8;
  7926. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7927. }
  7928. else
  7929. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7930. }
  7931. /* else if((i-19)==7)
  7932. {
  7933. CRect rc=StrRect;
  7934. CRect rc2=rc;
  7935. rc.right -=rc2.Width ()/2;
  7936. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7937. rc2.left +=rc.Width ()+3;
  7938. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7939. }*/
  7940. else
  7941. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7942. }
  7943. strarray.RemoveAll();
  7944. strarray.Add(m_waiter2);
  7945. strarray.Add(m_waiter1);
  7946. strarray.Add(m_waiter4);
  7947. for (i = 13; i <= 15; i++)
  7948. {
  7949. StrRect = load2.m_rcarray.ElementAt(i - 1);
  7950. StrRect.left += 4;
  7951. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  7952. }
  7953. ///////////spno
  7954. CRect sprc[14];
  7955. for (i = 0; i < 14; i++)
  7956. {
  7957. if (i < 7)
  7958. {
  7959. if (i == 0)
  7960. {
  7961. StrRect = load.m_rcarray.ElementAt(17); StrRect.left += 94; StrRect.right -= 3;
  7962. }
  7963. else
  7964. {
  7965. StrRect = load.m_rcarray.ElementAt(30 + i); StrRect.left += 4; StrRect.right -= 3;
  7966. }
  7967. }
  7968. else
  7969. {
  7970. StrRect = load2.m_rcarray.ElementAt(i - 7); StrRect.left += 4; StrRect.right -= 3;
  7971. }
  7972. sprc[i] = StrRect;
  7973. }
  7974. CString temp, tempspno, tempbz;
  7975. CSize size;
  7976. BOOL bRun = 0;
  7977. int fontsize = 12;
  7978. ll: tempspno = spno;
  7979. tempbz = m_bz;
  7980. m_Print.SetFontFace(fontsize, 1, "宋体");
  7981. for (i = 0; i<14; i++)
  7982. {
  7983. if (!tempspno.IsEmpty())
  7984. {
  7985. temp = tempspno;
  7986. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  7987. int right = 0;
  7988. CRect temprc = sprc[i];
  7989. while (size.cx>temprc.Width())
  7990. {
  7991. right++;
  7992. temp = tempspno.Left(tempspno.GetLength() - (right));
  7993. if (GIsHalfHZ(temp))
  7994. {
  7995. right++;
  7996. temp.Delete(temp.GetLength() - 1);
  7997. }
  7998. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  7999. }
  8000. if (bRun)
  8001. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8002. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  8003. if (tempspno.IsEmpty())i++;
  8004. }
  8005. else if (!tempbz.IsEmpty())
  8006. {
  8007. temp = tempbz;
  8008. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8009. int right = 0;
  8010. CRect temprc = sprc[i];
  8011. while (size.cx > temprc.Width())
  8012. {
  8013. right++;
  8014. temp = tempbz.Left(tempbz.GetLength() - (right));
  8015. if (GIsHalfHZ(temp))
  8016. {
  8017. right++;
  8018. temp.Delete(temp.GetLength() - 1);
  8019. }
  8020. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  8021. }
  8022. if (bRun)
  8023. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8024. tempbz = tempbz.Right(tempbz.GetLength() - temp.GetLength());
  8025. }
  8026. }
  8027. if (tempspno.IsEmpty() == 0 || tempbz.IsEmpty() == 0)
  8028. {
  8029. fontsize--;
  8030. goto ll;
  8031. }
  8032. if (bRun == 0)
  8033. {
  8034. bRun = 1;
  8035. goto ll;
  8036. }
  8037. PrintPreview dlg;
  8038. dlg.m_mode = 2;
  8039. dlg.m_name = name;
  8040. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8041. dlg.m_pDC = m_Print.GetPDC();
  8042. if (aa == 0)
  8043. {
  8044. if (dlg.DoModal() != IDOK)
  8045. return;
  8046. printcot = dlg.m_num;
  8047. }
  8048. //结束打印
  8049. m_Print.EndPage();
  8050. m_Print.EndPrint();
  8051. }
  8052. }
  8053. void CMainFrame::PrintFlowChart3LKAY(CString strOrderNumber)
  8054. {
  8055. int printcot = 1;
  8056. for (int aa = 0; aa < printcot; aa++)
  8057. {
  8058. CPrintRX m_Print;
  8059. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  8060. {
  8061. m_Print.InitToPrint(NULL, 1);
  8062. }
  8063. else
  8064. {
  8065. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  8066. if (name.IsEmpty())
  8067. m_Print.InitToPrint(NULL, 1);
  8068. else
  8069. {
  8070. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8071. if (nret == -1 && aa == 0)
  8072. {
  8073. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8074. }
  8075. }
  8076. }
  8077. m_Print.StartPrint();
  8078. m_Print.StartPage();
  8079. LoadRect load;
  8080. load.SetLiaPath("18.lia");
  8081. load.SetMargins(10, 0);
  8082. if (!load.Load())return;
  8083. CString str;
  8084. int rcpos = -1;
  8085. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8086. m_Print.SetFontFace(25, 1, "宋体");
  8087. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8088. m_Print.SetFontFace(15, 1, "宋体");
  8089. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8090. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8091. m_Print.SetFontFace(9, 1, "宋体");
  8092. //////////////////////////////////////////////////////////////
  8093. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8094. g_sendhead.code[0] = 54;
  8095. g_sendhead.code[1] = 223;
  8096. g_sendhead.code[2] = 52;
  8097. g_sendhead.tabcount = 3;
  8098. g_sendhead.bsql = 0;
  8099. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  8100. CArray<CStringArray, CStringArray>sparray;
  8101. CArray<CStringArray, CStringArray>clientarray;
  8102. DataToArray(&g_List1array, &sparray, &clientarray);
  8103. CString spno;
  8104. CStringArray sparray2;
  8105. int i = 0;
  8106. for ( i = 0; i < sparray.GetSize(); i++)
  8107. {
  8108. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8109. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8110. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8111. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8112. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8113. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8114. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8115. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8116. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8117. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8118. }
  8119. for (i = 0; i < sparray.GetSize(); i++)
  8120. {
  8121. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8122. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8123. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8124. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8125. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8126. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8127. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8128. sparray2.Add(sparray.ElementAt(i).ElementAt(9));
  8129. sparray2.Add(sparray.ElementAt(i).ElementAt(10));
  8130. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8131. }
  8132. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8133. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8134. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8135. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8136. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8137. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8138. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8139. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8140. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8141. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8142. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8143. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8144. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8145. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8146. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8147. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8148. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8149. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8150. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8151. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8152. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8153. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8154. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8155. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8156. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8157. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8158. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8159. CString m_sum3;
  8160. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8161. ::ConvertToPrice(m_sum3);
  8162. if (m_money3.IsEmpty())m_money3 = "0";
  8163. int dty = 0;
  8164. CString name;
  8165. if (!m_name1.IsEmpty())
  8166. name = m_name1 + ",";
  8167. name += m_name2;
  8168. name.TrimRight(",");
  8169. CString phone;
  8170. if (!m_phone1.IsEmpty())
  8171. phone = m_phone1 + ",";
  8172. phone += m_phone2; phone.TrimRight(",");
  8173. if (IsHasRights2new(31) == 0)
  8174. phone = "***";
  8175. CStringArray strarray;
  8176. #ifdef CHILD_VERSION
  8177. if (m_birthday.IsEmpty())
  8178. strarray.Add("姓名/性别");
  8179. else
  8180. strarray.Add("姓名/性别/年龄");
  8181. #else
  8182. strarray.Add("客人姓名");
  8183. #endif
  8184. strarray.Add("电话");
  8185. strarray.Add("单号");
  8186. strarray.Add("套系");
  8187. strarray.Add("选样");
  8188. strarray.Add("余款/加挑");
  8189. strarray.Add("选片/日期");
  8190. #ifdef CHILD_VERSION
  8191. if (m_birthday.IsEmpty())
  8192. strarray.Add(name + "/" + m_sex);
  8193. else
  8194. {
  8195. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8196. m_birthday.Format("%d", year + 1);
  8197. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8198. }
  8199. #else
  8200. strarray.Add(name);
  8201. #endif
  8202. strarray.Add(phone);
  8203. strarray.Add(strOrderNumber);
  8204. strarray.Add(m_taoxiname);
  8205. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8206. strarray.Add(str);
  8207. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8208. strarray.Add(str);
  8209. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8210. for (i = 3; i <= 16; i++)
  8211. {
  8212. StrRect = load.m_rcarray.ElementAt(i - 1);
  8213. if (i < 10)
  8214. {
  8215. m_Print.DrawRect2(StrRect, 1);
  8216. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8217. }
  8218. }
  8219. StrRect = load.m_rcarray.ElementAt(29);
  8220. m_Print.DrawRect2(StrRect, 1);
  8221. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8222. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  8223. {
  8224. Image *pImg = NULL;
  8225. g_nSendCode = 31;
  8226. int g_nYearposTemp = g_nYearpos;
  8227. g_nYearpos = -1;
  8228. g_pMainWnd->ProcessChatMessageRequest2(1);
  8229. g_nYearpos = g_nYearposTemp;
  8230. g_nSendCode = 0;
  8231. if (g_bSendOK == 0)return;
  8232. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8233. if (pImg)
  8234. {
  8235. StrRect.left = 485;
  8236. StrRect.top = 12;
  8237. StrRect.right = StrRect.left + 60;
  8238. StrRect.bottom = StrRect.top + 60;
  8239. m_Print.DrawImage(pImg, StrRect);
  8240. delete pImg; pImg = NULL;
  8241. }
  8242. }
  8243. CArray<CRect, CRect>rcarray;
  8244. CStringArray strarray2;
  8245. for (i = 10; i <= 16; i++)
  8246. {
  8247. StrRect = load.m_rcarray.ElementAt(i - 1);
  8248. StrRect.left += 2;
  8249. StrRect.right -= 2;
  8250. StrRect.top += 2;
  8251. rcarray.Add(StrRect);
  8252. strarray2.Add(strarray.ElementAt(7 + i - 10));
  8253. }
  8254. if (1)
  8255. {
  8256. StrRect = load.m_rcarray.ElementAt(30);
  8257. StrRect.left += 2;
  8258. StrRect.right -= 2;
  8259. StrRect.top += 2;
  8260. rcarray.Add(StrRect);
  8261. strarray2.Add(m_time6 + "/" + m_time5);
  8262. }
  8263. int bottom = CalHeight(&rcarray, &strarray2, &m_Print, FORMAT_HCENTER);
  8264. for (i = 10; i <= 16; i++)
  8265. {
  8266. StrRect = load.m_rcarray.ElementAt(i - 1);
  8267. if (i == 10)
  8268. {
  8269. dty += bottom - StrRect.bottom;
  8270. }
  8271. StrRect.bottom = bottom;
  8272. m_Print.DrawRect2(StrRect, 1);
  8273. }
  8274. if (1)
  8275. {
  8276. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  8277. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  8278. // m_Print.DrawText((LPTSTR)(LPCTSTR)(m_time6+"/"+m_time5), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER );
  8279. }
  8280. m_Print.SetFontFace(15, 1, "宋体");
  8281. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  8282. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8283. m_Print.SetFontFace(9, 1, "宋体");
  8284. strarray.RemoveAll();
  8285. strarray.Add("产品名称");
  8286. strarray.Add("数量");
  8287. strarray.Add("P数");
  8288. strarray.Add("张数");
  8289. strarray.Add("照片编号");
  8290. CArray<CRect, CRect>rc2array;
  8291. int wid = 25;
  8292. for (i = 18; i <= 22; i++)
  8293. {
  8294. StrRect = load.m_rcarray.ElementAt(i - 1);
  8295. if (i == 19)
  8296. {
  8297. StrRect.right = StrRect.left + wid;
  8298. }
  8299. if (i == 20)
  8300. {
  8301. StrRect = load.m_rcarray.ElementAt(i - 2);
  8302. StrRect.left += wid; StrRect.right = StrRect.left;
  8303. StrRect.right += wid;
  8304. }
  8305. if (i == 21)
  8306. {
  8307. StrRect = load.m_rcarray.ElementAt(i - 3);
  8308. StrRect.left += wid * 2; StrRect.right = StrRect.left;
  8309. StrRect.right += wid;
  8310. wid = StrRect.right;
  8311. }
  8312. if (i == 22)
  8313. {
  8314. StrRect = load.m_rcarray.ElementAt(i - 3);
  8315. StrRect.left = wid;
  8316. }
  8317. StrRect.top += dty; StrRect.bottom += dty;
  8318. m_Print.DrawRect2(StrRect, 1);
  8319. StrRect.left += 2;
  8320. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8321. StrRect.left -= 2;
  8322. StrRect.top = StrRect.bottom;
  8323. StrRect.bottom += 18;
  8324. rc2array.Add(StrRect);
  8325. }
  8326. int curypos = 0;
  8327. for (i = 0; i < sparray2.GetSize(); i += 5)
  8328. {
  8329. rcarray.RemoveAll();
  8330. strarray2.RemoveAll();
  8331. int j = 0;
  8332. for ( j = 0; j < 5; j++)
  8333. {
  8334. StrRect = rc2array.ElementAt(j);
  8335. StrRect.left += 2;
  8336. StrRect.right -= 2;
  8337. StrRect.top += 2;
  8338. rcarray.Add(StrRect);
  8339. strarray2.Add(sparray2.ElementAt(i + j));
  8340. }
  8341. int bottom = CalHeight(&rcarray, &strarray2, &m_Print, FORMAT_LEFT);
  8342. rcarray.RemoveAll();
  8343. for (j = 0; j < 5; j++)
  8344. {
  8345. StrRect = rc2array.ElementAt(j);
  8346. if (j == 0)
  8347. {
  8348. dty += bottom - StrRect.bottom;
  8349. }
  8350. StrRect.bottom = bottom;
  8351. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8352. StrRect.top = StrRect.bottom;
  8353. StrRect.bottom += 18;
  8354. rcarray.Add(StrRect);
  8355. }
  8356. rc2array.RemoveAll();
  8357. rc2array.Copy(rcarray);
  8358. }
  8359. m_Print.SetFontFace(15, 1, "宋体");
  8360. StrRect = load.m_rcarray.ElementAt(20);
  8361. dty = curypos - StrRect.bottom + 35;
  8362. StrRect.top += dty; StrRect.bottom += dty;
  8363. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8364. m_Print.SetFontFace(9, 1, "宋体");
  8365. rcarray.RemoveAll();
  8366. strarray2.RemoveAll();
  8367. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8368. StrRect.left += 2;
  8369. StrRect.right -= 2;
  8370. StrRect.top += 2;
  8371. rcarray.Add(StrRect);
  8372. strarray2.Add(m_bz);
  8373. bottom = CalHeight(&rcarray, &strarray2, &m_Print, FORMAT_LEFT);
  8374. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  8375. dty += bottom - StrRect.bottom;
  8376. StrRect.bottom = bottom;
  8377. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  8378. m_Print.SetFontFace(10, 1, "宋体");
  8379. StrRect = load.m_rcarray.ElementAt(22);
  8380. dty = curypos - StrRect.bottom + 25;
  8381. StrRect.top += dty; StrRect.bottom += dty;
  8382. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  8383. if (m_edit9.IsEmpty())
  8384. {
  8385. m_edit9 = "\
  8386. 经确认后的照片均排入制作流程,\r\n\
  8387. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  8388. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  8389. }
  8390. CString info1, info2, info3;
  8391. int newlinepos = m_edit9.Find("\r\n");
  8392. if (newlinepos != -1)
  8393. {
  8394. info1 = m_edit9.Left(newlinepos);
  8395. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8396. }
  8397. newlinepos = m_edit9.Find("\r\n");
  8398. if (newlinepos != -1)
  8399. {
  8400. info2 = m_edit9.Left(newlinepos);
  8401. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8402. info3 = m_edit9;
  8403. }
  8404. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8405. StrRect = load.m_rcarray.ElementAt(23);
  8406. StrRect.top += dty; StrRect.bottom += dty;
  8407. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8408. StrRect = load.m_rcarray.ElementAt(24);
  8409. StrRect.top += dty; StrRect.bottom += dty;
  8410. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8411. StrRect.top += 15;
  8412. StrRect.bottom += 15;
  8413. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8414. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  8415. StrRect = load.m_rcarray.ElementAt(25);
  8416. StrRect.top += dty - dy;
  8417. StrRect.bottom += dty - dy;
  8418. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8419. StrRect = load.m_rcarray.ElementAt(26);
  8420. StrRect.top += dty - dy;
  8421. StrRect.bottom += dty - dy;
  8422. m_Print.DrawRect2(StrRect, 2);
  8423. StrRect = load.m_rcarray.ElementAt(25);
  8424. StrRect.top += dty + 15 - dy;
  8425. StrRect.bottom += dty + 15 - dy;
  8426. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8427. StrRect = load.m_rcarray.ElementAt(26);
  8428. StrRect.top += dty + 15 - dy;
  8429. StrRect.bottom += dty + 15 - dy;
  8430. m_Print.DrawRect2(StrRect, 2);
  8431. StrRect = load.m_rcarray.ElementAt(25);
  8432. StrRect.top += dty + 15 * 2 - dy;
  8433. StrRect.bottom += dty + 15 * 2 - dy;
  8434. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8435. StrRect = load.m_rcarray.ElementAt(26);
  8436. StrRect.top += dty + 15 * 2 - dy;
  8437. StrRect.bottom += dty + 15 * 2 - dy;
  8438. m_Print.DrawRect2(StrRect, 2);
  8439. PrintPreview dlg; dlg.m_mode = 2;
  8440. dlg.m_name = name;
  8441. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8442. dlg.m_pDC = m_Print.GetPDC();
  8443. if (aa == 0)
  8444. {
  8445. if (dlg.DoModal() != IDOK)
  8446. return;
  8447. printcot = dlg.m_num;
  8448. }
  8449. //结束打印
  8450. m_Print.EndPage();
  8451. m_Print.EndPrint();
  8452. }
  8453. }
  8454. void CMainFrame::PrintFlowChart3(CString strOrderNumber) // 选片打单 风格2;
  8455. {
  8456. #ifdef LKAY_VERSION
  8457. PrintFlowChart3LKAY(strOrderNumber);
  8458. return;
  8459. #endif
  8460. int printcot = 1;
  8461. for (int aa = 0; aa < printcot; aa++)
  8462. {
  8463. BOOL bSecondPage = 0;
  8464. int nPrintedPos = 0;
  8465. for (int bb = 0; bb < 2; bb++)
  8466. {
  8467. if (bb && bSecondPage == 0)break;
  8468. CPrintRX m_Print;
  8469. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58))) // 58-[version].[setcheck1] ==1,使用默认打印机;
  8470. {
  8471. m_Print.InitToPrint(NULL, 1);
  8472. }
  8473. else // 否则使用指定的打印机;
  8474. {
  8475. CString name = g_cominfoarray.ElementAt(0).ElementAt(64); // 64-[version].[printer2] 制作单打印机;
  8476. if (name.IsEmpty())
  8477. m_Print.InitToPrint(NULL, 1);
  8478. else
  8479. {
  8480. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  8481. if (nret == -1 && aa == 0)
  8482. {
  8483. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  8484. }
  8485. }
  8486. }
  8487. m_Print.StartPrint();
  8488. m_Print.StartPage();
  8489. LoadRect load;
  8490. load.SetLiaPath("18.lia");
  8491. load.SetMargins(10, 0);
  8492. if (!load.Load())return;
  8493. CString str;
  8494. int rcpos = -1;
  8495. // ■■■■■■从18.lia获取到第一个区域大小 - 1.显示店名;
  8496. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  8497. if ((bb == 0 && bSecondPage == 0))
  8498. {
  8499. m_Print.SetFontFace(25, 1, "宋体");
  8500. // 10-[version].[info1] 店名;
  8501. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8502. m_Print.SetFontFace(15, 1, "宋体");
  8503. // ■■■■■■从18.lia获取第二个区域大小 - 2.显示"基本资料";
  8504. StrRect = load.m_rcarray.ElementAt(++rcpos);
  8505. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8506. m_Print.SetFontFace(9, 1, "宋体");
  8507. }
  8508. //////////////////////////////////////////////////////////////
  8509. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  8510. g_sendhead.code[0] = 54; // dindan;
  8511. g_sendhead.code[1] = 223; // dindanspview2; shangpin+dindansp;
  8512. g_sendhead.code[2] = 52; // client;
  8513. g_sendhead.tabcount = 3;
  8514. g_sendhead.bsql = 0;
  8515. g_pMainWnd->ProcessChatMessageRequest2(filter);
  8516. if (g_bSendOK == 0)return;
  8517. CArray<CStringArray, CStringArray>sparray;
  8518. CArray<CStringArray, CStringArray>clientarray;
  8519. DataToArray(&g_List1array, &sparray, &clientarray);
  8520. CString spno;
  8521. CStringArray sparray2;
  8522. int i = 0;
  8523. for ( i = 0; i < sparray.GetSize(); i++)
  8524. {
  8525. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  8526. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  8527. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  8528. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8529. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8530. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8531. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  8532. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8533. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8534. }
  8535. for (i = 0; i < sparray.GetSize(); i++)
  8536. {
  8537. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  8538. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  8539. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  8540. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  8541. // 136 - [version].[reverse1] // 6 - [dindansp].[no]
  8542. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  8543. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  8544. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  8545. sparray2.Add(sparray.ElementAt(i).ElementAt(6));
  8546. }
  8547. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  8548. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  8549. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  8550. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  8551. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  8552. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  8553. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  8554. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  8555. CString m_time4 = g_List1array.ElementAt(0).ElementAt(7);
  8556. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  8557. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  8558. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  8559. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  8560. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  8561. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  8562. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  8563. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  8564. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  8565. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  8566. CString m_bz = g_List1array.ElementAt(0).ElementAt(17) + " " + g_List1array.ElementAt(0).ElementAt(29);
  8567. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(23);
  8568. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  8569. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  8570. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  8571. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  8572. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  8573. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  8574. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  8575. CString m_sum3;
  8576. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  8577. ::ConvertToPrice(m_sum3);
  8578. if (m_money3.IsEmpty())m_money3 = "0";
  8579. int dty = 0;
  8580. CString name;
  8581. if (!m_name1.IsEmpty())
  8582. name = m_name1 + ",";
  8583. name += m_name2;
  8584. name.TrimRight(",");
  8585. CString phone;
  8586. if (!m_phone1.IsEmpty())
  8587. phone = m_phone1 + ",";
  8588. phone += m_phone2; phone.TrimRight(",");
  8589. if (IsHasRights2new(31) == 0)
  8590. phone = "***";
  8591. CStringArray strarray;
  8592. CArray<CRect, CRect>rcarray;
  8593. CStringArray strarray2; CArray<CRect, CRect>rc2array;
  8594. int bottom;
  8595. if ((bb == 0 && bSecondPage == 0))
  8596. {
  8597. #ifdef CHILD_VERSION
  8598. if (m_birthday.IsEmpty())
  8599. strarray.Add("姓名/性别");
  8600. else
  8601. strarray.Add("姓名/性别/年龄");
  8602. #else
  8603. strarray.Add("客人姓名"); // 第3.1区域 -3.显示客人姓名;
  8604. #endif
  8605. strarray.Add("电话");
  8606. strarray.Add("单号");
  8607. strarray.Add("套系");
  8608. strarray.Add("选样");
  8609. strarray.Add("余款/加挑");
  8610. strarray.Add("选片/日期");
  8611. #ifdef CHILD_VERSION
  8612. if (m_birthday.IsEmpty())
  8613. strarray.Add(name + "/" + m_sex);
  8614. else
  8615. {
  8616. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  8617. m_birthday.Format("%d", year + 1);
  8618. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  8619. }
  8620. #else
  8621. strarray.Add(name); // 第4.1区域 -3.显示客人姓名;
  8622. #endif
  8623. strarray.Add(phone);
  8624. strarray.Add(strOrderNumber);
  8625. strarray.Add(m_taoxiname);
  8626. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  8627. strarray.Add(str);
  8628. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  8629. strarray.Add(str);
  8630. strarray.Add(m_waiter3 + "/" + m_time4);//m_time5
  8631. for (i = 3; i <= 16; i++)
  8632. {
  8633. // ■■■■■■从18.lia中获取第3~16的区域大小;
  8634. StrRect = load.m_rcarray.ElementAt(i - 1);
  8635. if (i < 10)
  8636. {
  8637. m_Print.DrawRect2(StrRect, 1);
  8638. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8639. }
  8640. }
  8641. // ■■■■■■从18.lia中获取第30的区域大小;
  8642. StrRect = load.m_rcarray.ElementAt(29);
  8643. m_Print.DrawRect2(StrRect, 1);
  8644. BOOL bPrintDate = 1;
  8645. #ifdef DDF_VERSION
  8646. // bPrintDate=0;
  8647. #else
  8648. if (m_time5 == "" && m_time6 == "")
  8649. bPrintDate = 0;
  8650. #endif
  8651. if (bPrintDate)
  8652. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8653. else
  8654. {
  8655. #ifdef CHILD_VERSION
  8656. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/引导", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8657. #else
  8658. m_Print.DrawText((LPTSTR)(LPCTSTR)"摄影/化妆", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8659. #endif
  8660. }
  8661. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138))) // [version].[reverse3]
  8662. {
  8663. Image *pImg = NULL;
  8664. g_nSendCode = 31;
  8665. int g_nYearposTemp = g_nYearpos;
  8666. g_nYearpos = -1;
  8667. g_pMainWnd->ProcessChatMessageRequest2(1);
  8668. g_nYearpos = g_nYearposTemp;
  8669. g_nSendCode = 0;
  8670. if (g_bSendOK == 0)return;
  8671. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  8672. // Jeff二维码的区域不是从18.lia里获取的,是固定在右上角指定区域;
  8673. if (pImg)
  8674. {
  8675. StrRect.left = 485;
  8676. StrRect.top = 12;
  8677. StrRect.right = StrRect.left + 60;
  8678. StrRect.bottom = StrRect.top + 60;
  8679. m_Print.DrawImage(pImg, StrRect);
  8680. delete pImg; pImg = NULL;
  8681. }
  8682. }
  8683. // CArray<CRect,CRect>rcarray;
  8684. // CStringArray strarray2;
  8685. // ■■■■■■从18.lia中获取第10的区域大小;
  8686. for (i = 10; i <= 16; i++)
  8687. {
  8688. StrRect = load.m_rcarray.ElementAt(i - 1);
  8689. StrRect.left += 2;
  8690. StrRect.right -= 2;
  8691. StrRect.top += 2;
  8692. rcarray.Add(StrRect);
  8693. strarray2.Add(strarray.ElementAt(7 + i - 10));
  8694. }
  8695. if (1)
  8696. {
  8697. // ■■■■■■从18.lia中获取第31的区域大小;
  8698. StrRect = load.m_rcarray.ElementAt(30);
  8699. StrRect.left += 2;
  8700. StrRect.right -= 2;
  8701. StrRect.top += 2;
  8702. rcarray.Add(StrRect);
  8703. if (bPrintDate)
  8704. strarray2.Add(m_time6 + "/" + m_time5);
  8705. else
  8706. {
  8707. strarray2.Add(m_waiter1 + "/" + m_waiter2);
  8708. }
  8709. }
  8710. int bottom = CalHeight(&rcarray, &strarray2, &m_Print, FORMAT_HCENTER);
  8711. for (i = 10; i <= 16; i++)
  8712. {
  8713. StrRect = load.m_rcarray.ElementAt(i - 1);
  8714. if (i == 10)
  8715. {
  8716. dty += bottom - StrRect.bottom;
  8717. }
  8718. StrRect.bottom = bottom;
  8719. m_Print.DrawRect2(StrRect, 1);
  8720. }
  8721. if (1)
  8722. {
  8723. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  8724. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  8725. }
  8726. m_Print.SetFontFace(15, 1, "宋体");
  8727. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  8728. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8729. }
  8730. int curypos = 0;
  8731. int oldpos = 0;
  8732. if (bb == 1)
  8733. {
  8734. dty = -100;
  8735. oldpos = nPrintedPos;
  8736. if (oldpos == 0)oldpos = 10000;
  8737. }
  8738. m_Print.SetFontFace(9, 1, "宋体");
  8739. strarray.RemoveAll();
  8740. if ((oldpos != 10000 && oldpos < sparray2.GetSize()) || bb == 0)
  8741. {
  8742. strarray.Add("产品名称");
  8743. strarray.Add("数量");
  8744. strarray.Add("照片编号");
  8745. for (i = 18; i <= 20; i++)
  8746. {
  8747. StrRect = load.m_rcarray.ElementAt(i - 1);
  8748. StrRect.top += dty;
  8749. StrRect.bottom += dty;
  8750. m_Print.DrawRect2(StrRect, 1);
  8751. StrRect.left += 2;
  8752. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8753. StrRect.left -= 2;
  8754. StrRect.top = StrRect.bottom;
  8755. StrRect.bottom += 18;
  8756. rc2array.Add(StrRect);
  8757. }
  8758. }
  8759. for (i = oldpos; i < sparray2.GetSize(); i += 3)
  8760. {
  8761. rcarray.RemoveAll();
  8762. strarray2.RemoveAll();
  8763. int j = 0;
  8764. for ( j = 0; j < 3; j++)
  8765. {
  8766. StrRect = rc2array.ElementAt(j);
  8767. StrRect.left += 2;
  8768. StrRect.right -= 2;
  8769. StrRect.top += 2;
  8770. rcarray.Add(StrRect);
  8771. #if JEFF_TEST_ON
  8772. if ( 2 == j )
  8773. {
  8774. CString strImg = sparray2.ElementAt(i + 2);
  8775. int nImgCount = strImg.Replace(",", ",");
  8776. if (nImgCount != 0 )
  8777. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount+1);
  8778. else if (!strImg.IsEmpty())
  8779. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  8780. strarray2.Add(strImg);
  8781. }
  8782. else
  8783. strarray2.Add(sparray2.ElementAt(i + j));
  8784. #else
  8785. strarray2.Add(sparray2.ElementAt(i + j));
  8786. #endif
  8787. }
  8788. bottom = CalHeight(&rcarray, &strarray2, &m_Print, FORMAT_LEFT);
  8789. rcarray.RemoveAll();
  8790. for (j = 0; j < 3; j++)
  8791. {
  8792. StrRect = rc2array.ElementAt(j);
  8793. if (j == 0)
  8794. {
  8795. dty += bottom - StrRect.bottom;
  8796. }
  8797. StrRect.bottom = bottom;
  8798. m_Print.DrawRect2(StrRect, 1);
  8799. curypos = StrRect.bottom;
  8800. StrRect.top = StrRect.bottom;
  8801. StrRect.bottom += 18;
  8802. rcarray.Add(StrRect);
  8803. }
  8804. rc2array.RemoveAll();
  8805. rc2array.Copy(rcarray);
  8806. if (bottom > 750)
  8807. {
  8808. bSecondPage = 1;
  8809. nPrintedPos = i + 3;
  8810. break;
  8811. }
  8812. }
  8813. if ((bb == 0 && bSecondPage == 0) || (bb == 1 && bSecondPage == 1))
  8814. {
  8815. m_Print.SetFontFace(15, 1, "宋体");
  8816. StrRect = load.m_rcarray.ElementAt(20);
  8817. dty = curypos - StrRect.bottom + 35;
  8818. StrRect.top += dty;
  8819. StrRect.bottom += dty;
  8820. if (StrRect.bottom > 700 && bb == 0)
  8821. {
  8822. bSecondPage = 1;
  8823. }
  8824. else
  8825. {
  8826. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  8827. m_Print.SetFontFace(9, 1, "宋体");
  8828. rcarray.RemoveAll();
  8829. strarray2.RemoveAll();
  8830. StrRect = load.m_rcarray.ElementAt(21);
  8831. StrRect.top += dty;
  8832. StrRect.bottom += dty;
  8833. StrRect.left += 2;
  8834. StrRect.right -= 2;
  8835. StrRect.top += 2;
  8836. rcarray.Add(StrRect);
  8837. #if JEFF_TEST_ON
  8838. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  8839. strarray2.RemoveAll();
  8840. CString strFind = "要求:";
  8841. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  8842. do
  8843. {
  8844. int nIndex = strbz3.Find(strFind, 1);
  8845. if (nIndex != -1)
  8846. {
  8847. CString strbz = strbz3.Left(nIndex);
  8848. strbz3 = strbz3.Mid(nIndex);
  8849. strarray2.Add(strbz);
  8850. }
  8851. else
  8852. {
  8853. strarray2.Add(strbz3);
  8854. strbz3 = "";
  8855. }
  8856. } while (strbz3.Find(strFind) != -1);
  8857. strarray2.Add(g_List1array.ElementAt(0).ElementAt(29));
  8858. strarray2.Add(g_List1array.ElementAt(0).ElementAt(23));
  8859. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  8860. #else
  8861. strarray2.Add(m_bz);
  8862. bottom = CalHeight(&rcarray, &strarray2, &m_Print, FORMAT_LEFT);
  8863. #endif
  8864. StrRect = load.m_rcarray.ElementAt(21);
  8865. StrRect.top += dty;
  8866. StrRect.bottom += dty;
  8867. dty += bottom - StrRect.bottom;
  8868. StrRect.bottom = bottom;
  8869. m_Print.DrawRect2(StrRect, 1);
  8870. curypos = StrRect.bottom;
  8871. m_Print.SetFontFace(10, 1, "宋体");
  8872. StrRect = load.m_rcarray.ElementAt(22);
  8873. dty = curypos - StrRect.bottom + 25;
  8874. StrRect.top += dty;
  8875. StrRect.bottom += dty;
  8876. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  8877. if (m_edit9.IsEmpty())
  8878. {
  8879. m_edit9 = "\
  8880. 经确认后的照片均排入制作流程,\r\n\
  8881. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  8882. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  8883. }
  8884. CString info1, info2, info3;
  8885. int newlinepos = m_edit9.Find("\r\n");
  8886. if (newlinepos != -1)
  8887. {
  8888. info1 = m_edit9.Left(newlinepos);
  8889. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8890. }
  8891. newlinepos = m_edit9.Find("\r\n");
  8892. if (newlinepos != -1)
  8893. {
  8894. info2 = m_edit9.Left(newlinepos);
  8895. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  8896. info3 = m_edit9;
  8897. }
  8898. #ifdef QCH_VERSION
  8899. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8900. StrRect = load.m_rcarray.ElementAt(23);
  8901. StrRect.top += dty; StrRect.bottom += dty;
  8902. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8903. StrRect=load.m_rcarray .ElementAt (24);
  8904. StrRect.top +=dty;StrRect.bottom +=dty;
  8905. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8906. StrRect.top +=15;
  8907. StrRect.bottom +=15;
  8908. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8909. #else
  8910. if (1)
  8911. {
  8912. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8913. StrRect = load.m_rcarray.ElementAt(23);
  8914. StrRect.top += dty; StrRect.bottom += dty;
  8915. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8916. StrRect = load.m_rcarray.ElementAt(24);
  8917. StrRect.top += dty; StrRect.bottom += dty;
  8918. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8919. }
  8920. else
  8921. {
  8922. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8923. StrRect = load.m_rcarray.ElementAt(23);
  8924. StrRect.top += dty; StrRect.bottom += dty;
  8925. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8926. StrRect = load.m_rcarray.ElementAt(24);
  8927. StrRect.top += dty; StrRect.bottom += dty;
  8928. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8929. }
  8930. StrRect.top += 15;
  8931. StrRect.bottom += 15;
  8932. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12) + " 电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  8933. #endif
  8934. int dy = load.m_rcarray.ElementAt(25).top - load.m_rcarray.ElementAt(27).top;
  8935. StrRect = load.m_rcarray.ElementAt(25);
  8936. StrRect.top += dty - dy;
  8937. StrRect.bottom += dty - dy;
  8938. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8939. StrRect = load.m_rcarray.ElementAt(26);
  8940. StrRect.top += dty - dy;
  8941. StrRect.bottom += dty - dy;
  8942. m_Print.DrawRect2(StrRect, 2);
  8943. StrRect = load.m_rcarray.ElementAt(25);
  8944. StrRect.top += dty + 15 - dy;
  8945. StrRect.bottom += dty + 15 - dy;
  8946. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8947. StrRect = load.m_rcarray.ElementAt(26);
  8948. StrRect.top += dty + 15 - dy;
  8949. StrRect.bottom += dty + 15 - dy;
  8950. m_Print.DrawRect2(StrRect, 2);
  8951. StrRect = load.m_rcarray.ElementAt(25);
  8952. StrRect.top += dty + 15 * 2 - dy;
  8953. StrRect.bottom += dty + 15 * 2 - dy;
  8954. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  8955. StrRect = load.m_rcarray.ElementAt(26);
  8956. StrRect.top += dty + 15 * 2 - dy;
  8957. StrRect.bottom += dty + 15 * 2 - dy;
  8958. m_Print.DrawRect2(StrRect, 2);
  8959. }
  8960. }
  8961. PrintPreview dlg; dlg.m_mode = 2;
  8962. dlg.m_name = name;
  8963. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  8964. dlg.m_pDC = m_Print.GetPDC();
  8965. if (aa == 0)
  8966. {
  8967. if (dlg.DoModal() != IDOK)
  8968. return;
  8969. printcot = dlg.m_num;
  8970. }
  8971. //结束打印
  8972. m_Print.EndPage();
  8973. m_Print.EndPrint();
  8974. }
  8975. }
  8976. }
  8977. /*
  8978. void CMainFrame::PrintFlowChart3(CString m_id)
  8979. {
  8980. #ifdef LKAY_VERSION
  8981. PrintFlowChart3LKAY(m_id);
  8982. return;
  8983. #endif
  8984. int printcot=1;
  8985. for(int aa=0; aa<printcot; aa++)
  8986. {
  8987. CPrintRX m_Print;
  8988. if(atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  8989. {
  8990. m_Print.InitToPrint(NULL, 1);
  8991. }
  8992. else
  8993. {
  8994. CString name=g_cominfoarray.ElementAt(0).ElementAt(64);
  8995. if(name.IsEmpty ())
  8996. m_Print.InitToPrint(NULL, 1);
  8997. else
  8998. {
  8999. int nret=m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9000. if(nret==-1 && aa==0)
  9001. {
  9002. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9003. }
  9004. }
  9005. }
  9006. m_Print.StartPrint();
  9007. m_Print.StartPage();
  9008. LoadRect load;
  9009. load.SetLiaPath ("18.lia");
  9010. load.SetMargins(10,0);
  9011. if(!load.Load ())return;
  9012. CString str;
  9013. int rcpos=-1;
  9014. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  9015. m_Print.SetFontFace(25, 1, "宋体");
  9016. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt (0).ElementAt (10)+"制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9017. m_Print.SetFontFace(15, 1, "宋体");
  9018. StrRect=load.m_rcarray .ElementAt (++rcpos);
  9019. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9020. m_Print.SetFontFace(9, 1, "宋体");
  9021. //////////////////////////////////////////////////////////////
  9022. CString filter="id='"+m_id+"';id='"+m_id+"' and kind<>'2';id='"+m_id+"'";
  9023. g_sendhead.code[0]=54;
  9024. g_sendhead.code[1]=50;
  9025. g_sendhead.code[2]=52;
  9026. g_sendhead.tabcount=3;
  9027. g_sendhead.bsql=0;
  9028. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  9029. CArray<CStringArray, CStringArray>sparray;
  9030. CArray<CStringArray, CStringArray>clientarray;
  9031. DataToArray(&g_List1array,&sparray,&clientarray);
  9032. CString spno;
  9033. CStringArray sparray2;
  9034. for(int i=0; i<sparray.GetSize (); i++)
  9035. {
  9036. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  9037. if(sparray.ElementAt (i).ElementAt (4)=="4" && sparray.ElementAt (i).ElementAt (5)!="入册" && sparray.ElementAt (i).ElementAt (5)!="入底")continue;
  9038. if(sparray.ElementAt (i).ElementAt (5)=="入册"&&sparray.ElementAt (i).ElementAt (5)=="入底"&&sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  9039. if(sparray.ElementAt (i).ElementAt (5)=="底片光盘")continue;
  9040. sparray2.Add (sparray.ElementAt (i).ElementAt (5));
  9041. sparray2.Add (sparray.ElementAt (i).ElementAt (3));
  9042. sparray2.Add (sparray.ElementAt (i).ElementAt (6));
  9043. }
  9044. for( i=0; i<sparray.GetSize (); i++)
  9045. {
  9046. if(sparray.ElementAt (i).ElementAt (4)!="4")continue;
  9047. if(sparray.ElementAt (i).ElementAt (5)=="入册")continue;
  9048. if(sparray.ElementAt (i).ElementAt (5)=="入底")continue;
  9049. if(sparray.ElementAt (i).ElementAt (5)=="底片光盘")continue;
  9050. sparray2.Add (sparray.ElementAt (i).ElementAt (5)+"+");
  9051. sparray2.Add (sparray.ElementAt (i).ElementAt (3));
  9052. sparray2.Add (sparray.ElementAt (i).ElementAt (6));
  9053. }
  9054. CString m_sex=clientarray.ElementAt (0).ElementAt (18);
  9055. CString m_birthday=clientarray.ElementAt (0).ElementAt (11);
  9056. CString m_name1 = g_List1array.ElementAt (0).ElementAt (1);
  9057. CString m_name2 = g_List1array.ElementAt (0).ElementAt (2);
  9058. CString m_phone1=g_List1array.ElementAt (0).ElementAt (3);
  9059. CString m_phone2=g_List1array.ElementAt (0).ElementAt (4);
  9060. CString m_urgent=g_List1array.ElementAt (0).ElementAt (5);
  9061. CString m_time2 = g_List1array.ElementAt (0).ElementAt (6);
  9062. CString m_time4 = g_List1array.ElementAt (0).ElementAt (7);
  9063. CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  9064. CString m_takezs = g_List1array.ElementAt (0).ElementAt (9);
  9065. CString m_taoxizs = g_List1array.ElementAt (0).ElementAt (10);
  9066. CString m_choosezs = g_List1array.ElementAt (0).ElementAt (11);
  9067. CString m_ren = g_List1array.ElementAt (0).ElementAt (12);
  9068. CString m_waiter3 = g_List1array.ElementAt (0).ElementAt (13);
  9069. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (14);
  9070. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (15);
  9071. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (16);
  9072. CString m_bz =g_List1array.ElementAt (0).ElementAt (17)+" "+g_List1array.ElementAt (0).ElementAt (29);
  9073. m_bz+=";"+g_List1array.ElementAt (0).ElementAt (23);
  9074. CString m_money3 = g_List1array.ElementAt (0).ElementAt (18);
  9075. CString m_money1 = g_List1array.ElementAt (0).ElementAt (19);
  9076. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (20);
  9077. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (21);
  9078. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (22);
  9079. CString m_taoxiname = g_List1array.ElementAt (0).ElementAt (24);
  9080. CString m_time6 = g_List1array.ElementAt (0).ElementAt (26);
  9081. CString m_sum3;
  9082. m_sum3.Format ("%0.2f", atof(m_taoxijiage)+atof(m_payed4)-(atof(m_payed5)+atof(m_money1)));
  9083. ::ConvertToPrice (m_sum3);
  9084. if(m_money3.IsEmpty ())m_money3="0";
  9085. int dty=0;
  9086. CString name;
  9087. if(!m_name1.IsEmpty ())
  9088. name=m_name1+",";
  9089. name+=m_name2;
  9090. name.TrimRight (",");
  9091. CString phone;
  9092. if(!m_phone1.IsEmpty ())
  9093. phone=m_phone1+",";
  9094. phone+=m_phone2;phone.TrimRight (",");
  9095. if(IsHasRights2new(31)==0)
  9096. phone="***";
  9097. CStringArray strarray;
  9098. #ifdef CHILD_VERSION
  9099. if(m_birthday.IsEmpty ())
  9100. strarray.Add ("姓名/性别");
  9101. else
  9102. strarray.Add ("姓名/性别/年龄");
  9103. #else
  9104. strarray.Add ("客人姓名");
  9105. #endif
  9106. strarray.Add ("电话");
  9107. strarray.Add ("单号");
  9108. strarray.Add ("套系");
  9109. strarray.Add ("选样");
  9110. strarray.Add ("余款/加挑");
  9111. strarray.Add ("选片/日期");
  9112. #ifdef CHILD_VERSION
  9113. if(m_birthday.IsEmpty ())
  9114. strarray.Add (name+"/"+m_sex);
  9115. else
  9116. {
  9117. int year=atoi(g_date.Left (4))-atoi(m_birthday.Left (4));
  9118. m_birthday.Format ("%d", year+1);
  9119. strarray.Add (name+"/"+m_sex+"/"+m_birthday);
  9120. }
  9121. #else
  9122. strarray.Add (name);
  9123. #endif
  9124. strarray.Add (phone);
  9125. strarray.Add (m_id);
  9126. strarray.Add (m_taoxiname);
  9127. str.Format ("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9128. strarray.Add (str);
  9129. str.Format ("%d/%d", atoi(m_sum3),atoi(m_money3));
  9130. strarray.Add (str);
  9131. strarray.Add (m_waiter3+"/"+m_time4);//m_time5
  9132. for( i=3; i<=16; i++)
  9133. {
  9134. StrRect=load.m_rcarray .ElementAt (i-1);
  9135. if(i<10)
  9136. {
  9137. m_Print.DrawRect2(StrRect, 1);
  9138. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9139. }
  9140. }
  9141. StrRect=load.m_rcarray .ElementAt (29);
  9142. m_Print.DrawRect2(StrRect, 1);
  9143. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样/取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9144. CArray<CRect,CRect>rcarray;
  9145. CStringArray strarray2;
  9146. for( i=10; i<=16; i++)
  9147. {
  9148. StrRect=load.m_rcarray .ElementAt (i-1);
  9149. StrRect.left +=2;
  9150. StrRect.right -=2;
  9151. StrRect.top +=2;
  9152. rcarray.Add (StrRect);
  9153. strarray2.Add (strarray.ElementAt (7+i-10));
  9154. }
  9155. if(1)
  9156. {
  9157. StrRect=load.m_rcarray .ElementAt (30);
  9158. StrRect.left +=2;
  9159. StrRect.right -=2;
  9160. StrRect.top +=2;
  9161. rcarray.Add (StrRect);
  9162. strarray2.Add (m_time6+"/"+m_time5);
  9163. }
  9164. int bottom=CalHeight(&rcarray, &strarray2, &m_Print, FORMAT_HCENTER);
  9165. for( i=10; i<=16; i++)
  9166. {
  9167. StrRect=load.m_rcarray .ElementAt (i-1);
  9168. if(i==10)
  9169. {
  9170. dty+=bottom-StrRect.bottom;
  9171. }
  9172. StrRect.bottom =bottom;
  9173. m_Print.DrawRect2(StrRect, 1);
  9174. }
  9175. if(1)
  9176. {
  9177. StrRect=load.m_rcarray .ElementAt (30);StrRect.bottom =bottom;
  9178. m_Print.DrawRect2(StrRect, 1);StrRect.top +=2;
  9179. // m_Print.DrawText((LPTSTR)(LPCTSTR)(m_time6+"/"+m_time5), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER );
  9180. }
  9181. m_Print.SetFontFace(15, 1, "宋体");
  9182. StrRect=load.m_rcarray .ElementAt (16);StrRect.top +=dty;StrRect.bottom +=dty;
  9183. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9184. m_Print.SetFontFace(9, 1, "宋体");
  9185. strarray.RemoveAll ();
  9186. strarray.Add ("产品名称");
  9187. strarray.Add ("数量");
  9188. strarray.Add ("照片编号");
  9189. CArray<CRect,CRect>rc2array;
  9190. for( i=18; i<=20; i++)
  9191. {
  9192. StrRect=load.m_rcarray .ElementAt (i-1);StrRect.top +=dty;StrRect.bottom +=dty;
  9193. m_Print.DrawRect2(StrRect, 1);
  9194. StrRect.left +=2;
  9195. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9196. StrRect.left -=2;
  9197. StrRect.top =StrRect.bottom ;
  9198. StrRect.bottom +=18;
  9199. rc2array.Add (StrRect);
  9200. }
  9201. int curypos=0;
  9202. for(i=0; i<sparray2.GetSize (); i+=3)
  9203. {
  9204. rcarray.RemoveAll ();
  9205. strarray2.RemoveAll ();
  9206. for(int j=0; j<3; j++)
  9207. {
  9208. StrRect=rc2array.ElementAt (j);
  9209. StrRect.left +=2;
  9210. StrRect.right -=2;
  9211. StrRect.top +=2;
  9212. rcarray.Add (StrRect);
  9213. strarray2.Add (sparray2.ElementAt (i+j));
  9214. }
  9215. int bottom=CalHeight(&rcarray, &strarray2, &m_Print, FORMAT_LEFT);
  9216. rcarray.RemoveAll ();
  9217. for( j=0; j<3; j++)
  9218. {
  9219. StrRect=rc2array.ElementAt (j);
  9220. if(j==0)
  9221. {
  9222. dty+=bottom-StrRect.bottom;
  9223. }
  9224. StrRect.bottom =bottom;
  9225. m_Print.DrawRect2(StrRect, 1);curypos=StrRect.bottom;
  9226. StrRect.top =StrRect.bottom ;
  9227. StrRect.bottom +=18;
  9228. rcarray.Add (StrRect);
  9229. }
  9230. rc2array.RemoveAll ();
  9231. rc2array.Copy(rcarray);
  9232. }
  9233. m_Print.SetFontFace(15, 1, "宋体");
  9234. StrRect=load.m_rcarray .ElementAt (20);
  9235. dty=curypos-StrRect.bottom+35;
  9236. StrRect.top +=dty;StrRect.bottom +=dty;
  9237. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9238. m_Print.SetFontFace(9, 1, "宋体");
  9239. rcarray.RemoveAll ();
  9240. strarray2.RemoveAll ();
  9241. StrRect=load.m_rcarray .ElementAt (21);StrRect.top +=dty;StrRect.bottom +=dty;
  9242. StrRect.left +=2;
  9243. StrRect.right -=2;
  9244. StrRect.top +=2;
  9245. rcarray.Add (StrRect);
  9246. strarray2.Add (m_bz);
  9247. bottom=CalHeight(&rcarray, &strarray2, &m_Print, FORMAT_LEFT);
  9248. StrRect=load.m_rcarray .ElementAt (21);StrRect.top +=dty;StrRect.bottom +=dty;
  9249. dty+=bottom-StrRect.bottom;
  9250. StrRect.bottom =bottom;
  9251. m_Print.DrawRect2(StrRect, 1);curypos=StrRect.bottom;
  9252. m_Print.SetFontFace(10, 1, "宋体");
  9253. StrRect=load.m_rcarray .ElementAt (22);
  9254. dty=curypos-StrRect.bottom+25;
  9255. StrRect.top +=dty;StrRect.bottom +=dty;
  9256. CString m_edit9=(g_cominfoarray.ElementAt (0).ElementAt (135));
  9257. if(m_edit9.IsEmpty())
  9258. {
  9259. m_edit9="\
  9260. 经确认后的照片均排入制作流程,\r\n\
  9261. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9262. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9263. }
  9264. CString info1,info2,info3;
  9265. int newlinepos=m_edit9.Find("\r\n");
  9266. if(newlinepos!=-1)
  9267. {
  9268. info1=m_edit9.Left(newlinepos);
  9269. m_edit9=m_edit9.Right(m_edit9.GetLength()-newlinepos-2);
  9270. }
  9271. newlinepos=m_edit9.Find("\r\n");
  9272. if(newlinepos!=-1)
  9273. {
  9274. info2=m_edit9.Left(newlinepos);
  9275. m_edit9=m_edit9.Right(m_edit9.GetLength()-newlinepos-2);
  9276. info3=m_edit9;
  9277. }
  9278. #ifdef QCH_VERSION
  9279. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9280. StrRect=load.m_rcarray .ElementAt (23);
  9281. StrRect.top +=dty;StrRect.bottom +=dty;
  9282. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9283. StrRect=load.m_rcarray .ElementAt (24);
  9284. StrRect.top +=dty;StrRect.bottom +=dty;
  9285. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9286. StrRect.top +=15;
  9287. StrRect.bottom +=15;
  9288. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:"+g_cominfoarray.ElementAt (0).ElementAt (12)+" 电话:"+g_cominfoarray.ElementAt (0).ElementAt (11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9289. #else
  9290. if(1)
  9291. {
  9292. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9293. StrRect=load.m_rcarray .ElementAt (23);
  9294. StrRect.top +=dty;StrRect.bottom +=dty;
  9295. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9296. StrRect=load.m_rcarray .ElementAt (24);
  9297. StrRect.top +=dty;StrRect.bottom +=dty;
  9298. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9299. }
  9300. else
  9301. {
  9302. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9303. StrRect=load.m_rcarray .ElementAt (23);
  9304. StrRect.top +=dty;StrRect.bottom +=dty;
  9305. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9306. StrRect=load.m_rcarray .ElementAt (24);
  9307. StrRect.top +=dty;StrRect.bottom +=dty;
  9308. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9309. }
  9310. StrRect.top +=15;
  9311. StrRect.bottom +=15;
  9312. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:"+g_cominfoarray.ElementAt (0).ElementAt (12)+" 电话:"+g_cominfoarray.ElementAt (0).ElementAt (11)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9313. #endif
  9314. int dy=load.m_rcarray .ElementAt (25).top-load.m_rcarray .ElementAt (27).top;
  9315. StrRect=load.m_rcarray .ElementAt (25);
  9316. StrRect.top +=dty-dy;
  9317. StrRect.bottom +=dty-dy;
  9318. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9319. StrRect=load.m_rcarray .ElementAt (26);
  9320. StrRect.top +=dty-dy;
  9321. StrRect.bottom +=dty-dy;
  9322. m_Print.DrawRect2(StrRect, 2);
  9323. StrRect=load.m_rcarray .ElementAt (25);
  9324. StrRect.top +=dty+15-dy;
  9325. StrRect.bottom +=dty+15-dy;
  9326. m_Print.DrawText((LPTSTR)(LPCTSTR)"看样签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9327. StrRect=load.m_rcarray .ElementAt (26);
  9328. StrRect.top +=dty+15-dy;
  9329. StrRect.bottom +=dty+15-dy;
  9330. m_Print.DrawRect2(StrRect, 2);
  9331. StrRect=load.m_rcarray .ElementAt (25);
  9332. StrRect.top +=dty+15*2-dy;
  9333. StrRect.bottom +=dty+15*2-dy;
  9334. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9335. StrRect=load.m_rcarray .ElementAt (26);
  9336. StrRect.top +=dty+15*2-dy;
  9337. StrRect.bottom +=dty+15*2-dy;
  9338. m_Print.DrawRect2(StrRect, 2);
  9339. PrintPreview dlg;dlg.m_mode=2;
  9340. dlg.m_name =name;
  9341. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  9342. dlg.m_pDC =m_Print.GetPDC() ;
  9343. if(aa==0)
  9344. {
  9345. if(dlg.DoModal ()!=IDOK)
  9346. return;
  9347. printcot=dlg.m_num;
  9348. }
  9349. //结束打印
  9350. m_Print.EndPage();
  9351. m_Print.EndPrint();
  9352. }
  9353. }
  9354. */
  9355. //void CMainFrame::PrintFlowChart4(CString m_id) // 选设计打单函数;
  9356. void CMainFrame::PrintFlowChart4(CString strOrderNumber) // 选设计打单函数,使用18.lia文件;
  9357. {
  9358. int printcot = 1;
  9359. for (int aa = 0; aa < printcot; aa++)
  9360. {
  9361. CPrintRX m_Print;
  9362. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  9363. {
  9364. m_Print.InitToPrint(NULL, 1);
  9365. }
  9366. else
  9367. {
  9368. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  9369. if (name.IsEmpty())
  9370. m_Print.InitToPrint(NULL, 1);
  9371. else
  9372. {
  9373. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  9374. if (nret == -1 && aa == 0)
  9375. {
  9376. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  9377. }
  9378. }
  9379. }
  9380. m_Print.StartPrint();
  9381. m_Print.StartPage();
  9382. LoadRect load;
  9383. load.SetLiaPath("18.lia");
  9384. load.SetMargins(10, 0);
  9385. if (!load.Load())return;
  9386. CString str;
  9387. int rcpos = -1;
  9388. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  9389. m_Print.SetFontFace(25, 1, "宋体");
  9390. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "制作单明细"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9391. m_Print.SetFontFace(15, 1, "宋体");
  9392. StrRect = load.m_rcarray.ElementAt(++rcpos);
  9393. m_Print.DrawText((LPTSTR)(LPCTSTR)"基本资料", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9394. m_Print.SetFontFace(9, 1, "宋体");
  9395. //////////////////////////////////////////////////////////////
  9396. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "' and kind<>'2';id='" + strOrderNumber + "'";
  9397. g_sendhead.code[0] = 54;
  9398. g_sendhead.code[1] = 223;
  9399. g_sendhead.code[2] = 52;
  9400. g_sendhead.tabcount = 3;
  9401. g_sendhead.bsql = 0;
  9402. g_pMainWnd->ProcessChatMessageRequest2(filter);
  9403. if (g_bSendOK == 0)return;
  9404. CArray<CStringArray, CStringArray>sparray;
  9405. CArray<CStringArray, CStringArray>clientarray;
  9406. DataToArray(&g_List1array, &sparray, &clientarray);
  9407. CString spno;
  9408. CStringArray sparray2;
  9409. int i = 0;
  9410. for ( i = 0; i < sparray.GetSize(); i++)
  9411. {
  9412. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  9413. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(8).IsEmpty())continue;
  9414. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9415. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9416. sparray2.Add(sparray.ElementAt(i).ElementAt(5));
  9417. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9418. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9419. }
  9420. for (i = 0; i < sparray.GetSize(); i++)
  9421. {
  9422. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  9423. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  9424. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  9425. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  9426. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  9427. sparray2.Add(sparray.ElementAt(i).ElementAt(5) + "+");
  9428. sparray2.Add(sparray.ElementAt(i).ElementAt(3));
  9429. sparray2.Add(sparray.ElementAt(i).ElementAt(8));
  9430. }
  9431. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  9432. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  9433. CString m_name1 = g_List1array.ElementAt(0).ElementAt(1);
  9434. CString m_name2 = g_List1array.ElementAt(0).ElementAt(2);
  9435. CString m_phone1 = g_List1array.ElementAt(0).ElementAt(3);
  9436. CString m_phone2 = g_List1array.ElementAt(0).ElementAt(4);
  9437. CString m_urgent = g_List1array.ElementAt(0).ElementAt(5);
  9438. CString m_time2 = g_List1array.ElementAt(0).ElementAt(6);
  9439. CString m_time5 = g_List1array.ElementAt(0).ElementAt(8);
  9440. CString m_takezs = g_List1array.ElementAt(0).ElementAt(9);
  9441. CString m_taoxizs = g_List1array.ElementAt(0).ElementAt(10);
  9442. CString m_choosezs = g_List1array.ElementAt(0).ElementAt(11);
  9443. CString m_ren = g_List1array.ElementAt(0).ElementAt(12);
  9444. CString m_waiter3 = g_List1array.ElementAt(0).ElementAt(13);
  9445. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(14);
  9446. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(15);
  9447. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(16);
  9448. CString m_bz = g_List1array.ElementAt(0).ElementAt(17);
  9449. m_bz += ";" + g_List1array.ElementAt(0).ElementAt(25);
  9450. CString m_money3 = g_List1array.ElementAt(0).ElementAt(18);
  9451. CString m_money1 = g_List1array.ElementAt(0).ElementAt(19);
  9452. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(20);
  9453. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(21);
  9454. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(22);
  9455. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(24);
  9456. CString m_time6 = g_List1array.ElementAt(0).ElementAt(26);
  9457. CString m_waiter8 = g_List1array.ElementAt(0).ElementAt(27);
  9458. CString m_replace = g_List1array.ElementAt(0).ElementAt(28);
  9459. if (!m_replace.IsEmpty())
  9460. {
  9461. m_replace = "设计替换照片:" + m_replace;
  9462. m_replace.Replace("$", ";");
  9463. m_replace.TrimLeft(";");
  9464. m_bz += ";";
  9465. m_bz += m_replace;
  9466. }
  9467. CString m_sum3;
  9468. m_sum3.Format("%0.2f", atof(m_taoxijiage) + atof(m_payed4) - (atof(m_payed5) + atof(m_money1)));
  9469. ::ConvertToPrice(m_sum3);
  9470. if (m_money3.IsEmpty())m_money3 = "0";
  9471. int dty = 0;
  9472. CString name;
  9473. if (!m_name1.IsEmpty())
  9474. name = m_name1 + ",";
  9475. name += m_name2;
  9476. name.TrimRight(",");
  9477. CString phone;
  9478. if (!m_phone1.IsEmpty())
  9479. phone = m_phone1 + ",";
  9480. phone += m_phone2; phone.TrimRight(",");
  9481. if (IsHasRights2new(31) == 0)
  9482. phone = "***";
  9483. CStringArray strarray;
  9484. #ifdef CHILD_VERSION
  9485. if (m_birthday.IsEmpty())
  9486. strarray.Add("姓名/性别");
  9487. else
  9488. strarray.Add("姓名/性别/年龄");
  9489. #else
  9490. strarray.Add("客人姓名");
  9491. #endif
  9492. strarray.Add("电话");
  9493. strarray.Add("单号");
  9494. strarray.Add("套系");
  9495. strarray.Add("");
  9496. strarray.Add("余款/加挑");
  9497. strarray.Add("看设计/日期");
  9498. #ifdef CHILD_VERSION
  9499. if (m_birthday.IsEmpty())
  9500. strarray.Add(name + "/" + m_sex);
  9501. else
  9502. {
  9503. int year = atoi(g_date.Left(4)) - atoi(m_birthday.Left(4));
  9504. m_birthday.Format("%d", year + 1);
  9505. strarray.Add(name + "/" + m_sex + "/" + m_birthday);
  9506. }
  9507. #else
  9508. strarray.Add(name);
  9509. #endif
  9510. strarray.Add(phone);
  9511. strarray.Add(strOrderNumber);
  9512. strarray.Add(m_taoxiname);
  9513. str.Format("应选:%d,加挑:%d", atoi(m_taoxizs), atoi(m_choosezs));
  9514. strarray.Add("");
  9515. str.Format("%d/%d", atoi(m_sum3), atoi(m_money3));
  9516. strarray.Add(str);
  9517. strarray.Add(m_waiter8 + "/" + m_time6);
  9518. //////////////////////////////////////////////
  9519. if (1)
  9520. {
  9521. StrRect = load.m_rcarray.ElementAt(6);
  9522. int addwid = StrRect.Width() / 6;
  9523. for (i = 3; i <= 6; i++)
  9524. {
  9525. StrRect = load.m_rcarray.ElementAt(i - 1);
  9526. StrRect.left += (i - 3)*addwid;
  9527. StrRect.right += (i - 2)*addwid;
  9528. load.m_rcarray.SetAt(i - 1, StrRect);
  9529. }
  9530. StrRect.left = StrRect.right = -1;
  9531. load.m_rcarray.SetAt(6, StrRect);
  9532. for (i = 10; i <= 13; i++)
  9533. {
  9534. StrRect = load.m_rcarray.ElementAt(i - 1);
  9535. StrRect.left += (i - 10)*addwid;
  9536. StrRect.right += (i - 9)*addwid;
  9537. load.m_rcarray.SetAt(i - 1, StrRect);
  9538. }
  9539. StrRect.left = StrRect.right = -1;
  9540. load.m_rcarray.SetAt(13, StrRect);
  9541. StrRect = load.m_rcarray.ElementAt(7);
  9542. int rcwid = StrRect.Width();
  9543. StrRect.left = load.m_rcarray.ElementAt(5).right;
  9544. StrRect.right = StrRect.left + rcwid + addwid;
  9545. load.m_rcarray.SetAt(7, StrRect);
  9546. StrRect = load.m_rcarray.ElementAt(8);
  9547. StrRect.left = load.m_rcarray.ElementAt(7).right;
  9548. StrRect.right = load.m_rcarray.ElementAt(29).left;
  9549. load.m_rcarray.SetAt(8, StrRect);
  9550. StrRect = load.m_rcarray.ElementAt(14);
  9551. rcwid = StrRect.Width();
  9552. StrRect.left = load.m_rcarray.ElementAt(12).right;
  9553. StrRect.right = StrRect.left + rcwid + addwid;
  9554. load.m_rcarray.SetAt(14, StrRect);
  9555. StrRect = load.m_rcarray.ElementAt(15);
  9556. StrRect.left = load.m_rcarray.ElementAt(14).right;
  9557. StrRect.right = load.m_rcarray.ElementAt(29).left;
  9558. load.m_rcarray.SetAt(15, StrRect);
  9559. }
  9560. ////////////////////////////////////////////////
  9561. for (i = 3; i <= 16; i++)
  9562. {
  9563. StrRect = load.m_rcarray.ElementAt(i - 1);
  9564. if (i < 10)
  9565. {
  9566. m_Print.DrawRect2(StrRect, 1);
  9567. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 3), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9568. }
  9569. }
  9570. StrRect = load.m_rcarray.ElementAt(29);
  9571. m_Print.DrawRect2(StrRect, 1);
  9572. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9573. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(138)))
  9574. {
  9575. Image *pImg = NULL;
  9576. g_nSendCode = 31;
  9577. int g_nYearposTemp = g_nYearpos;
  9578. g_nYearpos = -1;
  9579. g_pMainWnd->ProcessChatMessageRequest2(1);
  9580. g_nYearpos = g_nYearposTemp;
  9581. g_nSendCode = 0;
  9582. if (g_bSendOK == 0)return;
  9583. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  9584. if (pImg)
  9585. {
  9586. StrRect.left = 485;
  9587. StrRect.top = 12;
  9588. StrRect.right = StrRect.left + 60;
  9589. StrRect.bottom = StrRect.top + 60;
  9590. m_Print.DrawImage(pImg, StrRect);
  9591. delete pImg; pImg = NULL;
  9592. }
  9593. }
  9594. CArray<CRect, CRect>rcarray;
  9595. CStringArray strarray2;
  9596. for (i = 10; i <= 16; i++)
  9597. {
  9598. StrRect = load.m_rcarray.ElementAt(i - 1);
  9599. StrRect.left += 2;
  9600. StrRect.right -= 2;
  9601. StrRect.top += 2;
  9602. rcarray.Add(StrRect);
  9603. strarray2.Add(strarray.ElementAt(7 + i - 10));
  9604. }
  9605. int bottom = CalHeight(&rcarray, &strarray2, &m_Print, FORMAT_HCENTER);
  9606. for (i = 10; i <= 16; i++)
  9607. {
  9608. StrRect = load.m_rcarray.ElementAt(i - 1);
  9609. if (i == 10)
  9610. {
  9611. dty += bottom - StrRect.bottom;
  9612. }
  9613. StrRect.bottom = bottom;
  9614. m_Print.DrawRect2(StrRect, 1);
  9615. }
  9616. StrRect = load.m_rcarray.ElementAt(30); StrRect.bottom = bottom;
  9617. m_Print.DrawRect2(StrRect, 1); StrRect.top += 2;
  9618. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time5, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  9619. m_Print.SetFontFace(15, 1, "宋体");
  9620. StrRect = load.m_rcarray.ElementAt(16); StrRect.top += dty; StrRect.bottom += dty;
  9621. m_Print.DrawText((LPTSTR)(LPCTSTR)"指定制作", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9622. m_Print.SetFontFace(9, 1, "宋体");
  9623. strarray.RemoveAll();
  9624. strarray.Add("产品名称");
  9625. strarray.Add("数量");
  9626. strarray.Add("照片编号");
  9627. CArray<CRect, CRect>rc2array;
  9628. for (i = 18; i <= 20; i++)
  9629. {
  9630. StrRect = load.m_rcarray.ElementAt(i - 1); StrRect.top += dty; StrRect.bottom += dty;
  9631. m_Print.DrawRect2(StrRect, 1);
  9632. StrRect.left += 2;
  9633. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 18), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9634. StrRect.left -= 2;
  9635. StrRect.top = StrRect.bottom;
  9636. StrRect.bottom += 18;
  9637. rc2array.Add(StrRect);
  9638. }
  9639. int curypos = 0;
  9640. for (i = 0; i < sparray2.GetSize(); i += 3)
  9641. {
  9642. rcarray.RemoveAll();
  9643. strarray2.RemoveAll();
  9644. int j = 0;
  9645. for ( j = 0; j < 3; j++)
  9646. {
  9647. StrRect = rc2array.ElementAt(j);
  9648. StrRect.left += 2;
  9649. StrRect.right -= 2;
  9650. StrRect.top += 2;
  9651. rcarray.Add(StrRect);
  9652. #if JEFF_TEST_ON
  9653. if (2 == j)
  9654. {
  9655. CString strImg = sparray2.ElementAt(i + 2);
  9656. int nImgCount = strImg.Replace(",", ",");
  9657. if (nImgCount != 0)
  9658. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), nImgCount + 1);
  9659. else if (!strImg.IsEmpty())
  9660. strImg.Format("%s; 共 %d 张", sparray2.ElementAt(i + 2), 1);
  9661. strarray2.Add(strImg);
  9662. }
  9663. else
  9664. strarray2.Add(sparray2.ElementAt(i + j));
  9665. #else
  9666. strarray2.Add(sparray2.ElementAt(i + j));
  9667. #endif
  9668. }
  9669. int bottom = CalHeight(&rcarray, &strarray2, &m_Print, FORMAT_LEFT);
  9670. rcarray.RemoveAll();
  9671. for (j = 0; j < 3; j++)
  9672. {
  9673. StrRect = rc2array.ElementAt(j);
  9674. if (j == 0)
  9675. {
  9676. dty += bottom - StrRect.bottom;
  9677. }
  9678. StrRect.bottom = bottom;
  9679. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  9680. StrRect.top = StrRect.bottom;
  9681. StrRect.bottom += 18;
  9682. rcarray.Add(StrRect);
  9683. }
  9684. rc2array.RemoveAll();
  9685. rc2array.Copy(rcarray);
  9686. }
  9687. m_Print.SetFontFace(15, 1, "宋体");
  9688. StrRect = load.m_rcarray.ElementAt(20);
  9689. dty = curypos - StrRect.bottom + 35;
  9690. StrRect.top += dty; StrRect.bottom += dty;
  9691. m_Print.DrawText((LPTSTR)(LPCTSTR)"调修要求", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9692. m_Print.SetFontFace(9, 1, "宋体");
  9693. rcarray.RemoveAll();
  9694. strarray2.RemoveAll();
  9695. StrRect = load.m_rcarray.ElementAt(21);
  9696. StrRect.top += dty;
  9697. StrRect.bottom += dty;
  9698. StrRect.left += 2;
  9699. StrRect.right -= 2;
  9700. StrRect.top += 2;
  9701. rcarray.Add(StrRect);
  9702. #if JEFF_TEST_ON
  9703. // 17=客人备注bz3; 29=bz4单张相片备注,以空格分隔; 23=bz;
  9704. strarray2.RemoveAll();
  9705. CString strFind = "要求:";
  9706. CString strbz3 = g_List1array.ElementAt(0).ElementAt(17);
  9707. do
  9708. {
  9709. int nIndex = strbz3.Find(strFind, 1);
  9710. if (nIndex != -1)
  9711. {
  9712. CString strbz = strbz3.Left(nIndex);
  9713. strbz3 = strbz3.Mid(nIndex);
  9714. strarray2.Add(strbz);
  9715. }
  9716. else
  9717. {
  9718. strarray2.Add(strbz3);
  9719. strbz3 = "";
  9720. }
  9721. } while (strbz3.Find(strFind) != -1);
  9722. strarray2.Add(g_List1array.ElementAt(0).ElementAt(25));
  9723. if (!m_replace.IsEmpty())
  9724. {
  9725. m_replace = "设计替换照片:" + m_replace;
  9726. m_replace.Replace("$", ";");
  9727. m_replace.TrimLeft(";");
  9728. }
  9729. strarray2.Add(m_replace);
  9730. bottom = CalHeight_01(StrRect, &strarray2, &m_Print, FORMAT_LEFT);
  9731. #else
  9732. strarray2.Add(m_bz);
  9733. bottom = CalHeight(&rcarray, &strarray2, &m_Print, FORMAT_LEFT);
  9734. #endif
  9735. StrRect = load.m_rcarray.ElementAt(21); StrRect.top += dty; StrRect.bottom += dty;
  9736. dty += bottom - StrRect.bottom;
  9737. StrRect.bottom = bottom;
  9738. m_Print.DrawRect2(StrRect, 1); curypos = StrRect.bottom;
  9739. m_Print.SetFontFace(10, 1, "宋体");
  9740. StrRect = load.m_rcarray.ElementAt(22);
  9741. dty = curypos - StrRect.bottom + 25;
  9742. StrRect.top += dty; StrRect.bottom += dty;
  9743. CString m_edit9 = (g_cominfoarray.ElementAt(0).ElementAt(135));
  9744. if (m_edit9.IsEmpty())
  9745. {
  9746. m_edit9 = "\
  9747. 经确认后的照片均排入制作流程,\r\n\
  9748. 恕不接受更改及退费。实际冲晒出来的相片\r\n\
  9749. 与电脑显示会有少许差异,如颜色较深或亮度偏暗等。";
  9750. }
  9751. CString info1, info2, info3;
  9752. int newlinepos = m_edit9.Find("\r\n");
  9753. if (newlinepos != -1)
  9754. {
  9755. info1 = m_edit9.Left(newlinepos);
  9756. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9757. }
  9758. newlinepos = m_edit9.Find("\r\n");
  9759. if (newlinepos != -1)
  9760. {
  9761. info2 = m_edit9.Left(newlinepos);
  9762. m_edit9 = m_edit9.Right(m_edit9.GetLength() - newlinepos - 2);
  9763. info3 = m_edit9;
  9764. }
  9765. if (1)
  9766. {
  9767. m_Print.DrawText((LPTSTR)(LPCTSTR)info1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9768. StrRect = load.m_rcarray.ElementAt(23);
  9769. StrRect.top += dty; StrRect.bottom += dty;
  9770. m_Print.DrawText((LPTSTR)(LPCTSTR)info2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9771. StrRect = load.m_rcarray.ElementAt(24);
  9772. StrRect.top += dty; StrRect.bottom += dty;
  9773. m_Print.DrawText((LPTSTR)(LPCTSTR)info3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9774. }
  9775. else
  9776. {
  9777. m_Print.DrawText((LPTSTR)(LPCTSTR)"经确认后的照片均排入制作流程,", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9778. StrRect = load.m_rcarray.ElementAt(23);
  9779. StrRect.top += dty; StrRect.bottom += dty;
  9780. m_Print.DrawText((LPTSTR)(LPCTSTR)"恕不接受更改及退费。实际冲晒出来的相片", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9781. StrRect = load.m_rcarray.ElementAt(24);
  9782. StrRect.top += dty; StrRect.bottom += dty;
  9783. m_Print.DrawText((LPTSTR)(LPCTSTR)"与电脑显示会有少许差异,如颜色较深或亮度偏暗等。", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9784. }
  9785. StrRect = load.m_rcarray.ElementAt(25);
  9786. StrRect.top += dty; StrRect.bottom += dty;
  9787. m_Print.DrawText((LPTSTR)(LPCTSTR)"贵宾签名:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9788. StrRect = load.m_rcarray.ElementAt(26);
  9789. StrRect.top += dty; StrRect.bottom += dty;
  9790. m_Print.DrawRect2(StrRect, 2);
  9791. m_Print.SetFontFace(9, 1, "宋体");
  9792. StrRect = load.m_rcarray.ElementAt(27);
  9793. StrRect.top += dty; StrRect.bottom += dty;
  9794. m_Print.DrawText((LPTSTR)(LPCTSTR)("地址:" + g_cominfoarray.ElementAt(0).ElementAt(12)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9795. StrRect = load.m_rcarray.ElementAt(28);
  9796. StrRect.top += dty; StrRect.bottom += dty;
  9797. m_Print.DrawText((LPTSTR)(LPCTSTR)("电话:" + g_cominfoarray.ElementAt(0).ElementAt(11)), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  9798. PrintPreview dlg;//dlg.m_mode=2;
  9799. dlg.m_name = name;
  9800. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  9801. dlg.m_pDC = m_Print.GetPDC();
  9802. if (aa == 0)
  9803. {
  9804. if (dlg.DoModal() != IDOK)
  9805. return;
  9806. printcot = dlg.m_num;
  9807. }
  9808. //结束打印
  9809. m_Print.EndPage();
  9810. m_Print.EndPrint();
  9811. }
  9812. }
  9813. /*
  9814. void CMainFrame::PrintFlowChart(CString m_id)
  9815. {
  9816. CPrintRX m_Print;
  9817. m_Print.InitToPrint(NULL, 1);
  9818. m_Print.StartPrint();
  9819. m_Print.StartPage();
  9820. // CRect StrRect(0,0,560,818);
  9821. LoadRect load;
  9822. load.SetLiaPath ("4.lia");
  9823. load.SetMargins(-14,-14);
  9824. if(!load.Load ())return;
  9825. LoadRect load2;
  9826. load2.SetMargins(-14,472+27-14);
  9827. load2.SetLiaPath ("5.lia");
  9828. if(!load2.Load ())return;
  9829. //////////////////////////////////////////////////////////////
  9830. CString filter="id='"+m_id+"';id='"+m_id+"'";
  9831. g_sendhead.code[0]=54;
  9832. g_sendhead.code[1]=50;
  9833. g_sendhead.tabcount=2;
  9834. g_sendhead.bsql=0;
  9835. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  9836. CArray<CStringArray, CStringArray>sparray;
  9837. DataToArray(&g_List1array,&sparray);
  9838. CString spno;
  9839. for(int i=0; i<sparray.GetSize (); i++)
  9840. {
  9841. if(sparray.ElementAt (i).ElementAt (4)=="4" && sparray.ElementAt (i).ElementAt (5)!="入册")continue;
  9842. if(sparray.ElementAt (i).ElementAt (5)=="入册"&&sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  9843. spno+=sparray.ElementAt (i).ElementAt (5);
  9844. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  9845. spno+=";";
  9846. else
  9847. {
  9848. spno+=":";
  9849. spno+=sparray.ElementAt (i).ElementAt (6);
  9850. spno+=";";
  9851. }
  9852. }
  9853. spno+=" 加挑:";
  9854. for( i=0; i<sparray.GetSize (); i++)
  9855. {
  9856. if(sparray.ElementAt (i).ElementAt (4)!="4")continue;
  9857. if(sparray.ElementAt (i).ElementAt (5)=="入册")continue;
  9858. spno+=sparray.ElementAt (i).ElementAt (5);
  9859. if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())
  9860. spno+=";";
  9861. else
  9862. {
  9863. spno+=":";
  9864. spno+=sparray.ElementAt (i).ElementAt (6);
  9865. spno+=";";
  9866. }
  9867. }
  9868. if(spno.Right (6)==" 加挑:")
  9869. {
  9870. spno=spno.Left (spno.GetLength ()-6);
  9871. }
  9872. CString m_name1 = g_List1array.ElementAt (0).ElementAt (1);
  9873. CString m_name2 = g_List1array.ElementAt (0).ElementAt (2);
  9874. CString m_phone1=g_List1array.ElementAt (0).ElementAt (3);
  9875. CString m_phone2=g_List1array.ElementAt (0).ElementAt (4);
  9876. CString m_urgent=g_List1array.ElementAt (0).ElementAt (5);
  9877. if(m_urgent.IsEmpty ())m_urgent="否";
  9878. CString m_time2 = g_List1array.ElementAt (0).ElementAt (6);
  9879. CString m_time4 = g_List1array.ElementAt (0).ElementAt (7);
  9880. CString m_time5 = g_List1array.ElementAt (0).ElementAt (8);
  9881. CString m_takezs = g_List1array.ElementAt (0).ElementAt (9);
  9882. CString m_taoxizs = g_List1array.ElementAt (0).ElementAt (10);
  9883. CString m_choosezs = g_List1array.ElementAt (0).ElementAt (11);
  9884. CString m_ren = g_List1array.ElementAt (0).ElementAt (12);
  9885. CString m_waiter3 = g_List1array.ElementAt (0).ElementAt (13);
  9886. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (14);
  9887. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (15);
  9888. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (16);
  9889. CString m_bz = "客人要求: "+g_List1array.ElementAt (0).ElementAt (17);
  9890. CString m_money3 = g_List1array.ElementAt (0).ElementAt (18);
  9891. CString m_money1 = g_List1array.ElementAt (0).ElementAt (19);
  9892. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (20);
  9893. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (21);
  9894. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (22);
  9895. CString m_sum3;
  9896. m_sum3.Format ("%0.2f", atof(m_taoxijiage)+atof(m_payed4)-(atof(m_payed5)+atof(m_money1)));
  9897. ::ConvertToPrice (m_sum3);
  9898. if(m_money3.IsEmpty ())m_money3="0";
  9899. // m_money3=m_money3+"/"+m_sum3;
  9900. CString name;
  9901. if(!m_name1.IsEmpty ())
  9902. name=m_name1+",";
  9903. name+=m_name2;
  9904. name.TrimRight (",");
  9905. CString phone;
  9906. if(!m_phone1.IsEmpty ())
  9907. phone=m_phone1+",";
  9908. phone+=m_phone2;phone.TrimRight (",");
  9909. CStringArray strarray;
  9910. strarray.Add (m_urgent);
  9911. strarray.Add (m_ren);
  9912. strarray.Add (m_waiter3);
  9913. strarray.Add (name);
  9914. strarray.Add (m_time2);
  9915. strarray.Add (m_time4);
  9916. strarray.Add (m_time5);
  9917. strarray.Add (m_money3);
  9918. strarray.Add (m_takezs);
  9919. strarray.Add (m_taoxizs);
  9920. strarray.Add (m_choosezs);
  9921. strarray.Add (m_id);
  9922. strarray.Add (phone);
  9923. ////////////////////////////////////////////////////////////////
  9924. int rcpos=-1;
  9925. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  9926. Image *pImg=NULL;
  9927. #ifdef MNLS_VERSION
  9928. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG") );
  9929. #else
  9930. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo.jpg");
  9931. #endif
  9932. m_Print.DrawImage(pImg, StrRect);
  9933. delete pImg;
  9934. m_Print.SetFontFace(15, 1, "宋体");
  9935. StrRect=load.m_rcarray .ElementAt (++rcpos);
  9936. #ifdef MNLS_VERSION
  9937. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9938. #endif
  9939. StrRect=load.m_rcarray .ElementAt (++rcpos);
  9940. #ifdef MNLS_VERSION
  9941. m_Print.DrawRect(StrRect);
  9942. #endif
  9943. m_Print.SetFontFace(7, 1, "黑体");
  9944. m_Print.SetColor(0xffffff);
  9945. #ifdef MNLS_VERSION
  9946. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9947. #endif
  9948. m_Print.SetColor(0);
  9949. m_Print.SetFontFace(25, 1, "黑体");
  9950. StrRect=load.m_rcarray .ElementAt (++rcpos);
  9951. m_Print.DrawText((LPTSTR)(LPCTSTR)"数码制作一览表", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9952. CString title[13]={"是否加急:","接单门市:","选样人员:","新郎新娘姓名:","拍照日期:","选片日期:","取件日期:","加挑/余款:","拍摄总张数:","应挑选张数:","额外加挑张数:","票号:","客户联系电话:"};
  9953. m_Print.SetFontFace(12, 1, "宋体");
  9954. for( i=0; i<13; i++)
  9955. {
  9956. StrRect=load.m_rcarray .ElementAt (++rcpos);
  9957. if(i<3)
  9958. m_Print.DrawRect2(StrRect, 0);
  9959. else
  9960. m_Print.DrawRect2(StrRect, 1);
  9961. m_Print.DrawText((LPTSTR)(LPCTSTR)title[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9962. }
  9963. for( i=18; i<=37; i++)
  9964. {
  9965. StrRect=load.m_rcarray .ElementAt (++rcpos);
  9966. if(i>=19&&i<=21)
  9967. m_Print.DrawRect2(StrRect, 2);
  9968. else if(i==26)
  9969. {
  9970. CRect rc=StrRect;
  9971. CRect rc2=rc;
  9972. rc.right -=rc2.Width ()/2;
  9973. m_Print.DrawRect2(rc, 1);
  9974. rc2.left +=rc.Width ();
  9975. m_Print.DrawRect2(rc2, 1);
  9976. }
  9977. else
  9978. m_Print.DrawRect2(StrRect, 1);
  9979. if(i==18)
  9980. {
  9981. StrRect.left +=5;
  9982. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  9983. }
  9984. }
  9985. //////////////////////////////////////
  9986. rcpos=-1;
  9987. for( i=0; i<8; i++)
  9988. {
  9989. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  9990. m_Print.DrawRect2(StrRect, 1);
  9991. }
  9992. CString title2[4]={"化妆师:","摄影师:","数码设计师:","顾客签名:"};
  9993. for( i=0; i<4; i++)
  9994. {
  9995. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  9996. m_Print.DrawText((LPTSTR)(LPCTSTR)title2[i], StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  9997. }
  9998. for( i=0; i<4; i++)
  9999. {
  10000. StrRect=load2.m_rcarray .ElementAt (++rcpos);
  10001. m_Print.DrawRect2(StrRect, 2);
  10002. }
  10003. ///////////////////////////////////////////
  10004. for( i=19; i<=31; i++)
  10005. {
  10006. StrRect=load.m_rcarray .ElementAt (i-1);
  10007. StrRect.left +=4;
  10008. if(i==31)
  10009. {
  10010. if(m_phone1.IsEmpty ()==0 && m_phone2.IsEmpty ()==0)
  10011. {
  10012. StrRect.top +=2;
  10013. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  10014. StrRect.top +=8;
  10015. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10016. }
  10017. else
  10018. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10019. }
  10020. else if((i-19)==7)
  10021. {
  10022. CRect rc=StrRect;
  10023. CRect rc2=rc;
  10024. rc.right -=rc2.Width ()/2;
  10025. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), rc, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10026. rc2.left +=rc.Width ()+3;
  10027. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sum3, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10028. }
  10029. else
  10030. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-19), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10031. }
  10032. strarray.RemoveAll ();
  10033. strarray.Add (m_waiter2);
  10034. strarray.Add (m_waiter1);
  10035. strarray.Add (m_waiter4);
  10036. for( i=13; i<=15; i++)
  10037. {
  10038. StrRect=load2.m_rcarray .ElementAt (i-1);
  10039. StrRect.left +=4;
  10040. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-13), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10041. }
  10042. ///////////spno
  10043. CRect sprc[14];
  10044. for(i=0; i<14; i++)
  10045. {
  10046. if(i<7)
  10047. {
  10048. if(i==0)
  10049. {
  10050. StrRect=load.m_rcarray .ElementAt (17);StrRect.left +=94;StrRect.right -=3;
  10051. }
  10052. else
  10053. {
  10054. StrRect=load.m_rcarray .ElementAt (30+i);StrRect.left +=4;StrRect.right -=3;
  10055. }
  10056. }
  10057. else
  10058. {
  10059. StrRect=load2.m_rcarray .ElementAt (i-7);StrRect.left +=4;StrRect.right -=3;
  10060. }
  10061. sprc[i]=StrRect;
  10062. // m_Print.DrawText((LPTSTR)(LPCTSTR)"xxx", sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10063. }
  10064. CString temp,tempspno,tempbz;
  10065. CSize size;
  10066. BOOL bRun=0;
  10067. int fontsize=12;
  10068. ll: tempspno=spno;
  10069. tempbz=m_bz;
  10070. m_Print.SetFontFace(fontsize, 1, "宋体");
  10071. for( i=0; i<14; i++)
  10072. {
  10073. if(!tempspno.IsEmpty ())
  10074. {
  10075. temp=tempspno;
  10076. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10077. int right=0;
  10078. CRect temprc=sprc[i];
  10079. while(size.cx>temprc.Width ())
  10080. {
  10081. right++;
  10082. temp=tempspno.Left (tempspno.GetLength ()-(right));
  10083. if(GIsHalfHZ(temp))
  10084. {
  10085. right++;
  10086. temp.Delete (temp.GetLength ()-1);
  10087. }
  10088. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10089. }
  10090. if(bRun)
  10091. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10092. tempspno=tempspno.Right (tempspno.GetLength ()-temp.GetLength ());
  10093. if(tempspno.IsEmpty ())i++;
  10094. }
  10095. else if(!tempbz.IsEmpty ())
  10096. {
  10097. temp=tempbz;
  10098. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10099. int right=0;
  10100. CRect temprc=sprc[i];
  10101. while(size.cx>temprc.Width ())
  10102. {
  10103. right++;
  10104. temp=tempbz.Left (tempbz.GetLength ()-(right));
  10105. if(GIsHalfHZ(temp))
  10106. {
  10107. right++;
  10108. temp.Delete (temp.GetLength ()-1);
  10109. }
  10110. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  10111. }
  10112. if(bRun)
  10113. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  10114. tempbz=tempbz.Right (tempbz.GetLength ()-temp.GetLength ());
  10115. }
  10116. }
  10117. if(tempspno.IsEmpty ()==0 || tempbz.IsEmpty ()==0)
  10118. {
  10119. fontsize--;
  10120. goto ll;
  10121. }
  10122. if(bRun==0)
  10123. {
  10124. bRun=1;
  10125. goto ll;
  10126. }
  10127. PrintPreview dlg;
  10128. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  10129. dlg.m_pDC =m_Print.GetPDC() ;
  10130. if(dlg.DoModal ()!=IDOK)return;
  10131. //结束打印
  10132. m_Print.EndPage();
  10133. m_Print.EndPrint();
  10134. }
  10135. void CMainFrame::SetSelFolder(int pos)
  10136. {
  10137. m_wndToolBar2.SetSelFolder(pos);
  10138. }*/
  10139. void CMainFrame::ToPhotoPrint()
  10140. {
  10141. UINT nID = 1;
  10142. LPSTR pName;
  10143. pName = (LPSTR)(LPCSTR)"相片冲印资料";
  10144. OPEN_MENU(PhotoPrintFrom);
  10145. }
  10146. void CMainFrame::GetOcx()
  10147. {
  10148. char path[MAX_PATH];
  10149. ::GetSystemDirectory(path, MAX_PATH);
  10150. CString syspath = path;
  10151. try
  10152. {
  10153. if (!::PathFileExists(syspath + "\\MSCHRT20.OCX"))
  10154. {
  10155. g_sendhead.bsql = 0;
  10156. g_sendhead.code[0] = 103;
  10157. g_sendhead.tabcount = 1;
  10158. g_pMainWnd->ProcessChatMessageRequest2(1); if (g_bSendOK == 0)return;
  10159. CFile fp;
  10160. if (fp.Open(syspath + "\\MSCHRT20.OCX", CFile::modeWrite | CFile::modeCreate))
  10161. {
  10162. fp.Write(g_pData, g_nLeng);
  10163. fp.Close();
  10164. ::Sleep(1000);
  10165. }
  10166. }
  10167. CString temp;
  10168. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10169. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10170. }
  10171. catch (...)
  10172. {
  10173. }
  10174. try
  10175. {
  10176. CString temp;
  10177. temp.Format(_T(" -s %s\\MSCHRT20.OCX"), syspath);
  10178. ShellExecute(NULL, _T("Open"), _T("Regsvr32"), temp, NULL, SW_HIDE);
  10179. }
  10180. catch (...)
  10181. {
  10182. }
  10183. }
  10184. void CMainFrame::OnServer()
  10185. {
  10186. // TODO: Add your command handler code here
  10187. DBConfig dlg;
  10188. dlg.DoModal();
  10189. }
  10190. void CMainFrame::OnPath()
  10191. {
  10192. // TODO: Add your command handler code here
  10193. if (g_user.bLongin == 0)
  10194. {
  10195. if (g_bNoLoginLia)
  10196. {
  10197. Login dlg;
  10198. dlg.SetLiaPath("5.lia");
  10199. dlg.DoModal();
  10200. }
  10201. else
  10202. {
  10203. Login3 dlg;
  10204. dlg.SetLiaPath("5.lia");
  10205. dlg.DoModal();
  10206. }
  10207. if (g_user.bLongin == 0)return;
  10208. }
  10209. if (IsHasRightsnew(49) == 0)return;
  10210. SetPathDlg2 dlg;
  10211. dlg.DoModal();
  10212. }
  10213. void CMainFrame::OnShowhis()
  10214. {
  10215. // TODO: Add your command handler code here
  10216. if (g_user.bLongin == 0)
  10217. {
  10218. if (g_bNoLoginLia)
  10219. {
  10220. Login dlg;
  10221. dlg.SetLiaPath("5.lia");
  10222. dlg.DoModal();
  10223. }
  10224. else
  10225. {
  10226. Login3 dlg;
  10227. dlg.SetLiaPath("5.lia");
  10228. dlg.DoModal();
  10229. }
  10230. if (g_user.bLongin == 0)return;
  10231. }
  10232. if (IsHasRightsnew(52) == 0)return;
  10233. CMenu *pMenu = GetMenu();
  10234. CMenu* submenu = pMenu->GetSubMenu(2);
  10235. UINT status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10236. if (status&MF_CHECKED)
  10237. {
  10238. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_UNCHECKED);
  10239. g_bShowOK = 1;
  10240. }
  10241. else
  10242. {
  10243. submenu->CheckMenuItem(IDM_SHOWHIS, MF_BYCOMMAND | MF_CHECKED);
  10244. g_bShowOK = 0;
  10245. } m_Mdi.CloseAll();
  10246. }
  10247. void CMainFrame::AddHistoryMenu(CArray<CStringArray, CStringArray>*hisyeararray)
  10248. {
  10249. #ifdef NEW_SKIN
  10250. CMenu *m_menuXP = GetMenu();
  10251. CMenu* submenu = m_menuXP->GetSubMenu(2);
  10252. int i = 0;
  10253. for ( i = 0; i < 100; i++)
  10254. {
  10255. submenu->DeleteMenu(1000 + i, MF_BYCOMMAND);
  10256. }
  10257. for (i = 0; i < hisyeararray->GetSize(); i++)
  10258. {
  10259. submenu->AppendMenu(MF_STRING, 1000 + i, "查看历史数据:" + hisyeararray->ElementAt(i).ElementAt(0)); // 第一项菜单项
  10260. }
  10261. g_nYearpos = -1;
  10262. #else
  10263. HMENU hMenu = ::GetMenu(m_hWnd);
  10264. m_menuXP.Attach(hMenu);
  10265. BCMenu* submenu = (BCMenu*)m_menuXP.GetSubMenu(2);
  10266. for (int i = 0; i < 100; i++)
  10267. {
  10268. submenu->DeleteMenu (1000+i, MF_BYCOMMAND);
  10269. }
  10270. for( i=0; i<hisyeararray->GetSize (); i++)
  10271. {
  10272. submenu->AppendMenu(MF_STRING, 1000+i, "查看历史数据:"+hisyeararray->ElementAt (i).ElementAt (0)); // 第一项菜单项
  10273. }
  10274. m_menuXP.Detach ();
  10275. g_nYearpos = -1;
  10276. #endif
  10277. }
  10278. /************************************************************************/
  10279. /*
  10280. Jeff
  10281. 函数:AddBranchMenu()
  10282. 参数:CArray<CStringArray, CStringArray> *hisyeararray
  10283. 返回:void
  10284. 注意:
  10285. 调用关系:
  10286. */
  10287. /************************************************************************/
  10288. void CMainFrame::AddBranchMenu(CArray<CStringArray, CStringArray>*hisyeararray)
  10289. {
  10290. //WriteClientLog("AddBranchMenu,添加集团版菜单");
  10291. #ifdef ENTERPRISE_VERSION
  10292. CMenu *m_menuXP = GetMenu();
  10293. CMenu* submenu = m_menuXP->GetSubMenu(0);
  10294. for (int i = 0; i < 100; i++)
  10295. {
  10296. submenu->DeleteMenu(2000 + i, MF_BYCOMMAND);
  10297. }
  10298. g_menubranchname.RemoveAll();
  10299. CString name;
  10300. int a = 0;
  10301. #if 0 // Jeff.add for test
  10302. CString strCount;
  10303. strCount.Format("历史数据库个数=%d", hisyeararray->GetSize());
  10304. WriteClientLog(strCount);
  10305. #endif
  10306. for (i = 0; i < hisyeararray->GetSize() - 1; i++)
  10307. {
  10308. //WriteClientLog("111");
  10309. //WriteClientLog(hisyeararray->ElementAt(i).ElementAt(0));
  10310. //WriteClientLog(name);
  10311. if (name == "")
  10312. {
  10313. name = hisyeararray->ElementAt(i).ElementAt(0);
  10314. #ifndef SQLSERVER_VERSION
  10315. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10316. a++;
  10317. #endif
  10318. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10319. a++;
  10320. g_menubranchname.Add(name);
  10321. continue;
  10322. }
  10323. else if (hisyeararray->ElementAt(i).ElementAt(0).Find(name) != -1 && ((hisyeararray->ElementAt(i).ElementAt(0).GetLength() - name.GetLength()) == 4))
  10324. {
  10325. continue;
  10326. }
  10327. name = hisyeararray->ElementAt(i).ElementAt(0);
  10328. #ifndef SQLSERVER_VERSION
  10329. submenu->AppendMenu(MF_STRING, 2000 + a, "查看分店数据:" + name + "(使用本机缓存,速度快)");
  10330. a++;
  10331. #endif
  10332. submenu->AppendMenu(MF_STRING, 2000 + a, "操作分店数据:" + name + "(实时访问分店,需网络通畅)");
  10333. g_menubranchname.Add(name);
  10334. a++;
  10335. //WriteClientLog("222");
  10336. }
  10337. if ((hisyeararray->GetSize() - 1) > 0)
  10338. {
  10339. if (hisyeararray->ElementAt(0).ElementAt(3) == "总店")
  10340. submenu->AppendMenu(MF_STRING, 2000 + a, "多店数据汇总");
  10341. }
  10342. #endif
  10343. }
  10344. void CMainFrame::OnHistory(UINT nID)
  10345. {
  10346. CMenu *pMenu = GetMenu();
  10347. CMenu* submenu = pMenu->GetSubMenu(2);
  10348. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10349. if (g_user.bLongin == 0)
  10350. {
  10351. if (g_bNoLoginLia)
  10352. {
  10353. Login dlg;
  10354. dlg.SetLiaPath("5.lia");
  10355. dlg.DoModal();
  10356. }
  10357. else
  10358. {
  10359. Login3 dlg;
  10360. dlg.SetLiaPath("5.lia");
  10361. dlg.DoModal();
  10362. }
  10363. if (g_user.bLongin == 0)return;
  10364. }
  10365. if (IsHasRightsnew(52) == 0)return;
  10366. m_Mdi.CloseAll();
  10367. for (int i = 0; i < 100; i++)
  10368. {
  10369. submenu->CheckMenuItem(1000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10370. }
  10371. if (status&MF_CHECKED)
  10372. {
  10373. g_nYearpos = -1;
  10374. status = submenu->GetMenuState(IDM_SHOWHIS, MF_BYCOMMAND);
  10375. if (status&MF_CHECKED)
  10376. g_bShowOK = 0;
  10377. else
  10378. g_bShowOK = 1;
  10379. }
  10380. else
  10381. {
  10382. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10383. g_nYearpos = nID - 1000;
  10384. g_bShowOK = 1;
  10385. }
  10386. }
  10387. void CMainFrame::OnBranchData(UINT nID)
  10388. {
  10389. #ifdef ENTERPRISE_VERSION
  10390. #ifdef SQLSERVER_VERSION
  10391. OnBranchData2(nID);
  10392. return;
  10393. #endif
  10394. /* g_bAllBranch=0;
  10395. m_Mdi.CloseAll();
  10396. OnDisconnect();
  10397. CMenu *pMenu=GetMenu();
  10398. CMenu* submenu = pMenu->GetSubMenu(0);
  10399. UINT status=submenu->GetMenuState(nID, MF_BYCOMMAND );
  10400. for(int i=0; i<100; i++)
  10401. {
  10402. submenu-> CheckMenuItem(2000+i, MF_BYCOMMAND | MF_UNCHECKED);
  10403. }
  10404. if(status&MF_CHECKED)
  10405. {
  10406. g_branchname.Empty (); g_branchip.Empty (); g_bBranchModify=0;
  10407. g_user.bLongin=0;
  10408. if(g_bNoLoginLia)
  10409. {
  10410. Login dlg;
  10411. dlg.SetLiaPath ("5.lia");
  10412. dlg.DoModal();
  10413. }
  10414. else
  10415. {
  10416. Login3 dlg;
  10417. dlg.SetLiaPath ("5.lia");
  10418. dlg.DoModal();
  10419. }
  10420. g_pMainWnd2->RefreshOutlookBar();
  10421. g_pMainWnd2->DrawLogin();
  10422. g_path1=g_path1bak;
  10423. g_path2=g_path2bak;
  10424. g_path3=g_path3bak;
  10425. g_path4=g_path4bak;
  10426. g_path5=g_path5bak;
  10427. g_path6=g_path6bak;
  10428. g_path7=g_path7bak;
  10429. g_pMainWnd2->EnableBtns(1);
  10430. }
  10431. else
  10432. {
  10433. BOOL bNeedCheckRights=1;
  10434. if(g_user.bLongin && g_branchname=="")//无需登陆本店判断其访问分店权限
  10435. {
  10436. bNeedCheckRights=0;
  10437. }
  10438. #ifndef SQLSERVER_VERSION
  10439. if((g_menubranchname.GetSize ()*2)==nID-2000)//多店数据汇总
  10440. #else
  10441. if((g_menubranchname.GetSize ())==nID-2000)//多店数据汇总
  10442. #endif
  10443. {
  10444. g_branchname.Empty ();
  10445. g_branchip.Empty (); g_bBranchModify=0;
  10446. if(bNeedCheckRights)
  10447. {
  10448. g_user.bLongin=0;
  10449. if(g_user.bLongin==0)
  10450. {
  10451. if(g_bNoLoginLia)
  10452. {
  10453. Login dlg;
  10454. dlg.SetLiaPath ("5.lia");
  10455. dlg.DoModal();
  10456. }
  10457. else
  10458. {
  10459. Login3 dlg;
  10460. dlg.SetLiaPath ("5.lia");
  10461. dlg.DoModal();
  10462. }
  10463. if(g_user.bLongin==0)return;
  10464. }
  10465. }
  10466. if(IsHasRightsnew(28)==0)
  10467. {
  10468. return;
  10469. }
  10470. g_bAllBranch=1;g_pMainWnd2->ShowBar (0);
  10471. g_pMainWnd2->RefreshOutlookBar2();
  10472. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10473. g_branchname.Empty ();
  10474. g_branchip.Empty ();
  10475. g_bBranchModify=0;
  10476. g_pMainWnd2->DrawLogin();
  10477. g_pMainWnd2->EnableBtns(0);
  10478. g_path1=g_path1bak;
  10479. g_path2=g_path2bak;
  10480. g_path3=g_path3bak;
  10481. g_path4=g_path4bak;
  10482. g_path5=g_path5bak;
  10483. g_path6=g_path6bak;
  10484. g_path7=g_path7bak;
  10485. }
  10486. else
  10487. {
  10488. if(bNeedCheckRights)
  10489. {
  10490. g_branchname.Empty ();
  10491. g_branchip.Empty ();
  10492. g_bBranchModify=0;
  10493. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_UNCHECKED);
  10494. g_user.bLongin=0;
  10495. if(g_pMainWnd2)
  10496. {
  10497. g_pMainWnd2->DrawLogin();
  10498. g_pMainWnd2->ShowBar (0);
  10499. }
  10500. if(g_bNoLoginLia)
  10501. {
  10502. Login dlg;
  10503. dlg.SetLiaPath ("5.lia");
  10504. dlg.DoModal();
  10505. }
  10506. else
  10507. {
  10508. Login3 dlg;
  10509. dlg.SetLiaPath ("5.lia");
  10510. dlg.DoModal();
  10511. }
  10512. if(g_user.bLongin==0)return;
  10513. }
  10514. if(IsHasRightsnew(28)==0)
  10515. {
  10516. return;
  10517. }
  10518. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10519. #ifndef SQLSERVER_VERSION
  10520. if(nID%2==0)
  10521. g_branchname=g_menubranchname.ElementAt ((nID-2000)/2);
  10522. else
  10523. g_branchname=g_menubranchname.ElementAt ((nID-2001)/2);
  10524. #else
  10525. g_branchname=g_menubranchname.ElementAt (nID-2000);
  10526. #endif
  10527. g_branchip.Empty ();
  10528. CString domainname="";
  10529. for(int i=0; i<g_brancharray.GetSize (); i++)
  10530. {
  10531. if(g_branchname==g_brancharray.ElementAt (i).ElementAt (0))
  10532. {
  10533. g_branchip=g_brancharray.ElementAt (i).ElementAt (1);
  10534. g_branchip2=g_brancharray.ElementAt (i).ElementAt (4);
  10535. domainname=g_brancharray.ElementAt (i).ElementAt (2);
  10536. }
  10537. }
  10538. g_path1=g_path1bak;
  10539. g_path2=g_path2bak;
  10540. g_path3=g_path3bak;
  10541. g_path4=g_path4bak;
  10542. g_path5=g_path5bak;
  10543. g_path6=g_path6bak;
  10544. g_path7=g_path7bak;
  10545. if(domainname.IsEmpty ())
  10546. {
  10547. g_path1=g_path2=g_path3=g_path4=g_path5=g_path6=g_path7="xxx";
  10548. }
  10549. else
  10550. {
  10551. g_path1+="\\"+domainname;
  10552. g_path2+="\\"+domainname;
  10553. g_path3+="\\"+domainname;
  10554. g_path4+="\\"+domainname;
  10555. g_path5+="\\"+domainname;
  10556. g_path6+="\\"+domainname;
  10557. g_path7+="\\"+domainname;
  10558. }
  10559. if(nID%2==0)
  10560. {
  10561. g_bBranchModify=0;
  10562. }
  10563. else
  10564. {
  10565. g_bBranchModify=1;
  10566. }
  10567. CArray<CStringArray, CStringArray>yeararray;
  10568. for( i=0; i<g_brancharray.GetSize (); i++)
  10569. {
  10570. if(g_brancharray.ElementAt (i).ElementAt (0).Find (g_branchname)!=-1 && g_branchname!=g_brancharray.ElementAt (i).ElementAt (0))
  10571. {
  10572. int size=yeararray.GetSize ();
  10573. yeararray.SetSize(size+1,1);
  10574. CString str=g_brancharray.ElementAt (i).ElementAt (0);
  10575. str.Delete (0, g_branchname.GetLength ());
  10576. yeararray.ElementAt (size).Add (str);
  10577. }
  10578. }
  10579. AddHistoryMenu(&yeararray);
  10580. if(g_bBranchModify)OnDisconnect();
  10581. if(1)
  10582. {
  10583. g_user.bLongin=0;
  10584. g_user.name.Empty ();
  10585. g_user.rights.Empty ();
  10586. g_user.account.Empty ();
  10587. g_user.rights2="*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  10588. g_pMainWnd2->RefreshOutlookBar();
  10589. m_Mdi.CloseAll();
  10590. if(g_pMainWnd2)
  10591. {
  10592. g_pMainWnd2->DrawLogin();
  10593. g_pMainWnd2->ShowBar (0);
  10594. }
  10595. if(g_bNoLoginLia)
  10596. {
  10597. Login dlg;
  10598. dlg.SetLiaPath ("5.lia");
  10599. dlg.DoModal();
  10600. }
  10601. else
  10602. {
  10603. Login3 dlg;
  10604. dlg.SetLiaPath ("5.lia");
  10605. dlg.DoModal();
  10606. }
  10607. if(g_user.bLongin==0)return;
  10608. if(g_pMainWnd2)g_pMainWnd2->ShowBar (1);
  10609. }
  10610. g_pMainWnd2->DrawLogin();
  10611. g_pMainWnd2->EnableBtns(1);
  10612. }
  10613. g_nYearpos=-1;
  10614. }
  10615. */
  10616. #endif
  10617. }
  10618. void CMainFrame::OnBranchData2(UINT nID)
  10619. {
  10620. #ifdef ENTERPRISE_VERSION
  10621. g_bAllBranch = 0;
  10622. m_Mdi.CloseAll();
  10623. OnDisconnect();
  10624. CMenu *pMenu = GetMenu();
  10625. CMenu* submenu = pMenu->GetSubMenu(0);
  10626. UINT status = submenu->GetMenuState(nID, MF_BYCOMMAND);
  10627. for (int i = 0; i < 100; i++)
  10628. {
  10629. submenu->CheckMenuItem(2000 + i, MF_BYCOMMAND | MF_UNCHECKED);
  10630. }
  10631. if (status&MF_CHECKED)
  10632. {
  10633. g_branchname.Empty();
  10634. g_branchip.Empty();
  10635. g_bBranchModify = 0;
  10636. g_user.bLongin = 0;
  10637. if (g_bNoLoginLia)
  10638. {
  10639. Login dlg;
  10640. dlg.SetLiaPath("5.lia");
  10641. dlg.DoModal();
  10642. }
  10643. else
  10644. {
  10645. Login3 dlg;
  10646. dlg.SetLiaPath("5.lia");
  10647. dlg.DoModal();
  10648. }
  10649. g_pMainWnd2->RefreshOutlookBar();
  10650. g_pMainWnd2->DrawLogin();
  10651. g_path1 = g_path1bak;
  10652. g_path2 = g_path2bak;
  10653. g_path3 = g_path3bak;
  10654. g_path4 = g_path4bak;
  10655. g_path5 = g_path5bak;
  10656. g_path6 = g_path6bak;
  10657. g_path7 = g_path7bak;
  10658. g_pMainWnd2->EnableBtns(1);
  10659. }
  10660. else
  10661. {
  10662. BOOL bNeedCheckRights = 1;
  10663. if (g_user.bLongin && g_branchname == "")//无需登陆本店判断其访问分店权限
  10664. {
  10665. bNeedCheckRights = 0;
  10666. }
  10667. #ifndef SQLSERVER_VERSION
  10668. if ((g_menubranchname.GetSize() * 2) == nID - 2000)//多店数据汇总
  10669. #else
  10670. if ((g_menubranchname.GetSize()) == nID - 2000)//多店数据汇总
  10671. #endif
  10672. {
  10673. g_branchname.Empty();
  10674. g_branchip.Empty();
  10675. g_bBranchModify = 0;
  10676. if (bNeedCheckRights)
  10677. {
  10678. g_user.bLongin = 0;
  10679. if (g_user.bLongin == 0)
  10680. {
  10681. if (g_bNoLoginLia)
  10682. {
  10683. Login dlg;
  10684. dlg.SetLiaPath("5.lia");
  10685. dlg.DoModal();
  10686. }
  10687. else
  10688. {
  10689. Login3 dlg;
  10690. dlg.SetLiaPath("5.lia");
  10691. dlg.DoModal();
  10692. }
  10693. if (g_user.bLongin == 0)return;
  10694. }
  10695. }
  10696. if (IsHasRightsnew(28) == 0)
  10697. {
  10698. return;
  10699. }
  10700. g_bAllBranch = 1; g_pMainWnd2->ShowBar(0);
  10701. g_pMainWnd2->RefreshOutlookBar2();
  10702. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10703. g_branchname.Empty();
  10704. g_branchip.Empty();
  10705. g_bBranchModify = 0;
  10706. g_pMainWnd2->DrawLogin();
  10707. g_pMainWnd2->EnableBtns(0);
  10708. g_path1 = g_path1bak;
  10709. g_path2 = g_path2bak;
  10710. g_path3 = g_path3bak;
  10711. g_path4 = g_path4bak;
  10712. g_path5 = g_path5bak;
  10713. g_path6 = g_path6bak;
  10714. g_path7 = g_path7bak;
  10715. }
  10716. else
  10717. {
  10718. if (bNeedCheckRights)
  10719. {
  10720. g_branchname.Empty();
  10721. g_branchip.Empty();
  10722. g_bBranchModify = 0;
  10723. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_UNCHECKED);
  10724. g_user.bLongin = 0;
  10725. if (g_pMainWnd2)
  10726. {
  10727. g_pMainWnd2->DrawLogin();
  10728. g_pMainWnd2->ShowBar(0);
  10729. }
  10730. if (g_bNoLoginLia)
  10731. {
  10732. Login dlg;
  10733. dlg.SetLiaPath("5.lia");
  10734. dlg.DoModal();
  10735. }
  10736. else
  10737. {
  10738. Login3 dlg;
  10739. dlg.SetLiaPath("5.lia");
  10740. dlg.DoModal();
  10741. }
  10742. if (g_user.bLongin == 0)return;
  10743. }
  10744. if (IsHasRightsnew(28) == 0)
  10745. {
  10746. return;
  10747. }
  10748. submenu->CheckMenuItem(nID, MF_BYCOMMAND | MF_CHECKED);
  10749. #ifndef SQLSERVER_VERSION
  10750. if (nID % 2 == 0)
  10751. g_branchname = g_menubranchname.ElementAt((nID - 2000) / 2);
  10752. else
  10753. g_branchname = g_menubranchname.ElementAt((nID - 2001) / 2);
  10754. #else
  10755. g_branchname = g_menubranchname.ElementAt(nID - 2000);
  10756. #endif
  10757. g_branchip.Empty();
  10758. CString domainname = "";
  10759. for (int i = 0; i < g_brancharray.GetSize(); i++)
  10760. {
  10761. if (g_branchname == g_brancharray.ElementAt(i).ElementAt(0))
  10762. {
  10763. g_branchip = g_brancharray.ElementAt(i).ElementAt(1);
  10764. g_branchip2 = g_brancharray.ElementAt(i).ElementAt(4);
  10765. domainname = g_brancharray.ElementAt(i).ElementAt(2);
  10766. }
  10767. }
  10768. g_path1 = g_path1bak;
  10769. g_path2 = g_path2bak;
  10770. g_path3 = g_path3bak;
  10771. g_path4 = g_path4bak;
  10772. g_path5 = g_path5bak;
  10773. g_path6 = g_path6bak;
  10774. g_path7 = g_path7bak;
  10775. if (domainname.IsEmpty())
  10776. {
  10777. g_path1 = g_path2 = g_path3 = g_path4 = g_path5 = g_path6 = g_path7 = "xxx";
  10778. }
  10779. else
  10780. {
  10781. g_path1 += "\\" + domainname;
  10782. g_path2 += "\\" + domainname;
  10783. g_path3 += "\\" + domainname;
  10784. g_path4 += "\\" + domainname;
  10785. g_path5 += "\\" + domainname;
  10786. g_path6 += "\\" + domainname;
  10787. g_path7 += "\\" + domainname;
  10788. }
  10789. g_bBranchModify = 1;
  10790. /* CArray<CStringArray, CStringArray>yeararray;
  10791. for( i=0; i<g_brancharray.GetSize (); i++)
  10792. {
  10793. if(g_brancharray.ElementAt (i).ElementAt (0).Find (g_branchname)!=-1 && g_branchname!=g_brancharray.ElementAt (i).ElementAt (0))
  10794. {
  10795. int size=yeararray.GetSize ();
  10796. yeararray.SetSize(size+1,1);
  10797. CString str=g_brancharray.ElementAt (i).ElementAt (0);
  10798. str.Delete (0, g_branchname.GetLength ());
  10799. yeararray.ElementAt (size).Add (str);
  10800. }
  10801. }
  10802. AddHistoryMenu(&yeararray);*/
  10803. if (g_bBranchModify)OnDisconnect();
  10804. if (1)
  10805. {
  10806. g_user.bLongin = 0;
  10807. g_user.name.Empty();
  10808. g_user.rights.Empty();
  10809. g_user.account.Empty();
  10810. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  10811. g_pMainWnd2->RefreshOutlookBar();
  10812. m_Mdi.CloseAll();
  10813. if (g_pMainWnd2)
  10814. {
  10815. g_pMainWnd2->DrawLogin();
  10816. g_pMainWnd2->ShowBar(0);
  10817. }
  10818. if (g_bNoLoginLia)
  10819. {
  10820. Login dlg;
  10821. dlg.SetLiaPath("5.lia");
  10822. dlg.DoModal();
  10823. }
  10824. else
  10825. {
  10826. Login3 dlg;
  10827. dlg.SetLiaPath("5.lia");
  10828. dlg.DoModal();
  10829. }
  10830. if (g_user.bLongin == 0)return;
  10831. if (g_pMainWnd2)g_pMainWnd2->ShowBar(1);
  10832. }
  10833. g_pMainWnd2->DrawLogin();
  10834. g_pMainWnd2->EnableBtns(1);
  10835. }
  10836. g_nYearpos = -1;
  10837. }
  10838. #endif
  10839. }
  10840. void CMainFrame::OnStaffAchievementShow() //Jeff:此机只用于员工看业绩;
  10841. {
  10842. // TODO: Add your command handler code here
  10843. if (g_user.bLongin == 0) // 是否登陆系统;
  10844. {
  10845. if (g_bNoLoginLia)
  10846. {
  10847. Login dlg;
  10848. dlg.SetLiaPath("5.lia");
  10849. dlg.DoModal();
  10850. }
  10851. else
  10852. {
  10853. Login3 dlg;
  10854. dlg.SetLiaPath("5.lia");
  10855. dlg.DoModal();
  10856. }
  10857. if (g_user.bLongin == 0)return;
  10858. }
  10859. if (IsHasRightsnew(49) == 0)return;// 是否有权限进行设置;
  10860. CString version = _T("Version 1.0");
  10861. CMenu *pMenu = GetMenu();
  10862. CMenu* submenu = pMenu->GetSubMenu(1);
  10863. UINT status = submenu->GetMenuState(IDM_StaffAchievementShow, MF_BYCOMMAND);
  10864. if (status&MF_CHECKED)
  10865. {
  10866. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_UNCHECKED);
  10867. AfxGetApp()->WriteProfileInt(version, "status2", 0);
  10868. g_bStaffAchievementShow = 0;
  10869. TCHAR szKey[MAX_PATH];
  10870. TCHAR szDir[MAX_PATH];
  10871. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  10872. HKEY hKey = 0;
  10873. DWORD disp = 0;
  10874. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  10875. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  10876. if (lResult == ERROR_SUCCESS)
  10877. {
  10878. RegDeleteValue(hKey, "YLGLMAINAUTORUN");
  10879. RegDeleteKey(hKey, "YLGLMAINAUTORUN");
  10880. RegCloseKey(hKey);
  10881. }
  10882. }
  10883. else
  10884. {
  10885. submenu->CheckMenuItem(IDM_StaffAchievementShow, MF_BYCOMMAND | MF_CHECKED);
  10886. AfxGetApp()->WriteProfileInt(version, "status2", 1);
  10887. g_bStaffAchievementShow = 1;
  10888. TCHAR szKey[MAX_PATH];
  10889. TCHAR szDir[MAX_PATH];
  10890. ::GetModuleFileName(NULL, szDir, MAX_PATH);
  10891. HKEY hKey = 0;
  10892. DWORD disp = 0;
  10893. lstrcpy(szKey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
  10894. int lResult = RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &disp);
  10895. if (lResult == ERROR_SUCCESS)
  10896. {
  10897. lResult = RegSetValueEx(hKey, "YLGLMAINAUTORUN", 0, REG_SZ, (const unsigned char*)szDir, lstrlen(szDir));
  10898. RegCloseKey(hKey);
  10899. }
  10900. StaffAchievementSet dlg;
  10901. dlg.DoModal();
  10902. }
  10903. }
  10904. void CMainFrame::PrintDinDan2(CString m_id)
  10905. {
  10906. #ifdef MODERN_VERSION
  10907. SelContent seldlg;
  10908. if (seldlg.DoModal() != IDOK)return;
  10909. CPrintRX m_Print;
  10910. m_Print.InitToPrint(NULL, 1);
  10911. m_Print.StartPrint();
  10912. m_Print.StartPage();
  10913. // CRect StrRect(0,0,560,818);
  10914. LoadRect load;
  10915. LoadRect load2;
  10916. LoadRect load3;
  10917. load.SetLiaPath ("9.lia");
  10918. load.SetMargins(-14,0);
  10919. if(!load.Load ())return;
  10920. int i;
  10921. //////////////////////////////////////////////////////////////
  10922. CStringArray txarray;
  10923. CString filter="id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"';id='"+m_id+"'";
  10924. g_sendhead.code[0]=11;
  10925. g_sendhead.code[1]=52;
  10926. g_sendhead.code[2]=50;
  10927. g_sendhead.code[3]=38;
  10928. g_sendhead.code[4]=27;
  10929. g_sendhead.tabcount=5;
  10930. g_sendhead.bsql=0;
  10931. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  10932. CArray<CStringArray, CStringArray>sparray;
  10933. CArray<CStringArray, CStringArray>clientarray;
  10934. CArray<CStringArray, CStringArray>phonearray;
  10935. CArray<CStringArray, CStringArray>bukuan2array;
  10936. CArray<CStringArray, CStringArray>bukuanarray;
  10937. DataToArray(&g_List1array, &clientarray, &sparray, &bukuan2array, &bukuanarray);
  10938. CTime tm=CTime::GetCurrentTime ();
  10939. CString str;
  10940. CString m_money1 = g_List1array.ElementAt (0).ElementAt (1);
  10941. CString m_money2 = g_List1array.ElementAt (0).ElementAt (2);
  10942. CString m_money3 = g_List1array.ElementAt (0).ElementAt (3);
  10943. CString m_name1 = g_List1array.ElementAt (0).ElementAt (4);
  10944. CString m_name2 = g_List1array.ElementAt (0).ElementAt (5);
  10945. CString m_taoxiname= g_List1array.ElementAt (0).ElementAt (7);
  10946. CString m_taoxijiage = g_List1array.ElementAt (0).ElementAt (8);
  10947. CString m_zs = g_List1array.ElementAt (0).ElementAt (9);
  10948. CString m_time1 = g_List1array.ElementAt (0).ElementAt (10);
  10949. CString m_time2 = g_List1array.ElementAt (0).ElementAt (11);
  10950. CString m_time3 = g_List1array.ElementAt (0).ElementAt (12);
  10951. CString m_ren = g_List1array.ElementAt (0).ElementAt (14);
  10952. CString m_discount = g_List1array.ElementAt (0).ElementAt (15);
  10953. CString m_payed1 = g_List1array.ElementAt (0).ElementAt (16);
  10954. CString m_payed2 = g_List1array.ElementAt (0).ElementAt (17);
  10955. CString m_payed3 = g_List1array.ElementAt (0).ElementAt (18);
  10956. CString m_payed4 = g_List1array.ElementAt (0).ElementAt (19);
  10957. CString m_payed5 = g_List1array.ElementAt (0).ElementAt (20);
  10958. CString m_time4 = g_List1array.ElementAt (0).ElementAt (21);
  10959. CString m_time5 = g_List1array.ElementAt (0).ElementAt (22);
  10960. CString m_clothescount = g_List1array.ElementAt (0).ElementAt (26);
  10961. CString m_clothescount2 = g_List1array.ElementAt (0).ElementAt (27);
  10962. CString m_outside = g_List1array.ElementAt (0).ElementAt (28);
  10963. CString m_outside2 = g_List1array.ElementAt (0).ElementAt (29);
  10964. CString m_style = g_List1array.ElementAt (0).ElementAt (30);
  10965. CString m_waiter1 = g_List1array.ElementAt (0).ElementAt (34);
  10966. CString m_waiter2 = g_List1array.ElementAt (0).ElementAt (35);
  10967. CString m_waiter4 = g_List1array.ElementAt (0).ElementAt (37);
  10968. CString m_bz = g_List1array.ElementAt (0).ElementAt (38);
  10969. CString m_phone1=clientarray.ElementAt (0).ElementAt (3);
  10970. CString m_phone2=clientarray.ElementAt (0).ElementAt (4);
  10971. CString m_addr1=clientarray.ElementAt (0).ElementAt (7);
  10972. CString m_addr2=clientarray.ElementAt (0).ElementAt (8);
  10973. CString m_occupation1=clientarray.ElementAt (0).ElementAt (9);
  10974. CString m_occupation2=clientarray.ElementAt (0).ElementAt (10);
  10975. filter="name='"+m_ren+"'";
  10976. g_sendhead.code[0]=5;
  10977. g_sendhead.tabcount=1;
  10978. g_sendhead.bsql=0;
  10979. int g_nYearposTemp=g_nYearpos;
  10980. g_nYearpos=-1;
  10981. g_pMainWnd->ProcessChatMessageRequest2(filter);
  10982. g_nYearpos=g_nYearposTemp;
  10983. if(g_bSendOK==0)return;
  10984. DataToArray(&phonearray);
  10985. m_money2.Format ("%f", atof(m_payed5)+atof(m_money1));
  10986. m_money1.Format ("%f", atof(m_taoxijiage)+atof(m_payed4));
  10987. m_money3.Format ("%f", atof(m_money1)-atof(m_money2));
  10988. ConvertToPrice(m_money1);
  10989. ConvertToPrice(m_money2);
  10990. ConvertToPrice(m_money3);
  10991. ////////////////////////////////////////////////////////////////
  10992. int rcpos=-1;
  10993. CRect StrRect=load.m_rcarray .ElementAt (++rcpos);
  10994. Image *pImg=NULL;
  10995. ::LoadImageFromBuf (&pImg, g_mainpath+"\\skin\\logo2.jpg");
  10996. if(seldlg.m_bFrame)
  10997. m_Print.DrawImage(pImg, StrRect);
  10998. delete pImg;
  10999. m_Print.SetFontFace(16, 1, "黑体");
  11000. StrRect=load.m_rcarray .ElementAt (++rcpos);
  11001. if(seldlg.m_bFrame)
  11002. ///////////////////////////////不用改
  11003. m_Print.DrawText((LPTSTR)(LPCTSTR)"摩登新娘工作流程单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11004. m_Print.SetFontFace(10, 1, "宋体");
  11005. for( i=3; i<=6; i++)
  11006. {
  11007. StrRect=load.m_rcarray .ElementAt (i-1);
  11008. if(seldlg.m_bFrame)
  11009. m_Print.DrawRect2(StrRect, 1);
  11010. }
  11011. CStringArray strarray;
  11012. if(seldlg.m_bBooking==0)
  11013. {
  11014. m_name1.Empty ();
  11015. m_name2.Empty ();
  11016. m_phone1.Empty ();
  11017. m_phone2.Empty ();
  11018. m_addr1.Empty ();
  11019. m_addr2.Empty ();
  11020. m_taoxiname.Empty ();
  11021. m_taoxijiage.Empty ();
  11022. }
  11023. if(seldlg.m_bFrame )
  11024. {
  11025. strarray.Add("新郎:"+m_name1);
  11026. strarray.Add("H");
  11027. strarray.Add("O");
  11028. strarray.Add("手机:"+m_phone1);
  11029. strarray.Add("新娘:"+m_name2);
  11030. strarray.Add("H");
  11031. strarray.Add("O");
  11032. strarray.Add("手机:"+m_phone2);
  11033. }
  11034. else
  11035. {
  11036. strarray.Add(" "+m_name1);
  11037. strarray.Add("");
  11038. strarray.Add("");
  11039. strarray.Add(" "+m_phone1);
  11040. strarray.Add(" "+m_name2);
  11041. strarray.Add("");
  11042. strarray.Add("");
  11043. strarray.Add(" "+m_phone2);
  11044. }
  11045. for( i=7; i<=14; i++)
  11046. {
  11047. StrRect=load.m_rcarray .ElementAt (i-1);
  11048. StrRect.left +=2;
  11049. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11050. }
  11051. StrRect=load.m_rcarray .ElementAt (3);
  11052. StrRect.left +=2;
  11053. if(seldlg.m_bFrame)
  11054. str="地址:"+m_addr1;
  11055. else
  11056. str=" "+m_addr1;
  11057. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11058. StrRect=load.m_rcarray .ElementAt (5);
  11059. StrRect.left +=2;
  11060. if(seldlg.m_bFrame)
  11061. str="地址:"+m_addr2;
  11062. else
  11063. str=" "+m_addr2;
  11064. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11065. //////////////////////////////////////////////////////
  11066. StrRect=load.m_rcarray .ElementAt (14);
  11067. str="预\r\n约";
  11068. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11069. StrRect.top +=46;
  11070. StrRect.left +=2;
  11071. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11072. m_Print.SetFontFace(10, 1, "宋体");
  11073. StrRect=load.m_rcarray .ElementAt (15);
  11074. if(seldlg.m_bFrame)
  11075. str="套系名称:"+m_taoxiname;
  11076. else
  11077. str=" "+m_taoxiname;
  11078. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11079. StrRect.left +=4;
  11080. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11081. StrRect=load.m_rcarray .ElementAt (16);
  11082. if(seldlg.m_bFrame)
  11083. str="单价:"+m_taoxijiage;
  11084. else
  11085. str=" "+m_taoxijiage;
  11086. StrRect.left +=2;
  11087. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11088. StrRect=load.m_rcarray .ElementAt (21);
  11089. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11090. str="新人签名:";
  11091. StrRect.left +=2;
  11092. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11093. StrRect=load.m_rcarray .ElementAt (22);
  11094. if(seldlg.m_bBooking==0)
  11095. {
  11096. if(seldlg.m_bFrame)
  11097. str="未付款:";
  11098. else
  11099. str=" ";
  11100. }
  11101. else
  11102. {
  11103. if(seldlg.m_bFrame)
  11104. str="未付款:"+m_money3;
  11105. else
  11106. str=" "+m_money3;
  11107. }
  11108. StrRect.left +=2;
  11109. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11110. StrRect=load.m_rcarray .ElementAt (23);
  11111. str="结婚秘书:";
  11112. StrRect.left +=2;
  11113. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11114. StrRect=load.m_rcarray .ElementAt (24);
  11115. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11116. StrRect.left +=3;
  11117. StrRect.top +=3;
  11118. StrRect.right -=2;
  11119. StrRect.bottom -=2;
  11120. int realpos=0;str="";
  11121. for(i=0; i<sparray.GetSize (); i++)
  11122. {
  11123. if(atoi(sparray.ElementAt (i).ElementAt (4))!=1)continue;
  11124. str+=sparray.ElementAt (i).ElementAt (5);
  11125. str+=" 数量:";
  11126. str+=sparray.ElementAt (i).ElementAt (3);
  11127. if(realpos%2)
  11128. str+="\r\n";
  11129. else
  11130. str+=" ";
  11131. realpos++;
  11132. }
  11133. str.TrimRight ("\r\n");
  11134. str.TrimRight (" ");
  11135. if(seldlg.m_bBooking)AutoDraw(m_Print, StrRect, str, 1.4);
  11136. ///////////////////////////////////////////////////////////
  11137. StrRect=load.m_rcarray .ElementAt (14);
  11138. StrRect.top +=1*122;
  11139. StrRect.bottom +=1*122;
  11140. str="拍\r\n照";
  11141. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11142. StrRect.top +=46;
  11143. StrRect.left +=2;
  11144. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11145. m_Print.SetFontFace(10, 1, "宋体");
  11146. StrRect=load.m_rcarray .ElementAt (15);
  11147. StrRect.top +=1*122;
  11148. StrRect.bottom +=1*122;
  11149. str="拍照内容: 白 晚 特 便";
  11150. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11151. StrRect.left +=4;
  11152. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11153. StrRect=load.m_rcarray .ElementAt (21);
  11154. StrRect.top +=1*122;
  11155. StrRect.bottom +=1*122;
  11156. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11157. str=" 新人签名:";
  11158. StrRect.left +=2;
  11159. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11160. StrRect=load.m_rcarray .ElementAt (22);
  11161. StrRect.top +=1*122;
  11162. StrRect.bottom +=1*122;
  11163. if(seldlg.m_bTake)
  11164. {
  11165. if(seldlg.m_bFrame)
  11166. str="未付款:"+m_money3;
  11167. else
  11168. str=" "+m_money3;
  11169. }
  11170. else
  11171. {
  11172. if(seldlg.m_bFrame)
  11173. str="未付款:";
  11174. else
  11175. str=" ";
  11176. }
  11177. StrRect.left +=2;
  11178. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11179. StrRect=load.m_rcarray .ElementAt (23);
  11180. StrRect.top +=1*122;
  11181. StrRect.bottom +=1*122;
  11182. str="结婚秘书:";
  11183. StrRect.left +=2;
  11184. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11185. StrRect=load.m_rcarray .ElementAt (24);
  11186. StrRect.top +=1*122;
  11187. StrRect.bottom +=1*122;
  11188. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11189. StrRect.left +=3;
  11190. StrRect.top +=3;
  11191. StrRect.right -=2;
  11192. StrRect.bottom -=2;
  11193. if(seldlg.m_bTake)
  11194. {
  11195. str="";
  11196. for(i=0; i<bukuan2array.GetSize (); i++)
  11197. {
  11198. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=1)continue;
  11199. str+="加挑: ";
  11200. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11201. str+="\r\n";
  11202. }
  11203. str.TrimRight ("\r\n");
  11204. str.TrimRight (" ");
  11205. AutoDraw(m_Print, StrRect, str, 1.4);
  11206. }
  11207. ///////////////////////////////////////////////////////////
  11208. StrRect=load.m_rcarray .ElementAt (14);
  11209. StrRect.top +=2*122;
  11210. StrRect.bottom +=2*122;
  11211. str="选\r\n样";
  11212. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11213. StrRect.top +=46;
  11214. StrRect.left +=2;
  11215. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11216. m_Print.SetFontFace(10, 1, "宋体");
  11217. StrRect=load.m_rcarray .ElementAt (15);
  11218. StrRect.top +=2*122;
  11219. StrRect.bottom +=2*122;
  11220. str="选片内容:";
  11221. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11222. StrRect.left +=4;
  11223. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11224. StrRect=load.m_rcarray .ElementAt (21);
  11225. StrRect.top +=2*122;
  11226. StrRect.bottom +=2*122;
  11227. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11228. str=" 新人签名:";
  11229. StrRect.left +=2;
  11230. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11231. StrRect=load.m_rcarray .ElementAt (22);
  11232. StrRect.top +=2*122;
  11233. StrRect.bottom +=2*122;
  11234. if(seldlg.m_bChoose)
  11235. {
  11236. if(seldlg.m_bFrame)
  11237. str="未付款:"+m_money3;
  11238. else
  11239. str=" "+m_money3;
  11240. }
  11241. else
  11242. {
  11243. if(seldlg.m_bFrame)
  11244. str="未付款:";
  11245. else
  11246. str=" ";
  11247. }
  11248. StrRect.left +=2;
  11249. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11250. StrRect=load.m_rcarray .ElementAt (23);
  11251. StrRect.top +=2*122;
  11252. StrRect.bottom +=2*122;
  11253. str="结婚秘书:";
  11254. StrRect.left +=2;
  11255. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11256. StrRect=load.m_rcarray .ElementAt (24);
  11257. StrRect.top +=2*122;
  11258. StrRect.bottom +=2*122;
  11259. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11260. if(seldlg.m_bChoose)
  11261. {
  11262. StrRect.left +=3;
  11263. StrRect.top +=3;
  11264. StrRect.right -=2;
  11265. StrRect.bottom -=2;
  11266. str="";
  11267. for(i=0; i<bukuan2array.GetSize (); i++)
  11268. {
  11269. if(atoi(bukuan2array.ElementAt (i).ElementAt (5))!=2)continue;
  11270. str+="加挑: ";
  11271. str+=bukuan2array.ElementAt (i).ElementAt (4);
  11272. str+="\r\n";
  11273. }
  11274. str.TrimRight ("\r\n");
  11275. str.TrimRight (" ");
  11276. AutoDraw(m_Print, StrRect, str, 1.4);
  11277. }
  11278. ///////////////////////////////////////////////////////////
  11279. StrRect=load.m_rcarray .ElementAt (14);
  11280. StrRect.top +=3*122;
  11281. StrRect.bottom +=3*122;
  11282. str="结\r\n婚";
  11283. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11284. StrRect.top +=46;
  11285. StrRect.left +=2;
  11286. if(seldlg.m_bFrame)AutoDraw(m_Print, StrRect, str, 1.4);
  11287. m_Print.SetFontFace(10, 1, "宋体");
  11288. StrRect=load.m_rcarray .ElementAt (15);
  11289. StrRect.top +=3*122;
  11290. StrRect.bottom +=3*122;
  11291. str="结婚内容: 区 白 晚 押金:";
  11292. if(seldlg.m_bFrame) m_Print.DrawRect2(StrRect, 1);
  11293. StrRect.left +=4;
  11294. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11295. StrRect=load.m_rcarray .ElementAt (21);
  11296. StrRect.top +=3*122;
  11297. StrRect.bottom +=3*122;
  11298. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11299. str=" 新人签名:";
  11300. StrRect.left +=2;
  11301. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11302. StrRect=load.m_rcarray .ElementAt (22);
  11303. StrRect.top +=3*122;
  11304. StrRect.bottom +=3*122;
  11305. if(seldlg.m_bBooking)
  11306. {
  11307. if(seldlg.m_bFrame)
  11308. str="未付款:"+m_money3;
  11309. else
  11310. str=" "+m_money3;
  11311. }
  11312. else
  11313. {
  11314. if(seldlg.m_bFrame)
  11315. str="未付款:";
  11316. else
  11317. str=" ";
  11318. }
  11319. StrRect.left +=2;
  11320. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11321. StrRect=load.m_rcarray .ElementAt (23);
  11322. StrRect.top +=3*122;
  11323. StrRect.bottom +=3*122;
  11324. str="结婚秘书:";
  11325. StrRect.left +=2;
  11326. if(seldlg.m_bFrame)m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11327. StrRect=load.m_rcarray .ElementAt (24);
  11328. StrRect.top +=3*122;
  11329. StrRect.bottom +=3*122;
  11330. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11331. if(seldlg.m_bBooking)
  11332. {
  11333. StrRect.left +=3;
  11334. StrRect.top +=3;
  11335. StrRect.right -=2;
  11336. StrRect.bottom -=2;
  11337. realpos=0;str="";
  11338. for(i=0; i<sparray.GetSize (); i++)
  11339. {
  11340. if(atoi(sparray.ElementAt (i).ElementAt (4))!=2)continue;
  11341. str+=sparray.ElementAt (i).ElementAt (5);
  11342. str+=" 数量:";
  11343. str+=sparray.ElementAt (i).ElementAt (3);
  11344. if(realpos%2)
  11345. str+="\r\n";
  11346. else
  11347. str+=" ";
  11348. realpos++;
  11349. }
  11350. str.TrimRight ("\r\n");
  11351. str.TrimRight (" ");
  11352. AutoDraw(m_Print, StrRect, str, 1.4);
  11353. }
  11354. ///////////////////////////////////////
  11355. strarray.RemoveAll ();
  11356. if(seldlg.m_bFrame)
  11357. {
  11358. strarray.Add ("项目");
  11359. strarray.Add ("万");
  11360. strarray.Add ("千");
  11361. strarray.Add ("百");
  11362. strarray.Add ("十");
  11363. strarray.Add ("个");
  11364. strarray.Add ("收 银");
  11365. }
  11366. else
  11367. {
  11368. strarray.Add ("");
  11369. strarray.Add ("");
  11370. strarray.Add ("");
  11371. strarray.Add ("");
  11372. strarray.Add ("");
  11373. strarray.Add ("");
  11374. strarray.Add ("");
  11375. }
  11376. CStringArray strarray2;
  11377. float ftotal=0;
  11378. int realcount=0;
  11379. if(seldlg.m_bBooking)
  11380. {
  11381. for(i=0; i<bukuanarray.GetSize (); i++)
  11382. {
  11383. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=3 && atoi(bukuanarray.ElementAt (i).ElementAt (6))!=4)continue;
  11384. realcount++;
  11385. if(realcount>6)break;
  11386. str=bukuanarray.ElementAt (i).ElementAt (1);
  11387. ftotal+=atof(str);
  11388. strarray2.Add (GetW(str));
  11389. strarray2.Add (GetK(str));
  11390. strarray2.Add (GetB(str));
  11391. strarray2.Add (GetS(str));
  11392. strarray2.Add (GetG(str));
  11393. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11394. }
  11395. }
  11396. while(strarray2.GetSize ()<36)
  11397. strarray2.Add ("");
  11398. str.Format ("%f", ftotal);
  11399. strarray2.Add (GetW(str));
  11400. strarray2.Add (GetK(str));
  11401. strarray2.Add (GetB(str));
  11402. strarray2.Add (GetS(str));
  11403. strarray2.Add (GetG(str));
  11404. strarray2.Add ("");
  11405. //拍照
  11406. ftotal=0;
  11407. realcount=0;
  11408. if(seldlg.m_bTake)
  11409. {
  11410. for(i=0; i<bukuanarray.GetSize (); i++)
  11411. {
  11412. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=1)continue;
  11413. realcount++;
  11414. if(realcount>6)break;
  11415. str=bukuanarray.ElementAt (i).ElementAt (1);
  11416. ftotal+=atof(str);
  11417. strarray2.Add (GetW(str));
  11418. strarray2.Add (GetK(str));
  11419. strarray2.Add (GetB(str));
  11420. strarray2.Add (GetS(str));
  11421. strarray2.Add (GetG(str));
  11422. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11423. }
  11424. }
  11425. while(strarray2.GetSize ()<42+36)
  11426. strarray2.Add ("");
  11427. str.Format ("%f", ftotal);
  11428. strarray2.Add (GetW(str));
  11429. strarray2.Add (GetK(str));
  11430. strarray2.Add (GetB(str));
  11431. strarray2.Add (GetS(str));
  11432. strarray2.Add (GetG(str));
  11433. strarray2.Add ("");
  11434. //选片
  11435. ftotal=0;
  11436. realcount=0;
  11437. if(seldlg.m_bChoose)
  11438. {
  11439. for(i=0; i<bukuanarray.GetSize (); i++)
  11440. {
  11441. if(atoi(bukuanarray.ElementAt (i).ElementAt (6))!=2)continue;
  11442. realcount++;
  11443. if(realcount>6)break;
  11444. str=bukuanarray.ElementAt (i).ElementAt (1);
  11445. ftotal+=atof(str);
  11446. strarray2.Add (GetW(str));
  11447. strarray2.Add (GetK(str));
  11448. strarray2.Add (GetB(str));
  11449. strarray2.Add (GetS(str));
  11450. strarray2.Add (GetG(str));
  11451. strarray2.Add (bukuanarray.ElementAt (i).ElementAt (4));
  11452. }
  11453. }
  11454. while(strarray2.GetSize ()<42*2+36)
  11455. strarray2.Add ("");
  11456. str.Format ("%f", ftotal);
  11457. strarray2.Add (GetW(str));
  11458. strarray2.Add (GetK(str));
  11459. strarray2.Add (GetB(str));
  11460. strarray2.Add (GetS(str));
  11461. strarray2.Add (GetG(str));
  11462. strarray2.Add ("");
  11463. /////////////////////////////
  11464. CRect temprc;
  11465. for(int n=0; n<4; n++)
  11466. {
  11467. StrRect=load.m_rcarray .ElementAt (17);
  11468. StrRect.top +=n*122;
  11469. StrRect.bottom +=n*122;
  11470. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11471. StrRect=load.m_rcarray .ElementAt (18);
  11472. if(n)
  11473. {
  11474. StrRect.left +=36;
  11475. StrRect.right +=36;
  11476. }
  11477. StrRect.top +=n*122;
  11478. StrRect.bottom +=n*122;
  11479. if(seldlg.m_bFrame)
  11480. str.Format("%d年", tm.GetYear ());
  11481. else
  11482. str.Format("%d ", tm.GetYear ());
  11483. 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))
  11484. {
  11485. if(seldlg.m_bFrame)
  11486. str=" 年";
  11487. else
  11488. str=" ";
  11489. }
  11490. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11491. StrRect=load.m_rcarray .ElementAt (19);
  11492. if(n)
  11493. {
  11494. StrRect.left +=38;
  11495. StrRect.right +=38;
  11496. }
  11497. StrRect.top +=n*122;
  11498. StrRect.bottom +=n*122;
  11499. if(seldlg.m_bFrame)
  11500. str.Format("%02d月", tm.GetMonth ());
  11501. else
  11502. str.Format("%02d ", tm.GetMonth ());
  11503. 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))
  11504. {
  11505. if(seldlg.m_bFrame)
  11506. str=" 月";
  11507. else
  11508. str=" ";
  11509. }
  11510. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11511. StrRect=load.m_rcarray .ElementAt (20);
  11512. if(n)
  11513. {
  11514. StrRect.left +=36;
  11515. StrRect.right +=36;
  11516. }
  11517. StrRect.top +=n*122;
  11518. StrRect.bottom +=n*122;
  11519. if(seldlg.m_bFrame)
  11520. str.Format("%02d日", tm.GetDay ());
  11521. else
  11522. str.Format("%02d ", tm.GetDay ());
  11523. 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))
  11524. {
  11525. if(seldlg.m_bFrame)
  11526. str=" 日";
  11527. else
  11528. str=" ";
  11529. }
  11530. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  11531. for(i=26; i<=32; i++)
  11532. {
  11533. StrRect=load.m_rcarray .ElementAt (i-1);
  11534. StrRect.bottom -=14;
  11535. for(int j=0; j<8; j++)
  11536. {
  11537. StrRect.top=StrRect.bottom;
  11538. if(j>2)
  11539. {
  11540. StrRect.bottom =StrRect.top+14;
  11541. }
  11542. else
  11543. {
  11544. StrRect.bottom =StrRect.top+13;
  11545. }
  11546. temprc=StrRect;
  11547. StrRect.top +=n*122;
  11548. StrRect.bottom +=n*122;
  11549. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11550. if(i==26 && j==4 && seldlg.m_bFrame)
  11551. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11552. else if(i==26 && j==5 && seldlg.m_bFrame)
  11553. m_Print.DrawText((LPTSTR)(LPCTSTR)"付款", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11554. else if(i==26 && j==7 && seldlg.m_bFrame)
  11555. m_Print.DrawText((LPTSTR)(LPCTSTR)"合计", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11556. else if(j==0)
  11557. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt (i-26), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11558. else if(j && i>26 && n<3)
  11559. {
  11560. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray2.ElementAt ((j-1)*6+(i-27)+n*42), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11561. }
  11562. StrRect=temprc;
  11563. }
  11564. }
  11565. }
  11566. if(seldlg.m_bFrame)
  11567. {
  11568. StrRect=load.m_rcarray .ElementAt (32);
  11569. str="注\r\n意\r\n事\r\n项";
  11570. StrRect.top +=367;
  11571. StrRect.bottom +=367;
  11572. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11573. StrRect.top +=17;
  11574. StrRect.left +=2;
  11575. AutoDraw(m_Print, StrRect, str, 1.4);
  11576. StrRect=load.m_rcarray .ElementAt (33);
  11577. str="1: 本预约单自预定日期起一年内有效.定金在拍照套系金额中扣出.预定金一概不退\r\n\
  11578. 2: 多拍照片只供筛选.恕不奉送.版权所有.不得私自拷贝\r\n\
  11579. 3: 拍照款请于拍照时一次付清\r\n\
  11580. 4: 新娘装AM8:00前钟点费另计.婚纱礼服出租押金500-2000元\r\n\
  11581. 5: 本公司设有豪华VIP礼服区.及皇家御用礼服展区.但需另外加价.详情请咨本店人员\r\n\
  11582. 6: 安瓶, 美甲一次性化妆用具等均属增值服务部分,则需另外加价,详情咨询本店工作人员\r\n\
  11583. 7: 本电脑机械故障导致文件资料丢失.本公司只提供补拍服务\r\n\
  11584. 8: 每次前来请务必携带本单交给工作人员.本单是您在摩登新娘拍照的凭证.办理有关手续凭本单办理盖\r\n\
  11585. 章后方可生效";
  11586. StrRect.top +=367;
  11587. StrRect.bottom +=367;
  11588. if(seldlg.m_bFrame)m_Print.DrawRect2(StrRect, 1);
  11589. StrRect.top +=4;
  11590. StrRect.left +=2;
  11591. AutoDraw(m_Print, StrRect, str, 1.0);
  11592. StrRect=load.m_rcarray .ElementAt (34);
  11593. 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)";
  11594. AutoDraw(m_Print, StrRect, str, 1.0);
  11595. m_Print.SetFontFace(13, 1, "宋体");
  11596. StrRect=load.m_rcarray .ElementAt (35);
  11597. str="地 址: 汉口 . 解放大道 . 头道街东部购物公园C栋二,三层";
  11598. StrRect.top +=367;
  11599. StrRect.bottom +=367;
  11600. StrRect.left +=2;
  11601. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11602. StrRect=load.m_rcarray .ElementAt (36);
  11603. str="喜讯热线: 027-81888799 81888599 81888699";
  11604. StrRect.top +=367;
  11605. StrRect.bottom +=367;
  11606. StrRect.left +=2;
  11607. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11608. }
  11609. PrintPreview dlg;
  11610. m_Print.GetWidHei(dlg.m_w , dlg.m_h );
  11611. dlg.m_pDC =m_Print.GetPDC() ;
  11612. if(dlg.DoModal ()!=IDOK)return;
  11613. //结束打印
  11614. m_Print.EndPage();
  11615. m_Print.EndPrint();
  11616. #endif
  11617. }
  11618. extern CString GetHMoney(CString str);
  11619. void CMainFrame::PrintReceipt3(CString strOrderNumber, CStringArray *pArray, float money)
  11620. {
  11621. int printcot = 1;
  11622. for (int aa = 0; aa < printcot; aa++)
  11623. {
  11624. g_sendhead.bsql = 0;
  11625. g_sendhead.code[0] = 24;
  11626. g_sendhead.tabcount = 1;
  11627. int g_nYearposTemp = g_nYearpos;
  11628. g_nYearpos = -1;
  11629. g_pMainWnd->ProcessChatMessageRequest2(1);
  11630. g_nYearpos = g_nYearposTemp;
  11631. if (0 == g_bSendOK)return;
  11632. DataToArray(&g_cominfoarray);
  11633. CString SerialNo;
  11634. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  11635. CPrintRX m_Print;
  11636. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  11637. {
  11638. m_Print.InitToPrint(NULL, 1);
  11639. }
  11640. else
  11641. {
  11642. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  11643. if (name.IsEmpty())
  11644. m_Print.InitToPrint(NULL, 1);
  11645. else
  11646. {
  11647. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  11648. if (nret == -1 && aa == 0)
  11649. {
  11650. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  11651. }
  11652. }
  11653. }
  11654. m_Print.StartPrint();
  11655. m_Print.StartPage();
  11656. LoadRect load;
  11657. load.SetLiaPath("15.lia");
  11658. load.SetMargins(0, 0);
  11659. if (!load.Load())return;
  11660. int i;
  11661. //////////////////////////////////////////////////////////////
  11662. CStringArray txarray;
  11663. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  11664. g_sendhead.code[0] = 11;
  11665. g_sendhead.code[1] = 52;
  11666. g_sendhead.tabcount = 2;
  11667. g_sendhead.bsql = 0;
  11668. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  11669. CArray<CStringArray, CStringArray>sparray;
  11670. CArray<CStringArray, CStringArray>clientarray;
  11671. DataToArray(&g_List1array, &clientarray);
  11672. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  11673. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  11674. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  11675. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  11676. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  11677. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  11678. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  11679. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  11680. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  11681. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  11682. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  11683. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  11684. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  11685. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  11686. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  11687. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  11688. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  11689. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  11690. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  11691. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  11692. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  11693. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  11694. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  11695. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  11696. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  11697. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  11698. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  11699. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  11700. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  11701. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  11702. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  11703. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  11704. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  11705. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  11706. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  11707. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  11708. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  11709. CString m_addr = m_addr1 + ";";
  11710. m_addr.TrimLeft(";");
  11711. m_addr += m_addr2;
  11712. CString m_qq = m_qq1 + ";";
  11713. m_qq.TrimLeft(";");
  11714. m_qq += m_qq2;
  11715. m_money1.Format("%f", atof(m_taoxijiage));
  11716. m_money2.Format("%f", atof(m_payed1));
  11717. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  11718. ConvertToPrice(m_money1);
  11719. ConvertToPrice(m_money2);
  11720. ConvertToPrice(m_money3);
  11721. ////////////////////////////////////////////////////////////////
  11722. int rcpos = -1;
  11723. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  11724. m_Print.SetFontFace(17, 1, "宋体");
  11725. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11726. StrRect.top -= 0;
  11727. StrRect.bottom -= 10;
  11728. StrRect.left -= 140;
  11729. StrRect.right = StrRect.left + 48;
  11730. m_Print.SetFontFace(15, 1, "宋体");
  11731. m_Print.SetColor(0xffffff);
  11732. m_Print.DrawRect(StrRect, 0);
  11733. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11734. StrRect.left = StrRect.right;
  11735. StrRect.right = StrRect.left + 48;
  11736. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  11737. m_Print.SetColor(0, RGB(255, 0, 0));
  11738. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11739. m_Print.SetColor(0);
  11740. m_Print.SetFontFace(12, 1, "宋体");
  11741. StrRect.left -= 48;
  11742. int hei = StrRect.Height();
  11743. StrRect.top = StrRect.bottom + 2;
  11744. StrRect.bottom += hei + 2;
  11745. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11746. StrRect.top = StrRect.bottom - 2;
  11747. StrRect.bottom += hei - 5;
  11748. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  11749. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11750. m_Print.SetFontFace(12, 1, "宋体");
  11751. m_Print.DrawText((LPTSTR)(LPCTSTR)"收款单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11752. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11753. m_Print.SetFontFace(9, 1, "宋体");
  11754. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11755. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11756. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11757. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11758. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11759. m_Print.DrawRect2(StrRect, 2);
  11760. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11761. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11762. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11763. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11764. m_Print.DrawRect2(StrRect, 2);
  11765. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11766. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11767. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11768. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11769. m_Print.DrawRect2(StrRect, 2);
  11770. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11771. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约地点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11772. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11773. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11774. m_Print.DrawRect2(StrRect, 2);
  11775. ////////////
  11776. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11777. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11778. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11779. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11780. m_Print.DrawRect2(StrRect, 2);
  11781. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11782. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11783. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11784. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11785. m_Print.DrawRect2(StrRect, 2);
  11786. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11787. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11788. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11789. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11790. m_Print.DrawRect2(StrRect, 2);
  11791. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11792. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11793. StrRect = load.m_rcarray.ElementAt(++rcpos);
  11794. m_Print.DrawText((LPTSTR)(LPCTSTR)g_date, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11795. m_Print.DrawRect2(StrRect, 2);
  11796. for (i = 19; i < 49; i++)
  11797. {
  11798. if (i >= 44)
  11799. {
  11800. StrRect = load.m_rcarray.ElementAt(i - 5);
  11801. int hei = StrRect.Height();
  11802. StrRect.top += hei;
  11803. StrRect.bottom += hei;
  11804. }
  11805. else
  11806. StrRect = load.m_rcarray.ElementAt(i);
  11807. m_Print.DrawRect2(StrRect, 1);
  11808. }
  11809. float fmoney = 0;
  11810. for (i = 19; i < 49; i++)
  11811. {
  11812. if (i >= 44)
  11813. {
  11814. StrRect = load.m_rcarray.ElementAt(i - 5);
  11815. int hei = StrRect.Height();
  11816. StrRect.top += hei;
  11817. StrRect.bottom += hei;
  11818. }
  11819. else
  11820. StrRect = load.m_rcarray.ElementAt(i);
  11821. StrRect.left += 2;
  11822. /* if((i-19)%5==2)
  11823. {
  11824. fmoney+=atof(pArray->ElementAt (i-19));
  11825. }*/
  11826. m_Print.DrawText((LPTSTR)(LPCTSTR)(pArray->ElementAt(i - 19)), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11827. }
  11828. m_money2.Format("%f", money);
  11829. ConvertToPrice(m_money2);
  11830. StrRect = load.m_rcarray.ElementAt(44);
  11831. CString str;
  11832. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 实收¥: %s 元 收银员: %s", \
  11833. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  11834. m_money2, g_user.name);
  11835. m_Print.DrawRect2(StrRect, 1);
  11836. StrRect.left += 3;
  11837. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11838. StrRect = load.m_rcarray.ElementAt(46);
  11839. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11840. StrRect = load.m_rcarray.ElementAt(47);
  11841. m_Print.DrawRect2(StrRect, 2);
  11842. StrRect = load.m_rcarray.ElementAt(48);
  11843. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11844. StrRect = load.m_rcarray.ElementAt(45);
  11845. str = "\
  11846. 顾客须知\r\n\
  11847. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  11848. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  11849. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  11850. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  11851. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  11852. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  11853. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  11854. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  11855. AutoDraw(m_Print, StrRect, str, 1.8);
  11856. PrintPreview dlg;
  11857. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  11858. dlg.m_pDC = m_Print.GetPDC();
  11859. if (aa == 0)
  11860. {
  11861. if (dlg.DoModal() != IDOK)
  11862. return;
  11863. printcot = dlg.m_num;
  11864. }
  11865. //结束打印
  11866. m_Print.EndPage();
  11867. m_Print.EndPrint();
  11868. }
  11869. }
  11870. void CMainFrame::PrintReceipt2(CString strOrderNumber)
  11871. {
  11872. int printcot = 1;
  11873. for (int aa = 0; aa < printcot; aa++)
  11874. {
  11875. g_sendhead.bsql = 0;
  11876. g_sendhead.code[0] = 24;
  11877. g_sendhead.tabcount = 1;
  11878. int g_nYearposTemp = g_nYearpos;
  11879. g_nYearpos = -1;
  11880. g_pMainWnd->ProcessChatMessageRequest2(1);
  11881. g_nYearpos = g_nYearposTemp;
  11882. if (0 == g_bSendOK)return;
  11883. DataToArray(&g_cominfoarray);
  11884. CString SerialNo;
  11885. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(126)) + 1);
  11886. CPrintRX m_Print;
  11887. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  11888. {
  11889. m_Print.InitToPrint(NULL, 1);
  11890. }
  11891. else
  11892. {
  11893. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  11894. if (name.IsEmpty())
  11895. m_Print.InitToPrint(NULL, 1);
  11896. else
  11897. {
  11898. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  11899. if (nret == -1 && aa == 0)
  11900. {
  11901. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  11902. }
  11903. }
  11904. }
  11905. m_Print.StartPrint();
  11906. m_Print.StartPage();
  11907. LoadRect load;
  11908. load.SetLiaPath("14.lia");
  11909. load.SetMargins(0, 0);
  11910. if (!load.Load())return;
  11911. int i;
  11912. //////////////////////////////////////////////////////////////
  11913. CStringArray txarray;
  11914. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  11915. g_sendhead.code[0] = 11;
  11916. g_sendhead.code[1] = 52;
  11917. g_sendhead.code[2] = 93;
  11918. g_sendhead.tabcount = 3;
  11919. g_sendhead.bsql = 0;
  11920. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  11921. CArray<CStringArray, CStringArray>sparray;
  11922. CArray<CStringArray, CStringArray>clientarray;
  11923. CArray<CStringArray, CStringArray>moneyarray;
  11924. DataToArray(&g_List1array, &clientarray, &moneyarray);
  11925. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  11926. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  11927. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  11928. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  11929. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  11930. CString m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);//+" 张数:"+g_List1array.ElementAt (0).ElementAt (9);
  11931. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  11932. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  11933. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  11934. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  11935. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  11936. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  11937. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  11938. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  11939. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  11940. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  11941. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  11942. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  11943. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  11944. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  11945. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  11946. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  11947. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  11948. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  11949. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  11950. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  11951. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  11952. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  11953. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  11954. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  11955. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  11956. CString m_qq1 = clientarray.ElementAt(0).ElementAt(5);
  11957. CString m_qq2 = clientarray.ElementAt(0).ElementAt(6);
  11958. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  11959. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  11960. CString m_birthday1 = clientarray.ElementAt(0).ElementAt(11);
  11961. CString m_birthday2 = clientarray.ElementAt(0).ElementAt(12);
  11962. CString m_addr = m_addr1 + ";";
  11963. m_addr.TrimLeft(";");
  11964. m_addr += m_addr2;
  11965. CString m_qq = m_qq1 + ";";
  11966. m_qq.TrimLeft(";");
  11967. m_qq += m_qq2;
  11968. m_money1.Format("%f", atof(m_taoxijiage));
  11969. m_money2 = "0";
  11970. for (i = 0; i < moneyarray.GetSize(); i++)
  11971. {
  11972. if (moneyarray.ElementAt(i).ElementAt(5) == "预约收款")
  11973. m_money2 = moneyarray.ElementAt(i).ElementAt(1);
  11974. }
  11975. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  11976. ConvertToPrice(m_money1);
  11977. ConvertToPrice(m_money2);
  11978. ConvertToPrice(m_money3);
  11979. ////////////////////////////////////////////////////////////////
  11980. int rcpos = -1;
  11981. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  11982. m_Print.SetFontFace(17, 1, "宋体");
  11983. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  11984. StrRect.top -= 0;
  11985. StrRect.bottom -= 10;
  11986. StrRect.left -= 140;
  11987. StrRect.right = StrRect.left + 48;
  11988. m_Print.SetFontFace(15, 1, "宋体");
  11989. m_Print.SetColor(0xffffff);
  11990. m_Print.DrawRect(StrRect, 0);
  11991. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11992. StrRect.left = StrRect.right;
  11993. StrRect.right = StrRect.left + 48;
  11994. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  11995. m_Print.SetColor(0, RGB(255, 0, 0));
  11996. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  11997. m_Print.SetColor(0);
  11998. m_Print.SetFontFace(12, 1, "宋体");
  11999. StrRect.left -= 48;
  12000. int hei = StrRect.Height();
  12001. StrRect.top = StrRect.bottom + 2;
  12002. StrRect.bottom += hei + 2;
  12003. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12004. StrRect.top = StrRect.bottom - 2;
  12005. StrRect.bottom += hei - 5;
  12006. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12007. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12008. m_Print.SetFontFace(12, 1, "宋体");
  12009. m_Print.DrawText((LPTSTR)(LPCTSTR)"定金单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12010. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12011. m_Print.SetFontFace(9, 1, "宋体");
  12012. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + strOrderNumber), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12013. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12014. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12015. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12016. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12017. m_Print.DrawRect2(StrRect, 2);
  12018. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12019. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12020. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12021. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12022. m_Print.DrawRect2(StrRect, 2);
  12023. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12024. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12025. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12026. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12027. m_Print.DrawRect2(StrRect, 2);
  12028. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12029. m_Print.DrawText((LPTSTR)(LPCTSTR)"预约地点:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12030. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12031. m_Print.DrawText((LPTSTR)(LPCTSTR)m_outside, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12032. m_Print.DrawRect2(StrRect, 2);
  12033. ////////////
  12034. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12035. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12036. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12037. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12038. m_Print.DrawRect2(StrRect, 2);
  12039. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12040. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12041. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12042. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12043. m_Print.DrawRect2(StrRect, 2);
  12044. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12045. m_Print.DrawText((LPTSTR)(LPCTSTR)"生日:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12046. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12047. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12048. m_Print.DrawRect2(StrRect, 2);
  12049. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12050. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12051. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12052. m_Print.DrawText((LPTSTR)(LPCTSTR)g_date, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12053. m_Print.DrawRect2(StrRect, 2);
  12054. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12055. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客地址:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12056. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12057. m_Print.DrawText((LPTSTR)(LPCTSTR)m_addr, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12058. m_Print.DrawRect2(StrRect, 2);
  12059. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12060. m_Print.DrawText((LPTSTR)(LPCTSTR)"大婚时间:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12061. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12062. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time3, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12063. m_Print.DrawRect2(StrRect, 2);
  12064. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12065. m_Print.DrawText((LPTSTR)(LPCTSTR)"QQ/MSN:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12066. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12067. m_Print.DrawText((LPTSTR)(LPCTSTR)m_qq, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12068. m_Print.DrawRect2(StrRect, 2);
  12069. CStringArray strarray;
  12070. strarray.Add("套系名称");
  12071. strarray.Add("总 额");
  12072. strarray.Add("定 金");
  12073. strarray.Add("余 款");
  12074. strarray.Add("摄影日期");
  12075. strarray.Add(m_taoxiname);
  12076. strarray.Add(m_money1);
  12077. strarray.Add(m_money2);
  12078. strarray.Add(m_money3);
  12079. strarray.Add(m_time2);
  12080. for (i = 25; i < 37; i++)
  12081. {
  12082. StrRect = load.m_rcarray.ElementAt(i);
  12083. m_Print.DrawRect2(StrRect, 1);
  12084. }
  12085. for (i = 25; i < 35; i++)
  12086. {
  12087. StrRect = load.m_rcarray.ElementAt(i);
  12088. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 25), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12089. }
  12090. StrRect = load.m_rcarray.ElementAt(35);
  12091. StrRect.left += 5;
  12092. StrRect.top += 5;
  12093. m_Print.DrawText((LPTSTR)(LPCTSTR)" 备 注:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_UP);
  12094. StrRect = load.m_rcarray.ElementAt(36);
  12095. CString str;
  12096. str.Format("金额(大写): %s 萬 %s 仟 %s 佰 %s 拾 %s 元整 ¥: %s 元 收银员: %s", \
  12097. GetHMoney(GetW(m_money2)), GetHMoney(GetK(m_money2)), GetHMoney(GetB(m_money2)), GetHMoney(GetS(m_money2)), GetHMoney(GetG(m_money2)), \
  12098. m_money2, g_user.name);
  12099. StrRect.left += 3;
  12100. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12101. StrRect = load.m_rcarray.ElementAt(38);
  12102. m_Print.DrawText((LPTSTR)(LPCTSTR)"营业员:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12103. StrRect = load.m_rcarray.ElementAt(39);
  12104. m_Print.DrawText((LPTSTR)(LPCTSTR)m_ren, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12105. m_Print.DrawRect2(StrRect, 2);
  12106. StrRect = load.m_rcarray.ElementAt(40);
  12107. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12108. StrRect = load.m_rcarray.ElementAt(41);
  12109. m_Print.DrawRect2(StrRect, 2);
  12110. StrRect = load.m_rcarray.ElementAt(42);
  12111. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12112. StrRect = load.m_rcarray.ElementAt(37);
  12113. str = "\
  12114. 顾客须知\r\n\
  12115. 首先感谢您选择挚爱婚纱摄影,进入本公司场所,请勿带摄影器材(面斥不雅)为了更好的服务更愉快的流程,请仔细阅读以下事项\r\n\
  12116. 1. 核对清楚套系内容,有任何特殊要求请与工作人员沟通,以文字注明生效.\r\n\
  12117. 2. 拍摄前请付清套系全款,另购买其它产品款项购买当天付清。\r\n\
  12118. 3. 拍摄完毕后15天内公司专人电话通知选相片,为了更好更专业的选出您要制作的产品,请不要带陪同(意见不一不便照顾)。\r\n\
  12119. 4. 选样文件因空间有限保留时间为60天删除(拍摄日起)成品以取件日后保管30天,30天后未来取件需收第天5天保管费,\
  12120. 为了对您负责请本人持单据取件,委托他人取件需带单据和委托人身份证。\r\n\
  12121. 5. 认真对待合同意义确认套系内容与制作内容一致,超出内容的自愿消费项目签名确认消费,恕不退还。\r\n\
  12122. 6. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12123. AutoDraw(m_Print, StrRect, str, 1.8);
  12124. PrintPreview dlg;
  12125. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12126. dlg.m_pDC = m_Print.GetPDC();
  12127. if (aa == 0)
  12128. {
  12129. if (dlg.DoModal() != IDOK)
  12130. return;
  12131. printcot = dlg.m_num;
  12132. }
  12133. //结束打印
  12134. m_Print.EndPage();
  12135. m_Print.EndPrint();
  12136. }
  12137. }
  12138. void CMainFrame::OnAutodelphoto()
  12139. {
  12140. // TODO: Add your command handler code here
  12141. if (g_user.bLongin == 0)
  12142. {
  12143. if (g_bNoLoginLia)
  12144. {
  12145. Login dlg;
  12146. dlg.SetLiaPath("5.lia");
  12147. dlg.DoModal();
  12148. }
  12149. else
  12150. {
  12151. Login3 dlg;
  12152. dlg.SetLiaPath("5.lia");
  12153. dlg.DoModal();
  12154. }
  12155. if (g_user.bLongin == 0)return;
  12156. }
  12157. if (IsHasRightsnew(49) == 0)return;
  12158. DelPhotoSet dlg;
  12159. dlg.DoModal();
  12160. }
  12161. void CMainFrame::Onphotomanage()
  12162. {
  12163. // TODO: Add your command handler code here
  12164. if (g_user.bLongin == 0)
  12165. {
  12166. if (g_bNoLoginLia)
  12167. {
  12168. Login dlg;
  12169. dlg.SetLiaPath("5.lia");
  12170. dlg.DoModal();
  12171. }
  12172. else
  12173. {
  12174. Login3 dlg;
  12175. dlg.SetLiaPath("5.lia");
  12176. dlg.DoModal();
  12177. }
  12178. if (g_user.bLongin == 0)return;
  12179. }
  12180. if (IsHasRightsnew(49) == 0)return;
  12181. ShowPic3 dlg;
  12182. dlg.DoModal();
  12183. }
  12184. void CMainFrame::OnCompanyinfo()
  12185. {
  12186. // TODO: Add your command handler code here
  12187. if (g_user.bLongin == 0)
  12188. {
  12189. if (g_bNoLoginLia)
  12190. {
  12191. Login dlg;
  12192. dlg.SetLiaPath("5.lia");
  12193. dlg.DoModal();
  12194. }
  12195. else
  12196. {
  12197. Login3 dlg;
  12198. dlg.SetLiaPath("5.lia");
  12199. dlg.DoModal();
  12200. }
  12201. if (g_user.bLongin == 0)return;
  12202. }
  12203. if (IsHasRightsnew(49) == 0)return;
  12204. CompanyInfo dlg;
  12205. dlg.DoModal();
  12206. }
  12207. void CMainFrame::OnTaoxifg()
  12208. {
  12209. // TODO: Add your command handler code here
  12210. if (g_user.bLongin == 0)
  12211. {
  12212. if (g_bNoLoginLia)
  12213. {
  12214. Login dlg;
  12215. dlg.SetLiaPath("5.lia");
  12216. dlg.DoModal();
  12217. }
  12218. else
  12219. {
  12220. Login3 dlg;
  12221. dlg.SetLiaPath("5.lia");
  12222. dlg.DoModal();
  12223. }
  12224. if (g_user.bLongin == 0)return;
  12225. }
  12226. if (IsHasRightsnew(49) == 0)return;
  12227. TXFG dlg;
  12228. dlg.DoModal();
  12229. }
  12230. void CMainFrame::OnHelpfile()
  12231. {
  12232. // TODO: Add your command handler code here
  12233. // ShellExecute(NULL, _T("open"), _T(g_mainpath+"\\帮助文档.chm"), "", NULL, SW_SHOWNORMAL);
  12234. // if(::PathFileExists (g_mainpath+"\\zx.dll"))
  12235. // ShellExecute(NULL, _T("open"), _T("www.zcsmkj.com"), "", NULL, SW_SHOWNORMAL);
  12236. // else
  12237. ShellExecute(NULL, _T("open"), _T("www.lyfz.net"), "", NULL, SW_SHOWNORMAL);
  12238. }
  12239. void CMainFrame::OnPhotobak()
  12240. {
  12241. // TODO: Add your command handler code here
  12242. if (g_user.bLongin == 0)
  12243. {
  12244. if (g_bNoLoginLia)
  12245. {
  12246. Login dlg;
  12247. dlg.SetLiaPath("5.lia");
  12248. dlg.DoModal();
  12249. }
  12250. else
  12251. {
  12252. Login3 dlg;
  12253. dlg.SetLiaPath("5.lia");
  12254. dlg.DoModal();
  12255. }
  12256. if (g_user.bLongin == 0)return;
  12257. }
  12258. if (IsHasRightsnew(49) == 0)return;
  12259. PhotoBak dlg;
  12260. dlg.DoModal();
  12261. }
  12262. //客户报表
  12263. void CMainFrame::OnClose2()
  12264. { // TODO: Add your message handler code here and/or call default
  12265. if (AfxMessageBox("是否退出系统?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  12266. WriteLog(_T("普通日志"), _T("退出系统"), g_user.name, _T("退出系统"));
  12267. g_bShowBar = 0;
  12268. if (m_Mdi.MainClose())
  12269. CMDIFrameWnd::OnClose();
  12270. }
  12271. //
  12272. void CMainFrame::ResetTimer()
  12273. {
  12274. }
  12275. void CMainFrame::LinkClick(CString str, int nParent)
  12276. {
  12277. g_pMainWnd2->m_bar.LinkClick(str);
  12278. }
  12279. void CMainFrame::PrintFlowChart2(CString m_id)
  12280. {
  12281. CPrintRX m_Print;
  12282. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12283. {
  12284. m_Print.InitToPrint(NULL, 1);
  12285. }
  12286. else
  12287. {
  12288. CString name = g_cominfoarray.ElementAt(0).ElementAt(64);
  12289. if (name.IsEmpty())
  12290. m_Print.InitToPrint(NULL, 1);
  12291. else
  12292. {
  12293. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12294. if (nret == -1)
  12295. {
  12296. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12297. }
  12298. }
  12299. }
  12300. m_Print.StartPrint();
  12301. m_Print.StartPage();
  12302. LoadRect load;
  12303. load.SetLiaPath("16.lia");
  12304. load.SetMargins(0, 0);
  12305. if (!load.Load())return;
  12306. LoadRect load2;
  12307. load2.SetLiaPath("17.lia");
  12308. load2.SetMargins(0, 660);
  12309. if (!load2.Load())return;
  12310. int i;
  12311. //////////////////////////////////////////////////////////////
  12312. CStringArray txarray;
  12313. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and kind<>'2'";
  12314. g_sendhead.code[0] = 11;
  12315. g_sendhead.code[1] = 52;
  12316. g_sendhead.code[2] = 223;
  12317. g_sendhead.tabcount = 3;
  12318. g_sendhead.bsql = 0;
  12319. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12320. CArray<CStringArray, CStringArray>sparray;
  12321. CArray<CStringArray, CStringArray>clientarray;
  12322. DataToArray(&g_List1array, &clientarray, &sparray);
  12323. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12324. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12325. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12326. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12327. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12328. CString m_photocount = g_List1array.ElementAt(0).ElementAt(9);
  12329. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12330. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12331. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12332. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12333. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12334. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12335. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12336. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12337. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12338. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12339. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12340. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12341. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12342. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12343. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12344. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12345. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12346. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12347. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12348. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12349. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12350. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12351. CString m_bz = "客人要求: " + g_List1array.ElementAt(0).ElementAt(39) + g_List1array.ElementAt(0).ElementAt(75);
  12352. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12353. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12354. CString spno;
  12355. for (i = 0; i < sparray.GetSize(); i++)
  12356. {
  12357. // if(sparray.ElementAt (i).ElementAt (6).IsEmpty ())continue;
  12358. if (sparray.ElementAt(i).ElementAt(4) == "4" && sparray.ElementAt(i).ElementAt(5) != "入册" && sparray.ElementAt(i).ElementAt(5) != "入底")continue;
  12359. if (sparray.ElementAt(i).ElementAt(5) == "入册"&&sparray.ElementAt(i).ElementAt(5) == "入底"&&sparray.ElementAt(i).ElementAt(6).IsEmpty())continue;
  12360. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12361. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12362. spno += sparray.ElementAt(i).ElementAt(5);
  12363. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12364. spno += "; ";
  12365. else
  12366. {
  12367. spno += ":";
  12368. spno += sparray.ElementAt(i).ElementAt(6);
  12369. spno += "; ";
  12370. }
  12371. }
  12372. spno += " 加挑:";
  12373. for (i = 0; i < sparray.GetSize(); i++)
  12374. {
  12375. if (sparray.ElementAt(i).ElementAt(4) != "4")continue;
  12376. if (sparray.ElementAt(i).ElementAt(5) == "入册")continue;
  12377. if (sparray.ElementAt(i).ElementAt(5) == "入底")continue;
  12378. if (sparray.ElementAt(i).ElementAt(5) == "底片光盘")continue;
  12379. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(136)) && sparray.ElementAt(i).ElementAt(6) == "")continue;
  12380. spno += sparray.ElementAt(i).ElementAt(5);
  12381. if (sparray.ElementAt(i).ElementAt(6).IsEmpty())
  12382. spno += "; ";
  12383. else
  12384. {
  12385. spno += ":";
  12386. spno += sparray.ElementAt(i).ElementAt(6);
  12387. spno += "; ";
  12388. }
  12389. }
  12390. if (spno.Right(6) == " 加挑:")
  12391. {
  12392. spno = spno.Left(spno.GetLength() - 6);
  12393. }
  12394. ////////////////////////////////////////////////////////////////
  12395. int rcpos = -1;
  12396. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12397. m_Print.SetFontFace(17, 1, "宋体");
  12398. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12399. StrRect.top -= 0;
  12400. StrRect.bottom -= 10;
  12401. StrRect.left -= 140;
  12402. StrRect.right = StrRect.left + 48;
  12403. m_Print.SetFontFace(15, 1, "宋体");
  12404. m_Print.SetColor(0xffffff);
  12405. m_Print.DrawRect(StrRect, 0);
  12406. m_Print.DrawText((LPTSTR)(LPCTSTR)" Honey", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12407. StrRect.left = StrRect.right;
  12408. StrRect.right = StrRect.left + 48;
  12409. m_Print.DrawRect(StrRect, RGB(255, 0, 0));
  12410. m_Print.SetColor(0, RGB(255, 0, 0));
  12411. m_Print.DrawText((LPTSTR)(LPCTSTR)" 挚 爱 ", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12412. m_Print.SetColor(0);
  12413. m_Print.SetFontFace(12, 1, "宋体");
  12414. StrRect.left -= 48;
  12415. int hei = StrRect.Height();
  12416. StrRect.top = StrRect.bottom + 2;
  12417. StrRect.bottom += hei + 2;
  12418. m_Print.DrawText((LPTSTR)(LPCTSTR)"挚爱婚纱精品摄影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12419. StrRect.top = StrRect.bottom - 2;
  12420. StrRect.bottom += hei - 5;
  12421. m_Print.DrawText((LPTSTR)(LPCTSTR)"www.gzhoney.com", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  12422. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12423. m_Print.SetFontFace(12, 1, "宋体");
  12424. m_Print.DrawText((LPTSTR)(LPCTSTR)"加做取件单", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12425. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12426. m_Print.SetFontFace(11, 1, "宋体");
  12427. m_Print.DrawText((LPTSTR)(LPCTSTR)("客户编号:" + m_id), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12428. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12429. m_Print.DrawText((LPTSTR)(LPCTSTR)"先生姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12430. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12431. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12432. m_Print.DrawRect2(StrRect, 2);
  12433. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12434. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12435. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12436. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12437. m_Print.DrawRect2(StrRect, 2);
  12438. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12439. m_Print.DrawText((LPTSTR)(LPCTSTR)"选片日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12440. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12441. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time4, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12442. m_Print.DrawRect2(StrRect, 2);
  12443. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12444. m_Print.DrawText((LPTSTR)(LPCTSTR)"取件日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12445. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12446. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time5, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12447. m_Print.DrawRect2(StrRect, 2);
  12448. ////////////
  12449. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12450. m_Print.DrawText((LPTSTR)(LPCTSTR)"女士姓名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12451. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12452. m_Print.DrawText((LPTSTR)(LPCTSTR)m_name2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12453. m_Print.DrawRect2(StrRect, 2);
  12454. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12455. m_Print.DrawText((LPTSTR)(LPCTSTR)"电话:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12456. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12457. m_Print.DrawText((LPTSTR)(LPCTSTR)m_phone2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12458. m_Print.DrawRect2(StrRect, 2);
  12459. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12460. m_Print.DrawText((LPTSTR)(LPCTSTR)"赠送张数:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12461. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12462. m_Print.DrawText((LPTSTR)(LPCTSTR)m_photocount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12463. m_Print.DrawRect2(StrRect, 2);
  12464. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12465. m_Print.DrawText((LPTSTR)(LPCTSTR)"开单日期:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12466. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12467. m_Print.DrawText((LPTSTR)(LPCTSTR)m_time1, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12468. m_Print.DrawRect2(StrRect, 2);
  12469. ////////////
  12470. ///////////spno
  12471. CRect sprc[22];
  12472. StrRect = load.m_rcarray.ElementAt(19);
  12473. StrRect.left += 4; StrRect.right -= 3;
  12474. hei = StrRect.Height();
  12475. for (i = 0; i < 22; i++)
  12476. {
  12477. sprc[i] = StrRect;
  12478. m_Print.DrawRect2(StrRect, 1);
  12479. if (i == 0)
  12480. {
  12481. StrRect.left += 5;
  12482. m_Print.DrawText((LPTSTR)(LPCTSTR)"全部套系内容:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12483. StrRect.left -= 5;
  12484. }
  12485. StrRect.top = StrRect.bottom;
  12486. StrRect.bottom = StrRect.top + hei;
  12487. sprc[i].left += 4; sprc[i].right -= 3;
  12488. }
  12489. StrRect.bottom = StrRect.top + 60;
  12490. m_Print.DrawRect2(StrRect, 1);
  12491. StrRect.left += 3; StrRect.top += 3;
  12492. StrRect.right -= 3; StrRect.bottom -= 3;
  12493. AutoDraw(m_Print, StrRect, m_bz, 1.8);
  12494. CString temp, tempspno, tempbz;
  12495. CSize size;
  12496. BOOL bRun = 0;
  12497. int fontsize = 12;
  12498. ll: tempspno = spno;
  12499. m_Print.SetFontFace(fontsize, 1, "宋体");
  12500. for (i = 1; i<22; i++)
  12501. {
  12502. if (!tempspno.IsEmpty())
  12503. {
  12504. temp = tempspno;
  12505. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12506. int right = 0;
  12507. CRect temprc = sprc[i];
  12508. while (size.cx>temprc.Width())
  12509. {
  12510. right++;
  12511. temp = tempspno.Left(tempspno.GetLength() - (right));
  12512. if (GIsHalfHZ(temp))
  12513. {
  12514. right++;
  12515. temp.Delete(temp.GetLength() - 1);
  12516. }
  12517. m_Print.GetStrSize((LPTSTR)(LPCTSTR)temp, size);
  12518. }
  12519. if (bRun)
  12520. m_Print.DrawText((LPTSTR)(LPCTSTR)temp, sprc[i], 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12521. tempspno = tempspno.Right(tempspno.GetLength() - temp.GetLength());
  12522. if (tempspno.IsEmpty())i++;
  12523. }
  12524. }
  12525. if (tempspno.IsEmpty() == 0)//|| tempbz.IsEmpty ()==0)
  12526. {
  12527. fontsize--;
  12528. goto ll;
  12529. }
  12530. if (bRun == 0)
  12531. {
  12532. bRun = 1;
  12533. goto ll;
  12534. }
  12535. m_Print.SetFontFace(12, 1, "宋体");
  12536. StrRect = load2.m_rcarray.ElementAt(1);
  12537. m_Print.DrawText((LPTSTR)(LPCTSTR)"喜事热线: 020-8666 8233 020-8667 8166", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12538. StrRect = load2.m_rcarray.ElementAt(2);
  12539. m_Print.DrawText((LPTSTR)(LPCTSTR)"地址: 广州市越秀区流花路120号东方宾馆一号楼首层 www.gzhoney.com", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12540. StrRect = load2.m_rcarray.ElementAt(3);
  12541. m_Print.DrawText((LPTSTR)(LPCTSTR)"顾客确认签名:", StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12542. StrRect = load2.m_rcarray.ElementAt(4);
  12543. m_Print.DrawRect2(StrRect, 2);
  12544. StrRect = load2.m_rcarray.ElementAt(0);
  12545. CString str = "\
  12546. 爱心提示:如对制作有任何要求请清楚列出,所有制作内容一经确认将按要求制作。\r\n\
  12547. 选样文件从拍摄日期计算将保留二个月;套相成品按取件日期保留三个月,逾期不做保留。\r\n\
  12548. 产品取件日期为45天(选相片那天算起)如要提前属急件,提前30天内需收10%的加急费。";
  12549. AutoDraw(m_Print, StrRect, str, 1.8);
  12550. PrintPreview dlg; dlg.m_mode = 2;
  12551. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12552. dlg.m_pDC = m_Print.GetPDC();
  12553. if (dlg.DoModal() != IDOK)return;
  12554. //结束打印
  12555. m_Print.EndPage();
  12556. m_Print.EndPrint();
  12557. }
  12558. //分店
  12559. CString CMainFrame::GetDanWei(CString name, CArray<CStringArray, CStringArray>*array)
  12560. {
  12561. for (int i = 0; i < array->GetSize(); i++)
  12562. {
  12563. if (name == array->ElementAt(i).ElementAt(1))
  12564. return array->ElementAt(i).ElementAt(2);
  12565. }
  12566. return "";
  12567. }
  12568. //g_sendhead
  12569. int CMainFrame::GetPort()
  12570. {
  12571. static int aaa = -1;
  12572. if (aaa == -1)
  12573. {
  12574. aaa = CTime::GetCurrentTime().GetSecond() % 7;
  12575. }
  12576. aaa++;
  12577. if (aaa >= 7)aaa = 0;
  12578. return 8387 + aaa;
  12579. }
  12580. void CMainFrame::OnShowBakState()
  12581. {
  12582. // TODO: Add your command handler code here
  12583. g_sendhead.bsql = 0;
  12584. g_sendhead.code[0] = 171;
  12585. g_sendhead.tabcount = 1;
  12586. g_pMainWnd->ProcessChatMessageRequest2(1);
  12587. if (g_bSendOK == 0)
  12588. {
  12589. return;
  12590. }
  12591. CArray<CStringArray, CStringArray>g_bakstatearray;
  12592. DataToArray(&g_bakstatearray);
  12593. while (g_bakstatearray.GetSize() > 7)
  12594. {
  12595. g_bakstatearray.RemoveAt(0);
  12596. }
  12597. int photocount = 0;
  12598. int infocount = 0;
  12599. for (int i = 0; i < g_bakstatearray.GetSize(); i++)
  12600. {
  12601. if (g_bakstatearray.ElementAt(i).ElementAt(1) != "1")photocount++;
  12602. if (g_bakstatearray.ElementAt(i).ElementAt(2) != "1")infocount++;
  12603. }
  12604. ShowBakState dlg;
  12605. dlg.m_pArray = &g_bakstatearray;
  12606. dlg.DoModal();
  12607. }
  12608. void CMainFrame::PrintReceipt2(CStringArray *pArray)
  12609. {
  12610. int printcot = 1;
  12611. for (int aa = 0; aa < printcot; aa++)
  12612. {
  12613. g_sendhead.bsql = 0;
  12614. g_sendhead.code[0] = 24;
  12615. g_sendhead.tabcount = 1;
  12616. int g_nYearposTemp = g_nYearpos;
  12617. g_nYearpos = -1;
  12618. g_pMainWnd->ProcessChatMessageRequest2(1);
  12619. g_nYearpos = g_nYearposTemp;
  12620. if (0 == g_bSendOK)return;
  12621. DataToArray(&g_cominfoarray);
  12622. CString SerialNo;
  12623. SerialNo.Format("SerialNo.%05d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  12624. CPrintRX m_Print;
  12625. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12626. {
  12627. m_Print.InitToPrint(NULL, 1);
  12628. }
  12629. else
  12630. {
  12631. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  12632. if (name.IsEmpty())
  12633. m_Print.InitToPrint(NULL, 1);
  12634. else
  12635. {
  12636. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12637. if (nret == -1 && aa == 0)
  12638. {
  12639. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12640. }
  12641. }
  12642. }
  12643. m_Print.StartPrint();
  12644. m_Print.StartPage();
  12645. LoadRect load;
  12646. BOOL bSmall = 0;
  12647. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(87)))//小单
  12648. {
  12649. bSmall = 1;
  12650. load.SetLiaPath("20.lia");
  12651. }
  12652. else
  12653. load.SetLiaPath("10.lia");
  12654. if (bSmall)
  12655. load.SetMargins(-10, 0);
  12656. else
  12657. load.SetMargins(10, 0);
  12658. if (!load.Load())return;
  12659. int rcpos = -1;
  12660. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12661. Image *pImg = NULL;
  12662. #ifdef MNLS_VERSION
  12663. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  12664. #else
  12665. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  12666. #endif
  12667. // m_Print.DrawImage(pImg, StrRect);
  12668. delete pImg;
  12669. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(139)))
  12670. {
  12671. Image *pImg = NULL;
  12672. g_nSendCode = 31;
  12673. int g_nYearposTemp = g_nYearpos;
  12674. g_nYearpos = -1;
  12675. g_pMainWnd->ProcessChatMessageRequest2(1);
  12676. g_nYearpos = g_nYearposTemp;
  12677. g_nSendCode = 0;
  12678. if (g_bSendOK == 0)return;
  12679. ::LoadImageFromBuf(&pImg, g_pData, g_nLeng);
  12680. if (pImg)
  12681. {
  12682. StrRect.left = 65;
  12683. if (bSmall)StrRect.left = 55;
  12684. StrRect.top = 10;
  12685. StrRect.right = StrRect.left + 58;
  12686. StrRect.bottom = StrRect.top + 58;
  12687. m_Print.DrawImage(pImg, StrRect);
  12688. delete pImg; pImg = NULL;
  12689. }
  12690. }
  12691. if (bSmall)
  12692. {
  12693. m_Print.SetFontFace(18, 1, "黑体");
  12694. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12695. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12696. m_Print.SetFontFace(9, 1, "宋体");
  12697. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12698. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12699. m_Print.SetFontFace(6, 1, "宋体");
  12700. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12701. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12702. m_Print.SetFontFace(9, 1, "宋体");
  12703. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12704. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12705. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12706. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12707. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12708. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12709. int hei = StrRect.Height();
  12710. StrRect.bottom = StrRect.top;
  12711. StrRect.top -= 8;
  12712. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  12713. m_Print.SetFontFace(10, 1, "宋体");
  12714. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12715. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12716. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12717. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12718. m_Print.SetFontFace(9, 1, "宋体");
  12719. int i = 0;
  12720. for ( i = 7; i < 24; i++)
  12721. {
  12722. StrRect = load.m_rcarray.ElementAt(i);
  12723. m_Print.DrawRect2(StrRect, 1);
  12724. }
  12725. for (i = 9; i < 24; i++)
  12726. {
  12727. StrRect = load.m_rcarray.ElementAt(i);
  12728. StrRect.left += 2;
  12729. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12730. }
  12731. m_Print.SetFontFace(6, 1, "宋体");
  12732. for (i = 24; i < 26; i++)
  12733. {
  12734. StrRect = load.m_rcarray.ElementAt(i);
  12735. StrRect.left += 2;
  12736. if (i == 24)
  12737. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12738. else
  12739. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12740. }
  12741. }
  12742. else//大单
  12743. {
  12744. m_Print.SetFontFace(20, 1, "黑体");
  12745. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12746. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12747. m_Print.SetFontFace(11, 1, "宋体");
  12748. // StrRect=load.m_rcarray .ElementAt (++rcpos);
  12749. // m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt (rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12750. StrRect = load.m_rcarray.ElementAt(++rcpos); StrRect.right -= 15;
  12751. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12752. int hei = StrRect.Height();
  12753. StrRect.bottom = StrRect.top;
  12754. StrRect.top -= 10;
  12755. m_Print.DrawText((LPTSTR)(LPCTSTR)SerialNo, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_BOTTOM);
  12756. m_Print.SetFontFace(8, 1, "宋体");
  12757. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12758. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12759. m_Print.SetFontFace(11, 1, "宋体");
  12760. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12761. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12762. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12763. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12764. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12765. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12766. m_Print.SetFontFace(13, 1, "宋体");
  12767. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12768. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12769. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12770. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(rcpos), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12771. m_Print.SetFontFace(11, 1, "宋体");
  12772. int i = 0;
  12773. for ( i = 7; i < 24; i++)
  12774. {
  12775. StrRect = load.m_rcarray.ElementAt(i);
  12776. m_Print.DrawRect2(StrRect, 1);
  12777. }
  12778. for (i = 9; i < 24; i++)
  12779. {
  12780. StrRect = load.m_rcarray.ElementAt(i);
  12781. StrRect.left += 2;
  12782. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12783. }
  12784. m_Print.SetFontFace(8, 1, "宋体");
  12785. for (i = 24; i < 27; i++)
  12786. {
  12787. StrRect = load.m_rcarray.ElementAt(i);
  12788. StrRect.left += 2;
  12789. m_Print.DrawText((LPTSTR)(LPCTSTR)pArray->ElementAt(i), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12790. }
  12791. }
  12792. PrintPreview dlg;
  12793. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  12794. dlg.m_pDC = m_Print.GetPDC();
  12795. if (aa == 0)
  12796. {
  12797. if (dlg.DoModal() != IDOK)
  12798. return;
  12799. printcot = dlg.m_num;
  12800. }
  12801. //结束打印
  12802. m_Print.EndPage();
  12803. m_Print.EndPrint();
  12804. SerialNo.Format("%d", atoi(g_cominfoarray.ElementAt(0).ElementAt(127)) + 1);
  12805. CString sql;
  12806. sql.Format("update version set [serialno2]='%s'", SerialNo);
  12807. g_sendhead.bsql = 1;
  12808. g_nYearposTemp = g_nYearpos;
  12809. g_nYearpos = -1;
  12810. g_pMainWnd->ProcessChatMessageRequest2(sql);
  12811. g_nYearpos = g_nYearposTemp;
  12812. }
  12813. }
  12814. //出生年月
  12815. //第一联
  12816. void CMainFrame::OnLog()
  12817. {
  12818. // TODO: Add your command handler code here OnShowBakState
  12819. if (IsHasRightsnew(49) == 0)return;
  12820. ShowLOg dlg;
  12821. dlg.DoModal();
  12822. }
  12823. // www.lyfz.net 8888
  12824. void CMainFrame::PrintDinDan6(CString m_id)
  12825. {
  12826. // TODO: Add your control notification handler code here 预约订单
  12827. int printcot = 1;
  12828. for (int aa = 0; aa < printcot; aa++)
  12829. {
  12830. PrintPreview dlg;
  12831. CPrintRX m_Print;
  12832. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  12833. {
  12834. m_Print.InitToPrint(NULL, 1);
  12835. }
  12836. else
  12837. {
  12838. CString name = g_cominfoarray.ElementAt(0).ElementAt(63);
  12839. if (name.IsEmpty())
  12840. m_Print.InitToPrint(NULL, 1);
  12841. else
  12842. {
  12843. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  12844. if (nret == -1 && aa == 0)
  12845. {
  12846. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  12847. }
  12848. }
  12849. }
  12850. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(66)) == 3)
  12851. {
  12852. m_Print.StartPrint();
  12853. m_Print.StartPage();
  12854. LoadRect load;
  12855. load.SetLiaPath("6.lia");
  12856. load.SetMargins(-14, 15);
  12857. if (!load.Load())return;
  12858. LoadRect load2;
  12859. load2.SetLiaPath("7.lia");
  12860. load2.SetMargins(-14, 216 + 15);
  12861. if (!load2.Load())return;
  12862. LoadRect load3;
  12863. load3.SetLiaPath("8.lia");
  12864. load3.SetMargins(-14, 705 + 15);
  12865. if (!load3.Load())return;
  12866. int i;
  12867. //////////////////////////////////////////////////////////////
  12868. CStringArray txarray;
  12869. CString filter = "id='" + m_id + "';id='" + m_id + "';id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  12870. g_sendhead.code[0] = 11;
  12871. g_sendhead.code[1] = 52;
  12872. g_sendhead.code[2] = 50;
  12873. g_sendhead.code[3] = 150;
  12874. g_sendhead.code[4] = 77;
  12875. g_sendhead.code[5] = 4;
  12876. g_sendhead.tabcount = 6;
  12877. g_sendhead.bsql = 0;
  12878. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  12879. CArray<CStringArray, CStringArray>sparray;
  12880. CArray<CStringArray, CStringArray>clientarray;
  12881. CArray<CStringArray, CStringArray>phonearray;
  12882. CArray<CStringArray, CStringArray>fgarray;
  12883. CArray<CStringArray, CStringArray>danweiarray;
  12884. CArray<CStringArray, CStringArray>jdarray;
  12885. DataToArray(&g_List1array, &clientarray, &sparray, &jdarray, &fgarray, &danweiarray);
  12886. CString m_money1 = g_List1array.ElementAt(0).ElementAt(1);
  12887. CString m_money2 = g_List1array.ElementAt(0).ElementAt(2);
  12888. CString m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  12889. CString m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  12890. CString m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  12891. CString m_zs = g_List1array.ElementAt(0).ElementAt(9);
  12892. CString m_taoxiname;
  12893. if (m_zs.Find("\\") != -1)
  12894. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底\\入册:" + g_List1array.ElementAt(0).ElementAt(9);
  12895. else
  12896. m_taoxiname = g_List1array.ElementAt(0).ElementAt(7) + " 入底:" + g_List1array.ElementAt(0).ElementAt(9);
  12897. CString m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  12898. CString m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  12899. CString m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  12900. CString m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  12901. CString m_ren = g_List1array.ElementAt(0).ElementAt(14);
  12902. CString m_discount = g_List1array.ElementAt(0).ElementAt(15);
  12903. CString m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  12904. CString m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  12905. CString m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  12906. CString m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  12907. CString m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  12908. CString m_time4 = g_List1array.ElementAt(0).ElementAt(21);
  12909. CString m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  12910. CString m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  12911. CString m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  12912. CString m_outside = g_List1array.ElementAt(0).ElementAt(28);
  12913. CString m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  12914. CString m_style = g_List1array.ElementAt(0).ElementAt(30);
  12915. CString m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  12916. CString m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  12917. CString m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  12918. CString m_bz = g_List1array.ElementAt(0).ElementAt(38);
  12919. if (jdarray.GetSize())
  12920. {
  12921. if (m_bz.IsEmpty() == 0)
  12922. m_bz = "\r\n" + m_bz;
  12923. m_bz += "景点:";
  12924. }
  12925. for (i = 0; i < jdarray.GetSize(); i++)
  12926. {
  12927. m_bz += jdarray.ElementAt(i).ElementAt(1) + ";";
  12928. }
  12929. m_bz.TrimRight(";");
  12930. CString m_phone1 = clientarray.ElementAt(0).ElementAt(3);
  12931. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  12932. if (IsHasRights2new(31) == 0)
  12933. {
  12934. m_phone1 = "***";
  12935. m_phone2 = "***";
  12936. }
  12937. CString m_addr1 = clientarray.ElementAt(0).ElementAt(7);
  12938. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  12939. CString m_occupation1 = clientarray.ElementAt(0).ElementAt(9);
  12940. CString m_occupation2 = clientarray.ElementAt(0).ElementAt(10);
  12941. CString m_sex = clientarray.ElementAt(0).ElementAt(18);
  12942. CString m_birthday = clientarray.ElementAt(0).ElementAt(11);
  12943. filter = "staff_name='" + m_ren + "'";
  12944. g_sendhead.code[0] = 5;
  12945. g_sendhead.tabcount = 1;
  12946. g_sendhead.bsql = 0;
  12947. int g_nYearposTemp = g_nYearpos;
  12948. g_nYearpos = -1;
  12949. g_pMainWnd->ProcessChatMessageRequest2(filter);
  12950. g_nYearpos = g_nYearposTemp;
  12951. if (g_bSendOK == 0)return;
  12952. DataToArray(&phonearray);
  12953. m_money1.Format("%f", atof(m_taoxijiage));
  12954. m_money2.Format("%f", atof(m_payed1));
  12955. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  12956. ConvertToPrice(m_money1);
  12957. ConvertToPrice(m_money2);
  12958. ConvertToPrice(m_money3);
  12959. ////////////////////////////////////////////////////////////////
  12960. int rcpos = -1;
  12961. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  12962. StrRect.top -= 15; StrRect.bottom -= 15;
  12963. Image *pImg = NULL;
  12964. #ifdef MNLS_VERSION
  12965. LoadImageFromRes(&pImg, MAKEINTRESOURCE(IDR_JPG1), _T("JPG"));
  12966. #else
  12967. ::LoadImageFromBuf(&pImg, g_mainpath + "\\图片\\logo.jpg");
  12968. #endif
  12969. m_Print.DrawImage(pImg, StrRect);
  12970. delete pImg;
  12971. m_Print.SetFontFace(11, 1, "宋体");
  12972. StrRect = load.m_rcarray.ElementAt(20);
  12973. StrRect.right = load.m_rcarray.ElementAt(23).right;
  12974. StrRect.top -= 18; StrRect.bottom -= 18;
  12975. CString str = "地址:" + g_cominfoarray.ElementAt(0).ElementAt(12);
  12976. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  12977. str = "电话:" + g_cominfoarray.ElementAt(0).ElementAt(11);
  12978. m_Print.DrawText((LPTSTR)(LPCTSTR)str, StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  12979. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12980. StrRect.top -= 15; StrRect.bottom -= 15;
  12981. #ifdef MNLS_VERSION
  12982. m_Print.DrawText((LPTSTR)(LPCTSTR)"婚 纱 摄 影", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12983. #endif
  12984. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12985. StrRect.top -= 15; StrRect.bottom -= 15;
  12986. #ifdef MNLS_VERSION
  12987. m_Print.DrawRect(StrRect);
  12988. #endif
  12989. m_Print.SetFontFace(7, 1, "黑体");
  12990. m_Print.SetColor(0xffffff);
  12991. #ifdef MNLS_VERSION
  12992. m_Print.DrawText((LPTSTR)(LPCTSTR)"佳 美 女 人 坊 艺 术 摄 影 机 构", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12993. #endif
  12994. m_Print.SetColor(0);
  12995. m_Print.SetFontFace(15, 1, "宋体");
  12996. StrRect = load.m_rcarray.ElementAt(++rcpos);
  12997. StrRect.top -= 15; StrRect.bottom -= 15;
  12998. m_Print.DrawText((LPTSTR)(LPCTSTR)"(套系合同拍摄单)", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  12999. CStringArray strarray;
  13000. strarray.Add("NO: " + m_id);
  13001. CString date;
  13002. date.Format("%s年%s月%s日", g_date.Mid(0, 4), g_date.Mid(5, 2), g_date.Mid(8, 2));
  13003. strarray.Add(date);
  13004. strarray.Add("喜爱");
  13005. strarray.Add("格调");
  13006. if (fgarray.GetSize() == 12)
  13007. {
  13008. for (int i = 0; i < 12; i++)
  13009. strarray.Add(fgarray.ElementAt(i).ElementAt(0));
  13010. }
  13011. else
  13012. {
  13013. strarray.Add("复古典雅");
  13014. strarray.Add("温文尔雅");
  13015. strarray.Add("豪华艳丽");
  13016. strarray.Add("传统大方");
  13017. strarray.Add("新潮个性");
  13018. strarray.Add("浪漫奔放");
  13019. strarray.Add("简单素雅");
  13020. strarray.Add("活泼俏丽");
  13021. strarray.Add("妩媚温馨");
  13022. strarray.Add("温柔贤惠");
  13023. strarray.Add("成熟感性");
  13024. strarray.Add("清纯可爱");
  13025. }
  13026. strarray.Add("姓名");
  13027. // strarray.Add("职业");
  13028. strarray.Add("");
  13029. strarray.Add("地址");
  13030. strarray.Add("电话");
  13031. #ifdef CHILD_VERSION
  13032. strarray.Add("家长");
  13033. strarray.Add("宝宝");
  13034. #else
  13035. strarray.Add("先生");
  13036. strarray.Add("女士");
  13037. #endif
  13038. m_Print.SetFontFace(11, 1, "宋体");
  13039. for (i = 0; i < strarray.GetSize(); i++)
  13040. {
  13041. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13042. if (i < 2)
  13043. {
  13044. StrRect.top -= 15; StrRect.bottom -= 15;
  13045. }
  13046. if (i>15)
  13047. m_Print.DrawRect2(StrRect, 1);
  13048. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13049. }
  13050. for (i = 29; i <= 40; i++)
  13051. {
  13052. if (m_style.GetLength() <= (i - 29))continue;
  13053. if (m_style.GetAt(i - 29) != '1')continue;
  13054. StrRect = load.m_rcarray.ElementAt(i - 1);
  13055. m_Print.DrawText((LPTSTR)(LPCTSTR)"√", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13056. }
  13057. for (i = 27; i <= 48; i++)
  13058. {
  13059. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13060. m_Print.DrawRect2(StrRect, 1);
  13061. }
  13062. #ifdef CHILD_VERSION
  13063. StrRect = load.m_rcarray.ElementAt(45);
  13064. StrRect.right = StrRect.left + 62;
  13065. m_Print.DrawRect2(StrRect, 1);
  13066. m_Print.DrawText((LPTSTR)(LPCTSTR)"性别", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13067. StrRect.left = StrRect.right;
  13068. StrRect.right = StrRect.left + 62;
  13069. m_Print.DrawRect2(StrRect, 1);
  13070. m_Print.DrawText((LPTSTR)(LPCTSTR)m_sex, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13071. StrRect.left = StrRect.right;
  13072. StrRect.right = StrRect.left + 62;
  13073. m_Print.DrawRect2(StrRect, 1);
  13074. m_Print.DrawText((LPTSTR)(LPCTSTR)"出生日期", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13075. StrRect.left = StrRect.right;
  13076. StrRect.right = StrRect.left + 62;
  13077. m_Print.DrawRect2(StrRect, 1);
  13078. m_Print.DrawText((LPTSTR)(LPCTSTR)m_birthday, StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13079. #endif
  13080. /////////////////////////
  13081. strarray.RemoveAll();
  13082. CString temp;
  13083. temp.Format("拍摄多款选 %d 款,其中影", atoi(m_outside) + atoi(m_outside2));
  13084. strarray.Add(temp);
  13085. temp.Format("棚景 %d 款,景点 %d 款.", atoi(m_outside2), atoi(m_outside));
  13086. strarray.Add(temp);
  13087. strarray.Add("化妆");
  13088. strarray.Add("造型");
  13089. #ifdef CHILD_VERSION
  13090. strarray.Add("");
  13091. #else
  13092. strarray.Add("婚纱");
  13093. #endif
  13094. strarray.Add("服饰");
  13095. strarray.Add("配");
  13096. strarray.Add("置");
  13097. strarray.Add("其");
  13098. strarray.Add("它");
  13099. strarray.Add("套系名称");
  13100. strarray.Add("镜款");
  13101. strarray.Add("套系总价");
  13102. strarray.Add("主摄影师");
  13103. strarray.Add("拍摄日期");
  13104. strarray.Add("定金");
  13105. #ifdef CHILD_VERSION
  13106. strarray.Add("主引导师");
  13107. #else
  13108. strarray.Add("主化妆师");
  13109. #endif
  13110. strarray.Add("看样日期");
  13111. strarray.Add("补 余 款");
  13112. strarray.Add("总监");
  13113. strarray.Add("取件日期");
  13114. rcpos = -1;
  13115. for (i = 0; i < strarray.GetSize(); i++)
  13116. {
  13117. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13118. if (i>9)
  13119. m_Print.DrawRect2(StrRect, 1);
  13120. #ifdef CHILD_VERSION
  13121. if (i == 5)
  13122. StrRect.top -= StrRect.Height();
  13123. #endif
  13124. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13125. }
  13126. for (i = 22; i <= 41; i++)
  13127. {
  13128. StrRect = load2.m_rcarray.ElementAt(++rcpos);
  13129. m_Print.DrawRect2(StrRect, 1);
  13130. }
  13131. /////////////////////////////
  13132. strarray.RemoveAll();
  13133. #ifdef CHILD_VERSION
  13134. strarray.Add("顾客方 家长:");
  13135. strarray.Add("宝宝:");
  13136. #else
  13137. strarray.Add("顾客方 先生:");
  13138. strarray.Add("女士:");
  13139. #endif
  13140. strarray.Add("电话:");
  13141. strarray.Add("影楼方 店长:");
  13142. strarray.Add("接单人:");
  13143. strarray.Add("电话:");
  13144. rcpos = -1;
  13145. for (i = 0; i < strarray.GetSize(); i++)
  13146. {
  13147. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13148. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13149. }
  13150. for (i = 7; i <= 12; i++)
  13151. {
  13152. StrRect = load3.m_rcarray.ElementAt(++rcpos);
  13153. // if(i!=10)
  13154. m_Print.DrawRect2(StrRect, 2);
  13155. }
  13156. //////////////////////////////////////
  13157. //开始打数据
  13158. strarray.RemoveAll();
  13159. strarray.Add(m_name1);
  13160. strarray.Add(m_name2);
  13161. strarray.Add("");
  13162. strarray.Add("");
  13163. strarray.Add(m_addr1);
  13164. #ifdef CHILD_VERSION
  13165. strarray.Add("");
  13166. #else
  13167. strarray.Add(m_addr2);
  13168. #endif
  13169. strarray.Add(m_phone1);
  13170. strarray.Add(m_phone2);
  13171. for (i = 41; i <= 48; i++)
  13172. {
  13173. StrRect = load.m_rcarray.ElementAt(i - 1);
  13174. StrRect.left += 4;
  13175. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 41), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13176. }
  13177. ///////////////////////////////
  13178. strarray.RemoveAll();
  13179. strarray.Add(m_money1);
  13180. strarray.Add(m_waiter1);
  13181. strarray.Add(m_time2);
  13182. strarray.Add(m_money2);
  13183. strarray.Add(m_waiter2);
  13184. strarray.Add(m_time4);
  13185. strarray.Add(m_money3);
  13186. strarray.Add("");
  13187. strarray.Add(m_time5);
  13188. for (i = 32; i <= 40; i++)
  13189. {
  13190. StrRect = load2.m_rcarray.ElementAt(i - 1);
  13191. StrRect.left += 4;
  13192. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 32), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13193. }
  13194. ///////////////////////////////
  13195. strarray.RemoveAll();
  13196. strarray.Add("");//m_name1);
  13197. strarray.Add("");//m_name2);
  13198. CString phone;
  13199. if (m_phone1.IsEmpty() == 0)
  13200. phone = m_phone1 + ",";
  13201. phone += m_phone2;
  13202. phone.TrimRight(",");
  13203. strarray.Add("");//phone);
  13204. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(14));
  13205. strarray.Add(m_ren);
  13206. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13207. for (i = 7; i <= 12; i++)
  13208. {
  13209. StrRect = load3.m_rcarray.ElementAt(i - 1);
  13210. StrRect.left += 4;
  13211. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 7), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13212. }
  13213. StrRect = load2.m_rcarray.ElementAt(26); StrRect.left += 4;
  13214. m_Print.DrawText((LPTSTR)(LPCTSTR)m_taoxiname, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13215. StrRect = load2.m_rcarray.ElementAt(27); StrRect.left += 4;
  13216. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount2, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13217. StrRect = load2.m_rcarray.ElementAt(28); StrRect.left += 4;
  13218. m_Print.DrawText((LPTSTR)(LPCTSTR)m_clothescount, StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13219. //////////////////////////////
  13220. //开始画文字
  13221. StrRect = load2.m_rcarray.ElementAt(30);
  13222. StrRect.left += 3;
  13223. StrRect.top += 3;
  13224. StrRect.right -= 2;
  13225. StrRect.bottom -= 2;
  13226. AutoDraw(m_Print, StrRect, m_bz, 1.4);
  13227. StrRect = load2.m_rcarray.ElementAt(29);
  13228. StrRect.left += 3;
  13229. StrRect.top += 3;
  13230. StrRect.right -= 2;
  13231. StrRect.bottom -= 2;
  13232. str = "";
  13233. for (i = 0; i < sparray.GetSize(); i++)
  13234. {
  13235. str += sparray.ElementAt(i).ElementAt(5);
  13236. str += " 数量:";
  13237. str += sparray.ElementAt(i).ElementAt(3);
  13238. str += GetDanWei(sparray.ElementAt(i).ElementAt(5), &danweiarray);
  13239. str += "\r\n";
  13240. }
  13241. str.TrimRight("\r\n");
  13242. AutoDraw(m_Print, StrRect, str, 1.4);
  13243. StrRect = load2.m_rcarray.ElementAt(40);
  13244. StrRect.top += 8;
  13245. m_Print.SetFontFace(12, 1, "黑体");
  13246. m_Print.DrawText((LPTSTR)(LPCTSTR)"温馨提示", StrRect, 0, 0, FORMAT_HCENTER | FORMAT_UP);
  13247. StrRect.left += 3;
  13248. StrRect.top += 30;
  13249. StrRect.right -= 2;
  13250. StrRect.bottom -= 2;
  13251. str = g_cominfoarray.ElementAt(0).ElementAt(37);
  13252. if (str.IsEmpty())
  13253. {
  13254. str = "\
  13255. 1. 感谢您俩对我影楼的信任与青睐, 为了给您俩设\
  13256. 计好整体形象, 保证您俩拍摄效果的完善, 请配合我们\
  13257. 严谨的工作态度, 仔细阅读顾客须知.\r\n\
  13258. 2. 接近拍照日期请勿多晒太阳, 不要劳累, 尽量保\
  13259. 持良好的心境.\r\n\
  13260. 3. 拍照前一晚请少喝水, 睡眠一定要充足, 洗干净\
  13261. 头发, 勿使用任何发胶, 发膏. 先生请刮胡子.\r\n\
  13262. 4. 拍照当天请勿化妆, 女士应穿前开口上衣, 勿穿\
  13263. 套头上衣, 以免换婚纱时影响化好的妆与做好的发型.\r\n\
  13264. 5. 拍照时请勿带贵重物品, 以免丢失, 随行人员请\
  13265. 勿进影室, 以免影响拍摄.\r\n\
  13266. 6. 拍照时如有特殊要求或有异议时, 请当面与摄影\
  13267. 师或店长沟通.\r\n\
  13268. 7. 为了您俩有更大的选择款式, 本影楼所拍片该套\
  13269. 系所定数量多出一倍左右, 多片您俩若也要, 每款__\
  13270. 元. 其余照片和存底本影楼只保存__个月.\r\n\
  13271. 8. 配置内容应由所预约套系款数里挑选.\r\n\
  13272. 9. 本合同余额欠款须在拍照前付清.\r\n\
  13273. 10. 本合同预约单加盖本影楼公章方有效, 顾客方\
  13274. 签名后视为有效合同. 预约__个月内有效, 预约金不退\
  13275. 还.";
  13276. }
  13277. AutoDraw(m_Print, StrRect, str, 1.8);
  13278. }
  13279. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13280. dlg.m_pDC = m_Print.GetPDC();
  13281. dlg.m_mode = 1;
  13282. if (aa == 0)
  13283. {
  13284. if (dlg.DoModal() != IDOK)
  13285. return;
  13286. printcot = dlg.m_num;
  13287. }
  13288. //结束打印
  13289. m_Print.EndPage();
  13290. m_Print.EndPrint();
  13291. }
  13292. }
  13293. void CMainFrame::InsideMsg()
  13294. {
  13295. ///内部消息
  13296. CString str;
  13297. g_sendhead.bsql = 0;
  13298. g_sendhead.code[0] = 126;
  13299. g_sendhead.tabcount = 1;
  13300. g_bNoConnDlg = 1;
  13301. g_pMainWnd->ProcessChatMessageRequest2(1); g_bNoConnDlg = 0;
  13302. if (g_bSendOK == 0)return;
  13303. CArray<CStringArray, CStringArray>m_List1array;
  13304. DataToArray(&g_List1array);//, &m_List1array);
  13305. m_List1array.SetSize(g_List1array.GetSize());
  13306. int i = 0;
  13307. for ( i = 0; i < g_List1array.GetSize(); i++)
  13308. {
  13309. m_List1array.ElementAt(i).Copy(g_List1array.ElementAt(i));
  13310. }
  13311. str = "," + g_user.name + ",";
  13312. for (i = g_List1array.GetSize() - 1; i >= 0; i--)
  13313. {
  13314. CString receivers2 = g_List1array.ElementAt(i).ElementAt(4);
  13315. receivers2.TrimLeft(",");
  13316. receivers2.TrimRight(",");
  13317. receivers2 = "," + receivers2 + ",";
  13318. CString receivers = g_List1array.ElementAt(i).ElementAt(3);
  13319. receivers.TrimLeft(",");
  13320. receivers.TrimRight(",");
  13321. receivers = "," + receivers + ",";
  13322. if (receivers.Find(str) == -1)
  13323. g_List1array.RemoveAt(i);
  13324. else if (receivers2.Find(str) != -1)
  13325. g_List1array.RemoveAt(i);
  13326. }
  13327. if (g_List1array.GetSize())
  13328. {
  13329. ShowMsg dlg;
  13330. dlg.DoModal();
  13331. }
  13332. for (i = m_List1array.GetSize() - 1; i >= 0; i--)
  13333. {
  13334. CString receivers2 = m_List1array.ElementAt(i).ElementAt(4);
  13335. receivers2.TrimLeft(",");
  13336. receivers2.TrimRight(",");
  13337. receivers2 = "," + receivers2 + ",";
  13338. CString receivers = m_List1array.ElementAt(i).ElementAt(3);
  13339. if (receivers != "")
  13340. m_List1array.RemoveAt(i);
  13341. else if (receivers2.Find(str) != -1)
  13342. m_List1array.RemoveAt(i);
  13343. }
  13344. if (m_List1array.GetSize())
  13345. {
  13346. SendInsideMsg2 dlg;
  13347. dlg.m_bShow = 1;
  13348. dlg.m_pArray = &m_List1array;
  13349. dlg.DoModal();
  13350. }
  13351. }
  13352. //定金
  13353. void CMainFrame::PrintHireDress(CString strOrderNumber) // 打印礼服出租单;
  13354. {
  13355. int printcot = 1;
  13356. for (int aa = 0; aa < printcot; aa++)
  13357. {
  13358. CPrintRX m_Print;
  13359. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13360. {
  13361. m_Print.InitToPrint(NULL, 1);
  13362. }
  13363. else
  13364. {
  13365. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13366. if (name.IsEmpty())
  13367. m_Print.InitToPrint(NULL, 1);
  13368. else
  13369. {
  13370. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13371. if (nret == -1 && aa == 0)
  13372. {
  13373. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  13374. }
  13375. }
  13376. }
  13377. m_Print.StartPrint();
  13378. m_Print.StartPage();
  13379. LoadRect load;
  13380. load.SetLiaPath("21.lia");
  13381. load.SetMargins(0, 0);
  13382. if (!load.Load())
  13383. {
  13384. return;
  13385. }
  13386. int i;
  13387. //////////////////////////////////////////////////////////////
  13388. //CString filter="id='"+strOrderNumber+"';id='"+strOrderNumber+"';id='"+strOrderNumber+"'";
  13389. CString strFilter;
  13390. strFilter.Format("id='%s';id='%s';id='%s'", strOrderNumber, strOrderNumber, strOrderNumber);
  13391. g_sendhead.bsql = 0;
  13392. g_sendhead.code[0] = 73;
  13393. g_sendhead.code[1] = 74;
  13394. g_sendhead.code[2] = 52;
  13395. g_sendhead.tabcount = 3;
  13396. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  13397. if (g_bSendOK == 0)
  13398. {
  13399. return;
  13400. }
  13401. CArray<CStringArray, CStringArray>dresshirearray;
  13402. CArray<CStringArray, CStringArray>dresshiredataarray;
  13403. CArray<CStringArray, CStringArray>clientarray;
  13404. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13405. if (dresshirearray.GetSize() == 0)
  13406. {
  13407. return;
  13408. }
  13409. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10);
  13410. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7);
  13411. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8);
  13412. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6);
  13413. if (clientarray.GetSize() == 0)
  13414. {
  13415. return;
  13416. }
  13417. //AfxMessageBox("打印礼服出租单-()");
  13418. CString m_name2 = clientarray.ElementAt(0).ElementAt(2);
  13419. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13420. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13421. CString m_time3 = clientarray.ElementAt(0).ElementAt(20);
  13422. //#if JEFF_TEST
  13423. // if ( dresshiredataarray.GetSize() == 0 )
  13424. // {
  13425. // AfxMessageBox("没衣服");
  13426. // }
  13427. //#endif
  13428. CString sItem;
  13429. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13430. {
  13431. sItem += dresshiredataarray.ElementAt(i).ElementAt(1);
  13432. sItem += " ";
  13433. sItem += dresshiredataarray.ElementAt(i).ElementAt(2);
  13434. sItem += " 数量:";
  13435. sItem += dresshiredataarray.ElementAt(i).ElementAt(3);
  13436. sItem += " 金额:";
  13437. sItem += dresshirearray.ElementAt(i).ElementAt(1);
  13438. sItem += " 押金:";
  13439. sItem += dresshirearray.ElementAt(i).ElementAt(2) + "\r\n";
  13440. }
  13441. ////////////////////////////////////////////////////////////////
  13442. int rcpos = -1;
  13443. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13444. m_Print.SetFontFace(17, 1, "宋体");
  13445. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13446. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13447. m_Print.SetFontFace(10, 1, "宋体");
  13448. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13449. CStringArray strarray;
  13450. strarray.Add("客户姓名");
  13451. strarray.Add("客户电话");
  13452. strarray.Add("预定日期");
  13453. strarray.Add("结婚日期");
  13454. strarray.Add("取件日期");
  13455. strarray.Add("归还日期");
  13456. strarray.Add("本店地址");
  13457. strarray.Add("电 话");
  13458. strarray.Add("客户地址");
  13459. strarray.Add("客户签名");
  13460. for (i = 2; i < 12; i++)
  13461. {
  13462. StrRect = load.m_rcarray.ElementAt(i);
  13463. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13464. }
  13465. strarray.RemoveAll();
  13466. strarray.Add(m_name2);
  13467. strarray.Add(m_phone2);
  13468. strarray.Add(m_inputdate);
  13469. strarray.Add(m_time3);
  13470. strarray.Add(m_date1);
  13471. strarray.Add(m_date2);
  13472. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13473. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13474. strarray.Add(m_addr2);
  13475. strarray.Add("");
  13476. for (i = 12; i < 22; i++)
  13477. {
  13478. StrRect = load.m_rcarray.ElementAt(i);
  13479. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13480. m_Print.DrawRect2(StrRect, 2);
  13481. }
  13482. for (i = 25; i < 30; i++)
  13483. {
  13484. StrRect = load.m_rcarray.ElementAt(i);
  13485. m_Print.DrawRect2(StrRect, 1);
  13486. }
  13487. StrRect = load.m_rcarray.ElementAt(22);
  13488. StrRect.top += 7;
  13489. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13490. StrRect = load.m_rcarray.ElementAt(23);
  13491. StrRect.top += 7;
  13492. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13493. StrRect = load.m_rcarray.ElementAt(24);
  13494. StrRect.top += 7;
  13495. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13496. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13497. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13498. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13499. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13500. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13501. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13502. if (str.IsEmpty())
  13503. {
  13504. str = "\
  13505. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13506. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13507. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13508. 4. 如有破损酌情赔偿.";
  13509. }
  13510. AutoDraw(m_Print, StrRect, str, 1.5);
  13511. PrintPreview dlg;
  13512. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13513. dlg.m_pDC = m_Print.GetPDC();
  13514. if (aa == 0)
  13515. {
  13516. if (dlg.DoModal() != IDOK)
  13517. return;
  13518. printcot = dlg.m_num;
  13519. }
  13520. //结束打印
  13521. m_Print.EndPage();
  13522. m_Print.EndPrint();
  13523. }
  13524. }
  13525. void CMainFrame::PrintHireDress_01(CString strOrderNumber) // 打印礼服出租单,无法改变结构,需要修改21.lia才能改变打印的布局;
  13526. {
  13527. int printcot = 1;
  13528. for (int aa = 0; aa < printcot; aa++)
  13529. {
  13530. CPrintRX m_Print;
  13531. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(58)))
  13532. {
  13533. m_Print.InitToPrint(NULL, 1);
  13534. }
  13535. else
  13536. {
  13537. CString name = g_cominfoarray.ElementAt(0).ElementAt(65);
  13538. if (name.IsEmpty())
  13539. m_Print.InitToPrint(NULL, 1);
  13540. else
  13541. {
  13542. int nret = m_Print.InitToPrint((char*)(LPCTSTR)name, 1);
  13543. if (nret == -1 && aa == 0)
  13544. {
  13545. AfxMessageBox("没有此找到打印机, 将使用默认打印机!"); m_Print.InitToPrint(NULL, 1);
  13546. }
  13547. }
  13548. }
  13549. m_Print.StartPrint();
  13550. m_Print.StartPage();
  13551. LoadRect load;
  13552. load.SetLiaPath("21.lia");
  13553. load.SetMargins(0, 0);
  13554. if (!load.Load())return;
  13555. int i;
  13556. //////////////////////////////////////////////////////////////
  13557. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "'";
  13558. g_sendhead.bsql = 0;
  13559. g_sendhead.code[0] = 73;
  13560. g_sendhead.code[1] = 74;
  13561. g_sendhead.code[2] = 52;
  13562. g_sendhead.tabcount = 3;
  13563. g_pMainWnd->ProcessChatMessageRequest2(filter);
  13564. if (g_bSendOK == 0)
  13565. {
  13566. return;
  13567. }
  13568. CArray<CStringArray, CStringArray>dresshirearray;
  13569. CArray<CStringArray, CStringArray>dresshiredataarray;
  13570. CArray<CStringArray, CStringArray>clientarray;
  13571. DataToArray(&dresshirearray, &dresshiredataarray, &clientarray);
  13572. if (dresshirearray.GetSize() == 0)return;
  13573. CString m_remark = dresshirearray.ElementAt(0).ElementAt(10);
  13574. CString m_date1 = dresshirearray.ElementAt(0).ElementAt(7);
  13575. CString m_date2 = dresshirearray.ElementAt(0).ElementAt(8);
  13576. CString m_inputdate = dresshirearray.ElementAt(0).ElementAt(6);
  13577. CString strPrice = dresshirearray.ElementAt(0).ElementAt(1); // 金额;
  13578. CString strDeposit = dresshirearray.ElementAt(0).ElementAt(2); // 押金;
  13579. if (clientarray.GetSize() == 0)return;
  13580. CString m_name2 = clientarray.ElementAt(0).ElementAt(2);
  13581. CString m_phone2 = clientarray.ElementAt(0).ElementAt(4);
  13582. CString m_addr2 = clientarray.ElementAt(0).ElementAt(8);
  13583. CString m_time3 = clientarray.ElementAt(0).ElementAt(20);
  13584. CString sItem;
  13585. for (i = 0; i < dresshiredataarray.GetSize(); i++)
  13586. {
  13587. sItem += dresshiredataarray.ElementAt(i).ElementAt(1);
  13588. sItem += " ";
  13589. sItem += dresshiredataarray.ElementAt(i).ElementAt(2);
  13590. sItem += " 数量:";
  13591. //sItem+=dresshiredataarray.ElementAt (i).ElementAt (3);
  13592. sItem += dresshiredataarray.ElementAt(i).ElementAt(3) + "\r\n";
  13593. }
  13594. ////////////////////////////////////////////////////////////////
  13595. int rcpos = -1;
  13596. CRect StrRect = load.m_rcarray.ElementAt(++rcpos);
  13597. m_Print.SetFontFace(17, 1, "宋体");
  13598. m_Print.DrawText((LPTSTR)(LPCTSTR)(g_cominfoarray.ElementAt(0).ElementAt(10) + "礼服单"), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13599. StrRect = load.m_rcarray.ElementAt(++rcpos);
  13600. m_Print.SetFontFace(10, 1, "宋体");
  13601. m_Print.DrawText((LPTSTR)(LPCTSTR)(strOrderNumber), StrRect, 0, 0, FORMAT_RIGHT | FORMAT_VCENTER);
  13602. CStringArray strarray;
  13603. strarray.Add("客户姓名"); // 1.
  13604. strarray.Add("客户电话");
  13605. strarray.Add("预定日期");
  13606. strarray.Add("结婚日期");
  13607. strarray.Add("取件日期"); // 5.
  13608. strarray.Add("归还日期");
  13609. strarray.Add("本店地址");
  13610. strarray.Add("电 话");
  13611. strarray.Add("客户地址");
  13612. strarray.Add("客户签名"); // 10.
  13613. strarray.Add("金额");
  13614. strarray.Add("押金");
  13615. //for( i=2; i<12; i++)
  13616. for (i = 2; i < 14; i++)
  13617. {
  13618. StrRect = load.m_rcarray.ElementAt(i);
  13619. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 2), StrRect, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13620. }
  13621. strarray.RemoveAll();
  13622. strarray.Add(m_name2);
  13623. strarray.Add(m_phone2);
  13624. strarray.Add(m_inputdate);
  13625. strarray.Add(m_time3);
  13626. strarray.Add(m_date1);
  13627. strarray.Add(m_date2);
  13628. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(12));
  13629. strarray.Add(g_cominfoarray.ElementAt(0).ElementAt(11));
  13630. strarray.Add(m_addr2);
  13631. strarray.Add("");
  13632. strarray.Add(strPrice); // 金额;
  13633. strarray.Add(strDeposit); // 押金;
  13634. //for( i=12; i<22; i++)
  13635. for (i = 14; i < 24; i++)
  13636. {
  13637. StrRect = load.m_rcarray.ElementAt(i);
  13638. //m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i-12), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13639. m_Print.DrawText((LPTSTR)(LPCTSTR)strarray.ElementAt(i - 14), StrRect, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13640. m_Print.DrawRect2(StrRect, 2);
  13641. }
  13642. for (i = 25; i < 30; i++)
  13643. {
  13644. StrRect = load.m_rcarray.ElementAt(i);
  13645. m_Print.DrawRect2(StrRect, 1);
  13646. }
  13647. StrRect = load.m_rcarray.ElementAt(22);
  13648. StrRect.top += 7;
  13649. m_Print.DrawText((LPTSTR)(LPCTSTR)"服务项目:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13650. StrRect = load.m_rcarray.ElementAt(23);
  13651. StrRect.top += 7;
  13652. m_Print.DrawText((LPTSTR)(LPCTSTR)"备 注:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13653. StrRect = load.m_rcarray.ElementAt(24);
  13654. StrRect.top += 7;
  13655. m_Print.DrawText((LPTSTR)(LPCTSTR)"注意事项:", StrRect, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13656. StrRect = load.m_rcarray.ElementAt(25); StrRect.left += 75; StrRect.top += 5;
  13657. AutoDraw(m_Print, StrRect, sItem, 1.5);
  13658. StrRect = load.m_rcarray.ElementAt(26); StrRect.left += 75; StrRect.top += 5;
  13659. AutoDraw(m_Print, StrRect, m_remark, 1.5);
  13660. StrRect = load.m_rcarray.ElementAt(27); StrRect.left += 75; StrRect.top += 5;
  13661. CString str = (g_cominfoarray.ElementAt(0).ElementAt(132));
  13662. if (str.IsEmpty())
  13663. {
  13664. str = "\
  13665. 1. 承租者必须持本人身份证,另交押金伍佰-壹仟元整.\r\n\
  13666. 2. 承租时间从结婚日上午八点到下午九点,超时费每小时贰拾圆.\r\n\
  13667. 3. 本店婚纱礼服及其它项目一经定出不可退换.\r\n\
  13668. 4. 如有破损酌情赔偿.";
  13669. }
  13670. AutoDraw(m_Print, StrRect, str, 1.5);
  13671. PrintPreview dlg;
  13672. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13673. dlg.m_pDC = m_Print.GetPDC();
  13674. if (aa == 0)
  13675. {
  13676. if (dlg.DoModal() != IDOK)
  13677. return;
  13678. printcot = dlg.m_num;
  13679. }
  13680. //结束打印
  13681. m_Print.EndPage();
  13682. m_Print.EndPrint();
  13683. }
  13684. }
  13685. // ****************************************************************************
  13686. // Jeff:
  13687. // 函数:PrintHireDress2
  13688. // 无参;
  13689. // 调用者:DinDanFrom.cpp
  13690. // void DinDanFrom::GetData(),订单报表调用时,判断订单数是否大于1000
  13691. // 当订单数大于1000,设置连接公司服务器开关量为真;
  13692. // -----------------------------------------------------------------------------
  13693. // 修改:Jeff
  13694. // 时间:2014.10.18
  13695. // 内容:将 g_ncot 比较值改为100;
  13696. // ****************************************************************************
  13697. void CMainFrame::PrintHireDress2()
  13698. {
  13699. if (g_ncot > 100) g_bSendLYFZ = 1;
  13700. // g_pMainWnd->SetTimer (7, 3000, NULL);
  13701. }
  13702. void CMainFrame::PrintTakeForm2(CArray<CStringArray, CStringArray>*Listarray)
  13703. {
  13704. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "选片客人明细表";
  13705. int pages = Listarray->GetSize() / 46;
  13706. if (Listarray->GetSize() % 46)pages++;
  13707. for (int aa = 0; aa < pages; aa++)
  13708. {
  13709. PrintPreview dlg;
  13710. CPrintRX m_Print;
  13711. m_Print.InitToPrint(NULL, 1);
  13712. m_Print.StartPrint();
  13713. m_Print.StartPage();
  13714. CRect mainrc(0, 0, 560, 793);
  13715. float fscale;
  13716. {
  13717. int w, h;
  13718. m_Print.GetWidHei(w, h);
  13719. fscale = (float)w / (float)h;
  13720. }
  13721. mainrc.DeflateRect(25, 40, 10, 0);
  13722. CRect rc, rc2;
  13723. rc = mainrc;
  13724. rc.bottom = rc.top;
  13725. rc.top -= 20;
  13726. m_Print.SetFontFace(16, 1, "黑体");
  13727. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13728. m_Print.SetFontFace(9, 1, "宋体");
  13729. CString str;
  13730. int wid[5] = { 200, 110, 70, 85, 62 };
  13731. int hei = 16;
  13732. if (fscale > 0.71)hei = 15;
  13733. rc = mainrc;
  13734. rc.bottom = rc.top + hei;
  13735. for (int i = 0; i < 47; i++)
  13736. {
  13737. rc2.top = rc.top + i*hei;
  13738. rc2.bottom = rc.bottom + i*hei;
  13739. rc2.left = rc.left;
  13740. rc2.right = rc.left + wid[0];
  13741. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  13742. for (int j = 0; j<5; j++)
  13743. {
  13744. m_Print.DrawRect2(rc2, 1);
  13745. if (Listarray->GetSize()>aa * 46 + i)
  13746. {
  13747. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  13748. rc2.left += 3;
  13749. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13750. rc2.left -= 3;
  13751. }
  13752. rc2.left += wid[j];
  13753. rc2.right = rc2.left + wid[j + 1];
  13754. }
  13755. }
  13756. rc2.top += 2;
  13757. rc2.left += 2; rc2.right = mainrc.right + 4;
  13758. m_Print.SetFontFace(8, 1, "宋体");
  13759. str.Format(" 页:%d/%d", aa + 1, pages);
  13760. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  13761. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13762. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13763. dlg.m_pDC = m_Print.GetPDC();
  13764. // dlg.m_mode=1;
  13765. if (aa == 0)
  13766. {
  13767. if (dlg.DoModal() != IDOK)
  13768. return;
  13769. }
  13770. //结束打印
  13771. m_Print.EndPage();
  13772. m_Print.EndPrint();
  13773. }
  13774. }
  13775. void CMainFrame::PrintTakeForm3(CArray<CStringArray, CStringArray>*Listarray)
  13776. {
  13777. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "看设计客人明细表";
  13778. int pages = Listarray->GetSize() / 46;
  13779. if (Listarray->GetSize() % 46)pages++;
  13780. for (int aa = 0; aa < pages; aa++)
  13781. {
  13782. PrintPreview dlg;
  13783. CPrintRX m_Print;
  13784. m_Print.InitToPrint(NULL, 1);
  13785. m_Print.StartPrint();
  13786. m_Print.StartPage();
  13787. CRect mainrc(0, 0, 560, 793);
  13788. float fscale;
  13789. {
  13790. int w, h;
  13791. m_Print.GetWidHei(w, h);
  13792. fscale = (float)w / (float)h;
  13793. }
  13794. mainrc.DeflateRect(25, 40, 10, 0);
  13795. CRect rc, rc2;
  13796. rc = mainrc;
  13797. rc.bottom = rc.top;
  13798. rc.top -= 20;
  13799. m_Print.SetFontFace(16, 1, "黑体");
  13800. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13801. m_Print.SetFontFace(9, 1, "宋体");
  13802. CString str;
  13803. int wid[5] = { 200, 110, 70, 85, 62 };
  13804. int hei = 16;
  13805. if (fscale > 0.71)hei = 15;
  13806. rc = mainrc;
  13807. rc.bottom = rc.top + hei;
  13808. for (int i = 0; i < 47; i++)
  13809. {
  13810. rc2.top = rc.top + i*hei;
  13811. rc2.bottom = rc.bottom + i*hei;
  13812. rc2.left = rc.left;
  13813. rc2.right = rc.left + wid[0];
  13814. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  13815. for (int j = 0; j<5; j++)
  13816. {
  13817. m_Print.DrawRect2(rc2, 1);
  13818. if (Listarray->GetSize()>aa * 46 + i)
  13819. {
  13820. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  13821. rc2.left += 3;
  13822. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13823. rc2.left -= 3;
  13824. }
  13825. rc2.left += wid[j];
  13826. rc2.right = rc2.left + wid[j + 1];
  13827. }
  13828. }
  13829. rc2.top += 2;
  13830. rc2.left += 2; rc2.right = mainrc.right + 4;
  13831. m_Print.SetFontFace(8, 1, "宋体");
  13832. str.Format(" 页:%d/%d", aa + 1, pages);
  13833. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  13834. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13835. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13836. dlg.m_pDC = m_Print.GetPDC();
  13837. // dlg.m_mode=1;
  13838. if (aa == 0)
  13839. {
  13840. if (dlg.DoModal() != IDOK)
  13841. return;
  13842. }
  13843. //结束打印
  13844. m_Print.EndPage();
  13845. m_Print.EndPrint();
  13846. }
  13847. }
  13848. void CMainFrame::PrintTakeForm4(CArray<CStringArray, CStringArray>*Listarray)
  13849. {
  13850. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "取件客人明细表";
  13851. int pages = Listarray->GetSize() / 46;
  13852. if (Listarray->GetSize() % 46)pages++;
  13853. for (int aa = 0; aa < pages; aa++)
  13854. {
  13855. PrintPreview dlg;
  13856. CPrintRX m_Print;
  13857. m_Print.InitToPrint(NULL, 1);
  13858. m_Print.StartPrint();
  13859. m_Print.StartPage();
  13860. CRect mainrc(0, 0, 560, 793);
  13861. float fscale;
  13862. {
  13863. int w, h;
  13864. m_Print.GetWidHei(w, h);
  13865. fscale = (float)w / (float)h;
  13866. }
  13867. mainrc.DeflateRect(25, 40, 10, 0);
  13868. CRect rc, rc2;
  13869. rc = mainrc;
  13870. rc.bottom = rc.top;
  13871. rc.top -= 20;
  13872. m_Print.SetFontFace(16, 1, "黑体");
  13873. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13874. m_Print.SetFontFace(9, 1, "宋体");
  13875. CString str;
  13876. int wid[5] = { 200, 110, 70, 85, 62 };
  13877. int hei = 16;
  13878. if (fscale > 0.71)hei = 15;
  13879. rc = mainrc;
  13880. rc.bottom = rc.top + hei;
  13881. for (int i = 0; i < 47; i++)
  13882. {
  13883. rc2.top = rc.top + i*hei;
  13884. rc2.bottom = rc.bottom + i*hei;
  13885. rc2.left = rc.left;
  13886. rc2.right = rc.left + wid[0];
  13887. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  13888. for (int j = 0; j<5; j++)
  13889. {
  13890. m_Print.DrawRect2(rc2, 1);
  13891. if (Listarray->GetSize()>aa * 46 + i)
  13892. {
  13893. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  13894. rc2.left += 3;
  13895. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13896. rc2.left -= 3;
  13897. }
  13898. rc2.left += wid[j];
  13899. rc2.right = rc2.left + wid[j + 1];
  13900. }
  13901. }
  13902. rc2.top += 2;
  13903. rc2.left += 2; rc2.right = mainrc.right + 4;
  13904. m_Print.SetFontFace(8, 1, "宋体");
  13905. str.Format(" 页:%d/%d", aa + 1, pages);
  13906. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  13907. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13908. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13909. dlg.m_pDC = m_Print.GetPDC();
  13910. // dlg.m_mode=1;
  13911. if (aa == 0)
  13912. {
  13913. if (dlg.DoModal() != IDOK)
  13914. return;
  13915. }
  13916. //结束打印
  13917. m_Print.EndPage();
  13918. m_Print.EndPrint();
  13919. }
  13920. }
  13921. void CMainFrame::PrintTakeForm5(CArray<CStringArray, CStringArray>*Listarray)
  13922. {
  13923. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "婚庆客人明细表";
  13924. int pages = Listarray->GetSize() / 46;
  13925. if (Listarray->GetSize() % 46)pages++;
  13926. for (int aa = 0; aa < pages; aa++)
  13927. {
  13928. PrintPreview dlg;
  13929. CPrintRX m_Print;
  13930. m_Print.InitToPrint(NULL, 1);
  13931. m_Print.StartPrint();
  13932. m_Print.StartPage();
  13933. CRect mainrc(0, 0, 560, 793);
  13934. float fscale;
  13935. {
  13936. int w, h;
  13937. m_Print.GetWidHei(w, h);
  13938. fscale = (float)w / (float)h;
  13939. }
  13940. mainrc.DeflateRect(25, 40, 10, 0);
  13941. CRect rc, rc2;
  13942. rc = mainrc;
  13943. rc.bottom = rc.top;
  13944. rc.top -= 20;
  13945. m_Print.SetFontFace(16, 1, "黑体");
  13946. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  13947. m_Print.SetFontFace(8, 1, "宋体");
  13948. CString str;
  13949. int wid[7] = { 165, 90, 90, 45, 45, 60, 35 };
  13950. int hei = 16;
  13951. if (fscale > 0.71)hei = 15;
  13952. rc = mainrc;
  13953. rc.bottom = rc.top + hei;
  13954. for (int i = 0; i < 47; i++)
  13955. {
  13956. rc2.top = rc.top + i*hei;
  13957. rc2.bottom = rc.bottom + i*hei;
  13958. rc2.left = rc.left;
  13959. rc2.right = rc.left + wid[0];
  13960. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  13961. for (int j = 0; j<7; j++)
  13962. {
  13963. m_Print.DrawRect2(rc2, 1);
  13964. if (Listarray->GetSize()>aa * 46 + i)
  13965. {
  13966. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  13967. rc2.left += 3;
  13968. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  13969. rc2.left -= 3;
  13970. }
  13971. rc2.left += wid[j];
  13972. rc2.right = rc2.left + wid[j + 1];
  13973. }
  13974. }
  13975. rc2.top += 2;
  13976. rc2.left += 2; rc2.right = mainrc.right + 4;
  13977. m_Print.SetFontFace(8, 1, "宋体");
  13978. str.Format(" 页:%d/%d", aa + 1, pages);
  13979. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  13980. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  13981. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  13982. dlg.m_pDC = m_Print.GetPDC();
  13983. // dlg.m_mode=1;
  13984. if (aa == 0)
  13985. {
  13986. if (dlg.DoModal() != IDOK)
  13987. return;
  13988. }
  13989. //结束打印
  13990. m_Print.EndPage();
  13991. m_Print.EndPrint();
  13992. }
  13993. }
  13994. void CMainFrame::PrintTakeForm1(CArray<CStringArray, CStringArray>*Listarray)
  13995. {
  13996. CString title = g_cominfoarray.ElementAt(0).ElementAt(10) + "拍照客人明细表";
  13997. int pages = Listarray->GetSize() / 46;
  13998. if (Listarray->GetSize() % 46)pages++;
  13999. for (int aa = 0; aa < pages; aa++)
  14000. {
  14001. PrintPreview dlg;
  14002. CPrintRX m_Print;
  14003. m_Print.InitToPrint(NULL, 1);
  14004. m_Print.StartPrint();
  14005. m_Print.StartPage();
  14006. CRect mainrc(0, 0, 560, 793);
  14007. float fscale;
  14008. {
  14009. int w, h;
  14010. m_Print.GetWidHei(w, h);
  14011. fscale = (float)w / (float)h;
  14012. }
  14013. mainrc.DeflateRect(25, 40, 10, 0);
  14014. CRect rc, rc2;
  14015. rc = mainrc;
  14016. rc.bottom = rc.top;
  14017. rc.top -= 20;
  14018. m_Print.SetFontFace(16, 1, "黑体");
  14019. m_Print.DrawText((LPTSTR)(LPCTSTR)title, rc, 0, 0, FORMAT_HCENTER | FORMAT_VCENTER);
  14020. m_Print.SetFontFace(8, 1, "宋体");
  14021. CString str;
  14022. int wid[7] = { 165, 60, 90, 60, 60, 60, 35 };
  14023. int hei = 16;
  14024. if (fscale > 0.71)hei = 15;
  14025. rc = mainrc;
  14026. rc.bottom = rc.top + hei;
  14027. for (int i = 0; i < 47; i++)
  14028. {
  14029. rc2.top = rc.top + i*hei;
  14030. rc2.bottom = rc.bottom + i*hei;
  14031. rc2.left = rc.left;
  14032. rc2.right = rc.left + wid[0];
  14033. if ((!(Listarray->GetSize() > aa * 46 + i)) || i == 46)break;
  14034. for (int j = 0; j<7; j++)
  14035. {
  14036. m_Print.DrawRect2(rc2, 1);
  14037. if (Listarray->GetSize()>aa * 46 + i)
  14038. {
  14039. str = Listarray->ElementAt(aa * 46 + i).ElementAt(j);
  14040. rc2.left += 3;
  14041. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_LEFT | FORMAT_VCENTER);
  14042. rc2.left -= 3;
  14043. }
  14044. rc2.left += wid[j];
  14045. rc2.right = rc2.left + wid[j + 1];
  14046. }
  14047. }
  14048. rc2.top += 2;
  14049. rc2.left += 2; rc2.right = mainrc.right + 4;
  14050. m_Print.SetFontFace(8, 1, "宋体");
  14051. str.Format(" 页:%d/%d", aa + 1, pages);
  14052. str = "制表:" + g_user.name + " 日期:" + g_date + str;
  14053. m_Print.DrawText((LPTSTR)(LPCTSTR)str, rc2, 0, 0, FORMAT_RIGHT | FORMAT_UP);
  14054. m_Print.GetWidHei(dlg.m_w, dlg.m_h);
  14055. dlg.m_pDC = m_Print.GetPDC();
  14056. // dlg.m_mode=1;
  14057. if (aa == 0)
  14058. {
  14059. if (dlg.DoModal() != IDOK)
  14060. return;
  14061. }
  14062. //结束打印
  14063. m_Print.EndPage();
  14064. m_Print.EndPrint();
  14065. }
  14066. }
  14067. void CMainFrame::ShowMonthForm2()
  14068. {
  14069. }
  14070. // dlg;