6.以表格单据式单表为模板定制模块:订单信息维护

1.业务需求:实现对订单信息的一个维护模块,该模块涉及到两个表,客户信息表和订单信息表的逻辑结构和物理结构如下:

创建表的SQL:

CREATE TABLE K_Custom
(
 CustomID             varchar(10)  NOT NULL ,
 Province             varchar(50)  NULL ,
 UnitName             varchar(100)  NULL ,
 PName                varchar(50)  NULL ,
 Sex                  varchar(3)  NULL ,
 MobileNo             varchar(20)  NULL ,
 Tel                  varchar(20)  NULL ,
 QQNo                 varchar(15)  NULL ,
 Fax                  varchar(20)  NULL ,
 Depart               varchar(100)  NULL ,
 Duty                 varchar(20)  NULL ,
 Address              varchar(200)  NULL ,
 Birthday             datetime  NULL ,
 E_mail               varchar(20)  NULL ,
 MicroLetterNo        varchar(15)  NULL ,
 CustomType           tinyint  NULL ,
 InputDate            datetime  NULL ,
 EmpID                int  NULL ,
 Notes                varchar(300)  NULL ,
 Flag                 tinyint  NULL ,
 BNumber              int  NULL ,
 Period               tinyint  NULL
)
go


ALTER TABLE K_Custom
 ADD CONSTRAINT XPKK_Custom PRIMARY KEY  NONCLUSTERED (CustomID ASC)
go


CREATE TABLE K_OrderInf
(
 OrderID              varchar(10)  NOT NULL ,
 CustomID             varchar(10)  NULL ,
 OrderDate            datetime  NULL ,
 ContractMoney        numeric(8,2)  NULL ,
 InvoiceType          tinyint  NULL ,
 PayMoney             numeric(8,2)  NULL ,
 PayDate              datetime  NULL ,
 SendDate             datetime  NULL ,
 IssueMoney           numeric(8,2)  NULL ,
 IssueDate            datetime  NULL ,
 GoodName             varchar(100)  NULL ,
 ContractNo           varchar(30)  NULL ,
 IsPay                bit  NULL ,
 InputDate            datetime  NULL ,
 EmpID                int  NULL ,
 IsCalc               bit  NULL ,
 CEmpID               int  NULL ,
 SEmpID               int  NULL ,
 Remark               varchar(200)  NULL
)
go


ALTER TABLE K_OrderInf
 ADD CONSTRAINT XPKK_OrderInf PRIMARY KEY  NONCLUSTERED (OrderID ASC)
go



ALTER TABLE K_OrderInf
 ADD CONSTRAINT R_1 FOREIGN KEY (CustomID) REFERENCES K_Custom(CustomID)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION
go


表K_Custom和表K_OrderInf是主细关系


2.打开模块构件,新增一个模块,模块构件的属性设置界面如下:

3.打开界面元素构件,选中订单信息维护模块,新增一个界面元素,界面元素的属性设置如下:

其中查询SQL为:

select ceiling(count(*)/10.0) from CRMData.dbo.K_Custom x,CRMData.dbo.K_OrderInf y
where x.CustomID=y.CustomID and x.UnitName like '%'+@UnitName_+'%'
and x.PName like '%'+@PName_+'%' andy.InvoiceType=@InvoiceType_;
select TOP 10 * from (select ROW_NUMBER() OVER(ORDER BY y.OrderID desc) as RowNumber_,
y.OrderID,x.Province,x.UnitName,x.PName,y.CustomID,y.OrderDate,y.ContractMoney,y.InvoiceType,y.PayMoney,y.PayDate
      ,y.SendDate,y.IssueMoney,y.IssueDate,y.GoodName,y.ContractNo,y.IsPay,y.InputDate,
case when y.IsPay=1 then '已付款' else '未付款' end IsPayName,y.Remark
from CRMData.dbo.K_Custom x,CRMData.dbo.K_OrderInf y
where x.CustomID=y.CustomID and x.UnitName like '%'+@UnitName_+'%'
and x.PName like '%'+@PName_+'%'
and y.InvoiceType=@InvoiceType_) as a_ where a_.RowNumber_>@pageNo_;
select RowNumber_ from (select ROW_NUMBER() OVER(ORDER BY y.OrderID desc) as RowNumber_,
y.OrderID from CRMData.dbo.K_Custom x,CRMData.dbo.K_OrderInf y
where x.CustomID=y.CustomID and x.UnitName like '%'+@UnitName_+'%'
and x.PName like '%'+@PName_+'%'
and y.InvoiceType=@InvoiceType_) as a_ wherea_.OrderID=@OrderID_

