FrmCustomer.xml 179 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <Forms>
  3. <Form Name="FrmCustomer">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @SetFlag=1;
  9. @Title="客户基本资料";
  10. @HaveSearchCustomerList=false;
  11. GetSchema();
  12. Search("SearchSystemSetting");
  13. @SysCurrency=#SystemSetting.SysCurrency_SystemSetting;
  14. ChangeMode("Search");
  15. RecordHistoryRead("FrmCustomer");
  16. Search("SearchIsMain");
  17. ]]>
  18. </Load>
  19. <Closing>
  20. RecordHistoryWrite("FrmCustomer","dtStartBill","dtEndBill","ckNearlyBill","tbNearlyBill","ckQueryPriceBill","ckSaleBill","ckSaleRtnBill","ckInventoryBill","dtStartProduct"
  21. ,"dtEndProduct","ckNearlyProduct","tbNearlyProduct","ckQueryPriceProduct","ckSaleProduct","ckSaleRtnProduct","ckInventoryProduct","ckSaleOutDepotBill","ckIndentBill","ckSaleOutDepotProduct","ckIndentProduct");
  22. </Closing>
  23. <Closed>
  24. ;
  25. </Closed>
  26. </Events>
  27. <Mode>
  28. <Search>
  29. <Lable name="Search" />
  30. </Search>
  31. <New>
  32. <Lable name="New" />
  33. </New>
  34. <View>
  35. <Lable name="View" />
  36. </View>
  37. <Modify>
  38. <Lable name="Modify" />
  39. </Modify>
  40. </Mode>
  41. <Controls>
  42. <IKTextButton name="tbNo" DataSource="Customer.No_Customer">
  43. <Events>
  44. <Enter>
  45. <![CDATA[
  46. if(tbNo.ReadOnly == false)
  47. {
  48. if(tbNo.CValue != StringEmpty())
  49. {
  50. UpdateForm(false, "");
  51. Empty("#ExchangeProduct");
  52. Empty("#ExchangeBill");
  53. if(Search("SearchCustomerWithNo", tbNo.CValue))
  54. {
  55. if(!Search("SearchCustomersIsInRegionalLeader",#Customer.No_Customer, GetCurrentUser()))
  56. {
  57. MessageBox("你与客户不在同一个区域,不能查看!");
  58. ChangeMode("Search");
  59. return;
  60. }
  61. if(!GetRight("客户基本资料","全权查看"))
  62. {
  63. if( !Equals(#Customer.ID_Creator,GetLoginUserID()) )
  64. {
  65. @EnterNo=tbNo.CValue;
  66. ChangeMode("Search");
  67. tbNo.CValue = @EnterNo;
  68. MessageBox("您没有查看此客户基本资料的权限!",@Title);
  69. return;
  70. }
  71. }
  72. ChangeMode("View");
  73. }
  74. else
  75. {
  76. if(GetRight(@Title,"新增"))
  77. ChangeMode("New");
  78. else
  79. MessageBox("您没有新增客户基本资料的权限!",@Title);
  80. }
  81. }
  82. else
  83. {
  84. MessageBox("请输入客户编号!",@Title);
  85. }
  86. }
  87. ]]>
  88. </Enter>
  89. <Click>
  90. <![CDATA[
  91. if (tbNo.ReadOnly == false)
  92. {
  93. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbNo.CValue);
  94. if( @temp == "" )
  95. return;
  96. tbNo.CValue = @temp;
  97. ActiveControlEvent("tbNo", "Enter");
  98. }
  99. ]]>
  100. </Click>
  101. </Events>
  102. </IKTextButton>
  103. <IKTextButton name="tbNo2" DataSource="Customer.No2_Customer">
  104. <Events>
  105. <Enter>
  106. if(tbNo2.CValue != StringEmpty())
  107. {
  108. if (tbNo2.CValue.ToUpper()!=tbNo.CValue.ToUpper())
  109. {
  110. #Customer.No_Customer = tbNo2.CValue;
  111. if(Search("SearchCustomerWithNo2", tbNo2.CValue))
  112. {
  113. #Customer.IsCustomersCustomer_Customer = 1;
  114. #Customer.CustomerID_Customer = #Customer2.ID_Customer;
  115. tbNo2.CValue = #Customer2.No_Customer;
  116. txtShortName2.CValue = #Customer2.ShortName_Customer;
  117. }
  118. else
  119. {
  120. #Customer.IsCustomersCustomer_Customer = 0;
  121. #Customer.CustomerID_Customer = GuidEmpty();
  122. tbNo2.CValue = "";
  123. txtShortName2.CValue = "";
  124. MessageBox("找不到此客户!!");
  125. }
  126. #Customer.No_Customer = tbNo.CValue;
  127. }
  128. else
  129. {
  130. #Customer.IsCustomersCustomer_Customer = 0;
  131. #Customer.CustomerID_Customer = GuidEmpty();
  132. tbNo2.CValue = "";
  133. txtShortName2.CValue = "";
  134. MessageBox("所属客户不可与客户名相同!");
  135. tbNo2.Focus();
  136. }
  137. }
  138. </Enter>
  139. <Click>
  140. tbNo2.CValue="";
  141. txtShortName2.CValue="";
  142. @Temp2 = ShowSearchBox("CustomerSearch","INFOMATION",tbNo2.CValue);
  143. if( @Temp2 != StringEmpty() )
  144. {
  145. tbNo2.CValue = @Temp2;
  146. if (tbNo2.CValue!=tbNo.CValue)
  147. {
  148. if(Search("SearchCustomerWithNo2",tbNo2.CValue))
  149. {
  150. #Customer.IsCustomersCustomer_Customer = 1;
  151. #Customer.CustomerID_Customer = #Customer2.ID_Customer;
  152. tbNo2.CValue = #Customer2.No_Customer;
  153. txtShortName2.CValue = #Customer2.ShortName_Customer;
  154. }
  155. else
  156. {
  157. #Customer.IsCustomersCustomer_Customer = 0;
  158. #Customer.CustomerID_Customer = GuidEmpty();
  159. tbNo2.CValue = "";
  160. txtShortName2.CValue = "";
  161. }
  162. }
  163. else
  164. {
  165. #Customer.IsCustomersCustomer_Customer = 0;
  166. #Customer.CustomerID_Customer = GuidEmpty();
  167. tbNo2.CValue = "";
  168. txtShortName2.CValue = "";
  169. MessageBox("所属客户不可与客户名相同!");
  170. tbNo2.Focus();
  171. }
  172. }
  173. </Click>
  174. </Events>
  175. </IKTextButton>
  176. <IKTextBox name="txtShortName" DataSource="Customer.ShortName_Customer"/>
  177. <IKTextBox name="txtShortName2" DataSource="Customer.ShortName2_Customer"/>
  178. <IKTextBox name="txtName" DataSource="Customer.Name_Customer"/>
  179. <IKTextBox name="txtRegistedAddress" DataSource="Customer.RegistedAddress_Customer">
  180. <Events>
  181. <Enter>
  182. if(txtRegistedAddress.CValue!=StringEmpty())
  183. {
  184. txtSendAddr.CValue=txtRegistedAddress.CValue;
  185. Search("InsertRecord",txtName.CValue,txtRegistedAddress.CValue);
  186. MergeTable("#TempInvoice","#Invoice");
  187. }
  188. else
  189. {
  190. MessageBox("请输入客户注册地址!",@Title);
  191. }
  192. </Enter>
  193. </Events>
  194. </IKTextBox>
  195. <IKCountryCombo name="cbCountry" DataSource="Customer.Country_Customer"/>
  196. <IKTextBox name="txtPostalCode" DataSource="Customer.PostalCode_Customer"/>
  197. <IKPhoneControl name="pcPhone" DataSource="Telephone" ValueMember="ID_Telephone" DisplayMember="Name_Telephone" NoMember="No_Telephone" FocusMember="Focus_Telephone"></IKPhoneControl>
  198. <IKPhoneControl name="pcFax" DataSource="Fax" ValueMember="ID_Fax" DisplayMember="Name_Fax" NoMember="No_Fax" FocusMember="Focus_Fax"></IKPhoneControl>
  199. <IKNumericTextBox name="txtPayLimit" DataSource="Customer.PayLimit_Customer"/>
  200. <IKComboBoxEx name="cbPayLimitType" DataSource="GetPayLimitType" DisplayMember="Name_Type">
  201. <Events>
  202. <Reload>
  203. UpdateForm(false,"cbPayLimitType");
  204. Search("SearchPayLimitType");
  205. UpdateForm(true,"cbPayLimitType");
  206. </Reload>
  207. </Events>
  208. </IKComboBoxEx>
  209. <IKNumericTextBox name="txtPayLimit2" DataSource="Customer.OpeningBalanceAdjust_Customer"/>
  210. <IKNumericTextBox name="tbDunDate" DataSource="Customer.DunDate_Customer"/>
  211. <IKNumericTextBox name="tbLowDiscount" DataSource="Customer.LowDiscount_Customer"/>
  212. <IKComboBoxEx name="cbGetMethod" DisplaySource="Customer.GetMethod_Customer" DataSource="GetMethodType" DisplayMember="Name_TypeDef">
  213. <Events>
  214. <Reload>
  215. UpdateForm(false, "cbGetMethod");
  216. Search("SearchGetMethodType");
  217. UpdateForm(true, "cbGetMethod");
  218. </Reload>
  219. <SelectedIndexChanged>
  220. if(cbGetMethod.SelectedName=="先款后货")
  221. {
  222. txtPayLimit.CValue=0;
  223. txtPayLimit.Enabled=false;
  224. }
  225. else
  226. {
  227. txtPayLimit.Enabled=GetFieldRight(@Title,"信用额度","修改");;
  228. }
  229. </SelectedIndexChanged>
  230. </Events>
  231. </IKComboBoxEx>
  232. <IKTextBox name="txtSendAddr" DataSource="Customer.SendAddr_Customer"/>
  233. <IKDateTimeText name="dttCreateDate" DataSource="Customer.CreateDate_Customer"/>
  234. <IKTextBox name="txtCreator" DataSource="Customer.CreatorName_Customer"/>
  235. <!--Customer.CreatorName_Customer isn't DB's Field-->
  236. <IKDateTimePause name="dtpIsSuspend" DataSource="Customer.SuspendDate_Customer"/>
  237. <IKTextBox name="txtComment" DataSource="Customer.Comment_Customer"/>
  238. <IKTextBox name="txtRemark" DataSource="Customer.RemarkBalance_Customer"/>
  239. <IKComboBoxEx name="comboArea" ValueSource ="Customer.ID_RegionalLeader" DisplaySource="Customer.Name_RegionalLeader" NoSource="Customer.No_RegionalLeader" DataSource="RegionalLeader" ValueMember="ID_RegionalLeader" DisplayMember="Name_RegionalLeader" NoMember="No_RegionalLeader">
  240. <Events>
  241. <Reload>
  242. UpdateForm(false, "comboArea");
  243. Search("SearchAreaType");
  244. UpdateForm(true, "comboArea");
  245. </Reload>
  246. </Events>
  247. </IKComboBoxEx>
  248. <IKComboBoxEx name="cbIndustry" DisplaySource="Customer.Industry_Customer" DataSource="IndustryType" DisplayMember="Name_TypeDef">
  249. <Events>
  250. <Reload>
  251. UpdateForm(false, "cbIndustry");
  252. Search("SearchIndustryType");
  253. UpdateForm(true, "cbIndustry");
  254. </Reload>
  255. </Events>
  256. </IKComboBoxEx>
  257. <IKComboBoxEx name="cbZone" DisplaySource="Customer.Zone_Customer" DataSource="ZoneType" DisplayMember="Name_TypeDef">
  258. <Events>
  259. <Reload>
  260. UpdateForm(false, "cbZone");
  261. Search("SearchZoneType");
  262. UpdateForm(true, "cbZone");
  263. </Reload>
  264. </Events>
  265. </IKComboBoxEx>
  266. <IKComboBoxEx name="cbType" DisplaySource="Customer.Type_Customer" DataSource="Type" DisplayMember="Name_TypeDef">
  267. <Events>
  268. <Reload>
  269. UpdateForm(false, "cbType");
  270. Search("SearchType");
  271. UpdateForm(true, "cbType");
  272. </Reload>
  273. </Events>
  274. </IKComboBoxEx>
  275. <IKCheckBox name="cbIsGeneric" DataSource="Customer.IsGeneric_Customer"/>
  276. <IKComboBoxEx name="cbSource" DisplaySource="Customer.Source_Customer" DataSource="SourceType" DisplayMember="Name_TypeDef">
  277. <Events>
  278. <Reload>
  279. UpdateForm(false, "cbSource");
  280. Search("SearchSourceType");
  281. UpdateForm(true, "cbSource");
  282. </Reload>
  283. </Events>
  284. </IKComboBoxEx>
  285. <IKComboBoxEx name="cbLevel" DisplaySource="Customer.Level_Customer" DataSource="LevelType" DisplayMember="Name_TypeDef">
  286. <Events>
  287. <Reload>
  288. UpdateForm(false, "cbLevel");
  289. Search("SearchLevelType");
  290. UpdateForm(true, "cbLevel");
  291. </Reload>
  292. </Events>
  293. </IKComboBoxEx>
  294. <IKComboBoxEx name="cbBank" DisplaySource="Customer.Bank_Customer" DataSource="BankType" DisplayMember="Name_TypeDef">
  295. <Events>
  296. <Reload>
  297. UpdateForm(false, "cbBank");
  298. Search("SearchBankType");
  299. UpdateForm(true, "cbBank");
  300. </Reload>
  301. </Events>
  302. </IKComboBoxEx>
  303. <IKComboBoxEx name="cbCompany" DisplaySource="Customer.Company_Customer" DataSource="CompanyType" DisplayMember="Name_TypeDef">
  304. <Events>
  305. <Reload>
  306. UpdateForm(false, "cbCompany");
  307. Search("SearchCompanyType");
  308. UpdateForm(true, "cbCompany");
  309. </Reload>
  310. </Events>
  311. </IKComboBoxEx>
  312. <IKTextBox name="ikTextBox1" DataSource="Customer.Note_Customer"/>
  313. <IKTextBox name="txtAccount" DataSource="Customer.Account_Customer"/>
  314. <IKTextBox name="txtRevenueRegisterNo" DataSource="Customer.RevenueRegisterNo_Customer"/>
  315. <IKTextBox name="txtMender" DataSource="Customer.LastModUser"/>
  316. <IKDateTimeText name="dttMendeDate" DataSource="Customer.LastModDate_Customer"/>
  317. <IKDateTimePicker name="dtpBeginDate" DataSource="Customer.BeginDate_Customer"/>
  318. <IKDataGridEx name="dgInvoice" DataSource="Invoice" TableStyleIndex="0">
  319. <DataColumn Index="0" DataSource="Invoice.IsCommon_Invoice" >
  320. <IKDataGridComboBoxColumn DisplaySourceEx="Invoice.IsCommon_Invoice" ValueSourceEx="Invoice.Common_Invoice" DataSourceEx="IsMain" DisplayMemberEx="Result" ValueMemberEx="Value">
  321. <Events>
  322. <Reload>
  323. Search("SearchIsMain");
  324. SetDataGridColumnDataSource(0,"dgInvoice");
  325. </Reload>
  326. </Events>
  327. </IKDataGridComboBoxColumn>
  328. </DataColumn>
  329. <DataColumn Index="1" DataSource="Invoice.Title_Invoice" />
  330. <DataColumn Index="2" DataSource="Invoice.Address_Invoice" />
  331. <DataColumn Index="3" DataSource="Invoice.Tel_Invoice" />
  332. <DataColumn Index="4" DataSource="Invoice.Linkman_Invoice" />
  333. <DataColumn Index="5" DataSource="Invoice.Comment_Invoice" />
  334. </IKDataGridEx>
  335. <IKDataGridEx name="dgPrincipal" DataSource="Principal" TableStyleIndex="0">
  336. <DataColumn Index="0" DataSource="Principal.No_Employee" >
  337. <IKDataGridTextButtonColumn>
  338. <Events>
  339. <Click>
  340. @SetFlag=1;
  341. @temp = ShowSearchBox("EmployeeSearch","INFOMATION",#Principal.No_Employee);
  342. if(@temp != "")
  343. {
  344. ResumeColumnEvent("#Principal.No_Employee");
  345. #Principal.No_Employee = @temp;
  346. ClearColumnEvent();
  347. }
  348. </Click>
  349. <SetFlagBeforeClick>
  350. @SetFlag=0;
  351. </SetFlagBeforeClick>
  352. </Events>
  353. </IKDataGridTextButtonColumn>
  354. </DataColumn>
  355. <DataColumn Index="1" DataSource="Principal.Name_Employee" />
  356. <DataColumn Index="2" DataSource="Principal.IsMainStr_Principal" >
  357. <IKDataGridComboBoxColumn DisplaySourceEx="Principal.IsMainStr_Principal" ValueSourceEx="Principal.IsMain_Principal" DataSourceEx="IsMain" DisplayMemberEx="Result" ValueMemberEx="Value">
  358. <Events>
  359. <Reload>
  360. Search("SearchIsMain");
  361. SetDataGridColumnDataSource(2,"dgPrincipal");
  362. </Reload>
  363. </Events>
  364. </IKDataGridComboBoxColumn>
  365. </DataColumn>
  366. <DataColumn Index="3" DataSource="Principal.Comment_Principal" />
  367. </IKDataGridEx>
  368. <IKDataGridEx name="dgLinkMan" DataSource="Linkman" TableStyleIndex="0">
  369. <DataColumn Index="0" DataSource="Linkman.IsMainStr_Linkman" >
  370. <IKDataGridComboBoxColumn DisplaySourceEx="Linkman.IsMainStr_Linkman" ValueSourceEx="Linkman.IsMain_Linkman" DataSourceEx="IsMain" DisplayMemberEx="Result" ValueMemberEx="Value">
  371. <Events>
  372. <Reload>
  373. Search("SearchIsMain");
  374. SetDataGridColumnDataSource(0,"dgLinkMan");
  375. </Reload>
  376. </Events>
  377. </IKDataGridComboBoxColumn>
  378. </DataColumn>
  379. <DataColumn Index="1" DataSource="Linkman.Name_Linkman" />
  380. <DataColumn Index="2" DataSource="Linkman.Department_Linkman" />
  381. <DataColumn Index="3" DataSource="Linkman.Duty_Linkman" />
  382. <DataColumn Index="4" DataSource="Linkman.Tel_Linkman" />
  383. <DataColumn Index="5" DataSource="Linkman.Fax_Linkman" />
  384. <DataColumn Index="6" DataSource="Linkman.Mobile_Linkman" />
  385. <DataColumn Index="7" DataSource="Linkman.Email_Linkman" />
  386. <DataColumn Index="8" DataSource="Linkman.Comment_Linkman" />
  387. </IKDataGridEx>
  388. <IKDataGridEx name="dgCustomer" DataSource="CustomerList" TableStyleIndex="0">
  389. <DataColumn Index="0" DataSource="CustomerList.No_Customer" />
  390. <DataColumn Index="1" DataSource="CustomerList.ShortName_Customer" />
  391. <Events>
  392. <RowHeaderDoubleClick>
  393. if(Search("SearchCustomerWithNo",#CustomerList.No_Customer))
  394. {
  395. ChangeMode("View");
  396. }
  397. </RowHeaderDoubleClick>
  398. </Events>
  399. </IKDataGridEx>
  400. <IKDataGridEx name="dgExchangeBill" DataSource="ExchangeBill" TableStyleIndex="0">
  401. <DataColumn Index="0" DataSource="ExchangeBill.Date" />
  402. <DataColumn Index="1" DataSource="ExchangeBill.Name_Bill" />
  403. <DataColumn Index="2" DataSource="ExchangeBill.No_Bill" />
  404. <DataColumn Index="3" DataSource="ExchangeBill.ConsultNo" />
  405. <DataColumn Index="4" DataSource="ExchangeBill.Principal" />
  406. <DataColumn Index="5" DataSource="ExchangeBill.Money" />
  407. <Events>
  408. <RowHeaderDoubleClick>
  409. DgDoubleClick(#ExchangeBill.Name_Bill,#ExchangeBill.No_Bill);
  410. </RowHeaderDoubleClick>
  411. </Events>
  412. </IKDataGridEx>
  413. <IKButton name="btSearchBill">
  414. <Events>
  415. <Click>
  416. <![CDATA[
  417. if(dtStartBill.Checked==true)
  418. @StartTime = dtStartBill.CValue;
  419. else
  420. @StartTime = DBNull();
  421. if(dtEndBill.Checked==true)
  422. @EndTime = dtEndBill.CValue;
  423. else
  424. @EndTime = DBNull();
  425. @tbNearlyBill=tbNearlyBill.CValue;
  426. if(!Search("SearchExchangeBill",@StartTime, @EndTime,ckNearlyBill.Checked,@tbNearlyBill,ckQueryPriceBill.Checked,ckSaleBill.Checked,ckSaleRtnBill.Checked,ckInventoryBill.Checked,tbNo.CValue,ckSaleOutDepotBill.Checked,ckIndentBill.Checked,txtShortName.CValue,GetFieldRight("订货单","特价单","查看"),GetFieldRight("销货单","特价单","查看"),GetFieldRight("报价单","最低报价","查看")))
  427. Empty("#ExchangeBill");
  428. ]]>
  429. </Click>
  430. </Events>
  431. </IKButton>
  432. <IKDataGridEx name="dgExchangeProduct" DataSource="ExchangeProduct" TableStyleIndex="0">
  433. <DataColumn Index="0" DataSource="ExchangeProduct.No_Product" />
  434. <DataColumn Index="1" DataSource="ExchangeProduct.Name_Product" />
  435. <DataColumn Index="2" DataSource="ExchangeProduct.Date" />
  436. <DataColumn Index="3" DataSource="ExchangeProduct.Name_Bill" />
  437. <DataColumn Index="4" DataSource="ExchangeProduct.No_Bill" />
  438. <DataColumn Index="5" DataSource="ExchangeProduct.Num" />
  439. <DataColumn Index="6" DataSource="ExchangeProduct.Price" />
  440. <DataColumn Index="7" DataSource="ExchangeProduct.TaxCurrency" />
  441. <DataColumn Index="8" DataSource="ExchangeProduct.Money" />
  442. <DataColumn Index="9" DataSource="ExchangeProduct.Comment" />
  443. <Events>
  444. <RowHeaderDoubleClick>
  445. DgDoubleClick(#ExchangeProduct.Name_Bill,#ExchangeProduct.No_Bill);
  446. </RowHeaderDoubleClick>
  447. </Events>
  448. </IKDataGridEx>
  449. <IKDataGridEx name="dgRemark" DataSource="BasicComment" TableStyleIndex="0">
  450. <DataColumn Index="0" DataSource="BasicComment.Comment_BasicComment" />
  451. </IKDataGridEx>
  452. <IKDataGridEx name="dgInfo" DataSource="CustomerInfo" TableStyleIndex="0">
  453. <DataColumn Index="0" DataSource="CustomerInfo.No_CustomerInfo" />
  454. <DataColumn Index="1" DataSource="CustomerInfo.Date_CustomerInfo" />
  455. <DataColumn Index="2" DataSource="CustomerInfo.Principal_CustomerInfo" />
  456. <DataColumn Index="3" DataSource="CustomerInfo.Purchase_CustomerInfo" />
  457. <DataColumn Index="4" DataSource="CustomerInfo.Linkman_CustomerInfo" />
  458. <DataColumn Index="5" DataSource="CustomerInfo.Tel_CustomerInfo" />
  459. <DataColumn Index="6" DataSource="CustomerInfo.Fax_CustomerInfo" />
  460. <DataColumn Index="7" DataSource="CustomerInfo.FromDate_CustomerInfo" />
  461. <DataColumn Index="8" DataSource="CustomerInfo.Member_CustomerInfo" />
  462. <DataColumn Index="9" DataSource="CustomerInfo.LastTurnover_CustomerInfo" />
  463. <DataColumn Index="10" DataSource="CustomerInfo.Turnover_CustomerInfo" />
  464. <DataColumn Index="11" DataSource="CustomerInfo.Type_CustomerInfo" />
  465. </IKDataGridEx>
  466. <IKButton name="btSearchProduct">
  467. <Events>
  468. <Click>
  469. <![CDATA[
  470. if(dtStartProduct.Checked==true)
  471. @StartTime = dtStartProduct.CValue;
  472. else
  473. @StartTime = DBNull();
  474. if(dtEndProduct.Checked==true)
  475. @EndTime = dtEndProduct.CValue;
  476. else
  477. @EndTime = DBNull();
  478. @tbNearlyProduct=tbNearlyProduct.CValue;
  479. if(!(ckQueryPriceProduct.Checked||ckSaleProduct.Checked||ckSaleRtnProduct.Checked||ckInventoryProduct.Checked||ckSaleOutDepotProduct.Checked||ckIndentProduct.Checked))
  480. {
  481. MessageBox("请选择至少一种单据类型",@Title);
  482. return;
  483. }
  484. if(!Search("SearchExchangeProduct",@StartTime, @EndTime,ckNearlyProduct.Checked,@tbNearlyProduct,ckQueryPriceProduct.Checked,ckSaleProduct.Checked,ckSaleRtnProduct.Checked,ckInventoryProduct.Checked,tbNo.CValue,ckSaleOutDepotProduct.Checked,ckIndentProduct.Checked,txtShortName.CValue,GetFieldRight("订货单","特价单","查看"),GetFieldRight("销货单","特价单","查看"),GetFieldRight("报价单","最低报价","查看")))
  485. Empty("#ExchangeProduct");
  486. ]]>
  487. </Click>
  488. </Events>
  489. </IKButton>
  490. <IKCheckBox name="ckDisplay" DataSource="Customer.IsDisplay">
  491. <Events>
  492. <CheckedChanged>
  493. if(ckDisplay.Checked)
  494. Search("SearchAllCustomerList",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  495. else
  496. Search("SearchCustomerList",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  497. </CheckedChanged>
  498. </Events>
  499. </IKCheckBox>
  500. <IKCheckBox name="ikCheckBox2" DataSource="Customer.IsCustomersCustomer_Customer">
  501. <Events>
  502. <CheckedChanged>
  503. if (ikCheckBox2.Enabled == true)
  504. {
  505. tbNo2.IKButton.Enabled = true;
  506. if (ikCheckBox2.Checked == true)
  507. {
  508. tbNo2.ReadOnly = false;
  509. if(Search("SearchCustomerWithNo2", tbNo.CValue))
  510. {
  511. #Customer.IsCustomersCustomer_Customer=1;
  512. tbNo2.CValue = #Customer2.No2_Customer;
  513. txtShortName2.CValue = #Customer2.ShortName2_Customer;
  514. }
  515. else
  516. {
  517. #Customer.IsCustomersCustomer_Customer=0;
  518. tbNo2.CValue = "";
  519. txtShortName2.CValue = "";
  520. }
  521. }
  522. else
  523. {
  524. tbNo2.ReadOnly = true;
  525. tbNo2.IKButton.Enabled = false;
  526. #Customer.IsCustomersCustomer_Customer=0;
  527. #Customer.CustomerID_Customer = GuidEmpty();
  528. tbNo2.CValue = "";
  529. txtShortName2.CValue = "";
  530. }
  531. }
  532. else
  533. {
  534. tbNo2.ReadOnly = true;
  535. tbNo2.IKButton.Enabled = false;
  536. if(ikCheckBox2.Checked == true)
  537. if(Search("SearchCustomerWithNo2",tbNo.CValue))
  538. {
  539. tbNo2.CValue = #Customer2.No2_Customer;
  540. txtShortName2.CValue = #Customer2.ShortName2_Customer;
  541. }
  542. else
  543. {
  544. tbNo2.CValue = "";
  545. txtShortName2.CValue = "";
  546. }
  547. }
  548. </CheckedChanged>
  549. </Events>
  550. </IKCheckBox>
  551. <IKFormToolBar name="toolBar">
  552. <Events>
  553. <ClickFirst>
  554. cbPayLimitType.SelectedName="";
  555. if(Search("SearchCustomerFirst", tbNo.CValue,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetCurrentUser()))
  556. {
  557. Empty("#ExchangeProduct");
  558. Empty("#ExchangeBill");
  559. ChangeMode("View");
  560. }
  561. </ClickFirst>
  562. <ClickPrev>
  563. cbPayLimitType.SelectedName="";
  564. if(Search("SearchCustomerPrevious", tbNo.CValue,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetCurrentUser()))
  565. {
  566. Empty("#ExchangeProduct");
  567. Empty("#ExchangeBill");
  568. ChangeMode("View");
  569. }
  570. </ClickPrev>
  571. <ClickNext>
  572. cbPayLimitType.SelectedName="";
  573. if(Search("SearchCustomerNext", tbNo.CValue,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetCurrentUser()))
  574. {
  575. Empty("#ExchangeProduct");
  576. Empty("#ExchangeBill");
  577. ChangeMode("View");
  578. }
  579. </ClickNext>
  580. <ClickLast>
  581. cbPayLimitType.SelectedName="";
  582. if(Search("SearchCustomerLast", tbNo.CValue,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),GetCurrentUser()))
  583. {
  584. Empty("#ExchangeProduct");
  585. Empty("#ExchangeBill");
  586. ChangeMode("View");
  587. }
  588. </ClickLast>
  589. <ClickNew>
  590. ;
  591. </ClickNew>
  592. <ClickEmpty>
  593. ChangeMode("Search");
  594. </ClickEmpty>
  595. <ClickSubmit>
  596. <Lable name="SubmitButtonClick" />
  597. </ClickSubmit>
  598. <ClickModify>
  599. <!--Search("SearchPrincipal", tbareaNo.CValue);-->
  600. ChangeMode("Modify");
  601. </ClickModify>
  602. <ClickDelete>
  603. Delete(); ChangeMode("Search");
  604. </ClickDelete>
  605. <ClickPrint>
  606. #Customer.CountryName = cbCountry.Text;
  607. PrintReport();
  608. </ClickPrint>
  609. <ClickAudit>
  610. ;
  611. </ClickAudit>
  612. <ClickUnAudit>
  613. ;
  614. </ClickUnAudit>
  615. <ClickImport>
  616. ;
  617. </ClickImport>
  618. <ClickExport>
  619. ;
  620. </ClickExport>
  621. <ClickClose>
  622. ;
  623. </ClickClose>
  624. <ClickExpand>
  625. if(toolBar.ExpandForm==true)
  626. {
  627. pnRight.Visible=true;<!--PanelRight is not existed-->
  628. if(!@HaveSearchCustomerList)
  629. {
  630. Search("SearchCustomerList",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
  631. @HaveSearchCustomerList=true;
  632. }
  633. }
  634. else
  635. {
  636. pnRight.Visible=false;
  637. }
  638. </ClickExpand>
  639. </Events>
  640. </IKFormToolBar>
  641. </Controls>
  642. <Tables>
  643. <Table name="Principal">
  644. <Events>
  645. <ColumnsChanged>
  646. <No_Employee>
  647. if(@SetFlag==0)
  648. {
  649. return;
  650. }
  651. if(Search("GetEmployeeNameByNo",#Principal.No_Employee))
  652. {
  653. #Principal.Name_Employee=#Employee.Name_Employee;
  654. #Principal.ID_Employee=#Employee.ID_Employee;
  655. if(!Equals(#Employee.SuspendDate_Employee,DBNull()))
  656. MessageBox("该员工已停用!",@Title);
  657. }
  658. else
  659. {
  660. MessageBox("该员工不存在!",@Title);
  661. #Principal.Name_Employee="";
  662. #Principal.ID_Employee=GuidEmpty();
  663. @temp = ShowSearchBox("EmployeeSearch","INFOMATION",#Principal.No_Employee);
  664. if(@temp != "")
  665. {
  666. ResumeColumnEvent("#Principal.No_Employee");
  667. #Principal.No_Employee = @temp;
  668. ClearColumnEvent();
  669. }
  670. }
  671. </No_Employee>
  672. </ColumnsChanged>
  673. </Events>
  674. </Table>
  675. <Table name="Linkman">
  676. <Events>
  677. <ColumnsChanged>
  678. <Name_Linkman>
  679. <![CDATA[
  680. if(!Equals(#Linkman.Name_Linkman,"")&&!Equals(#Linkman.Tel_Linkman,""))
  681. {
  682. if(RowCount("#Linkman")==1)
  683. {
  684. SuspendLayout();
  685. for(@i=0;@i<RowCount("#Invoice");@i++)
  686. {
  687. SetPosition("#Invoice",@i);
  688. if(Equals(#Invoice.Tel_Invoice,"")&&Equals(#Invoice.Linkman_Invoice,""))
  689. {
  690. #Invoice.Tel_Invoice=#Linkman.Tel_Linkman;
  691. #Invoice.Linkman_Invoice=#Linkman.Name_Linkman;
  692. }
  693. }
  694. ResumeLayout();
  695. }
  696. }
  697. ]]>
  698. </Name_Linkman>
  699. <Tel_Linkman>
  700. <![CDATA[
  701. if(!Equals(#Linkman.Name_Linkman,"")&&!Equals(#Linkman.Tel_Linkman,""))
  702. {
  703. if(RowCount("#Linkman")==1)
  704. {
  705. SuspendLayout();
  706. for(@i=0;@i<RowCount("#Invoice");@i++)
  707. {
  708. SetPosition("#Invoice",@i);
  709. if(Equals(#Invoice.Tel_Invoice,"")&&Equals(#Invoice.Linkman_Invoice,""))
  710. {
  711. #Invoice.Tel_Invoice=#Linkman.Tel_Linkman;
  712. #Invoice.Linkman_Invoice=#Linkman.Name_Linkman;
  713. }
  714. }
  715. ResumeLayout();
  716. }
  717. }
  718. ]]>
  719. </Tel_Linkman>
  720. </ColumnsChanged>
  721. </Events>
  722. </Table>
  723. </Tables>
  724. <LockInfomation LockID="ID_Customer" LockNO="No_Customer" LockSearchFunction="SearchCustomerWithNo"/>
  725. <ChildForms>
  726. <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionCondition="SearchCustomerCondition" SearchFunctionByNo="SearchCustomerWithNo" MappingName="客户">
  727. <DataColumn Index="0" MappingName="#Customer.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  728. <DataColumn Index="1" MappingName="#Customer.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  729. <DataColumn Index="2" MappingName="#Customer.Zone_Customer" HeaderText="地区" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  730. <DataColumn Index="3" MappingName="#Customer.SendAddr_Customer" HeaderText="送货地址" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  731. <DataColumn Index="4" MappingName="#Customer.RegistedAddress_Customer" HeaderText="客户地址" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  732. <DataColumn Index="5" MappingName="#Customer.Name_Linkman" HeaderText="主要联系人" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  733. <DataColumn Index="6" MappingName="#Customer.Tel_Linkman" HeaderText="联系人电话" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  734. <DataColumn Index="7" MappingName="#Customer.No_Telephone" HeaderText="客户电话" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  735. <DataColumn Index="8" MappingName="#Customer.Type_Customer" HeaderText="客户类别" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  736. <DataColumn Index="9" MappingName="#Customer.GetMethod_Customer" HeaderText="结款方式" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  737. <DataColumn Index="10" MappingName="#Customer.Level_Customer" HeaderText="客户等级" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  738. <DataColumn Index="11" MappingName="#Customer.Name_Employee" HeaderText="负责业务" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  739. <DataColumn Index="12" MappingName="#Customer.PayLimit_Customer" HeaderText="信用额度" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  740. <DataColumn Index="13" MappingName="#Customer.LowDiscount_Customer" HeaderText="最低折扣" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  741. <DataColumn Index="14" MappingName="#Customer.DunDate_Customer" HeaderText="催款日" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  742. <DataColumn Index="15" MappingName="#Customer.Company_Customer" HeaderText="所属公司" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  743. <DataColumn Index="16" MappingName="#Customer.No_RegionalLeader" HeaderText="所属区域" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  744. <DataColumn Index="17" MappingName="#Customer.Comment_Customer" HeaderText="备注" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  745. </ChildForm>
  746. <ChildForm name="EmployeeSearch" DataSource="Employee" SearchFunction="SearchAllEmployee" SearchFunctionByNo="SearchEmployeeWithNo" MappingName="员工" >
  747. <DataColumn Index="0" MappingName="#Employee.No_Employee" HeaderText="员工编号" Width="90" ColumnType="IKDataGridTextBoxColumn" />
  748. <DataColumn Index="1" MappingName="#Employee.Name_Employee" HeaderText="员工名称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  749. </ChildForm>
  750. <ChildForm name="RegionalLeaderSearch" DataSource="RegionalLeader" SearchFunction="SearchAllRegionalLeader" SearchFunctionByNo="" MappingName="负责人" >
  751. <DataColumn Index="0" MappingName="#RegionalLeader.No_RegionalLeader" HeaderText="区域编号" Width="90" ColumnType="IKDataGridTextBoxColumn" />
  752. <DataColumn Index="1" MappingName="#RegionalLeader.Name_RegionalLeader" HeaderText="区域名称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  753. </ChildForm>
  754. </ChildForms>
  755. <FormatString>
  756. <Format name="SearchCustomerCondition">
  757. if(GetRight("客户基本资料","全权查看"))
  758. {
  759. FormatString("");
  760. }
  761. else
  762. {
  763. FormatString(" Customer.ID_Creator='{0}' ",GetLoginUserID());
  764. }
  765. </Format>
  766. </FormatString>
  767. </Client>
  768. <Server>
  769. <Tables>
  770. <Table name="Customer" Type="Parent">
  771. <GetSchema CmdType="Text" CmdText=" SELECT Top 0 Customer.*,RegionalLeader.No_RegionalLeader,RegionalLeader.Name_RegionalLeader
  772. ,convert(nvarchar(64),'') as CountryName
  773. ,A.Name_User AS CreatorName_Customer,B.Name_User As LastModUser
  774. ,Convert(bit,1) As IsDisplay,Employee.No_Employee as No_Employee
  775. ,Employee.Name_Employee as Name_Employee
  776. ,ct.No_Customer as No2_Customer , ct.ShortName_Customer as ShortName2_Customer
  777. FROM Customer
  778. left join Customer ct on Customer.CustomerID_Customer = ct.ID_Customer
  779. LEFT JOIN RegionalLeader on RegionalLeader.ID_RegionalLeader=Customer.ID_RegionalLeader
  780. LEFT JOIN AppUser A ON A.ID_User = Customer.ID_Creator
  781. LEFT Join AppUser B ON B.ID_User=Customer.LastModUser_Customer
  782. LEFT JOIN Employee on Employee.ID_Employee= Customer.LastPrincipal_Customer"/>
  783. <New CmdType="Text" CmdText=" INSERT INTO Customer (ID_Customer
  784. ,No_Customer
  785. ,ShortName_Customer
  786. ,Name_Customer
  787. ,RegistedAddress_Customer
  788. ,Country_Customer
  789. ,PostalCode_Customer
  790. ,Type_Customer
  791. ,IsGeneric_Customer
  792. ,PayLimitCurrency
  793. ,PayLimit_Customer
  794. ,GetMethod_Customer
  795. ,CreateDate_Customer
  796. ,ID_Creator
  797. ,SendAddr_Customer
  798. ,Comment_Customer
  799. ,Industry_Customer
  800. ,Zone_Customer
  801. ,Source_Customer
  802. ,Level_Customer
  803. ,Bank_Customer
  804. ,Account_Customer
  805. ,RevenueRegisterNo_Customer
  806. ,SuspendDate_Customer
  807. ,LastModDate_Customer
  808. ,LastModUser_Customer
  809. ,DunDate_Customer
  810. ,LowDiscount_Customer
  811. ,IsCustomersCustomer_Customer
  812. ,BeginDate_Customer
  813. ,Saleroom_Customer
  814. ,PerValue_Customer
  815. ,CustomerID_Customer
  816. ,ID_RegionalLeader
  817. ,Note_Customer
  818. ,PrePayValue_Customer
  819. ,Company_Customer
  820. ,OpeningBalanceAdjust_Customer
  821. ,RemarkBalance_Customer)
  822. VALUES(@ID_Customer
  823. ,@No_Customer
  824. ,@ShortName_Customer
  825. ,@Name_Customer
  826. ,@RegistedAddress_Customer
  827. ,@Country_Customer
  828. ,@PostalCode_Customer
  829. ,@Type_Customer
  830. ,@IsGeneric_Customer
  831. ,@PayLimitCurrency
  832. ,@PayLimit_Customer
  833. ,@GetMethod_Customer
  834. ,@CreateDate_Customer
  835. ,@ID_Creator
  836. ,@SendAddr_Customer
  837. ,@Comment_Customer
  838. ,@Industry_Customer
  839. ,@Zone_Customer
  840. ,@Source_Customer
  841. ,@Level_Customer
  842. ,@Bank_Customer
  843. ,@Account_Customer
  844. ,@RevenueRegisterNo_Customer
  845. ,@SuspendDate_Customer
  846. ,@LastModDate_Customer
  847. ,@LastModUser_Customer
  848. ,@DunDate_Customer
  849. ,@LowDiscount_Customer
  850. ,@IsCustomersCustomer_Customer
  851. ,@BeginDate_Customer
  852. ,@Saleroom_Customer
  853. ,@PerValue_Customer
  854. ,@CustomerID_Customer
  855. ,@ID_RegionalLeader
  856. ,@Note_Customer
  857. ,@PrePayValue_Customer
  858. ,@Company_Customer
  859. ,@OpeningBalanceAdjust_Customer
  860. ,@RemarkBalance_Customer)" >
  861. <Params>
  862. <Param name="@ID_Customer" type="Customer.ID_Customer" sourceColumn="ID_Customer" />
  863. <Param name="@No_Customer" type="Customer.No_Customer" sourceColumn="No_Customer" />
  864. <Param name="@ShortName_Customer" type="Customer.ShortName_Customer" sourceColumn="ShortName_Customer" />
  865. <Param name="@Name_Customer" type="Customer.Name_Customer" sourceColumn="Name_Customer" />
  866. <Param name="@RegistedAddress_Customer" type="Customer.RegistedAddress_Customer" sourceColumn="RegistedAddress_Customer" />
  867. <Param name="@Country_Customer" type="Customer.Country_Customer" sourceColumn="Country_Customer" />
  868. <Param name="@PostalCode_Customer" type="Customer.PostalCode_Customer" sourceColumn="PostalCode_Customer" />
  869. <Param name="@Type_Customer" type="Customer.Type_Customer" sourceColumn="Type_Customer" />
  870. <Param name="@IsGeneric_Customer" type="Customer.IsGeneric_Customer" sourceColumn="IsGeneric_Customer" />
  871. <Param name="@PayLimitCurrency" type="Customer.PayLimitCurrency" sourceColumn="PayLimitCurrency" />
  872. <Param name="@PayLimit_Customer" type="Customer.PayLimit_Customer" sourceColumn="PayLimit_Customer" />
  873. <Param name="@GetMethod_Customer" type="Customer.GetMethod_Customer" sourceColumn="GetMethod_Customer" />
  874. <Param name="@CreateDate_Customer" type="Customer.CreateDate_Customer" sourceColumn="CreateDate_Customer" />
  875. <Param name="@ID_Creator" type="Customer.ID_Creator" sourceColumn="ID_Creator" />
  876. <Param name="@SendAddr_Customer" type="Customer.SendAddr_Customer" sourceColumn="SendAddr_Customer" />
  877. <Param name="@Comment_Customer" type="Customer.Comment_Customer" sourceColumn="Comment_Customer" />
  878. <Param name="@Industry_Customer" type="Customer.Industry_Customer" sourceColumn="Industry_Customer" />
  879. <Param name="@Zone_Customer" type="Customer.Zone_Customer" sourceColumn="Zone_Customer" />
  880. <Param name="@Source_Customer" type="Customer.Source_Customer" sourceColumn="Source_Customer" />
  881. <Param name="@Level_Customer" type="Customer.Level_Customer" sourceColumn="Level_Customer" />
  882. <Param name="@Bank_Customer" type="Customer.Bank_Customer" sourceColumn="Bank_Customer" />
  883. <Param name="@Account_Customer" type="Customer.Account_Customer" sourceColumn="Account_Customer" />
  884. <Param name="@RevenueRegisterNo_Customer" type="Customer.RevenueRegisterNo_Customer" sourceColumn="RevenueRegisterNo_Customer" />
  885. <Param name="@SuspendDate_Customer" type="Customer.SuspendDate_Customer" sourceColumn="SuspendDate_Customer" />
  886. <Param name="@LastModDate_Customer" type="Customer.LastModDate_Customer" sourceColumn="LastModDate_Customer" />
  887. <Param name="@LastModUser_Customer" type="Customer.LastModUser_Customer" sourceColumn="LastModUser_Customer" />
  888. <Param name="@DunDate_Customer" type="Customer.DunDate_Customer" sourceColumn="DunDate_Customer" />
  889. <Param name="@LowDiscount_Customer" type="Customer.LowDiscount_Customer" sourceColumn="LowDiscount_Customer" />
  890. <Param name="@IsCustomersCustomer_Customer" type="Customer.IsCustomersCustomer_Customer" sourceColumn="IsCustomersCustomer_Customer" />
  891. <Param name="@BeginDate_Customer" type="Customer.BeginDate_Customer" sourceColumn="BeginDate_Customer" />
  892. <Param name="@Saleroom_Customer" type="Customer.Saleroom_Customer" sourceColumn="Saleroom_Customer" />
  893. <Param name="@PerValue_Customer" type="Customer.PerValue_Customer" sourceColumn="PerValue_Customer" />
  894. <Param name="@CustomerID_Customer" type="Customer.CustomerID_Customer" sourceColumn="CustomerID_Customer" />
  895. <Param name="@ID_RegionalLeader" type="Customer.ID_RegionalLeader" sourceColumn="ID_RegionalLeader" />
  896. <Param name="@Note_Customer" type="Customer.Note_Customer" sourceColumn="Note_Customer" />
  897. <Param name="@PrePayValue_Customer" type="Customer.PrePayValue_Customer" sourceColumn="PrePayValue_Customer" />
  898. <Param name="@Company_Customer" type="Customer.Company_Customer" sourceColumn="Company_Customer" />
  899. <Param name="@OpeningBalanceAdjust_Customer" type="Customer.OpeningBalanceAdjust_Customer" sourceColumn="OpeningBalanceAdjust_Customer" />
  900. <Param name="@RemarkBalance_Customer" type="Customer.RemarkBalance_Customer" sourceColumn="RemarkBalance_Customer" />
  901. </Params>
  902. </New>
  903. <Update CmdType="Text" CmdText="UPDATE Customer SET GetMethod_Customer = @GetMethod_Customer
  904. ,ShortName_Customer = @ShortName_Customer
  905. ,Name_Customer = @Name_Customer
  906. ,RegistedAddress_Customer = @RegistedAddress_Customer
  907. ,Country_Customer = @Country_Customer
  908. ,Type_Customer = @Type_Customer
  909. ,IsGeneric_Customer =@IsGeneric_Customer
  910. ,PostalCode_Customer = @PostalCode_Customer
  911. ,PayLimitCurrency = @PayLimitCurrency
  912. ,PayLimit_Customer = @PayLimit_Customer
  913. ,CreateDate_Customer = @CreateDate_Customer
  914. ,ID_Creator = @ID_Creator
  915. ,SendAddr_Customer=@SendAddr_Customer
  916. ,Comment_Customer = @Comment_Customer
  917. ,Industry_Customer = @Industry_Customer
  918. ,Zone_Customer = @Zone_Customer
  919. ,Source_Customer = @Source_Customer
  920. ,Level_Customer =@Level_Customer
  921. ,Bank_Customer = @Bank_Customer
  922. ,Account_Customer = @Account_Customer
  923. ,RevenueRegisterNo_Customer = @RevenueRegisterNo_Customer
  924. ,SuspendDate_Customer = @SuspendDate_Customer
  925. ,LastModDate_Customer=@LastModDate_Customer
  926. ,LastModUser_Customer=@LastModUser_Customer
  927. ,DunDate_Customer=@DunDate_Customer
  928. ,LowDiscount_Customer=@LowDiscount_Customer
  929. ,IsCustomersCustomer_Customer=@IsCustomersCustomer_Customer
  930. ,BeginDate_Customer = @BeginDate_Customer
  931. ,Saleroom_Customer = @Saleroom_Customer
  932. ,PerValue_Customer=@PerValue_Customer
  933. ,CustomerID_Customer = @CustomerID_Customer
  934. ,ID_RegionalLeader = @ID_RegionalLeader
  935. ,Note_Customer=@Note_Customer
  936. ,PrePayValue_Customer=@PrePayValue_Customer
  937. ,Company_Customer=@Company_Customer
  938. ,OpeningBalanceAdjust_Customer=@OpeningBalanceAdjust_Customer
  939. ,RemarkBalance_Customer=@RemarkBalance_Customer
  940. FROM Customer
  941. WHERE ID_Customer = @ID_Customer
  942. Select Customer.* ,ct.No_Customer as No2_Customer
  943. ,ct.ShortName_Customer as ShortName2_Customer
  944. From Customer
  945. left join Customer ct on Customer.CustomerID_Customer = ct.ID_Customer
  946. WHERE Customer.ID_Customer = @ID_Customer">
  947. <Params>
  948. <Param name="@ID_Customer" type="Customer.ID_Customer" sourceColumn="ID_Customer" />
  949. <!--<Param name="@No_Customer" type="Customer.No_Customer" sourceColumn="No_Customer" />-->
  950. <Param name="@ShortName_Customer" type="Customer.ShortName_Customer" sourceColumn="ShortName_Customer" />
  951. <Param name="@Name_Customer" type="Customer.Name_Customer" sourceColumn="Name_Customer" />
  952. <Param name="@RegistedAddress_Customer" type="Customer.RegistedAddress_Customer" sourceColumn="RegistedAddress_Customer" />
  953. <Param name="@Country_Customer" type="Customer.Country_Customer" sourceColumn="Country_Customer" />
  954. <Param name="@PostalCode_Customer" type="Customer.PostalCode_Customer" sourceColumn="PostalCode_Customer" />
  955. <Param name="@Type_Customer" type="Customer.Type_Customer" sourceColumn="Type_Customer" />
  956. <Param name="@IsGeneric_Customer" type="Customer.IsGeneric_Customer" sourceColumn="IsGeneric_Customer" />
  957. <Param name="@PayLimitCurrency" type="Customer.PayLimitCurrency" sourceColumn="PayLimitCurrency" />
  958. <Param name="@PayLimit_Customer" type="Customer.PayLimit_Customer" sourceColumn="PayLimit_Customer" />
  959. <Param name="@GetMethod_Customer" type="Customer.GetMethod_Customer" sourceColumn="GetMethod_Customer" />
  960. <Param name="@CreateDate_Customer" type="Customer.CreateDate_Customer" sourceColumn="CreateDate_Customer" />
  961. <Param name="@ID_Creator" type="Customer.ID_Creator" sourceColumn="ID_Creator" />
  962. <Param name="@SendAddr_Customer" type="Customer.SendAddr_Customer" sourceColumn="SendAddr_Customer" />
  963. <Param name="@Comment_Customer" type="Customer.Comment_Customer" sourceColumn="Comment_Customer" />
  964. <Param name="@Industry_Customer" type="Customer.Industry_Customer" sourceColumn="Industry_Customer" />
  965. <Param name="@Zone_Customer" type="Customer.Zone_Customer" sourceColumn="Zone_Customer" />
  966. <Param name="@Source_Customer" type="Customer.Source_Customer" sourceColumn="Source_Customer" />
  967. <Param name="@Level_Customer" type="Customer.Level_Customer" sourceColumn="Level_Customer" />
  968. <Param name="@Bank_Customer" type="Customer.Bank_Customer" sourceColumn="Bank_Customer" />
  969. <Param name="@Account_Customer" type="Customer.Account_Customer" sourceColumn="Account_Customer" />
  970. <Param name="@RevenueRegisterNo_Customer" type="Customer.RevenueRegisterNo_Customer" sourceColumn="RevenueRegisterNo_Customer" />
  971. <Param name="@SuspendDate_Customer" type="Customer.SuspendDate_Customer" sourceColumn="SuspendDate_Customer" />
  972. <Param name="@LastModDate_Customer" type="Customer.LastModDate_Customer" sourceColumn="LastModDate_Customer" />
  973. <Param name="@LastModUser_Customer" type="Customer.LastModUser_Customer" sourceColumn="LastModUser_Customer" />
  974. <Param name="@DunDate_Customer" type="Customer.DunDate_Customer" sourceColumn="DunDate_Customer" />
  975. <Param name="@LowDiscount_Customer" type="Customer.LowDiscount_Customer" sourceColumn="LowDiscount_Customer" />
  976. <Param name="@IsCustomersCustomer_Customer" type="Customer.IsCustomersCustomer_Customer" sourceColumn="IsCustomersCustomer_Customer" />
  977. <Param name="@BeginDate_Customer" type="Customer.BeginDate_Customer" sourceColumn="BeginDate_Customer" />
  978. <Param name="@Saleroom_Customer" type="Customer.Saleroom_Customer" sourceColumn="Saleroom_Customer" />
  979. <Param name="@PerValue_Customer" type="Customer.PerValue_Customer" sourceColumn="PerValue_Customer" />
  980. <Param name="@CustomerID_Customer" type="Customer.CustomerID_Customer" sourceColumn="CustomerID_Customer" />
  981. <Param name="@ID_RegionalLeader" type="Customer.ID_RegionalLeader" sourceColumn="ID_RegionalLeader" />
  982. <Param name="@Note_Customer" type="Customer.Note_Customer" sourceColumn="Note_Customer" />
  983. <Param name="@PrePayValue_Customer" type="Customer.PrePayValue_Customer" sourceColumn="PrePayValue_Customer" />
  984. <Param name="@Company_Customer" type="Customer.Company_Customer" sourceColumn="Company_Customer" />
  985. <Param name="@OpeningBalanceAdjust_Customer" type="Customer.OpeningBalanceAdjust_Customer" sourceColumn="OpeningBalanceAdjust_Customer" />
  986. <Param name="@RemarkBalance_Customer" type="Customer.RemarkBalance_Customer" sourceColumn="RemarkBalance_Customer" />
  987. </Params>
  988. </Update>
  989. <Delete CmdType="Text" CmdText="if exists (select * from salebill where id_customer =@ID_Customer)
  990. begin
  991. RAISERROR('该客户已被引用,删除失败!',16,1)
  992. RETURN
  993. end
  994. DELETE Fax WHERE ID_Person = @ID_Customer
  995. DELETE Telephone WHERE ID_Person = @ID_Customer
  996. DELETE Linkman WHERE ID_Person = @ID_Customer
  997. DELETE Principal WHERE ID_Person = @ID_Customer
  998. DELETE Invoice WHERE ID_Customer = @ID_Customer
  999. DELETE BasicComment WHERE ID_Object = @ID_Customer
  1000. DELETE Customer WHERE ID_Customer = @ID_Customer">
  1001. <Params>
  1002. <Param name="@ID_Customer" type="Customer.ID_Customer" sourceColumn="ID_Customer" />
  1003. </Params>
  1004. </Delete>
  1005. <FKErrorReport ErrorMessage="该客户已被引用,删除失败!"/>
  1006. <UNIQUEErrorReport ErrorMessage="该客户编号已存在,提交失败!"/>
  1007. </Table>
  1008. <Table name="CustomerList" Type="Other">
  1009. <GetSchema CmdType="Text" CmdText=" SELECT Top 0 No_Customer,ShortName_Customer From Customer"/>
  1010. </Table>
  1011. <Table name="Linkman" Type="Child">
  1012. <GetSchema CmdType="Text" CmdText="SELECT top 0 Linkman.*,Convert(nvarchar(64),'') As IsMainStr_Linkman FROM Linkman" />
  1013. <New CmdType="Text" CmdText=" INSERT INTO Linkman (ID_Linkman
  1014. ,ID_Person
  1015. ,Name_Linkman
  1016. ,Department_Linkman
  1017. ,Duty_Linkman
  1018. ,Tel_Linkman
  1019. ,Fax_Linkman
  1020. ,Mobile_Linkman
  1021. ,Email_Linkman
  1022. ,IsMain_Linkman
  1023. ,Comment_Linkman)
  1024. VALUES(@ID_Linkman
  1025. ,@ID_Person
  1026. ,@Name_Linkman
  1027. ,@Department_Linkman
  1028. ,@Duty_Linkman
  1029. ,@Tel_Linkman
  1030. ,@Fax_Linkman
  1031. ,@Mobile_Linkman
  1032. ,@Email_Linkman
  1033. ,@IsMain_Linkman
  1034. ,@Comment_Linkman)">
  1035. <Params>
  1036. <Param name="@ID_Linkman" type="Linkman.ID_Linkman" sourceColumn="ID_Linkman" />
  1037. <Param name="@ID_Person" type="Linkman.ID_Person" sourceColumn="ID_Person" />
  1038. <Param name="@Name_Linkman" type="Linkman.Name_Linkman" sourceColumn="Name_Linkman" />
  1039. <Param name="@Department_Linkman" type="Linkman.Department_Linkman" sourceColumn="Department_Linkman" />
  1040. <Param name="@Duty_Linkman" type="Linkman.Duty_Linkman" sourceColumn="Duty_Linkman" />
  1041. <Param name="@Tel_Linkman" type="Linkman.Tel_Linkman" sourceColumn="Tel_Linkman" />
  1042. <Param name="@Fax_Linkman" type="Linkman.Fax_Linkman" sourceColumn="Fax_Linkman" />
  1043. <Param name="@Mobile_Linkman" type="Linkman.Mobile_Linkman" sourceColumn="Mobile_Linkman" />
  1044. <Param name="@Email_Linkman" type="Linkman.Email_Linkman" sourceColumn="Email_Linkman" />
  1045. <Param name="@IsMain_Linkman" type="Linkman.IsMain_Linkman" sourceColumn="IsMain_Linkman" />
  1046. <Param name="@Comment_Linkman" type="Linkman.Comment_Linkman" sourceColumn="Comment_Linkman" />
  1047. </Params>
  1048. </New>
  1049. <Update CmdType="Text" CmdText="UPDATE Linkman SET Name_Linkman = @Name_Linkman
  1050. ,Department_Linkman = @Department_Linkman
  1051. ,Duty_Linkman = @Duty_Linkman
  1052. ,Tel_Linkman = @Tel_Linkman
  1053. ,Fax_Linkman = @Fax_Linkman
  1054. ,Mobile_Linkman = @Mobile_Linkman
  1055. ,Email_Linkman = @Email_Linkman
  1056. ,IsMain_Linkman = @IsMain_Linkman
  1057. ,Comment_Linkman = @Comment_Linkman
  1058. WHERE ID_Linkman = @ID_Linkman">
  1059. <Params>
  1060. <Param name="@ID_Linkman" type="Linkman.ID_Linkman" sourceColumn="ID_Linkman" />
  1061. <Param name="@Name_Linkman" type="Linkman.Name_Linkman" sourceColumn="Name_Linkman" />
  1062. <Param name="@Department_Linkman" type="Linkman.Department_Linkman" sourceColumn="Department_Linkman" />
  1063. <Param name="@Duty_Linkman" type="Linkman.Duty_Linkman" sourceColumn="Duty_Linkman" />
  1064. <Param name="@Tel_Linkman" type="Linkman.Tel_Linkman" sourceColumn="Tel_Linkman" />
  1065. <Param name="@Fax_Linkman" type="Linkman.Fax_Linkman" sourceColumn="Fax_Linkman" />
  1066. <Param name="@Mobile_Linkman" type="Linkman.Mobile_Linkman" sourceColumn="Mobile_Linkman" />
  1067. <Param name="@Email_Linkman" type="Linkman.Email_Linkman" sourceColumn="Email_Linkman" />
  1068. <Param name="@IsMain_Linkman" type="Linkman.IsMain_Linkman" sourceColumn="IsMain_Linkman" />
  1069. <Param name="@Comment_Linkman" type="Linkman.Comment_Linkman" sourceColumn="Comment_Linkman" />
  1070. </Params>
  1071. </Update>
  1072. <Delete CmdType="Text" CmdText="DELETE Linkman WHERE ID_Linkman=@ID_Linkman">
  1073. <Params>
  1074. <Param name="@ID_Linkman" type="Linkman.ID_Linkman" sourceColumn="ID_Linkman" />
  1075. </Params>
  1076. </Delete>
  1077. </Table>
  1078. <Table name="Principal" Type="Child">
  1079. <GetSchema CmdType="Text" CmdText="SELECT top 0 Principal.*,Convert(nvarchar(64),'') As IsMainStr_Principal
  1080. ,Employee.Name_Employee AS Name_Employee, Employee.No_Employee AS No_Employee
  1081. FROM Principal
  1082. INNER JOIN Employee ON Employee.ID_Employee = Principal.ID_Employee" />
  1083. <New CmdType="Text" CmdText=" INSERT INTO Principal (ID_Principal
  1084. ,ID_Person
  1085. ,ID_Employee
  1086. ,IsMain_Principal
  1087. ,Comment_Principal)
  1088. VALUES(@ID_Principal
  1089. ,@ID_Person
  1090. ,@ID_Employee
  1091. ,@IsMain_Principal
  1092. ,@Comment_Principal)" >
  1093. <Params>
  1094. <Param name="@ID_Principal" type="Principal.ID_Principal" sourceColumn="ID_Principal" />
  1095. <Param name="@ID_Person" type="Principal.ID_Person" sourceColumn="ID_Person" />
  1096. <Param name="@ID_Employee" type="Principal.ID_Employee" sourceColumn="ID_Employee" />
  1097. <Param name="@IsMain_Principal" type="Principal.IsMain_Principal" sourceColumn="IsMain_Principal" />
  1098. <Param name="@Comment_Principal" type="Principal.Comment_Principal" sourceColumn="Comment_Principal" />
  1099. </Params>
  1100. </New>
  1101. <Update CmdType="Text" CmdText="UPDATE Principal SET ID_Employee = @ID_Employee
  1102. ,IsMain_Principal = @IsMain_Principal
  1103. ,Comment_Principal = @Comment_Principal
  1104. WHERE ID_Principal = @ID_Principal">
  1105. <Params>
  1106. <Param name="@ID_Principal" type="Principal.ID_Principal" sourceColumn="ID_Principal" />
  1107. <Param name="@ID_Employee" type="Principal.ID_Employee" sourceColumn="ID_Employee" />
  1108. <Param name="@IsMain_Principal" type="Principal.IsMain_Principal" sourceColumn="IsMain_Principal" />
  1109. <Param name="@Comment_Principal" type="Principal.Comment_Principal" sourceColumn="Comment_Principal" />
  1110. </Params>
  1111. </Update>
  1112. <Delete CmdType="Text" CmdText="DELETE Principal WHERE ID_Principal = @ID_Principal">
  1113. <Params>
  1114. <Param name="@ID_Principal" type="Principal.ID_Principal" sourceColumn="ID_Principal" />
  1115. </Params>
  1116. </Delete>
  1117. </Table>
  1118. <Table name="Invoice" Type="Child">
  1119. <GetSchema CmdType="Text" CmdText="SELECT top 0 Invoice.*,'' As IsCommon_Invoice FROM Invoice" />
  1120. <New CmdType="Text" CmdText=" INSERT INTO Invoice (ID_Invoice
  1121. ,ID_Customer
  1122. ,Title_Invoice
  1123. ,Address_Invoice
  1124. ,Common_Invoice
  1125. ,Comment_Invoice
  1126. ,Tel_Invoice
  1127. ,Linkman_Invoice)
  1128. VALUES (@ID_Invoice
  1129. ,@ID_Customer
  1130. ,@Title_Invoice
  1131. ,@Address_Invoice
  1132. ,@Common_Invoice
  1133. ,@Comment_Invoice
  1134. ,@Tel_Invoice
  1135. ,@Linkman_Invoice)" >
  1136. <Params>
  1137. <Param name="@ID_Invoice" type="Invoice.ID_Invoice" sourceColumn="ID_Invoice" />
  1138. <Param name="@ID_Customer" type="Invoice.ID_Customer" sourceColumn="ID_Customer" />
  1139. <Param name="@Title_Invoice" type="Invoice.Title_Invoice" sourceColumn="Title_Invoice" />
  1140. <Param name="@Address_Invoice" type="Invoice.Address_Invoice" sourceColumn="Address_Invoice" />
  1141. <Param name="@Common_Invoice" type="Invoice.Common_Invoice" sourceColumn="Common_Invoice" />
  1142. <Param name="@Comment_Invoice" type="Invoice.Comment_Invoice" sourceColumn="Comment_Invoice" />
  1143. <Param name="@Tel_Invoice" type="Invoice.Tel_Invoice" sourceColumn="Tel_Invoice" />
  1144. <Param name="@Linkman_Invoice" type="Invoice.Linkman_Invoice" sourceColumn="Linkman_Invoice" />
  1145. </Params>
  1146. </New>
  1147. <Update CmdType="Text" CmdText="UPDATE Invoice SET ID_Customer = @ID_Customer
  1148. ,Title_Invoice = @Title_Invoice
  1149. ,Address_Invoice = @Address_Invoice
  1150. ,Common_Invoice = @Common_Invoice
  1151. ,Comment_Invoice = @Comment_Invoice
  1152. ,Tel_Invoice=@Tel_Invoice
  1153. ,Linkman_Invoice=@Linkman_Invoice
  1154. WHERE ID_Invoice = @ID_Invoice">
  1155. <Params>
  1156. <Param name="@ID_Invoice" type="Invoice.ID_Invoice" sourceColumn="ID_Invoice" />
  1157. <Param name="@ID_Customer" type="Invoice.ID_Customer" sourceColumn="ID_Customer" />
  1158. <Param name="@Title_Invoice" type="Invoice.Title_Invoice" sourceColumn="Title_Invoice" />
  1159. <Param name="@Address_Invoice" type="Invoice.Address_Invoice" sourceColumn="Address_Invoice" />
  1160. <Param name="@Common_Invoice" type="Invoice.Common_Invoice" sourceColumn="Common_Invoice" />
  1161. <Param name="@Comment_Invoice" type="Invoice.Comment_Invoice" sourceColumn="Comment_Invoice" />
  1162. <Param name="@Tel_Invoice" type="Invoice.Tel_Invoice" sourceColumn="Tel_Invoice" />
  1163. <Param name="@Linkman_Invoice" type="Invoice.Linkman_Invoice" sourceColumn="Linkman_Invoice" />
  1164. </Params>
  1165. </Update>
  1166. <Delete CmdType="Text" CmdText="DELETE Invoice WHERE ID_Invoice = @ID_Invoice">
  1167. <Params>
  1168. <Param name="@ID_Invoice" type="Invoice.ID_Invoice" sourceColumn="ID_Invoice" />
  1169. </Params>
  1170. </Delete>
  1171. </Table>
  1172. <Table name="Fax" Type="Association">
  1173. <GetSchema CmdType="Text" CmdText="SELECT top 0 * FROM Fax" />
  1174. <New CmdType="Text" CmdText=" INSERT INTO Fax (ID_Fax
  1175. ,ID_Person
  1176. ,Name_Fax
  1177. ,No_Fax
  1178. ,Focus_Fax)
  1179. VALUES(@ID_Fax
  1180. ,@ID_Person
  1181. ,@Name_Fax
  1182. ,@No_Fax
  1183. ,@Focus_Fax)">
  1184. <Params>
  1185. <Param name="@ID_Fax" type="Fax.ID_Fax" sourceColumn="ID_Fax" />
  1186. <Param name="@ID_Person" type="Fax.ID_Person" sourceColumn="ID_Person" />
  1187. <Param name="@Name_Fax" type="Fax.Name_Fax" sourceColumn="Name_Fax" />
  1188. <Param name="@No_Fax" type="Fax.No_Fax" sourceColumn="No_Fax" />
  1189. <Param name="@Focus_Fax" type="Fax.Focus_Fax" sourceColumn="Focus_Fax" />
  1190. </Params>
  1191. </New>
  1192. <Update CmdType="Text" CmdText="UPDATE Fax SET Name_Fax=@Name_Fax
  1193. ,No_Fax=@No_Fax
  1194. ,Focus_Fax=@Focus_Fax
  1195. WHERE ID_Fax=@ID_Fax">
  1196. <Params>
  1197. <Param name="@ID_Fax" type="Fax.ID_Fax" sourceColumn="ID_Fax" />
  1198. <Param name="@Name_Fax" type="Fax.Name_Fax" sourceColumn="Name_Fax" />
  1199. <Param name="@No_Fax" type="Fax.No_Fax" sourceColumn="No_Fax" />
  1200. <Param name="@Focus_Fax" type="Fax.Focus_Fax" sourceColumn="Focus_Fax" />
  1201. </Params>
  1202. </Update>
  1203. <Delete CmdType="Text" CmdText="DELETE Fax WHERE ID_Fax=@ID_Fax">
  1204. <Params>
  1205. <Param name="@ID_Fax" type="Fax.ID_Fax" sourceColumn="ID_Fax" />
  1206. </Params>
  1207. </Delete>
  1208. <FKErrorReport ErrorMessage="本记录被其他单据使用过,不能删除!"/>
  1209. <UNIQUEErrorReport ErrorMessage="传真名称或传真号码已经存在!"/>
  1210. </Table>
  1211. <Table name="Telephone" Type="Association">
  1212. <GetSchema CmdType="Text" CmdText="SELECT top 0 * FROM Telephone" />
  1213. <New CmdType="Text" CmdText=" INSERT INTO Telephone (ID_Telephone
  1214. ,ID_Person
  1215. ,Name_Telephone
  1216. ,No_Telephone
  1217. ,Focus_Telephone)
  1218. VALUES(@ID_Telephone
  1219. ,@ID_Person
  1220. ,@Name_Telephone
  1221. ,@No_Telephone
  1222. ,@Focus_Telephone)">
  1223. <Params>
  1224. <Param name="@ID_Telephone" type="Telephone.ID_Telephone" sourceColumn="ID_Telephone" />
  1225. <Param name="@ID_Person" type="Telephone.ID_Person" sourceColumn="ID_Person" />
  1226. <Param name="@Name_Telephone" type="Telephone.Name_Telephone" sourceColumn="Name_Telephone" />
  1227. <Param name="@No_Telephone" type="Telephone.No_Telephone" sourceColumn="No_Telephone" />
  1228. <Param name="@Focus_Telephone" type="Telephone.Focus_Telephone" sourceColumn="Focus_Telephone" />
  1229. </Params>
  1230. </New>
  1231. <Update CmdType="Text" CmdText="UPDATE Telephone SET Name_Telephone=@Name_Telephone
  1232. ,No_Telephone=@No_Telephone
  1233. ,Focus_Telephone=@Focus_Telephone
  1234. WHERE ID_Telephone=@ID_Telephone">
  1235. <Params>
  1236. <Param name="@ID_Telephone" type="Telephone.ID_Telephone" sourceColumn="ID_Telephone" />
  1237. <Param name="@Name_Telephone" type="Telephone.Name_Telephone" sourceColumn="Name_Telephone" />
  1238. <Param name="@No_Telephone" type="Telephone.No_Telephone" sourceColumn="No_Telephone" />
  1239. <Param name="@Focus_Telephone" type="Telephone.Focus_Telephone" sourceColumn="Focus_Telephone" />
  1240. </Params>
  1241. </Update>
  1242. <Delete CmdType="Text" CmdText="DELETE Telephone WHERE ID_Telephone=@ID_Telephone">
  1243. <Params>
  1244. <Param name="@ID_Telephone" type="Telephone.ID_Telephone" sourceColumn="ID_Telephone" />
  1245. </Params>
  1246. </Delete>
  1247. <FKErrorReport ErrorMessage="本记录被其他单据使用过,不能删除!"/>
  1248. <UNIQUEErrorReport ErrorMessage="电话名称或电话号码已经存在!"/>
  1249. </Table>
  1250. <Table name="Employee" Type="Other">
  1251. <GetSchema CmdType="Text" CmdText="SELECT top 0 * FROM Employee" />
  1252. </Table>
  1253. <Table name="ExchangeBill" Type="Other">
  1254. <GetSchema CmdType="Text" CmdText="SELECT Top 0 Date_SaleBill as Date
  1255. ,convert(nvarchar(64),'') as Name_Bill
  1256. ,convert(nvarchar(64),'') as No_Bill
  1257. ,convert(nvarchar(64),'') as ConsultNo
  1258. ,convert(nvarchar(64),'')as Principal
  1259. ,convert(decimal,0.00) as Money
  1260. ,convert(nvarchar(200),'')as Comment
  1261. FROM SaleBill" />
  1262. </Table>
  1263. <Table name="ExchangeProduct" Type="Other">
  1264. <GetSchema CmdType="Text" CmdText="SELECT Top 0 convert(nvarchar(64),'') as No_Product
  1265. ,convert(nvarchar(64),'') as Name_Product
  1266. ,Date_SaleBill as Date,convert(nvarchar(64),'') as Name_Bill
  1267. ,convert(nvarchar(64),'') as No_Bill
  1268. ,convert(nvarchar(64),'') as TaxCurrency
  1269. ,convert(decimal,0.00) as Num
  1270. ,convert(decimal,0.00) as Price
  1271. ,convert(decimal,0.00) as Moeny
  1272. ,convert(nvarchar(200),'')as Comment
  1273. FROM SaleBill" />
  1274. </Table>
  1275. <Table name="BasicComment" Type="Child">
  1276. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 BasicComment.* FROM BasicComment"/>
  1277. <New CmdType="Text" CmdText=" INSERT INTO BasicComment (ID_BasicComment
  1278. ,ID_Object
  1279. ,Comment_BasicComment)
  1280. VALUES (@ID_BasicComment
  1281. ,@ID_Object
  1282. ,@Comment_BasicComment)">
  1283. <Params>
  1284. <Param name="@ID_BasicComment" type="BasicComment.ID_BasicComment" sourceColumn="ID_BasicComment" />
  1285. <Param name="@ID_Object" type="BasicComment.ID_Object" sourceColumn="ID_Object" />
  1286. <Param name="@Comment_BasicComment" type="BasicComment.Comment_BasicComment" sourceColumn="Comment_BasicComment" />
  1287. </Params>
  1288. </New>
  1289. <Update CmdType="Text" CmdText=" UPDATE BasicComment SET ID_Object = @ID_Object
  1290. ,Comment_BasicComment = @Comment_BasicComment
  1291. WHERE ID_BasicComment = @ID_BasicComment">
  1292. <Params>
  1293. <Param name="@ID_BasicComment" type="BasicComment.ID_BasicComment" sourceColumn="ID_BasicComment" />
  1294. <Param name="@ID_Object" type="BasicComment.ID_Object" sourceColumn="ID_Object" />
  1295. <Param name="@Comment_BasicComment" type="BasicComment.Comment_BasicComment" sourceColumn="Comment_BasicComment" />
  1296. </Params>
  1297. </Update>
  1298. <Delete CmdType="Text" CmdText=" DELETE BasicComment WHERE ID_BasicComment = @ID_BasicComment">
  1299. <Params>
  1300. <Param name="@ID_BasicComment" type="BasicComment.ID_BasicComment" sourceColumn="ID_BasicComment" />
  1301. </Params>
  1302. </Delete>
  1303. </Table>
  1304. <Table name="CustomerInfo" Type="Child">
  1305. <GetSchema CmdType="Text" CmdText="Select Top 0 CustomerInfo.*
  1306. ,Convert(Nvarchar(64),'') As Type_CustomerInfo
  1307. From CustomerInfo"/>
  1308. <New CmdType="Text" CmdText="">
  1309. </New>
  1310. </Table>
  1311. </Tables>
  1312. <Search>
  1313. <SearchDefaultPhone CmdType="Text" CmdText="Select newid() as ID_Telephone
  1314. ,CAST('{00000000-0000-0000-0000-000000000000}' AS uniqueidentifier) as ID_Person
  1315. ,CAST(Name_TypeDef AS NVARCHAR(64))As Name_Telephone
  1316. ,CAST(''AS NVARCHAR(128)) As No_Telephone
  1317. ,CAST(0 AS bit) As Focus_Telephone
  1318. From TypeDef
  1319. Where Type_TypeDef = 24">
  1320. <Tables>
  1321. <Table name="DefaultTelephone" />
  1322. </Tables>
  1323. </SearchDefaultPhone>
  1324. <SearchDefaultFax CmdType="Text" CmdText="Select newid() as ID_Fax
  1325. ,CAST('{00000000-0000-0000-0000-000000000000}' AS uniqueidentifier) as ID_Person
  1326. ,CAST(Name_TypeDef AS NVARCHAR(64)) As Name_Fax
  1327. ,CAST(''AS NVARCHAR(128)) As No_Fax
  1328. ,CAST(0 AS bit) As Focus_Fax
  1329. From TypeDef
  1330. Where Type_TypeDef = 25
  1331. order by No_TypeDef">
  1332. <Tables>
  1333. <Table name="DefaultFax" />
  1334. </Tables>
  1335. </SearchDefaultFax>
  1336. <SearchAllCustomer CmdType="Text" CmdText=" SELECT Customer.*,RegionalLeader.No_RegionalLeader
  1337. ,RegionalLeader.Name_RegionalLeader,Linkman.Name_Linkman
  1338. ,Linkman.Tel_Linkman,No_Telephone
  1339. ,Employee.No_Employee as No_Employee
  1340. --,Employee.Name_Employee as Name_Employee
  1341. ,case Principal.IsMain_Principal when 1 then Employee.Name_Employee
  1342. else null end as Name_Employee
  1343. FROM
  1344. (
  1345. SELECT Customer.ID_Customer,Customer.No_Customer
  1346. ,Customer.ShortName_Customer,Customer.Zone_Customer
  1347. ,Customer.SendAddr_Customer,RegistedAddress_Customer
  1348. ,SuspendDate_Customer
  1349. ,ID_Linkman=(Select Top 1 ID_Linkman From Linkman Where ID_Person=Customer.ID_Customer And IsMain_Linkman=1 order by name_linkman)
  1350. ,LastPrincipal_Customer,Type_Customer,GetMethod_Customer
  1351. ,Level_Customer
  1352. ,ID_RegionalLeader =(select Top 1 ID_RegionalLeader from RegionalLeader where ID_RegionalLeader = Customer.ID_RegionalLeader)
  1353. ,PayLimit_Customer
  1354. ,LowDiscount_Customer
  1355. ,DunDate_Customer
  1356. ,Company_Customer
  1357. ,Comment_Customer
  1358. From Customer
  1359. )Customer
  1360. LEFT JOIN RegionalLeader on RegionalLeader.ID_RegionalLeader = Customer.ID_RegionalLeader
  1361. Left Join Linkman On Customer.ID_Linkman=Linkman.ID_Linkman
  1362. LEFT JOIN Telephone ON Telephone.ID_Person = Customer.ID_Customer and Focus_Telephone = 1
  1363. --Left Join Employee On Employee.ID_Employee = Customer.LastPrincipal_Customer
  1364. left join Principal on Principal.ID_Person= Customer.ID_Customer and IsMain_Principal = 1
  1365. Left Join Employee On Employee.ID_Employee = Principal.ID_Employee
  1366. ">
  1367. <Tables>
  1368. <Table name="AllCustomer" />
  1369. </Tables>
  1370. </SearchAllCustomer>
  1371. <SearchAllRegionalLeader CmdType="Text" CmdText="SELECT RegionalLeader.*
  1372. FROM
  1373. (
  1374. SELECT RegionalLeader.ID_RegionalLeader
  1375. ,RegionalLeader.No_RegionalLeader
  1376. ,RegionalLeader.Name_RegionalLeader
  1377. From RegionalLeader
  1378. )RegionalLeader
  1379. ">
  1380. <Tables>
  1381. <Table name="AllRegionalLeader" />
  1382. </Tables>
  1383. </SearchAllRegionalLeader>
  1384. <SearchCustomerList CmdType="Text" CmdText=" Select No_Customer,ShortName_Customer
  1385. From Customer
  1386. Where SuspendDate_Customer Is Null
  1387. and Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right">
  1388. <Params>
  1389. <Param name="@Right" type="SaleBill.ID_Customer" Index="0" />
  1390. </Params>
  1391. <Tables>
  1392. <Table name="CustomerList"/>
  1393. </Tables>
  1394. </SearchCustomerList>
  1395. <SearchAllCustomerList CmdType="Text" CmdText=" Select No_Customer,ShortName_Customer
  1396. From Customer
  1397. where Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right">
  1398. <Params>
  1399. <Param name="@Right" type="SaleBill.ID_Customer" Index="0" />
  1400. </Params>
  1401. <Tables>
  1402. <Table name="CustomerList"/>
  1403. </Tables>
  1404. </SearchAllCustomerList>
  1405. <SearchIsMain CmdType="Text" CmdText=" Create Table #IsMain
  1406. (
  1407. Result nvarchar(64),
  1408. Value bit
  1409. )
  1410. Insert into #IsMain Values('是',1)
  1411. Insert into #IsMain Values('否',0)
  1412. Select * From #IsMain
  1413. Drop Table #IsMain">
  1414. <Tables>
  1415. <Table name="IsMain" />
  1416. </Tables>
  1417. </SearchIsMain>
  1418. <SearchRegionalLeaderWithNo CmdType="Text" CmdText="IF object_id('tempdb..#Principal') IS NOT NULL
  1419. drop table #Principal
  1420. Create table #Principal
  1421. (ID_RegionalLeader Uniqueidentifier
  1422. ,ID_Employee Uniqueidentifier)
  1423. declare @ID_RegionalLeader Uniqueidentifier
  1424. declare @No_RegionalLeader nvarchar(64)
  1425. declare @ID_Employee Uniqueidentifier
  1426. Declare Cur Cursor for Select Distinct ID_RegionalLeader
  1427. From Principal Where IsMain_Principal = 1
  1428. Open Cur
  1429. Fetch Next From Cur Into @ID_RegionalLeader
  1430. While @@FETCH_STATUS = 0
  1431. Begin
  1432. Select Top 1 @ID_Employee = ID_Employee
  1433. From Principal
  1434. Where ID_RegionalLeader = @ID_RegionalLeader
  1435. And IsMain_Principal = 1
  1436. Insert Into #Principal(ID_RegionalLeader,ID_Employee)
  1437. Values(@ID_RegionalLeader,@ID_Employee)
  1438. Fetch Next From Cur Into @ID_RegionalLeader
  1439. End
  1440. Close Cur
  1441. Deallocate Cur
  1442. SELECT RegionalLeader.ID_RegionalLeader, RegionalLeader.No_RegionalLeader
  1443. ,RegionalLeader.Name_RegionalLeader
  1444. ,Employee.Name_Employee,Employee.No_Employee
  1445. ,Employee.ID_Employee As ID_Employee
  1446. FROM RegionalLeader
  1447. Left Join #Principal On #Principal.ID_RegionalLeader = RegionalLeader.ID_RegionalLeader
  1448. Left join Employee On Employee.ID_Employee = #Principal.ID_Employee
  1449. WHERE RegionalLeader.No_RegionalLeader = @No_RegionalLeader
  1450. SELECT @ID_RegionalLeader = RegionalLeader.ID_RegionalLeader
  1451. FROM RegionalLeader WHERE RegionalLeader.No_RegionalLeader = @No_RegionalLeader
  1452. Drop table #Principal
  1453. ">
  1454. <Params>
  1455. <Param name="@No_Regionalleader" type="Regionalleader.No_Regionalleader" Index="0" />
  1456. </Params>
  1457. <Tables>
  1458. <Table name="Regionalleader" />
  1459. </Tables>
  1460. </SearchRegionalLeaderWithNo>
  1461. <SearchPrincipal CmdType="Text" CmdText=" SELECT Employee.No_Employee AS No_Principal
  1462. ,Employee.Name_Employee AS Principal_PriceQueryBill
  1463. FROM Principal
  1464. INNER JOIN Employee ON Employee.ID_Employee = Principal.ID_Employee
  1465. INNER JOIN Customer ON Customer.ID_Customer = Principal.ID_Person
  1466. WHERE Customer.No_Customer = @No_Customer">
  1467. <Params>
  1468. <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
  1469. </Params>
  1470. <Tables>
  1471. <Table name="Principal" />
  1472. </Tables>
  1473. </SearchPrincipal>
  1474. <SearchCustomerWithNo CmdType="Text" CmdText=" DECLARE @ID_Customer uniqueidentifier
  1475. SELECT Customer.*,RegionalLeader.No_RegionalLeader
  1476. ,RegionalLeader.Name_RegionalLeader
  1477. ,A.Name_User AS CreatorName_Customer
  1478. ,B.Name_User As LastModUser
  1479. ,Employee.No_Employee as No_Employee
  1480. ,Employee.Name_Employee as Name_Employee
  1481. ,ct.No_Customer as No2_Customer
  1482. ,ct.ShortName_Customer as ShortName2_Customer
  1483. FROM Customer
  1484. LEFT JOIN RegionalLeader on RegionalLeader.ID_RegionalLeader = Customer.ID_RegionalLeader
  1485. LEFT JOIN AppUser A ON A.ID_User = Customer.ID_Creator
  1486. LEFT Join AppUser B ON B.ID_User=Customer.LastModUser_Customer
  1487. LEFT JOIN Employee on Employee.ID_Employee = Customer.LastPrincipal_Customer
  1488. left join Customer ct on Customer.CustomerID_Customer = ct.ID_Customer
  1489. Where Customer.No_Customer=@No_Customer
  1490. SELECT @ID_Customer = Customer.ID_Customer
  1491. FROM Customer
  1492. WHERE Customer.No_Customer = @No_Customer
  1493. SELECT * FROM Telephone
  1494. WHERE Telephone.ID_Person = @ID_Customer
  1495. SELECT * FROM Fax
  1496. WHERE Fax.ID_Person = @ID_Customer
  1497. SELECT Linkman.*
  1498. ,Case When Linkman.IsMain_Linkman = 1 Then '是' Else '否' End As IsMainStr_Linkman
  1499. FROM Linkman
  1500. WHERE Linkman.ID_Person = @ID_Customer
  1501. order by name_linkman
  1502. SELECT Principal.*
  1503. ,Case When Principal.IsMain_Principal = 1 Then '是' Else '否' End As IsMainStr_Principal
  1504. ,Employee.Name_Employee AS Name_Employee
  1505. ,Employee.No_Employee AS No_Employee
  1506. FROM Principal
  1507. INNER JOIN Employee ON Employee.ID_Employee = Principal.ID_Employee
  1508. WHERE Principal.ID_Person = @ID_Customer
  1509. SELECT Invoice.*
  1510. ,Case When Invoice.Common_Invoice = 1 Then '是' Else '否' End As IsCommon_Invoice
  1511. FROM Invoice
  1512. WHERE ID_Customer = @ID_Customer
  1513. SELECT BasicComment.* FROM BasicComment
  1514. WHERE BasicComment.ID_Object = @ID_Customer
  1515. order by BasicComment.No_BasicComment
  1516. Select CustomerInfo.*,
  1517. Case IsProduct_CustomerInfo When 1 then '生产 ' else '' End +
  1518. Case IsSpecial_CustomerInfo When 1 Then ' 专门代工 ' Else '' End +
  1519. Case IsNormal_CustomerInfo When 1 Then ' 一般代工 ' Else '' End AS Type_CustomerInfo
  1520. From dbo.CustomerInfo Where ID_Customer = @ID_Customer
  1521. Order By No_CustomerInfo">
  1522. <Params>
  1523. <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
  1524. </Params>
  1525. <Tables>
  1526. <Table name="Customer" />
  1527. <Table name="Telephone" />
  1528. <Table name="Fax"/>
  1529. <Table name="Linkman" />
  1530. <Table name="Principal"/>
  1531. <Table name="Invoice"/>
  1532. <Table name="BasicComment"/>
  1533. <Table name="CustomerInfo"/>
  1534. </Tables>
  1535. </SearchCustomerWithNo>
  1536. <SearchCustomerWithNo2 CmdType="Text" CmdText="SELECT Customer.*,ct.No_Customer as No2_Customer
  1537. ,ct.ShortName_Customer as ShortName2_Customer
  1538. FROM Customer
  1539. left join Customer ct on Customer.CustomerID_Customer = ct.ID_Customer
  1540. WHERE Customer.No_Customer=@No_Customer
  1541. ">
  1542. <Params>
  1543. <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
  1544. </Params>
  1545. <Tables>
  1546. <Table name="Customer2"></Table>
  1547. </Tables>
  1548. </SearchCustomerWithNo2>
  1549. <SearchCustomerWithNo3 CmdType="Text" CmdText=" DECLARE @ID_Customer Uniqueidentifier
  1550. SELECT @ID_Customer=ID_Customer FROM Customer
  1551. where No_Customer=@No_Customer
  1552. SELECT No_Customer FROM Customer
  1553. WHERE Customer.ID_Customer in (SELECT ID_Customer FROM PreGet WHERE ID_Customer=@ID_Customer)
  1554. or Customer.ID_Customer in (SELECT ID_Customer FROM SaleInvoice WHERE ID_Customer=@ID_Customer and Disable_SaleInvoice=0)
  1555. ">
  1556. <Params>
  1557. <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
  1558. </Params>
  1559. <Tables>
  1560. <Table name="Customer3"></Table>
  1561. </Tables>
  1562. </SearchCustomerWithNo3>
  1563. <SearchCustomerWithNo4 CmdType="Text" CmdText="SELECT Customer.No_Customer,Customer.Company_Customer,ct.No_Customer as No2_Customer
  1564. FROM Customer
  1565. left join Customer ct on Customer.CustomerID_Customer = ct.ID_Customer
  1566. WHERE Customer.No_Customer=@No_Customer
  1567. ">
  1568. <Params>
  1569. <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
  1570. </Params>
  1571. <Tables>
  1572. <Table name="Customer4"></Table>
  1573. </Tables>
  1574. </SearchCustomerWithNo4>
  1575. <SearchCustomerNext CmdType="Text" CmdText=" DECLARE @ID_Customer uniqueidentifier
  1576. DECLARE @NextNo nvarchar(64)
  1577. SET @NextNo = @No_Customer
  1578. SELECT TOP 1 @NextNo = Customer.No_Customer
  1579. FROM Customer
  1580. WHERE Customer.No_Customer &gt; @No_Customer
  1581. and Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right
  1582. and Customer.ID_RegionalLeader in
  1583. (Select ID_RegionalLeader From Principal
  1584. Where ID_Employee in(select ID_Employee from Employee where Name_Employee=@Name_Employee)
  1585. )
  1586. ORDER BY Customer.No_Customer
  1587. SELECT Customer.*,A.Name_User AS CreatorName_Customer
  1588. ,B.Name_User As LastModUser
  1589. ,No_RegionalLeader As No_RegionalLeader
  1590. ,Name_RegionalLeader As Name_RegionalLeader
  1591. ,Employee.No_Employee AS No_Employee
  1592. ,Employee.Name_Employee as Name_Employee
  1593. ,ct.No_Customer as No2_Customer
  1594. ,ct.ShortName_Customer as ShortName2_Customer
  1595. FROM Customer
  1596. LEFT JOIN AppUser A ON A.ID_User = Customer.ID_Creator
  1597. LEFT Join AppUser B ON B.ID_User=Customer.LastModUser_Customer
  1598. LEFT JOIN RegionalLeader on RegionalLeader.ID_RegionalLeader = Customer.ID_RegionalLeader
  1599. LEFT JOIN Employee on Employee.ID_Employee = Customer.LastPrincipal_Customer
  1600. left join Customer ct on Customer.CustomerID_Customer = ct.ID_Customer
  1601. Where Customer.No_Customer=@NextNo
  1602. SELECT @ID_Customer = Customer.ID_Customer
  1603. FROM Customer
  1604. WHERE Customer.No_Customer = @NextNo
  1605. SELECT * FROM Telephone
  1606. WHERE Telephone.ID_Person = @ID_Customer
  1607. SELECT * FROM Fax
  1608. WHERE Fax.ID_Person = @ID_Customer
  1609. SELECT Linkman.*
  1610. ,Case When Linkman.IsMain_Linkman = 1 Then '是' Else '否' End As IsMainStr_Linkman
  1611. FROM Linkman
  1612. WHERE Linkman.ID_Person = @ID_Customer
  1613. order by name_linkman
  1614. SELECT Principal.*
  1615. ,Case When Principal.IsMain_Principal = 1 Then '是' Else '否' End As IsMainStr_Principal
  1616. ,Employee.Name_Employee AS Name_Employee
  1617. ,Employee.No_Employee AS No_Employee
  1618. FROM Principal
  1619. INNER JOIN Employee ON Employee.ID_Employee = Principal.ID_Employee
  1620. WHERE Principal.ID_Person = @ID_Customer
  1621. SELECT Invoice.*
  1622. ,Case When Invoice.Common_Invoice = 1 Then '是' Else '否' End As IsCommon_Invoice
  1623. FROM Invoice
  1624. WHERE ID_Customer = @ID_Customer
  1625. SELECT BasicComment.* FROM BasicComment
  1626. WHERE BasicComment.ID_Object = @ID_Customer
  1627. order by BasicComment.No_BasicComment
  1628. Select CustomerInfo.*,
  1629. Case IsProduct_CustomerInfo When 1 then '生产 ' else '' End +
  1630. Case IsSpecial_CustomerInfo When 1 Then ' 专门代工 ' Else '' End +
  1631. Case IsNormal_CustomerInfo When 1 Then ' 一般代工 ' Else '' End AS Type_CustomerInfo
  1632. From dbo.CustomerInfo Where ID_Customer = @ID_Customer
  1633. Order By No_CustomerInfo">
  1634. <Params>
  1635. <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
  1636. <Param name="@Right" type="SaleBill.ID_Customer" Index="1" />
  1637. <Param name="@Name_Employee" type="Employee.Name_Employee" Index="2" />
  1638. </Params>
  1639. <Tables>
  1640. <Table name="Customer" />
  1641. <Table name="Telephone" />
  1642. <Table name="Fax"/>
  1643. <Table name="Linkman" />
  1644. <Table name="Principal"/>
  1645. <Table name="Invoice"/>
  1646. <Table name="BasicComment"/>
  1647. <Table name="CustomerInfo"/>
  1648. </Tables>
  1649. </SearchCustomerNext>
  1650. <SearchCustomerPrevious CmdType="Text" CmdText=" DECLARE @ID_Customer uniqueidentifier
  1651. DECLARE @NextNo nvarchar(64)
  1652. SET @NextNo = @No_Customer
  1653. SELECT TOP 1 @NextNo = Customer.No_Customer FROM Customer WHERE Customer.No_Customer &lt; @No_Customer and Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right
  1654. and Customer.ID_RegionalLeader in
  1655. (Select ID_RegionalLeader From Principal
  1656. Where ID_Employee in(select ID_Employee from Employee where Name_Employee=@Name_Employee)
  1657. )
  1658. ORDER BY Customer.No_Customer Desc
  1659. SELECT Customer.*,A.Name_User AS CreatorName_Customer,B.Name_User As LastModUser
  1660. ,No_RegionalLeader As No_RegionalLeader,Name_RegionalLeader As Name_RegionalLeader
  1661. ,Employee.No_Employee AS No_Employee,Employee.Name_Employee as Name_Employee
  1662. ,ct.No_Customer as No2_Customer , ct.ShortName_Customer as ShortName2_Customer
  1663. FROM Customer
  1664. LEFT JOIN AppUser A ON A.ID_User = Customer.ID_Creator
  1665. LEFT Join AppUser B ON B.ID_User=Customer.LastModUser_Customer
  1666. LEFT JOIN RegionalLeader on RegionalLeader.ID_RegionalLeader = Customer.ID_RegionalLeader
  1667. LEFT JOIN Employee on Employee.ID_Employee = Customer.LastPrincipal_Customer
  1668. left join Customer ct on Customer.CustomerID_Customer = ct.ID_Customer
  1669. where Customer.No_Customer = @NextNo
  1670. SELECT @ID_Customer = Customer.ID_Customer FROM Customer WHERE Customer.No_Customer = @NextNo
  1671. SELECT * FROM Telephone WHERE Telephone.ID_Person = @ID_Customer
  1672. SELECT * FROM Fax WHERE Fax.ID_Person = @ID_Customer
  1673. SELECT Linkman.*,Case When Linkman.IsMain_Linkman = 1 Then '是' Else '否' End As IsMainStr_Linkman FROM Linkman WHERE Linkman.ID_Person = @ID_Customer order by name_linkman
  1674. SELECT Principal.*,Case When Principal.IsMain_Principal = 1 Then '是' Else '否' End As IsMainStr_Principal, Employee.Name_Employee AS Name_Employee, Employee.No_Employee AS No_Employee FROM Principal INNER JOIN Employee ON Employee.ID_Employee = Principal.ID_Employee WHERE Principal.ID_Person = @ID_Customer
  1675. SELECT Invoice.*,Case When Invoice.Common_Invoice = 1 Then '是' Else '否' End As IsCommon_Invoice FROM Invoice WHERE ID_Customer = @ID_Customer
  1676. SELECT BasicComment.* FROM BasicComment WHERE BasicComment.ID_Object = @ID_Customer order by BasicComment.No_BasicComment
  1677. Select CustomerInfo.*,
  1678. Case IsProduct_CustomerInfo When 1 then '生产 ' else '' End +
  1679. Case IsSpecial_CustomerInfo When 1 Then ' 专门代工 ' Else '' End +
  1680. Case IsNormal_CustomerInfo When 1 Then ' 一般代工 ' Else '' End AS Type_CustomerInfo
  1681. From dbo.CustomerInfo Where ID_Customer = @ID_Customer
  1682. Order By No_CustomerInfo">
  1683. <Params>
  1684. <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
  1685. <Param name="@Right" type="SaleBill.ID_Customer" Index="1" />
  1686. <Param name="@Name_Employee" type="Employee.Name_Employee" Index="2" />
  1687. </Params>
  1688. <Tables>
  1689. <Table name="Customer" />
  1690. <Table name="Telephone" />
  1691. <Table name="Fax"/>
  1692. <Table name="Linkman" />
  1693. <Table name="Principal"/>
  1694. <Table name="Invoice"/>
  1695. <Table name="BasicComment"/>
  1696. <Table name="CustomerInfo"/>
  1697. </Tables>
  1698. </SearchCustomerPrevious>
  1699. <SearchCustomerFirst CmdType="Text" CmdText=" DECLARE @ID_Customer uniqueidentifier
  1700. DECLARE @NextNo nvarchar(64)
  1701. SET @NextNo = @No_Customer
  1702. SELECT TOP 1 @NextNo = Customer.No_Customer FROM Customer where Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right
  1703. and Customer.ID_RegionalLeader in
  1704. (Select ID_RegionalLeader From Principal
  1705. Where ID_Employee in(select ID_Employee from Employee where Name_Employee=@Name_Employee)
  1706. )
  1707. ORDER BY Customer.No_Customer
  1708. SELECT Customer.*,A.Name_User AS CreatorName_Customer,B.Name_User As LastModUser
  1709. ,No_RegionalLeader As No_RegionalLeader,Name_RegionalLeader As Name_RegionalLeader
  1710. ,Employee.No_Employee AS No_Employee,Employee.Name_Employee as Name_Employee
  1711. ,ct.No_Customer as No2_Customer , ct.ShortName_Customer as ShortName2_Customer
  1712. FROM Customer
  1713. LEFT JOIN AppUser A ON A.ID_User = Customer.ID_Creator
  1714. LEFT Join AppUser B ON B.ID_User=Customer.LastModUser_Customer
  1715. LEFT JOIN RegionalLeader on RegionalLeader.ID_RegionalLeader = Customer.ID_RegionalLeader
  1716. LEFT JOIN Employee on Employee.ID_Employee = Customer.LastPrincipal_Customer
  1717. left join Customer ct on Customer.CustomerID_Customer = ct.ID_Customer
  1718. Where Customer.No_Customer=@NextNo
  1719. SELECT @ID_Customer = Customer.ID_Customer FROM Customer WHERE Customer.No_Customer = @NextNo
  1720. SELECT * FROM Telephone WHERE Telephone.ID_Person = @ID_Customer
  1721. SELECT * FROM Fax WHERE Fax.ID_Person = @ID_Customer
  1722. SELECT Linkman.*,Case When Linkman.IsMain_Linkman = 1 Then '是' Else '否' End As IsMainStr_Linkman FROM Linkman WHERE Linkman.ID_Person = @ID_Customer order by name_linkman
  1723. SELECT Principal.*,Case When Principal.IsMain_Principal = 1 Then '是' Else '否' End As IsMainStr_Principal, Employee.Name_Employee AS Name_Employee, Employee.No_Employee AS No_Employee FROM Principal INNER JOIN Employee ON Employee.ID_Employee = Principal.ID_Employee WHERE Principal.ID_Person = @ID_Customer
  1724. SELECT Invoice.*,Case When Invoice.Common_Invoice = 1 Then '是' Else '否' End As IsCommon_Invoice FROM Invoice WHERE ID_Customer = @ID_Customer
  1725. SELECT BasicComment.* FROM BasicComment WHERE BasicComment.ID_Object = @ID_Customer order by BasicComment.No_BasicComment
  1726. Select CustomerInfo.*,
  1727. Case IsProduct_CustomerInfo When 1 then '生产 ' else '' End +
  1728. Case IsSpecial_CustomerInfo When 1 Then ' 专门代工 ' Else '' End +
  1729. Case IsNormal_CustomerInfo When 1 Then ' 一般代工 ' Else '' End AS Type_CustomerInfo
  1730. From dbo.CustomerInfo Where ID_Customer = @ID_Customer
  1731. Order By No_CustomerInfo">
  1732. <Params>
  1733. <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
  1734. <Param name="@Right" type="SaleBill.ID_Customer" Index="1" />
  1735. <Param name="@Name_Employee" type="Employee.Name_Employee" Index="2" />
  1736. </Params>
  1737. <Tables>
  1738. <Table name="Customer" />
  1739. <Table name="Telephone" />
  1740. <Table name="Fax"/>
  1741. <Table name="Linkman" />
  1742. <Table name="Principal"/>
  1743. <Table name="Invoice"/>
  1744. <Table name="BasicComment"/>
  1745. <Table name="CustomerInfo"/>
  1746. </Tables>
  1747. </SearchCustomerFirst>
  1748. <SearchCustomerLast CmdType="Text" CmdText=" DECLARE @ID_Customer uniqueidentifier
  1749. DECLARE @NextNo nvarchar(64)
  1750. SET @NextNo = @No_Customer
  1751. SELECT TOP 1 @NextNo = Customer.No_Customer FROM Customer where Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right
  1752. and Customer.ID_RegionalLeader in
  1753. (Select ID_RegionalLeader From Principal
  1754. Where ID_Employee in(select ID_Employee from Employee where Name_Employee=@Name_Employee)
  1755. )
  1756. ORDER BY Customer.No_Customer DESC
  1757. SELECT Customer.*,A.Name_User AS CreatorName_Customer,B.Name_User As LastModUser
  1758. ,No_RegionalLeader As No_RegionalLeader,Name_RegionalLeader As Name_RegionalLeader
  1759. ,Employee.No_Employee AS No_Employee,Employee.Name_Employee as Name_Employee
  1760. ,ct.No_Customer as No2_Customer , ct.ShortName_Customer as ShortName2_Customer
  1761. FROM Customer
  1762. LEFT JOIN AppUser A ON A.ID_User = Customer.ID_Creator
  1763. LEFT Join AppUser B ON B.ID_User=Customer.LastModUser_Customer
  1764. LEFT JOIN RegionalLeader on RegionalLeader.ID_RegionalLeader = Customer.ID_RegionalLeader
  1765. LEFT JOIN Employee on Employee.ID_Employee = Customer.LastPrincipal_Customer
  1766. left join Customer ct on Customer.CustomerID_Customer = ct.ID_Customer
  1767. Where Customer.No_Customer=@NextNo
  1768. SELECT @ID_Customer = Customer.ID_Customer FROM Customer WHERE Customer.No_Customer = @NextNo
  1769. SELECT * FROM Telephone WHERE Telephone.ID_Person = @ID_Customer
  1770. SELECT * FROM Fax WHERE Fax.ID_Person = @ID_Customer
  1771. SELECT Linkman.*,Case When Linkman.IsMain_Linkman = 1 Then '是' Else '否' End As IsMainStr_Linkman FROM Linkman WHERE Linkman.ID_Person = @ID_Customer order by name_linkman
  1772. SELECT Principal.*,Case When Principal.IsMain_Principal = 1 Then '是' Else '否' End As IsMainStr_Principal, Employee.Name_Employee AS Name_Employee, Employee.No_Employee AS No_Employee FROM Principal INNER JOIN Employee ON Employee.ID_Employee = Principal.ID_Employee WHERE Principal.ID_Person = @ID_Customer
  1773. SELECT Invoice.*,Case When Invoice.Common_Invoice = 1 Then '是' Else '否' End As IsCommon_Invoice FROM Invoice WHERE ID_Customer = @ID_Customer
  1774. SELECT BasicComment.* FROM BasicComment WHERE BasicComment.ID_Object = @ID_Customer order by BasicComment.No_BasicComment
  1775. Select CustomerInfo.*,
  1776. Case IsProduct_CustomerInfo When 1 then '生产 ' else '' End +
  1777. Case IsSpecial_CustomerInfo When 1 Then ' 专门代工 ' Else '' End +
  1778. Case IsNormal_CustomerInfo When 1 Then ' 一般代工 ' Else '' End AS Type_CustomerInfo
  1779. From dbo.CustomerInfo Where ID_Customer = @ID_Customer
  1780. Order By No_CustomerInfo">
  1781. <Params>
  1782. <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
  1783. <Param name="@Right" type="SaleBill.ID_Customer" Index="1" />
  1784. <Param name="@Name_Employee" type="Employee.Name_Employee" Index="2" />
  1785. </Params>
  1786. <Tables>
  1787. <Table name="Customer" />
  1788. <Table name="Telephone" />
  1789. <Table name="Fax"/>
  1790. <Table name="Linkman" />
  1791. <Table name="Principal"/>
  1792. <Table name="Invoice"/>
  1793. <Table name="BasicComment"/>
  1794. <Table name="CustomerInfo"/>
  1795. </Tables>
  1796. </SearchCustomerLast>
  1797. <GetEmployeeNameByNo CmdType="Text" CmdText="SELECT Employee.ID_Employee,Employee.No_Employee,Employee.Name_Employee,Employee.SuspendDate_Employee FROM Employee WHERE No_Employee = @No_Employee">
  1798. <Params>
  1799. <Param name="@No_Employee" type="Employee.No_Employee" Index="0" />
  1800. </Params>
  1801. <Tables>
  1802. <Table name="Employee" />
  1803. </Tables>
  1804. </GetEmployeeNameByNo>
  1805. <SearchAreaType CmdType="Text" CmdText="Select * FROM RegionalLeader">
  1806. <Tables>
  1807. <Table name="RegionalLeader" />
  1808. </Tables>
  1809. </SearchAreaType>
  1810. <SearchIndustryType CmdType="Text" CmdText="SELECT * FROM TypeDef WHERE Type_TypeDef = 13">
  1811. <Tables>
  1812. <Table name="IndustryType" />
  1813. </Tables>
  1814. </SearchIndustryType>
  1815. <SearchZoneType CmdType="Text" CmdText="SELECT * FROM TypeDef WHERE Type_TypeDef = 14">
  1816. <Tables>
  1817. <Table name="ZoneType" />
  1818. </Tables>
  1819. </SearchZoneType>
  1820. <SearchType CmdType="Text" CmdText="SELECT * FROM TypeDef WHERE Type_TypeDef = 12">
  1821. <Tables>
  1822. <Table name="Type" />
  1823. </Tables>
  1824. </SearchType>
  1825. <SearchSourceType CmdType="Text" CmdText="SELECT * FROM TypeDef WHERE Type_TypeDef = 15">
  1826. <Tables>
  1827. <Table name="SourceType" />
  1828. </Tables>
  1829. </SearchSourceType>
  1830. <SearchLevelType CmdType="Text" CmdText="SELECT * FROM TypeDef WHERE Type_TypeDef = 16">
  1831. <Tables>
  1832. <Table name="LevelType" />
  1833. </Tables>
  1834. </SearchLevelType>
  1835. <SearchBankType CmdType="Text" CmdText="SELECT * FROM TypeDef WHERE Type_TypeDef = 6">
  1836. <Tables>
  1837. <Table name="BankType" />
  1838. </Tables>
  1839. </SearchBankType>
  1840. <SearchCompanyType CmdType="Text" CmdText=" Select * From TypeDef Where Type_TypeDef = 30">
  1841. <Tables>
  1842. <Table name="CompanyType" />
  1843. </Tables>
  1844. </SearchCompanyType>
  1845. <SearchSystemSetting CmdType="Text" CmdText="SELECT SysCurrency_SystemSetting From SystemSetting">
  1846. <Tables>
  1847. <Table name="SystemSetting"/>
  1848. </Tables>
  1849. </SearchSystemSetting>
  1850. <SearchGetMethodType CmdType="Text" CmdText="CREATE TABLE #TypeDef( Type nvarchar(64)) DECLARE @i int SET @i = 0
  1851. WHILE @i &lt; 6
  1852. BEGIN
  1853. IF(@i=0)
  1854. BEGIN
  1855. INSERT INTO #TypeDef (Type)VALUES('先款后货')
  1856. END
  1857. IF(@i=1)
  1858. BEGIN
  1859. INSERT INTO #TypeDef (Type)VALUES('票到当月结')
  1860. END
  1861. IF(@i=2)
  1862. BEGIN
  1863. INSERT INTO #TypeDef (Type)VALUES('两月结')
  1864. END
  1865. IF(@i=3)
  1866. BEGIN
  1867. INSERT INTO #TypeDef (Type)VALUES('三月结')
  1868. END
  1869. IF(@i=4)
  1870. BEGIN
  1871. INSERT INTO #TypeDef (Type)VALUES('四月结')
  1872. END
  1873. IF(@i=5)
  1874. BEGIN
  1875. INSERT INTO #TypeDef (Type)VALUES('票到付款')
  1876. END
  1877. SET @i = @i + 1
  1878. END
  1879. SELECT Type AS Name_TypeDef FROM #TypeDef
  1880. DROP TABLE #TypeDef">
  1881. <Tables>
  1882. <Table name="GetMethodType" />
  1883. </Tables>
  1884. </SearchGetMethodType>
  1885. <InsertRecord CmdType="Text" CmdText="Create Table Record
  1886. (
  1887. Title_Invoice nvarchar(64),
  1888. Address_Invoice nvarchar(256)
  1889. )
  1890. Insert Into Record(Title_Invoice,Address_Invoice)
  1891. Values(@Title_Invoice,@Address_Invoice)
  1892. Select * From Record
  1893. Drop Table Record
  1894. ">
  1895. <Params>
  1896. <Param name="@Title_Invoice" type="Invoice.Title_Invoice" Index="0" />
  1897. <Param name="@Address_Invoice" type="Invoice.Address_Invoice" Index="1" />
  1898. </Params>
  1899. <Tables>
  1900. <Table name="TempInvoice"/>
  1901. </Tables>
  1902. </InsertRecord>
  1903. <SearchExchangeBill CmdType="Text" CmdText="declare @cmd nvarchar(4000)
  1904. if(@ckNearlyBill=1)
  1905. begin
  1906. set @cmd = N'set rowcount '+convert(nvarchar,@tbNearlyBill) +N' select * from ( '
  1907. end
  1908. else
  1909. begin
  1910. set @cmd = N' select * from ( '
  1911. end
  1912. set @cmd = @cmd+N' SELECT Top 0 Date_SaleBill as Date,convert(nvarchar(64),'+nchar(39)+nchar(39)+N') as Name_Bill,'
  1913. +N' convert(nvarchar(64),'+nchar(39)+nchar(39)+N') as No_Bill,convert(nvarchar(64),'+nchar(39)+nchar(39)+N') as ConsultNo,convert(nvarchar(64),'+nchar(39)+nchar(39)+N')as Principal,'
  1914. +N' convert(decimal,0.00) as Money,SaleBill.ID_Assessor as ID_Assessor,convert(nvarchar(200),'+nchar(39)+nchar(39)+N')as No_Customer '
  1915. +N' FROM SaleBill '
  1916. if(@ckQueryPriceBill = 1)
  1917. begin
  1918. set @cmd = @cmd+N' Union all SELECT A.Date_PriceQueryBill as Date,convert(nvarchar(64),'+nchar(39)+N'报价单'+nchar(39)+N') as Name_Bill,A.No_PriceQueryBill as No_Bill,'
  1919. +N' convert(nvarchar(64),'+nchar(39)+nchar(39)+N') as ConsultNo,Y.Name_Employee as Principal,'
  1920. +N' A.Amount_PriceQueryBill as Money,'
  1921. +N' A.ID_Assessor,X.No_Customer'
  1922. +N' From PriceQueryBill A'
  1923. +N' Left join Employee Y on Y.ID_Employee=A.ID_Principal '
  1924. +N' Left join Customer X on X.ID_Customer = A.ID_Customer '
  1925. if(@RightPriceQueryBill=0)
  1926. set @cmd=@cmd+N' Where Special_PriceQueryBill=0 '
  1927. end
  1928. if(@ckSaleBill = 1)
  1929. begin
  1930. set @cmd = @cmd+N' Union all select A.Date_SaleBill as Date,convert(nvarchar(64),'+nchar(39)+N'销货单'+nchar(39)+N') as Name_Bill,A.No_SaleBill as No_Bill,'
  1931. +N' A.No_OrderBill as ConsultNo,Y.Name_Employee as Principal,'
  1932. +N' A.Amount_SaleBill as Money,'
  1933. +N' A.ID_Assessor,X.No_Customer'
  1934. +N' from SaleBill A'
  1935. +N' Left join Employee Y on Y.ID_Employee=A.ID_Principal '
  1936. +N' Left join Customer X on X.ID_Customer = A.ID_Customer '
  1937. if(@RightSaleBill=0)
  1938. set @cmd=@cmd+N' Where Special_SaleBill=0 '
  1939. end
  1940. if(@ckSaleRtnBill = 1)
  1941. begin
  1942. set @cmd = @cmd+N' Union all select A.Date_SaleRtnBill as Date,convert(nvarchar(64),'+nchar(39)+N'销售退货单'+nchar(39)+N') as Name_Bill,A.No_SaleRtnBill as No_Bill,'
  1943. +N' convert(nvarchar(64),'+nchar(39)+nchar(39)+N') as ConsultNo,Y.Name_Employee as Principal,'
  1944. +N' A.Amount_SaleRtnBill as Money,'
  1945. +N' A.ID_Assessor,X.No_Customer'
  1946. +N' from SaleRtnBill A'
  1947. +N' Left join Employee Y on Y.ID_Employee=A.ID_Principal '
  1948. +N' left join Customer X on X.ID_Customer=A.ID_Customer '
  1949. end
  1950. if(@ckInventoryBill = 1)
  1951. begin
  1952. set @cmd = @cmd+N' Union all select A.Date_ModifyDepotBill as Date,convert(nvarchar(64),'+nchar(39)+N'库存异动作业'+nchar(39)+N') as Name_Bill,A.No_ModifyDepotBill as No_Bill,'
  1953. +N' convert(nvarchar(64),'+nchar(39)+nchar(39)+N') as ConsultNo,convert(nvarchar(64),'+nchar(39)+nchar(39)+N') as Principal,'
  1954. +N' A.Amount_ModifyDepotBill as Money,'
  1955. +N' A.ID_Assessor,'+nchar(39)+@No_Customer+nchar(39)+N' As No_Customer'
  1956. +N' from ModifyDepotBill A'
  1957. +N' Where Comment_ModifyDepotBill='+nchar(39)+@ShortName_Customer+nchar(39)
  1958. end
  1959. if(@ckSaleOutDepotBill = 1)
  1960. begin
  1961. set @cmd = @cmd+N' Union all select A.Date_SaleOutDepotBill as Date,convert(nvarchar(64),'+nchar(39)+N'销货出库单'+nchar(39)+N') as Name_Bill,A.No_SaleOutDepotBill as No_Bill,'
  1962. +N' convert(nvarchar(64),'+nchar(39)+nchar(39)+N') as ConsultNo,convert(nvarchar(64),'+nchar(39)+nchar(39)+N') as Principal,'
  1963. +N' B.Amount_SaleOutDepotBill as Money,'
  1964. +N' A.ID_Assessor,X.No_Customer'
  1965. +N' from SaleOutDepotBill A'
  1966. +N' Left join Customer X on X.ID_Customer = A.ID_Customer '
  1967. +N' Left join (Select ID_SaleOutDepotBill,Sum(Quantity_SaleOutDepotBillProduct*UnitPrice_SaleOutDepotBillProduct) As Amount_SaleOutDepotBill From SaleOutDepotBillProduct Group By ID_SaleOutDepotBill)B On B.ID_SaleOutDepotBill=A.ID_SaleOutDepotBill '
  1968. end
  1969. if(@ckIndentBill = 1)
  1970. begin
  1971. set @cmd = @cmd+N' Union all select A.Date_IndentBill as Date,convert(nvarchar(64),'+nchar(39)+N'订货单'+nchar(39)+N') as Name_Bill,A.No_IndentBill as No_Bill,'
  1972. +N' convert(nvarchar(64),'+nchar(39)+nchar(39)+N') as ConsultNo,Y.Name_Employee as Principal,'
  1973. +N' A.Amount_IndentBill as Money,'
  1974. +N' A.ID_Assessor,X.No_Customer'
  1975. +N' from IndentBill A'
  1976. +N' Left join Employee Y on Y.ID_Employee=A.ID_Principal '
  1977. +N' Left join Customer X on X.ID_Customer = A.ID_Customer '
  1978. if(@RightIndentBill=0)
  1979. set @cmd=@cmd+N' Where Special_IndentBill=0 '
  1980. end
  1981. set @cmd = @cmd + N' )A where A.ID_Assessor is not null and A.No_Customer = '+nchar(39)+@No_Customer+nchar(39)
  1982. if(@StartTime is not null)
  1983. set @cmd = @cmd + N' and A.Date &gt; DATEADD(day, DATEDIFF(day,0,'+nchar(39)+convert(nvarchar,@StartTime) +nchar(39)+N'), 0) '
  1984. if(@EndTime is not null)
  1985. set @cmd = @cmd + N' and A.Date &lt; DATEADD(day, DATEDIFF(day,0,'+nchar(39)+convert(nvarchar,@EndTime) +nchar(39)+N'), 1) '
  1986. set @cmd = @cmd + N' Order By A.Date Desc '
  1987. EXECUTE sp_executesql @cmd
  1988. Return
  1989. ">
  1990. <Params>
  1991. <Param name="@StartTime" type="SaleBill.Date_SaleBill" Index="0" />
  1992. <Param name="@EndTime" type="SaleBill.Date_SaleBill" Index="1" />
  1993. <Param name="@ckNearlyBill" type="SaleBill.Disable_SaleBill" Index="2" />
  1994. <Param name="@tbNearlyBill" type="SaleBill.GoodsAmount_SaleBill" Index="3" />
  1995. <Param name="@ckQueryPriceBill" type="SaleBill.Disable_SaleBill" Index="4" />
  1996. <Param name="@ckSaleBill" type="SaleBill.Disable_SaleBill" Index="5" />
  1997. <Param name="@ckSaleRtnBill" type="SaleBill.Disable_SaleBill" Index="6" />
  1998. <Param name="@ckInventoryBill" type="SaleBill.Disable_SaleBill" Index="7" />
  1999. <Param name="@No_Customer" type="Customer.No_Customer" Index="8" />
  2000. <Param name="@ckSaleOutDepotBill" type="SaleBill.Disable_SaleBill" Index="9" />
  2001. <Param name="@ckIndentBill" type="SaleBill.Disable_SaleBill" Index="10" />
  2002. <Param name="@ShortName_Customer" type="Customer.No_Customer" Index="11" />
  2003. <Param name="@RightIndentBill" type="IndentBill.Special_IndentBill" Index="12" />
  2004. <Param name="@RightSaleBill" type="IndentBill.Special_IndentBill" Index="13" />
  2005. <Param name="@RightPriceQueryBill" type="IndentBill.Special_IndentBill" Index="14" />
  2006. </Params>
  2007. <Tables>
  2008. <Table name="ExchangeBill"/>
  2009. </Tables>
  2010. </SearchExchangeBill>
  2011. <SearchExchangeProduct CmdType="Text" CmdText=" declare @cmd nvarchar(4000)
  2012. declare @first bit
  2013. set @first=1
  2014. if(@ckNearlyProduct=1)
  2015. begin
  2016. set @cmd = N' set rowcount '+convert(nvarchar,@tbNearlyProduct) +N' select * from ( '
  2017. end
  2018. else
  2019. begin
  2020. set @cmd = N' select * from ( '
  2021. end
  2022. /*set @cmd = @cmd+N' SELECT Top 0 '+nchar(39)+nchar(39)+N' as No_Product,'+nchar(39)+nchar(39)+N' as Name_Product, Date_SaleBill as Date,'+nchar(39)+nchar(39)+N' as Name_Bill,'
  2023. +nchar(39)+nchar(39)+N' as No_Bill,convert(decimal,0.00) as Num,convert(decimal,0.00) as Price,
  2024. convert(decimal,0.00) as Money,'+nchar(39)+nchar(39)+N' as Comment,SaleBill.ID_Assessor as ID_Assessor,'+nchar(39)+nchar(39)+N' as No_Customer,'+nchar(39)+nchar(39)+N' as TaxCurrency FROM SaleBill ' */
  2025. if(@ckQueryPriceProduct = 1)
  2026. begin
  2027. if(@first!=1)
  2028. set @cmd = @cmd+N' Union all'
  2029. set @first=0
  2030. set @cmd = @cmd +N' select No_Product,Name_Product, Date_PriceQueryBill as Date,Name_Bill='+nchar(39)+N'报价单'+nchar(39)+N',No_PriceQueryBill as No_Bill,'
  2031. +N' Quantity_PriceQueryBillProduct as Num,UnitPrice_PriceQueryBillProduct as price,'
  2032. +N' (Quantity_PriceQueryBillProduct*UnitPrice_PriceQueryBillProduct) as Money,'
  2033. +N' Comment_PriceQueryBillProduct as Comment,'
  2034. +N' ID_Assessor,X.No_Customer,TaxCurrency_PriceQueryBill as TaxCurrency '
  2035. +N' From PriceQueryBill pq'
  2036. +N' join PriceQueryBillProduct pqp on pq.ID_PriceQueryBill = pqp.ID_PriceQueryBill'
  2037. +N' left join Product p on p.ID_Product=pqp.ID_Product left join Customer X on X.ID_Customer = pq.ID_Customer'
  2038. if(@RightPriceQueryBill=0)
  2039. set @cmd=@cmd+N' Where Special_PriceQueryBill=0 '
  2040. end
  2041. if(@ckSaleProduct = 1)
  2042. begin
  2043. if(@first!=1)
  2044. set @cmd = @cmd+N' Union all'
  2045. set @first=0
  2046. set @cmd = @cmd+N' select No_Product,Name_Product,Date_SaleBill as Date,Name_Bill='+nchar(39)+N'销货单'+nchar(39)+N',No_SaleBill as No_Bill,'
  2047. +N' Quantity_SaleBillProduct as Num,UnitPrice_SaleBillProduct as price,'
  2048. +N' (Quantity_SaleBillProduct*UnitPrice_SaleBillProduct) as Money,Comment_SaleBillProduct as Comment,'
  2049. +N' ID_Assessor,X.No_Customer,TaxCurrency_SaleBill as TaxCurrency '
  2050. +N' from SaleBill s'
  2051. +N' join SaleBillProduct sp on s.ID_SaleBill=sp.ID_SaleBill'
  2052. +N' left join Product on Product.ID_Product=sp.ID_Product left join Customer X on X.ID_Customer = s.ID_Customer'
  2053. if(@RightSaleBill=0)
  2054. set @cmd=@cmd+N' Where Special_SaleBill=0 '
  2055. end
  2056. if(@ckSaleRtnProduct = 1)
  2057. begin
  2058. if(@first!=1)
  2059. set @cmd = @cmd+N' Union all'
  2060. set @first=0
  2061. set @cmd = @cmd+N' select No_Product,Name_Product,Date_SaleRtnBill as Date,Name_Bill='+nchar(39)+N'销售退货单'+nchar(39)+N',No_SaleRtnBill as No_Bill,'
  2062. +N' Quantity_SaleRtnBillProduct as Num,UnitPrice_SaleRtnBillProduct as price,'
  2063. +N' (Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct) as Money,Comment_SaleRtnBillProduct as Comment,'
  2064. +N' ID_Assessor,X.No_Customer,TaxCurrency_SaleRtnBill as TaxCurrency '
  2065. +N' from SaleRtnBill'
  2066. +N' join SaleRtnBillProduct on SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill'
  2067. +N' left join Product on Product.ID_Product=SaleRtnBillProduct.ID_Product left join Customer X on X.ID_Customer = SaleRtnBill.ID_Customer'
  2068. end
  2069. if(@ckInventoryProduct = 1)
  2070. begin
  2071. if(@first!=1)
  2072. set @cmd = @cmd+N' Union all'
  2073. set @first=0
  2074. set @cmd = @cmd+N' select No_Product,Name_Product,Date_ModifyDepotBill as Date,Name_Bill='+nchar(39)+N'库存异动作业'+nchar(39)+N',No_ModifyDepotBill as No_Bill,'
  2075. +N' Quantity_ModifyDepotBillProduct as Num,UnitPrice_ModifyDepotBillProduct as price,'
  2076. +N' (Quantity_ModifyDepotBillProduct*UnitPrice_ModifyDepotBillProduct)as Money,Comment_ModifyDepotBillProduct as Comment,'
  2077. +N' ID_Assessor,'+nchar(39)+@No_Customer+nchar(39)+N' As No_Customer,'+nchar(39)+nchar(39)+N' as TaxCurrency'
  2078. +N' from ModifyDepotBill'
  2079. +N' join ModifyDepotBillProduct on ModifyDepotBill.ID_ModifyDepotBill=ModifyDepotBillProduct.ID_ModifyDepotBill'
  2080. +N' left join Product on Product.ID_Product=ModifyDepotBillProduct.ID_Product Where Comment_ModifyDepotBill='+nchar(39)+@ShortName_Customer+nchar(39)
  2081. end
  2082. if(@ckSaleOutDepotProduct = 1)
  2083. begin
  2084. if(@first!=1)
  2085. set @cmd = @cmd+N' Union all'
  2086. set @first=0
  2087. set @cmd = @cmd+N' select No_Product,Name_Product,Date_SaleOutDepotBill as Date,Name_Bill='+nchar(39)+N'销货出库单'+nchar(39)+N',No_SaleOutDepotBill as No_Bill,'
  2088. +N' Quantity_SaleOutDepotBillProduct as Num,UnitPrice_SaleOutDepotBillProduct as price,'
  2089. +N' (Quantity_SaleOutDepotBillProduct*UnitPrice_SaleOutDepotBillProduct) as Money,Comment_SaleOutDepotBillProduct as Comment,'
  2090. +N' ID_Assessor,X.No_Customer,'+nchar(39)+nchar(39)+N' as TaxCurrency '
  2091. +N' from SaleOutDepotBill'
  2092. +N' join SaleOutDepotBillProduct on SaleOutDepotBill.ID_SaleOutDepotBill=SaleOutDepotBillProduct.ID_SaleOutDepotBill'
  2093. +N' left join Product on Product.ID_Product=SaleOutDepotBillProduct.ID_Product left join Customer X on X.ID_Customer = SaleOutDepotBill.ID_Customer'
  2094. end
  2095. if(@ckIndentProduct = 1)
  2096. begin
  2097. if(@first!=1)
  2098. set @cmd = @cmd+N' Union all'
  2099. set @first=0
  2100. set @cmd = @cmd+N' select No_Product,Name_Product,Date_IndentBill as Date,Name_Bill='+nchar(39)+N'订货单'+nchar(39)+N',No_IndentBill as No_Bill,'
  2101. +N' Quantity_IndentBillProduct as Num,UnitPrice_IndentBillProduct as price,'
  2102. +N' (Quantity_IndentBillProduct*UnitPrice_IndentBillProduct) as Money,Comment_IndentBillProduct as Comment,'
  2103. +N' ID_Assessor,X.No_Customer,TaxCurrency_IndentBill as TaxCurrency '
  2104. +N' from IndentBill'
  2105. +N' join IndentBillProduct on IndentBill.ID_IndentBill=IndentBillProduct.ID_IndentBill'
  2106. +N' left join Product on Product.ID_Product=IndentBillProduct.ID_Product left join Customer X on X.ID_Customer = IndentBill.ID_Customer'
  2107. if(@RightIndentBill=0)
  2108. set @cmd=@cmd+N' Where Special_IndentBill=0 '
  2109. end
  2110. set @cmd = @cmd + N' )A where A.ID_Assessor is not null and A.No_Customer = '+nchar(39)+@No_Customer+nchar(39)
  2111. if(@StartTime is not null)
  2112. set @cmd = @cmd + N' and A.Date &gt; DATEADD(day, DATEDIFF(day,0,'+nchar(39)+convert(nvarchar,@StartTime) +nchar(39)+N'), 0) '
  2113. if(@EndTime is not null)
  2114. set @cmd = @cmd + N' and A.Date &lt; DATEADD(day, DATEDIFF(day,0,'+nchar(39)+convert(nvarchar,@EndTime) +nchar(39)+N'), 1) '
  2115. set @cmd = @cmd + N' Order By A.Date Desc '
  2116. EXECUTE sp_executesql @cmd
  2117. ">
  2118. <Params>
  2119. <Param name="@StartTime" type="SaleBill.Date_SaleBill" Index="0" />
  2120. <Param name="@EndTime" type="SaleBill.Date_SaleBill" Index="1" />
  2121. <Param name="@ckNearlyProduct" type="SaleBill.Disable_SaleBill" Index="2" />
  2122. <Param name="@tbNearlyProduct" type="SaleBill.GoodsAmount_SaleBill" Index="3" />
  2123. <Param name="@ckQueryPriceProduct" type="SaleBill.Disable_SaleBill" Index="4" />
  2124. <Param name="@ckSaleProduct" type="SaleBill.Disable_SaleBill" Index="5" />
  2125. <Param name="@ckSaleRtnProduct" type="SaleBill.Disable_SaleBill" Index="6" />
  2126. <Param name="@ckInventoryProduct" type="SaleBill.Disable_SaleBill" Index="7" />
  2127. <Param name="@No_Customer" type="Customer.No_Customer" Index="8" />
  2128. <Param name="@ckSaleOutDepotProduct" type="SaleBill.Disable_SaleBill" Index="9" />
  2129. <Param name="@ckIndentProduct" type="SaleBill.Disable_SaleBill" Index="10" />
  2130. <Param name="@ShortName_Customer" type="Customer.No_Customer" Index="11" />
  2131. <Param name="@RightIndentBill" type="IndentBill.Special_IndentBill" Index="12" />
  2132. <Param name="@RightSaleBill" type="IndentBill.Special_IndentBill" Index="13" />
  2133. <Param name="@RightPriceQueryBill" type="IndentBill.Special_IndentBill" Index="14" />
  2134. </Params>
  2135. <Tables>
  2136. <Table name="ExchangeProduct"/>
  2137. </Tables>
  2138. </SearchExchangeProduct>
  2139. <SearchAllEmployee CmdType="Text" CmdText="SELECT Employee.No_Employee,Employee.Name_Employee
  2140. FROM Employee ">
  2141. <Tables>
  2142. <Table name="AllEmployee" />
  2143. </Tables>
  2144. </SearchAllEmployee>
  2145. <SearchCustomersIsInRegionalLeader CmdType="Text" CmdText="select * from Employee
  2146. where ID_Employee
  2147. in
  2148. (
  2149. Select ID_Employee from Principal
  2150. where ID_RegionalLeader
  2151. in
  2152. (
  2153. select ID_RegionalLeader from Customer
  2154. where No_Customer = @No_Customer
  2155. )
  2156. )
  2157. and Employee.Name_Employee = @Name_Employee
  2158. ">
  2159. <Params>
  2160. <Param name="@No_Customer" type="Customer.No_Customer" />
  2161. <Param name="@Name_Employee" type="Employee.Name_Employee" />
  2162. </Params>
  2163. <Tables>
  2164. <Table name="IsInRegionalLeader" />
  2165. </Tables>
  2166. </SearchCustomersIsInRegionalLeader>
  2167. <SearchPayLimitType CmdType="Text" CmdText=" CREATE TABLE #TypeDef( Type nvarchar(64)) DECLARE @c int SET @c = 0
  2168. WHILE @c &lt; 2
  2169. BEGIN
  2170. IF(@c=0)
  2171. BEGIN
  2172. INSERT INTO #TypeDef (Type)VALUES('+')
  2173. END
  2174. IF(@c=1)
  2175. BEGIN
  2176. INSERT INTO #TypeDef (Type)VALUES('-')
  2177. END
  2178. SET @c = @c + 1
  2179. END
  2180. SELECT Type AS Name_Type FROM #TypeDef
  2181. DROP TABLE #TypeDef
  2182. ">
  2183. <Tables>
  2184. <Table name="GetPayLimitType" />
  2185. </Tables>
  2186. </SearchPayLimitType>
  2187. <SearchOpeningBalanceAdjust CmdType="Text" CmdText=" SELECT OpeningBalanceAdjust_Customer From Customer where No_Customer=@No_Customer">
  2188. <Params>
  2189. <Param name="@No_Customer" type="Customer.No_Customer" />
  2190. </Params>
  2191. <Tables>
  2192. <Table name="SearchOpeningBalanceAdjust" />
  2193. </Tables>
  2194. </SearchOpeningBalanceAdjust>
  2195. </Search>
  2196. <Insert>
  2197. </Insert>
  2198. </Server>
  2199. <Lables>
  2200. <Search>
  2201. Empty();
  2202. Empty("#ExchangeProduct");
  2203. Empty("#ExchangeBill");
  2204. NewInstance();
  2205. tbNo.ReadOnly=false;
  2206. txtShortName.ReadOnly=true;
  2207. txtShortName2.ReadOnly = true;
  2208. txtName.ReadOnly=true;
  2209. txtRegistedAddress.ReadOnly=true;
  2210. cbCountry.Enabled=false;
  2211. txtPostalCode.ReadOnly=true;
  2212. cbPayLimitCurrency.Enabled=false;<!--一直为false-->
  2213. cbPayLimitCurrency.Text=@SysCurrency;
  2214. tbDunDate.ReadOnly=true;
  2215. txtSendAddr.ReadOnly=true;
  2216. dtpIsSuspend.Enabled=false;
  2217. txtComment.ReadOnly=true;
  2218. cbIndustry.Enabled=false;
  2219. cbZone.Enabled=false;
  2220. cbType.Enabled=false;
  2221. comboArea.Enabled=false;
  2222. cbIsGeneric.Enabled=false;
  2223. cbSource.Enabled=false;
  2224. cbLevel.Enabled=false;
  2225. cbBank.Enabled=false;
  2226. cbCompany.Enabled=false;
  2227. txtAccount.ReadOnly=true;
  2228. txtRevenueRegisterNo.ReadOnly=true;
  2229. cbGetMethod.Enabled=false;
  2230. txtPayLimit.Enabled=false;
  2231. cbPayLimitType.Enabled=false;
  2232. txtPayLimit2.Enabled=false;
  2233. tbLowDiscount.Enabled=false;
  2234. ikTextBox1.Enabled=false;
  2235. txtRemark.Enabled=false;
  2236. dgInvoice.ReadOnly=true;
  2237. dgLinkMan.ReadOnly=true;
  2238. dgPrincipal.ReadOnly=true;
  2239. dgRemark.ReadOnly = true;
  2240. dgInfo.ReadOnly = true;
  2241. toolBar.EnableSubmit=false;
  2242. toolBar.EnableModify=false;
  2243. toolBar.EnableDelete=false;
  2244. toolBar.EnablePrint=false;
  2245. tbNo.ReadOnly=false;
  2246. txtShortName.ReadOnly=true;
  2247. txtShortName2.ReadOnly=true;
  2248. txtName.ReadOnly=true;
  2249. txtRegistedAddress.ReadOnly=true;
  2250. cbCountry.Enabled=false;
  2251. txtPostalCode.ReadOnly=true;
  2252. cbPayLimitCurrency.Enabled=false;<!--一直?false-->
  2253. tbDunDate.ReadOnly=true;
  2254. txtSendAddr.ReadOnly=true;
  2255. dtpIsSuspend.Enabled=false;
  2256. txtComment.ReadOnly=true;
  2257. cbIndustry.Enabled=false;
  2258. cbZone.Enabled=false;
  2259. cbType.Enabled=false;
  2260. comboArea.Enabled=false;
  2261. cbIsGeneric.Enabled=false;
  2262. cbSource.Enabled=false;
  2263. cbLevel.Enabled=false;
  2264. cbBank.Enabled=false;
  2265. cbCompany.Enabled=false;
  2266. txtAccount.ReadOnly=true;
  2267. txtRevenueRegisterNo.ReadOnly=true;
  2268. cbGetMethod.Enabled=false;
  2269. txtPayLimit.Enabled=false;
  2270. txtPayLimit2.Enabled=false;
  2271. cbPayLimitType.Enabled=false;
  2272. tbLowDiscount.Enabled=false;
  2273. ikTextBox1.Enabled=false;
  2274. txtRemark.Enabled=false;
  2275. dgInvoice.ReadOnly=true;
  2276. dgLinkMan.ReadOnly=true;
  2277. dgPrincipal.ReadOnly=true;
  2278. dgRemark.ReadOnly = true;
  2279. dgInfo.ReadOnly = true;
  2280. tbNo2.ReadOnly = true;
  2281. tbNo2.IKButton.Enabled = false;
  2282. txtShortName2.Enabled = false;
  2283. ikCheckBox2.Enabled = false;
  2284. dtpBeginDate.Enabled=false;
  2285. toolBar.EnableSubmit=false;
  2286. toolBar.EnableModify=GetRight(@Title,"修改");
  2287. toolBar.EnableDelete=GetRight(@Title,"删除");
  2288. toolBar.EnablePrint=GetRight(@Title,"打印");
  2289. if(ckDisplay.Checked)
  2290. #Customer.IsDisplay=1;
  2291. else
  2292. #Customer.IsDisplay=0;
  2293. UpdateForm(true, "");
  2294. txtLinkMan.CValue="";
  2295. txtLinkTel.CValue="";
  2296. if(RowCount("#Linkman")&gt;0)
  2297. {
  2298. SuspendLayout();
  2299. for(@i=0;@i &lt; RowCount("#Linkman");@i++)
  2300. {
  2301. SetPosition("#Linkman",@i);
  2302. if(#Linkman.IsMain_Linkman==true)
  2303. {
  2304. txtLinkMan.CValue=#Linkman.Name_Linkman;
  2305. txtLinkTel.CValue=#Linkman.Tel_Linkman;
  2306. break;
  2307. }
  2308. }
  2309. ResumeLayout();
  2310. }
  2311. pcPhone.ReadOnly=true;
  2312. pcFax.ReadOnly=true;
  2313. @Status=2;
  2314. dtpBeginDate.Enabled=false;
  2315. #Customer.CreateDate_Customer=DBNull();
  2316. #Customer.SuspendDate_Customer=DBNull();
  2317. #Customer.LastModUser=DBNull();
  2318. #Customer.LastModUser_Customer=DBNull();
  2319. #Customer.LastModDate_Customer=DBNull();
  2320. if(ckDisplay.Checked)
  2321. #Customer.IsDisplay=1;
  2322. else
  2323. #Customer.IsDisplay=0;
  2324. UpdateForm(true, "");
  2325. txtLinkMan.CValue="";
  2326. txtLinkTel.CValue="";
  2327. pcPhone.ReadOnly=true;
  2328. pcFax.ReadOnly=true;
  2329. tbNo.Focus();
  2330. @Status=0;
  2331. </Search>
  2332. <New>
  2333. @tempmoney=0;
  2334. Empty();
  2335. NewInstance();
  2336. tbNo.ReadOnly=true;
  2337. txtShortName.ReadOnly=false;
  2338. txtShortName2.ReadOnly=true;
  2339. txtName.ReadOnly=false;
  2340. txtRegistedAddress.ReadOnly=false;
  2341. cbCountry.Enabled=true;
  2342. txtPostalCode.ReadOnly=false;
  2343. cbPayLimitCurrency.Enabled=false;<!--一直为false-->
  2344. tbDunDate.ReadOnly=false;
  2345. txtSendAddr.ReadOnly=false;
  2346. dtpIsSuspend.Enabled=true;
  2347. txtComment.ReadOnly=false;
  2348. cbIndustry.Enabled=true;
  2349. cbGetMethod.Enabled=GetFieldRight(@Title,"结算方式","修改");
  2350. tbLowDiscount.Enabled=GetFieldRight(@Title,"最低折扣","修改");
  2351. ikTextBox1.Enabled=GetFieldRight(@Title,"帐款备注","修改");
  2352. tbDunDate.Enabled=GetFieldRight(@Title,"催款日期","修改");
  2353. txtPayLimit2.Enabled=GetFieldRight(@Title,"期初余额调整","修改");
  2354. txtRemark.Enabled=GetFieldRight(@Title,"备注","修改");
  2355. cbPayLimitType.Enabled=GetFieldRight(@Title,"期初余额调整","修改");
  2356. cbPayLimitType.SelectedName = "+";
  2357. cbZone.Enabled=true;
  2358. cbType.Enabled=true;
  2359. comboArea.Enabled=true;
  2360. cbIsGeneric.Enabled=true;
  2361. cbSource.Enabled=true;
  2362. cbLevel.Enabled=true;
  2363. cbBank.Enabled=true;
  2364. cbCompany.Enabled=true;
  2365. txtAccount.ReadOnly=false;
  2366. txtRevenueRegisterNo.ReadOnly=false;
  2367. dgInvoice.ReadOnly=false;
  2368. dgLinkMan.ReadOnly=false;
  2369. dgPrincipal.ReadOnly=false;
  2370. dgRemark.ReadOnly = false;
  2371. dgInfo.ReadOnly = true;
  2372. toolBar.EnableSubmit=GetRight(@Title,"新增");
  2373. toolBar.EnableModify=false;
  2374. toolBar.EnableDelete=false;
  2375. toolBar.EnablePrint=false;
  2376. ikCheckBox2.Enabled = true; <!-- NEW -->
  2377. tbNo2.ReadOnly = true;
  2378. tbNo2.IKButton.Enabled = false;
  2379. dtpBeginDate.Enabled=true;
  2380. #Customer.No_Customer=tbNo.CValue;
  2381. #Customer.CreatorName_Customer=GetCurrentUser();
  2382. #Customer.ID_Customer=NewGuid();
  2383. #Customer.ID_Creator=GetLoginUserID();
  2384. #Customer.Country_Customer=40;
  2385. #Customer.CreateDate_Customer=DateTimeNow();
  2386. #Customer.SuspendDate_Customer=DBNull();
  2387. #Customer.GetMethod_Customer = "先款后货";
  2388. if(cbGetMethod.SelectedName=="先款后货")
  2389. {
  2390. txtPayLimit.Enabled=false;
  2391. txtPayLimit.CValue=0;
  2392. }
  2393. else
  2394. {
  2395. txtPayLimit.Enabled=GetFieldRight(@Title,"信用额度","修改");
  2396. }
  2397. Search("SearchDefaultPhone");
  2398. Search("SearchDefaultFax");
  2399. MergeTable("#DefaultFax","#Fax");
  2400. MergeTable("#DefaultTelephone","#Telephone");
  2401. if(ckDisplay.Checked)
  2402. #Customer.IsDisplay=1;
  2403. else
  2404. #Customer.IsDisplay=0;
  2405. UpdateForm(true, "");
  2406. txtLinkMan.CValue="";
  2407. txtLinkTel.CValue="";
  2408. tbLowDiscount.CValue=100.00;
  2409. pcPhone.ReadOnly=false;
  2410. pcFax.ReadOnly=false;
  2411. txtShortName.Focus();
  2412. @Status=1;
  2413. </New>
  2414. <View>
  2415. tbNo.ReadOnly=false;
  2416. txtShortName.ReadOnly=true;
  2417. txtShortName2.ReadOnly=true;
  2418. txtName.ReadOnly=true;
  2419. txtRegistedAddress.ReadOnly=true;
  2420. cbCountry.Enabled=false;
  2421. txtPostalCode.ReadOnly=true;
  2422. cbPayLimitCurrency.Enabled=false;<!--一直?false-->
  2423. tbDunDate.ReadOnly=true;
  2424. txtSendAddr.ReadOnly=true;
  2425. dtpIsSuspend.Enabled=false;
  2426. txtComment.ReadOnly=true;
  2427. cbIndustry.Enabled=false;
  2428. cbGetMethod.Enabled=false;
  2429. txtPayLimit.Enabled=false;
  2430. cbPayLimitType.Enabled=false;
  2431. txtPayLimit2.Enabled=false;
  2432. tbLowDiscount.Enabled=false;
  2433. ikTextBox1.Enabled=false;
  2434. txtRemark.Enabled=false;
  2435. cbZone.Enabled=false;
  2436. cbType.Enabled=false;
  2437. comboArea.Enabled=false;
  2438. cbIsGeneric.Enabled=false;
  2439. cbSource.Enabled=false;
  2440. cbLevel.Enabled=false;
  2441. cbBank.Enabled=false;
  2442. cbCompany.Enabled=false;
  2443. txtAccount.ReadOnly=true;
  2444. txtRevenueRegisterNo.ReadOnly=true;
  2445. dgInvoice.ReadOnly=true;
  2446. dgLinkMan.ReadOnly=true;
  2447. dgPrincipal.ReadOnly=true;
  2448. dgRemark.ReadOnly = true;
  2449. dgInfo.ReadOnly = true;
  2450. tbNo2.ReadOnly = true;
  2451. tbNo2.IKButton.Enabled = false;
  2452. txtShortName2.Enabled = false;
  2453. ikCheckBox2.Enabled = false;
  2454. if(#Customer.OpeningBalanceAdjust_Customer>=0)
  2455. {
  2456. cbPayLimitType.SelectedName ="+";
  2457. }
  2458. else
  2459. {
  2460. cbPayLimitType.SelectedName ="-";
  2461. }
  2462. if(Search("SearchCustomerWithNo2",tbNo.CValue))
  2463. {
  2464. if( #Customer2.IsCustomersCustomer_Customer)
  2465. {
  2466. tbNo2.ReadOnly = true;
  2467. tbNo2.CValue = #Customer2.No_Customer;
  2468. txtShortName2.CValue = #Customer2.ShortName_Customer;
  2469. }
  2470. else
  2471. {
  2472. ikCheckBox2.Checked = false;
  2473. tbNo2.IKButton.Enabled = false;
  2474. tbNo2.CValue = "";
  2475. txtShortName2.CValue = "";
  2476. }
  2477. }
  2478. dtpBeginDate.Enabled=false;
  2479. toolBar.EnableSubmit=false;
  2480. toolBar.EnableModify=GetRight(@Title,"修改");
  2481. toolBar.EnableDelete=GetRight(@Title,"删除");
  2482. toolBar.EnablePrint=GetRight(@Title,"打印");
  2483. if(ckDisplay.Checked)
  2484. #Customer.IsDisplay=1;
  2485. else
  2486. #Customer.IsDisplay=0;
  2487. UpdateForm(true, "");
  2488. txtLinkMan.CValue="";
  2489. txtLinkTel.CValue="";
  2490. if(RowCount("#Linkman")&gt;0)
  2491. {
  2492. SuspendLayout();
  2493. for(@i=0;@i &lt; RowCount("#Linkman");@i++)
  2494. {
  2495. SetPosition("#Linkman",@i);
  2496. if(#Linkman.IsMain_Linkman==true)
  2497. {
  2498. txtLinkMan.CValue=#Linkman.Name_Linkman;
  2499. txtLinkTel.CValue=#Linkman.Tel_Linkman;
  2500. break;
  2501. }
  2502. }
  2503. ResumeLayout();
  2504. }
  2505. pcPhone.ReadOnly=true;
  2506. pcFax.ReadOnly=true;
  2507. @Status=2;
  2508. </View>
  2509. <Modify>
  2510. @tempmoney=0;
  2511. @tempmoney= txtPayLimit2.CValue;
  2512. tbNo.ReadOnly=true;
  2513. txtShortName.ReadOnly=false;
  2514. txtShortName2.ReadOnly=false;
  2515. txtName.ReadOnly=false;
  2516. txtRegistedAddress.ReadOnly=false;
  2517. cbCountry.Enabled=true;
  2518. txtPostalCode.ReadOnly=false;
  2519. cbPayLimitCurrency.Enabled=false;<!--一直为false-->
  2520. tbDunDate.ReadOnly=false;
  2521. txtSendAddr.ReadOnly=false;
  2522. dtpIsSuspend.Enabled=true;
  2523. txtComment.ReadOnly=false;
  2524. cbIndustry.Enabled=true;
  2525. cbGetMethod.Enabled=GetFieldRight(@Title,"结算方式","修改");
  2526. if(cbGetMethod.SelectedName=="先款后货")
  2527. {
  2528. txtPayLimit.Enabled=false;
  2529. txtPayLimit.CValue=0;
  2530. }
  2531. else
  2532. {
  2533. txtPayLimit.Enabled=GetFieldRight(@Title,"信用额度","修改");
  2534. }
  2535. tbLowDiscount.Enabled=GetFieldRight(@Title,"最低折扣","修改");
  2536. ikTextBox1.Enabled=GetFieldRight(@Title,"帐款备注","修改");
  2537. tbDunDate.Enabled=GetFieldRight(@Title,"催款日期","修改");
  2538. txtPayLimit2.Enabled=GetFieldRight(@Title,"期初余额调整","修改");
  2539. txtRemark.Enabled=GetFieldRight(@Title,"备注","修改");
  2540. cbPayLimitType.Enabled=GetFieldRight(@Title,"期初余额调整","修改");
  2541. cbZone.Enabled=true;
  2542. cbType.Enabled=true;
  2543. comboArea.Enabled=true;
  2544. cbIsGeneric.Enabled=true;
  2545. cbSource.Enabled=true;
  2546. cbLevel.Enabled=true;
  2547. cbBank.Enabled=true;
  2548. cbCompany.Enabled=true;
  2549. txtAccount.ReadOnly=false;
  2550. txtRevenueRegisterNo.ReadOnly=false;
  2551. dgInvoice.ReadOnly=false;
  2552. dgLinkMan.ReadOnly=false;
  2553. dgPrincipal.ReadOnly=false;
  2554. dgRemark.ReadOnly = false;
  2555. dgInfo.ReadOnly = true;
  2556. ikCheckBox2.Enabled = true;
  2557. tbNo2.ReadOnly = false;
  2558. if(Search("SearchCustomerWithNo2",tbNo.CValue))
  2559. {
  2560. if( #Customer.IsCustomersCustomer_Customer)
  2561. {
  2562. ikCheckBox2.Checked = true;
  2563. tbNo2.IKButton.Enabled = true;
  2564. tbNo2.ReadOnly = false;
  2565. }
  2566. else
  2567. {
  2568. ikCheckBox2.Checked = false;
  2569. tbNo2.IKButton.Enabled = false;
  2570. tbNo2.ReadOnly = true;
  2571. }
  2572. }
  2573. dtpBeginDate.Enabled=true;
  2574. toolBar.EnableSubmit=GetRight(@Title,"新增");
  2575. toolBar.EnableModify=false;
  2576. toolBar.EnableDelete=GetRight(@Title,"删除");
  2577. toolBar.EnablePrint=false;
  2578. #Customer.LastModUser=GetCurrentUser();
  2579. #Customer.LastModUser_Customer=GetLoginUserID();
  2580. #Customer.LastModDate_Customer=GetCurrentTime();
  2581. if(ckDisplay.Checked)
  2582. #Customer.IsDisplay = 1;
  2583. else
  2584. #Customer.IsDisplay = 0;
  2585. UpdateForm(true, "");
  2586. pcPhone.ReadOnly=false;
  2587. pcFax.ReadOnly=false;
  2588. txtShortName.Focus();
  2589. @Status=3;
  2590. </Modify>
  2591. <SubmitButtonClick>
  2592. <![CDATA[
  2593. @count =0;
  2594. if(txtShortName.CValue=="")
  2595. {
  2596. MessageBox("请输入客户简称!",@Title);
  2597. txtShortName.Focus();
  2598. return;
  2599. }
  2600. if (ikCheckBox2.Checked)
  2601. {
  2602. if(!Search("SearchCustomerWithNo2", tbNo2.CValue))
  2603. {
  2604. MessageBox("找不到此客户!",@Title);
  2605. #Customer.CustomerID_Customer = GuidEmpty();
  2606. tbNo2.CValue = "";
  2607. txtShortName2.CValue = "";
  2608. txtShortName2.Focus();
  2609. return;
  2610. }
  2611. else
  2612. {
  2613. if(Search("SearchCustomerWithNo3", tbNo.CValue))
  2614. {
  2615. MessageBox("该客户有销项发票、收款单或所属公司不同,不能做子客户!",@Title);
  2616. return;
  2617. }
  2618. else
  2619. {
  2620. if (tbNo2.CValue.ToUpper() == tbNo.CValue.ToUpper())
  2621. {
  2622. tbNo2.CValue = "";
  2623. txtShortName2.CValue = "";
  2624. #Customer.CustomerID_Customer = GuidEmpty();
  2625. MessageBox("所属客户不可与客户名相同!");
  2626. tbNo2.Focus();
  2627. return;
  2628. }
  2629. else
  2630. {
  2631. if(Search("SearchCustomerWithNo4", tbNo2.CValue))
  2632. {
  2633. if(#Customer4.Company_Customer!=cbCompany.SelectedName)
  2634. {
  2635. MessageBox("该客户有销项发票、收款单或所属公司不同,不能做子客户!",@Title);
  2636. return;
  2637. }
  2638. }
  2639. }
  2640. }
  2641. }
  2642. if(txtShortName2.CValue=="")
  2643. {
  2644. MessageBox("请填写所属客户名称!",@Title);
  2645. #Customer.CustomerID_Customer = GuidEmpty();
  2646. tbNo2.CValue = "";
  2647. txtShortName2.CValue = "";
  2648. txtShortName2.Focus();
  2649. return;
  2650. }
  2651. }
  2652. else
  2653. {
  2654. #Customer.CustomerID_Customer = GuidEmpty();
  2655. tbNo2.CValue = "";
  2656. txtShortName2.CValue = "";
  2657. }
  2658. if(txtName.CValue=="")
  2659. {
  2660. MessageBox("请输入客户名称!",@Title);
  2661. txtName.Focus();
  2662. return;
  2663. }
  2664. if(cbCountry.CValue==0)
  2665. {
  2666. tcOperMan.SelectedIndex=0;
  2667. MessageBox("请输入国家!",@Title);
  2668. cbCountry.Focus();
  2669. return;
  2670. }
  2671. if(tbDunDate.CValue=="")
  2672. {
  2673. tcOperMan.SelectedIndex=0;
  2674. MessageBox("请输入催款日期!",@Title);
  2675. tbDunDate.Focus();
  2676. return;
  2677. }
  2678. else if(tbDunDate.CValue<0||tbDunDate.CValue>31)
  2679. {
  2680. tcOperMan.SelectedIndex=0;
  2681. MessageBox("请输入有效的催款日期!",@Title);
  2682. tbDunDate.Focus();
  2683. return;
  2684. }
  2685. if(tbDunDate.CValue<0||tbDunDate.CValue>31)
  2686. {
  2687. tcOperMan.SelectedIndex=0;
  2688. MessageBox("请输入正确的日期范围!",@Title);
  2689. cbGetMethod.Focus();
  2690. return;
  2691. }
  2692. if(cbGetMethod.SelectedName=="")
  2693. {
  2694. tcOperMan.SelectedIndex=0;
  2695. MessageBox("请输入结算方式!",@Title);
  2696. cbGetMethod.Focus();
  2697. return;
  2698. }
  2699. if(!cbPayLimitType.CheckSelectedItem())
  2700. {
  2701. MessageBox("请输入有效的期初余额调整方式!",@Title);
  2702. cbPayLimitType.Focus();
  2703. return;
  2704. }
  2705. if(cbType.SelectedName=="")
  2706. {
  2707. tcOperMan.SelectedIndex=1;
  2708. MessageBox("请输入客户类别!",@Title);
  2709. cbType.Focus();
  2710. return;
  2711. }
  2712. if((cbIndustry.SelectedName==""))
  2713. {
  2714. tcOperMan.SelectedIndex=1;
  2715. MessageBox("请输入行业!",@Title);
  2716. cbIndustry.Focus();
  2717. return;
  2718. }
  2719. if(cbZone.SelectedName=="")
  2720. {
  2721. tcOperMan.SelectedIndex=1;
  2722. MessageBox("请输入地区!",@Title);
  2723. cbZone.Focus();
  2724. return;
  2725. }
  2726. if(cbSource.SelectedName=="")
  2727. {
  2728. tcOperMan.SelectedIndex=1;
  2729. MessageBox("请输入客户来源!",@Title);
  2730. cbSource.Focus();
  2731. return;
  2732. }
  2733. if(cbCompany.SelectedName=="")
  2734. {
  2735. tcOperMan.SelectedIndex=1;
  2736. MessageBox("请选择所属公司!",@Title);
  2737. cbCompany.Focus();
  2738. return;
  2739. }
  2740. if(comboArea.SelectedName=="")
  2741. {
  2742. MessageBox("请选择所属区域!",@Title);
  2743. comboArea.Focus();
  2744. return;
  2745. }
  2746. #Customer.PayLimitCurrency=cbPayLimitCurrency.Text;
  2747. UpdateForm(false, "");
  2748. if(@Status==1)
  2749. {
  2750. SuspendLayout();
  2751. for(@i=RowCount("#Linkman")-1;@i>=0;@i=@i-1)
  2752. {
  2753. SetPosition("#Linkman", @i);
  2754. if(Equals(#Linkman.ID_Linkman,GuidEmpty()))
  2755. #Linkman.ID_Linkman = NewGuid();
  2756. #Linkman.ID_Person = #Customer.ID_Customer;
  2757. }
  2758. for(@i=RowCount("#Principal")-1;@i>=0;@i=@i-1)
  2759. {
  2760. SetPosition("#Principal", @i);
  2761. if(Equals(#Principal.ID_Principal,GuidEmpty()))
  2762. #Principal.ID_Principal = NewGuid();
  2763. if(Equals(#Principal.ID_Employee, GuidEmpty()))
  2764. {
  2765. dgPrincipal.CurrentRowIndex=@i;
  2766. tcOperMan.SelectedIndex=2;
  2767. MessageBox("该员工不存在!",@Title);
  2768. ResumeLayout();
  2769. return;
  2770. }
  2771. #Principal.ID_Person = #Customer.ID_Customer;
  2772. }
  2773. for(@i=RowCount("#Telephone")-1;@i>=0;@i=@i-1)
  2774. {
  2775. SetPosition("#Telephone",@i);
  2776. if(Equals(#Telephone.ID_Telephone,GuidEmpty()))
  2777. #Telephone.ID_Telephone=NewGuid();
  2778. #Telephone.ID_Person=#Customer.ID_Customer;
  2779. }
  2780. for(@i=RowCount("#Fax")-1;@i>=0;@i=@i-1)
  2781. {
  2782. SetPosition("#Fax",@i);
  2783. if(Equals(#Fax.ID_Fax,GuidEmpty()))
  2784. #Fax.ID_Fax=NewGuid();
  2785. #Fax.ID_Person=#Customer.ID_Customer;
  2786. }
  2787. for(@i=0;@i<RowCount("#Invoice");@i=@i+1)
  2788. {
  2789. SetPosition("#Invoice",@i);
  2790. if(Equals(#Invoice.ID_Invoice,GuidEmpty()))
  2791. #Invoice.ID_Invoice=NewGuid();
  2792. #Invoice.ID_Customer=#Customer.ID_Customer;
  2793. }
  2794. for (@i=0;@i<RowCount("#BasicComment");@i=@i+1)
  2795. {
  2796. SetPosition("#BasicComment", @i);
  2797. if (Equals(#BasicComment.ID_BasicComment,GuidEmpty()))
  2798. #BasicComment.ID_BasicComment = NewGuid();
  2799. #BasicComment.ID_Object = #Customer.ID_Customer;
  2800. }
  2801. ResumeLayout();
  2802. #Customer.LastModUser_Customer=DBNull();
  2803. #Customer.LastModDate_Customer=DBNull();
  2804. SuspendLayout();
  2805. for(@y=0;@y<RowCount("#Principal");@y++)
  2806. {
  2807. SetPosition("#Principal", @y);
  2808. if(Equals(#Principal.IsMainStr_Principal,"是"))
  2809. {
  2810. @count++;
  2811. }
  2812. }
  2813. ResumeLayout();
  2814. if(@count > 1)
  2815. {
  2816. MessageBox("只能有一个主要负责人,请检查!",@Title);
  2817. return;
  2818. }
  2819. @tep=0;
  2820. if(cbPayLimitType.SelectedName=="+")
  2821. {
  2822. #Customer.OpeningBalanceAdjust_Customer = txtPayLimit2.CValue;
  2823. }
  2824. if(cbPayLimitType.SelectedName=="-")
  2825. {
  2826. #Customer.OpeningBalanceAdjust_Customer = -txtPayLimit2.CValue;
  2827. }
  2828. New();
  2829. }
  2830. else if(@Status == 3)
  2831. {
  2832. SuspendLayout();
  2833. for(@i=RowCount("#Linkman")-1;@i>=0;@i=@i-1)
  2834. {
  2835. SetPosition("#Linkman", @i);
  2836. if(Equals(#Linkman.ID_Linkman,GuidEmpty()))
  2837. #Linkman.ID_Linkman = NewGuid();
  2838. #Linkman.ID_Person = #Customer.ID_Customer;
  2839. }
  2840. for(@i=RowCount("#Principal")-1;@i>=0;@i=@i-1)
  2841. {
  2842. SetPosition("#Principal", @i);
  2843. if(Equals(#Principal.ID_Principal,GuidEmpty()))
  2844. #Principal.ID_Principal = NewGuid();
  2845. if(Equals(#Principal.ID_Employee, GuidEmpty()))
  2846. {
  2847. dgPrincipal.CurrentRowIndex=@i;
  2848. tcOperMan.SelectedIndex=2;
  2849. MessageBox("该员工不存在!",@Title);
  2850. ResumeLayout();
  2851. return;
  2852. }
  2853. #Principal.ID_Person = #Customer.ID_Customer;
  2854. }
  2855. for(@i=RowCount("#Telephone")-1;@i>=0;@i=@i-1)
  2856. {
  2857. SetPosition("#Telephone",@i);
  2858. if(Equals(#Telephone.ID_Telephone,GuidEmpty()))
  2859. #Telephone.ID_Telephone=NewGuid();
  2860. #Telephone.ID_Person=#Customer.ID_Customer;
  2861. }
  2862. for(@i=RowCount("#Fax")-1;@i>=0;@i=@i-1)
  2863. {
  2864. SetPosition("#Fax",@i);
  2865. if(Equals(#Fax.ID_Fax,GuidEmpty()))
  2866. #Fax.ID_Fax=NewGuid();
  2867. #Fax.ID_Person=#Customer.ID_Customer;
  2868. }
  2869. for(@i=0;@i<RowCount("#Invoice");@i=@i+1)
  2870. {
  2871. SetPosition("#Invoice",@i);
  2872. if(Equals(#Invoice.ID_Invoice,GuidEmpty()))
  2873. #Invoice.ID_Invoice=NewGuid();
  2874. #Invoice.ID_Customer=#Customer.ID_Customer;
  2875. }
  2876. for (@i=0;@i<RowCount("#BasicComment");@i=@i+1)
  2877. {
  2878. SetPosition("#BasicComment", @i);
  2879. if (Equals(#BasicComment.ID_BasicComment,GuidEmpty()))
  2880. #BasicComment.ID_BasicComment = NewGuid();
  2881. #BasicComment.ID_Object = #Customer.ID_Customer;
  2882. }
  2883. ResumeLayout();
  2884. #Customer.LastModUser=GetCurrentUser();
  2885. #Customer.LastModUser_Customer=GetLoginUserID();
  2886. #Customer.LastModDate_Customer=GetCurrentTime();
  2887. tbNo.Focus();
  2888. SuspendLayout();
  2889. for(@y=0;@y<RowCount("#Principal");@y++)
  2890. {
  2891. SetPosition("#Principal", @y);
  2892. if(Equals(#Principal.IsMainStr_Principal,"是"))
  2893. {
  2894. @count++;
  2895. }
  2896. }
  2897. ResumeLayout();
  2898. if(@count > 1)
  2899. {
  2900. MessageBox("只能有一个主要负责人,请检查!",@Title);
  2901. return;
  2902. }
  2903. if(cbPayLimitType.SelectedName=="-")
  2904. {
  2905. if(txtPayLimit2.CValue!=@tempmoney)
  2906. {
  2907. if(txtPayLimit2.CValue!=-@tempmoney)
  2908. {
  2909. if (txtPayLimit2.CValue >=0)
  2910. #Customer.OpeningBalanceAdjust_Customer=-txtPayLimit2.CValue;
  2911. else
  2912. #Customer.OpeningBalanceAdjust_Customer=txtPayLimit2.CValue;
  2913. }
  2914. }
  2915. else
  2916. {
  2917. if(@tempmoney>=0)
  2918. #Customer.OpeningBalanceAdjust_Customer=-@tempmoney;
  2919. else
  2920. #Customer.OpeningBalanceAdjust_Customer=@tempmoney;
  2921. }
  2922. }
  2923. else
  2924. {
  2925. if(txtPayLimit2.CValue!=@tempmoney)
  2926. {
  2927. if(txtPayLimit2.CValue!=-@tempmoney)
  2928. {
  2929. if (txtPayLimit2.CValue >=0)
  2930. #Customer.OpeningBalanceAdjust_Customer=txtPayLimit2.CValue;
  2931. else
  2932. #Customer.OpeningBalanceAdjust_Customer=-txtPayLimit2.CValue;
  2933. }
  2934. }
  2935. else
  2936. {
  2937. if(@tempmoney>=0)
  2938. #Customer.OpeningBalanceAdjust_Customer=@tempmoney;
  2939. else
  2940. #Customer.OpeningBalanceAdjust_Customer=-@tempmoney;
  2941. }
  2942. }
  2943. Update();
  2944. }
  2945. ChangeMode("View");
  2946. ]]>
  2947. </SubmitButtonClick>
  2948. </Lables>
  2949. </Form>
  2950. </Forms>