FrmPayroll.cs 370 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562
  1. using LYFZ.ComponentLibrary;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Windows.Forms;
  11. namespace LYFZ.Software.MainBusiness.FinancialManagement
  12. {
  13. public partial class FrmPayroll : LYFZ.Software.UI.FinancialManagement.FrmPayroll
  14. {
  15. LYFZ.BLL.BLL_ErpOrder orbll = new LYFZ.BLL.BLL_ErpOrder();
  16. LYFZ.BLL.BLL_ErpPayment ptbll = new BLL.BLL_ErpPayment();
  17. LYFZ.BLL.BLL_AllViewSet avsbll = new BLL.BLL_AllViewSet();
  18. LYFZ.BLL.BLL_ErpWagesSet wsbll = new BLL.BLL_ErpWagesSet();
  19. LYFZ.BLL.BLL_ErpSystemConfigure sgbll = new BLL.BLL_ErpSystemConfigure();
  20. LYFZ.BLL.BLL_ErpOrdersPhotography opbll = new BLL.BLL_ErpOrdersPhotography();
  21. LYFZ.BLL.BLL_ErpWageCommissionSet wcsbll = new BLL.BLL_ErpWageCommissionSet();
  22. LYFZ.BLL.BLL_ErpCommissionPercentage cpbll = new BLL.BLL_ErpCommissionPercentage();
  23. LYFZ.BLL.BLL_ErpWageCommissionRecords wcrbll = new BLL.BLL_ErpWageCommissionRecords();
  24. LYFZ.BLL.BLL_ErpPieceCommissionRecords pcrbll = new BLL.BLL_ErpPieceCommissionRecords();
  25. private delegate void UpdateControl();
  26. public FrmPayroll()
  27. {
  28. this.dgv.RowsAdded += dgv_RowsAdded;
  29. this.txtTimeStart.Leave += txtTimeStart_Leave;
  30. this.Resize += FrmPayroll_Resize;
  31. }
  32. /// <summary>
  33. /// 一级景点个数
  34. /// </summary>
  35. int OneLevelCount = 0;
  36. /// <summary>
  37. /// 二级景点个数
  38. /// </summary>
  39. int TwoLevelCount = 0;
  40. /// <summary>
  41. /// 三级景点个数
  42. /// </summary>
  43. int ThreeLevelCount = 0;
  44. //景点等级比重
  45. /// <summary>
  46. /// 一级景点比重
  47. /// </summary>
  48. decimal OneLevel = 0;
  49. /// <summary>
  50. /// 二级景点比重
  51. /// </summary>
  52. decimal TwoLevel = 0;
  53. /// <summary>
  54. /// 三级景点比重
  55. /// </summary>
  56. decimal ThreeLevel = 0;
  57. /// <summary>
  58. /// 摄影比重
  59. /// </summary>
  60. decimal MainPhotography = 0;
  61. /// <summary>
  62. /// 摄影助理比重
  63. /// </summary>
  64. decimal DeputyPhotography = 0;
  65. /// <summary>
  66. /// 化妆比重
  67. /// </summary>
  68. decimal MainMake = 0;
  69. /// <summary>
  70. /// 化妆助理比重
  71. /// </summary>
  72. decimal DeputyMake = 0;
  73. /// <summary>
  74. /// 引导比重
  75. /// </summary>
  76. decimal MainBootDivision = 0;
  77. /// <summary>
  78. /// 引导助理比重
  79. /// </summary>
  80. decimal DeputyBootDivision = 0;
  81. /// <summary>
  82. ///
  83. /// </summary>
  84. DataTable dt_SystemConfigure = new DataTable();
  85. /// <summary>
  86. ///
  87. /// </summary>
  88. DataTable tblSystemCategory = new DataTable();
  89. /// <summary>
  90. /// 是否首次远行
  91. /// </summary>
  92. bool IsFirstRun = true;
  93. /// <summary>
  94. /// 窗体加载事件
  95. /// </summary>
  96. /// <param name="sender"></param>
  97. /// <param name="e"></param>
  98. protected override void FrmPayroll_Shown(object sender, EventArgs e)
  99. {
  100. this.tblSystemCategory = new LYFZ.BLL.BLL_ErpSystemCategory().GetAllList(filedOrder: "ID asc").Tables[0];
  101. this.txtTimeStart.DateValue = SDateTime.Now.Year + "-" + SDateTime.Now.Month + "-01";
  102. this.txtTimeEnd.DateValue = Convert.ToDateTime(this.txtTimeStart.DateValue).AddMonths(1).AddSeconds(-1).ToString("yyyy-MM-dd");
  103. dt_SystemConfigure = sgbll.GetAllList().Tables[0];
  104. // 部门人员绑定
  105. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.cmbEmployeeName, IsFirstNodeNull: true, IsFirstNodeName: "全部", IsShowResign: false, IsShowAdmin: true);
  106. //项目类别
  107. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView(this.cmbItemCategory, StrBindData: "订单前期,服务前期,订单后期,服务后期,其它消费,会员充值,服务卡充值,计件提成,礼服租售", IsFirstNodeNull: true);
  108. //流程状态
  109. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView(this.cmbProcessStatus, StrBindData: "拍照OK,选片OK,取件OK", IsFirstNodeNull: true);
  110. //客户来源
  111. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("AAAAAAF", this.cmbCustomerSource, IsFirstNodeNull: true, tbl: tblSystemCategory);
  112. //套系类别
  113. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BFAGAHBFDGCABAJIH", this.CtvPak_Name, IsFirstNodeNull: true, tbl: tblSystemCategory);
  114. //计件提成
  115. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BEBBAFACDCCFBJFI", this.cmbCommissionScheme, IsFirstNodeNull: true, tbl: tblSystemCategory);
  116. ////景点类别
  117. //LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView(this.cmbtreevSightsCategory, "内景,外景", IsFirstNodeNull: true);
  118. // 查看
  119. this.cmbEmployeeName.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StatisticalInquiryAllWagesCompetence, CustomAttributes.OperatingAuthority.ViewAll);
  120. if (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Account != LYFZ.AuthorizeUserName.AdministratorsName)
  121. {
  122. this.cmbEmployeeName.TagFindText(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID);
  123. this.cmbEmployeeName_ComboBoxTree_NodeMouseClick(null, null);
  124. }
  125. // 录入
  126. btnSave.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StatisticalInquiryAllWagesCompetence, CustomAttributes.OperatingAuthority.Add);
  127. // 导出
  128. btnExPort.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StatisticalInquiryAllWagesCompetence, CustomAttributes.OperatingAuthority.DataExport);
  129. // 获取景点等级级别比重
  130. if (cpbll.GetList("Cp_ProportionCode='BEBBBCADDEBFJDFFC'").Tables[0].Rows.Count > 0)
  131. { OneLevel = Convert.ToDecimal(cpbll.GetList("Cp_ProportionCode='BEBBBCADDEBFJDFFC'").Tables[0].Rows[0]["Cp_Proportion"]); }
  132. if (cpbll.GetList("Cp_ProportionCode='BEBBBCADEGBGAFFJC'").Tables[0].Rows.Count > 0)
  133. { TwoLevel = Convert.ToDecimal(cpbll.GetList("Cp_ProportionCode='BEBBBCADEGBGAFFJC'").Tables[0].Rows[0]["Cp_Proportion"]); }
  134. if (cpbll.GetList("Cp_ProportionCode='BEBBBCADAFBHBCHCI'").Tables[0].Rows.Count > 0)
  135. { ThreeLevel = Convert.ToDecimal(cpbll.GetList("Cp_ProportionCode='BEBBBCADAFBHBCHCI'").Tables[0].Rows[0]["Cp_Proportion"]); }
  136. // 获取摄影比重
  137. if (cpbll.GetList("Cp_ProportionCode='MainPhotography'").Tables[0].Rows.Count > 0)
  138. { MainPhotography = Convert.ToDecimal(cpbll.GetList("Cp_ProportionCode='MainPhotography'").Tables[0].Rows[0]["Cp_Proportion"]); }
  139. if (cpbll.GetList("Cp_ProportionCode='DeputyPhotography'").Tables[0].Rows.Count > 0)
  140. { DeputyPhotography = Convert.ToDecimal(cpbll.GetList("Cp_ProportionCode='DeputyPhotography'").Tables[0].Rows[0]["Cp_Proportion"]); }
  141. // 获取化妆比重
  142. if (cpbll.GetList("Cp_ProportionCode='MainMake'").Tables[0].Rows.Count > 0)
  143. { MainMake = Convert.ToDecimal(cpbll.GetList("Cp_ProportionCode='MainMake'").Tables[0].Rows[0]["Cp_Proportion"]); }
  144. if (cpbll.GetList("Cp_ProportionCode='DeputyMake'").Tables[0].Rows.Count > 0)
  145. { DeputyMake = Convert.ToDecimal(cpbll.GetList("Cp_ProportionCode='DeputyMake'").Tables[0].Rows[0]["Cp_Proportion"]); }
  146. // 获取引导比重
  147. if (cpbll.GetList("Cp_ProportionCode='MainBootDivision'").Tables[0].Rows.Count > 0)
  148. { MainBootDivision = Convert.ToDecimal(cpbll.GetList("Cp_ProportionCode='MainBootDivision'").Tables[0].Rows[0]["Cp_Proportion"]); }
  149. if (cpbll.GetList("Cp_ProportionCode='DeputyBootDivision'").Tables[0].Rows.Count > 0)
  150. { DeputyBootDivision = Convert.ToDecimal(cpbll.GetList("Cp_ProportionCode='DeputyBootDivision'").Tables[0].Rows[0]["Cp_Proportion"]); }
  151. this.IsFirstRun = false;
  152. this.FrmPayroll_Resize(this, null);
  153. }
  154. /// <summary>
  155. /// 获取儿童阶段金额
  156. /// </summary>
  157. /// <param name="OrdNumber">主订单号</param>
  158. /// <param name="YsAmount">应该金额</param>
  159. /// <param name="BcAmount">本次收款金额</param>
  160. /// <param name="SightsName">景点名称</param>
  161. /// <returns></returns>
  162. public decimal GetChildrenAmount(string OrdNumber, decimal YsAmount, decimal BcAmount, string SightsName)
  163. {
  164. decimal Sum = 0;
  165. decimal ChildrenAmount = 0;
  166. decimal EveryAmount = 0;
  167. DataTable tbl = opbll.GetList("Ordpg_Number = '" + OrdNumber + "'", "Ordpg_ViceNumber ASC").Tables[0];
  168. int Count = tbl.Rows.Count;
  169. //每次收款金额(平均分)
  170. if (Count > 0)
  171. { EveryAmount = YsAmount / Count; }
  172. //获取收款金额
  173. DataTable dt = ptbll.GetSum("Pay_OrdNumber = '" + OrdNumber + "' and Pay_Category != '后期收款'").Tables[0];
  174. if (!string.IsNullOrEmpty(dt.Rows[0]["Pay_AmountOf"].ToString()))
  175. { ChildrenAmount = Convert.ToDecimal(dt.Rows[0]["Pay_AmountOf"].ToString()); }
  176. //for (int i = 0; i < tbl.Rows.Count; i++)
  177. //{
  178. // if (SightsName == tbl.Rows[i]["Ordpg_Sights"].ToString().Trim())
  179. // {
  180. // ChildrenAmount = ChildrenAmount - EveryAmount;
  181. // if (ChildrenAmount > EveryAmount)
  182. // { Sum = EveryAmount; }
  183. // else
  184. // { Sum = ChildrenAmount; }
  185. // break;
  186. // }
  187. // else
  188. // { ChildrenAmount = ChildrenAmount - EveryAmount; }
  189. //}
  190. if ((ChildrenAmount / Count) == EveryAmount)
  191. {
  192. if (ptbll.GetList("Pay_OrdNumber = '" + OrdNumber + "' and Pay_Category != '后期收款'").Tables[0].Rows.Count == 1)
  193. { Sum = EveryAmount; }
  194. else
  195. { Sum = BcAmount / Count; }
  196. }
  197. else
  198. {
  199. if (ChildrenAmount < EveryAmount)
  200. {
  201. for (int i = 0; i < tbl.Rows.Count; i++)
  202. {
  203. string Ordpg_Sights = tbl.Rows[i]["Ordpg_Sights"].ToString();
  204. if (SightsName == Ordpg_Sights)
  205. {
  206. if (i + 1 == 1)
  207. { Sum = ChildrenAmount / ptbll.GetList("Pay_OrdNumber='" + OrdNumber + "' and Pay_Category!='后期收款'").Tables[0].Rows.Count; }
  208. else
  209. { Sum = 0; }
  210. }
  211. }
  212. }
  213. if (ChildrenAmount >= EveryAmount)
  214. {
  215. for (int i = 0; i < tbl.Rows.Count; i++)
  216. {
  217. string Ordpg_Sights = tbl.Rows[i]["Ordpg_Sights"].ToString();
  218. if (SightsName == Ordpg_Sights)
  219. {
  220. if (ChildrenAmount > (EveryAmount * (i + 1)))
  221. {
  222. if (ptbll.GetList("Pay_OrdNumber='" + OrdNumber + "' and Pay_Category!='后期收款'").Tables[0].Rows.Count == 1)
  223. { Sum = EveryAmount; }
  224. else
  225. { Sum = EveryAmount / ptbll.GetList("Pay_OrdNumber='" + OrdNumber + "' and Pay_Category!='后期收款'").Tables[0].Rows.Count; }
  226. }
  227. else
  228. { Sum = 0; }
  229. }
  230. }
  231. }
  232. }
  233. return Convert.ToDecimal(Sum.ToString("N2"));
  234. }
  235. /// <summary>
  236. /// 获取所有业绩列表
  237. /// </summary>
  238. /// <param name="StartTime"></param>
  239. /// <param name="EndTime"></param>
  240. /// <param name="EmployeeName"></param>
  241. /// <param name="backgroundWorker"></param>
  242. /// <returns></returns>
  243. public decimal BindPerformance(string StartTime, string EndTime, string EmployeeName, BackgroundWorker backgroundWorker)
  244. {
  245. this.Invoke(new UpdateControl(delegate()
  246. {
  247. this.dgv.Rows.Clear();
  248. }));
  249. string StrUserName = "";
  250. if (!string.IsNullOrEmpty(EmployeeName))
  251. {
  252. DataRow dtRow = LYFZ.DAL.DAL_ErpUser.SimpleUserDataTable.Rows.Find(EmployeeName);
  253. if (dtRow != null)
  254. { StrUserName = dtRow["User_Name"].ToString().Trim(); }
  255. }
  256. decimal Sum = 0;
  257. string s = "";
  258. StringBuilder strBuilder = new StringBuilder();
  259. #region 列表
  260. if (string.IsNullOrEmpty(this.Str_ItemCategory.Trim()) || this.Str_ItemCategory.Trim() == "订单前期" || this.Str_ItemCategory.Trim() == "订单后期" || this.Str_ItemCategory.Trim() == "其它消费" || this.Str_ItemCategory.Trim() == "礼服租售")
  261. {
  262. #region 获取订单收款(前期收款,后期收款,其它消费)收款后即分提成
  263. strBuilder.Append(" 1 = 1 ");
  264. string StrPaymentWhere = "";
  265. if (string.IsNullOrEmpty(this.Str_ProcessStatus.Trim()))
  266. { strBuilder.Append("and 收款时间>='" + StartTime + "' and 收款时间<='" + EndTime + " 23:59:59.000' "); }
  267. //if (string.IsNullOrEmpty(this.Str_ProcessStatus.Trim()))
  268. //{ StrPaymentWhere = "and Pay_CreateDatetime >= '" + StartTime + "' and 收款时间<='" + EndTime + " 23:59:59.000' "; }
  269. else if (!string.IsNullOrEmpty(this.Str_ProcessStatus.Trim()))
  270. {
  271. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  272. { strBuilder.Append("and 未拍个数 = 0 and (最后拍摄时间 >= '" + StartTime + "' and 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  273. if (this.Str_ProcessStatus.Trim() == "选片OK")
  274. { strBuilder.Append("and 选片状态 = '1' and (选片时间 >= '" + StartTime + "' and 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  275. if (this.Str_ProcessStatus.Trim() == "取件OK")
  276. { strBuilder.Append("and 取件状态 = 'OK' and (取件日期 >= '" + StartTime + "' and 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  277. strBuilder.Append("and (收款类别 = '全款' or 收款类别 = '预约补款' or 收款类别 = '预约收款' or 二销类别编号 = 'BEBCABBAAHFCJBJGJ')");
  278. }
  279. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  280. { strBuilder.Append("and 接单人编号 like '%" + EmployeeName + "%'"); }
  281. if (!string.IsNullOrEmpty(this.Str_Scores1))
  282. { strBuilder.Append("and (门市满意总分>=" + this.Str_Scores1 + " and 门市满意总分<=" + this.Str_Scores2 + ")"); }
  283. bool IsQuery = true;
  284. s = BindSelect1(ref IsQuery);
  285. if (IsQuery)
  286. {
  287. DataTable dtCount = orbll.GetView_Custom("Vw_StaffPerformance_OrdersPerson", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  288. //DataTable dtCount = LYFZ.BLL.BLL_ErpPaymentPayrollClass.GetPayrollOrderPerson(StrPaymentWhere, strBuilder.ToString() + s.ToString()); // orbll.GetView_Custom("Vw_StaffPerformance_OrdersPerson", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  289. if (dtCount.Rows.Count > 0)
  290. {
  291. if (Convert.ToInt32(dtCount.Rows[0]["CountID"]) > 0)
  292. {
  293. backgroundWorker.ReportProgress(0, "正在获取'门市接单' ...");
  294. string StrColumnName = "订单号,接单人名称,主门市,客户名称,主门市金额,副门市金额,收款时间,收款类型,套系类别,套系名称,项目名称,应收金额,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,取件状态,取件日期,拍摄阶段,门市满意总分";
  295. //DataTable dt_OrderPayment = avsbll.Vw_StaffPerformance_OrdersPerson(str.ToString() + s.ToString()).Tables[0];
  296. DataTable dt_OrderPayment = orbll.GetView_Custom("Vw_StaffPerformance_OrdersPerson", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  297. for (int t = 0; t < dt_OrderPayment.Rows.Count; t++)
  298. {
  299. #region
  300. DataGridViewRow dgvr = new DataGridViewRow();
  301. DataGridViewCell cell = null;
  302. //订单号
  303. cell = new DataGridViewTextBoxCell();
  304. cell.Value = dt_OrderPayment.Rows[t]["订单号"].ToString().Trim();
  305. dgvr.Cells.Add(cell);
  306. //员工
  307. cell = new DataGridViewTextBoxCell();
  308. cell.Value = dt_OrderPayment.Rows[t]["接单人名称"].ToString().Trim();
  309. dgvr.Cells.Add(cell);
  310. //职务
  311. cell = new DataGridViewTextBoxCell();
  312. #region 前期收款,后期收款
  313. if (!string.IsNullOrEmpty(dt_OrderPayment.Rows[t]["主门市"].ToString()))
  314. {
  315. if (dt_OrderPayment.Rows[t]["主门市"].ToString() == EmployeeName)
  316. { cell.Value = "主接单人"; }
  317. else
  318. { cell.Value = "副接单人"; }
  319. }
  320. #endregion
  321. dgvr.Cells.Add(cell);
  322. //客户姓名
  323. cell = new DataGridViewTextBoxCell();
  324. cell.Value = dt_OrderPayment.Rows[t]["客户名称"].ToString().Trim();
  325. dgvr.Cells.Add(cell);
  326. //收款金额
  327. cell = new DataGridViewTextBoxCell();
  328. #region 前期收款,后期收款
  329. if (!string.IsNullOrEmpty(dt_OrderPayment.Rows[t]["主门市"].ToString()))
  330. {
  331. if (dt_OrderPayment.Rows[t]["主门市"].ToString() == EmployeeName)
  332. { cell.Value = Convert.ToDecimal(dt_OrderPayment.Rows[t]["主门市金额"]).ToString("N2"); }
  333. else
  334. { cell.Value = Convert.ToDecimal(dt_OrderPayment.Rows[t]["副门市金额"]).ToString("N2"); }
  335. }
  336. #endregion
  337. dgvr.Cells.Add(cell);
  338. //收款时间
  339. cell = new DataGridViewTextBoxCell();
  340. cell.Value = dt_OrderPayment.Rows[t]["收款时间"].ToString().Trim();
  341. dgvr.Cells.Add(cell);
  342. //套系类别
  343. cell = new DataGridViewTextBoxCell();
  344. if (dt_OrderPayment.Rows[t]["收款类型"].ToString() == "0")
  345. { cell.Value = dt_OrderPayment.Rows[t]["套系类别"].ToString().Trim(); }
  346. if (dt_OrderPayment.Rows[t]["收款类型"].ToString() == "1")
  347. { cell.Value = "/其它消费"; }
  348. if (dt_OrderPayment.Rows[t]["收款类型"].ToString() == "2")
  349. { cell.Value = "/礼服租售"; }
  350. dgvr.Cells.Add(cell);
  351. //套系名称
  352. cell = new DataGridViewTextBoxCell();
  353. if (dt_OrderPayment.Rows[t]["收款类型"].ToString() == "0")
  354. { cell.Value = dt_OrderPayment.Rows[t]["套系名称"].ToString().Trim(); }
  355. if (dt_OrderPayment.Rows[t]["收款类型"].ToString() == "1")
  356. { cell.Value = dt_OrderPayment.Rows[t]["项目名称"].ToString().Trim(); }
  357. dgvr.Cells.Add(cell);
  358. //应收金额
  359. cell = new DataGridViewTextBoxCell();
  360. if (!string.IsNullOrEmpty(dt_OrderPayment.Rows[t]["应收金额"].ToString().Trim()))
  361. { cell.Value = Convert.ToDecimal(dt_OrderPayment.Rows[t]["应收金额"]).ToString("N2").Trim(); }
  362. else
  363. { cell.Value = 0; }
  364. dgvr.Cells.Add(cell);
  365. //项目名称
  366. cell = new DataGridViewTextBoxCell();
  367. if (dt_OrderPayment.Rows[t]["收款类型"].ToString() == "0")
  368. {
  369. if (string.IsNullOrEmpty(dt_OrderPayment.Rows[t]["项目名称"].ToString().Trim()))
  370. { cell.Value = dt_OrderPayment.Rows[t]["收款类别"].ToString(); }
  371. else
  372. { cell.Value = dt_OrderPayment.Rows[t]["项目名称"].ToString().Trim(); }
  373. }
  374. else
  375. { cell.Value = dt_OrderPayment.Rows[t]["项目名称"].ToString().Trim(); }
  376. dgvr.Cells.Add(cell);
  377. //付款名称
  378. cell = new DataGridViewTextBoxCell();
  379. cell.Value = dt_OrderPayment.Rows[t]["付款方式名称"].ToString().Trim();
  380. dgvr.Cells.Add(cell);
  381. #region
  382. if (dt_OrderPayment.Rows[t]["收款类型"].ToString() == "0")
  383. {
  384. //拍摄状态
  385. cell = new DataGridViewTextBoxCell();
  386. if (Convert.ToInt32(dt_OrderPayment.Rows[t]["未拍个数"]) == 0)
  387. { cell.Value = "OK"; }
  388. else
  389. { cell.Value = "未拍"; }
  390. dgvr.Cells.Add(cell);
  391. //拍摄时间
  392. cell = new DataGridViewTextBoxCell();
  393. cell.Value = dt_OrderPayment.Rows[t]["最后拍摄时间"].ToString();
  394. dgvr.Cells.Add(cell);
  395. //选片状态
  396. cell = new DataGridViewTextBoxCell();
  397. if (dt_OrderPayment.Rows[t]["选片状态"].ToString() == "1")
  398. { cell.Value = "OK"; }
  399. else
  400. { cell.Value = "未选"; }
  401. dgvr.Cells.Add(cell);
  402. //选片时间
  403. cell = new DataGridViewTextBoxCell();
  404. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_OrderPayment.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  405. dgvr.Cells.Add(cell);
  406. //取件状态
  407. cell = new DataGridViewTextBoxCell();
  408. if (dt_OrderPayment.Rows[t]["取件状态"].ToString() == "OK")
  409. { cell.Value = "OK"; }
  410. else
  411. { cell.Value = "未取"; }
  412. dgvr.Cells.Add(cell);
  413. //拍摄阶段
  414. cell = new DataGridViewTextBoxCell();
  415. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_OrderPayment.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  416. dgvr.Cells.Add(cell);
  417. //取件时间
  418. cell = new DataGridViewTextBoxCell();
  419. cell.Value = dt_OrderPayment.Rows[t]["拍摄阶段"].ToString();
  420. dgvr.Cells.Add(cell);
  421. //订单类型
  422. cell = new DataGridViewTextBoxCell();
  423. cell.Value = "";
  424. dgvr.Cells.Add(cell);
  425. //收款类型
  426. cell = new DataGridViewTextBoxCell();
  427. cell.Value = "";
  428. dgvr.Cells.Add(cell);
  429. //副订单
  430. cell = new DataGridViewTextBoxCell();
  431. cell.Value = "";
  432. dgvr.Cells.Add(cell);
  433. //门市满意度
  434. cell = new DataGridViewTextBoxCell();
  435. cell.Value = dt_OrderPayment.Rows[t]["门市满意总分"].ToString();
  436. dgvr.Cells.Add(cell);
  437. }
  438. #endregion
  439. this.Invoke(new UpdateControl(delegate()
  440. {
  441. this.dgv.Rows.Add(dgvr);
  442. }));
  443. #endregion
  444. }
  445. }
  446. }
  447. }
  448. #endregion
  449. }
  450. if (this.Str_ItemCategory.Trim() == "" || this.Str_ItemCategory.Trim() == "服务前期" || this.Str_ItemCategory.Trim() == "服务后期")
  451. {
  452. #region 获取流程状态(前期收款(摄影,化妆,引导,初修,精修,设计)前期业绩,选片二销业绩)
  453. if (this.Str_ItemCategory.Trim() == "" || this.Str_ItemCategory.Trim() == "服务前期")
  454. {
  455. #region 前期业绩
  456. DataRow[] ConfigureRow = dt_SystemConfigure.Select("Sconfig_Code='PhotographersEarly' and Sconfig_IsEnabled=1");
  457. if (ConfigureRow.Length > 0)
  458. {
  459. if (ConfigureRow[0]["Sconfig_Value"].ToString() == "1")
  460. {
  461. if (this.Str_ProjectTitle.Trim() == "" || this.Str_ProjectTitle.Trim() == "摄影前期")
  462. {
  463. #region 主摄影师
  464. s = "";
  465. strBuilder = new StringBuilder();
  466. strBuilder.Append(" 收款类别 <> '后期收款'");
  467. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  468. { strBuilder.Append(" And 主摄影师ID like '%" + EmployeeName + "%' "); }
  469. if (this.Str_ProcessStatus.Trim() == "")
  470. { strBuilder.Append(" And 未拍个数 = 0 And (服务前期查询时间 >= '" + StartTime + "' And 服务前期查询时间 <= '" + EndTime + " 23:59:59.000')"); }
  471. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  472. { strBuilder.Append(" And 未拍个数 = 0 And (最后拍摄时间>='" + StartTime + "' And 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  473. if (this.Str_ProcessStatus.Trim() == "选片OK")
  474. { strBuilder.Append(" And 选片状态 = 'OK' And (选片时间 >= '" + StartTime + "' And 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  475. if (this.Str_ProcessStatus.Trim() == "取件OK")
  476. { strBuilder.Append(" And 取件状态 = 'OK' And (取件日期 >= '" + StartTime + "' And 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  477. if (!string.IsNullOrEmpty(this.Str_Scores1))
  478. { strBuilder.Append(" and (主摄影满意总分>=" + this.Str_Scores1 + " and 主摄影满意总分<=" + this.Str_Scores2 + ")"); }
  479. s = BindSelect5();
  480. DataTable dtCount1 = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  481. if (dtCount1.Rows.Count > 0)
  482. {
  483. if (Convert.ToInt32(dtCount1.Rows[0]["CountID"]) > 0)
  484. {
  485. backgroundWorker.ReportProgress(0, "正在获取'主摄影师前期业绩' ...");
  486. string StrColumnName = "订单号,客户名称,订单类型,收款金额,应收金额,拍摄名称,收款时间,套系类别,套系名称,项目名称,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,取件状态,取件日期,副订单,主摄影满意总分";
  487. DataTable dt_MainPhotographer = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  488. for (int t = 0; t < dt_MainPhotographer.Rows.Count; t++)
  489. {
  490. #region
  491. DataGridViewRow dgvr = new DataGridViewRow();
  492. DataGridViewCell cell = null;
  493. //订单号
  494. cell = new DataGridViewTextBoxCell();
  495. cell.Value = dt_MainPhotographer.Rows[t]["订单号"].ToString().Trim();
  496. dgvr.Cells.Add(cell);
  497. //员工
  498. cell = new DataGridViewTextBoxCell();
  499. cell.Value = StrUserName;
  500. dgvr.Cells.Add(cell);
  501. //职务
  502. cell = new DataGridViewTextBoxCell();
  503. cell.Value = "主摄影师";
  504. dgvr.Cells.Add(cell);
  505. //客户姓名
  506. cell = new DataGridViewTextBoxCell();
  507. cell.Value = dt_MainPhotographer.Rows[t]["客户名称"].ToString().Trim();
  508. dgvr.Cells.Add(cell);
  509. //收款金额
  510. cell = new DataGridViewTextBoxCell();
  511. if (dt_MainPhotographer.Rows[t]["订单类型"].ToString() != "1")
  512. { cell.Value = Convert.ToDecimal(dt_MainPhotographer.Rows[t]["收款金额"]).ToString("N2"); }
  513. else
  514. { cell.Value = GetChildrenAmount(dt_MainPhotographer.Rows[t]["订单号"].ToString().Trim(), Convert.ToDecimal(dt_MainPhotographer.Rows[t]["应收金额"]), Convert.ToDecimal(dt_MainPhotographer.Rows[t]["收款金额"]), dt_MainPhotographer.Rows[t]["拍摄名称"].ToString()); }
  515. dgvr.Cells.Add(cell);
  516. //收款时间
  517. cell = new DataGridViewTextBoxCell();
  518. cell.Value = dt_MainPhotographer.Rows[t]["收款时间"].ToString().Trim();
  519. dgvr.Cells.Add(cell);
  520. //套系类别
  521. cell = new DataGridViewTextBoxCell();
  522. cell.Value = dt_MainPhotographer.Rows[t]["套系类别"].ToString().Trim();
  523. dgvr.Cells.Add(cell);
  524. //套系名称
  525. cell = new DataGridViewTextBoxCell();
  526. cell.Value = dt_MainPhotographer.Rows[t]["套系名称"].ToString().Trim();
  527. dgvr.Cells.Add(cell);
  528. //应收金额
  529. cell = new DataGridViewTextBoxCell();
  530. cell.Value = Convert.ToDecimal(dt_MainPhotographer.Rows[t]["应收金额"]).ToString("N2").Trim();
  531. dgvr.Cells.Add(cell);
  532. //项目名称
  533. cell = new DataGridViewTextBoxCell();
  534. if (string.IsNullOrEmpty(dt_MainPhotographer.Rows[t]["项目名称"].ToString().Trim()))
  535. { cell.Value = dt_MainPhotographer.Rows[t]["收款类别"].ToString(); }
  536. else
  537. { cell.Value = dt_MainPhotographer.Rows[t]["项目名称"].ToString().Trim(); }
  538. dgvr.Cells.Add(cell);
  539. //付款名称
  540. cell = new DataGridViewTextBoxCell();
  541. cell.Value = dt_MainPhotographer.Rows[t]["付款方式名称"].ToString().Trim();
  542. dgvr.Cells.Add(cell);
  543. //拍摄状态
  544. cell = new DataGridViewTextBoxCell();
  545. if (Convert.ToInt32(dt_MainPhotographer.Rows[t]["未拍个数"]) == 0)
  546. { cell.Value = "OK"; }
  547. else
  548. { cell.Value = "未拍"; }
  549. dgvr.Cells.Add(cell);
  550. //拍摄时间
  551. cell = new DataGridViewTextBoxCell();
  552. cell.Value = dt_MainPhotographer.Rows[t]["最后拍摄时间"].ToString();
  553. dgvr.Cells.Add(cell);
  554. //选片状态
  555. cell = new DataGridViewTextBoxCell();
  556. if (dt_MainPhotographer.Rows[t]["选片状态"].ToString() == "OK")
  557. { cell.Value = "OK"; }
  558. else
  559. { cell.Value = "未选"; }
  560. dgvr.Cells.Add(cell);
  561. //选片时间
  562. cell = new DataGridViewTextBoxCell();
  563. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_MainPhotographer.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  564. dgvr.Cells.Add(cell);
  565. //取件状态
  566. cell = new DataGridViewTextBoxCell();
  567. if (dt_MainPhotographer.Rows[t]["取件状态"].ToString() == "OK")
  568. { cell.Value = "OK"; }
  569. else
  570. { cell.Value = "未取"; }
  571. dgvr.Cells.Add(cell);
  572. //取件时间
  573. cell = new DataGridViewTextBoxCell();
  574. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_MainPhotographer.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  575. dgvr.Cells.Add(cell);
  576. //拍摄名称
  577. cell = new DataGridViewTextBoxCell();
  578. cell.Value = dt_MainPhotographer.Rows[t]["拍摄名称"].ToString();
  579. dgvr.Cells.Add(cell);
  580. //订单类型
  581. cell = new DataGridViewTextBoxCell();
  582. cell.Value = dt_MainPhotographer.Rows[t]["订单类型"].ToString();
  583. dgvr.Cells.Add(cell);
  584. //收款类型
  585. cell = new DataGridViewTextBoxCell();
  586. cell.Value = dt_MainPhotographer.Rows[t]["收款类别"].ToString();
  587. dgvr.Cells.Add(cell);
  588. //副订单
  589. cell = new DataGridViewTextBoxCell();
  590. cell.Value = dt_MainPhotographer.Rows[t]["副订单"].ToString();
  591. dgvr.Cells.Add(cell);
  592. //主摄影满意总分
  593. cell = new DataGridViewTextBoxCell();
  594. cell.Value = dt_MainPhotographer.Rows[t]["主摄影满意总分"].ToString();
  595. dgvr.Cells.Add(cell);
  596. this.Invoke(new UpdateControl(delegate()
  597. {
  598. this.dgv.Rows.Add(dgvr);
  599. }));
  600. #endregion
  601. }
  602. }
  603. }
  604. #endregion
  605. #region 摄影助理
  606. s = "";
  607. strBuilder = new StringBuilder();
  608. strBuilder.Append(" 收款类别 <> '后期收款'");
  609. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  610. { strBuilder.Append(" And 摄影助理ID like '%" + EmployeeName + "%' "); }
  611. if (this.Str_ProcessStatus.Trim() == "")
  612. { strBuilder.Append(" And 未拍个数 = 0 And (服务前期查询时间 >= '" + StartTime + "' And 服务前期查询时间 <= '" + EndTime + " 23:59:59.000')"); }
  613. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  614. { strBuilder.Append(" And 未拍个数 = 0 And (最后拍摄时间 >= '" + StartTime + "' And 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  615. if (this.Str_ProcessStatus.Trim() == "选片OK")
  616. { strBuilder.Append(" And 选片状态 = 'OK' And (选片时间 >= '" + StartTime + "' And 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  617. if (this.Str_ProcessStatus.Trim() == "取件OK")
  618. { strBuilder.Append(" And 取件状态 = 'OK' And (取件日期 >= '" + StartTime + "' And 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  619. if (!string.IsNullOrEmpty(this.Str_Scores1))
  620. { strBuilder.Append(" and (摄影助理满意总分>=" + this.Str_Scores1 + " and 摄影助理满意总分<=" + this.Str_Scores2 + ")"); }
  621. s = BindSelect5();
  622. DataTable dtCount2 = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  623. if (dtCount2.Rows.Count > 0)
  624. {
  625. if (Convert.ToInt32(dtCount2.Rows[0]["CountID"]) > 0)
  626. {
  627. backgroundWorker.ReportProgress(0, "正在获取'摄影助理前期业绩' ...");
  628. string StrColumnName = "订单号,客户名称,订单类型,收款金额,应收金额,拍摄名称,收款时间,套系类别,套系名称,项目名称,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,取件状态,取件日期,副订单,摄影助理满意总分";
  629. DataTable dt_VicePhotographer = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  630. for (int t = 0; t < dt_VicePhotographer.Rows.Count; t++)
  631. {
  632. #region
  633. DataGridViewRow dgvr = new DataGridViewRow();
  634. DataGridViewCell cell = null;
  635. //订单号
  636. cell = new DataGridViewTextBoxCell();
  637. cell.Value = dt_VicePhotographer.Rows[t]["订单号"].ToString().Trim();
  638. dgvr.Cells.Add(cell);
  639. //员工
  640. cell = new DataGridViewTextBoxCell();
  641. cell.Value = StrUserName;
  642. dgvr.Cells.Add(cell);
  643. //职务
  644. cell = new DataGridViewTextBoxCell();
  645. cell.Value = "摄影助理";
  646. dgvr.Cells.Add(cell);
  647. //客户姓名
  648. cell = new DataGridViewTextBoxCell();
  649. cell.Value = dt_VicePhotographer.Rows[t]["客户名称"].ToString().Trim();
  650. dgvr.Cells.Add(cell);
  651. //收款金额
  652. cell = new DataGridViewTextBoxCell();
  653. if (dt_VicePhotographer.Rows[t]["订单类型"].ToString() != "1")
  654. { cell.Value = Convert.ToDecimal(dt_VicePhotographer.Rows[t]["收款金额"]).ToString("N2"); }
  655. else
  656. { cell.Value = GetChildrenAmount(dt_VicePhotographer.Rows[t]["订单号"].ToString().Trim(), Convert.ToDecimal(dt_VicePhotographer.Rows[t]["应收金额"]), Convert.ToDecimal(dt_VicePhotographer.Rows[t]["收款金额"]), dt_VicePhotographer.Rows[t]["拍摄名称"].ToString()); }
  657. dgvr.Cells.Add(cell);
  658. //收款时间
  659. cell = new DataGridViewTextBoxCell();
  660. cell.Value = dt_VicePhotographer.Rows[t]["收款时间"].ToString().Trim();
  661. dgvr.Cells.Add(cell);
  662. //套系类别
  663. cell = new DataGridViewTextBoxCell();
  664. cell.Value = dt_VicePhotographer.Rows[t]["套系类别"].ToString().Trim();
  665. dgvr.Cells.Add(cell);
  666. //套系名称
  667. cell = new DataGridViewTextBoxCell();
  668. cell.Value = dt_VicePhotographer.Rows[t]["套系名称"].ToString().Trim();
  669. dgvr.Cells.Add(cell);
  670. //应收金额
  671. cell = new DataGridViewTextBoxCell();
  672. cell.Value = dt_VicePhotographer.Rows[t]["应收金额"].ToString().Trim();
  673. dgvr.Cells.Add(cell);
  674. //项目名称
  675. cell = new DataGridViewTextBoxCell();
  676. if (string.IsNullOrEmpty(dt_VicePhotographer.Rows[t]["项目名称"].ToString().Trim()))
  677. { cell.Value = dt_VicePhotographer.Rows[t]["收款类别"].ToString(); }
  678. else { cell.Value = dt_VicePhotographer.Rows[t]["项目名称"].ToString().Trim(); }
  679. dgvr.Cells.Add(cell);
  680. //付款名称
  681. cell = new DataGridViewTextBoxCell();
  682. cell.Value = dt_VicePhotographer.Rows[t]["付款方式名称"].ToString().Trim();
  683. dgvr.Cells.Add(cell);
  684. //拍摄状态
  685. cell = new DataGridViewTextBoxCell();
  686. if (Convert.ToInt32(dt_VicePhotographer.Rows[t]["未拍个数"]) == 0)
  687. { cell.Value = "OK"; }
  688. else { cell.Value = "未拍"; }
  689. dgvr.Cells.Add(cell);
  690. //拍摄时间
  691. cell = new DataGridViewTextBoxCell();
  692. cell.Value = dt_VicePhotographer.Rows[t]["最后拍摄时间"].ToString();
  693. dgvr.Cells.Add(cell);
  694. //选片状态
  695. cell = new DataGridViewTextBoxCell();
  696. if (dt_VicePhotographer.Rows[t]["选片状态"].ToString() == "OK")
  697. { cell.Value = "OK"; }
  698. else { cell.Value = "未选"; }
  699. dgvr.Cells.Add(cell);
  700. //选片时间
  701. cell = new DataGridViewTextBoxCell();
  702. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_VicePhotographer.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  703. dgvr.Cells.Add(cell);
  704. //取件状态
  705. cell = new DataGridViewTextBoxCell();
  706. if (dt_VicePhotographer.Rows[t]["取件状态"].ToString() == "OK")
  707. { cell.Value = "OK"; }
  708. else { cell.Value = "未取"; }
  709. dgvr.Cells.Add(cell);
  710. //取件时间
  711. cell = new DataGridViewTextBoxCell();
  712. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_VicePhotographer.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  713. dgvr.Cells.Add(cell);
  714. //拍摄名称
  715. cell = new DataGridViewTextBoxCell();
  716. cell.Value = dt_VicePhotographer.Rows[t]["拍摄名称"].ToString();
  717. dgvr.Cells.Add(cell);
  718. //订单类型
  719. cell = new DataGridViewTextBoxCell();
  720. cell.Value = dt_VicePhotographer.Rows[t]["订单类型"].ToString();
  721. dgvr.Cells.Add(cell);
  722. //收款类型
  723. cell = new DataGridViewTextBoxCell();
  724. cell.Value = dt_VicePhotographer.Rows[t]["收款类别"].ToString();
  725. dgvr.Cells.Add(cell);
  726. //副订单
  727. cell = new DataGridViewTextBoxCell();
  728. cell.Value = dt_VicePhotographer.Rows[t]["副订单"].ToString();
  729. dgvr.Cells.Add(cell);
  730. //摄影助理满意总分
  731. cell = new DataGridViewTextBoxCell();
  732. cell.Value = dt_VicePhotographer.Rows[t]["摄影助理满意总分"].ToString();
  733. dgvr.Cells.Add(cell);
  734. this.Invoke(new UpdateControl(delegate()
  735. {
  736. this.dgv.Rows.Add(dgvr);
  737. }));
  738. #endregion
  739. }
  740. }
  741. }
  742. #endregion
  743. }
  744. }
  745. }
  746. ConfigureRow = dt_SystemConfigure.Select("Sconfig_Code='MakeupArtistEarly' and Sconfig_IsEnabled=1");
  747. if (ConfigureRow.Length > 0)
  748. {
  749. if (ConfigureRow[0]["Sconfig_Value"].ToString() == "1")
  750. {
  751. if (this.Str_ProjectTitle.Trim() == "" || this.Str_ProjectTitle.Trim() == "化妆前期")
  752. {
  753. #region 主化妆师
  754. s = "";
  755. strBuilder = new StringBuilder();
  756. strBuilder.Append(" 收款类别 <> '后期收款'");
  757. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  758. { strBuilder.Append(" And 主化妆ID like '%" + EmployeeName + "%' "); }
  759. if (this.Str_ProcessStatus.Trim() == "")
  760. { strBuilder.Append(" And 未拍个数 = 0 And (服务前期查询时间 >= '" + StartTime + "' And 服务前期查询时间 <= '" + EndTime + " 23:59:59.000')"); }
  761. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  762. { strBuilder.Append(" And 未拍个数 = 0 And (最后拍摄时间 >= '" + StartTime + "' And 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  763. if (this.Str_ProcessStatus.Trim() == "选片OK")
  764. { strBuilder.Append(" And 选片状态 = 'OK' And (选片时间 >= '" + StartTime + "' And 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  765. if (this.Str_ProcessStatus.Trim() == "取件OK")
  766. { strBuilder.Append(" And 取件状态 = 'OK' And (取件日期 >= '" + StartTime + "' And 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  767. if (!string.IsNullOrEmpty(this.Str_Scores1))
  768. { strBuilder.Append(" and (主化妆满意总分>=" + this.Str_Scores1 + " and 主化妆满意总分<=" + this.Str_Scores2 + ")"); }
  769. s = BindSelect5();
  770. DataTable dtCount1 = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  771. if (dtCount1.Rows.Count > 0)
  772. {
  773. if (Convert.ToInt32(dtCount1.Rows[0]["CountID"]) > 0)
  774. {
  775. backgroundWorker.ReportProgress(0, "正在获取'主化妆师前期业绩' ...");
  776. string StrColumnName = "订单号,客户名称,订单类型,收款金额,应收金额,拍摄名称,收款时间,套系类别,套系名称,项目名称,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,取件状态,取件日期,副订单,主化妆满意总分";
  777. DataTable dt_MainMakeupArtist = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  778. for (int t = 0; t < dt_MainMakeupArtist.Rows.Count; t++)
  779. {
  780. #region
  781. DataGridViewRow dgvr = new DataGridViewRow();
  782. DataGridViewCell cell = null;
  783. //订单号
  784. cell = new DataGridViewTextBoxCell();
  785. cell.Value = dt_MainMakeupArtist.Rows[t]["订单号"].ToString().Trim();
  786. dgvr.Cells.Add(cell);
  787. //员工
  788. cell = new DataGridViewTextBoxCell();
  789. cell.Value = StrUserName;
  790. dgvr.Cells.Add(cell);
  791. //职务
  792. cell = new DataGridViewTextBoxCell();
  793. cell.Value = "主化妆师";
  794. dgvr.Cells.Add(cell);
  795. //客户姓名
  796. cell = new DataGridViewTextBoxCell();
  797. cell.Value = dt_MainMakeupArtist.Rows[t]["客户名称"].ToString().Trim();
  798. dgvr.Cells.Add(cell);
  799. //收款金额
  800. cell = new DataGridViewTextBoxCell();
  801. if (dt_MainMakeupArtist.Rows[t]["订单类型"].ToString() != "1")
  802. { cell.Value = Convert.ToDecimal(dt_MainMakeupArtist.Rows[t]["收款金额"]).ToString("N2"); }
  803. else
  804. { cell.Value = GetChildrenAmount(dt_MainMakeupArtist.Rows[t]["订单号"].ToString().Trim(), Convert.ToDecimal(dt_MainMakeupArtist.Rows[t]["应收金额"]), Convert.ToDecimal(dt_MainMakeupArtist.Rows[t]["收款金额"]), dt_MainMakeupArtist.Rows[t]["拍摄名称"].ToString()); }
  805. dgvr.Cells.Add(cell);
  806. //收款时间
  807. cell = new DataGridViewTextBoxCell();
  808. cell.Value = dt_MainMakeupArtist.Rows[t]["收款时间"].ToString().Trim();
  809. dgvr.Cells.Add(cell);
  810. //套系类别
  811. cell = new DataGridViewTextBoxCell();
  812. cell.Value = dt_MainMakeupArtist.Rows[t]["套系类别"].ToString().Trim();
  813. dgvr.Cells.Add(cell);
  814. //套系名称
  815. cell = new DataGridViewTextBoxCell();
  816. cell.Value = dt_MainMakeupArtist.Rows[t]["套系名称"].ToString().Trim();
  817. dgvr.Cells.Add(cell);
  818. //应收金额
  819. cell = new DataGridViewTextBoxCell();
  820. cell.Value = Convert.ToDecimal(dt_MainMakeupArtist.Rows[t]["应收金额"]).ToString("N2").Trim();
  821. dgvr.Cells.Add(cell);
  822. //项目名称
  823. cell = new DataGridViewTextBoxCell();
  824. if (string.IsNullOrEmpty(dt_MainMakeupArtist.Rows[t]["项目名称"].ToString().Trim()))
  825. { cell.Value = dt_MainMakeupArtist.Rows[t]["收款类别"].ToString(); }
  826. else
  827. { cell.Value = dt_MainMakeupArtist.Rows[t]["项目名称"].ToString().Trim(); }
  828. dgvr.Cells.Add(cell);
  829. //付款名称
  830. cell = new DataGridViewTextBoxCell();
  831. cell.Value = dt_MainMakeupArtist.Rows[t]["付款方式名称"].ToString().Trim();
  832. dgvr.Cells.Add(cell);
  833. //拍摄状态
  834. cell = new DataGridViewTextBoxCell();
  835. if (Convert.ToInt32(dt_MainMakeupArtist.Rows[t]["未拍个数"]) == 0)
  836. { cell.Value = "OK"; }
  837. else
  838. { cell.Value = "未拍"; }
  839. dgvr.Cells.Add(cell);
  840. //拍摄时间
  841. cell = new DataGridViewTextBoxCell();
  842. cell.Value = dt_MainMakeupArtist.Rows[t]["最后拍摄时间"].ToString();
  843. dgvr.Cells.Add(cell);
  844. //选片状态
  845. cell = new DataGridViewTextBoxCell();
  846. if (dt_MainMakeupArtist.Rows[t]["选片状态"].ToString() == "OK")
  847. { cell.Value = "OK"; }
  848. else
  849. { cell.Value = "未选"; }
  850. dgvr.Cells.Add(cell);
  851. //选片时间
  852. cell = new DataGridViewTextBoxCell();
  853. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_MainMakeupArtist.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  854. dgvr.Cells.Add(cell);
  855. //取件状态
  856. cell = new DataGridViewTextBoxCell();
  857. if (dt_MainMakeupArtist.Rows[t]["取件状态"].ToString() == "OK")
  858. { cell.Value = "OK"; }
  859. else
  860. { cell.Value = "未取"; }
  861. dgvr.Cells.Add(cell);
  862. //取件时间
  863. cell = new DataGridViewTextBoxCell();
  864. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_MainMakeupArtist.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  865. dgvr.Cells.Add(cell);
  866. //拍摄名称
  867. cell = new DataGridViewTextBoxCell();
  868. cell.Value = dt_MainMakeupArtist.Rows[t]["拍摄名称"].ToString();
  869. dgvr.Cells.Add(cell);
  870. //订单类型
  871. cell = new DataGridViewTextBoxCell();
  872. cell.Value = dt_MainMakeupArtist.Rows[t]["订单类型"].ToString();
  873. dgvr.Cells.Add(cell);
  874. //收款类型
  875. cell = new DataGridViewTextBoxCell();
  876. cell.Value = dt_MainMakeupArtist.Rows[t]["收款类别"].ToString();
  877. dgvr.Cells.Add(cell);
  878. //副订单
  879. cell = new DataGridViewTextBoxCell();
  880. cell.Value = dt_MainMakeupArtist.Rows[t]["副订单"].ToString();
  881. dgvr.Cells.Add(cell);
  882. //主化妆满意总分
  883. cell = new DataGridViewTextBoxCell();
  884. cell.Value = dt_MainMakeupArtist.Rows[t]["主化妆满意总分"].ToString();
  885. dgvr.Cells.Add(cell);
  886. #endregion
  887. this.Invoke(new UpdateControl(delegate()
  888. {
  889. this.dgv.Rows.Add(dgvr);
  890. }));
  891. }
  892. }
  893. }
  894. #endregion
  895. #region 化妆助理
  896. s = "";
  897. strBuilder = new StringBuilder();
  898. strBuilder.Append(" 收款类别 <> '后期收款'");
  899. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  900. { strBuilder.Append(" And 化妆助理ID like '%" + EmployeeName + "%' "); }
  901. if (this.Str_ProcessStatus.Trim() == "")
  902. { strBuilder.Append(" And 未拍个数 = 0 And (服务前期查询时间 >= '" + StartTime + "' And 服务前期查询时间 <= '" + EndTime + " 23:59:59.000')"); }
  903. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  904. { strBuilder.Append(" And 未拍个数 = 0 And (最后拍摄时间 >= '" + StartTime + "' And 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  905. if (this.Str_ProcessStatus.Trim() == "选片OK")
  906. { strBuilder.Append(" And 选片状态 = 'OK' And (选片时间 >= '" + StartTime + "' And 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  907. if (this.Str_ProcessStatus.Trim() == "取件OK")
  908. { strBuilder.Append(" And 取件状态 = 'OK' And (取件日期 >= '" + StartTime + "' And 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  909. if (!string.IsNullOrEmpty(this.Str_Scores1))
  910. { strBuilder.Append(" and (化妆助理满意总分>=" + this.Str_Scores1 + " and 化妆助理满意总分<=" + this.Str_Scores2 + ")"); }
  911. s = BindSelect5();
  912. DataTable dtCount2 = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  913. if (dtCount2.Rows.Count > 0)
  914. {
  915. if (Convert.ToInt32(dtCount2.Rows[0]["CountID"]) > 0)
  916. {
  917. backgroundWorker.ReportProgress(0, "正在获取'化妆助理前期业绩' ...");
  918. string StrColumnName = "订单号,客户名称,订单类型,收款金额,应收金额,拍摄名称,收款时间,套系类别,套系名称,项目名称,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,取件状态,取件日期,副订单,化妆助理满意总分";
  919. DataTable dt_ViceMakeupArtist = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  920. for (int t = 0; t < dt_ViceMakeupArtist.Rows.Count; t++)
  921. {
  922. #region
  923. DataGridViewRow dgvr = new DataGridViewRow();
  924. DataGridViewCell cell = null;
  925. //订单号
  926. cell = new DataGridViewTextBoxCell();
  927. cell.Value = dt_ViceMakeupArtist.Rows[t]["订单号"].ToString().Trim();
  928. dgvr.Cells.Add(cell);
  929. //员工
  930. cell = new DataGridViewTextBoxCell();
  931. cell.Value = StrUserName;
  932. dgvr.Cells.Add(cell);
  933. //职务
  934. cell = new DataGridViewTextBoxCell();
  935. cell.Value = "化妆助理";
  936. dgvr.Cells.Add(cell);
  937. //客户姓名
  938. cell = new DataGridViewTextBoxCell();
  939. cell.Value = dt_ViceMakeupArtist.Rows[t]["客户名称"].ToString().Trim();
  940. dgvr.Cells.Add(cell);
  941. //收款金额
  942. cell = new DataGridViewTextBoxCell();
  943. if (dt_ViceMakeupArtist.Rows[t]["订单类型"].ToString() != "1")
  944. { cell.Value = Convert.ToDecimal(dt_ViceMakeupArtist.Rows[t]["收款金额"]).ToString("N2"); }
  945. else { cell.Value = GetChildrenAmount(dt_ViceMakeupArtist.Rows[t]["订单号"].ToString().Trim(), Convert.ToDecimal(dt_ViceMakeupArtist.Rows[t]["应收金额"]), Convert.ToDecimal(dt_ViceMakeupArtist.Rows[t]["收款金额"]), dt_ViceMakeupArtist.Rows[t]["拍摄名称"].ToString()); }
  946. dgvr.Cells.Add(cell);
  947. //收款时间
  948. cell = new DataGridViewTextBoxCell();
  949. cell.Value = dt_ViceMakeupArtist.Rows[t]["收款时间"].ToString().Trim();
  950. dgvr.Cells.Add(cell);
  951. //套系类别
  952. cell = new DataGridViewTextBoxCell();
  953. cell.Value = dt_ViceMakeupArtist.Rows[t]["套系类别"].ToString().Trim();
  954. dgvr.Cells.Add(cell);
  955. //套系名称
  956. cell = new DataGridViewTextBoxCell();
  957. cell.Value = dt_ViceMakeupArtist.Rows[t]["套系名称"].ToString().Trim();
  958. dgvr.Cells.Add(cell);
  959. //应收金额
  960. cell = new DataGridViewTextBoxCell();
  961. cell.Value = Convert.ToDecimal(dt_ViceMakeupArtist.Rows[t]["应收金额"]).ToString("N2").Trim();
  962. dgvr.Cells.Add(cell);
  963. //项目名称
  964. cell = new DataGridViewTextBoxCell();
  965. if (string.IsNullOrEmpty(dt_ViceMakeupArtist.Rows[t]["项目名称"].ToString().Trim()))
  966. { cell.Value = dt_ViceMakeupArtist.Rows[t]["收款类别"].ToString(); }
  967. else { cell.Value = dt_ViceMakeupArtist.Rows[t]["项目名称"].ToString().Trim(); }
  968. dgvr.Cells.Add(cell);
  969. //付款名称
  970. cell = new DataGridViewTextBoxCell();
  971. cell.Value = dt_ViceMakeupArtist.Rows[t]["付款方式名称"].ToString().Trim();
  972. dgvr.Cells.Add(cell);
  973. //拍摄状态
  974. cell = new DataGridViewTextBoxCell();
  975. if (Convert.ToInt32(dt_ViceMakeupArtist.Rows[t]["未拍个数"]) == 0)
  976. { cell.Value = "OK"; }
  977. else { cell.Value = "未拍"; }
  978. dgvr.Cells.Add(cell);
  979. //拍摄时间
  980. cell = new DataGridViewTextBoxCell();
  981. cell.Value = dt_ViceMakeupArtist.Rows[t]["最后拍摄时间"].ToString();
  982. dgvr.Cells.Add(cell);
  983. //选片状态
  984. cell = new DataGridViewTextBoxCell();
  985. if (dt_ViceMakeupArtist.Rows[t]["选片状态"].ToString() == "OK")
  986. { cell.Value = "OK"; }
  987. else { cell.Value = "未选"; }
  988. dgvr.Cells.Add(cell);
  989. //选片时间
  990. cell = new DataGridViewTextBoxCell();
  991. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_ViceMakeupArtist.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  992. dgvr.Cells.Add(cell);
  993. //取件状态
  994. cell = new DataGridViewTextBoxCell();
  995. if (dt_ViceMakeupArtist.Rows[t]["取件状态"].ToString() == "OK")
  996. { cell.Value = "OK"; }
  997. else { cell.Value = "未取"; }
  998. dgvr.Cells.Add(cell);
  999. //取件时间
  1000. cell = new DataGridViewTextBoxCell();
  1001. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_ViceMakeupArtist.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  1002. dgvr.Cells.Add(cell);
  1003. //拍摄名称
  1004. cell = new DataGridViewTextBoxCell();
  1005. cell.Value = dt_ViceMakeupArtist.Rows[t]["拍摄名称"].ToString();
  1006. dgvr.Cells.Add(cell);
  1007. //订单类型
  1008. cell = new DataGridViewTextBoxCell();
  1009. cell.Value = dt_ViceMakeupArtist.Rows[t]["订单类型"].ToString();
  1010. dgvr.Cells.Add(cell);
  1011. //收款类型
  1012. cell = new DataGridViewTextBoxCell();
  1013. cell.Value = dt_ViceMakeupArtist.Rows[t]["收款类别"].ToString();
  1014. dgvr.Cells.Add(cell);
  1015. //副订单
  1016. cell = new DataGridViewTextBoxCell();
  1017. cell.Value = dt_ViceMakeupArtist.Rows[t]["副订单"].ToString();
  1018. dgvr.Cells.Add(cell);
  1019. //化妆助理满意总分
  1020. cell = new DataGridViewTextBoxCell();
  1021. cell.Value = dt_ViceMakeupArtist.Rows[t]["化妆助理满意总分"].ToString();
  1022. dgvr.Cells.Add(cell);
  1023. #endregion
  1024. this.Invoke(new UpdateControl(delegate()
  1025. {
  1026. this.dgv.Rows.Add(dgvr);
  1027. }));
  1028. }
  1029. }
  1030. }
  1031. #endregion
  1032. }
  1033. }
  1034. }
  1035. ConfigureRow = dt_SystemConfigure.Select("Sconfig_Code='BootDivisionEarly' and Sconfig_IsEnabled=1");
  1036. if (ConfigureRow.Length > 0)
  1037. {
  1038. if (ConfigureRow[0]["Sconfig_Value"].ToString() == "1")
  1039. {
  1040. if (this.Str_ProjectTitle.Trim() == "" || this.Str_ProjectTitle.Trim() == "引导前期")
  1041. {
  1042. #region 引导师
  1043. s = "";
  1044. strBuilder = new StringBuilder();
  1045. strBuilder.Append(" 收款类别 <> '后期收款'");
  1046. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  1047. { strBuilder.Append(" And 引导师ID like '%" + EmployeeName + "%' "); }
  1048. if (this.Str_ProcessStatus.Trim() == "")
  1049. { strBuilder.Append(" And 未拍个数 = 0 And (服务前期查询时间 >= '" + StartTime + "' And 服务前期查询时间 <= '" + EndTime + " 23:59:59.000')"); }
  1050. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  1051. { strBuilder.Append(" And 未拍个数 = 0 And (最后拍摄时间 >= '" + StartTime + "' And 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  1052. if (this.Str_ProcessStatus.Trim() == "选片OK")
  1053. { strBuilder.Append(" And 选片状态 = 'OK' And (选片时间 >= '" + StartTime + "' And 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  1054. if (this.Str_ProcessStatus.Trim() == "取件OK")
  1055. { strBuilder.Append(" And 取件状态 = 'OK' And (取件日期 >= '" + StartTime + "' And 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  1056. if (!string.IsNullOrEmpty(this.Str_Scores1))
  1057. { strBuilder.Append(" and (引导满意总分>=" + this.Str_Scores1 + " and 引导满意总分<=" + this.Str_Scores2 + ")"); }
  1058. s = BindSelect5();
  1059. DataTable dtCount1 = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  1060. if (dtCount1.Rows.Count > 0)
  1061. {
  1062. if (Convert.ToInt32(dtCount1.Rows[0]["CountID"]) > 0)
  1063. {
  1064. backgroundWorker.ReportProgress(0, "正在获取'引导师前期业绩' ...");
  1065. string StrColumnName = "订单号,客户名称,订单类型,收款金额,应收金额,拍摄名称,收款时间,套系类别,套系名称,项目名称,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,取件状态,取件日期,副订单,引导满意总分";
  1066. DataTable dt_BootDivisiont = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  1067. for (int t = 0; t < dt_BootDivisiont.Rows.Count; t++)
  1068. {
  1069. #region
  1070. DataGridViewRow dgvr = new DataGridViewRow();
  1071. DataGridViewCell cell = null;
  1072. //订单号
  1073. cell = new DataGridViewTextBoxCell();
  1074. cell.Value = dt_BootDivisiont.Rows[t]["订单号"].ToString().Trim();
  1075. dgvr.Cells.Add(cell);
  1076. //员工
  1077. cell = new DataGridViewTextBoxCell();
  1078. cell.Value = StrUserName;
  1079. dgvr.Cells.Add(cell);
  1080. //职务
  1081. cell = new DataGridViewTextBoxCell();
  1082. cell.Value = "引导师";
  1083. dgvr.Cells.Add(cell);
  1084. //客户姓名
  1085. cell = new DataGridViewTextBoxCell();
  1086. cell.Value = dt_BootDivisiont.Rows[t]["客户名称"].ToString().Trim();
  1087. dgvr.Cells.Add(cell);
  1088. //收款金额
  1089. cell = new DataGridViewTextBoxCell();
  1090. if (dt_BootDivisiont.Rows[t]["订单类型"].ToString() != "1")
  1091. { cell.Value = Convert.ToDecimal(dt_BootDivisiont.Rows[t]["收款金额"]).ToString("N2"); }
  1092. else { cell.Value = GetChildrenAmount(dt_BootDivisiont.Rows[t]["订单号"].ToString().Trim(), Convert.ToDecimal(dt_BootDivisiont.Rows[t]["应收金额"]), Convert.ToDecimal(dt_BootDivisiont.Rows[t]["收款金额"]), dt_BootDivisiont.Rows[t]["拍摄名称"].ToString()); }
  1093. dgvr.Cells.Add(cell);
  1094. //收款时间
  1095. cell = new DataGridViewTextBoxCell();
  1096. cell.Value = dt_BootDivisiont.Rows[t]["收款时间"].ToString().Trim();
  1097. dgvr.Cells.Add(cell);
  1098. //套系类别
  1099. cell = new DataGridViewTextBoxCell();
  1100. cell.Value = dt_BootDivisiont.Rows[t]["套系类别"].ToString().Trim();
  1101. dgvr.Cells.Add(cell);
  1102. //套系名称
  1103. cell = new DataGridViewTextBoxCell();
  1104. cell.Value = dt_BootDivisiont.Rows[t]["套系名称"].ToString().Trim();
  1105. dgvr.Cells.Add(cell);
  1106. //应收金额
  1107. cell = new DataGridViewTextBoxCell();
  1108. cell.Value = Convert.ToDecimal(dt_BootDivisiont.Rows[t]["应收金额"]).ToString("N2").Trim();
  1109. dgvr.Cells.Add(cell);
  1110. //项目名称
  1111. cell = new DataGridViewTextBoxCell();
  1112. if (string.IsNullOrEmpty(dt_BootDivisiont.Rows[t]["项目名称"].ToString().Trim()))
  1113. { cell.Value = dt_BootDivisiont.Rows[t]["收款类别"].ToString(); }
  1114. else { cell.Value = dt_BootDivisiont.Rows[t]["项目名称"].ToString().Trim(); }
  1115. dgvr.Cells.Add(cell);
  1116. //付款名称
  1117. cell = new DataGridViewTextBoxCell();
  1118. cell.Value = dt_BootDivisiont.Rows[t]["付款方式名称"].ToString().Trim();
  1119. dgvr.Cells.Add(cell);
  1120. //拍摄状态
  1121. cell = new DataGridViewTextBoxCell();
  1122. if (Convert.ToInt32(dt_BootDivisiont.Rows[t]["未拍个数"]) == 0)
  1123. { cell.Value = "OK"; }
  1124. else { cell.Value = "未拍"; }
  1125. dgvr.Cells.Add(cell);
  1126. //拍摄时间
  1127. cell = new DataGridViewTextBoxCell();
  1128. cell.Value = dt_BootDivisiont.Rows[t]["最后拍摄时间"].ToString();
  1129. dgvr.Cells.Add(cell);
  1130. //选片状态
  1131. cell = new DataGridViewTextBoxCell();
  1132. if (dt_BootDivisiont.Rows[t]["选片状态"].ToString() == "OK")
  1133. { cell.Value = "OK"; }
  1134. else { cell.Value = "未选"; }
  1135. dgvr.Cells.Add(cell);
  1136. //选片时间
  1137. cell = new DataGridViewTextBoxCell();
  1138. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_BootDivisiont.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  1139. dgvr.Cells.Add(cell);
  1140. //取件状态
  1141. cell = new DataGridViewTextBoxCell();
  1142. if (dt_BootDivisiont.Rows[t]["取件状态"].ToString() == "OK")
  1143. { cell.Value = "OK"; }
  1144. else { cell.Value = "未取"; }
  1145. dgvr.Cells.Add(cell);
  1146. //取件时间
  1147. cell = new DataGridViewTextBoxCell();
  1148. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_BootDivisiont.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  1149. dgvr.Cells.Add(cell);
  1150. //拍摄名称
  1151. cell = new DataGridViewTextBoxCell();
  1152. cell.Value = dt_BootDivisiont.Rows[t]["拍摄名称"].ToString();
  1153. dgvr.Cells.Add(cell);
  1154. //订单类型
  1155. cell = new DataGridViewTextBoxCell();
  1156. cell.Value = dt_BootDivisiont.Rows[t]["订单类型"].ToString();
  1157. dgvr.Cells.Add(cell);
  1158. //收款类型
  1159. cell = new DataGridViewTextBoxCell();
  1160. cell.Value = dt_BootDivisiont.Rows[t]["收款类别"].ToString();
  1161. dgvr.Cells.Add(cell);
  1162. //副订单
  1163. cell = new DataGridViewTextBoxCell();
  1164. cell.Value = dt_BootDivisiont.Rows[t]["副订单"].ToString();
  1165. dgvr.Cells.Add(cell);
  1166. //引导满意总分
  1167. cell = new DataGridViewTextBoxCell();
  1168. cell.Value = dt_BootDivisiont.Rows[t]["引导满意总分"].ToString();
  1169. dgvr.Cells.Add(cell);
  1170. #endregion
  1171. this.Invoke(new UpdateControl(delegate()
  1172. {
  1173. this.dgv.Rows.Add(dgvr);
  1174. }));
  1175. }
  1176. }
  1177. }
  1178. #endregion
  1179. #region 引导助理
  1180. s = "";
  1181. strBuilder = new StringBuilder();
  1182. strBuilder.Append(" 收款类别 <> '后期收款'");
  1183. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  1184. { strBuilder.Append(" And 引导助理ID like '%" + EmployeeName + "%' "); }
  1185. if (this.Str_ProcessStatus.Trim() == "")
  1186. { strBuilder.Append(" And 未拍个数 = 0 And (服务前期查询时间 >= '" + StartTime + "' And 服务前期查询时间 <= '" + EndTime + " 23:59:59.000')"); }
  1187. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  1188. { strBuilder.Append(" And 未拍个数 = 0 And (最后拍摄时间 >= '" + StartTime + "' And 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  1189. if (this.Str_ProcessStatus.Trim() == "选片OK")
  1190. { strBuilder.Append(" And 选片状态 = 'OK' And (选片时间 >= '" + StartTime + "' And 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  1191. if (this.Str_ProcessStatus.Trim() == "取件OK")
  1192. { strBuilder.Append(" And 取件状态 = 'OK' And (取件日期 >= '" + StartTime + "' And 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  1193. if (!string.IsNullOrEmpty(this.Str_Scores1))
  1194. { strBuilder.Append(" and (引导助理满意总分>=" + this.Str_Scores1 + " and 引导助理满意总分<=" + this.Str_Scores2 + ")"); }
  1195. s = BindSelect5();
  1196. DataTable dtCount2 = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  1197. if (dtCount2.Rows.Count > 0)
  1198. {
  1199. if (Convert.ToInt32(dtCount2.Rows[0]["CountID"]) > 0)
  1200. {
  1201. backgroundWorker.ReportProgress(0, "正在获取'引导师助理前期业绩' ...");
  1202. string StrColumnName = "订单号,客户名称,订单类型,收款金额,应收金额,拍摄名称,收款时间,套系类别,套系名称,项目名称,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,取件状态,取件日期,副订单,引导助理满意总分";
  1203. DataTable dt_BootDivisiont = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  1204. for (int t = 0; t < dt_BootDivisiont.Rows.Count; t++)
  1205. {
  1206. #region
  1207. DataGridViewRow dgvr = new DataGridViewRow();
  1208. DataGridViewCell cell = null;
  1209. //订单号
  1210. cell = new DataGridViewTextBoxCell();
  1211. cell.Value = dt_BootDivisiont.Rows[t]["订单号"].ToString().Trim();
  1212. dgvr.Cells.Add(cell);
  1213. //员工
  1214. cell = new DataGridViewTextBoxCell();
  1215. cell.Value = StrUserName;
  1216. dgvr.Cells.Add(cell);
  1217. //职务
  1218. cell = new DataGridViewTextBoxCell();
  1219. cell.Value = "引导助理";
  1220. dgvr.Cells.Add(cell);
  1221. //客户姓名
  1222. cell = new DataGridViewTextBoxCell();
  1223. cell.Value = dt_BootDivisiont.Rows[t]["客户名称"].ToString().Trim();
  1224. dgvr.Cells.Add(cell);
  1225. //收款金额
  1226. cell = new DataGridViewTextBoxCell();
  1227. if (dt_BootDivisiont.Rows[t]["订单类型"].ToString() != "1")
  1228. { cell.Value = Convert.ToDecimal(dt_BootDivisiont.Rows[t]["收款金额"]).ToString("N2"); }
  1229. else { cell.Value = GetChildrenAmount(dt_BootDivisiont.Rows[t]["订单号"].ToString().Trim(), Convert.ToDecimal(dt_BootDivisiont.Rows[t]["应收金额"]), Convert.ToDecimal(dt_BootDivisiont.Rows[t]["收款金额"]), dt_BootDivisiont.Rows[t]["拍摄名称"].ToString()); }
  1230. dgvr.Cells.Add(cell);
  1231. //收款时间
  1232. cell = new DataGridViewTextBoxCell();
  1233. cell.Value = dt_BootDivisiont.Rows[t]["收款时间"].ToString().Trim();
  1234. dgvr.Cells.Add(cell);
  1235. //套系类别
  1236. cell = new DataGridViewTextBoxCell();
  1237. cell.Value = dt_BootDivisiont.Rows[t]["套系类别"].ToString().Trim();
  1238. dgvr.Cells.Add(cell);
  1239. //套系名称
  1240. cell = new DataGridViewTextBoxCell();
  1241. cell.Value = dt_BootDivisiont.Rows[t]["套系名称"].ToString().Trim();
  1242. dgvr.Cells.Add(cell);
  1243. //应收金额
  1244. cell = new DataGridViewTextBoxCell();
  1245. cell.Value = Convert.ToDecimal(dt_BootDivisiont.Rows[t]["应收金额"]).ToString("N2").Trim();
  1246. dgvr.Cells.Add(cell);
  1247. //项目名称
  1248. cell = new DataGridViewTextBoxCell();
  1249. if (string.IsNullOrEmpty(dt_BootDivisiont.Rows[t]["项目名称"].ToString().Trim()))
  1250. { cell.Value = dt_BootDivisiont.Rows[t]["收款类别"].ToString(); }
  1251. else { cell.Value = dt_BootDivisiont.Rows[t]["项目名称"].ToString().Trim(); }
  1252. dgvr.Cells.Add(cell);
  1253. //付款名称
  1254. cell = new DataGridViewTextBoxCell();
  1255. cell.Value = dt_BootDivisiont.Rows[t]["付款方式名称"].ToString().Trim();
  1256. dgvr.Cells.Add(cell);
  1257. //拍摄状态
  1258. cell = new DataGridViewTextBoxCell();
  1259. if (Convert.ToInt32(dt_BootDivisiont.Rows[t]["未拍个数"]) == 0)
  1260. { cell.Value = "OK"; }
  1261. else { cell.Value = "未拍"; }
  1262. dgvr.Cells.Add(cell);
  1263. //拍摄时间
  1264. cell = new DataGridViewTextBoxCell();
  1265. cell.Value = dt_BootDivisiont.Rows[t]["最后拍摄时间"].ToString();
  1266. dgvr.Cells.Add(cell);
  1267. //选片状态
  1268. cell = new DataGridViewTextBoxCell();
  1269. if (dt_BootDivisiont.Rows[t]["选片状态"].ToString() == "OK")
  1270. { cell.Value = "OK"; }
  1271. else { cell.Value = "未选"; }
  1272. dgvr.Cells.Add(cell);
  1273. //选片时间
  1274. cell = new DataGridViewTextBoxCell();
  1275. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_BootDivisiont.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  1276. dgvr.Cells.Add(cell);
  1277. //取件状态
  1278. cell = new DataGridViewTextBoxCell();
  1279. if (dt_BootDivisiont.Rows[t]["取件状态"].ToString() == "OK")
  1280. { cell.Value = "OK"; }
  1281. else { cell.Value = "未取"; }
  1282. dgvr.Cells.Add(cell);
  1283. //取件时间
  1284. cell = new DataGridViewTextBoxCell();
  1285. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_BootDivisiont.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  1286. dgvr.Cells.Add(cell);
  1287. //拍摄名称
  1288. cell = new DataGridViewTextBoxCell();
  1289. cell.Value = dt_BootDivisiont.Rows[t]["拍摄名称"].ToString();
  1290. dgvr.Cells.Add(cell);
  1291. //订单类型
  1292. cell = new DataGridViewTextBoxCell();
  1293. cell.Value = dt_BootDivisiont.Rows[t]["订单类型"].ToString();
  1294. dgvr.Cells.Add(cell);
  1295. //收款类型
  1296. cell = new DataGridViewTextBoxCell();
  1297. cell.Value = dt_BootDivisiont.Rows[t]["收款类别"].ToString();
  1298. dgvr.Cells.Add(cell);
  1299. //副订单
  1300. cell = new DataGridViewTextBoxCell();
  1301. cell.Value = dt_BootDivisiont.Rows[t]["副订单"].ToString();
  1302. dgvr.Cells.Add(cell);
  1303. //引导满意总分
  1304. cell = new DataGridViewTextBoxCell();
  1305. cell.Value = dt_BootDivisiont.Rows[t]["引导助理满意总分"].ToString();
  1306. dgvr.Cells.Add(cell);
  1307. #endregion
  1308. this.Invoke(new UpdateControl(delegate()
  1309. {
  1310. this.dgv.Rows.Add(dgvr);
  1311. }));
  1312. }
  1313. }
  1314. }
  1315. #endregion
  1316. }
  1317. }
  1318. }
  1319. ConfigureRow = dt_SystemConfigure.Select("Sconfig_Code='FirstRepairDivisionEarly' and Sconfig_IsEnabled=1");
  1320. if (ConfigureRow.Length > 0)
  1321. {
  1322. if (ConfigureRow[0]["Sconfig_Value"].ToString() == "1")
  1323. {
  1324. if (this.Str_ProjectTitle.Trim() == "" || this.Str_ProjectTitle.Trim() == "初修前期")
  1325. {
  1326. #region 初修师
  1327. s = "";
  1328. strBuilder = new StringBuilder();
  1329. strBuilder.Append(" 收款类别 <> '后期收款'");
  1330. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  1331. { strBuilder.Append(" And 初修师ID like '%" + EmployeeName + "%' "); }
  1332. if (this.Str_ProcessStatus.Trim() == "")
  1333. { strBuilder.Append(" And 未拍个数 = 0 And 服务前期初修查询状态 = '2' And (服务前期初修查询时间 >= '" + StartTime + "' And 服务前期初修查询时间 <= '" + EndTime + " 23:59:59.000')"); }
  1334. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  1335. { strBuilder.Append(" And 未拍个数 = 0 And (最后拍摄时间 >= '" + StartTime + "' And 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  1336. if (this.Str_ProcessStatus.Trim() == "选片OK")
  1337. { strBuilder.Append(" And 选片状态 = 'OK' And (选片时间 >= '" + StartTime + "' And 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  1338. if (this.Str_ProcessStatus.Trim() == "取件OK")
  1339. { strBuilder.Append(" And 取件状态 = 'OK' And (取件日期 >= '" + StartTime + "' And 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  1340. if (!string.IsNullOrEmpty(this.Str_Scores1))
  1341. { strBuilder.Append(" and (初修师满意总分>=" + this.Str_Scores1 + " and 初修师满意总分<=" + this.Str_Scores2 + ")"); }
  1342. s = BindSelect5();
  1343. DataTable dtCount = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  1344. if (dtCount.Rows.Count > 0)
  1345. {
  1346. if (Convert.ToInt32(dtCount.Rows[0]["CountID"]) > 0)
  1347. {
  1348. backgroundWorker.ReportProgress(0, "正在获取'初修师前期业绩' ...");
  1349. string StrColumnName = "订单号,客户名称,订单类型,收款金额,应收金额,拍摄名称,收款时间,套系类别,套系名称,项目名称,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,取件状态,取件日期,副订单,初修师满意总分";
  1350. DataTable dt_EarlyRepair = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  1351. for (int t = 0; t < dt_EarlyRepair.Rows.Count; t++)
  1352. {
  1353. #region
  1354. DataGridViewRow dgvr = new DataGridViewRow();
  1355. DataGridViewCell cell = null;
  1356. //订单号
  1357. cell = new DataGridViewTextBoxCell();
  1358. cell.Value = dt_EarlyRepair.Rows[t]["订单号"].ToString().Trim();
  1359. dgvr.Cells.Add(cell);
  1360. //员工
  1361. cell = new DataGridViewTextBoxCell();
  1362. cell.Value = StrUserName;
  1363. dgvr.Cells.Add(cell);
  1364. //职务
  1365. cell = new DataGridViewTextBoxCell();
  1366. cell.Value = "初修师";
  1367. dgvr.Cells.Add(cell);
  1368. //客户姓名
  1369. cell = new DataGridViewTextBoxCell();
  1370. cell.Value = dt_EarlyRepair.Rows[t]["客户名称"].ToString().Trim();
  1371. dgvr.Cells.Add(cell);
  1372. //收款金额
  1373. cell = new DataGridViewTextBoxCell();
  1374. if (dt_EarlyRepair.Rows[t]["订单类型"].ToString() != "1")
  1375. { cell.Value = Convert.ToDecimal(dt_EarlyRepair.Rows[t]["收款金额"]).ToString("N2"); }
  1376. else { cell.Value = GetChildrenAmount(dt_EarlyRepair.Rows[t]["订单号"].ToString().Trim(), Convert.ToDecimal(dt_EarlyRepair.Rows[t]["应收金额"]), Convert.ToDecimal(dt_EarlyRepair.Rows[t]["收款金额"]), dt_EarlyRepair.Rows[t]["拍摄名称"].ToString()); }
  1377. dgvr.Cells.Add(cell);
  1378. //收款时间
  1379. cell = new DataGridViewTextBoxCell();
  1380. cell.Value = dt_EarlyRepair.Rows[t]["收款时间"].ToString().Trim();
  1381. dgvr.Cells.Add(cell);
  1382. //套系类别
  1383. cell = new DataGridViewTextBoxCell();
  1384. cell.Value = dt_EarlyRepair.Rows[t]["套系类别"].ToString().Trim();
  1385. dgvr.Cells.Add(cell);
  1386. //套系名称
  1387. cell = new DataGridViewTextBoxCell();
  1388. cell.Value = dt_EarlyRepair.Rows[t]["套系名称"].ToString().Trim();
  1389. dgvr.Cells.Add(cell);
  1390. //应收金额
  1391. cell = new DataGridViewTextBoxCell();
  1392. cell.Value = Convert.ToDecimal(dt_EarlyRepair.Rows[t]["应收金额"]).ToString("N2").Trim();
  1393. dgvr.Cells.Add(cell);
  1394. //项目名称
  1395. cell = new DataGridViewTextBoxCell();
  1396. if (string.IsNullOrEmpty(dt_EarlyRepair.Rows[t]["项目名称"].ToString().Trim()))
  1397. { cell.Value = dt_EarlyRepair.Rows[t]["收款类别"].ToString(); }
  1398. else { cell.Value = dt_EarlyRepair.Rows[t]["项目名称"].ToString().Trim(); }
  1399. dgvr.Cells.Add(cell);
  1400. //付款名称
  1401. cell = new DataGridViewTextBoxCell();
  1402. cell.Value = dt_EarlyRepair.Rows[t]["付款方式名称"].ToString().Trim();
  1403. dgvr.Cells.Add(cell);
  1404. //拍摄状态
  1405. cell = new DataGridViewTextBoxCell();
  1406. if (Convert.ToInt32(dt_EarlyRepair.Rows[t]["未拍个数"]) == 0)
  1407. { cell.Value = "OK"; }
  1408. else { cell.Value = "未拍"; }
  1409. dgvr.Cells.Add(cell);
  1410. //拍摄时间
  1411. cell = new DataGridViewTextBoxCell();
  1412. cell.Value = dt_EarlyRepair.Rows[t]["最后拍摄时间"].ToString();
  1413. dgvr.Cells.Add(cell);
  1414. //选片状态
  1415. cell = new DataGridViewTextBoxCell();
  1416. if (dt_EarlyRepair.Rows[t]["选片状态"].ToString() == "OK")
  1417. { cell.Value = "OK"; }
  1418. else { cell.Value = "未选"; }
  1419. dgvr.Cells.Add(cell);
  1420. //选片时间
  1421. cell = new DataGridViewTextBoxCell();
  1422. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_EarlyRepair.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  1423. dgvr.Cells.Add(cell);
  1424. //取件状态
  1425. cell = new DataGridViewTextBoxCell();
  1426. if (dt_EarlyRepair.Rows[t]["取件状态"].ToString() == "OK")
  1427. { cell.Value = "OK"; }
  1428. else { cell.Value = "未取"; }
  1429. dgvr.Cells.Add(cell);
  1430. //取件时间
  1431. cell = new DataGridViewTextBoxCell();
  1432. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_EarlyRepair.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  1433. dgvr.Cells.Add(cell);
  1434. //拍摄名称
  1435. cell = new DataGridViewTextBoxCell();
  1436. cell.Value = dt_EarlyRepair.Rows[t]["拍摄名称"].ToString();
  1437. dgvr.Cells.Add(cell);
  1438. //订单类型
  1439. cell = new DataGridViewTextBoxCell();
  1440. cell.Value = dt_EarlyRepair.Rows[t]["订单类型"].ToString();
  1441. dgvr.Cells.Add(cell);
  1442. //收款类型
  1443. cell = new DataGridViewTextBoxCell();
  1444. cell.Value = dt_EarlyRepair.Rows[t]["收款类别"].ToString();
  1445. dgvr.Cells.Add(cell);
  1446. //副订单
  1447. cell = new DataGridViewTextBoxCell();
  1448. cell.Value = dt_EarlyRepair.Rows[t]["副订单"].ToString();
  1449. dgvr.Cells.Add(cell);
  1450. //初修师满意总分
  1451. cell = new DataGridViewTextBoxCell();
  1452. cell.Value = dt_EarlyRepair.Rows[t]["初修师满意总分"].ToString();
  1453. dgvr.Cells.Add(cell);
  1454. #endregion
  1455. this.Invoke(new UpdateControl(delegate()
  1456. {
  1457. this.dgv.Rows.Add(dgvr);
  1458. }));
  1459. }
  1460. }
  1461. }
  1462. #endregion
  1463. }
  1464. }
  1465. }
  1466. ConfigureRow = dt_SystemConfigure.Select("Sconfig_Code='FinishingDivisionEarly' and Sconfig_IsEnabled=1");
  1467. if (ConfigureRow.Length > 0)
  1468. {
  1469. if (ConfigureRow[0]["Sconfig_Value"].ToString() == "1")
  1470. {
  1471. if (this.Str_ProjectTitle.Trim() == "" || this.Str_ProjectTitle.Trim() == "精修前期")
  1472. {
  1473. #region 精修师
  1474. s = "";
  1475. strBuilder = new StringBuilder();
  1476. strBuilder.Append(" 收款类别 <> '后期收款'");
  1477. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  1478. { strBuilder.Append(" And 精修师ID like '%" + EmployeeName + "%' "); }
  1479. if (this.Str_ProcessStatus.Trim() == "")
  1480. { strBuilder.Append(" And 未拍个数 = 0 And 服务前期精修查询状态 = '2' And (服务前期精修查询时间 >= '" + StartTime + "' And 服务前期精修查询时间 <= '" + EndTime + " 23:59:59.000')"); }
  1481. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  1482. { strBuilder.Append(" And 未拍个数 = 0 And (最后拍摄时间 >= '" + StartTime + "' And 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  1483. if (this.Str_ProcessStatus.Trim() == "选片OK")
  1484. { strBuilder.Append(" And 选片状态 = 'OK' And (选片时间 >= '" + StartTime + "' And 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  1485. if (this.Str_ProcessStatus.Trim() == "取件OK")
  1486. { strBuilder.Append(" And 取件状态 = 'OK' And (取件日期 >= '" + StartTime + "' And 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  1487. if (!string.IsNullOrEmpty(this.Str_Scores1))
  1488. { strBuilder.Append(" and (精修师满意总分>=" + this.Str_Scores1 + " and 精修师满意总分<=" + this.Str_Scores2 + ")"); }
  1489. s = BindSelect5();
  1490. DataTable dtCount = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  1491. if (dtCount.Rows.Count > 0)
  1492. {
  1493. if (Convert.ToInt32(dtCount.Rows[0]["CountID"]) > 0)
  1494. {
  1495. backgroundWorker.ReportProgress(0, "正在获取'精修师前期业绩' ...");
  1496. string StrColumnName = "订单号,客户名称,订单类型,收款金额,应收金额,拍摄名称,收款时间,套系类别,套系名称,项目名称,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,取件状态,取件日期,副订单,精修师满意总分";
  1497. DataTable dt_Refinement = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  1498. for (int t = 0; t < dt_Refinement.Rows.Count; t++)
  1499. {
  1500. #region
  1501. DataGridViewRow dgvr = new DataGridViewRow();
  1502. DataGridViewCell cell = null;
  1503. //订单号
  1504. cell = new DataGridViewTextBoxCell();
  1505. cell.Value = dt_Refinement.Rows[t]["订单号"].ToString().Trim();
  1506. dgvr.Cells.Add(cell);
  1507. //员工
  1508. cell = new DataGridViewTextBoxCell();
  1509. cell.Value = StrUserName;
  1510. dgvr.Cells.Add(cell);
  1511. //职务
  1512. cell = new DataGridViewTextBoxCell();
  1513. cell.Value = "精修师";
  1514. dgvr.Cells.Add(cell);
  1515. //客户姓名
  1516. cell = new DataGridViewTextBoxCell();
  1517. cell.Value = dt_Refinement.Rows[t]["客户名称"].ToString().Trim();
  1518. dgvr.Cells.Add(cell);
  1519. //收款金额
  1520. cell = new DataGridViewTextBoxCell();
  1521. if (dt_Refinement.Rows[t]["订单类型"].ToString() != "1")
  1522. { cell.Value = Convert.ToDecimal(dt_Refinement.Rows[t]["收款金额"]).ToString("N2"); }
  1523. else { cell.Value = GetChildrenAmount(dt_Refinement.Rows[t]["订单号"].ToString().Trim(), Convert.ToDecimal(dt_Refinement.Rows[t]["应收金额"]), Convert.ToDecimal(dt_Refinement.Rows[t]["收款金额"]), dt_Refinement.Rows[t]["拍摄名称"].ToString()); }
  1524. dgvr.Cells.Add(cell);
  1525. //收款时间
  1526. cell = new DataGridViewTextBoxCell();
  1527. cell.Value = dt_Refinement.Rows[t]["收款时间"].ToString().Trim();
  1528. dgvr.Cells.Add(cell);
  1529. //套系类别
  1530. cell = new DataGridViewTextBoxCell();
  1531. cell.Value = dt_Refinement.Rows[t]["套系类别"].ToString().Trim();
  1532. dgvr.Cells.Add(cell);
  1533. //套系名称
  1534. cell = new DataGridViewTextBoxCell();
  1535. cell.Value = dt_Refinement.Rows[t]["套系名称"].ToString().Trim();
  1536. dgvr.Cells.Add(cell);
  1537. //应收金额
  1538. cell = new DataGridViewTextBoxCell();
  1539. cell.Value = Convert.ToDecimal(dt_Refinement.Rows[t]["应收金额"]).ToString("N2").Trim();
  1540. dgvr.Cells.Add(cell);
  1541. //项目名称
  1542. cell = new DataGridViewTextBoxCell();
  1543. if (string.IsNullOrEmpty(dt_Refinement.Rows[t]["项目名称"].ToString().Trim()))
  1544. { cell.Value = dt_Refinement.Rows[t]["收款类别"].ToString(); }
  1545. else { cell.Value = dt_Refinement.Rows[t]["项目名称"].ToString().Trim(); }
  1546. dgvr.Cells.Add(cell);
  1547. //付款名称
  1548. cell = new DataGridViewTextBoxCell();
  1549. cell.Value = dt_Refinement.Rows[t]["付款方式名称"].ToString().Trim();
  1550. dgvr.Cells.Add(cell);
  1551. //拍摄状态
  1552. cell = new DataGridViewTextBoxCell();
  1553. if (Convert.ToInt32(dt_Refinement.Rows[t]["未拍个数"]) == 0)
  1554. { cell.Value = "OK"; }
  1555. else { cell.Value = "未拍"; }
  1556. dgvr.Cells.Add(cell);
  1557. //拍摄时间
  1558. cell = new DataGridViewTextBoxCell();
  1559. cell.Value = dt_Refinement.Rows[t]["最后拍摄时间"].ToString();
  1560. dgvr.Cells.Add(cell);
  1561. //选片状态
  1562. cell = new DataGridViewTextBoxCell();
  1563. if (dt_Refinement.Rows[t]["选片状态"].ToString() == "OK")
  1564. { cell.Value = "OK"; }
  1565. else { cell.Value = "未选"; }
  1566. dgvr.Cells.Add(cell);
  1567. //选片时间
  1568. cell = new DataGridViewTextBoxCell();
  1569. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_Refinement.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  1570. dgvr.Cells.Add(cell);
  1571. //取件状态
  1572. cell = new DataGridViewTextBoxCell();
  1573. if (dt_Refinement.Rows[t]["取件状态"].ToString() == "OK")
  1574. { cell.Value = "OK"; }
  1575. else { cell.Value = "未取"; }
  1576. dgvr.Cells.Add(cell);
  1577. //取件时间
  1578. cell = new DataGridViewTextBoxCell();
  1579. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_Refinement.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  1580. dgvr.Cells.Add(cell);
  1581. //拍摄名称
  1582. cell = new DataGridViewTextBoxCell();
  1583. cell.Value = dt_Refinement.Rows[t]["拍摄名称"].ToString();
  1584. dgvr.Cells.Add(cell);
  1585. //订单类型
  1586. cell = new DataGridViewTextBoxCell();
  1587. cell.Value = dt_Refinement.Rows[t]["订单类型"].ToString();
  1588. dgvr.Cells.Add(cell);
  1589. //收款类型
  1590. cell = new DataGridViewTextBoxCell();
  1591. cell.Value = dt_Refinement.Rows[t]["收款类别"].ToString();
  1592. dgvr.Cells.Add(cell);
  1593. //副订单
  1594. cell = new DataGridViewTextBoxCell();
  1595. cell.Value = dt_Refinement.Rows[t]["副订单"].ToString();
  1596. dgvr.Cells.Add(cell);
  1597. //精修师满意总分
  1598. cell = new DataGridViewTextBoxCell();
  1599. cell.Value = dt_Refinement.Rows[t]["精修师满意总分"].ToString();
  1600. dgvr.Cells.Add(cell);
  1601. #endregion
  1602. this.Invoke(new UpdateControl(delegate()
  1603. {
  1604. this.dgv.Rows.Add(dgvr);
  1605. }));
  1606. }
  1607. }
  1608. }
  1609. #endregion
  1610. }
  1611. }
  1612. }
  1613. ConfigureRow = dt_SystemConfigure.Select("Sconfig_Code='DesignersEarly' and Sconfig_IsEnabled=1");
  1614. if (ConfigureRow.Length > 0)
  1615. {
  1616. if (ConfigureRow[0]["Sconfig_Value"].ToString() == "1")
  1617. {
  1618. if (this.Str_ProjectTitle.Trim() == "" || this.Str_ProjectTitle.Trim() == "设计前期")
  1619. {
  1620. #region 设计师
  1621. s = "";
  1622. strBuilder = new StringBuilder();
  1623. strBuilder.Append(" 收款类别 <> '后期收款'");
  1624. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  1625. { strBuilder.Append(" And 设计师ID like '%" + EmployeeName + "%' "); }
  1626. if (this.Str_ProcessStatus.Trim() == "")
  1627. { strBuilder.Append(" And 未拍个数 = 0 And 服务前期设计查询状态 = '2' And (服务前期设计查询时间 >= '" + StartTime + "' And 服务前期设计查询时间 <= '" + EndTime + " 23:59:59.000')"); }
  1628. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  1629. { strBuilder.Append(" And 未拍个数 = 0 And (最后拍摄时间 >= '" + StartTime + "' And 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  1630. if (this.Str_ProcessStatus.Trim() == "选片OK")
  1631. { strBuilder.Append(" And 选片状态 = 'OK' And (选片时间 >= '" + StartTime + "' And 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  1632. if (this.Str_ProcessStatus.Trim() == "取件OK")
  1633. { strBuilder.Append(" And 取件状态 = 'OK' And (取件日期 >= '" + StartTime + "' And 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  1634. if (!string.IsNullOrEmpty(this.Str_Scores1))
  1635. { strBuilder.Append(" and (设计师满意总分>=" + this.Str_Scores1 + " and 设计师满意总分<=" + this.Str_Scores2 + ")"); }
  1636. s = BindSelect5();
  1637. DataTable dtCount = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  1638. if (dtCount.Rows.Count > 0)
  1639. {
  1640. if (Convert.ToInt32(dtCount.Rows[0]["CountID"]) > 0)
  1641. {
  1642. backgroundWorker.ReportProgress(0, "正在获取'设计师前期业绩' ...");
  1643. string StrColumnName = "订单号,客户名称,订单类型,收款金额,应收金额,拍摄名称,收款时间,套系类别,套系名称,项目名称,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,取件状态,取件日期,副订单,设计师满意总分";
  1644. DataTable dt_Designer = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  1645. for (int t = 0; t < dt_Designer.Rows.Count; t++)
  1646. {
  1647. #region
  1648. DataGridViewRow dgvr = new DataGridViewRow();
  1649. DataGridViewCell cell = null;
  1650. //订单号
  1651. cell = new DataGridViewTextBoxCell();
  1652. cell.Value = dt_Designer.Rows[t]["订单号"].ToString().Trim();
  1653. dgvr.Cells.Add(cell);
  1654. //员工
  1655. cell = new DataGridViewTextBoxCell();
  1656. cell.Value = StrUserName;
  1657. dgvr.Cells.Add(cell);
  1658. //职务
  1659. cell = new DataGridViewTextBoxCell();
  1660. cell.Value = "设计师";
  1661. dgvr.Cells.Add(cell);
  1662. //客户姓名
  1663. cell = new DataGridViewTextBoxCell();
  1664. cell.Value = dt_Designer.Rows[t]["客户名称"].ToString().Trim();
  1665. dgvr.Cells.Add(cell);
  1666. //收款金额
  1667. cell = new DataGridViewTextBoxCell();
  1668. if (dt_Designer.Rows[t]["订单类型"].ToString() != "1")
  1669. { cell.Value = Convert.ToDecimal(dt_Designer.Rows[t]["收款金额"]).ToString("N2"); }
  1670. else
  1671. { cell.Value = GetChildrenAmount(dt_Designer.Rows[t]["订单号"].ToString().Trim(), Convert.ToDecimal(dt_Designer.Rows[t]["应收金额"]), Convert.ToDecimal(dt_Designer.Rows[t]["收款金额"]), dt_Designer.Rows[t]["拍摄名称"].ToString()); }
  1672. dgvr.Cells.Add(cell);
  1673. //收款时间
  1674. cell = new DataGridViewTextBoxCell();
  1675. cell.Value = dt_Designer.Rows[t]["收款时间"].ToString().Trim();
  1676. dgvr.Cells.Add(cell);
  1677. //套系类别
  1678. cell = new DataGridViewTextBoxCell();
  1679. cell.Value = dt_Designer.Rows[t]["套系类别"].ToString().Trim();
  1680. dgvr.Cells.Add(cell);
  1681. //套系名称
  1682. cell = new DataGridViewTextBoxCell();
  1683. cell.Value = dt_Designer.Rows[t]["套系名称"].ToString().Trim();
  1684. dgvr.Cells.Add(cell);
  1685. //应收金额
  1686. cell = new DataGridViewTextBoxCell();
  1687. cell.Value = Convert.ToDecimal(dt_Designer.Rows[t]["应收金额"]).ToString("N2").Trim();
  1688. dgvr.Cells.Add(cell);
  1689. //项目名称
  1690. cell = new DataGridViewTextBoxCell();
  1691. if (string.IsNullOrEmpty(dt_Designer.Rows[t]["项目名称"].ToString().Trim()))
  1692. { cell.Value = dt_Designer.Rows[t]["收款类别"].ToString(); }
  1693. else
  1694. { cell.Value = dt_Designer.Rows[t]["项目名称"].ToString().Trim(); }
  1695. dgvr.Cells.Add(cell);
  1696. //付款名称
  1697. cell = new DataGridViewTextBoxCell();
  1698. cell.Value = dt_Designer.Rows[t]["付款方式名称"].ToString().Trim();
  1699. dgvr.Cells.Add(cell);
  1700. //拍摄状态
  1701. cell = new DataGridViewTextBoxCell();
  1702. if (Convert.ToInt32(dt_Designer.Rows[t]["未拍个数"]) == 0)
  1703. { cell.Value = "OK"; }
  1704. else
  1705. { cell.Value = "未拍"; }
  1706. dgvr.Cells.Add(cell);
  1707. //拍摄时间
  1708. cell = new DataGridViewTextBoxCell();
  1709. cell.Value = dt_Designer.Rows[t]["最后拍摄时间"].ToString();
  1710. dgvr.Cells.Add(cell);
  1711. //选片状态
  1712. cell = new DataGridViewTextBoxCell();
  1713. if (dt_Designer.Rows[t]["选片状态"].ToString() == "OK")
  1714. { cell.Value = "OK"; }
  1715. else
  1716. { cell.Value = "未选"; }
  1717. dgvr.Cells.Add(cell);
  1718. //选片时间
  1719. cell = new DataGridViewTextBoxCell();
  1720. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_Designer.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  1721. dgvr.Cells.Add(cell);
  1722. //取件状态
  1723. cell = new DataGridViewTextBoxCell();
  1724. if (dt_Designer.Rows[t]["取件状态"].ToString() == "OK")
  1725. { cell.Value = "OK"; }
  1726. else
  1727. { cell.Value = "未取"; }
  1728. dgvr.Cells.Add(cell);
  1729. //取件时间
  1730. cell = new DataGridViewTextBoxCell();
  1731. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_Designer.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  1732. dgvr.Cells.Add(cell);
  1733. //拍摄名称
  1734. cell = new DataGridViewTextBoxCell();
  1735. cell.Value = dt_Designer.Rows[t]["拍摄名称"].ToString();
  1736. dgvr.Cells.Add(cell);
  1737. //订单类型
  1738. cell = new DataGridViewTextBoxCell();
  1739. cell.Value = dt_Designer.Rows[t]["订单类型"].ToString();
  1740. dgvr.Cells.Add(cell);
  1741. //收款类型
  1742. cell = new DataGridViewTextBoxCell();
  1743. cell.Value = dt_Designer.Rows[t]["收款类别"].ToString();
  1744. dgvr.Cells.Add(cell);
  1745. //副订单
  1746. cell = new DataGridViewTextBoxCell();
  1747. cell.Value = dt_Designer.Rows[t]["副订单"].ToString();
  1748. dgvr.Cells.Add(cell);
  1749. //设计师满意总分
  1750. cell = new DataGridViewTextBoxCell();
  1751. cell.Value = dt_Designer.Rows[t]["设计师满意总分"].ToString();
  1752. dgvr.Cells.Add(cell);
  1753. #endregion
  1754. this.Invoke(new UpdateControl(delegate()
  1755. {
  1756. this.dgv.Rows.Add(dgvr);
  1757. }));
  1758. }
  1759. }
  1760. }
  1761. #endregion
  1762. }
  1763. }
  1764. }
  1765. #endregion
  1766. }
  1767. if (this.Str_ItemCategory.Trim() == "" || this.Str_ItemCategory.Trim() == "服务后期")
  1768. {
  1769. #region 选片二销业绩
  1770. DataRow[] ConfigureRow = dt_SystemConfigure.Select("Sconfig_Code='PhotographerSelectionFilms' and Sconfig_IsEnabled=1");
  1771. if (ConfigureRow.Length > 0)
  1772. {
  1773. if (ConfigureRow[0]["Sconfig_Value"].ToString() == "1")
  1774. {
  1775. if (this.Str_ProjectTitle.Trim() == "" || this.Str_ProjectTitle.Trim() == "摄影选片二销")
  1776. {
  1777. #region 主摄影师
  1778. s = "";
  1779. strBuilder = new StringBuilder();
  1780. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  1781. { strBuilder.Append(" And 主摄影师ID like '%" + EmployeeName + "%' "); }
  1782. if (this.Str_ProcessStatus.Trim() == "")
  1783. { strBuilder.Append(" And 未拍个数 = 0 And (收款时间 >= '" + StartTime + "' And 收款时间 <= '" + EndTime + " 23:59:59.000')"); }
  1784. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  1785. { strBuilder.Append(" And 未拍个数 = 0 And (最后拍摄时间 >= '" + StartTime + "' And 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  1786. if (this.Str_ProcessStatus.Trim() == "选片OK")
  1787. { strBuilder.Append(" And 选片状态 = 'OK' And (选片时间 >= '" + StartTime + "' And 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  1788. if (this.Str_ProcessStatus.Trim() == "取件OK")
  1789. { strBuilder.Append(" And 取件状态 = 'OK' And (取件日期 >= '" + StartTime + "' And 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  1790. if (!string.IsNullOrEmpty(this.Str_Scores1))
  1791. { strBuilder.Append(" and (主摄影满意总分>=" + this.Str_Scores1 + " and 主摄影满意总分<=" + this.Str_Scores2 + ")"); }
  1792. s = BindSelect5();
  1793. DataTable dtCount1 = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  1794. if (dtCount1.Rows.Count > 0)
  1795. {
  1796. if (Convert.ToInt32(dtCount1.Rows[0]["CountID"]) > 0)
  1797. {
  1798. backgroundWorker.ReportProgress(0, "正在获取'主摄影师选片二销业绩' ...");
  1799. string StrColumnName = "订单号,客户名称,收款金额,收款时间,套系类别,套系名称,应收金额,项目名称,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,取件状态,取件日期,拍摄名称,订单类型,副订单,主摄影满意总分";
  1800. DataTable dt_MainPhotographer = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  1801. for (int t = 0; t < dt_MainPhotographer.Rows.Count; t++)
  1802. {
  1803. #region
  1804. DataGridViewRow dgvr = new DataGridViewRow();
  1805. DataGridViewCell cell = null;
  1806. //订单号
  1807. cell = new DataGridViewTextBoxCell();
  1808. cell.Value = dt_MainPhotographer.Rows[t]["订单号"].ToString().Trim();
  1809. dgvr.Cells.Add(cell);
  1810. //员工
  1811. cell = new DataGridViewTextBoxCell();
  1812. cell.Value = StrUserName;
  1813. dgvr.Cells.Add(cell);
  1814. //职务
  1815. cell = new DataGridViewTextBoxCell();
  1816. cell.Value = "主摄影选片二销";
  1817. dgvr.Cells.Add(cell);
  1818. //客户姓名
  1819. cell = new DataGridViewTextBoxCell();
  1820. cell.Value = dt_MainPhotographer.Rows[t]["客户名称"].ToString().Trim();
  1821. dgvr.Cells.Add(cell);
  1822. //收款金额
  1823. cell = new DataGridViewTextBoxCell();
  1824. cell.Value = Convert.ToDecimal(dt_MainPhotographer.Rows[t]["收款金额"]).ToString("N2");
  1825. dgvr.Cells.Add(cell);
  1826. //收款时间
  1827. cell = new DataGridViewTextBoxCell();
  1828. cell.Value = dt_MainPhotographer.Rows[t]["收款时间"].ToString().Trim();
  1829. dgvr.Cells.Add(cell);
  1830. //套系类别
  1831. cell = new DataGridViewTextBoxCell();
  1832. cell.Value = dt_MainPhotographer.Rows[t]["套系类别"].ToString().Trim();
  1833. dgvr.Cells.Add(cell);
  1834. //套系名称
  1835. cell = new DataGridViewTextBoxCell();
  1836. cell.Value = dt_MainPhotographer.Rows[t]["套系名称"].ToString().Trim();
  1837. dgvr.Cells.Add(cell);
  1838. //应收金额
  1839. cell = new DataGridViewTextBoxCell();
  1840. cell.Value = Convert.ToDecimal(dt_MainPhotographer.Rows[t]["应收金额"]).ToString("N2").Trim();
  1841. dgvr.Cells.Add(cell);
  1842. //项目名称
  1843. cell = new DataGridViewTextBoxCell();
  1844. if (string.IsNullOrEmpty(dt_MainPhotographer.Rows[t]["项目名称"].ToString().Trim()))
  1845. { cell.Value = dt_MainPhotographer.Rows[t]["收款类别"].ToString(); }
  1846. else { cell.Value = dt_MainPhotographer.Rows[t]["项目名称"].ToString().Trim(); }
  1847. dgvr.Cells.Add(cell);
  1848. //付款名称
  1849. cell = new DataGridViewTextBoxCell();
  1850. cell.Value = dt_MainPhotographer.Rows[t]["付款方式名称"].ToString().Trim();
  1851. dgvr.Cells.Add(cell);
  1852. //拍摄状态
  1853. cell = new DataGridViewTextBoxCell();
  1854. if (Convert.ToInt32(dt_MainPhotographer.Rows[t]["未拍个数"]) == 0)
  1855. { cell.Value = "OK"; }
  1856. else { cell.Value = "未拍"; }
  1857. dgvr.Cells.Add(cell);
  1858. //拍摄时间
  1859. cell = new DataGridViewTextBoxCell();
  1860. cell.Value = dt_MainPhotographer.Rows[t]["最后拍摄时间"].ToString();
  1861. dgvr.Cells.Add(cell);
  1862. //选片状态
  1863. cell = new DataGridViewTextBoxCell();
  1864. if (dt_MainPhotographer.Rows[t]["选片状态"].ToString() == "OK")
  1865. { cell.Value = "OK"; }
  1866. else { cell.Value = "未选"; }
  1867. dgvr.Cells.Add(cell);
  1868. //选片时间
  1869. cell = new DataGridViewTextBoxCell();
  1870. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_MainPhotographer.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  1871. dgvr.Cells.Add(cell);
  1872. //取件状态
  1873. cell = new DataGridViewTextBoxCell();
  1874. if (dt_MainPhotographer.Rows[t]["取件状态"].ToString() == "OK")
  1875. { cell.Value = "OK"; }
  1876. else { cell.Value = "未取"; }
  1877. dgvr.Cells.Add(cell);
  1878. //取件时间
  1879. cell = new DataGridViewTextBoxCell();
  1880. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_MainPhotographer.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  1881. dgvr.Cells.Add(cell);
  1882. //拍摄名称
  1883. cell = new DataGridViewTextBoxCell();
  1884. cell.Value = dt_MainPhotographer.Rows[t]["拍摄名称"].ToString();
  1885. dgvr.Cells.Add(cell);
  1886. //订单类型
  1887. cell = new DataGridViewTextBoxCell();
  1888. cell.Value = dt_MainPhotographer.Rows[t]["订单类型"].ToString();
  1889. dgvr.Cells.Add(cell);
  1890. //收款类型
  1891. cell = new DataGridViewTextBoxCell();
  1892. cell.Value = dt_MainPhotographer.Rows[t]["收款类别"].ToString();
  1893. dgvr.Cells.Add(cell);
  1894. //副订单
  1895. cell = new DataGridViewTextBoxCell();
  1896. cell.Value = dt_MainPhotographer.Rows[t]["副订单"].ToString();
  1897. dgvr.Cells.Add(cell);
  1898. //主摄影满意总分
  1899. cell = new DataGridViewTextBoxCell();
  1900. cell.Value = dt_MainPhotographer.Rows[t]["主摄影满意总分"].ToString();
  1901. dgvr.Cells.Add(cell);
  1902. #endregion
  1903. this.Invoke(new UpdateControl(delegate()
  1904. {
  1905. this.dgv.Rows.Add(dgvr);
  1906. }));
  1907. }
  1908. }
  1909. }
  1910. #endregion
  1911. #region 摄影助理
  1912. s = "";
  1913. strBuilder = new StringBuilder();
  1914. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  1915. { strBuilder.Append(" And 摄影助理ID like '%" + EmployeeName + "%' "); }
  1916. if (this.Str_ProcessStatus.Trim() == "")
  1917. { strBuilder.Append(" And 未拍个数 = 0 And (收款时间 >= '" + StartTime + "' And 收款时间 <= '" + EndTime + " 23:59:59.000')"); }
  1918. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  1919. { strBuilder.Append(" And 未拍个数 = 0 And (最后拍摄时间 >= '" + StartTime + "' And 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  1920. if (this.Str_ProcessStatus.Trim() == "选片OK")
  1921. { strBuilder.Append(" And 选片状态 = 'OK' And (选片时间 >= '" + StartTime + "' And 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  1922. if (this.Str_ProcessStatus.Trim() == "取件OK")
  1923. { strBuilder.Append(" And 取件状态 = 'OK' And (取件日期 >= '" + StartTime + "' And 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  1924. if (!string.IsNullOrEmpty(this.Str_Scores1))
  1925. { strBuilder.Append(" and (摄影助理满意总分>=" + this.Str_Scores1 + " and 摄影助理满意总分<=" + this.Str_Scores2 + ")"); }
  1926. s = BindSelect5();
  1927. DataTable dtCount2 = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  1928. if (dtCount2.Rows.Count > 0)
  1929. {
  1930. if (Convert.ToInt32(dtCount2.Rows[0]["CountID"]) > 0)
  1931. {
  1932. backgroundWorker.ReportProgress(0, "正在获取'摄影助理选片二销业绩' ...");
  1933. string StrColumnName = "订单号,客户名称,收款金额,收款时间,套系类别,套系名称,应收金额,项目名称,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,取件状态,取件日期,拍摄名称,订单类型,副订单,摄影助理满意总分";
  1934. DataTable dt_VicePhotographer = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  1935. for (int t = 0; t < dt_VicePhotographer.Rows.Count; t++)
  1936. {
  1937. #region
  1938. DataGridViewRow dgvr = new DataGridViewRow();
  1939. DataGridViewCell cell = null;
  1940. //订单号
  1941. cell = new DataGridViewTextBoxCell();
  1942. cell.Value = dt_VicePhotographer.Rows[t]["订单号"].ToString().Trim();
  1943. dgvr.Cells.Add(cell);
  1944. //员工
  1945. cell = new DataGridViewTextBoxCell();
  1946. cell.Value = StrUserName;
  1947. dgvr.Cells.Add(cell);
  1948. //职务
  1949. cell = new DataGridViewTextBoxCell();
  1950. cell.Value = "摄影助理选片二销";
  1951. dgvr.Cells.Add(cell);
  1952. //客户姓名
  1953. cell = new DataGridViewTextBoxCell();
  1954. cell.Value = dt_VicePhotographer.Rows[t]["客户名称"].ToString().Trim();
  1955. dgvr.Cells.Add(cell);
  1956. //收款金额
  1957. cell = new DataGridViewTextBoxCell();
  1958. cell.Value = Convert.ToDecimal(dt_VicePhotographer.Rows[t]["收款金额"]).ToString("N2");
  1959. dgvr.Cells.Add(cell);
  1960. //收款时间
  1961. cell = new DataGridViewTextBoxCell();
  1962. cell.Value = dt_VicePhotographer.Rows[t]["收款时间"].ToString().Trim();
  1963. dgvr.Cells.Add(cell);
  1964. //套系类别
  1965. cell = new DataGridViewTextBoxCell();
  1966. cell.Value = dt_VicePhotographer.Rows[t]["套系类别"].ToString().Trim();
  1967. dgvr.Cells.Add(cell);
  1968. //套系名称
  1969. cell = new DataGridViewTextBoxCell();
  1970. cell.Value = dt_VicePhotographer.Rows[t]["套系名称"].ToString().Trim();
  1971. dgvr.Cells.Add(cell);
  1972. //应收金额
  1973. cell = new DataGridViewTextBoxCell();
  1974. cell.Value = Convert.ToDecimal(dt_VicePhotographer.Rows[t]["应收金额"]).ToString("N2").Trim();
  1975. dgvr.Cells.Add(cell);
  1976. //项目名称
  1977. cell = new DataGridViewTextBoxCell();
  1978. if (string.IsNullOrEmpty(dt_VicePhotographer.Rows[t]["项目名称"].ToString().Trim()))
  1979. { cell.Value = dt_VicePhotographer.Rows[t]["收款类别"].ToString(); }
  1980. else { cell.Value = dt_VicePhotographer.Rows[t]["项目名称"].ToString().Trim(); }
  1981. dgvr.Cells.Add(cell);
  1982. //付款名称
  1983. cell = new DataGridViewTextBoxCell();
  1984. cell.Value = dt_VicePhotographer.Rows[t]["付款方式名称"].ToString().Trim();
  1985. dgvr.Cells.Add(cell);
  1986. //拍摄状态
  1987. cell = new DataGridViewTextBoxCell();
  1988. if (Convert.ToInt32(dt_VicePhotographer.Rows[t]["未拍个数"]) == 0)
  1989. { cell.Value = "OK"; }
  1990. else { cell.Value = "未拍"; }
  1991. dgvr.Cells.Add(cell);
  1992. //拍摄时间
  1993. cell = new DataGridViewTextBoxCell();
  1994. cell.Value = dt_VicePhotographer.Rows[t]["最后拍摄时间"].ToString();
  1995. dgvr.Cells.Add(cell);
  1996. //选片状态
  1997. cell = new DataGridViewTextBoxCell();
  1998. if (dt_VicePhotographer.Rows[t]["选片状态"].ToString() == "OK")
  1999. { cell.Value = "OK"; }
  2000. else { cell.Value = "未选"; }
  2001. dgvr.Cells.Add(cell);
  2002. //选片时间
  2003. cell = new DataGridViewTextBoxCell();
  2004. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_VicePhotographer.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  2005. dgvr.Cells.Add(cell);
  2006. //取件状态
  2007. cell = new DataGridViewTextBoxCell();
  2008. if (dt_VicePhotographer.Rows[t]["取件状态"].ToString() == "OK")
  2009. { cell.Value = "OK"; }
  2010. else { cell.Value = "未取"; }
  2011. dgvr.Cells.Add(cell);
  2012. //取件时间
  2013. cell = new DataGridViewTextBoxCell();
  2014. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_VicePhotographer.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  2015. dgvr.Cells.Add(cell);
  2016. //拍摄名称
  2017. cell = new DataGridViewTextBoxCell();
  2018. cell.Value = dt_VicePhotographer.Rows[t]["拍摄名称"].ToString();
  2019. dgvr.Cells.Add(cell);
  2020. //订单类型
  2021. cell = new DataGridViewTextBoxCell();
  2022. cell.Value = dt_VicePhotographer.Rows[t]["订单类型"].ToString();
  2023. dgvr.Cells.Add(cell);
  2024. //收款类型
  2025. cell = new DataGridViewTextBoxCell();
  2026. cell.Value = dt_VicePhotographer.Rows[t]["收款类别"].ToString();
  2027. dgvr.Cells.Add(cell);
  2028. //副订单
  2029. cell = new DataGridViewTextBoxCell();
  2030. cell.Value = dt_VicePhotographer.Rows[t]["副订单"].ToString();
  2031. dgvr.Cells.Add(cell);
  2032. //摄影助理满意总分
  2033. cell = new DataGridViewTextBoxCell();
  2034. cell.Value = dt_VicePhotographer.Rows[t]["摄影助理满意总分"].ToString();
  2035. dgvr.Cells.Add(cell);
  2036. #endregion
  2037. this.Invoke(new UpdateControl(delegate()
  2038. {
  2039. this.dgv.Rows.Add(dgvr);
  2040. }));
  2041. }
  2042. }
  2043. }
  2044. #endregion
  2045. }
  2046. }
  2047. }
  2048. ConfigureRow = dt_SystemConfigure.Select("Sconfig_Code='MakeupArtistSelectionFilms' and Sconfig_IsEnabled=1");
  2049. if (ConfigureRow.Length > 0)
  2050. {
  2051. if (ConfigureRow[0]["Sconfig_Value"].ToString() == "1")
  2052. {
  2053. if (this.Str_ProjectTitle.Trim() == "" || this.Str_ProjectTitle.Trim() == "化妆选片二销")
  2054. {
  2055. #region 主化妆师
  2056. s = "";
  2057. strBuilder = new StringBuilder();
  2058. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  2059. { strBuilder.Append(" And 主化妆ID like '%" + EmployeeName + "%' "); }
  2060. if (this.Str_ProcessStatus.Trim() == "")
  2061. { strBuilder.Append(" And 未拍个数 = 0 And (收款时间 >= '" + StartTime + "' And 收款时间 <= '" + EndTime + " 23:59:59.000')"); }
  2062. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  2063. { strBuilder.Append(" And 未拍个数 = 0 And (最后拍摄时间 >= '" + StartTime + "' And 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  2064. if (this.Str_ProcessStatus.Trim() == "选片OK")
  2065. { strBuilder.Append(" And 选片状态 = 'OK' And (选片时间 >= '" + StartTime + "' And 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  2066. if (this.Str_ProcessStatus.Trim() == "取件OK")
  2067. { strBuilder.Append(" And 取件状态 = 'OK' And (取件日期 >= '" + StartTime + "' And 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  2068. if (!string.IsNullOrEmpty(this.Str_Scores1))
  2069. { strBuilder.Append(" and (主化妆满意总分>=" + this.Str_Scores1 + " and 主化妆满意总分<=" + this.Str_Scores2 + ")"); }
  2070. s = BindSelect5();
  2071. DataTable dtCount1 = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  2072. if (dtCount1.Rows.Count > 0)
  2073. {
  2074. if (Convert.ToInt32(dtCount1.Rows[0]["CountID"]) > 0)
  2075. {
  2076. backgroundWorker.ReportProgress(0, "正在获取'主化妆师选片二销业绩' ...");
  2077. string StrColumnName = "订单号,客户名称,收款金额,收款时间,套系类别,套系名称,应收金额,项目名称,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,取件状态,取件日期,拍摄名称,订单类型,副订单,主化妆满意总分";
  2078. DataTable dt_MainMakeupArtist = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  2079. for (int t = 0; t < dt_MainMakeupArtist.Rows.Count; t++)
  2080. {
  2081. #region
  2082. DataGridViewRow dgvr = new DataGridViewRow();
  2083. DataGridViewCell cell = null;
  2084. //订单号
  2085. cell = new DataGridViewTextBoxCell();
  2086. cell.Value = dt_MainMakeupArtist.Rows[t]["订单号"].ToString().Trim();
  2087. dgvr.Cells.Add(cell);
  2088. //员工
  2089. cell = new DataGridViewTextBoxCell();
  2090. cell.Value = StrUserName;
  2091. dgvr.Cells.Add(cell);
  2092. //职务
  2093. cell = new DataGridViewTextBoxCell();
  2094. cell.Value = "主化妆选片二销";
  2095. dgvr.Cells.Add(cell);
  2096. //客户姓名
  2097. cell = new DataGridViewTextBoxCell();
  2098. cell.Value = dt_MainMakeupArtist.Rows[t]["客户名称"].ToString().Trim();
  2099. dgvr.Cells.Add(cell);
  2100. //收款金额
  2101. cell = new DataGridViewTextBoxCell();
  2102. cell.Value = Convert.ToDecimal(dt_MainMakeupArtist.Rows[t]["收款金额"]).ToString("N2");
  2103. dgvr.Cells.Add(cell);
  2104. //收款时间
  2105. cell = new DataGridViewTextBoxCell();
  2106. cell.Value = dt_MainMakeupArtist.Rows[t]["收款时间"].ToString().Trim();
  2107. dgvr.Cells.Add(cell);
  2108. //套系类别
  2109. cell = new DataGridViewTextBoxCell();
  2110. cell.Value = dt_MainMakeupArtist.Rows[t]["套系类别"].ToString().Trim();
  2111. dgvr.Cells.Add(cell);
  2112. //套系名称
  2113. cell = new DataGridViewTextBoxCell();
  2114. cell.Value = dt_MainMakeupArtist.Rows[t]["套系名称"].ToString().Trim();
  2115. dgvr.Cells.Add(cell);
  2116. //应收金额
  2117. cell = new DataGridViewTextBoxCell();
  2118. cell.Value = Convert.ToDecimal(dt_MainMakeupArtist.Rows[t]["应收金额"]).ToString("N2").Trim();
  2119. dgvr.Cells.Add(cell);
  2120. //项目名称
  2121. cell = new DataGridViewTextBoxCell();
  2122. if (string.IsNullOrEmpty(dt_MainMakeupArtist.Rows[t]["项目名称"].ToString().Trim()))
  2123. { cell.Value = dt_MainMakeupArtist.Rows[t]["收款类别"].ToString(); }
  2124. else { cell.Value = dt_MainMakeupArtist.Rows[t]["项目名称"].ToString().Trim(); }
  2125. dgvr.Cells.Add(cell);
  2126. //付款名称
  2127. cell = new DataGridViewTextBoxCell();
  2128. cell.Value = dt_MainMakeupArtist.Rows[t]["付款方式名称"].ToString().Trim();
  2129. dgvr.Cells.Add(cell);
  2130. //拍摄状态
  2131. cell = new DataGridViewTextBoxCell();
  2132. if (Convert.ToInt32(dt_MainMakeupArtist.Rows[t]["未拍个数"]) == 0)
  2133. { cell.Value = "OK"; }
  2134. else { cell.Value = "未拍"; }
  2135. dgvr.Cells.Add(cell);
  2136. //拍摄时间
  2137. cell = new DataGridViewTextBoxCell();
  2138. cell.Value = dt_MainMakeupArtist.Rows[t]["最后拍摄时间"].ToString();
  2139. dgvr.Cells.Add(cell);
  2140. //选片状态
  2141. cell = new DataGridViewTextBoxCell();
  2142. if (dt_MainMakeupArtist.Rows[t]["选片状态"].ToString() == "OK")
  2143. { cell.Value = "OK"; }
  2144. else { cell.Value = "未选"; }
  2145. dgvr.Cells.Add(cell);
  2146. //选片时间
  2147. cell = new DataGridViewTextBoxCell();
  2148. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_MainMakeupArtist.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  2149. dgvr.Cells.Add(cell);
  2150. //取件状态
  2151. cell = new DataGridViewTextBoxCell();
  2152. if (dt_MainMakeupArtist.Rows[t]["取件状态"].ToString() == "OK")
  2153. { cell.Value = "OK"; }
  2154. else { cell.Value = "未取"; }
  2155. dgvr.Cells.Add(cell);
  2156. //取件时间
  2157. cell = new DataGridViewTextBoxCell();
  2158. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_MainMakeupArtist.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  2159. dgvr.Cells.Add(cell);
  2160. //拍摄名称
  2161. cell = new DataGridViewTextBoxCell();
  2162. cell.Value = dt_MainMakeupArtist.Rows[t]["拍摄名称"].ToString();
  2163. dgvr.Cells.Add(cell);
  2164. //订单类型
  2165. cell = new DataGridViewTextBoxCell();
  2166. cell.Value = dt_MainMakeupArtist.Rows[t]["订单类型"].ToString();
  2167. dgvr.Cells.Add(cell);
  2168. //收款类型
  2169. cell = new DataGridViewTextBoxCell();
  2170. cell.Value = dt_MainMakeupArtist.Rows[t]["收款类别"].ToString();
  2171. dgvr.Cells.Add(cell);
  2172. //副订单
  2173. cell = new DataGridViewTextBoxCell();
  2174. cell.Value = dt_MainMakeupArtist.Rows[t]["副订单"].ToString();
  2175. dgvr.Cells.Add(cell);
  2176. //主化妆满意总分
  2177. cell = new DataGridViewTextBoxCell();
  2178. cell.Value = dt_MainMakeupArtist.Rows[t]["主化妆满意总分"].ToString();
  2179. dgvr.Cells.Add(cell);
  2180. #endregion
  2181. this.Invoke(new UpdateControl(delegate()
  2182. {
  2183. this.dgv.Rows.Add(dgvr);
  2184. }));
  2185. }
  2186. }
  2187. }
  2188. #endregion
  2189. #region 化妆助理
  2190. s = "";
  2191. strBuilder = new StringBuilder();
  2192. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  2193. { strBuilder.Append(" And 化妆助理ID like '%" + EmployeeName + "%' "); }
  2194. if (this.Str_ProcessStatus.Trim() == "")
  2195. { strBuilder.Append(" And 未拍个数 = 0 And (收款时间 >= '" + StartTime + "' And 收款时间 <= '" + EndTime + " 23:59:59.000')"); }
  2196. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  2197. { strBuilder.Append(" And 未拍个数 = 0 And (最后拍摄时间 >= '" + StartTime + "' And 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  2198. if (this.Str_ProcessStatus.Trim() == "选片OK")
  2199. { strBuilder.Append(" And 选片状态 = 'OK' And (选片时间 >= '" + StartTime + "' And 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  2200. if (this.Str_ProcessStatus.Trim() == "取件OK")
  2201. { strBuilder.Append(" And 取件状态 = 'OK' And (取件日期 >= '" + StartTime + "' And 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  2202. if (!string.IsNullOrEmpty(this.Str_Scores1))
  2203. { strBuilder.Append(" and (化妆助理满意总分>=" + this.Str_Scores1 + " and 化妆助理满意总分<=" + this.Str_Scores2 + ")"); }
  2204. s = BindSelect5();
  2205. DataTable dtCount2 = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  2206. if (dtCount2.Rows.Count > 0)
  2207. {
  2208. if (Convert.ToInt32(dtCount2.Rows[0]["CountID"]) > 0)
  2209. {
  2210. backgroundWorker.ReportProgress(0, "正在获取'化妆助理选片二销业绩' ...");
  2211. string StrColumnName = "订单号,客户名称,收款金额,收款时间,套系类别,套系名称,应收金额,项目名称,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,取件状态,取件日期,拍摄名称,订单类型,副订单,化妆助理满意总分";
  2212. DataTable dt_ViceMakeupArtist = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  2213. for (int t = 0; t < dt_ViceMakeupArtist.Rows.Count; t++)
  2214. {
  2215. #region
  2216. DataGridViewRow dgvr = new DataGridViewRow();
  2217. DataGridViewCell cell = null;
  2218. //订单号
  2219. cell = new DataGridViewTextBoxCell();
  2220. cell.Value = dt_ViceMakeupArtist.Rows[t]["订单号"].ToString().Trim();
  2221. dgvr.Cells.Add(cell);
  2222. //员工
  2223. cell = new DataGridViewTextBoxCell();
  2224. cell.Value = StrUserName;
  2225. dgvr.Cells.Add(cell);
  2226. //职务
  2227. cell = new DataGridViewTextBoxCell();
  2228. cell.Value = "化妆助理选片二销";
  2229. dgvr.Cells.Add(cell);
  2230. //客户姓名
  2231. cell = new DataGridViewTextBoxCell();
  2232. cell.Value = dt_ViceMakeupArtist.Rows[t]["客户名称"].ToString().Trim();
  2233. dgvr.Cells.Add(cell);
  2234. //收款金额
  2235. cell = new DataGridViewTextBoxCell();
  2236. cell.Value = Convert.ToDecimal(dt_ViceMakeupArtist.Rows[t]["收款金额"]).ToString("N2");
  2237. dgvr.Cells.Add(cell);
  2238. //收款时间
  2239. cell = new DataGridViewTextBoxCell();
  2240. cell.Value = dt_ViceMakeupArtist.Rows[t]["收款时间"].ToString().Trim();
  2241. dgvr.Cells.Add(cell);
  2242. //套系类别
  2243. cell = new DataGridViewTextBoxCell();
  2244. cell.Value = dt_ViceMakeupArtist.Rows[t]["套系类别"].ToString().Trim();
  2245. dgvr.Cells.Add(cell);
  2246. //套系名称
  2247. cell = new DataGridViewTextBoxCell();
  2248. cell.Value = dt_ViceMakeupArtist.Rows[t]["套系名称"].ToString().Trim();
  2249. dgvr.Cells.Add(cell);
  2250. //应收金额
  2251. cell = new DataGridViewTextBoxCell();
  2252. cell.Value = Convert.ToDecimal(dt_ViceMakeupArtist.Rows[t]["应收金额"]).ToString("N2").Trim();
  2253. dgvr.Cells.Add(cell);
  2254. //项目名称
  2255. cell = new DataGridViewTextBoxCell();
  2256. if (string.IsNullOrEmpty(dt_ViceMakeupArtist.Rows[t]["项目名称"].ToString().Trim()))
  2257. { cell.Value = dt_ViceMakeupArtist.Rows[t]["收款类别"].ToString(); }
  2258. else { cell.Value = dt_ViceMakeupArtist.Rows[t]["项目名称"].ToString().Trim(); }
  2259. dgvr.Cells.Add(cell);
  2260. //付款名称
  2261. cell = new DataGridViewTextBoxCell();
  2262. cell.Value = dt_ViceMakeupArtist.Rows[t]["付款方式名称"].ToString().Trim();
  2263. dgvr.Cells.Add(cell);
  2264. //拍摄状态
  2265. cell = new DataGridViewTextBoxCell();
  2266. if (Convert.ToInt32(dt_ViceMakeupArtist.Rows[t]["未拍个数"]) == 0)
  2267. { cell.Value = "OK"; }
  2268. else { cell.Value = "未拍"; }
  2269. dgvr.Cells.Add(cell);
  2270. //拍摄时间
  2271. cell = new DataGridViewTextBoxCell();
  2272. cell.Value = dt_ViceMakeupArtist.Rows[t]["最后拍摄时间"].ToString();
  2273. dgvr.Cells.Add(cell);
  2274. //选片状态
  2275. cell = new DataGridViewTextBoxCell();
  2276. if (dt_ViceMakeupArtist.Rows[t]["选片状态"].ToString() == "OK")
  2277. { cell.Value = "OK"; }
  2278. else { cell.Value = "未选"; }
  2279. dgvr.Cells.Add(cell);
  2280. //选片时间
  2281. cell = new DataGridViewTextBoxCell();
  2282. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_ViceMakeupArtist.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  2283. dgvr.Cells.Add(cell);
  2284. //取件状态
  2285. cell = new DataGridViewTextBoxCell();
  2286. if (dt_ViceMakeupArtist.Rows[t]["取件状态"].ToString() == "OK")
  2287. { cell.Value = "OK"; }
  2288. else { cell.Value = "未取"; }
  2289. dgvr.Cells.Add(cell);
  2290. //取件时间
  2291. cell = new DataGridViewTextBoxCell();
  2292. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_ViceMakeupArtist.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  2293. dgvr.Cells.Add(cell);
  2294. //拍摄名称
  2295. cell = new DataGridViewTextBoxCell();
  2296. cell.Value = dt_ViceMakeupArtist.Rows[t]["拍摄名称"].ToString();
  2297. dgvr.Cells.Add(cell);
  2298. //订单类型
  2299. cell = new DataGridViewTextBoxCell();
  2300. cell.Value = dt_ViceMakeupArtist.Rows[t]["订单类型"].ToString();
  2301. dgvr.Cells.Add(cell);
  2302. //收款类型
  2303. cell = new DataGridViewTextBoxCell();
  2304. cell.Value = dt_ViceMakeupArtist.Rows[t]["收款类别"].ToString();
  2305. dgvr.Cells.Add(cell);
  2306. //副订单
  2307. cell = new DataGridViewTextBoxCell();
  2308. cell.Value = dt_ViceMakeupArtist.Rows[t]["副订单"].ToString();
  2309. dgvr.Cells.Add(cell);
  2310. //化妆助理满意总分
  2311. cell = new DataGridViewTextBoxCell();
  2312. cell.Value = dt_ViceMakeupArtist.Rows[t]["化妆助理满意总分"].ToString();
  2313. dgvr.Cells.Add(cell);
  2314. #endregion
  2315. this.Invoke(new UpdateControl(delegate()
  2316. {
  2317. this.dgv.Rows.Add(dgvr);
  2318. }));
  2319. }
  2320. }
  2321. }
  2322. #endregion
  2323. }
  2324. }
  2325. }
  2326. ConfigureRow = dt_SystemConfigure.Select("Sconfig_Code='GuideSelectionFilmsDivision' and Sconfig_IsEnabled=1");
  2327. if (ConfigureRow.Length > 0)
  2328. {
  2329. if (ConfigureRow[0]["Sconfig_Value"].ToString() == "1")
  2330. {
  2331. if (this.Str_ProjectTitle.Trim() == "" || this.Str_ProjectTitle.Trim() == "引导选片二销")
  2332. {
  2333. #region 引导师
  2334. s = "";
  2335. strBuilder = new StringBuilder();
  2336. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  2337. { strBuilder.Append(" And 引导师ID like '%" + EmployeeName + "%' "); }
  2338. if (this.Str_ProcessStatus.Trim() == "")
  2339. { strBuilder.Append(" And 未拍个数 = 0 And (收款时间 >= '" + StartTime + "' And 收款时间 <= '" + EndTime + " 23:59:59.000')"); }
  2340. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  2341. { strBuilder.Append(" And 未拍个数 = 0 And (最后拍摄时间 >= '" + StartTime + "' And 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  2342. if (this.Str_ProcessStatus.Trim() == "选片OK")
  2343. { strBuilder.Append(" And 选片状态 = 'OK' And (选片时间 >= '" + StartTime + "' And 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  2344. if (this.Str_ProcessStatus.Trim() == "取件OK")
  2345. { strBuilder.Append(" And 取件状态 = 'OK' And (取件日期 >= '" + StartTime + "' And 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  2346. if (!string.IsNullOrEmpty(this.Str_Scores1))
  2347. { strBuilder.Append(" and (引导满意总分>=" + this.Str_Scores1 + " and 引导满意总分<=" + this.Str_Scores2 + ")"); }
  2348. s = BindSelect5();
  2349. DataTable dtCount1 = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  2350. if (dtCount1.Rows.Count > 0)
  2351. {
  2352. if (Convert.ToInt32(dtCount1.Rows[0]["CountID"]) > 0)
  2353. {
  2354. backgroundWorker.ReportProgress(0, "正在获取'引导师选片二销业绩' ...");
  2355. string StrColumnName = "订单号,客户名称,收款金额,收款时间,套系类别,套系名称,应收金额,项目名称,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,取件状态,取件日期,拍摄名称,订单类型,副订单,引导满意总分";
  2356. DataTable dt_BootDivisiont = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  2357. for (int t = 0; t < dt_BootDivisiont.Rows.Count; t++)
  2358. {
  2359. #region
  2360. DataGridViewRow dgvr = new DataGridViewRow();
  2361. DataGridViewCell cell = null;
  2362. //订单号
  2363. cell = new DataGridViewTextBoxCell();
  2364. cell.Value = dt_BootDivisiont.Rows[t]["订单号"].ToString().Trim();
  2365. dgvr.Cells.Add(cell);
  2366. //员工
  2367. cell = new DataGridViewTextBoxCell();
  2368. cell.Value = StrUserName;
  2369. dgvr.Cells.Add(cell);
  2370. //职务
  2371. cell = new DataGridViewTextBoxCell();
  2372. cell.Value = "引导选片二销";
  2373. dgvr.Cells.Add(cell);
  2374. //客户姓名
  2375. cell = new DataGridViewTextBoxCell();
  2376. cell.Value = dt_BootDivisiont.Rows[t]["客户名称"].ToString().Trim();
  2377. dgvr.Cells.Add(cell);
  2378. //收款金额
  2379. cell = new DataGridViewTextBoxCell();
  2380. cell.Value = Convert.ToDecimal(dt_BootDivisiont.Rows[t]["收款金额"]).ToString("N2");
  2381. dgvr.Cells.Add(cell);
  2382. //收款时间
  2383. cell = new DataGridViewTextBoxCell();
  2384. cell.Value = dt_BootDivisiont.Rows[t]["收款时间"].ToString().Trim();
  2385. dgvr.Cells.Add(cell);
  2386. //套系类别
  2387. cell = new DataGridViewTextBoxCell();
  2388. cell.Value = dt_BootDivisiont.Rows[t]["套系类别"].ToString().Trim();
  2389. dgvr.Cells.Add(cell);
  2390. //套系名称
  2391. cell = new DataGridViewTextBoxCell();
  2392. cell.Value = dt_BootDivisiont.Rows[t]["套系名称"].ToString().Trim();
  2393. dgvr.Cells.Add(cell);
  2394. //应收金额
  2395. cell = new DataGridViewTextBoxCell();
  2396. cell.Value = Convert.ToDecimal(dt_BootDivisiont.Rows[t]["应收金额"]).ToString("N2").Trim();
  2397. dgvr.Cells.Add(cell);
  2398. //项目名称
  2399. cell = new DataGridViewTextBoxCell();
  2400. if (string.IsNullOrEmpty(dt_BootDivisiont.Rows[t]["项目名称"].ToString().Trim()))
  2401. { cell.Value = dt_BootDivisiont.Rows[t]["收款类别"].ToString(); }
  2402. else { cell.Value = dt_BootDivisiont.Rows[t]["项目名称"].ToString().Trim(); }
  2403. dgvr.Cells.Add(cell);
  2404. //付款名称
  2405. cell = new DataGridViewTextBoxCell();
  2406. cell.Value = dt_BootDivisiont.Rows[t]["付款方式名称"].ToString().Trim();
  2407. dgvr.Cells.Add(cell);
  2408. //拍摄状态
  2409. cell = new DataGridViewTextBoxCell();
  2410. if (Convert.ToInt32(dt_BootDivisiont.Rows[t]["未拍个数"]) == 0)
  2411. { cell.Value = "OK"; }
  2412. else { cell.Value = "未拍"; }
  2413. dgvr.Cells.Add(cell);
  2414. //拍摄时间
  2415. cell = new DataGridViewTextBoxCell();
  2416. cell.Value = dt_BootDivisiont.Rows[t]["最后拍摄时间"].ToString();
  2417. dgvr.Cells.Add(cell);
  2418. //选片状态
  2419. cell = new DataGridViewTextBoxCell();
  2420. if (dt_BootDivisiont.Rows[t]["选片状态"].ToString() == "OK")
  2421. { cell.Value = "OK"; }
  2422. else { cell.Value = "未选"; }
  2423. dgvr.Cells.Add(cell);
  2424. //选片时间
  2425. cell = new DataGridViewTextBoxCell();
  2426. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_BootDivisiont.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  2427. dgvr.Cells.Add(cell);
  2428. //取件状态
  2429. cell = new DataGridViewTextBoxCell();
  2430. if (dt_BootDivisiont.Rows[t]["取件状态"].ToString() == "OK")
  2431. { cell.Value = "OK"; }
  2432. else { cell.Value = "未取"; }
  2433. dgvr.Cells.Add(cell);
  2434. //取件时间
  2435. cell = new DataGridViewTextBoxCell();
  2436. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_BootDivisiont.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  2437. dgvr.Cells.Add(cell);
  2438. //拍摄名称
  2439. cell = new DataGridViewTextBoxCell();
  2440. cell.Value = dt_BootDivisiont.Rows[t]["拍摄名称"].ToString();
  2441. dgvr.Cells.Add(cell);
  2442. //订单类型
  2443. cell = new DataGridViewTextBoxCell();
  2444. cell.Value = dt_BootDivisiont.Rows[t]["订单类型"].ToString();
  2445. dgvr.Cells.Add(cell);
  2446. //收款类型
  2447. cell = new DataGridViewTextBoxCell();
  2448. cell.Value = dt_BootDivisiont.Rows[t]["收款类别"].ToString();
  2449. dgvr.Cells.Add(cell);
  2450. //副订单
  2451. cell = new DataGridViewTextBoxCell();
  2452. cell.Value = dt_BootDivisiont.Rows[t]["副订单"].ToString();
  2453. dgvr.Cells.Add(cell);
  2454. //引导满意总分
  2455. cell = new DataGridViewTextBoxCell();
  2456. cell.Value = dt_BootDivisiont.Rows[t]["引导满意总分"].ToString();
  2457. dgvr.Cells.Add(cell);
  2458. #endregion
  2459. this.Invoke(new UpdateControl(delegate()
  2460. {
  2461. this.dgv.Rows.Add(dgvr);
  2462. }));
  2463. }
  2464. }
  2465. }
  2466. #endregion
  2467. #region 引导助理
  2468. s = "";
  2469. strBuilder = new StringBuilder();
  2470. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  2471. { strBuilder.Append(" And 引导助理ID like '%" + EmployeeName + "%' "); }
  2472. if (this.Str_ProcessStatus.Trim() == "")
  2473. { strBuilder.Append(" And 未拍个数 = 0 And (收款时间 >= '" + StartTime + "' And 收款时间 <= '" + EndTime + " 23:59:59.000')"); }
  2474. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  2475. { strBuilder.Append(" And 未拍个数 = 0 And (最后拍摄时间 >= '" + StartTime + "' And 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  2476. if (this.Str_ProcessStatus.Trim() == "选片OK")
  2477. { strBuilder.Append(" And 选片状态 = 'OK' And (选片时间 >= '" + StartTime + "' And 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  2478. if (this.Str_ProcessStatus.Trim() == "取件OK")
  2479. { strBuilder.Append(" And 取件状态 = 'OK' And (取件日期 >= '" + StartTime + "' And 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  2480. if (!string.IsNullOrEmpty(this.Str_Scores1))
  2481. { strBuilder.Append(" and (引导助理满意总分>=" + this.Str_Scores1 + " and 引导助理满意总分<=" + this.Str_Scores2 + ")"); }
  2482. s = BindSelect5();
  2483. DataTable dtCount2 = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  2484. if (dtCount2.Rows.Count > 0)
  2485. {
  2486. if (Convert.ToInt32(dtCount2.Rows[0]["CountID"]) > 0)
  2487. {
  2488. backgroundWorker.ReportProgress(0, "正在获取'引导助理选片二销业绩' ...");
  2489. string StrColumnName = "订单号,客户名称,收款金额,收款时间,套系类别,套系名称,应收金额,项目名称,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,取件状态,取件日期,拍摄名称,订单类型,副订单,引导助理满意总分";
  2490. DataTable dt_BootDivisiont = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  2491. for (int t = 0; t < dt_BootDivisiont.Rows.Count; t++)
  2492. {
  2493. #region
  2494. DataGridViewRow dgvr = new DataGridViewRow();
  2495. DataGridViewCell cell = null;
  2496. //订单号
  2497. cell = new DataGridViewTextBoxCell();
  2498. cell.Value = dt_BootDivisiont.Rows[t]["订单号"].ToString().Trim();
  2499. dgvr.Cells.Add(cell);
  2500. //员工
  2501. cell = new DataGridViewTextBoxCell();
  2502. cell.Value = StrUserName;
  2503. dgvr.Cells.Add(cell);
  2504. //职务
  2505. cell = new DataGridViewTextBoxCell();
  2506. cell.Value = "引导助理选片二销";
  2507. dgvr.Cells.Add(cell);
  2508. //客户姓名
  2509. cell = new DataGridViewTextBoxCell();
  2510. cell.Value = dt_BootDivisiont.Rows[t]["客户名称"].ToString().Trim();
  2511. dgvr.Cells.Add(cell);
  2512. //收款金额
  2513. cell = new DataGridViewTextBoxCell();
  2514. cell.Value = Convert.ToDecimal(dt_BootDivisiont.Rows[t]["收款金额"]).ToString("N2");
  2515. dgvr.Cells.Add(cell);
  2516. //收款时间
  2517. cell = new DataGridViewTextBoxCell();
  2518. cell.Value = dt_BootDivisiont.Rows[t]["收款时间"].ToString().Trim();
  2519. dgvr.Cells.Add(cell);
  2520. //套系类别
  2521. cell = new DataGridViewTextBoxCell();
  2522. cell.Value = dt_BootDivisiont.Rows[t]["套系类别"].ToString().Trim();
  2523. dgvr.Cells.Add(cell);
  2524. //套系名称
  2525. cell = new DataGridViewTextBoxCell();
  2526. cell.Value = dt_BootDivisiont.Rows[t]["套系名称"].ToString().Trim();
  2527. dgvr.Cells.Add(cell);
  2528. //应收金额
  2529. cell = new DataGridViewTextBoxCell();
  2530. cell.Value = Convert.ToDecimal(dt_BootDivisiont.Rows[t]["应收金额"]).ToString("N2").Trim();
  2531. dgvr.Cells.Add(cell);
  2532. //项目名称
  2533. cell = new DataGridViewTextBoxCell();
  2534. if (string.IsNullOrEmpty(dt_BootDivisiont.Rows[t]["项目名称"].ToString().Trim()))
  2535. { cell.Value = dt_BootDivisiont.Rows[t]["收款类别"].ToString(); }
  2536. else { cell.Value = dt_BootDivisiont.Rows[t]["项目名称"].ToString().Trim(); }
  2537. dgvr.Cells.Add(cell);
  2538. //付款名称
  2539. cell = new DataGridViewTextBoxCell();
  2540. cell.Value = dt_BootDivisiont.Rows[t]["付款方式名称"].ToString().Trim();
  2541. dgvr.Cells.Add(cell);
  2542. //拍摄状态
  2543. cell = new DataGridViewTextBoxCell();
  2544. if (Convert.ToInt32(dt_BootDivisiont.Rows[t]["未拍个数"]) == 0)
  2545. { cell.Value = "OK"; }
  2546. else { cell.Value = "未拍"; }
  2547. dgvr.Cells.Add(cell);
  2548. //拍摄时间
  2549. cell = new DataGridViewTextBoxCell();
  2550. cell.Value = dt_BootDivisiont.Rows[t]["最后拍摄时间"].ToString();
  2551. dgvr.Cells.Add(cell);
  2552. //选片状态
  2553. cell = new DataGridViewTextBoxCell();
  2554. if (dt_BootDivisiont.Rows[t]["选片状态"].ToString() == "OK")
  2555. { cell.Value = "OK"; }
  2556. else { cell.Value = "未选"; }
  2557. dgvr.Cells.Add(cell);
  2558. //选片时间
  2559. cell = new DataGridViewTextBoxCell();
  2560. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_BootDivisiont.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  2561. dgvr.Cells.Add(cell);
  2562. //取件状态
  2563. cell = new DataGridViewTextBoxCell();
  2564. if (dt_BootDivisiont.Rows[t]["取件状态"].ToString() == "OK")
  2565. { cell.Value = "OK"; }
  2566. else { cell.Value = "未取"; }
  2567. dgvr.Cells.Add(cell);
  2568. //取件时间
  2569. cell = new DataGridViewTextBoxCell();
  2570. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_BootDivisiont.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  2571. dgvr.Cells.Add(cell);
  2572. //拍摄名称
  2573. cell = new DataGridViewTextBoxCell();
  2574. cell.Value = dt_BootDivisiont.Rows[t]["拍摄名称"].ToString();
  2575. dgvr.Cells.Add(cell);
  2576. //订单类型
  2577. cell = new DataGridViewTextBoxCell();
  2578. cell.Value = dt_BootDivisiont.Rows[t]["订单类型"].ToString();
  2579. dgvr.Cells.Add(cell);
  2580. //收款类型
  2581. cell = new DataGridViewTextBoxCell();
  2582. cell.Value = dt_BootDivisiont.Rows[t]["收款类别"].ToString();
  2583. dgvr.Cells.Add(cell);
  2584. //副订单
  2585. cell = new DataGridViewTextBoxCell();
  2586. cell.Value = dt_BootDivisiont.Rows[t]["副订单"].ToString();
  2587. dgvr.Cells.Add(cell);
  2588. //引导满意总分
  2589. cell = new DataGridViewTextBoxCell();
  2590. cell.Value = dt_BootDivisiont.Rows[t]["引导助理满意总分"].ToString();
  2591. dgvr.Cells.Add(cell);
  2592. #endregion
  2593. this.Invoke(new UpdateControl(delegate()
  2594. {
  2595. this.dgv.Rows.Add(dgvr);
  2596. }));
  2597. }
  2598. }
  2599. }
  2600. #endregion
  2601. }
  2602. }
  2603. }
  2604. ConfigureRow = dt_SystemConfigure.Select("Sconfig_Code='FirstRepairDivisionSelectionFilms' and Sconfig_IsEnabled=1");
  2605. if (ConfigureRow.Length > 0)
  2606. {
  2607. if (ConfigureRow[0]["Sconfig_Value"].ToString() == "1")
  2608. {
  2609. if (this.Str_ProjectTitle.Trim() == "" || this.Str_ProjectTitle.Trim() == "初修选片二销")
  2610. {
  2611. #region 初修师
  2612. s = "";
  2613. strBuilder = new StringBuilder();
  2614. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  2615. { strBuilder.Append(" And 初修师ID like '%" + EmployeeName + "%' "); }
  2616. if (this.Str_ProcessStatus.Trim() == "")
  2617. { strBuilder.Append(" And 未拍个数 = 0 And 服务前期初修查询状态 = '2' And (初修二销查询时间 >= '" + StartTime + "' And 初修二销查询时间 <= '" + EndTime + " 23:59:59.000')"); }
  2618. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  2619. { strBuilder.Append(" And 未拍个数 = 0 And (最后拍摄时间 >= '" + StartTime + "' And 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  2620. if (this.Str_ProcessStatus.Trim() == "选片OK")
  2621. { strBuilder.Append(" And 选片状态 = 'OK' And (选片时间 >= '" + StartTime + "' And 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  2622. if (this.Str_ProcessStatus.Trim() == "取件OK")
  2623. { strBuilder.Append(" And 取件状态 = 'OK' And (取件日期 >= '" + StartTime + "' And 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  2624. if (!string.IsNullOrEmpty(this.Str_Scores1))
  2625. { strBuilder.Append(" and (初修师满意总分>=" + this.Str_Scores1 + " and 初修师满意总分<=" + this.Str_Scores2 + ")"); }
  2626. s = BindSelect5();
  2627. DataTable dtCount = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  2628. if (dtCount.Rows.Count > 0)
  2629. {
  2630. if (Convert.ToInt32(dtCount.Rows[0]["CountID"]) > 0)
  2631. {
  2632. backgroundWorker.ReportProgress(0, "正在获取'初修师选片二销业绩' ...");
  2633. string StrColumnName = "订单号,客户名称,收款金额,收款时间,套系类别,套系名称,应收金额,项目名称,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,初修状态,初修时间,取件状态,取件日期,拍摄名称,订单类型,副订单,初修师满意总分";
  2634. DataTable dt_EarlyRepair = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  2635. for (int t = 0; t < dt_EarlyRepair.Rows.Count; t++)
  2636. {
  2637. #region
  2638. DataGridViewRow dgvr = new DataGridViewRow();
  2639. DataGridViewCell cell = null;
  2640. //订单号
  2641. cell = new DataGridViewTextBoxCell();
  2642. cell.Value = dt_EarlyRepair.Rows[t]["订单号"].ToString().Trim();
  2643. dgvr.Cells.Add(cell);
  2644. //员工
  2645. cell = new DataGridViewTextBoxCell();
  2646. cell.Value = StrUserName;
  2647. dgvr.Cells.Add(cell);
  2648. //职务
  2649. cell = new DataGridViewTextBoxCell();
  2650. cell.Value = "初修师选片二销";
  2651. dgvr.Cells.Add(cell);
  2652. //客户姓名
  2653. cell = new DataGridViewTextBoxCell();
  2654. cell.Value = dt_EarlyRepair.Rows[t]["客户名称"].ToString().Trim();
  2655. dgvr.Cells.Add(cell);
  2656. //收款金额
  2657. cell = new DataGridViewTextBoxCell();
  2658. cell.Value = Convert.ToDecimal(dt_EarlyRepair.Rows[t]["收款金额"]).ToString("N2");
  2659. dgvr.Cells.Add(cell);
  2660. //收款时间
  2661. cell = new DataGridViewTextBoxCell();
  2662. cell.Value = dt_EarlyRepair.Rows[t]["收款时间"].ToString().Trim();
  2663. dgvr.Cells.Add(cell);
  2664. //套系类别
  2665. cell = new DataGridViewTextBoxCell();
  2666. cell.Value = dt_EarlyRepair.Rows[t]["套系类别"].ToString().Trim();
  2667. dgvr.Cells.Add(cell);
  2668. //套系名称
  2669. cell = new DataGridViewTextBoxCell();
  2670. cell.Value = dt_EarlyRepair.Rows[t]["套系名称"].ToString().Trim();
  2671. dgvr.Cells.Add(cell);
  2672. //应收金额
  2673. cell = new DataGridViewTextBoxCell();
  2674. cell.Value = Convert.ToDecimal(dt_EarlyRepair.Rows[t]["应收金额"]).ToString("N2").Trim();
  2675. dgvr.Cells.Add(cell);
  2676. //项目名称
  2677. cell = new DataGridViewTextBoxCell();
  2678. if (string.IsNullOrEmpty(dt_EarlyRepair.Rows[t]["项目名称"].ToString().Trim()))
  2679. { cell.Value = dt_EarlyRepair.Rows[t]["收款类别"].ToString(); }
  2680. else { cell.Value = dt_EarlyRepair.Rows[t]["项目名称"].ToString().Trim(); }
  2681. dgvr.Cells.Add(cell);
  2682. //付款名称
  2683. cell = new DataGridViewTextBoxCell();
  2684. cell.Value = dt_EarlyRepair.Rows[t]["付款方式名称"].ToString().Trim();
  2685. dgvr.Cells.Add(cell);
  2686. //拍摄状态
  2687. cell = new DataGridViewTextBoxCell();
  2688. if (Convert.ToInt32(dt_EarlyRepair.Rows[t]["未拍个数"]) == 0)
  2689. { cell.Value = "OK"; }
  2690. else { cell.Value = "未拍"; }
  2691. dgvr.Cells.Add(cell);
  2692. //拍摄时间
  2693. cell = new DataGridViewTextBoxCell();
  2694. cell.Value = dt_EarlyRepair.Rows[t]["最后拍摄时间"].ToString();
  2695. dgvr.Cells.Add(cell);
  2696. //选片状态
  2697. cell = new DataGridViewTextBoxCell();
  2698. if (dt_EarlyRepair.Rows[t]["选片状态"].ToString() == "OK")
  2699. { cell.Value = "OK"; }
  2700. else { cell.Value = "未选"; }
  2701. dgvr.Cells.Add(cell);
  2702. //选片时间
  2703. cell = new DataGridViewTextBoxCell();
  2704. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_EarlyRepair.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  2705. dgvr.Cells.Add(cell);
  2706. //取件状态
  2707. cell = new DataGridViewTextBoxCell();
  2708. if (dt_EarlyRepair.Rows[t]["取件状态"].ToString() == "OK")
  2709. { cell.Value = "OK"; }
  2710. else { cell.Value = "未取"; }
  2711. dgvr.Cells.Add(cell);
  2712. //取件时间
  2713. cell = new DataGridViewTextBoxCell();
  2714. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_EarlyRepair.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  2715. dgvr.Cells.Add(cell);
  2716. //拍摄名称
  2717. cell = new DataGridViewTextBoxCell();
  2718. cell.Value = dt_EarlyRepair.Rows[t]["拍摄名称"].ToString();
  2719. dgvr.Cells.Add(cell);
  2720. //订单类型
  2721. cell = new DataGridViewTextBoxCell();
  2722. cell.Value = dt_EarlyRepair.Rows[t]["订单类型"].ToString();
  2723. dgvr.Cells.Add(cell);
  2724. //收款类型
  2725. cell = new DataGridViewTextBoxCell();
  2726. cell.Value = dt_EarlyRepair.Rows[t]["收款类别"].ToString();
  2727. dgvr.Cells.Add(cell);
  2728. //副订单
  2729. cell = new DataGridViewTextBoxCell();
  2730. cell.Value = dt_EarlyRepair.Rows[t]["副订单"].ToString();
  2731. dgvr.Cells.Add(cell);
  2732. //初修师满意总分
  2733. cell = new DataGridViewTextBoxCell();
  2734. cell.Value = dt_EarlyRepair.Rows[t]["初修师满意总分"].ToString();
  2735. dgvr.Cells.Add(cell);
  2736. #endregion
  2737. this.Invoke(new UpdateControl(delegate()
  2738. {
  2739. this.dgv.Rows.Add(dgvr);
  2740. }));
  2741. }
  2742. }
  2743. }
  2744. #endregion
  2745. }
  2746. }
  2747. }
  2748. ConfigureRow = dt_SystemConfigure.Select("Sconfig_Code = 'StoreSelectionFilms' and Sconfig_IsEnabled = 1");
  2749. if (ConfigureRow.Length > 0)
  2750. {
  2751. if (ConfigureRow[0]["Sconfig_Value"].ToString() == "1")
  2752. {
  2753. if (this.Str_ProjectTitle.Trim() == "" || this.Str_ProjectTitle.Trim() == "门市选片二销")
  2754. {
  2755. #region 门市
  2756. s = "";
  2757. strBuilder = new StringBuilder();
  2758. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  2759. { strBuilder.Append(" And 订单门市 like '%" + EmployeeName + "%' "); }
  2760. if (this.Str_ProcessStatus.Trim() == "")
  2761. { strBuilder.Append(" And 未拍个数 = 0 And (收款时间 >= '" + StartTime + " 00:00:00.000' And 收款时间 <= '" + EndTime + " 23:59:59.000')"); }
  2762. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  2763. { strBuilder.Append(" And 未拍个数 = 0 And (最后拍摄时间 >= '" + StartTime + "' And 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  2764. if (this.Str_ProcessStatus.Trim() == "选片OK")
  2765. { strBuilder.Append(" And 选片状态 = 'OK' And (选片时间 >= '" + StartTime + "' And 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  2766. if (this.Str_ProcessStatus.Trim() == "取件OK")
  2767. { strBuilder.Append(" And 取件状态 = 'OK' And (取件日期 >= '" + StartTime + "' And 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  2768. s = BindSelect5();
  2769. DataTable dtCount = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  2770. if (dtCount.Rows.Count > 0)
  2771. {
  2772. if (Convert.ToInt32(dtCount.Rows[0]["CountID"]) > 0)
  2773. {
  2774. backgroundWorker.ReportProgress(0, "正在获取'门市选片二销业绩' ...");
  2775. string StrColumnName = "订单号,客户名称,收款金额,收款时间,套系类别,套系名称,应收金额,项目名称,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,取件状态,取件日期,拍摄名称,订单类型,副订单";
  2776. DataTable dt_OrderPerson = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  2777. for (int t = 0; t < dt_OrderPerson.Rows.Count; t++)
  2778. {
  2779. #region
  2780. DataGridViewRow dgvr = new DataGridViewRow();
  2781. DataGridViewCell cell = null;
  2782. //订单号
  2783. cell = new DataGridViewTextBoxCell();
  2784. cell.Value = dt_OrderPerson.Rows[t]["订单号"].ToString().Trim();
  2785. dgvr.Cells.Add(cell);
  2786. //员工
  2787. cell = new DataGridViewTextBoxCell();
  2788. cell.Value = StrUserName;
  2789. dgvr.Cells.Add(cell);
  2790. //职务
  2791. cell = new DataGridViewTextBoxCell();
  2792. cell.Value = "门市选片二销";
  2793. dgvr.Cells.Add(cell);
  2794. //客户姓名
  2795. cell = new DataGridViewTextBoxCell();
  2796. cell.Value = dt_OrderPerson.Rows[t]["客户名称"].ToString().Trim();
  2797. dgvr.Cells.Add(cell);
  2798. //收款金额
  2799. cell = new DataGridViewTextBoxCell();
  2800. cell.Value = Convert.ToDecimal(dt_OrderPerson.Rows[t]["收款金额"]).ToString("N2");
  2801. dgvr.Cells.Add(cell);
  2802. //收款时间
  2803. cell = new DataGridViewTextBoxCell();
  2804. cell.Value = dt_OrderPerson.Rows[t]["收款时间"].ToString().Trim();
  2805. dgvr.Cells.Add(cell);
  2806. //套系类别
  2807. cell = new DataGridViewTextBoxCell();
  2808. cell.Value = dt_OrderPerson.Rows[t]["套系类别"].ToString().Trim();
  2809. dgvr.Cells.Add(cell);
  2810. //套系名称
  2811. cell = new DataGridViewTextBoxCell();
  2812. cell.Value = dt_OrderPerson.Rows[t]["套系名称"].ToString().Trim();
  2813. dgvr.Cells.Add(cell);
  2814. //应收金额
  2815. cell = new DataGridViewTextBoxCell();
  2816. cell.Value = Convert.ToDecimal(dt_OrderPerson.Rows[t]["应收金额"]).ToString("N2").Trim();
  2817. dgvr.Cells.Add(cell);
  2818. //项目名称
  2819. cell = new DataGridViewTextBoxCell();
  2820. if (string.IsNullOrEmpty(dt_OrderPerson.Rows[t]["项目名称"].ToString().Trim()))
  2821. { cell.Value = dt_OrderPerson.Rows[t]["收款类别"].ToString(); }
  2822. else { cell.Value = dt_OrderPerson.Rows[t]["项目名称"].ToString().Trim(); }
  2823. dgvr.Cells.Add(cell);
  2824. //付款名称
  2825. cell = new DataGridViewTextBoxCell();
  2826. cell.Value = dt_OrderPerson.Rows[t]["付款方式名称"].ToString().Trim();
  2827. dgvr.Cells.Add(cell);
  2828. //拍摄状态
  2829. cell = new DataGridViewTextBoxCell();
  2830. if (Convert.ToInt32(dt_OrderPerson.Rows[t]["未拍个数"]) == 0)
  2831. { cell.Value = "OK"; }
  2832. else { cell.Value = "未拍"; }
  2833. dgvr.Cells.Add(cell);
  2834. //拍摄时间
  2835. cell = new DataGridViewTextBoxCell();
  2836. cell.Value = dt_OrderPerson.Rows[t]["最后拍摄时间"].ToString();
  2837. dgvr.Cells.Add(cell);
  2838. //选片状态
  2839. cell = new DataGridViewTextBoxCell();
  2840. if (dt_OrderPerson.Rows[t]["选片状态"].ToString() == "OK")
  2841. { cell.Value = "OK"; }
  2842. else { cell.Value = "未选"; }
  2843. dgvr.Cells.Add(cell);
  2844. //选片时间
  2845. cell = new DataGridViewTextBoxCell();
  2846. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_OrderPerson.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  2847. dgvr.Cells.Add(cell);
  2848. //取件状态
  2849. cell = new DataGridViewTextBoxCell();
  2850. if (dt_OrderPerson.Rows[t]["取件状态"].ToString() == "OK")
  2851. { cell.Value = "OK"; }
  2852. else { cell.Value = "未取"; }
  2853. dgvr.Cells.Add(cell);
  2854. //取件时间
  2855. cell = new DataGridViewTextBoxCell();
  2856. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_OrderPerson.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  2857. dgvr.Cells.Add(cell);
  2858. //拍摄名称
  2859. cell = new DataGridViewTextBoxCell();
  2860. cell.Value = dt_OrderPerson.Rows[t]["拍摄名称"].ToString();
  2861. dgvr.Cells.Add(cell);
  2862. //订单类型
  2863. cell = new DataGridViewTextBoxCell();
  2864. cell.Value = dt_OrderPerson.Rows[t]["订单类型"].ToString();
  2865. dgvr.Cells.Add(cell);
  2866. //收款类型
  2867. cell = new DataGridViewTextBoxCell();
  2868. cell.Value = dt_OrderPerson.Rows[t]["收款类别"].ToString();
  2869. dgvr.Cells.Add(cell);
  2870. //副订单
  2871. cell = new DataGridViewTextBoxCell();
  2872. cell.Value = dt_OrderPerson.Rows[t]["副订单"].ToString();
  2873. dgvr.Cells.Add(cell);
  2874. //门市满意总分
  2875. cell = new DataGridViewTextBoxCell();
  2876. cell.Value = "";
  2877. dgvr.Cells.Add(cell);
  2878. #endregion
  2879. this.Invoke(new UpdateControl(delegate()
  2880. {
  2881. this.dgv.Rows.Add(dgvr);
  2882. }));
  2883. }
  2884. }
  2885. }
  2886. #endregion
  2887. }
  2888. }
  2889. }
  2890. ConfigureRow = dt_SystemConfigure.Select("Sconfig_Code='DesignerSelectionFilms' and Sconfig_IsEnabled=1");
  2891. if (ConfigureRow.Length > 0)
  2892. {
  2893. if (ConfigureRow[0]["Sconfig_Value"].ToString() == "1")
  2894. {
  2895. if (this.Str_ProjectTitle.Trim() == "" || this.Str_ProjectTitle.Trim() == "设计选片二销")
  2896. {
  2897. #region 设计师
  2898. s = "";
  2899. strBuilder = new StringBuilder();
  2900. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  2901. { strBuilder.Append(" And 设计师ID like '%" + EmployeeName + "%' "); }
  2902. if (this.Str_ProcessStatus.Trim() == "")
  2903. { strBuilder.Append(" And 未拍个数 = 0 And 服务前期设计查询状态 = '2' And (设计二销查询时间 >= '" + StartTime + "' And 设计二销查询时间 <= '" + EndTime + " 23:59:59.000')"); }
  2904. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  2905. { strBuilder.Append(" And 未拍个数 = 0 And (最后拍摄时间 >= '" + StartTime + "' And 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  2906. if (this.Str_ProcessStatus.Trim() == "选片OK")
  2907. { strBuilder.Append(" And 选片状态 = 'OK' And (选片时间 >= '" + StartTime + "' And 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  2908. if (this.Str_ProcessStatus.Trim() == "取件OK")
  2909. { strBuilder.Append(" And 取件状态 = 'OK' And (取件日期 >= '" + StartTime + "' And 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  2910. if (!string.IsNullOrEmpty(this.Str_Scores1))
  2911. { strBuilder.Append(" and (设计师满意总分>=" + this.Str_Scores1 + " and 设计师满意总分<=" + this.Str_Scores2 + ")"); }
  2912. s = BindSelect5();
  2913. DataTable dtCount = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  2914. if (dtCount.Rows.Count > 0)
  2915. {
  2916. if (Convert.ToInt32(dtCount.Rows[0]["CountID"]) > 0)
  2917. {
  2918. backgroundWorker.ReportProgress(0, "正在获取'设计师选片二销业绩' ...");
  2919. string StrColumnName = "订单号,客户名称,收款金额,收款时间,套系类别,套系名称,应收金额,项目名称,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,设计状态,设计时间,取件状态,取件日期,拍摄名称,订单类型,副订单,设计师满意总分";
  2920. DataTable dt_EarlyRepair = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  2921. for (int t = 0; t < dt_EarlyRepair.Rows.Count; t++)
  2922. {
  2923. #region
  2924. DataGridViewRow dgvr = new DataGridViewRow();
  2925. DataGridViewCell cell = null;
  2926. //订单号
  2927. cell = new DataGridViewTextBoxCell();
  2928. cell.Value = dt_EarlyRepair.Rows[t]["订单号"].ToString().Trim();
  2929. dgvr.Cells.Add(cell);
  2930. //员工
  2931. cell = new DataGridViewTextBoxCell();
  2932. cell.Value = StrUserName;
  2933. dgvr.Cells.Add(cell);
  2934. //职务
  2935. cell = new DataGridViewTextBoxCell();
  2936. cell.Value = "设计师选片二销";
  2937. dgvr.Cells.Add(cell);
  2938. //客户姓名
  2939. cell = new DataGridViewTextBoxCell();
  2940. cell.Value = dt_EarlyRepair.Rows[t]["客户名称"].ToString().Trim();
  2941. dgvr.Cells.Add(cell);
  2942. //收款金额
  2943. cell = new DataGridViewTextBoxCell();
  2944. cell.Value = Convert.ToDecimal(dt_EarlyRepair.Rows[t]["收款金额"]).ToString("N2");
  2945. dgvr.Cells.Add(cell);
  2946. //收款时间
  2947. cell = new DataGridViewTextBoxCell();
  2948. cell.Value = dt_EarlyRepair.Rows[t]["收款时间"].ToString().Trim();
  2949. dgvr.Cells.Add(cell);
  2950. //套系类别
  2951. cell = new DataGridViewTextBoxCell();
  2952. cell.Value = dt_EarlyRepair.Rows[t]["套系类别"].ToString().Trim();
  2953. dgvr.Cells.Add(cell);
  2954. //套系名称
  2955. cell = new DataGridViewTextBoxCell();
  2956. cell.Value = dt_EarlyRepair.Rows[t]["套系名称"].ToString().Trim();
  2957. dgvr.Cells.Add(cell);
  2958. //应收金额
  2959. cell = new DataGridViewTextBoxCell();
  2960. cell.Value = Convert.ToDecimal(dt_EarlyRepair.Rows[t]["应收金额"]).ToString("N2").Trim();
  2961. dgvr.Cells.Add(cell);
  2962. //项目名称
  2963. cell = new DataGridViewTextBoxCell();
  2964. if (string.IsNullOrEmpty(dt_EarlyRepair.Rows[t]["项目名称"].ToString().Trim()))
  2965. { cell.Value = dt_EarlyRepair.Rows[t]["收款类别"].ToString(); }
  2966. else { cell.Value = dt_EarlyRepair.Rows[t]["项目名称"].ToString().Trim(); }
  2967. dgvr.Cells.Add(cell);
  2968. //付款名称
  2969. cell = new DataGridViewTextBoxCell();
  2970. cell.Value = dt_EarlyRepair.Rows[t]["付款方式名称"].ToString().Trim();
  2971. dgvr.Cells.Add(cell);
  2972. //拍摄状态
  2973. cell = new DataGridViewTextBoxCell();
  2974. if (Convert.ToInt32(dt_EarlyRepair.Rows[t]["未拍个数"]) == 0)
  2975. { cell.Value = "OK"; }
  2976. else { cell.Value = "未拍"; }
  2977. dgvr.Cells.Add(cell);
  2978. //拍摄时间
  2979. cell = new DataGridViewTextBoxCell();
  2980. cell.Value = dt_EarlyRepair.Rows[t]["最后拍摄时间"].ToString();
  2981. dgvr.Cells.Add(cell);
  2982. //选片状态
  2983. cell = new DataGridViewTextBoxCell();
  2984. if (dt_EarlyRepair.Rows[t]["选片状态"].ToString() == "OK")
  2985. { cell.Value = "OK"; }
  2986. else { cell.Value = "未选"; }
  2987. dgvr.Cells.Add(cell);
  2988. //选片时间
  2989. cell = new DataGridViewTextBoxCell();
  2990. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_EarlyRepair.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  2991. dgvr.Cells.Add(cell);
  2992. //取件状态
  2993. cell = new DataGridViewTextBoxCell();
  2994. if (dt_EarlyRepair.Rows[t]["取件状态"].ToString() == "OK")
  2995. { cell.Value = "OK"; }
  2996. else { cell.Value = "未取"; }
  2997. dgvr.Cells.Add(cell);
  2998. //取件时间
  2999. cell = new DataGridViewTextBoxCell();
  3000. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_EarlyRepair.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  3001. dgvr.Cells.Add(cell);
  3002. //拍摄名称
  3003. cell = new DataGridViewTextBoxCell();
  3004. cell.Value = dt_EarlyRepair.Rows[t]["拍摄名称"].ToString();
  3005. dgvr.Cells.Add(cell);
  3006. //订单类型
  3007. cell = new DataGridViewTextBoxCell();
  3008. cell.Value = dt_EarlyRepair.Rows[t]["订单类型"].ToString();
  3009. dgvr.Cells.Add(cell);
  3010. //收款类型
  3011. cell = new DataGridViewTextBoxCell();
  3012. cell.Value = dt_EarlyRepair.Rows[t]["收款类别"].ToString();
  3013. dgvr.Cells.Add(cell);
  3014. //副订单
  3015. cell = new DataGridViewTextBoxCell();
  3016. cell.Value = dt_EarlyRepair.Rows[t]["副订单"].ToString();
  3017. dgvr.Cells.Add(cell);
  3018. //初修师满意总分
  3019. cell = new DataGridViewTextBoxCell();
  3020. cell.Value = dt_EarlyRepair.Rows[t]["设计师满意总分"].ToString();
  3021. dgvr.Cells.Add(cell);
  3022. #endregion
  3023. this.Invoke(new UpdateControl(delegate()
  3024. {
  3025. this.dgv.Rows.Add(dgvr);
  3026. }));
  3027. }
  3028. }
  3029. }
  3030. #endregion
  3031. }
  3032. }
  3033. }
  3034. ConfigureRow = dt_SystemConfigure.Select("Sconfig_Code='RefinedRepairSelectionFilms' and Sconfig_IsEnabled=1");
  3035. if (ConfigureRow.Length > 0)
  3036. {
  3037. if (ConfigureRow[0]["Sconfig_Value"].ToString() == "1")
  3038. {
  3039. if (this.Str_ProjectTitle.Trim() == "" || this.Str_ProjectTitle.Trim() == "精修选片二销")
  3040. {
  3041. #region 精修师
  3042. s = "";
  3043. strBuilder = new StringBuilder();
  3044. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  3045. { strBuilder.Append(" And 精修师ID like '%" + EmployeeName + "%' "); }
  3046. if (this.Str_ProcessStatus.Trim() == "")
  3047. { strBuilder.Append(" And 未拍个数 = 0 And 服务前期精修查询状态 = '2' And (精修二销查询时间 >= '" + StartTime + "' And 精修二销查询时间 <= '" + EndTime + " 23:59:59.000')"); }
  3048. if (this.Str_ProcessStatus.Trim() == "拍照OK")
  3049. { strBuilder.Append(" And 未拍个数 = 0 And (最后拍摄时间 >= '" + StartTime + "' And 最后拍摄时间 <= '" + EndTime + " 23:59:59.000')"); }
  3050. if (this.Str_ProcessStatus.Trim() == "选片OK")
  3051. { strBuilder.Append(" And 选片状态 = 'OK' And (选片时间 >= '" + StartTime + "' And 选片时间 <= '" + EndTime + " 23:59:59.000')"); }
  3052. if (this.Str_ProcessStatus.Trim() == "取件OK")
  3053. { strBuilder.Append(" And 取件状态 = 'OK' And (取件日期 >= '" + StartTime + "' And 取件日期 <= '" + EndTime + " 23:59:59.000')"); }
  3054. if (!string.IsNullOrEmpty(this.Str_Scores1))
  3055. { strBuilder.Append(" and (精修师满意总分>=" + this.Str_Scores1 + " and 精修师满意总分<=" + this.Str_Scores2 + ")"); }
  3056. s = BindSelect5();
  3057. DataTable dtCount = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  3058. if (dtCount.Rows.Count > 0)
  3059. {
  3060. if (Convert.ToInt32(dtCount.Rows[0]["CountID"]) > 0)
  3061. {
  3062. backgroundWorker.ReportProgress(0, "正在获取'精修师选片二销业绩' ...");
  3063. string StrColumnName = "订单号,客户名称,收款金额,收款时间,套系类别,套系名称,应收金额,项目名称,收款类别,付款方式名称,未拍个数,最后拍摄时间,选片状态,选片时间,精修状态,精修时间,取件状态,取件日期,拍摄名称,订单类型,副订单,精修师满意总分";
  3064. DataTable dt_EarlyRepair = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: "二销类别编号='BEBCABBAAHFCJBJGJ'" + strBuilder.ToString() + s.ToString(), ShowColumnName: StrColumnName).Tables[0];
  3065. for (int t = 0; t < dt_EarlyRepair.Rows.Count; t++)
  3066. {
  3067. #region
  3068. DataGridViewRow dgvr = new DataGridViewRow();
  3069. DataGridViewCell cell = null;
  3070. //订单号
  3071. cell = new DataGridViewTextBoxCell();
  3072. cell.Value = dt_EarlyRepair.Rows[t]["订单号"].ToString().Trim();
  3073. dgvr.Cells.Add(cell);
  3074. //员工
  3075. cell = new DataGridViewTextBoxCell();
  3076. cell.Value = StrUserName;
  3077. dgvr.Cells.Add(cell);
  3078. //职务
  3079. cell = new DataGridViewTextBoxCell();
  3080. cell.Value = "精修师选片二销";
  3081. dgvr.Cells.Add(cell);
  3082. //客户姓名
  3083. cell = new DataGridViewTextBoxCell();
  3084. cell.Value = dt_EarlyRepair.Rows[t]["客户名称"].ToString().Trim();
  3085. dgvr.Cells.Add(cell);
  3086. //收款金额
  3087. cell = new DataGridViewTextBoxCell();
  3088. cell.Value = Convert.ToDecimal(dt_EarlyRepair.Rows[t]["收款金额"]).ToString("N2");
  3089. dgvr.Cells.Add(cell);
  3090. //收款时间
  3091. cell = new DataGridViewTextBoxCell();
  3092. cell.Value = dt_EarlyRepair.Rows[t]["收款时间"].ToString().Trim();
  3093. dgvr.Cells.Add(cell);
  3094. //套系类别
  3095. cell = new DataGridViewTextBoxCell();
  3096. cell.Value = dt_EarlyRepair.Rows[t]["套系类别"].ToString().Trim();
  3097. dgvr.Cells.Add(cell);
  3098. //套系名称
  3099. cell = new DataGridViewTextBoxCell();
  3100. cell.Value = dt_EarlyRepair.Rows[t]["套系名称"].ToString().Trim();
  3101. dgvr.Cells.Add(cell);
  3102. //应收金额
  3103. cell = new DataGridViewTextBoxCell();
  3104. cell.Value = Convert.ToDecimal(dt_EarlyRepair.Rows[t]["应收金额"]).ToString("N2").Trim();
  3105. dgvr.Cells.Add(cell);
  3106. //项目名称
  3107. cell = new DataGridViewTextBoxCell();
  3108. if (string.IsNullOrEmpty(dt_EarlyRepair.Rows[t]["项目名称"].ToString().Trim()))
  3109. { cell.Value = dt_EarlyRepair.Rows[t]["收款类别"].ToString(); }
  3110. else { cell.Value = dt_EarlyRepair.Rows[t]["项目名称"].ToString().Trim(); }
  3111. dgvr.Cells.Add(cell);
  3112. //付款名称
  3113. cell = new DataGridViewTextBoxCell();
  3114. cell.Value = dt_EarlyRepair.Rows[t]["付款方式名称"].ToString().Trim();
  3115. dgvr.Cells.Add(cell);
  3116. //拍摄状态
  3117. cell = new DataGridViewTextBoxCell();
  3118. if (Convert.ToInt32(dt_EarlyRepair.Rows[t]["未拍个数"]) == 0)
  3119. { cell.Value = "OK"; }
  3120. else { cell.Value = "未拍"; }
  3121. dgvr.Cells.Add(cell);
  3122. //拍摄时间
  3123. cell = new DataGridViewTextBoxCell();
  3124. cell.Value = dt_EarlyRepair.Rows[t]["最后拍摄时间"].ToString();
  3125. dgvr.Cells.Add(cell);
  3126. //选片状态
  3127. cell = new DataGridViewTextBoxCell();
  3128. if (dt_EarlyRepair.Rows[t]["选片状态"].ToString() == "OK")
  3129. { cell.Value = "OK"; }
  3130. else { cell.Value = "未选"; }
  3131. dgvr.Cells.Add(cell);
  3132. //选片时间
  3133. cell = new DataGridViewTextBoxCell();
  3134. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_EarlyRepair.Rows[t]["选片时间"], "yyyy-MM-dd HH:mm");
  3135. dgvr.Cells.Add(cell);
  3136. //取件状态
  3137. cell = new DataGridViewTextBoxCell();
  3138. if (dt_EarlyRepair.Rows[t]["取件状态"].ToString() == "OK")
  3139. { cell.Value = "OK"; }
  3140. else { cell.Value = "未取"; }
  3141. dgvr.Cells.Add(cell);
  3142. //取件时间
  3143. cell = new DataGridViewTextBoxCell();
  3144. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt_EarlyRepair.Rows[t]["取件日期"], "yyyy-MM-dd HH:mm");
  3145. dgvr.Cells.Add(cell);
  3146. //拍摄名称
  3147. cell = new DataGridViewTextBoxCell();
  3148. cell.Value = dt_EarlyRepair.Rows[t]["拍摄名称"].ToString();
  3149. dgvr.Cells.Add(cell);
  3150. //订单类型
  3151. cell = new DataGridViewTextBoxCell();
  3152. cell.Value = dt_EarlyRepair.Rows[t]["订单类型"].ToString();
  3153. dgvr.Cells.Add(cell);
  3154. //收款类型
  3155. cell = new DataGridViewTextBoxCell();
  3156. cell.Value = dt_EarlyRepair.Rows[t]["收款类别"].ToString();
  3157. dgvr.Cells.Add(cell);
  3158. //副订单
  3159. cell = new DataGridViewTextBoxCell();
  3160. cell.Value = dt_EarlyRepair.Rows[t]["副订单"].ToString();
  3161. dgvr.Cells.Add(cell);
  3162. //初修师满意总分
  3163. cell = new DataGridViewTextBoxCell();
  3164. cell.Value = dt_EarlyRepair.Rows[t]["精修师满意总分"].ToString();
  3165. dgvr.Cells.Add(cell);
  3166. #endregion
  3167. this.Invoke(new UpdateControl(delegate()
  3168. {
  3169. this.dgv.Rows.Add(dgvr);
  3170. }));
  3171. }
  3172. }
  3173. }
  3174. #endregion
  3175. }
  3176. }
  3177. }
  3178. #endregion
  3179. }
  3180. #endregion
  3181. }
  3182. if (this.Str_ItemCategory.Trim() == "" || this.Str_ItemCategory.Trim() == "会员充值")
  3183. {
  3184. #region 获取会员充值
  3185. s = "";
  3186. strBuilder = new StringBuilder();
  3187. bool IsQuery = true;
  3188. if (string.IsNullOrEmpty(this.Str_ProcessStatus.Trim()))
  3189. {
  3190. strBuilder.Append("and 创建时间 >= '" + StartTime + "' and 创建时间 <= '" + EndTime + " 23:59:59.000' ");
  3191. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  3192. { strBuilder.Append("and 接单人编号 like '%" + EmployeeName + "%'"); }
  3193. s = BindSelect2(ref IsQuery);
  3194. }
  3195. else
  3196. { IsQuery = false; }
  3197. if (IsQuery)
  3198. {
  3199. DataTable dtCount = orbll.GetView_Custom("Vw_StaffPerformance_MemberCardRechargeRecord", StrWhere: " 1 = 1 " + strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  3200. if (dtCount.Rows.Count > 0)
  3201. {
  3202. if (Convert.ToInt32(dtCount.Rows[0]["CountID"]) > 0)
  3203. {
  3204. backgroundWorker.ReportProgress(0, "正在获取'会员充值' ...");
  3205. DataTable dt_MemberRecharge = avsbll.Vw_StaffPerformance_MemberCardRechargeRecord(strBuilder.ToString() + s.ToString()).Tables[0];
  3206. for (int t = 0; t < dt_MemberRecharge.Rows.Count; t++)
  3207. {
  3208. #region
  3209. DataGridViewRow dgvr = new DataGridViewRow();
  3210. DataGridViewCell cell = null;
  3211. //订单号
  3212. cell = new DataGridViewTextBoxCell();
  3213. cell.Value = dt_MemberRecharge.Rows[t]["充值编号"].ToString().Trim();
  3214. dgvr.Cells.Add(cell);
  3215. //员工
  3216. cell = new DataGridViewTextBoxCell();
  3217. cell.Value = dt_MemberRecharge.Rows[t]["接单人名称"].ToString().Trim();
  3218. dgvr.Cells.Add(cell);
  3219. //职务
  3220. cell = new DataGridViewTextBoxCell();
  3221. cell.Value = "会员接单人";
  3222. dgvr.Cells.Add(cell);
  3223. //客户姓名
  3224. cell = new DataGridViewTextBoxCell();
  3225. cell.Value = dt_MemberRecharge.Rows[t]["客户姓名"].ToString().Trim();
  3226. dgvr.Cells.Add(cell);
  3227. //收款金额
  3228. cell = new DataGridViewTextBoxCell();
  3229. cell.Value = Convert.ToDecimal(dt_MemberRecharge.Rows[t]["充值金额"]).ToString("N2").Trim();
  3230. dgvr.Cells.Add(cell);
  3231. //收款时间
  3232. cell = new DataGridViewTextBoxCell();
  3233. cell.Value = dt_MemberRecharge.Rows[t]["创建时间"].ToString().Trim();
  3234. dgvr.Cells.Add(cell);
  3235. //套系类别
  3236. cell = new DataGridViewTextBoxCell();
  3237. cell.Value = "/会员充值";
  3238. dgvr.Cells.Add(cell);
  3239. //套系名称
  3240. cell = new DataGridViewTextBoxCell();
  3241. cell.Value = dt_MemberRecharge.Rows[t]["充值名称"].ToString().Trim();
  3242. dgvr.Cells.Add(cell);
  3243. //应收金额
  3244. cell = new DataGridViewTextBoxCell();
  3245. cell.Value = Convert.ToDecimal(dt_MemberRecharge.Rows[t]["充值金额"]).ToString("N2").Trim();
  3246. dgvr.Cells.Add(cell);
  3247. //项目名称
  3248. cell = new DataGridViewTextBoxCell();
  3249. cell.Value = dt_MemberRecharge.Rows[t]["充值名称"].ToString().Trim();
  3250. dgvr.Cells.Add(cell);
  3251. //付款名称
  3252. cell = new DataGridViewTextBoxCell();
  3253. cell.Value = dt_MemberRecharge.Rows[t]["支付方式名称"].ToString().Trim();
  3254. dgvr.Cells.Add(cell);
  3255. //拍摄状态
  3256. cell = new DataGridViewTextBoxCell();
  3257. cell.Value = "";
  3258. dgvr.Cells.Add(cell);
  3259. //拍摄时间
  3260. cell = new DataGridViewTextBoxCell();
  3261. cell.Value = "";
  3262. dgvr.Cells.Add(cell);
  3263. //选片状态
  3264. cell = new DataGridViewTextBoxCell();
  3265. cell.Value = "";
  3266. dgvr.Cells.Add(cell);
  3267. //选片时间
  3268. cell = new DataGridViewTextBoxCell();
  3269. cell.Value = "";
  3270. dgvr.Cells.Add(cell);
  3271. //取件状态
  3272. cell = new DataGridViewTextBoxCell();
  3273. cell.Value = "";
  3274. dgvr.Cells.Add(cell);
  3275. //取件时间
  3276. cell = new DataGridViewTextBoxCell();
  3277. cell.Value = "";
  3278. dgvr.Cells.Add(cell);
  3279. //副订单
  3280. cell = new DataGridViewTextBoxCell();
  3281. cell.Value = "";
  3282. dgvr.Cells.Add(cell);
  3283. #endregion
  3284. this.Invoke(new UpdateControl(delegate()
  3285. {
  3286. this.dgv.Rows.Add(dgvr);
  3287. }));
  3288. }
  3289. }
  3290. }
  3291. }
  3292. #endregion
  3293. }
  3294. if (this.Str_ItemCategory.Trim() == "" || this.Str_ItemCategory.Trim() == "服务卡充值")
  3295. {
  3296. #region 获取服务卡充值
  3297. s = "";
  3298. strBuilder = new StringBuilder();
  3299. bool IsQuery = true;
  3300. if (string.IsNullOrEmpty(this.Str_ProcessStatus.Trim()))
  3301. {
  3302. strBuilder.Append("and 创建日期>='" + StartTime + "' and 创建日期<='" + EndTime + " 23:59:59.000' ");
  3303. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  3304. { strBuilder.Append("and 接单人编号 like '%" + EmployeeName + "%'"); }
  3305. s = BindSelect3(ref IsQuery);
  3306. }
  3307. else
  3308. { IsQuery = false; }
  3309. if (IsQuery)
  3310. {
  3311. DataTable dtCount = orbll.GetView_Custom("Vw_ErpMemberCardPayment", StrWhere: " 1 = 1 " + strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  3312. if (dtCount.Rows.Count > 0)
  3313. {
  3314. if (Convert.ToInt32(dtCount.Rows[0]["CountID"]) > 0)
  3315. {
  3316. backgroundWorker.ReportProgress(0, "正在获取'服务卡充值' ...");
  3317. DataTable dt_ServiceRecharge = avsbll.Vw_ErpMemberCardPayment(strBuilder.ToString() + s.ToString()).Tables[0];
  3318. for (int t = 0; t < dt_ServiceRecharge.Rows.Count; t++)
  3319. {
  3320. #region
  3321. DataGridViewRow dgvr = new DataGridViewRow();
  3322. DataGridViewCell cell = null;
  3323. //订单号
  3324. cell = new DataGridViewTextBoxCell();
  3325. cell.Value = dt_ServiceRecharge.Rows[t]["收款编号"].ToString().Trim();
  3326. dgvr.Cells.Add(cell);
  3327. //员工
  3328. cell = new DataGridViewTextBoxCell();
  3329. cell.Value = dt_ServiceRecharge.Rows[t]["接单人名称"].ToString().Trim();
  3330. dgvr.Cells.Add(cell);
  3331. //职务
  3332. cell = new DataGridViewTextBoxCell();
  3333. cell.Value = "服务卡接单人";
  3334. dgvr.Cells.Add(cell);
  3335. //客户姓名
  3336. cell = new DataGridViewTextBoxCell();
  3337. cell.Value = dt_ServiceRecharge.Rows[t]["客户姓名"].ToString().Trim();
  3338. dgvr.Cells.Add(cell);
  3339. //收款金额
  3340. cell = new DataGridViewTextBoxCell();
  3341. cell.Value = Convert.ToDecimal(dt_ServiceRecharge.Rows[t]["收款金额"]).ToString("N2").Trim();
  3342. dgvr.Cells.Add(cell);
  3343. //收款时间
  3344. cell = new DataGridViewTextBoxCell();
  3345. cell.Value = dt_ServiceRecharge.Rows[t]["创建日期"].ToString().Trim();
  3346. dgvr.Cells.Add(cell);
  3347. //套系类别
  3348. cell = new DataGridViewTextBoxCell();
  3349. cell.Value = "/服务卡充值";
  3350. dgvr.Cells.Add(cell);
  3351. //套系名称
  3352. cell = new DataGridViewTextBoxCell();
  3353. cell.Value = dt_ServiceRecharge.Rows[t]["服务套系类别名称"].ToString().Trim();
  3354. dgvr.Cells.Add(cell);
  3355. //应收金额
  3356. cell = new DataGridViewTextBoxCell();
  3357. cell.Value = Convert.ToDecimal(dt_ServiceRecharge.Rows[t]["收款金额"]).ToString("N2").Trim();
  3358. dgvr.Cells.Add(cell);
  3359. //项目名称
  3360. cell = new DataGridViewTextBoxCell();
  3361. cell.Value = dt_ServiceRecharge.Rows[t]["服务套系类别名称"].ToString().Trim();
  3362. dgvr.Cells.Add(cell);
  3363. //付款名称
  3364. cell = new DataGridViewTextBoxCell();
  3365. cell.Value = dt_ServiceRecharge.Rows[t]["支付方式名称"].ToString().Trim();
  3366. dgvr.Cells.Add(cell);
  3367. //拍摄状态
  3368. cell = new DataGridViewTextBoxCell();
  3369. cell.Value = "";
  3370. dgvr.Cells.Add(cell);
  3371. //拍摄时间
  3372. cell = new DataGridViewTextBoxCell();
  3373. cell.Value = "";
  3374. dgvr.Cells.Add(cell);
  3375. //选片状态
  3376. cell = new DataGridViewTextBoxCell();
  3377. cell.Value = "";
  3378. dgvr.Cells.Add(cell);
  3379. //选片时间
  3380. cell = new DataGridViewTextBoxCell();
  3381. cell.Value = "";
  3382. dgvr.Cells.Add(cell);
  3383. //取件状态
  3384. cell = new DataGridViewTextBoxCell();
  3385. cell.Value = "";
  3386. dgvr.Cells.Add(cell);
  3387. //取件时间
  3388. cell = new DataGridViewTextBoxCell();
  3389. cell.Value = "";
  3390. dgvr.Cells.Add(cell);
  3391. //副订单
  3392. cell = new DataGridViewTextBoxCell();
  3393. cell.Value = "";
  3394. dgvr.Cells.Add(cell);
  3395. #endregion
  3396. this.Invoke(new UpdateControl(delegate()
  3397. {
  3398. this.dgv.Rows.Add(dgvr);
  3399. }));
  3400. }
  3401. }
  3402. }
  3403. }
  3404. #endregion
  3405. }
  3406. if (this.Str_ItemCategory.Trim() == "" || this.Str_ItemCategory.Trim() == "计件提成")
  3407. {
  3408. #region 获取计件提成
  3409. s = "";
  3410. strBuilder = new StringBuilder();
  3411. bool IsQuery = true;
  3412. if (string.IsNullOrEmpty(this.Str_ProcessStatus.Trim()))
  3413. {
  3414. strBuilder.Append("and Pcr_Date >= '" + StartTime + "' and Pcr_Date <= '" + EndTime + " 23:59:59.000' ");
  3415. if (EmployeeName != null && !string.IsNullOrEmpty(EmployeeName))
  3416. { strBuilder.Append("and Pcr_DigitalDivision like '%" + EmployeeName + "%'"); }
  3417. s = BindSelect4(ref IsQuery);
  3418. }
  3419. else
  3420. { IsQuery = false; }
  3421. if (IsQuery)
  3422. {
  3423. DataTable dtCount = orbll.GetView_Custom("Vw_ErpPieceCommissionRecords", StrWhere: " 1 = 1 " + strBuilder.ToString() + s.ToString(), ShowColumnName: "Count(ID) CountID").Tables[0];
  3424. if (dtCount.Rows.Count > 0)
  3425. {
  3426. if (Convert.ToInt32(dtCount.Rows[0]["CountID"]) > 0)
  3427. {
  3428. backgroundWorker.ReportProgress(0, "正在获取'计件提成' ...");
  3429. DataTable dt_PieceCommission = pcrbll.Vw_ErpPieceCommissionRecords(strBuilder.ToString() + s.ToString()).Tables[0];
  3430. for (int t = 0; t < dt_PieceCommission.Rows.Count; t++)
  3431. {
  3432. #region
  3433. DataGridViewRow dgvr = new DataGridViewRow();
  3434. DataGridViewCell cell = null;
  3435. //订单号
  3436. cell = new DataGridViewTextBoxCell();
  3437. cell.Value = dt_PieceCommission.Rows[t]["Pcr_OrderNumber"].ToString().Trim();
  3438. dgvr.Cells.Add(cell);
  3439. //员工
  3440. cell = new DataGridViewTextBoxCell();
  3441. cell.Value = dt_PieceCommission.Rows[t]["Pcr_DigitalDivisionName"].ToString().Trim();
  3442. dgvr.Cells.Add(cell);
  3443. //职务
  3444. cell = new DataGridViewTextBoxCell();
  3445. cell.Value = "计件接单人";
  3446. dgvr.Cells.Add(cell);
  3447. //客户姓名
  3448. cell = new DataGridViewTextBoxCell();
  3449. cell.Value = dt_PieceCommission.Rows[t]["Cus_Name"].ToString().Trim();
  3450. dgvr.Cells.Add(cell);
  3451. //收款金额
  3452. cell = new DataGridViewTextBoxCell();
  3453. cell.Value = dt_PieceCommission.Rows[t]["总价格"].ToString() == "" ? "0" : Convert.ToDecimal(dt_PieceCommission.Rows[t]["总价格"]).ToString("N2");
  3454. dgvr.Cells.Add(cell);
  3455. //收款时间
  3456. cell = new DataGridViewTextBoxCell();
  3457. cell.Value = dt_PieceCommission.Rows[t]["Pcr_Date"].ToString().Trim();
  3458. dgvr.Cells.Add(cell);
  3459. //套系类别
  3460. cell = new DataGridViewTextBoxCell();
  3461. cell.Value = "/计件提成";
  3462. dgvr.Cells.Add(cell);
  3463. //套系名称
  3464. cell = new DataGridViewTextBoxCell();
  3465. cell.Value = dt_PieceCommission.Rows[t]["Pcr_CompletionContentsName"].ToString().Trim();
  3466. dgvr.Cells.Add(cell);
  3467. //应收金额
  3468. cell = new DataGridViewTextBoxCell();
  3469. cell.Value = dt_PieceCommission.Rows[t]["总价格"].ToString() == "" ? "0" : Convert.ToDecimal(dt_PieceCommission.Rows[t]["总价格"]).ToString("N2");
  3470. dgvr.Cells.Add(cell);
  3471. //项目名称
  3472. cell = new DataGridViewTextBoxCell();
  3473. cell.Value = dt_PieceCommission.Rows[t]["Pcr_CompletionContentsName"].ToString().Trim();
  3474. dgvr.Cells.Add(cell);
  3475. //付款名称
  3476. cell = new DataGridViewTextBoxCell();
  3477. cell.Value = "";
  3478. dgvr.Cells.Add(cell);
  3479. //拍摄状态
  3480. cell = new DataGridViewTextBoxCell();
  3481. cell.Value = "";
  3482. dgvr.Cells.Add(cell);
  3483. //拍摄时间
  3484. cell = new DataGridViewTextBoxCell();
  3485. cell.Value = "";
  3486. dgvr.Cells.Add(cell);
  3487. //选片状态
  3488. cell = new DataGridViewTextBoxCell();
  3489. cell.Value = "";
  3490. dgvr.Cells.Add(cell);
  3491. //选片时间
  3492. cell = new DataGridViewTextBoxCell();
  3493. cell.Value = "";
  3494. dgvr.Cells.Add(cell);
  3495. //取件状态
  3496. cell = new DataGridViewTextBoxCell();
  3497. cell.Value = "";
  3498. dgvr.Cells.Add(cell);
  3499. //取件时间
  3500. cell = new DataGridViewTextBoxCell();
  3501. cell.Value = "";
  3502. dgvr.Cells.Add(cell);
  3503. //副订单
  3504. cell = new DataGridViewTextBoxCell();
  3505. cell.Value = "";
  3506. dgvr.Cells.Add(cell);
  3507. //满意总分
  3508. cell = new DataGridViewTextBoxCell();
  3509. cell.Value = "";
  3510. dgvr.Cells.Add(cell);
  3511. //
  3512. cell = new DataGridViewTextBoxCell();
  3513. cell.Value = "";
  3514. dgvr.Cells.Add(cell);
  3515. //
  3516. cell = new DataGridViewTextBoxCell();
  3517. cell.Value = "";
  3518. dgvr.Cells.Add(cell);
  3519. //
  3520. cell = new DataGridViewTextBoxCell();
  3521. cell.Value = "";
  3522. dgvr.Cells.Add(cell);
  3523. //数量
  3524. cell = new DataGridViewTextBoxCell();
  3525. cell.Value = Convert.ToInt32(dt_PieceCommission.Rows[t]["Pcr_Quantity"]).ToString().Trim();
  3526. dgvr.Cells.Add(cell);
  3527. #endregion
  3528. this.Invoke(new UpdateControl(delegate()
  3529. {
  3530. this.dgv.Rows.Add(dgvr);
  3531. }));
  3532. }
  3533. }
  3534. }
  3535. }
  3536. #endregion
  3537. }
  3538. #endregion
  3539. #region 显示绘画(计算业绩)
  3540. backgroundWorker.ReportProgress(0, "正在计算业绩 ...");
  3541. string StrWhere1 = "";
  3542. string StrWhere2 = "";
  3543. string StrMainNumber = "";
  3544. string StrViceNumber = "";
  3545. this.Invoke(new UpdateControl(delegate()
  3546. {
  3547. for (int i = 0; i < this.dgv.Rows.Count; i++)
  3548. {
  3549. if (this.dgv.Rows[i].Cells["Column19"].Value != null)
  3550. {
  3551. if (this.dgv.Rows[i].Cells["Column19"].Value.ToString().Trim() != "1")
  3552. { StrMainNumber += "'" + this.dgv.Rows[i].Cells["Column1"].Value.ToString().Trim() + "',"; }
  3553. else
  3554. { StrViceNumber += "'" + this.dgv.Rows[i].Cells["Column21"].Value.ToString().Trim() + "',"; }
  3555. }
  3556. }
  3557. }));
  3558. if (!string.IsNullOrEmpty(StrMainNumber))
  3559. {
  3560. //StrWhere1 += "主订单 in (" + StrMainNumber.TrimEnd(',') + ")";
  3561. StrWhere1 += "Ordv_Number in (" + StrMainNumber.TrimEnd(',') + ")";
  3562. StrWhere2 += "Ordpg_Number in (" + StrMainNumber.TrimEnd(',') + ")";
  3563. }
  3564. if (!string.IsNullOrEmpty(StrViceNumber))
  3565. {
  3566. if (string.IsNullOrEmpty(StrMainNumber))
  3567. {
  3568. //StrWhere1 += "副订单 in (" + StrViceNumber.TrimEnd(',') + ")";
  3569. StrWhere1 += "Ordv_ViceNumber in (" + StrViceNumber.TrimEnd(',') + ")";
  3570. StrWhere2 += "Ordpg_ViceNumber in (" + StrViceNumber.TrimEnd(',') + ")";
  3571. }
  3572. else
  3573. {
  3574. //StrWhere1 += " Or 副订单 in (" + StrViceNumber.TrimEnd(',') + ")";
  3575. StrWhere1 += " Or Ordv_ViceNumber in (" + StrViceNumber.TrimEnd(',') + ")";
  3576. StrWhere2 += " Or Ordpg_ViceNumber in (" + StrViceNumber.TrimEnd(',') + ")";
  3577. }
  3578. }
  3579. DataTable dt_Level = new DataTable();
  3580. DataTable dt_Sights = new DataTable();
  3581. if (!string.IsNullOrEmpty(StrWhere1))
  3582. {
  3583. //dt_Level = orbll.GetView_Custom("Vw_StaffPerformance_Photograph", StrWhere: StrWhere1, ShowColumnName: "*").Tables[0];
  3584. dt_Level = LYFZ.BLL.BLL_ErpPaymentPayrollClass.GetPayrollLevel(StrWhere1);
  3585. }
  3586. if (!string.IsNullOrEmpty(StrWhere2))
  3587. { dt_Sights = orbll.GetView_Custom("tb_ErpOrdersPhotography", StrWhere: StrWhere2, ShowColumnName: "*").Tables[0]; }
  3588. this.Invoke(new UpdateControl(delegate()
  3589. {
  3590. if (this.dgv.Rows.Count > 0)
  3591. {
  3592. decimal CurrentPerformance = 0; //业绩
  3593. decimal PieceCommission = 0;
  3594. for (int i = 0; i < this.dgv.Rows.Count; i++)
  3595. {
  3596. #region 参数
  3597. string Ord_Number = this.dgv.Rows[i].Cells["Column1"].Value.ToString();
  3598. object DeputyOrd_Number = this.dgv.Rows[i].Cells["Column21"].Value;
  3599. object Ord_Type = this.dgv.Rows[i].Cells["Column19"].Value;
  3600. object Pay_Category = this.dgv.Rows[i].Cells["Column20"].Value;
  3601. object Project_Name = this.dgv.Rows[i].Cells["Column8"].Value;
  3602. object Post = this.dgv.Rows[i].Cells["Column17"].Value;
  3603. decimal Pay_AmountOf = Convert.ToDecimal(this.dgv.Rows[i].Cells["Column3"].Value);
  3604. //摄影师
  3605. string OrdPg_Photographer = "";
  3606. string OrdPg_PhotographyAssistant = "";
  3607. //等级
  3608. string OrdPg_SightsLevel = "";
  3609. //化妆
  3610. string OrdPg_MakeupArtist = "";
  3611. string OrdPg_MakeupAssistant = "";
  3612. //引导
  3613. string Ordpg_BootDivision = "";
  3614. string Ordpg_BootDivisionAssistant = "";
  3615. #endregion
  3616. #region 绘画前期业绩(摄影,化妆)
  3617. if (Ord_Type != null)
  3618. {
  3619. if (Pay_Category.ToString() == "预约收款" || Pay_Category.ToString() == "全款" || Pay_Category.ToString() == "预约补款" || Project_Name.ToString() == "选片二销")
  3620. {
  3621. if (Ord_Type.ToString() != "")
  3622. {
  3623. #region 获取等级级别个数
  3624. //以下为滕工版
  3625. string StrWhere = "";
  3626. //if (Ord_Type.ToString() != "1")
  3627. //{ StrWhere = " 主订单='" + Ord_Number + "'"; }
  3628. //else
  3629. //{ StrWhere = " 副订单='" + DeputyOrd_Number + "'"; }
  3630. if (Ord_Type.ToString() != "1")
  3631. { StrWhere = " Ordv_Number='" + Ord_Number + "'"; }
  3632. else
  3633. { StrWhere = " Ordv_ViceNumber='" + DeputyOrd_Number + "'"; }
  3634. DataRow[] dtRows = dt_Level.Select(StrWhere);
  3635. if (dtRows.Length > 0)
  3636. {
  3637. OneLevelCount = Convert.ToInt32(dtRows[0]["景点一级个数"]);
  3638. TwoLevelCount = Convert.ToInt32(dtRows[0]["景点二级个数"]);
  3639. ThreeLevelCount = Convert.ToInt32(dtRows[0]["景点三级个数"]);
  3640. OrdPg_Photographer = dtRows[0]["主摄影师ID"].ToString();
  3641. OrdPg_PhotographyAssistant = dtRows[0]["摄影助理ID"].ToString();
  3642. OrdPg_MakeupArtist = dtRows[0]["主化妆ID"].ToString();
  3643. OrdPg_MakeupAssistant = dtRows[0]["化妆助理ID"].ToString();
  3644. Ordpg_BootDivision = dtRows[0]["引导师ID"].ToString();
  3645. Ordpg_BootDivisionAssistant = dtRows[0]["引导助理ID"].ToString();
  3646. }
  3647. #region 摄影工资
  3648. if (Post.ToString() == "主摄影师" || Post.ToString() == "摄影助理" || Post.ToString() == "主摄影选片二销" || Post.ToString() == "摄影助理选片二销")
  3649. {
  3650. //修改前 if ((OneLevelCount >= 1 && TwoLevelCount == 0 && ThreeLevelCount == 0) || (OneLevelCount == 0 && TwoLevelCount >= 1 && ThreeLevelCount == 0) || (OneLevelCount == 0 && TwoLevelCount == 0 && ThreeLevelCount >= 1))
  3651. //刘工修改
  3652. if ((OneLevelCount + TwoLevelCount + ThreeLevelCount) == 1)
  3653. {
  3654. #region 1.如果所以景点阶段都相同
  3655. decimal Amount = 0;
  3656. if (Post.ToString() == "主摄影师" || Post.ToString() == "主摄影选片二销")
  3657. {
  3658. OrdPg_Photographer = OrdPg_Photographer.TrimEnd(',');
  3659. string[] OrdPg_Photographer_O = OrdPg_Photographer.Split(',');
  3660. for (int t = 0; t < OrdPg_Photographer_O.Length; t++)
  3661. {
  3662. if (OrdPg_Photographer_O[t] == EmployeeName)
  3663. {
  3664. if (!string.IsNullOrEmpty(OrdPg_Photographer.ToString().TrimEnd(',')) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant.ToString().TrimEnd(',')))
  3665. { Amount += (Pay_AmountOf * (MainPhotography / 100)) / OrdPg_Photographer_O.Length; }
  3666. else
  3667. { Amount += Pay_AmountOf / OrdPg_Photographer_O.Length; }
  3668. }
  3669. }
  3670. }
  3671. if (Post.ToString() == "摄影助理" || Post.ToString() == "摄影助理选片二销")
  3672. {
  3673. OrdPg_PhotographyAssistant = OrdPg_PhotographyAssistant.TrimEnd(',');
  3674. string[] OrdPg_PhotographyAssistant_O = OrdPg_PhotographyAssistant.Split(',');
  3675. for (int t = 0; t < OrdPg_PhotographyAssistant_O.Length; t++)
  3676. {
  3677. if (OrdPg_PhotographyAssistant_O[t] == EmployeeName)
  3678. {
  3679. if (!string.IsNullOrEmpty(OrdPg_Photographer.ToString().TrimEnd(',')) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant.ToString().TrimEnd(',')))
  3680. { Amount += (Pay_AmountOf * (DeputyPhotography / 100)) / OrdPg_PhotographyAssistant_O.Length; }
  3681. else
  3682. { Amount += Pay_AmountOf / OrdPg_PhotographyAssistant_O.Length; }
  3683. }
  3684. }
  3685. }
  3686. this.dgv.Rows[i].Cells["Column3"].Value = Convert.ToDecimal(Amount).ToString("N2");
  3687. #endregion
  3688. }
  3689. else
  3690. {
  3691. #region 2.如果等级不相同
  3692. decimal Amount = 0;
  3693. decimal Amount_A = 0;
  3694. decimal Onej = 0;//一级景点工资
  3695. decimal Twoj = 0; //二级景点工资
  3696. decimal Threej = 0; //三级景点工资
  3697. //获取景点等级总百分比
  3698. decimal AttractionsPercentage = (OneLevelCount * OneLevel) + (TwoLevelCount * TwoLevel) + (ThreeLevelCount * ThreeLevel);
  3699. if (AttractionsPercentage != 0)
  3700. {
  3701. Onej = Pay_AmountOf / AttractionsPercentage * OneLevel;
  3702. Twoj = Pay_AmountOf / AttractionsPercentage * TwoLevel;
  3703. Threej = Pay_AmountOf / AttractionsPercentage * ThreeLevel;
  3704. }
  3705. if (!string.IsNullOrEmpty(OrdPg_Photographer.ToString().TrimEnd(',')))
  3706. {
  3707. #region 主等于副
  3708. if (OrdPg_Photographer.ToString().TrimEnd(',') == OrdPg_PhotographyAssistant.ToString().TrimEnd(','))
  3709. {
  3710. if (Post.ToString() == "主摄影师" || Post.ToString() == "主摄影选片二销")
  3711. { Amount = (Pay_AmountOf * (MainPhotography / 100)); }
  3712. if (Post.ToString() == "摄影助理" || Post.ToString() == "摄影助理选片二销")
  3713. { Amount = (Pay_AmountOf * (DeputyPhotography / 100)); }
  3714. }
  3715. #endregion
  3716. #region 副为空
  3717. if (string.IsNullOrEmpty(OrdPg_PhotographyAssistant.ToString().TrimEnd(',')))
  3718. {
  3719. //按照景点等级比重
  3720. if (Post.ToString() == "主摄影师" || Post.ToString() == "主摄影选片二销")
  3721. {
  3722. //获取摄影人员
  3723. DataRow[] dtRow = null;
  3724. if (Ord_Type.ToString() != "1")
  3725. { dtRow = dt_Sights.Select("Ordpg_Number='" + Ord_Number + "' and Ordpg_Photographer = '" + EmployeeName + "'"); }
  3726. else
  3727. { dtRow = dt_Sights.Select("Ordpg_ViceNumber='" + DeputyOrd_Number + "' and Ordpg_Photographer = '" + EmployeeName + "'"); }
  3728. if (dtRow != null)
  3729. {
  3730. for (int y = 0; y < dtRow.Length; y++)
  3731. {
  3732. OrdPg_SightsLevel = dtRow[y]["OrdPg_SightsLevel"].ToString();
  3733. //一级
  3734. if (OrdPg_SightsLevel == "BEBBBCADDEBFJDFFC")
  3735. { Amount += Onej; }
  3736. //二级
  3737. if (OrdPg_SightsLevel == "BEBBBCADEGBGAFFJC")
  3738. { Amount += Twoj; }
  3739. //三级
  3740. if (OrdPg_SightsLevel == "BEBBBCADAFBHBCHCI")
  3741. { Amount += Threej; }
  3742. }
  3743. }
  3744. }
  3745. }
  3746. #endregion
  3747. #region 主副不为空并且不相等
  3748. if ((!string.IsNullOrEmpty(OrdPg_Photographer.ToString().TrimEnd(',')) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant.ToString().TrimEnd(','))) && OrdPg_Photographer.ToString().TrimEnd(',') != OrdPg_PhotographyAssistant.ToString().TrimEnd(','))
  3749. {
  3750. #region 主
  3751. if (Post.ToString() == "主摄影师" || Post.ToString() == "主摄影选片二销")
  3752. {
  3753. //获取摄影人员
  3754. DataRow[] dtRow = null;
  3755. if (Ord_Type.ToString() != "1")
  3756. { dtRow = dt_Sights.Select("Ordpg_Number='" + Ord_Number + "' and Ordpg_Photographer = '" + EmployeeName + "'"); }
  3757. else
  3758. { dtRow = dt_Sights.Select("Ordpg_ViceNumber='" + DeputyOrd_Number + "' and Ordpg_Photographer = '" + EmployeeName + "'"); }
  3759. if (dtRow != null)
  3760. {
  3761. Amount_A = Pay_AmountOf * (MainPhotography / 100);
  3762. for (int y = 0; y < dtRow.Length; y++)
  3763. {
  3764. OrdPg_SightsLevel = dtRow[y]["OrdPg_SightsLevel"].ToString();
  3765. if (AttractionsPercentage != 0)
  3766. {
  3767. //一级
  3768. if (OrdPg_SightsLevel == "BEBBBCADDEBFJDFFC")
  3769. { Amount += Amount_A / AttractionsPercentage * OneLevel; }
  3770. //二级
  3771. if (OrdPg_SightsLevel == "BEBBBCADEGBGAFFJC")
  3772. { Amount += Amount_A / AttractionsPercentage * TwoLevel; }
  3773. //三级
  3774. if (OrdPg_SightsLevel == "BEBBBCADAFBHBCHCI")
  3775. { Amount += Amount_A / AttractionsPercentage * ThreeLevel; }
  3776. }
  3777. }
  3778. }
  3779. }
  3780. #endregion
  3781. #region 副
  3782. if (Post.ToString() == "摄影助理" || Post.ToString() == "摄影助理选片二销")
  3783. {
  3784. //获取摄影人员
  3785. DataRow[] dtRow = null;
  3786. if (Ord_Type.ToString() != "1")
  3787. { dtRow = dt_Sights.Select("Ordpg_Number='" + Ord_Number + "' and Ordpg_PhotographyAssistant = '" + EmployeeName + "'"); }
  3788. else
  3789. { dtRow = dt_Sights.Select("Ordpg_ViceNumber='" + DeputyOrd_Number + "' and Ordpg_PhotographyAssistant = '" + EmployeeName + "'"); }
  3790. if (dtRow != null)
  3791. {
  3792. Amount_A = Pay_AmountOf * (DeputyPhotography / 100);
  3793. for (int y = 0; y < dtRow.Length; y++)
  3794. {
  3795. OrdPg_SightsLevel = dtRow[y]["OrdPg_SightsLevel"].ToString();
  3796. if (AttractionsPercentage != 0)
  3797. {
  3798. //一级
  3799. if (OrdPg_SightsLevel == "BEBBBCADDEBFJDFFC")
  3800. { Amount += Amount_A / AttractionsPercentage * OneLevel; }
  3801. //二级
  3802. if (OrdPg_SightsLevel == "BEBBBCADEGBGAFFJC")
  3803. { Amount += Amount_A / AttractionsPercentage * TwoLevel; }
  3804. //三级
  3805. if (OrdPg_SightsLevel == "BEBBBCADAFBHBCHCI")
  3806. { Amount += Amount_A / AttractionsPercentage * ThreeLevel; }
  3807. }
  3808. }
  3809. }
  3810. }
  3811. #endregion
  3812. }
  3813. #endregion
  3814. }
  3815. this.dgv.Rows[i].Cells["Column3"].Value = Convert.ToDecimal(Amount).ToString("N2");
  3816. #endregion
  3817. }
  3818. }
  3819. #endregion
  3820. #region 化妆工资
  3821. if (Post.ToString() == "主化妆师" || Post.ToString() == "化妆助理" || Post.ToString() == "主化妆选片二销" || Post.ToString() == "化妆助理选片二销")
  3822. {
  3823. //修改前 if ((OneLevelCount >= 1 && TwoLevelCount == 0 && ThreeLevelCount == 0) || (OneLevelCount == 0 && TwoLevelCount >= 1 && ThreeLevelCount == 0) || (OneLevelCount == 0 && TwoLevelCount == 0 && ThreeLevelCount >= 1))
  3824. //刘工修改
  3825. if ((OneLevelCount + TwoLevelCount + ThreeLevelCount) == 1)
  3826. {
  3827. #region 1.如果所以景点阶段都相同
  3828. decimal Amount = 0;
  3829. if (Post.ToString() == "主化妆师" || Post.ToString() == "主化妆选片二销")
  3830. {
  3831. OrdPg_MakeupArtist = OrdPg_MakeupArtist.TrimEnd(',');
  3832. string[] OrdPg_MakeupArtist_O = OrdPg_MakeupArtist.Split(',');
  3833. for (int t = 0; t < OrdPg_MakeupArtist_O.Length; t++)
  3834. {
  3835. if (OrdPg_MakeupArtist_O[t] == EmployeeName)
  3836. {
  3837. if (!string.IsNullOrEmpty(OrdPg_MakeupArtist.ToString().TrimEnd(',')) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant.ToString().TrimEnd(',')))
  3838. { Amount += (Pay_AmountOf * (MainMake / 100)) / OrdPg_MakeupArtist_O.Length; }
  3839. else
  3840. { Amount += Pay_AmountOf / OrdPg_MakeupArtist_O.Length; }
  3841. }
  3842. }
  3843. }
  3844. if (Post.ToString() == "化妆助理" || Post.ToString() == "化妆助理选片二销")
  3845. {
  3846. OrdPg_MakeupAssistant = OrdPg_MakeupAssistant.TrimEnd(',');
  3847. string[] OrdPg_MakeupAssistant_O = OrdPg_MakeupAssistant.Split(',');
  3848. for (int t = 0; t < OrdPg_MakeupAssistant_O.Length; t++)
  3849. {
  3850. if (OrdPg_MakeupAssistant_O[t] == EmployeeName)
  3851. {
  3852. if (!string.IsNullOrEmpty(OrdPg_MakeupArtist.ToString().TrimEnd(',')) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant.ToString().TrimEnd(',')))
  3853. { Amount += (Pay_AmountOf * (DeputyMake / 100)) / OrdPg_MakeupAssistant_O.Length; }
  3854. else
  3855. { Amount += Pay_AmountOf / OrdPg_MakeupAssistant_O.Length; }
  3856. }
  3857. }
  3858. }
  3859. this.dgv.Rows[i].Cells["Column3"].Value = Convert.ToDecimal(Amount).ToString("N2");
  3860. #endregion
  3861. }
  3862. else
  3863. {
  3864. #region 2.如果等级不相同
  3865. decimal Amount = 0;
  3866. decimal Amount_A = 0;
  3867. decimal Onej = 0;//一级景点工资
  3868. decimal Twoj = 0; //二级景点工资
  3869. decimal Threej = 0; //三级景点工资
  3870. //获取景点等级总百分比
  3871. decimal AttractionsPercentage = (OneLevelCount * OneLevel) + (TwoLevelCount * TwoLevel) + (ThreeLevelCount * ThreeLevel);
  3872. if (AttractionsPercentage != 0)
  3873. {
  3874. Onej = Pay_AmountOf / AttractionsPercentage * OneLevel;
  3875. Twoj = Pay_AmountOf / AttractionsPercentage * TwoLevel;
  3876. Threej = Pay_AmountOf / AttractionsPercentage * ThreeLevel;
  3877. }
  3878. if (!string.IsNullOrEmpty(OrdPg_MakeupArtist.ToString().TrimEnd(',')))
  3879. {
  3880. #region 主等于副
  3881. if (OrdPg_MakeupArtist.ToString().TrimEnd(',') == OrdPg_MakeupAssistant.ToString().TrimEnd(','))
  3882. {
  3883. if (Post.ToString() == "主化妆师" || Post.ToString() == "主化妆选片二销")
  3884. { Amount = (Pay_AmountOf * (MainMake / 100)); }
  3885. if (Post.ToString() == "化妆助理" || Post.ToString() == "化妆助理选片二销")
  3886. { Amount = (Pay_AmountOf * (DeputyMake / 100)); }
  3887. }
  3888. #endregion
  3889. #region 副为空
  3890. if (string.IsNullOrEmpty(OrdPg_MakeupAssistant.ToString().TrimEnd(',')))
  3891. {
  3892. //按照景点等级比重
  3893. if (Post.ToString() == "主化妆师" || Post.ToString() == "主化妆选片二销")
  3894. {
  3895. //获取化妆人员
  3896. DataRow[] dtRow = null;
  3897. if (Ord_Type.ToString() != "1")
  3898. { dtRow = dt_Sights.Select("Ordpg_Number='" + Ord_Number + "' and Ordpg_MakeupArtist = '" + EmployeeName + "'"); }
  3899. else
  3900. { dtRow = dt_Sights.Select("Ordpg_ViceNumber='" + DeputyOrd_Number + "' and Ordpg_MakeupArtist = '" + EmployeeName + "'"); }
  3901. if (dtRow != null)
  3902. {
  3903. for (int y = 0; y < dtRow.Length; y++)
  3904. {
  3905. OrdPg_SightsLevel = dtRow[y]["OrdPg_SightsLevel"].ToString();
  3906. //一级
  3907. if (OrdPg_SightsLevel == "BEBBBCADDEBFJDFFC")
  3908. { Amount += Onej; }
  3909. //二级
  3910. if (OrdPg_SightsLevel == "BEBBBCADEGBGAFFJC")
  3911. { Amount += Twoj; }
  3912. //三级
  3913. if (OrdPg_SightsLevel == "BEBBBCADAFBHBCHCI")
  3914. { Amount += Threej; }
  3915. }
  3916. }
  3917. }
  3918. }
  3919. #endregion
  3920. #region 主副不为空并且不相等
  3921. if ((!string.IsNullOrEmpty(OrdPg_MakeupArtist.ToString().TrimEnd(',')) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant.ToString().TrimEnd(','))) && OrdPg_MakeupArtist.ToString().TrimEnd(',') != OrdPg_MakeupAssistant.ToString().TrimEnd(','))
  3922. {
  3923. #region 主
  3924. if (Post.ToString() == "主化妆师" || Post.ToString() == "主化妆选片二销")
  3925. {
  3926. //获取摄影人员
  3927. DataRow[] dtRow = null;
  3928. if (Ord_Type.ToString() != "1")
  3929. { dtRow = dt_Sights.Select("Ordpg_Number='" + Ord_Number + "' and Ordpg_MakeupArtist = '" + EmployeeName + "'"); }
  3930. else
  3931. { dtRow = dt_Sights.Select("Ordpg_ViceNumber='" + DeputyOrd_Number + "' and Ordpg_MakeupArtist = '" + EmployeeName + "'"); }
  3932. if (dtRow != null)
  3933. {
  3934. Amount_A = Pay_AmountOf * (MainMake / 100);
  3935. for (int y = 0; y < dtRow.Length; y++)
  3936. {
  3937. OrdPg_SightsLevel = dtRow[y]["OrdPg_SightsLevel"].ToString();
  3938. if (AttractionsPercentage != 0)
  3939. {
  3940. //一级
  3941. if (OrdPg_SightsLevel == "BEBBBCADDEBFJDFFC")
  3942. { Amount += Amount_A / AttractionsPercentage * OneLevel; }
  3943. //二级
  3944. if (OrdPg_SightsLevel == "BEBBBCADEGBGAFFJC")
  3945. { Amount += Amount_A / AttractionsPercentage * TwoLevel; }
  3946. //三级
  3947. if (OrdPg_SightsLevel == "BEBBBCADAFBHBCHCI")
  3948. { Amount += Amount_A / AttractionsPercentage * ThreeLevel; }
  3949. }
  3950. }
  3951. }
  3952. }
  3953. #endregion
  3954. #region 副
  3955. if (Post.ToString() == "化妆助理" || Post.ToString() == "化妆助理选片二销")
  3956. {
  3957. //获取摄影人员
  3958. DataRow[] dtRow = null;
  3959. if (Ord_Type.ToString() != "1")
  3960. { dtRow = dt_Sights.Select("Ordpg_Number='" + Ord_Number + "' and Ordpg_MakeupAssistant = '" + EmployeeName + "'"); }
  3961. else
  3962. { dtRow = dt_Sights.Select("Ordpg_ViceNumber='" + DeputyOrd_Number + "' and Ordpg_MakeupAssistant = '" + EmployeeName + "'"); }
  3963. if (dtRow != null)
  3964. {
  3965. Amount_A = Pay_AmountOf * (DeputyMake / 100);
  3966. for (int y = 0; y < dtRow.Length; y++)
  3967. {
  3968. OrdPg_SightsLevel = dtRow[y]["OrdPg_SightsLevel"].ToString();
  3969. if (AttractionsPercentage != 0)
  3970. {
  3971. //一级
  3972. if (OrdPg_SightsLevel == "BEBBBCADDEBFJDFFC")
  3973. { Amount += Amount_A / AttractionsPercentage * OneLevel; }
  3974. //二级
  3975. if (OrdPg_SightsLevel == "BEBBBCADEGBGAFFJC")
  3976. { Amount += Amount_A / AttractionsPercentage * TwoLevel; }
  3977. //三级
  3978. if (OrdPg_SightsLevel == "BEBBBCADAFBHBCHCI")
  3979. { Amount += Amount_A / AttractionsPercentage * ThreeLevel; }
  3980. }
  3981. }
  3982. }
  3983. }
  3984. #endregion
  3985. }
  3986. #endregion
  3987. }
  3988. this.dgv.Rows[i].Cells["Column3"].Value = Convert.ToDecimal(Amount).ToString("N2");
  3989. #endregion
  3990. }
  3991. }
  3992. #endregion
  3993. #region 引导工资
  3994. if (Post.ToString() == "引导师" || Post.ToString() == "引导助理" || Post.ToString() == "引导选片二销" || Post.ToString() == "引导助理选片二销")
  3995. {
  3996. //修改前 if ((OneLevelCount >= 1 && TwoLevelCount == 0 && ThreeLevelCount == 0) || (OneLevelCount == 0 && TwoLevelCount >= 1 && ThreeLevelCount == 0) || (OneLevelCount == 0 && TwoLevelCount == 0 && ThreeLevelCount >= 1))
  3997. //刘工修改
  3998. if ((OneLevelCount + TwoLevelCount + ThreeLevelCount) == 1)
  3999. {
  4000. #region 1.如果所以景点阶段都相同
  4001. decimal Amount = 0;
  4002. if (Post.ToString() == "引导师" || Post.ToString() == "引导选片二销")
  4003. {
  4004. Ordpg_BootDivision = Ordpg_BootDivision.TrimEnd(',');
  4005. string[] OrdPg_MakeupArtist_O = Ordpg_BootDivision.Split(',');
  4006. for (int t = 0; t < OrdPg_MakeupArtist_O.Length; t++)
  4007. {
  4008. if (OrdPg_MakeupArtist_O[t] == EmployeeName)
  4009. {
  4010. if (!string.IsNullOrEmpty(Ordpg_BootDivision.ToString().TrimEnd(',')) && !string.IsNullOrEmpty(Ordpg_BootDivisionAssistant.ToString().TrimEnd(',')))
  4011. { Amount += (Pay_AmountOf * (MainBootDivision / 100)) / OrdPg_MakeupArtist_O.Length; }
  4012. else
  4013. { Amount += Pay_AmountOf / OrdPg_MakeupArtist_O.Length; }
  4014. }
  4015. }
  4016. }
  4017. if (Post.ToString() == "引导助理" || Post.ToString() == "引导助理选片二销")
  4018. {
  4019. Ordpg_BootDivisionAssistant = Ordpg_BootDivisionAssistant.TrimEnd(',');
  4020. string[] OrdPg_MakeupAssistant_O = Ordpg_BootDivisionAssistant.Split(',');
  4021. for (int t = 0; t < OrdPg_MakeupAssistant_O.Length; t++)
  4022. {
  4023. if (OrdPg_MakeupAssistant_O[t] == EmployeeName)
  4024. {
  4025. if (!string.IsNullOrEmpty(Ordpg_BootDivision.ToString().TrimEnd(',')) && !string.IsNullOrEmpty(Ordpg_BootDivisionAssistant.ToString().TrimEnd(',')))
  4026. { Amount += (Pay_AmountOf * (DeputyBootDivision / 100)) / OrdPg_MakeupAssistant_O.Length; }
  4027. else
  4028. { Amount += Pay_AmountOf / OrdPg_MakeupAssistant_O.Length; }
  4029. }
  4030. }
  4031. }
  4032. this.dgv.Rows[i].Cells["Column3"].Value = Convert.ToDecimal(Amount).ToString("N2");
  4033. #endregion
  4034. }
  4035. else
  4036. {
  4037. #region 2.如果等级不相同
  4038. decimal Amount = 0;
  4039. decimal Amount_A = 0;
  4040. decimal Onej = 0;//一级景点工资
  4041. decimal Twoj = 0; //二级景点工资
  4042. decimal Threej = 0; //三级景点工资
  4043. //获取景点等级总百分比
  4044. decimal AttractionsPercentage = (OneLevelCount * OneLevel) + (TwoLevelCount * TwoLevel) + (ThreeLevelCount * ThreeLevel);
  4045. if (AttractionsPercentage != 0)
  4046. {
  4047. Onej = Pay_AmountOf / AttractionsPercentage * OneLevel;
  4048. Twoj = Pay_AmountOf / AttractionsPercentage * TwoLevel;
  4049. Threej = Pay_AmountOf / AttractionsPercentage * ThreeLevel;
  4050. }
  4051. if (!string.IsNullOrEmpty(Ordpg_BootDivision.ToString().TrimEnd(',')))
  4052. {
  4053. #region 主等于副
  4054. if (Ordpg_BootDivision.ToString().TrimEnd(',') == Ordpg_BootDivisionAssistant.ToString().TrimEnd(','))
  4055. {
  4056. if (Post.ToString() == "引导师" || Post.ToString() == "引导选片二销")
  4057. { Amount = (Pay_AmountOf * (MainBootDivision / 100)); }
  4058. if (Post.ToString() == "引导助理" || Post.ToString() == "引导助理选片二销")
  4059. { Amount = (Pay_AmountOf * (DeputyBootDivision / 100)); }
  4060. }
  4061. #endregion
  4062. #region 副为空
  4063. if (string.IsNullOrEmpty(Ordpg_BootDivisionAssistant.ToString().TrimEnd(',')))
  4064. {
  4065. //按照景点等级比重
  4066. if (Post.ToString() == "引导师" || Post.ToString() == "引导选片二销")
  4067. {
  4068. //获取化妆人员
  4069. DataRow[] dtRow = null;
  4070. if (Ord_Type.ToString() != "1")
  4071. { dtRow = dt_Sights.Select("Ordpg_Number='" + Ord_Number + "' and Ordpg_BootDivision = '" + EmployeeName + "'"); }
  4072. else
  4073. { dtRow = dt_Sights.Select("Ordpg_ViceNumber='" + DeputyOrd_Number + "' and Ordpg_BootDivision = '" + EmployeeName + "'"); }
  4074. if (dtRow != null)
  4075. {
  4076. for (int y = 0; y < dtRow.Length; y++)
  4077. {
  4078. OrdPg_SightsLevel = dtRow[y]["OrdPg_SightsLevel"].ToString();
  4079. //一级
  4080. if (OrdPg_SightsLevel == "BEBBBCADDEBFJDFFC")
  4081. { Amount += Onej; }
  4082. //二级
  4083. if (OrdPg_SightsLevel == "BEBBBCADEGBGAFFJC")
  4084. { Amount += Twoj; }
  4085. //三级
  4086. if (OrdPg_SightsLevel == "BEBBBCADAFBHBCHCI")
  4087. { Amount += Threej; }
  4088. }
  4089. }
  4090. }
  4091. }
  4092. #endregion
  4093. #region 主副不为空并且不相等
  4094. if ((!string.IsNullOrEmpty(Ordpg_BootDivision.ToString().TrimEnd(',')) && !string.IsNullOrEmpty(Ordpg_BootDivisionAssistant.ToString().TrimEnd(','))) && Ordpg_BootDivision.ToString().TrimEnd(',') != Ordpg_BootDivisionAssistant.ToString().TrimEnd(','))
  4095. {
  4096. #region 主
  4097. if (Post.ToString() == "引导师" || Post.ToString() == "引导选片二销")
  4098. {
  4099. //获取摄影人员
  4100. DataRow[] dtRow = null;
  4101. if (Ord_Type.ToString() != "1")
  4102. { dtRow = dt_Sights.Select("Ordpg_Number='" + Ord_Number + "' and Ordpg_BootDivision = '" + EmployeeName + "'"); }
  4103. else
  4104. { dtRow = dt_Sights.Select("Ordpg_ViceNumber='" + DeputyOrd_Number + "' and Ordpg_BootDivision = '" + EmployeeName + "'"); }
  4105. if (dtRow != null)
  4106. {
  4107. Amount_A = Pay_AmountOf * (MainBootDivision / 100);
  4108. for (int y = 0; y < dtRow.Length; y++)
  4109. {
  4110. OrdPg_SightsLevel = dtRow[y]["OrdPg_SightsLevel"].ToString();
  4111. if (AttractionsPercentage != 0)
  4112. {
  4113. //一级
  4114. if (OrdPg_SightsLevel == "BEBBBCADDEBFJDFFC")
  4115. { Amount += Amount_A / AttractionsPercentage * OneLevel; }
  4116. //二级
  4117. if (OrdPg_SightsLevel == "BEBBBCADEGBGAFFJC")
  4118. { Amount += Amount_A / AttractionsPercentage * TwoLevel; }
  4119. //三级
  4120. if (OrdPg_SightsLevel == "BEBBBCADAFBHBCHCI")
  4121. { Amount += Amount_A / AttractionsPercentage * ThreeLevel; }
  4122. }
  4123. }
  4124. }
  4125. }
  4126. #endregion
  4127. #region 副
  4128. if (Post.ToString() == "引导助理" || Post.ToString() == "引导助理选片二销")
  4129. {
  4130. //获取摄影人员
  4131. DataRow[] dtRow = null;
  4132. if (Ord_Type.ToString() != "1")
  4133. { dtRow = dt_Sights.Select("Ordpg_Number='" + Ord_Number + "' and Ordpg_BootDivisionAssistant = '" + EmployeeName + "'"); }
  4134. else
  4135. { dtRow = dt_Sights.Select("Ordpg_ViceNumber='" + DeputyOrd_Number + "' and Ordpg_BootDivisionAssistant = '" + EmployeeName + "'"); }
  4136. if (dtRow != null)
  4137. {
  4138. Amount_A = Pay_AmountOf * (DeputyBootDivision / 100);
  4139. for (int y = 0; y < dtRow.Length; y++)
  4140. {
  4141. OrdPg_SightsLevel = dtRow[y]["OrdPg_SightsLevel"].ToString();
  4142. if (AttractionsPercentage != 0)
  4143. {
  4144. //一级
  4145. if (OrdPg_SightsLevel == "BEBBBCADDEBFJDFFC")
  4146. { Amount += Amount_A / AttractionsPercentage * OneLevel; }
  4147. //二级
  4148. if (OrdPg_SightsLevel == "BEBBBCADEGBGAFFJC")
  4149. { Amount += Amount_A / AttractionsPercentage * TwoLevel; }
  4150. //三级
  4151. if (OrdPg_SightsLevel == "BEBBBCADAFBHBCHCI")
  4152. { Amount += Amount_A / AttractionsPercentage * ThreeLevel; }
  4153. }
  4154. }
  4155. }
  4156. }
  4157. #endregion
  4158. }
  4159. #endregion
  4160. }
  4161. this.dgv.Rows[i].Cells["Column3"].Value = Convert.ToDecimal(Amount).ToString("N2");
  4162. #endregion
  4163. }
  4164. }
  4165. #endregion
  4166. #endregion
  4167. }
  4168. }
  4169. }
  4170. #endregion
  4171. #region 计件提成
  4172. object ItemName = this.dgv.Rows[i].Cells["Column5"].Value;
  4173. if (ItemName != null)
  4174. {
  4175. if (ItemName.ToString().Trim() == "/计件提成")
  4176. { PieceCommission += Convert.ToDecimal(this.dgv.Rows[i].Cells["Column3"].Value); }
  4177. else
  4178. { CurrentPerformance += Convert.ToDecimal(this.dgv.Rows[i].Cells["Column3"].Value); }
  4179. }
  4180. #endregion
  4181. }
  4182. //当前业绩
  4183. Sum = Convert.ToDecimal(CurrentPerformance);
  4184. // 计件提成
  4185. this.txtPieceCommission.Text = Convert.ToDecimal(PieceCommission).ToString("N2");
  4186. }
  4187. else
  4188. {
  4189. this.txtCurrentPerformance.Text = "0.00";
  4190. this.txtPieceCommission.Text = "0.00";
  4191. }
  4192. }));
  4193. #endregion
  4194. return Sum;
  4195. }
  4196. /// <summary>
  4197. /// 绑定业绩列表查询方法1(全部收款记录)
  4198. /// </summary>
  4199. /// <param name="IsQuery"></param>
  4200. /// <returns></returns>
  4201. public string BindSelect1(ref bool IsQuery)
  4202. {
  4203. StringBuilder str = new StringBuilder();
  4204. if (!string.IsNullOrEmpty(Str_CustomerSource.Trim()) && Str_CustomerSourceTag != null)
  4205. { str.Append(" and 客户来源='" + Str_CustomerSource.Trim() + "'"); }
  4206. if (!string.IsNullOrEmpty(Str_PakName.Trim()) && Str_PakNameTag != null)
  4207. { str.Append(" and 订单类别='" + Str_PakName.Trim() + "'"); }
  4208. if (this.Str_ProjectTitle.Trim() != "选片二销")
  4209. {
  4210. if (!string.IsNullOrEmpty(this.Str_AmountRange1.Trim()))
  4211. { str.Append(" and (应收金额>=" + this.Str_AmountRange1.Trim() + " and 应收金额<=" + this.Str_AmountRange2.Trim() + ")"); }
  4212. }
  4213. // 订单前期
  4214. if (this.Str_ItemCategory.Trim() == "订单前期")
  4215. {
  4216. if (!string.IsNullOrEmpty(this.Str_ProjectTitle.Trim()))
  4217. {
  4218. if (this.Str_ProjectTitle.Trim() == "实收")
  4219. { str.Append(" and 收款类别 <> '后期收款'"); }
  4220. if (this.Str_ProjectTitle.Trim() == "全款")
  4221. { str.Append(" and 应收金额 = 前期实收金额"); }
  4222. }
  4223. str.Append(" and 收款类别 <> '后期收款'");
  4224. }
  4225. // 订单后期
  4226. if (this.Str_ItemCategory.Trim() == "订单后期")
  4227. {
  4228. if (!string.IsNullOrEmpty(this.Str_ProjectTitle.Trim()))
  4229. {
  4230. if (!string.IsNullOrEmpty(this.Str_AmountRange1.Trim()))
  4231. {
  4232. if (this.Str_ProjectTitle.Trim() == "选片二销")
  4233. { str.Append(" and (收款金额>=" + this.Str_AmountRange1.Trim() + " and 收款金额<=" + this.Str_AmountRange2.Trim() + ")"); }
  4234. }
  4235. str.Append(" and 二销类别编号='" + this.Str_ProjectTitleTag.ToString().Trim() + "'");
  4236. }
  4237. str.Append(" and 收款类别='后期收款' and 收款类型=0");
  4238. }
  4239. // 其它消费
  4240. if (this.Str_ItemCategory.Trim() == "其它消费")
  4241. {
  4242. if (!string.IsNullOrEmpty(this.Str_ProjectTitle.Trim()))
  4243. { str.Append(" and 二销类别编号='" + this.Str_ProjectTitleTag.ToString().Trim() + "'"); }
  4244. str.Append(" and 收款类型=1");
  4245. }
  4246. if (this.Str_ItemCategory.Trim() == "礼服租售")
  4247. { str.Append(" and 收款类型 = '2' "); }
  4248. // 其它
  4249. //if (this.Str_ItemCategory.Trim() == "会员充值")
  4250. //{ str.Append(" and id=-3"); }
  4251. //if (this.Str_ItemCategory.Trim() == "服务卡充值")
  4252. //{ str.Append(" and id=-3"); }
  4253. //if (this.Str_ItemCategory.Trim() == "礼服租售")
  4254. //{ str.Append(" and id=-3"); }
  4255. //if (this.Str_ItemCategory.Trim() == "计件提成")
  4256. //{ str.Append(" and id=-3"); }
  4257. switch (this.Str_ItemCategory.Trim())
  4258. {
  4259. case "会员充值":
  4260. case "服务卡充值":
  4261. //case "礼服租售":
  4262. case "计件提成":
  4263. IsQuery = false;
  4264. break;
  4265. default:
  4266. IsQuery = true;
  4267. break;
  4268. }
  4269. return str.ToString();
  4270. }
  4271. /// <summary>
  4272. /// 绑定业绩列表查询方法2
  4273. /// </summary>
  4274. /// <param name="IsQuery"></param>
  4275. /// <returns></returns>
  4276. public string BindSelect2(ref bool IsQuery)
  4277. {
  4278. if (!string.IsNullOrEmpty(this.Str_CustomerSource.Trim()) || (!string.IsNullOrEmpty(this.Str_PakName.Trim()) && this.Str_PakNameTag != null) || !string.IsNullOrEmpty(this.Str_ProcessStatus.Trim()) || (!string.IsNullOrEmpty(this.Str_ItemCategory.Trim()) && this.Str_ItemCategory.Trim() != "会员充值"))
  4279. { IsQuery = false; }
  4280. else
  4281. { IsQuery = true; }
  4282. StringBuilder str = new StringBuilder();
  4283. if (!string.IsNullOrEmpty(this.Str_AmountRange1.Trim()))
  4284. { str.Append(" and 充值金额 >= " + this.Str_AmountRange1.Trim() + " and 充值金额 <= " + this.Str_AmountRange2.Trim() + ""); }
  4285. return str.ToString();
  4286. //StringBuilder str = new StringBuilder();
  4287. //if (!string.IsNullOrEmpty(this.Str_CustomerSource.Trim()))
  4288. //{ str.Append(" and id = -3"); }
  4289. //if (!string.IsNullOrEmpty(this.Str_PakName.Trim()) && this.Str_PakNameTag != null)
  4290. //{ str.Append(" and id = -3"); }
  4291. //if (!string.IsNullOrEmpty(this.Str_AmountRange1.Trim()))
  4292. //{ str.Append(" and 充值金额 >= " + this.Str_AmountRange1.Trim() + " and 充值金额 <= " + this.Str_AmountRange2.Trim() + ""); }
  4293. //if (!string.IsNullOrEmpty(this.Str_ProcessStatus.Trim()))
  4294. //{ str.Append(" and id = -3"); }
  4295. //// 会员充值
  4296. //if (!string.IsNullOrEmpty(this.Str_ItemCategory.Trim()))
  4297. //{
  4298. // if (this.Str_ItemCategory.Trim() != "会员充值")
  4299. // { str.Append("and id = -3"); }
  4300. //}
  4301. //return str.ToString();
  4302. }
  4303. /// <summary>
  4304. /// 绑定业绩列表查询方法3(服务卡)
  4305. /// </summary>
  4306. /// <param name="IsQuery"></param>
  4307. /// <returns></returns>
  4308. public string BindSelect3(ref bool IsQuery)
  4309. {
  4310. if (!string.IsNullOrEmpty(this.Str_CustomerSource.Trim()) || (!string.IsNullOrEmpty(this.Str_PakName.Trim()) && this.Str_PakNameTag != null) || !string.IsNullOrEmpty(this.Str_ProcessStatus.Trim()) || (!string.IsNullOrEmpty(this.Str_ItemCategory.Trim()) && this.Str_ItemCategory.Trim() != "服务卡充值"))
  4311. { IsQuery = false; }
  4312. else
  4313. { IsQuery = true; }
  4314. StringBuilder str = new StringBuilder();
  4315. if (!string.IsNullOrEmpty(this.Str_AmountRange1.Trim()))
  4316. { str.Append(" and 收款金额 >= " + this.Str_AmountRange1.Trim() + " and 收款金额 <= " + this.Str_AmountRange2.Trim() + ""); }
  4317. return str.ToString();
  4318. //StringBuilder str = new StringBuilder();
  4319. //if (!string.IsNullOrEmpty(cmbCustomerSource.Text.Trim()))
  4320. //{ str.Append(" and id=-3"); }
  4321. //if (!string.IsNullOrEmpty(CtvPak_Name.Text.Trim()) && CtvPak_Name.Tag != null)
  4322. //{ str.Append(" and id=-3"); }
  4323. //if (!string.IsNullOrEmpty(txtAmountRange1.Text))
  4324. //{ str.Append(" and 收款金额>=" + txtAmountRange1.Text.Trim() + " and 收款金额<=" + txtAmountRange2.Text.Trim() + ""); }
  4325. //if (!string.IsNullOrEmpty(cmbProcessStatus.Text.Trim()))
  4326. //{ str.Append(" and id=-3"); }
  4327. //// 会员充值
  4328. //if (!string.IsNullOrEmpty(cmbItemCategory.Text.Trim()))
  4329. //{
  4330. // if (cmbItemCategory.Text.Trim() != "服务卡充值")
  4331. // { str.Append("and id=-3"); }
  4332. //}
  4333. //return str.ToString();
  4334. }
  4335. /// <summary>
  4336. /// 绑定业绩列表查询方法4(计件)
  4337. /// </summary>
  4338. /// <param name="IsQuery"></param>
  4339. /// <returns></returns>
  4340. public string BindSelect4(ref bool IsQuery)
  4341. {
  4342. if (!string.IsNullOrEmpty(this.Str_CustomerSource.Trim()) || !string.IsNullOrEmpty(this.Str_ProcessStatus.Trim()) || (!string.IsNullOrEmpty(this.Str_ItemCategory.Trim()) && this.Str_ItemCategory.Trim() != "计件提成"))
  4343. { IsQuery = false; }
  4344. else
  4345. { IsQuery = true; }
  4346. StringBuilder str = new StringBuilder();
  4347. if (!string.IsNullOrEmpty(this.Str_PakName.Trim()) && this.Str_PakNameTag != null)
  4348. { str.Append(" and Ord_SeriesName = '" + this.Str_PakName.Trim() + "'"); }
  4349. if (!string.IsNullOrEmpty(this.Str_AmountRange1.Trim()))
  4350. { str.Append(" and 总价格 >= " + this.Str_AmountRange1.Trim() + " and 总价格 <= " + this.Str_AmountRange2.Trim() + ""); }
  4351. // 计件
  4352. if (!string.IsNullOrEmpty(this.Str_ItemCategory.Trim()))
  4353. {
  4354. if (this.Str_ItemCategory.Trim() == "计件提成")
  4355. {
  4356. if (!string.IsNullOrEmpty(this.Str_ProjectTitle.Trim()))
  4357. { str.Append(" and Pcr_CompletionContents = '" + this.Str_ProjectTitleTag + "'"); }
  4358. }
  4359. }
  4360. return str.ToString();
  4361. //StringBuilder str = new StringBuilder();
  4362. //if (!string.IsNullOrEmpty(cmbCustomerSource.Text.Trim()))
  4363. //{ str.Append(" and id=-3"); }
  4364. //if (!string.IsNullOrEmpty(CtvPak_Name.Text.Trim()) && CtvPak_Name.Tag != null)
  4365. //{ str.Append(" and Ord_SeriesName='" + CtvPak_Name.Text.Trim() + "'"); }
  4366. //if (!string.IsNullOrEmpty(txtAmountRange1.Text))
  4367. //{ str.Append(" and 总价格>=" + txtAmountRange1.Text.Trim() + " and 总价格<=" + txtAmountRange2.Text.Trim() + ""); }
  4368. //if (!string.IsNullOrEmpty(cmbProcessStatus.Text.Trim()))
  4369. //{ str.Append(" and id=-3"); }
  4370. //// 计件
  4371. //if (!string.IsNullOrEmpty(cmbItemCategory.Text.Trim()))
  4372. //{
  4373. // if (cmbItemCategory.Text.Trim() == "计件提成")
  4374. // {
  4375. // if (!string.IsNullOrEmpty(cmbProjectTitle.Text.Trim()))
  4376. // { str.Append(" and Pcr_CompletionContents='" + cmbProjectTitle.Tag + "'"); }
  4377. // }
  4378. // else
  4379. // { str.Append("and id=-3"); }
  4380. //}
  4381. //return str.ToString();
  4382. }
  4383. /// <summary>
  4384. /// 绑定业绩列表查询方法5(拍照)
  4385. /// </summary>
  4386. /// <returns></returns>
  4387. public string BindSelect5()
  4388. {
  4389. StringBuilder str = new StringBuilder();
  4390. if (!string.IsNullOrEmpty(this.Str_CustomerSource.Trim()) && this.Str_CustomerSourceTag != null)
  4391. { str.Append(" and 客户来源 = '" + this.Str_CustomerSource.Trim() + "'"); }
  4392. if (!string.IsNullOrEmpty(this.Str_PakName.Trim()) && this.Str_PakNameTag != null)
  4393. { str.Append(" and 订单类别 = '" + this.Str_PakName.Trim() + "'"); }
  4394. if (!string.IsNullOrEmpty(this.Str_AmountRange1.Trim()))
  4395. { str.Append(" and 应收金额 >= " + this.Str_AmountRange1.Trim() + " and 应收金额 <= " + this.Str_AmountRange2.Trim() + ""); }
  4396. return str.ToString();
  4397. }
  4398. /// <summary>
  4399. /// 统计业绩
  4400. /// </summary>
  4401. public void TotalPerformance()
  4402. {
  4403. DataTable dt = new DataTable();
  4404. this.dgvAll.Rows.Clear();
  4405. string StrWhere = "";
  4406. if (this.cmbEmployeeName.StrGetName.ToString() == "Department")
  4407. { StrWhere = " And User_Department = '" + this.cmbEmployeeName.Tag.ToString().Trim() + "'"; }
  4408. else if (this.cmbEmployeeName.StrGetName.ToString() == "StoreName")
  4409. { StrWhere = " And User_DividedShop = '" + this.cmbEmployeeName.Tag.ToString().Trim() + "'"; }
  4410. string StrTimeStart = this.txtTimeStart.DateValue.ToString().Trim();
  4411. string StrTimeEnd = this.txtTimeEnd.DateValue.ToString().Trim();
  4412. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  4413. {
  4414. dt = orbll.GetView_Custom("tb_ErpUser", StrWhere: "User_Status='在职'" + StrWhere, ShowColumnName: "User_Name,User_EmployeeID").Tables[0];
  4415. for (int t = 0; t < dt.Rows.Count; t++)
  4416. {
  4417. DataGridViewRow dgvr = new DataGridViewRow();
  4418. DataGridViewCell cell = null;
  4419. //员工编号
  4420. cell = new DataGridViewTextBoxCell();
  4421. cell.Value = dt.Rows[t]["User_EmployeeID"].ToString().Trim();
  4422. dgvr.Cells.Add(cell);
  4423. //员工姓名
  4424. cell = new DataGridViewTextBoxCell();
  4425. cell.Value = dt.Rows[t]["User_Name"].ToString().Trim();
  4426. dgvr.Cells.Add(cell);
  4427. //当前业绩
  4428. cell = new DataGridViewTextBoxCell();
  4429. cell.Value = Convert.ToDecimal(BindPerformance(StrTimeStart, StrTimeEnd, dt.Rows[t]["User_EmployeeID"].ToString().Trim(), backgroundWorker)).ToString();
  4430. dgvr.Cells.Add(cell);
  4431. this.Invoke(new UpdateControl(delegate()
  4432. {
  4433. this.dgvAll.Rows.Add(dgvr);
  4434. }));
  4435. }
  4436. });
  4437. }
  4438. /// <summary>
  4439. /// 获取业绩个数
  4440. /// </summary>
  4441. /// <param name="Ord_OrdersPersonID"></param>
  4442. /// <param name="StartTime"></param>
  4443. /// <param name="EndTime"></param>
  4444. /// <returns></returns>
  4445. public string GetNumberOfResults(string Ord_OrdersPersonID, string StartTime, string EndTime)
  4446. {
  4447. //DataTable dt = new DataTable();
  4448. //int OrderCount = 0;
  4449. //int PhotographyCount = 0;
  4450. //int PhotographyAssistantCount = 0;
  4451. //int MakeUpCount = 0;
  4452. //int MakeUpAssistantCount = 0;
  4453. //int GuideCount = 0;
  4454. //int FirstRepairCount = 0;
  4455. //int RefinementCount = 0;
  4456. //int DesignCount = 0;
  4457. Hashtable htDataOrder = new Hashtable();
  4458. Hashtable htDataPhotography = new Hashtable();
  4459. Hashtable htDataPhotographyAssistant = new Hashtable();
  4460. Hashtable htDataMakeUp = new Hashtable();
  4461. Hashtable htDataMakeUpAssistant = new Hashtable();
  4462. Hashtable htDataGuide = new Hashtable();
  4463. Hashtable htDataGuideAssistant = new Hashtable();
  4464. Hashtable htDataFirstRepair = new Hashtable();
  4465. Hashtable htDataRefinement = new Hashtable();
  4466. Hashtable htDataDesign = new Hashtable();
  4467. #region 获取订单数
  4468. //dt = orbll.GetView_Custom("Vw_Customer_PaymentOrders", StrWhere: "Ord_OrdersPersonID like '%" + Ord_OrdersPersonID + "%' and Ord_Class=1 and Ord_CreateDatetime>='" + StartTime + "' and Ord_CreateDatetime<='" + EndTime + "' ", ShowColumnName: "ID").Tables[0];
  4469. //if (dt.Rows.Count > 0)
  4470. //{ OrderCount = dt.Rows.Count; }
  4471. this.Invoke(new UpdateControl(delegate()
  4472. {
  4473. for (int i = 0; i < this.dgv.Rows.Count; i++)
  4474. {
  4475. if (this.dgv.Rows[i].Cells["Column18"].Value != null && !string.IsNullOrEmpty(this.dgv.Rows[i].Cells["Column18"].Value.ToString().Trim()))
  4476. {
  4477. string StrKeys = this.dgv.Rows[i].Cells["Column1"].Value.ToString().Trim() + this.dgv.Rows[i].Cells["Column17"].Value.ToString().Trim();
  4478. switch (this.dgv.Rows[i].Cells["Column17"].Value.ToString().Trim())
  4479. {
  4480. case "主接单人":
  4481. case "副接单人":
  4482. case "门市选片二销":
  4483. if (!htDataOrder.ContainsKey(StrKeys))
  4484. { htDataOrder[StrKeys] = 1; }
  4485. break;
  4486. case "主摄影师":
  4487. case "主摄影选片二销":
  4488. if (!htDataPhotography.ContainsKey(StrKeys))
  4489. { htDataPhotography[StrKeys] = 1; }
  4490. break;
  4491. case "摄影助理":
  4492. case "摄影助理选片二销":
  4493. if (!htDataPhotographyAssistant.ContainsKey(StrKeys))
  4494. { htDataPhotographyAssistant[StrKeys] = 1; }
  4495. break;
  4496. case "主化妆师":
  4497. case "主化妆选片二销":
  4498. if (!htDataMakeUp.ContainsKey(StrKeys))
  4499. { htDataMakeUp[StrKeys] = 1; }
  4500. break;
  4501. case "化妆助理":
  4502. case "化妆助理选片二销":
  4503. if (!htDataMakeUpAssistant.ContainsKey(StrKeys))
  4504. { htDataMakeUpAssistant[StrKeys] = 1; }
  4505. break;
  4506. case "引导师":
  4507. case "引导选片二销":
  4508. if (!htDataGuide.ContainsKey(StrKeys))
  4509. { htDataGuide[StrKeys] = 1; }
  4510. break;
  4511. case "引导助理":
  4512. case "引导助理选片二销":
  4513. if (!htDataGuideAssistant.ContainsKey(StrKeys))
  4514. { htDataGuideAssistant[StrKeys] = 1; }
  4515. break;
  4516. case "初修师":
  4517. case "初修师选片二销":
  4518. if (!htDataFirstRepair.ContainsKey(StrKeys))
  4519. { htDataFirstRepair[StrKeys] = 1; }
  4520. break;
  4521. case "精修师":
  4522. case "精修师选片二销":
  4523. if (!htDataRefinement.ContainsKey(StrKeys))
  4524. { htDataRefinement[StrKeys] = 1; }
  4525. break;
  4526. case "设计师":
  4527. case "设计师选片二销":
  4528. if (!htDataDesign.ContainsKey(StrKeys))
  4529. { htDataDesign[StrKeys] = 1; }
  4530. break;
  4531. }
  4532. }
  4533. }
  4534. }));
  4535. #endregion
  4536. #region 摄影师个数
  4537. //dt = new DataTable();
  4538. //dt = orbll.GetView_Custom("Vw_OrdersWagePhotography", StrWhere: "摄影师ID like '%" + Ord_OrdersPersonID + "%' and Ord_Class=1 and 拍摄状态=1 and 拍摄时间>='" + StartTime + "' and 拍摄时间<='" + EndTime + "' ", ShowColumnName: "ID").Tables[0];
  4539. //if (dt.Rows.Count > 0)
  4540. //{
  4541. // PhotographyCount = dt.Rows.Count;
  4542. //}
  4543. #endregion
  4544. #region 摄影助理个数
  4545. //dt = new DataTable();
  4546. //dt = orbll.GetView_Custom("Vw_OrdersWagePhotography", StrWhere: "摄影助理ID like '%" + Ord_OrdersPersonID + "%' and Ord_Class=1 and 拍摄状态=1 and 拍摄时间>='" + StartTime + "' and 拍摄时间<='" + EndTime + "' ", ShowColumnName: "ID").Tables[0];
  4547. //if (dt.Rows.Count > 0)
  4548. //{ PhotographyAssistantCount = dt.Rows.Count; }
  4549. #endregion
  4550. #region 化妆师个数
  4551. //dt = new DataTable();
  4552. //dt = orbll.GetView_Custom("Vw_OrdersWagePhotography", StrWhere: "化妆师ID like '%" + Ord_OrdersPersonID + "%' and Ord_Class=1 and 拍摄状态=1 and 拍摄时间>='" + StartTime + "' and 拍摄时间<='" + EndTime + "' ", ShowColumnName: "ID").Tables[0];
  4553. //if (dt.Rows.Count > 0)
  4554. //{ MakeUpCount = dt.Rows.Count; }
  4555. #endregion
  4556. #region 化妆助理个数
  4557. //dt = new DataTable();
  4558. //dt = orbll.GetView_Custom("Vw_OrdersWagePhotography", StrWhere: "化妆助理ID like '%" + Ord_OrdersPersonID + "%' and Ord_Class=1 and 拍摄状态=1 and 拍摄时间>='" + StartTime + "' and 拍摄时间<='" + EndTime + "' ", ShowColumnName: "ID").Tables[0];
  4559. //if (dt.Rows.Count > 0)
  4560. //{ MakeUpAssistantCount = dt.Rows.Count; }
  4561. #endregion
  4562. #region 引导师个数
  4563. //dt = new DataTable();
  4564. //dt = orbll.GetView_Custom("Vw_OrdersWagePhotography", StrWhere: "引导师ID like '%" + Ord_OrdersPersonID + "%' and Ord_Class=1 and 拍摄状态=1 and 拍摄时间>='" + StartTime + "' and 拍摄时间<='" + EndTime + "' ", ShowColumnName: "ID").Tables[0];
  4565. //if (dt.Rows.Count > 0)
  4566. //{ GuideCount = dt.Rows.Count; }
  4567. #endregion
  4568. #region 初修师个数
  4569. //dt = new DataTable();
  4570. //dt = orbll.GetView_Custom("Vw_OrdersWageDigital", StrWhere: "初修师ID like '%" + Ord_OrdersPersonID + "%' and Ord_Class=1 and 初修状态=2 and 初修时间>='" + StartTime + "' and 初修时间<='" + EndTime + "' ", ShowColumnName: "ID").Tables[0];
  4571. //if (dt.Rows.Count > 0)
  4572. //{ FirstRepairCount = dt.Rows.Count; }
  4573. #endregion
  4574. #region 精修师个数
  4575. //dt = new DataTable();
  4576. //dt = orbll.GetView_Custom("Vw_OrdersWageDigital", StrWhere: "精修师ID like '%" + Ord_OrdersPersonID + "%' and Ord_Class=1 and 精修状态=2 and 精修时间>='" + StartTime + "' and 精修时间<='" + EndTime + "' ", ShowColumnName: "ID").Tables[0];
  4577. //if (dt.Rows.Count > 0)
  4578. //{ RefinementCount = dt.Rows.Count; }
  4579. #endregion
  4580. #region 设计师个数
  4581. //dt = new DataTable();
  4582. //dt = orbll.GetView_Custom("Vw_OrdersWageDigital", StrWhere: "设计师ID like '%" + Ord_OrdersPersonID + "%' and Ord_Class=1 and 设计状态=2 and 设计时间>='" + StartTime + "' and 设计时间<='" + EndTime + "' ", ShowColumnName: "ID").Tables[0];
  4583. //if (dt.Rows.Count > 0)
  4584. //{ RefinementCount = dt.Rows.Count; }
  4585. #endregion
  4586. string StrCountSum = "订单数:" + htDataOrder.Count + ";摄影景点数:" + htDataPhotography.Count + ";摄影助理景点数:" + htDataPhotographyAssistant.Count + ";化妆数:" + htDataMakeUp.Count + ";化妆助理数:" + htDataMakeUpAssistant.Count;
  4587. StrCountSum += ";引导数:" + htDataGuide.Count + ";引导助理数:" + htDataGuideAssistant.Count + ";初修景点数:" + htDataFirstRepair.Count + ";精修景点数:" + htDataRefinement.Count + ";设计景点数:" + htDataDesign.Count;
  4588. return StrCountSum;
  4589. }
  4590. string Str_ItemCategory = "";
  4591. string Str_ProcessStatus = "";
  4592. string Str_CustomerSource = "";
  4593. object Str_CustomerSourceTag = "";
  4594. string Str_ProjectTitle = "";
  4595. object Str_ProjectTitleTag = "";
  4596. string Str_PakName = "";
  4597. object Str_PakNameTag = "";
  4598. string Str_AmountRange1 = "";
  4599. string Str_AmountRange2 = "";
  4600. string Str_Scores1 = "";
  4601. string Str_Scores2 = "";
  4602. //======================================================================操作事件==================================
  4603. /// <summary>
  4604. /// 选择人员姓名查询人员工资基本信息
  4605. /// </summary>
  4606. /// <param name="sender"></param>
  4607. /// <param name="e"></param>
  4608. protected override void cmbEmployeeName_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  4609. {
  4610. if (this.cmbEmployeeName.Tag != null)
  4611. {
  4612. if (this.cmbEmployeeName.StrGetName.Trim() == "User")
  4613. {
  4614. this.dgvAll.Visible = false;
  4615. this.dgv.Visible = true;
  4616. DataTable dt = wsbll.GetList("Ws_StaffCode='" + this.cmbEmployeeName.Tag.ToString().Trim() + "'").Tables[0];
  4617. if (dt.Rows.Count > 0)
  4618. {
  4619. this.txtBasicwage.Text = dt.Rows[0]["Ws_BasicWage"].ToString();
  4620. this.txtPay_Remark.Text = dt.Rows[0]["Ws_Remark"].ToString();
  4621. }
  4622. else
  4623. {
  4624. this.txtBasicwage.Text = "0";
  4625. this.txtPay_Remark.Text = "";
  4626. }
  4627. }
  4628. else if (string.IsNullOrEmpty(this.cmbEmployeeName.StrGetName.Trim()) || this.cmbEmployeeName.StrGetName.Trim() == "StoreName" || this.cmbEmployeeName.StrGetName.Trim() == "Department")
  4629. {
  4630. this.dgvAll.Visible = true;
  4631. this.dgv.Visible = false;
  4632. this.dgv.Rows.Clear();
  4633. this.txtBasicwage.Text = "0";
  4634. this.txtPay_Remark.Text = "";
  4635. this.txtCurrentPerformance.Text = "0";
  4636. this.cmbCommissionScheme.Text = "";
  4637. this.txtPieceCommission.Text = "0";
  4638. this.txtCommissionWages.Text = "0";
  4639. }
  4640. }
  4641. else
  4642. { MessageBoxCustom.Show("请选择人员!"); }
  4643. }
  4644. /// <summary>
  4645. /// 对象转为时间
  4646. /// </summary>
  4647. /// <param name="timeObj"></param>
  4648. /// <returns></returns>
  4649. DateTime GetObjectToDateTime(object timeObj)
  4650. {
  4651. try
  4652. {
  4653. if (timeObj != null)
  4654. {
  4655. return Convert.ToDateTime(timeObj.ToString());
  4656. }
  4657. else
  4658. {
  4659. return DateTime.MinValue;
  4660. }
  4661. }
  4662. catch { return DateTime.MinValue; }
  4663. }
  4664. /// <summary>
  4665. /// 选择项目类别
  4666. /// </summary>
  4667. /// <param name="sender"></param>
  4668. /// <param name="e"></param>
  4669. protected override void cmbItemCategory_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  4670. {
  4671. //清空项目名称
  4672. this.cmbProjectTitle.TreeView.Nodes.Clear();
  4673. this.cmbProjectTitle.Text = "";
  4674. this.cmbCommissionScheme.SetTextAndTag_ValueNull();
  4675. this.cmbCommissionScheme.Enabled = true;
  4676. this.cmbProjectTitle.Enabled = true;
  4677. if (this.cmbItemCategory.Text.Trim() == "订单前期")
  4678. { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView(this.cmbProjectTitle, StrBindData: "实收,全款", IsFirstNodeNull: true); }
  4679. else if (this.cmbItemCategory.Text.Trim() == "服务前期")
  4680. { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView(this.cmbProjectTitle, StrBindData: "摄影前期,化妆前期,引导前期,初修前期,精修前期,设计前期", IsFirstNodeNull: true); }
  4681. else if (this.cmbItemCategory.Text.Trim() == "订单后期" || this.cmbItemCategory.Text.Trim() == "其它消费")
  4682. { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BEBACDAJDFDDEACGJ", this.cmbProjectTitle, IsFirstNodeNull: true, StrWhere: "Sc_ClassCode!='BEBCADBFBCDFBGJHC' and Sc_ClassCode!='BEBCADBFBDDEGGABF' and Sc_ClassCode!='BEBCBFBICGDHCGBEJ' and Sc_ClassCode!='BEBCABBAAICBDHDHI' and Sc_ClassCode!='BEBCABBAAICJAAGDG' and Sc_ClassCode!='BEBCBFBICFCECBHFF'"); }
  4683. else if (this.cmbItemCategory.Text.Trim() == "服务后期")
  4684. { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView(this.cmbProjectTitle, StrBindData: "门市选片二销,摄影选片二销,化妆选片二销,引导选片二销,初修选片二销,设计选片二销,精修选片二销", IsFirstNodeNull: true); }
  4685. else if (this.cmbItemCategory.Text.Trim() == "会员充值" || this.cmbItemCategory.Text.Trim() == "服务卡充值")
  4686. { this.cmbProjectTitle.Enabled = false; }
  4687. else if (this.cmbItemCategory.Text.Trim() == "礼服租售")
  4688. { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView(this.cmbProjectTitle, StrBindData: "礼服出租,礼服出售", IsFirstNodeNull: true); }
  4689. else if (this.cmbItemCategory.Text.Trim() == "计件提成")
  4690. {
  4691. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BEBBBABBEBAIHGDCB", this.cmbProjectTitle, IsFirstNodeNull: true, tbl: tblSystemCategory);
  4692. this.cmbCommissionScheme.Enabled = false;
  4693. this.cmbCommissionScheme.Text = "计件提成";
  4694. }
  4695. }
  4696. /// <summary>
  4697. /// 查询
  4698. /// </summary>
  4699. /// <param name="sender"></param>
  4700. /// <param name="e"></param>
  4701. protected override void btnSelect_Click(object sender, EventArgs e)
  4702. {
  4703. if (string.IsNullOrEmpty(this.txtTimeStart.DateValue))
  4704. { MessageBoxCustom.Show("开始时间不能为空!"); return; }
  4705. if (string.IsNullOrEmpty(this.txtTimeEnd.DateValue))
  4706. { MessageBoxCustom.Show("结束时间不能为空!"); return; }
  4707. if (this.cmbItemCategory.Text.Trim() == "订单后期" && this.cmbProjectTitle.Text.Trim() == "选片二销")
  4708. { this.lblAmountDisplay.Text = "选片金额:"; }
  4709. else
  4710. { this.lblAmountDisplay.Text = "套系金额:"; }
  4711. if (!string.IsNullOrEmpty(this.txtAmountRange1.Text))
  4712. {
  4713. if (string.IsNullOrEmpty(this.txtAmountRange2.Text))
  4714. { MessageBoxCustom.Show("结束金额范围不能为空!"); return; }
  4715. }
  4716. if (!string.IsNullOrEmpty(this.txtAmountRange2.Text))
  4717. {
  4718. if (string.IsNullOrEmpty(this.txtAmountRange1.Text))
  4719. { MessageBoxCustom.Show("开始金额范围不能为空!"); return; }
  4720. }
  4721. if (!string.IsNullOrEmpty(this.txtScores1.Text))
  4722. {
  4723. if (string.IsNullOrEmpty(this.txtScores2.Text))
  4724. { MessageBoxCustom.Show("满意分值范围不能为空!"); return; }
  4725. }
  4726. if (!string.IsNullOrEmpty(this.txtScores2.Text))
  4727. {
  4728. if (string.IsNullOrEmpty(this.txtScores1.Text))
  4729. { MessageBoxCustom.Show("满意分值范围不能为空!"); return; }
  4730. }
  4731. this.Str_ItemCategory = this.cmbItemCategory.Text.Trim();
  4732. this.Str_ProcessStatus = this.cmbProcessStatus.Text.Trim();
  4733. this.Str_CustomerSource = this.cmbCustomerSource.Text.Trim();
  4734. this.Str_CustomerSourceTag = this.cmbCustomerSource.Tag;
  4735. this.Str_ProjectTitle = this.cmbProjectTitle.Text.Trim();
  4736. this.Str_ProjectTitleTag = this.cmbProjectTitle.Tag;
  4737. this.Str_PakName = this.CtvPak_Name.Text.Trim();
  4738. this.Str_PakNameTag = this.CtvPak_Name.Tag;
  4739. this.Str_AmountRange1 = this.txtAmountRange1.Text.Trim();
  4740. this.Str_AmountRange2 = this.txtAmountRange2.Text.Trim();
  4741. this.Str_Scores1 = this.txtScores1.Text.Trim();
  4742. this.Str_Scores2 = this.txtScores2.Text.Trim();
  4743. if (this.cmbEmployeeName.Tag == null)
  4744. { this.cmbEmployeeName.TagFindText(""); }
  4745. string StrEmployeeNameTag = this.cmbEmployeeName.Tag.ToString().Trim();
  4746. string StrDateStart = this.txtTimeStart.DateValue.ToString().Trim();
  4747. string StrDateEnd = this.txtTimeEnd.DateValue.ToString().Trim();
  4748. if (this.cmbEmployeeName.Tag != null)
  4749. {
  4750. if (this.cmbEmployeeName.StrGetName.Trim() == "User")
  4751. {
  4752. this.txtCommissionWages.Text = "0";
  4753. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  4754. {
  4755. string strCurrentPerformance = Convert.ToDecimal(this.BindPerformance(StrDateStart, StrDateEnd, StrEmployeeNameTag, backgroundWorker)).ToString("N2");
  4756. string StrCountSum = this.GetNumberOfResults(StrEmployeeNameTag, StrDateStart, StrDateEnd);
  4757. this.Invoke(new UpdateControl(delegate()
  4758. {
  4759. //获取员工业绩列表
  4760. this.txtCurrentPerformance.Text = strCurrentPerformance;
  4761. this.lblCountSum.Text = StrCountSum;
  4762. }));
  4763. });
  4764. }
  4765. else
  4766. {
  4767. this.TotalPerformance();
  4768. this.dgvAll.Visible = true;
  4769. }
  4770. }
  4771. //以下为滕工加,2016-01-28
  4772. this.cmbCommissionScheme_ComboBoxTree_NodeMouseClick(this, null);
  4773. }
  4774. /// <summary>
  4775. /// 输入框设置
  4776. /// </summary>
  4777. /// <param name="sender"></param>
  4778. /// <param name="e"></param>
  4779. protected override void txtAmountRange2_KeyPress(object sender, KeyPressEventArgs e)
  4780. {
  4781. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  4782. { e.Handled = true; }
  4783. }
  4784. /// <summary>
  4785. /// 输入框设置
  4786. /// </summary>
  4787. /// <param name="sender"></param>
  4788. /// <param name="e"></param>
  4789. protected override void txtAmountRange1_KeyPress(object sender, KeyPressEventArgs e)
  4790. {
  4791. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  4792. { e.Handled = true; }
  4793. }
  4794. /// <summary>
  4795. /// 关闭
  4796. /// </summary>
  4797. /// <param name="sender"></param>
  4798. /// <param name="e"></param>
  4799. protected override void btnClose_Click(object sender, EventArgs e)
  4800. {
  4801. this.Close();
  4802. }
  4803. /// <summary>
  4804. /// 提成工资事件
  4805. /// </summary>
  4806. /// <param name="sender"></param>
  4807. /// <param name="e"></param>
  4808. protected override void cmbCommissionScheme_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  4809. {
  4810. if (!string.IsNullOrEmpty(this.cmbCommissionScheme.Text.Trim()) && this.cmbCommissionScheme.Tag != null)
  4811. {
  4812. if (this.cmbEmployeeName.Text.Trim() == "全部" || this.cmbEmployeeName.StrGetName.ToString() == "Department" || string.IsNullOrEmpty(this.cmbEmployeeName.Text.Trim()))
  4813. {
  4814. MessageBoxCustom.Show("请选择员工!");
  4815. this.cmbCommissionScheme.Text = "";
  4816. return;
  4817. }
  4818. DataTable dt = wcsbll.GetList("Wcs_TypeCode='" + this.cmbCommissionScheme.Tag.ToString() + "'").Tables[0];
  4819. if (dt.Rows.Count == 0)
  4820. {
  4821. MessageBoxCustom.Show("请在工资设置,设置规则!");
  4822. this.cmbCommissionScheme.Text = "";
  4823. this.txtCommissionWages.Text = "0";
  4824. return;
  4825. }
  4826. else
  4827. { this.txtCommissionWages.Text = wcsbll.GetCommissionSpecifications(this.cmbCommissionScheme.Tag.ToString(), Convert.ToDecimal(this.txtCurrentPerformance.Text)).ToString("N2"); }
  4828. }
  4829. else
  4830. { this.txtCommissionWages.Text = "0"; }
  4831. }
  4832. /// <summary>
  4833. /// 排序
  4834. /// </summary>
  4835. /// <param name="sender"></param>
  4836. /// <param name="e"></param>
  4837. protected override void dgvAll_SortCompare(object sender, DataGridViewSortCompareEventArgs e)
  4838. {
  4839. if (e.Column.Name == "员工姓名" || e.Column.Name == "当前业绩")
  4840. { e.SortResult = (Convert.ToDouble(e.CellValue1) - Convert.ToDouble(e.CellValue2) > 0) ? 1 : (Convert.ToDouble(e.CellValue1) - Convert.ToDouble(e.CellValue2) < 0) ? -1 : 0; }
  4841. //否则,按字符串比较
  4842. else
  4843. { e.SortResult = System.String.Compare(Convert.ToString(e.CellValue1), Convert.ToString(e.CellValue2)); }
  4844. e.Handled = true;//不能省掉,不然没效果
  4845. }
  4846. /// <summary>
  4847. /// 保存记录
  4848. /// </summary>
  4849. /// <param name="sender"></param>
  4850. /// <param name="e"></param>
  4851. protected override void btnSave_Click(object sender, EventArgs e)
  4852. {
  4853. if (string.IsNullOrEmpty(txtTimeStart.DateValue))
  4854. { MessageBoxCustom.Show("开始时间不能为空!"); return; }
  4855. if (string.IsNullOrEmpty(txtTimeEnd.DateValue))
  4856. { MessageBoxCustom.Show("结束时间不能为空!"); return; }
  4857. if (cmbEmployeeName.Text.Trim() == "全部" || cmbEmployeeName.StrGetName.ToString() == "Department" || string.IsNullOrEmpty(cmbEmployeeName.Text.Trim()))
  4858. { MessageBoxCustom.Show("请选择员工!"); return; }
  4859. if (string.IsNullOrEmpty(cmbCommissionScheme.Text.Trim()))
  4860. { MessageBoxCustom.Show("请选择提成方案!"); return; }
  4861. if (cmbCommissionScheme.Text.Trim() != "计件提成")
  4862. {
  4863. DataTable dt = wcsbll.GetList("Wcs_TypeCode='" + cmbCommissionScheme.Tag.ToString() + "'").Tables[0];
  4864. if (dt.Rows.Count == 0)
  4865. {
  4866. MessageBoxCustom.Show("请在工资设置,设置规则!");
  4867. cmbCommissionScheme.SetTextAndTag_ValueNull();
  4868. txtCommissionWages.Text = "0";
  4869. return;
  4870. }
  4871. }
  4872. #region 保存工资提成记录
  4873. LYFZ.Model.Model_ErpWageCommissionRecords WageCommissionRecordsModel = new Model.Model_ErpWageCommissionRecords();
  4874. WageCommissionRecordsModel.Wcr_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  4875. WageCommissionRecordsModel.Wcr_EmployeeID = cmbEmployeeName.Tag.ToString();
  4876. if (cmbCommissionScheme.Text.Trim() == "计件提成")
  4877. { WageCommissionRecordsModel.Wcr_CommissionScheme = cmbCommissionScheme.Text.Trim(); }
  4878. else
  4879. { WageCommissionRecordsModel.Wcr_CommissionScheme = cmbCommissionScheme.Tag.ToString(); }
  4880. WageCommissionRecordsModel.Wcr_CurrentPerformance = Convert.ToDecimal(txtCurrentPerformance.Text);
  4881. WageCommissionRecordsModel.Wcr_PieceCommission = Convert.ToDecimal(txtPieceCommission.Text);
  4882. WageCommissionRecordsModel.Wcr_CommissionWages = Convert.ToDecimal(txtCommissionWages.Text);
  4883. WageCommissionRecordsModel.Wcr_PerformanceTimeStart = Convert.ToDateTime(txtTimeStart.Text);
  4884. WageCommissionRecordsModel.Wcr_PerformanceTimeEnd = Convert.ToDateTime(txtTimeEnd.Text);
  4885. WageCommissionRecordsModel.Wcr_CreateDateTime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
  4886. WageCommissionRecordsModel.Wcr_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  4887. if (wcrbll.Add(WageCommissionRecordsModel))
  4888. {
  4889. MessageBoxCustom.Show("保存成功!");
  4890. cmbCommissionScheme.SetTextAndTag_ValueNull();
  4891. txtCommissionWages.Text = "0";
  4892. }
  4893. #endregion
  4894. }
  4895. /// <summary>
  4896. /// 查看记录
  4897. /// </summary>
  4898. /// <param name="sender"></param>
  4899. /// <param name="e"></param>
  4900. protected override void btnSearchRecord_Click(object sender, EventArgs e)
  4901. {
  4902. if (string.IsNullOrEmpty(cmbEmployeeName.Text.Trim()))
  4903. { MessageBoxCustom.Show("员工姓名不能为空!请选择!"); return; }
  4904. LYFZ.Software.MainBusiness.FinancialManagement.Payroll.FrmSearchRecord frm = new Payroll.FrmSearchRecord();
  4905. frm.N_NameText = cmbEmployeeName.Text.Trim();
  4906. if (cmbEmployeeName.Text.Trim() != "全部")
  4907. {
  4908. frm.N_NameTag = cmbEmployeeName.Tag.ToString();
  4909. frm.N_Name = cmbEmployeeName.Name;
  4910. }
  4911. frm.ShowDialog();
  4912. }
  4913. /// <summary>
  4914. /// 添加行事件
  4915. /// </summary>
  4916. /// <param name="sender"></param>
  4917. /// <param name="e"></param>
  4918. void dgv_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
  4919. {
  4920. if (this.dgv.Rows[e.RowIndex].Cells["Column4"].Value != null && !string.IsNullOrEmpty(this.dgv.Rows[e.RowIndex].Cells["Column4"].Value.ToString().Trim()))
  4921. { this.dgv.Rows[e.RowIndex].Cells["Column4"].Value = LYFZ.Command.Command_Validate.DateTimeToString(this.dgv.Rows[e.RowIndex].Cells["Column4"].Value, "yyyy-MM-dd HH:mm"); }
  4922. if (this.dgv.Rows[e.RowIndex].Cells["Column11"].Value != null && !string.IsNullOrEmpty(this.dgv.Rows[e.RowIndex].Cells["Column11"].Value.ToString().Trim()))
  4923. { this.dgv.Rows[e.RowIndex].Cells["Column11"].Value = LYFZ.Command.Command_Validate.DateTimeToString(this.dgv.Rows[e.RowIndex].Cells["Column11"].Value, "yyyy-MM-dd HH:mm"); }
  4924. if (this.dgv.Rows[e.RowIndex].Cells["Column3"].Value != null && !string.IsNullOrEmpty(this.dgv.Rows[e.RowIndex].Cells["Column3"].Value.ToString().Trim()))
  4925. { this.dgv.Rows[e.RowIndex].Cells["Column3"].Value = this.dgv.Rows[e.RowIndex].Cells["Column3"].Value.ToString(); }
  4926. }
  4927. /// <summary>
  4928. /// 导出
  4929. /// </summary>
  4930. /// <param name="sender"></param>
  4931. /// <param name="e"></param>
  4932. protected override void btnExPort_Click(object sender, EventArgs e)
  4933. {
  4934. if (this.dgv.Visible)
  4935. { this.dgv.DataToExcelPayroll(this.cmbEmployeeName.Text.Trim()); }
  4936. else
  4937. { this.dgvAll.ExportDataTable(); }
  4938. }
  4939. /// <summary>
  4940. /// 开始时间改变
  4941. /// </summary>
  4942. /// <param name="sender"></param>
  4943. /// <param name="e"></param>
  4944. void txtTimeStart_Leave(object sender, EventArgs e)
  4945. {
  4946. if (!string.IsNullOrEmpty(this.txtTimeStart.DateValue.Trim()))
  4947. { this.txtTimeEnd.DateValue = Convert.ToDateTime(this.txtTimeStart.DateValue).AddMonths(1).AddSeconds(-1).ToString("yyyy-MM-dd"); }
  4948. }
  4949. /// <summary>
  4950. /// 窗体大小发生改变事件
  4951. /// </summary>
  4952. /// <param name="sender"></param>
  4953. /// <param name="e"></param>
  4954. void FrmPayroll_Resize(object sender, EventArgs e)
  4955. {
  4956. if (!this.IsFirstRun)
  4957. {
  4958. switch (this.panelSaveed.Location.Y)
  4959. {
  4960. case 0: this.flowLayoutPanel1.Height = 29; break;
  4961. case 29: this.flowLayoutPanel1.Height = 59; break;
  4962. case 58: this.flowLayoutPanel1.Height = 89; break;
  4963. case 87: this.flowLayoutPanel1.Height = 119; break;
  4964. case 116: this.flowLayoutPanel1.Height = 149; break;
  4965. }
  4966. }
  4967. }
  4968. }
  4969. }