查询SQL中共有三个SQL查询语句,之间用分号分开,第一个SQL用于计算页数;第二个SQL用于查询出某页的数据,参数@pageNo_必需要有,表示某页的开始行号,由系统自动把下页开始行号值传入SQL,从而实现翻页的功能,函数ROW_NUMBER() OVER(ORDER BY y.OrderID desc)表示以y.OrderID字段进行排序来生成行号,该函数也必须有,因为用SQL进行翻页性能最好。第三个SQL用于计算主键OrderID@OrderID_值时的行号,用于新增或修改时进行行定位,刷新数据后选中行定位到当前新增行或当前修改行。

选中订单信息列表界面元,新增第二个界面元素,界面元素的属性设置如下:

其中查询SQL为:

select 1;
select y.OrderID,x.Province,x.UnitName,x.PName,y.CustomID,y.OrderDate,y.ContractMoney,y.InvoiceType,y.PayMoney,y.PayDate
      ,y.SendDate,y.IssueMoney,y.IssueDate,y.GoodName,y.ContractNo,y.IsPay,y.InputDate,
case when y.IsPay=1 then '已付款' else '未付款' end IsPayName,
case when y.InvoiceType=0 then '不开发票' when y.InvoiceType=1 then '普通发票' when y.InvoiceType=2 then '增值发票' end InvoiceTypeName,
y.Remark,y.CEmpID,y.SEmpID,y.EmpID,m.EmpName AEmpName,n.EmpName CEmpName,k.EmpName SEmpName
from CRMData.dbo.K_Custom x,CRMData.dbo.K_OrderInf y
left join T_Employee m on y.EmpID=m.EmpID
left join T_Employee n on y.CEmpID=n.EmpID
left join T_Employee k on y.SEmpID=k.EmpID
where x.CustomID=y.CustomID and y.OrderID=@OrderID_


4.打开操作构件,选中订单信息维护模块中的订单信息列表界面元素,新增“查询操作,属性设置如下:

     


选中订单信息列表界面元下的订单详细信息界面元素,新增新增、修改、删除、保存、取消操作,这些操作的属性设置如下:

新增属性设置如下图:


修改属性设置如下图:


删除属性设置如下图:

其中点击前执行脚本为:

confirm('你确认要删除该订单信息吗?');

保存属性设置如下图:

取消属性设置如下图:

5.打开界面元查询参数构件,选中订单信息维护模块的订单信息列表界面元,定义五个参数,其属性设置如下:

选中订单信息维护模块的订单详细信息界面元,定义一个主细关系关联参数,其属性设置如下:

6.打开过滤参数构件,选中订单信息维护模块的订单信息列表界面元下的查询操作,定义三个过滤条件参数,属性设置如下:


7.打开字段构件,选中订单信息维护模块中的订单信息列表界面元素,定义的字段属性设置如下:
CustomID字段属性设置:

OrderID字段属性设置:
Province字段属性设置:
UnitName字段属性设置:

PName字段属性设置:
ContractMoney字段属性设置:
PayMoney字段属性设置:
IsPayName字段属性设置如下:
SendDate字段属性设置:
PayDate字段属性设置:
IssueDate字段属性设置:
Remark字段属性设置:
打开字段构件,选中订单信息维护模块中的订单详细信息界面元素,定义的字段属性设置如下:
CEmpID字段属性设置:
CustomID字段属性设置:
EmpID字段属性设置:
InvoiceType字段属性设置:
IsPay字段属性设置:
OrderID字段属性设置:
SEmpID字段属性设置:

Province字段属性设置:
UnitName字段属性设置:
PName字段属性设置:
OrderDate字段属性设置:
ContractMoney字段属性设置:
InvoiceTypeName字段属性设置:
PayMoney字段属性设置:
PayDate字段属性设置:
SendDate字段属性设置:
IssueMoney字段属性设置:

IssueDate字段属性设置:
ContractNo字段属性设置:
IsPayName字段属性设置:
InputDate字段属性设置:
Remark字段属性设置:
AEmpName字段属性设置:
CEmpName字段属性设置:
SEmpName字段属性设置:
8.打开自定义表单构件选中订单信息维护模块中的订单详细信息界面元素,新增一个自定义表单,在HTML编辑器中新增表格,并在表格中把定义的字段放入相应的位置,生成的自定义界面如下:

