protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Utility.BindDataToDropdown(ddlSettlementStatus, Utility.GetSettlementStatusList()); Utility.BindDataToDropdown(ddlSettlementMan, Utility.GetUserList2(true)); DeliveryDAL dlDAL = new DeliveryDAL(); var deliverys = dlDAL.GetDeliveryByOrderNo(SourceNo); if (deliverys != null) { foreach (var item in deliverys) { cblDeliveryList.Items.Add(new ListItem() { Text = item.Delivery_No, Value = item.Delivery_Id.ToString() }); } } //link OrderDAL sDAL = new OrderDAL(); var order = sDAL.GetOrderByNo(SourceNo); lnkOrderId.Text = order.Order_No; lnkOrderId.NavigateUrl = string.Format("orderform.aspx?ordid={0}&ordno={1}&sourcetype={2}&sourceno={3}", order.Order_Id, order.Order_No, order.SourceType, order.SourceNo); SettlementDAL dal = new SettlementDAL(); var st = dal.GetSettlementByNo(StNo); txtCreatedDate.Text = st.CreatedDate.ToString("yyyy-MM-dd"); txtDeliveryDate.Text = st.DeliveryDate.HasValue ? st.DeliveryDate.Value.ToString("yyyy-MM-dd") : string.Empty; ddlSettlementMan.SelectedValue = st.StMan; if (!string.IsNullOrEmpty(st.DeliveryList)) { foreach (ListItem item in cblDeliveryList.Items) { if (st.DeliveryList.Contains(item.Text)) { item.Selected = true; } } } //customer this.customerInfoControl.SetValue(st.CustomerCompanyName, st.CustomerContactName, st.CustomerAddress, st.CustomerEmail, st.CustomerQQ, st.CustomerPhone1, st.CustomerPhone2, st.CustomerOthers); //lineitem LineItemsControl1.IsPriceColumnVisible = true; LineItemsControl1.IsSpecColumnVisible = false; LineItemsControl1.IsFooterVisible = false; LineItemsControl1.SourceId = st.St_Id; UIUtility.BindUserControl(LineItemsControl1, SysConst.SourceTypeSettlement, st.St_No); //amount SetAmount(SysConst.SourceTypeSettlement, st.St_Id); txtTotalAmount.Text = st.TotalAmount.ToString(); txtReceivedFirst.Text = st.FirstAmount.ToString(); txtReceived.Text = st.AmountReceived.ToString(); txtBalanceIntro.Text = st.ReceivableIntro; lblEndBalance.Text = ((st.TotalAmount.HasValue ? st.TotalAmount.Value : 0) - (st.AmountReceived.HasValue ? st.AmountReceived.Value:0)).ToString(); var accumulateAmount = dal.GetSettlementByOrderNo(SourceNo).Where(s => s.CreatedDate <= st.CreatedDate).Sum(settle => settle.TotalAmount); var receivableTotal = new ReceiptDAL().GetReceiptBySource(SysConst.SourceTypeOrder, st.SourceNo).Where(r => r.ReceivedDate <= st.CreatedDate).Sum(re => re.ReceivedAmount); lblAccumulateAmount.Text = accumulateAmount.ToString(); lblReceivableTotal.Text = receivableTotal.ToString(); //status ddlSettlementStatus.SelectedValue = st.Status; //followup UIUtility.BindUserControl(followUpControl, SysConst.SourceTypeSettlement, st.SourceNo); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Utility.BindDataToDropdown(ddlDeliveryStatus, Utility.GetDeliveryStatusList()); Utility.BindDataToDropdown(ddlDeliveryMethod, Utility.GetLookupList(SysConst.DeliveryCatelog)); Utility.BindDataToDropdown(ddlInstallType, Utility.GetLookupList(SysConst.InstallCatelog)); Utility.BindDataToDropdown(ddlDelCreateMan, Utility.GetUserList2(true)); Utility.BindDataToDropdown(ddlSalesMan, Utility.GetUserList2(true)); if (!string.IsNullOrEmpty(DeliveryNo)) { DeliveryDAL dDAL = new DeliveryDAL(); var del = dDAL.GetDeliveryByNo(DeliveryNo); OrderDAL soDAL = new OrderDAL(); var ord = soDAL.GetOrderByNo(SourceNo); MachiningDAL mDAL = new MachiningDAL(); var machList = mDAL.GetMachBySource(SysConst.SourceTypeOrder, SourceNo); foreach (var item in machList) { cblMach.Items.Add(new ListItem() { Text = item.Mach_No, Value = item.Mach_Id.ToString() }); } //basic txtCreatedDate.Text = del.CreatedDate.ToString("yyyy-MM-dd"); ddlSalesMan.SelectedValue = del.OrderMan; ddlDelCreateMan.SelectedValue = del.DeliveryCreateMan; lnkOrder.Text = SourceNo; lnkOrder.NavigateUrl = Page.ResolveUrl(string.Format("~/OrderForm.aspx?ordid={0}&ordno={1}&sourcetype={2}&sourceno={3}", ord.Order_Id, ord.Order_No, ord.SourceType, ord.SourceNo)); if (!string.IsNullOrEmpty(del.MachList)) { foreach (ListItem item in cblMach.Items) { if (del.MachList.Contains(item.Text)) { item.Selected = true; } } } //customer this.customerInfoControl.SetValue( del.CustomerCompanyName, del.CustomerContactName, del.CustomerAddress, del.CustomerEmail, del.CustomerQQ, del.CustomerPhone1, del.CustomerPhone2, del.CustomerOthers); //delivery type this.ddlDeliveryMethod.SelectedValue = del.DeliveryType; this.txtDelIntro.Text = del.DeliveryIntro; this.txtDeliveryDriverMan.Text = del.DeliveryDriverMan; this.txtDelPhone.Text = del.DriverPhone; this.txtCarType.Text = del.CarType; this.txtDeliveryToAddress.Text = del.DeliveryToAddress; this.txtExpectDeliveryDate.Text = del.ExpectedDeliveryDate.HasValue ? del.ExpectedDeliveryDate.Value.ToString("yyyy-MM-dd") : string.Empty; this.txtRealDelDate.Text = del.RealDeliveryDate.HasValue ? del.RealDeliveryDate.Value.ToString("yyyy-MM-dd") : string.Empty; //install this.chkProvideInstall.Checked = del.IsInstallProvided; this.ddlInstallType.SelectedValue = del.InstallType; this.txtInstallIntro.Text = del.InstallIntro; this.txtInstallMan.Text = del.InstallMan; this.txtInstallPhone.Text = del.InstallPhone; this.txtInstallDate.Text = del.InstallDate.HasValue ? del.InstallDate.Value.ToString("yyyy-MM-dd"):string.Empty; this.chkInsteadSettlement.Checked = del.InsteadOfSettlement; //delivery content lineItemControl.SourceId = del.Delivery_Id; UIUtility.BindUserControl(lineItemControl, SysConst.SourceTypeDelivery, del.Delivery_No); //settlement info if (chkInsteadSettlement.Checked) { SettlementDAL dal = new SettlementDAL(); SetAmount(SysConst.SourceTypeDelivery, del.Delivery_Id); txtTotalAmount.Text = del.TotalAmount.ToString(); txtReceivedFirst.Text = del.FirstAmount.ToString(); txtReceived.Text = del.ReceivedAmount.ToString(); txtBalanceIntro.Text = del.ReceivableIntro; lblEndBalance.Text = ((del.TotalAmount.HasValue ? del.TotalAmount.Value : 0) - (del.ReceivedAmount.HasValue ? del.ReceivedAmount.Value : 0)).ToString(); var accumulateAmount = dal.GetSettlementByOrderNo(SourceNo).Where(s => s.CreatedDate <= del.CreatedDate).Sum(settle => settle.TotalAmount); var receivableTotal = new ReceiptDAL().GetReceiptBySource(SysConst.SourceTypeOrder, del.Order_No).Where(r => r.ReceivedDate <= del.CreatedDate).Sum(re => re.ReceivedAmount); lblAccumulateAmount.Text = accumulateAmount.ToString(); lblReceivableTotal.Text = receivableTotal.ToString(); } //intro UIUtility.BindUserControl(FooterIntroControl1, SysConst.SourceTypeDelivery, del.Delivery_No); this.ddlDeliveryStatus.SelectedValue = del.Status; //followup UIUtility.BindUserControl(followUpControl, SysConst.SourceTypeDelivery, del.Delivery_No); } } }