B3代宰模块
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

155 lines
5.0 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using BWP.B3SubstituteKill.BL;
using BWP.B3SubstituteKill.BO;
using BWP.Web.Layout;
using BWP.Web.Utils;
using BWP.Web.WebControls;
using Forks.EnterpriseServices.DataForm;
using Forks.Utils.Collections;
using TSingSoft.WebControls2;
namespace BWP.Web.Pages.B3SubstituteKill.Bills.SubKillGathering_
{
class SubKillGatheringEdit : DepartmentWorkFlowBillEditPage<SubKillGathering, ISubKillGatheringBL>
{
protected override void BuildBasePropertiesEditor(TitlePanel titlePanel, CustomPageLayout.PageLayoutSection pageLayoutSection)
{
var layoutManager = new LayoutManager("", mDFInfo, mDFContainer);
var config = new AutoLayoutConfig();
config.Add("AccountingUnit_ID");
config.Add("Department_ID");
config.Add("Employee_ID");
config.Add("Date");
config.Add("Supplier_ID");
config.Add("Supplier_Tel");
config.Add("Supplier_Card_ID");
config.Add("Supplier_Address");
config.Add("Remark");
layoutManager.Config = config;
pageLayoutSection.ApplyLayout(layoutManager, config, mPageLayoutManager, mDFInfo);
titlePanel.Controls.Add(layoutManager.CreateLayout());
if (layoutManager.Contains("Supplier_ID"))
{
var supplierInput = layoutManager["Supplier_ID"].InputControl as DFChoiceBox;
if (supplierInput != null)
{
var script = @"
var txtValue =parseInt(__DFContainer.getValue('Supplier_ID'));
simpleRestCall('/MainSystem/B3SubstituteKill/Rpcs/SupplierRpc/GetSupplierAndPriceBillID',[txtValue,__DFContainer.getControl('Date').value],
function(result){
if(typeof(result.Address)!='undefined')
{
__DFContainer.setValue('Supplier_Address',result.Address);
}
else
{
__DFContainer.setValue('Supplier_Address','');
}
if(typeof(result.Tel)!='undefined')
{
__DFContainer.setValue('Supplier_Tel',result.Tel);
}
else
{
__DFContainer.setValue('Supplier_Tel','');
}
if(typeof(result.Supplier_Card_ID)!='undefined')
{
__DFContainer.setValue('Supplier_Card_ID',result.Card_ID);
}
else
{
__DFContainer.setValue('Supplier_Card_ID','');
}
},{ });";
supplierInput.OnClientSelected = script;
}
}
}
protected override void BuildBody(System.Web.UI.Control parent)
{
base.BuildBody(parent);
AddCostDetail(parent.EAdd(new TitlePanel("收款明细", "收款明细")));
}
DFEditGrid _detail;
private void AddCostDetail(TitlePanel titlePanel)
{
var vPanel = titlePanel.EAdd(new VLayoutPanel());
AddToolbarControl(vPanel);
var editor = new DFCollectionEditor<SubKillGathering_Detail>(() => Dmo.Details);
editor.AllowDeletionFunc = () => CanSave;
editor.CanDeleteFunc = detail => CanSave;
editor.IsEditableFunc = (field, detail) => CanSave;
_detail = vPanel.Add(new DFEditGrid(editor) { Width = Unit.Percentage(100) });
_detail.Columns.Add(new DFEditGridColumn<DFValueLabel>("StatPay_ID"));
_detail.Columns.Add(new DFEditGridColumn<DFValueLabel>("StatPay_Date"));
_detail.Columns.Add(new DFEditGridColumn<DFValueLabel>("Weigh_ID"));
_detail.Columns.EAdd(new DFEditGridColumn<DFValueLabel>("WeighTime"));
_detail.Columns.EAdd(new DFEditGridColumn<DFValueLabel>("StatPay_ReceiveMoney"));
_detail.Columns.EAdd(new DFEditGridColumn<DFValueLabel>("AlreadyReceiveMoney"));
_detail.Columns.EAdd(new DFEditGridColumn<DFTextBox>("ThisReceiveMoney"));
_detail.Columns.EAdd(new DFEditGridColumn<DFTextBox>("Remark"));
var section = mPageLayoutManager.AddSection("CostDetail", "收款明细");
titlePanel.SetPageLayoutSetting(mPageLayoutManager, section.Name);
section.ApplyLayout(_detail, mPageLayoutManager, DFInfo.Get(typeof(SubKillGathering_Detail)));
}
private void AddToolbarControl(VLayoutPanel vPanel)
{
if (CanSave)
{
var hPanel = vPanel.Add(new HLayoutPanel(), new VLayoutOption(HorizontalAlign.Left));
var dialogButton = hPanel.Add(new DialogButton
{
Text = "选择结算单",
Url = "SelectStatPayDialog.aspx?"
});
dialogButton.BeforeClientClick = "var sid=__DFContainer.getValue('Supplier_ID'); if (sid == '') { alert('先选择供应商');return false;}";
dialogButton.ClientDynamicParamGetter = "return 'Supplier_ID=' + __DFContainer.getValue('Supplier_ID')";
dialogButton.Click += delegate {
_detail.GetFromUI();
var details = DialogUtil.GetCachedObj<SubKillGathering_Detail>(this);
foreach (SubKillGathering_Detail detail in details)
{
if (Dmo.Details.Any(x => x.StatPay_ID == detail.StatPay_ID))
continue;
Dmo.Details.Add(detail);
}
_detail.DataBind();
};
}
}
public override void AppToUI()
{
base.AppToUI();
_detail.DataBind();
}
public override void GetFromUI()
{
base.GetFromUI();
_detail.GetFromUI();
}
}
}