上面自定义表单对应的html文本为:
<table bordercolor="#cccccc" style="width:100%;height:100px;" border="1" cellspacing="0" cellpadding="2">
 <tbody>
  <tr>
   <td style="width:8%;height:21px;">
    <label>客户姓名</label>
   </td>
   <td style="width:15%;height:21px;">
    <input id="PName_Edit" type="text" @readonly_="readOnly" @tooltip_="0" @displaystyle_="" @downpos_="0" @defaultstate_="0" @minvalue_="" @maxvalue_="1" @showmsgname_="" @isscriptforce_="false" @exescript_="" @eventtype_="20" @textvalue_="" @defaultvalue_="" @digits_="0" @label_="客户姓名" @oldvalue_="0" @ismodify_="false" @isinsert_="false" @modifyflag_="0" @downpolicyid_="0000000025" @downid_="0000000337" @oldkeyfieldvalue_="" @fieldflag_="Edit" @keyfieldname_="CustomID" @iskey_="false" @getvaluefieldlist_="Province=Province,UnitName=UnitName,PName=PName" @inputtype_="5" @datatype_="STRING" @validate_="1" @maxlength_="25">
   </td>
   <td style="width:8%;height:21px;">
    <label>归属</label>
   </td>
   <td style="width:15%;height:21px;">
    <input id="Province_Edit" style="border: 1px solid rgb(51, 102, 153); border-image: none; width: 90%; background-color: gainsboro;" type="text" @readonly_="readOnly" @tooltip_="0" @displaystyle_="" @downpos_="0" @defaultstate_="0" @minvalue_="" @maxvalue_="1" @showmsgname_="" @isscriptforce_="false" @exescript_="" @eventtype_="0" @textvalue_="" @defaultvalue_="" @digits_="0" @label_="省份" @oldvalue_="0" @ismodify_="false" @isinsert_="false" @modifyflag_="0" @downpolicyid_="" @downid_="null" @oldkeyfieldvalue_="" @fieldflag_="Edit" @keyfieldname_="Province" @iskey_="false" @getvaluefieldlist_="" @inputtype_="1" @datatype_="STRING" @validate_="0" @maxlength_="1">
   </td>
   <td style="width:8%;height:21px;">
    <label>单位名称</label>
   </td>
   <td style="width:23%;height:21px;">
    <input id="UnitName_Edit" style="border: 1px solid rgb(51, 102, 153); border-image: none; width: 90%; background-color: gainsboro;" type="text" @readonly_="readOnly" @tooltip_="0" @displaystyle_="" @downpos_="0" @defaultstate_="0" @minvalue_="" @maxvalue_="1" @showmsgname_="" @isscriptforce_="false" @exescript_="" @eventtype_="0" @textvalue_="" @defaultvalue_="" @digits_="0" @label_="单位名称" @oldvalue_="0" @ismodify_="false" @isinsert_="false" @modifyflag_="0" @downpolicyid_="" @downid_="null" @oldkeyfieldvalue_="" @fieldflag_="Edit" @keyfieldname_="$NULL" @iskey_="false" @getvaluefieldlist_="" @inputtype_="1" @datatype_="STRING" @validate_="0" @maxlength_="50">
   </td>
   <td style="width:8%;height:21px;">
    <label>签订日期</label>
   </td>
   <td style="width:15%;height:21px;">
    <input id="OrderDate_Edit" type="text" @readonly_="readOnly" @tooltip_="0" @displaystyle_="" @downpos_="0" @defaultstate_="0" @minvalue_="" @maxvalue_="1" @showmsgname_="" @isscriptforce_="false" @exescript_="" @eventtype_="20" @textvalue_="" @defaultvalue_="" @digits_="0" @label_="签订日期" @oldvalue_="0" @ismodify_="false" @isinsert_="false" @modifyflag_="0" @downpolicyid_="" @downid_="null" @oldkeyfieldvalue_="" @fieldflag_="Edit" @keyfieldname_="$NULL" @iskey_="false" @getvaluefieldlist_="" @inputtype_="3" @datatype_="DATE" @validate_="0" @maxlength_="1">
   </td>
  </tr>
  <tr>
   <td style="width:8%;height:21px;">
    <label><label>合同编号</label></label>
   </td>
   <td>
    <input id="ContractNo_Edit" style="border: 1px solid rgb(51, 102, 153); border-image: none; width: 90%;" type="text" @readonly_="readOnly" @tooltip_="0" @displaystyle_="" @downpos_="0" @defaultstate_="0" @minvalue_="" @maxvalue_="1" @showmsgname_="" @isscriptforce_="false" @exescript_="" @eventtype_="0" @textvalue_="" @defaultvalue_="" @digits_="0" @label_="合同编号" @oldvalue_="0" @ismodify_="false" @isinsert_="false" @modifyflag_="0" @downpolicyid_="" @downid_="null" @oldkeyfieldvalue_="" @fieldflag_="Edit" @keyfieldname_="$NULL" @iskey_="false" @getvaluefieldlist_="" @inputtype_="2" @datatype_="STRING" @validate_="0" @maxlength_="20" onchange="setModifyFlag();">
   </td>
   <td>
    <label><label>合同金额</label></label>
   </td>
   <td>
    <input id="ContractMoney_Edit" style="border: 1px solid rgb(51, 102, 153); border-image: none; width: 90%;" type="text" @readonly_="readOnly" @tooltip_="0" @displaystyle_="" @downpos_="0" @defaultstate_="0" @minvalue_="" @maxvalue_="99999999" @showmsgname_="" @isscriptforce_="false" @exescript_="" @eventtype_="20" @textvalue_="" @defaultvalue_="" @digits_="2" @label_="合同金额" @oldvalue_="0" @ismodify_="false" @isinsert_="false" @modifyflag_="0" @downpolicyid_="" @downid_="null" @oldkeyfieldvalue_="" @fieldflag_="Edit" @keyfieldname_="$NULL" @iskey_="false" @getvaluefieldlist_="" @inputtype_="2" @datatype_="NUMERIC" @validate_="0" @maxlength_="27" onchange="setModifyFlag();">
   </td>
   <td>
    <label>开票类型</label>
   </td>
   <td>
    <input id="InvoiceTypeName_Edit" type="text" @readonly_="readOnly" @tooltip_="0" @displaystyle_="" @downpos_="0" @defaultstate_="0" @minvalue_="" @maxvalue_="1" @showmsgname_="" @isscriptforce_="false" @exescript_="" @eventtype_="20" @textvalue_="" @defaultvalue_="" @digits_="0" @label_="开票类型" @oldvalue_="0" @ismodify_="false" @isinsert_="false" @modifyflag_="0" @downpolicyid_="" @downid_="0000000335" @oldkeyfieldvalue_="" @fieldflag_="Edit" @keyfieldname_="InvoiceType" @iskey_="false" @getvaluefieldlist_="" @inputtype_="4" @datatype_="STRING" @validate_="0" @maxlength_="1">
   </td>
   <td>
    <label><label>销售录入员</label></label>
   </td>
   <td>
    <input id="AEmpName_Edit" style="border: 1px solid rgb(51, 102, 153); border-image: none; width: 90%; background-color: gainsboro;" type="text" @readonly_="readOnly" @tooltip_="0" @displaystyle_="" @downpos_="0" @defaultstate_="0" @minvalue_="" @maxvalue_="1" @showmsgname_="" @isscriptforce_="false" @exescript_="" @eventtype_="0" @textvalue_="" @defaultvalue_="" @digits_="0" @label_="销售录入员" @oldvalue_="0" @ismodify_="false" @isinsert_="false" @modifyflag_="0" @downpolicyid_="" @downid_="null" @oldkeyfieldvalue_="" @fieldflag_="Edit" @keyfieldname_="EmpID" @iskey_="false" @getvaluefieldlist_="" @inputtype_="1" @datatype_="STRING" @validate_="0" @maxlength_="1">
   </td>
  </tr>
  <tr>
   <td style="width:8%;height:21px;">
    <label>是否已付款</label>
   </td>
   <td>
    <input id="IsPayName_Edit" type="text" @readonly_="readOnly" @tooltip_="0" @displaystyle_="" @downpos_="0" @defaultstate_="0" @minvalue_="" @maxvalue_="1" @showmsgname_="" @isscriptforce_="false" @exescript_="" @eventtype_="20" @textvalue_="" @defaultvalue_="" @digits_="0" @label_="是否已付款" @oldvalue_="0" @ismodify_="false" @isinsert_="false" @modifyflag_="0" @downpolicyid_="" @downid_="0000000336" @oldkeyfieldvalue_="" @fieldflag_="Edit" @keyfieldname_="IsPay" @iskey_="false" @getvaluefieldlist_="" @inputtype_="4" @datatype_="STRING" @validate_="0" @maxlength_="1">
   </td>
   <td>
    <label><label>付款日期</label></label>
   </td>
   <td>
    <input id="PayDate_Edit" type="text" @readonly_="readOnly" @tooltip_="0" @displaystyle_="" @downpos_="0" @defaultstate_="0" @minvalue_="" @maxvalue_="1" @showmsgname_="" @isscriptforce_="false" @exescript_="" @eventtype_="20" @textvalue_="" @defaultvalue_="" @digits_="0" @label_="付款日期" @oldvalue_="0" @ismodify_="false" @isinsert_="false" @modifyflag_="0" @downpolicyid_="" @downid_="null" @oldkeyfieldvalue_="" @fieldflag_="Edit" @keyfieldname_="$NULL" @iskey_="false" @getvaluefieldlist_="" @inputtype_="3" @datatype_="DATE" @validate_="0" @maxlength_="1">
   </td>
   <td>
    <label>付款金额</label>
   </td>
   <td>
    <input id="PayMoney_Edit" style="border: 1px solid rgb(51, 102, 153); border-image: none; width: 90%;" type="text" @readonly_="readOnly" @tooltip_="0" @displaystyle_="" @downpos_="0" @defaultstate_="0" @minvalue_="" @maxvalue_="99999999" @showmsgname_="" @isscriptforce_="false" @exescript_="" @eventtype_="20" @textvalue_="" @defaultvalue_="" @digits_="2" @label_="付款金额" @oldvalue_="0" @ismodify_="false" @isinsert_="false" @modifyflag_="0" @downpolicyid_="" @downid_="null" @oldkeyfieldvalue_="" @fieldflag_="Edit" @keyfieldname_="$NULL" @iskey_="false" @getvaluefieldlist_="" @inputtype_="2" @datatype_="NUMERIC" @validate_="0" @maxlength_="27" onchange="setModifyFlag();">
   </td>
   <td>
    <label><label>财务录入员</label></label>
   </td>
   <td>
    <input id="CEmpName_Edit" style="border: 1px solid rgb(51, 102, 153); border-image: none; width: 90%; background-color: gainsboro;" type="text" @readonly_="readOnly" @tooltip_="0" @displaystyle_="" @downpos_="0" @defaultstate_="0" @minvalue_="" @maxvalue_="1" @showmsgname_="" @isscriptforce_="false" @exescript_="" @eventtype_="0" @textvalue_="" @defaultvalue_="" @digits_="0" @label_="财务录入员" @oldvalue_="0" @ismodify_="false" @isinsert_="false" @modifyflag_="0" @downpolicyid_="" @downid_="null" @oldkeyfieldvalue_="" @fieldflag_="Edit" @keyfieldname_="CEmpID" @iskey_="false" @getvaluefieldlist_="" @inputtype_="1" @datatype_="STRING" @validate_="0" @maxlength_="1">
   </td>
  </tr>
  <tr>
   <td style="width:8%;height:21px;">
    <label>开票日期</label>
   </td>
   <td>
    <input id="IssueDate_Edit" type="text" @readonly_="readOnly" @tooltip_="0" @displaystyle_="" @downpos_="0" @defaultstate_="0" @minvalue_="" @maxvalue_="1" @showmsgname_="" @isscriptforce_="false" @exescript_="" @eventtype_="20" @textvalue_="" @defaultvalue_="" @digits_="0" @label_="开票日期" @oldvalue_="0" @ismodify_="false" @isinsert_="false" @modifyflag_="0" @downpolicyid_="" @downid_="null" @oldkeyfieldvalue_="" @fieldflag_="Edit" @keyfieldname_="$NULL" @iskey_="false" @getvaluefieldlist_="" @inputtype_="3" @datatype_="DATE" @validate_="0" @maxlength_="1">
   </td>
   <td>
    <label><label>开票金额</label></label>
   </td>
   <td>
    <input id="IssueMoney_Edit" style="border: 1px solid rgb(51, 102, 153); border-image: none; width: 90%;" type="text" @readonly_="readOnly" @tooltip_="0" @displaystyle_="" @downpos_="0" @defaultstate_="0" @minvalue_="" @maxvalue_="99999999" @showmsgname_="" @isscriptforce_="false" @exescript_="" @eventtype_="20" @textvalue_="" @defaultvalue_="" @digits_="2" @label_="开票金额" @oldvalue_="0" @ismodify_="false" @isinsert_="false" @modifyflag_="0" @downpolicyid_="" @downid_="null" @oldkeyfieldvalue_="" @fieldflag_="Edit" @keyfieldname_="$NULL" @iskey_="false" @getvaluefieldlist_="" @inputtype_="2" @datatype_="NUMERIC" @validate_="0" @maxlength_="27" onchange="setModifyFlag();">
   </td>
   <td>
    <label>发货日期</label>
   </td>
   <td>
    <input id="SendDate_Edit" type="text" @readonly_="readOnly" @tooltip_="0" @displaystyle_="" @downpos_="0" @defaultstate_="0" @minvalue_="" @maxvalue_="1" @showmsgname_="" @isscriptforce_="false" @exescript_="" @eventtype_="20" @textvalue_="" @defaultvalue_="" @digits_="0" @label_="发货日期" @oldvalue_="0" @ismodify_="false" @isinsert_="false" @modifyflag_="0" @downpolicyid_="" @downid_="null" @oldkeyfieldvalue_="" @fieldflag_="Edit" @keyfieldname_="$NULL" @iskey_="false" @getvaluefieldlist_="" @inputtype_="3" @datatype_="DATE" @validate_="0" @maxlength_="1">
   </td>
   <td>
    <label>发货录入员</label>
   </td>
   <td>
    <input id="SEmpName_Edit" style="border: 1px solid rgb(51, 102, 153); border-image: none; width: 90%; background-color: gainsboro;" type="text" @readonly_="readOnly" @tooltip_="0" @displaystyle_="" @downpos_="0" @defaultstate_="0" @minvalue_="" @maxvalue_="1" @showmsgname_="" @isscriptforce_="false" @exescript_="" @eventtype_="0" @textvalue_="" @defaultvalue_="" @digits_="0" @label_="发货录入员" @oldvalue_="0" @ismodify_="false" @isinsert_="false" @modifyflag_="0" @downpolicyid_="" @downid_="null" @oldkeyfieldvalue_="" @fieldflag_="Edit" @keyfieldname_="SEmpID" @iskey_="false" @getvaluefieldlist_="" @inputtype_="1" @datatype_="STRING" @validate_="0" @maxlength_="1">
   </td>
  </tr>
  <tr>
   <td style="width:8%;height:21px;">
    <label>录入日期</label>
   </td>
   <td>
    <input id="InputDate_Edit" style="border: 1px solid rgb(51, 102, 153); border-image: none; width: 90%; background-color: gainsboro;" type="text" @readonly_="readOnly" @tooltip_="0" @displaystyle_="" @downpos_="0" @defaultstate_="0" @minvalue_="" @maxvalue_="1" @showmsgname_="" @isscriptforce_="false" @exescript_="" @eventtype_="0" @textvalue_="" @defaultvalue_="" @digits_="0" @label_="录入日期" @oldvalue_="0" @ismodify_="false" @isinsert_="false" @modifyflag_="0" @downpolicyid_="" @downid_="null" @oldkeyfieldvalue_="" @fieldflag_="Edit" @keyfieldname_="$NULL" @iskey_="false" @getvaluefieldlist_="" @inputtype_="1" @datatype_="DATE" @validate_="0" @maxlength_="1">
   </td>
   <td>
    <label>备注</label><br />
   </td>
   <td colspan="5">
    <input id="Remark_Edit" style="border: 1px solid rgb(51, 102, 153); border-image: none; width: 90%;" type="text" @readonly_="readOnly" @tooltip_="0" @displaystyle_="" @downpos_="0" @defaultstate_="0" @minvalue_="" @maxvalue_="1" @showmsgname_="" @isscriptforce_="false" @exescript_="" @eventtype_="0" @textvalue_="" @defaultvalue_="" @digits_="0" @label_="备注" @oldvalue_="0" @ismodify_="false" @isinsert_="false" @modifyflag_="0" @downpolicyid_="" @downid_="null" @oldkeyfieldvalue_="" @fieldflag_="Edit" @keyfieldname_="$NULL" @iskey_="false" @getvaluefieldlist_="" @inputtype_="2" @datatype_="STRING" @validate_="0" @maxlength_="100" onchange="setModifyFlag();">
   </td>
  </tr>
 </tbody>
