Ejemplo n.º 1
0
        public override void BindControl()
        {
            SettlementDAL dal = new SettlementDAL();
            var           sts = dal.GetSettlementByOrderNo(SourceNo);

            Utility.BindDataToRepeater(rpItems, sts);
        }
Ejemplo n.º 2
0
        protected void rpOrderList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Order order = e.Item.DataItem as Order;
                FollowUpTop3UserControl followUp = e.Item.FindControl("followUpTop3UserControl") as FollowUpTop3UserControl;
                UIUtility.BindUserControl(followUp, SysConst.SourceTypeOrder, order.Order_No);

                Label         lblContractAmount   = e.Item.FindControl("lblContractAmount") as Label;
                Label         lblSettlementAmount = e.Item.FindControl("lblSettlementAmount") as Label;
                Label         lblReceivedAmount   = e.Item.FindControl("lblReceivedAmount") as Label;
                Label         lblNeedAmount       = e.Item.FindControl("lblNeedAmount") as Label;
                LineItemDAL   lineDAL             = new LineItemDAL();
                SettlementDAL stDAL          = new SettlementDAL();
                ReceiptDAL    rDAL           = new ReceiptDAL();
                var           contractAmount = lineDAL.GetLineItemsBySource(order.Order_Id, SysConst.SourceTypeOrder).Sum(l => l.UnitPrice * l.Quantity);
                var           stAmount       = stDAL.GetSettlementByOrderNo(order.Order_No).Sum(s => s.TotalAmount);
                var           receivedAmount = rDAL.GetReceiptBySource(SysConst.SourceTypeOrder, order.Order_No).Sum(r => r.ReceivedAmount);
                lblContractAmount.Text   = contractAmount.ToString();
                lblSettlementAmount.Text = stAmount.ToString();
                lblReceivedAmount.Text   = receivedAmount.ToString();
                var needAmount = stAmount != 0 ? (stAmount - receivedAmount) : (contractAmount - receivedAmount);
                lblNeedAmount.Text = needAmount.ToString();

                totalContract += contractAmount.GetValueOrDefault();
                totalSt       += stAmount.GetValueOrDefault();
                totalRec      += receivedAmount.GetValueOrDefault();
                totalNeed     += needAmount.GetValueOrDefault();
            }

            if (e.Item.ItemType == ListItemType.Footer)
            {
                var lblTotalContract = e.Item.FindControl("lblTotalContract") as Label;
                var lblTotalST       = e.Item.FindControl("lblTotalST") as Label;
                var lblTotalRec      = e.Item.FindControl("lblTotalRec") as Label;
                var lblTotalNeed     = e.Item.FindControl("lblTotalNeed") as Label;

                lblTotalContract.Text = totalContract.ToString();
                lblTotalNeed.Text     = totalNeed.ToString();
                lblTotalRec.Text      = totalRec.ToString();
                lblTotalST.Text       = totalSt.ToString();
            }
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        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);
                }
            }
        }