FrmCustomerold.xml 173 KB

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