</table>
<br />
打开界面元素构件,把订单详细信息界面元素的自定义表单属性设置为该表单:

9.打开操作SQL构件,选中订单信息维护理模块中的订单详细信息界面元素的删除操作,属性设置如下图:

其中执行SQL为:
delete from CRMData.dbo.K_OrderInf whereOrderID=@OrderID_
选中保存操作,其中新增状态的属性设置如下图:
新增状态执行SQL为:
DECLARE @EmpID_ int
DECLARE @CEmpID_ int
DECLARE @SEmpID_ int
set @EmpID_=null
set @CEmpID_=null
set @SEmpID_=null
if(@OrderDate_ is not null or @ContractMoney_ is not null or @InvoiceType_ is not null)
   set @EmpID_=@XEmpID_
if(@IsPay_ is not null or @PayDate_ is not null or @PayMoney_ is not null)
  set @CEmpID_=@XEmpID_
if(@IssueDate_ is not null or @IssueMoney_ is not null or @SendDate_ is not null)
  set @SEmpID_=@XEmpID_
Insert into CRMData.dbo.K_OrderInf
 ( ContractMoney,ContractNo,CustomID,EmpID,InputDate,InvoiceType,IsPay,IssueDate,IssueMoney,OrderDate,OrderID,PayMoney,PayDate,SendDate,CEmpID,SEmpID,Remark)
 values
( @ContractMoney_,@ContractNo_,@CustomID_,@EmpID_,getdate(),isnull(@InvoiceType_,0),@IsPay_,@IssueDate_,@IssueMoney_,@OrderDate_,@OrderID_,@PayMoney_,@PayDate_,@SendDate_,@CEmpID_,@SEmpID_,@Remark_)
set @ReStr_=@OrderID_
新增状态执行SQL中的参数属性设置为:
参数属性设置第一页
参数属性设置第二页
第一页的参数设置中的参数@OrderID_为系统自动生成的,这需要在编码规则和公式中去定义(定义表K_OrderInf的字段OrderID的编码规则,在本文稍后说明如何定义)。
其中修改状态的属性设置如下图:
SQL属性设置和参数属性设置第一页
参数属性设置第二页
修改状态的执行SQL为:
if(@OrderDate_ is not null or @ContractMoney_ is not null or @InvoiceType_ is not null)
   Update CRMData.dbo.K_OrderInf set EmpID=@XEmpID_ where OrderID=@OrderID_ and EmpID is null
if(@IsPay_ is not null or @PayDate_ is not null or @PayMoney_ is not null)
   Update CRMData.dbo.K_OrderInf set CEmpID=@XEmpID_ where OrderID=@OrderID_ and CEmpID is null
if(@IssueDate_ is not null or @IssueMoney_ is not null or @SendDate_ is not null)
   Update CRMData.dbo.K_OrderInf set SEmpID=@XEmpID_ where OrderID=@OrderID_ and SEmpID is null
Update CRMData.dbo.K_OrderInf
set
ContractMoney=@ContractMoney_,
ContractNo=@ContractNo_,
CustomID=@CustomID_,
InputDate=@InputDate_,
InvoiceType=@InvoiceType_,
IsPay=@IsPay_,
IssueDate=@IssueDate_,
IssueMoney=@IssueMoney_,
OrderDate=@OrderDate_,
PayDate=@PayDate_,
PayMoney=@PayMoney_,
Remark=@Remark_,
SendDate=@SendDate_
where OrderID=@OrderID_
10.打开编码规则和公式构件的编码规则标签页,新增表K_OrderInf的字段OrderID的编码规则,如下:
选择编码标签页,新增表K_OrderInf的字段OrderID的编码公式:
编码公式定义完后,要在保存操作的新增状态参数@OrderID_属性设置时设置序号生成表名为K_OrderInf生成序号字段名为OrderID(本文前面有叙述)。
到此为止,该模块定制完成,定制出来的模块可以对订单信息进行新增、修改和删除、查询操作了。模块界面如下图:



阅读更多
换一批

没有更多推荐了,返回首页