Exemplo n.º 1
0
        protected void rpSettlementList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Settlement  st        = e.Item.DataItem as Settlement;
                Repeater    rpDelList = e.Item.FindControl("rpDelList") as Repeater;
                DeliveryDAL dlDAL     = new DeliveryDAL();
                var         deliverys = dlDAL.GetDeliveryByOrderNo(st.SourceNo);

                Utility.BindDataToRepeater(rpDelList, deliverys);
                FollowUpTop3UserControl followUp = e.Item.FindControl("followUpTop3UserControl") as FollowUpTop3UserControl;
                UIUtility.BindUserControl(followUp, SysConst.SourceTypeSettlement, st.St_No);

                Total     += st.TotalAmount.GetValueOrDefault();
                TotalNeed += st.FirstAmount.GetValueOrDefault();
                TotalRec  += st.AmountReceived.GetValueOrDefault();
                TotalEnd  += st.TotalAmount.GetValueOrDefault() - st.AmountReceived.GetValueOrDefault();
            }
            if (e.Item.ItemType == ListItemType.Footer)
            {
                var lblTotal = e.Item.FindControl("lblTotal") as Label;
                var lblNeed  = e.Item.FindControl("lblNeed") as Label;
                var lblRec   = e.Item.FindControl("lblRec") as Label;
                var lblEnd   = e.Item.FindControl("lblEnd") as Label;
                lblTotal.Text = Total.ToString();
                lblNeed.Text  = TotalNeed.ToString();
                lblRec.Text   = TotalRec.ToString();
                lblEnd.Text   = TotalEnd.ToString();
            }
        }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Utility.BindDataToDropdown(ddlPurchaseStatus, Utility.GetPurchaseStatusList());
         Utility.BindDataToDropdown(ddlApplyPurchaseMan, Utility.GetUserList2(true));
         Utility.BindDataToDropdown(ddlApproveMan, Utility.GetUserList2(true));
         Utility.BindDataToDropdown(ddlMachMan, Utility.GetUserList2(true));
         Utility.BindDataToDropdown(ddlMachTableMan, Utility.GetUserList2(true));
         Utility.BindDataToDropdown(ddlPurchaseMan, Utility.GetUserList2(true));
         Utility.BindDataToDropdown(ddlSalesMan, Utility.GetUserList2(true));
         PurchaseOrderDAL dal = new PurchaseOrderDAL();
         var po = dal.GetPOByNo(PONo);
         txtPurchaseId.Text                = po.Purchase_No;
         txtPurchaseCreatedDate.Text       = po.CreatedDate.ToString("yyyy-MM-dd");
         txtApplyPurchaseDate.Text         = po.ApplyPurchaseDate.HasValue ? po.ApplyPurchaseDate.Value.ToString("yyyy-MM-dd") : string.Empty;
         txtExpectedCompleteDate.Text      = po.ExpectedCompleteDate.HasValue ? po.ExpectedCompleteDate.Value.ToString("yyyy-MM-dd") : string.Empty;
         ddlSalesMan.SelectedValue         = po.EnqOrdMan;
         ddlMachMan.SelectedValue          = po.MachiningCreateMan;
         ddlPurchaseMan.SelectedValue      = po.PurchaseMan;
         ddlApplyPurchaseMan.SelectedValue = po.PurchaseApplyMan;
         ddlApproveMan.SelectedValue       = po.ApproveMan;
         ddlMachTableMan.SelectedValue     = po.MachTableCreateMan;
         txtPurchaseSummary.Text           = po.PurchaseIntro;
         //purchase content
         BindControl();
         //status
         ddlPurchaseStatus.SelectedValue = po.Status;
         //followup
         UIUtility.BindUserControl(followUpControl, SysConst.SourceTypePurchase, PONo);
     }
 }
Exemplo n.º 3
0
 protected void rpQuotationList_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         FollowUpTop3UserControl followUpTop3UserControl = e.Item.FindControl("followUpTop3UserControl") as FollowUpTop3UserControl;
         UIUtility.BindUserControl(followUpTop3UserControl, SysConst.SourceTypeQuote, ((Quotation)e.Item.DataItem).Quotation_No);
     }
 }
Exemplo n.º 4
0
 protected void rpPurchaseList_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         FollowUpTop3UserControl followUp = e.Item.FindControl("followUpTop3UserControl") as FollowUpTop3UserControl;
         UIUtility.BindUserControl(followUp, SysConst.SourceTypePurchase, ((PurchaseOrder)e.Item.DataItem).Purchase_No);
     }
 }
Exemplo n.º 5
0
        protected void btnImport_Click(object sender, EventArgs e)
        {
            SettlementDAL dal  = new SettlementDAL();
            LineItemDAL   lDal = new LineItemDAL();

            var             settlement = dal.GetSettlementById(StId);
            StringBuilder   sb         = new StringBuilder(256);
            List <LineItem> lineItems  = new List <LineItem>();

            foreach (ListItem item in cblDeliveryList.Items)
            {
                if (item.Selected)
                {
                    sb.Append(item.Text).Append("|");
                    lineItems.AddRange(lDal.GetLineItemsBySource(int.Parse(item.Value), SysConst.SourceTypeDelivery));
                }
            }
            settlement.DeliveryList = sb.ToString();

            dal.Save();


            var dbItems = lDal.GetLineItemsBySource(this.StId, SysConst.SourceTypeSettlement);

            foreach (var item in dbItems)
            {
                lDal.DeleteItem(item.LineItem_Id);
            }

            foreach (var item in lineItems)
            {
                LineItem li = new LineItem()
                {
                    Intro      = item.Intro,
                    Name       = item.Name,
                    OriginNo   = item.OriginNo,
                    Project    = item.Project,
                    Quantity   = item.Quantity,
                    Remark     = item.Remark,
                    SourceId   = this.StId,
                    SourceType = SysConst.SourceTypeSettlement,
                    Spec       = item.Spec,
                    Unit       = item.Unit,
                    UnitPrice  = item.UnitPrice
                };
                lDal.AddLineItem(li);
            }
            lDal.Save();

            UIUtility.BindUserControl(LineItemsControl1, SysConst.SourceTypeSettlement, StId);
        }
Exemplo n.º 6
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();
            }
        }
Exemplo n.º 7
0
        protected void rpEnqList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Enquiry      enq  = e.Item.DataItem as Enquiry;
                RefineDAL    rDal = new RefineDAL();
                SurveyDAL    sDal = new SurveyDAL();
                QuotationDAL qDal = new QuotationDAL();

                Repeater rpRefinement = e.Item.FindControl("rpRefinement") as Repeater;
                Utility.BindDataToRepeater(rpRefinement, rDal.GetRefineBySource(SysConst.SourceTypeEnquiry, enq.Enquiry_No));

                Repeater rpSurvey = e.Item.FindControl("rpSurvey") as Repeater;
                Utility.BindDataToRepeater(rpSurvey, sDal.GetSurveyBySource(enq.Enquiry_No, SysConst.SourceTypeEnquiry));

                Repeater rpQuoationa = e.Item.FindControl("rpQuoation") as Repeater;
                Utility.BindDataToRepeater(rpQuoationa, qDal.GetQuotesBySource(SysConst.SourceTypeEnquiry, enq.Enquiry_No));

                FollowUpTop3UserControl followUp = e.Item.FindControl("followUpTop3UserControl") as FollowUpTop3UserControl;
                UIUtility.BindUserControl(followUp, SysConst.SourceTypeEnquiry, ((Enquiry)e.Item.DataItem).Enquiry_No);
            }
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility.BindDataToDropdown(ddlEnqOrdMan, Utility.GetUserList2(true));
                Utility.BindDataToDropdown(ddlRefMan, Utility.GetUserList2(true));

                if (!string.IsNullOrEmpty(SourceType) && !string.IsNullOrEmpty(SourceNo))
                {
                    //link
                    if (string.Equals(SourceType, SysConst.SourceTypeEnquiry, StringComparison.OrdinalIgnoreCase))
                    {
                        EnquiryDAL eDAL = new EnquiryDAL();
                        var        enq  = eDAL.GetEnquiryByNo(SourceNo);
                        lnkSource.NavigateUrl = Page.ResolveUrl(string.Format("~/enquiryform.aspx?enqno={0}&enqid={1}", SourceNo, enq.Enquiry_Id));
                    }
                    else
                    {
                        OrderDAL sDAL = new OrderDAL();
                        var      ord  = sDAL.GetOrderByNo(SourceNo);
                        lnkSource.NavigateUrl = Page.ResolveUrl(string.Format("~/orderform.aspx?ordno={0}&ordid={1}&sourcetype={2}&sourceno={3}", SourceNo, ord.Order_Id, ord.SourceType, ord.SourceNo));
                    }
                    lnkSource.Text = SourceNo;

                    RefineDAL dal    = new RefineDAL();
                    var       refine = dal.GetRefineByNo(RefNo);
                    //basic
                    txtCreatedDate.Text         = refine.CreatedDate.ToString("yyyy-MM-dd");
                    ddlEnqOrdMan.SelectedValue  = refine.EnqOrdMan;
                    ddlRefMan.SelectedValue     = refine.RefineMan;
                    txtCompletedDate.Text       = refine.RequestCompleteDate.HasValue ? refine.RequestCompleteDate.Value.ToString("yyyy-MM-dd") : string.Empty;
                    chkConfirm.Checked          = refine.NeedCustomerConfirm;
                    txtConfirmIntro.Text        = refine.CustomerConfirmIntro;
                    chkIncludeMachining.Checked = refine.IncludeMaching;
                    chkNeedApprove.Checked      = refine.NeedApprove;
                    txtRefineIntro.Text         = refine.RefineIntro;
                    //customer info
                    this.customerInfoControl.SetValue(
                        refine.CustomerCompanyName,
                        refine.CustomerContactName,
                        refine.CustomerAddress,
                        refine.CustomerEmail,
                        refine.CustomerQQ,
                        refine.CustomerPhone1,
                        refine.CustomerPhone2,
                        refine.CustomerOthers);
                    //history cad
                    UIUtility.BindUserControl(cADRefinementControl, SourceType, SourceNo);
                    //customer drawing
                    UIUtility.BindUserControl(customerDrawingControl, SourceType, SourceNo);
                    //survey
                    UIUtility.BindUserControl(surveyControl, SourceType, SourceNo);
                    //cad
                    cADFileListControl.RefineId = RefId;
                    UIUtility.BindUserControl(cADFileListControl, SourceType, SourceNo);
                    //followup
                    UIUtility.BindUserControl(followUpControl, SysConst.SourceTypeRefine, refine.Refine_No);

                    //status dropdown
                    var result = StatusEngine.GetRefineStatus(chkIncludeMachining.Checked, chkNeedApprove.Checked, chkConfirm.Checked);
                    ddlRefineStatus.Items.Clear();
                    foreach (var item in result)
                    {
                        ddlRefineStatus.Items.Add(new ListItem()
                        {
                            Text = item, Value = item
                        });
                    }
                    ddlRefineStatus.SelectedValue = refine.Status;
                }
            }
        }
Exemplo n.º 9
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);
            }
        }
Exemplo n.º 10
0
        protected void cblDeliveryList_SelectedIndexChanged(object sender, EventArgs e)
        {
            List <LineItem> items = new List <LineItem>();
            LineItemDAL     dal   = new LineItemDAL();

            foreach (ListItem listItem in cblDeliveryList.Items)
            {
                if (listItem.Selected)
                {
                    var del      = new DeliveryDAL().GetDeliveryByNo(listItem.Text);
                    var delItems = dal.GetLineItemsBySource(del.Delivery_Id, SysConst.SourceTypeDelivery);
                    foreach (var delItem in delItems)
                    {
                        items.Add(new LineItem()
                        {
                            Intro      = delItem.Intro,
                            Name       = delItem.Name,
                            OriginNo   = listItem.Text,
                            Project    = delItem.Project,
                            Quantity   = delItem.Quantity,
                            Remark     = delItem.Remark,
                            SourceId   = StId,
                            SourceType = SysConst.SourceTypeSettlement,
                            Spec       = delItem.Spec,
                            Unit       = delItem.Unit,
                            UnitPrice  = delItem.UnitPrice
                        });
                    }
                }
                else
                {
                    var lineItemsOfSt = dal.GetLineItemsBySource(StId, SysConst.SourceTypeSettlement);
                    foreach (var item in lineItemsOfSt)
                    {
                        if (item.OriginNo == listItem.Text)
                        {
                            dal.DeleteItem(item.LineItem_Id);
                        }
                    }
                }
            }
            foreach (var item in items)
            {
                dal.AddLineItem(item);
            }
            dal.Save();

            //save list
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < cblDeliveryList.Items.Count; i++)
            {
                if (cblDeliveryList.Items[i].Selected)
                {
                    sb.Append(cblDeliveryList.Items[i].Text).Append("|");
                }
            }
            var stDAL = new SettlementDAL();
            var st    = stDAL.GetSettlementByNo(StNo);

            st.DeliveryList = sb.ToString();
            stDAL.Save();

            UIUtility.BindUserControl(LineItemsControl1, SysConst.SourceTypeSettlement, StId);
        }
Exemplo n.º 11
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);
                }
            }
        }
Exemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility.BindDataToDropdown(ddlMachiningStatus, Utility.GetMachiningStatusList());
                Utility.BindDataToDropdown(ddlMachCreateMan, Utility.GetUserList2(true));
                Utility.BindDataToDropdown(ddlMachTableMan, Utility.GetUserList2(true));
                Utility.BindDataToDropdown(ddlSalesMan, Utility.GetUserList2(true));
                Utility.BindDataToDropdown(ddlRefineMan, Utility.GetUserList2(true));
                Utility.BindDataToDropdown(ddlSurveyMan, Utility.GetUserList2(true));
                Utility.BindDataToDropdown(ddlMachProcessor, Utility.GetUserList2(true));

                if (!string.IsNullOrWhiteSpace(MachNo))
                {
                    MachiningDAL dal  = new MachiningDAL();
                    var          mach = dal.GetMachByNo(MachNo);

                    OrderDAL sDAL  = new OrderDAL();
                    var      order = sDAL.GetOrderByNo(SourceNo);
                    lnkSource.NavigateUrl = Page.ResolveUrl(string.Format("~/OrderForm.aspx?ordno={0}&ordid={1}&sourceno={2}&sourcetype={3}", order.Order_No, order.Order_Id, order.SourceNo, order.SourceType));
                    lnkSource.Text        = SourceNo;

                    txtCreatedDate.Text            = mach.CreatedDate.ToString("yyyy-MM-dd");
                    ddlMachCreateMan.SelectedValue = mach.MachCreateMan;
                    ddlMachTableMan.SelectedValue  = mach.ProcessCreateMan;
                    ddlSalesMan.SelectedValue      = mach.SalesMan;
                    ddlRefineMan.SelectedValue     = mach.RefineMan;
                    ddlSurveyMan.SelectedValue     = mach.SurveyMan;
                    ddlMachProcessor.SelectedValue = mach.MachMan;
                    txtApplyDate.Text             = mach.ApplyDate.HasValue ? mach.ApplyDate.Value.ToString("yyyy-MM-dd") : string.Empty;
                    txtExpectedCompletedDate.Text = mach.ExpectedCompleteDate.HasValue ? mach.ExpectedCompleteDate.Value.ToString("yyyy-MM-dd") : string.Empty;
                    txtCompletedDate.Text         = mach.CompleteDate.HasValue ? mach.CompleteDate.Value.ToString("yyyy-MM-dd") : string.Empty;
                    txtExpectedDeliveryDate.Text  = mach.ExpectedDeliveryDate.HasValue ? mach.ExpectedDeliveryDate.Value.ToString("yyyy-MM-dd") : string.Empty;
                    txtExpectedInstallDate.Text   = mach.ExpectedInstallDate.HasValue ? mach.ExpectedInstallDate.Value.ToString("yyyy-MM-dd") : string.Empty;
                    txtMachiningSummary.Text      = mach.MachIntro;

                    //customer info
                    this.customerInfoControl.SetValue(
                        mach.CustomerCompanyName,
                        mach.CustomerContactName,
                        mach.CustomerAddress,
                        mach.CustomerEmail,
                        mach.CustomerQQ,
                        mach.CustomerPhone1,
                        mach.CustomerPhone2,
                        mach.CustomerOthers);
                    //history refine
                    UIUtility.BindUserControl(cADRefinementControl, SysConst.SourceTypeOrder, SourceNo);
                    //customer drawing
                    customerDrawingControl.IsCustomerProvideImage = order.IsCustomerProvideImage;
                    UIUtility.BindUserControl(customerDrawingControl, SysConst.SourceTypeOrder, order.Order_No);
                    //survey
                    UIUtility.BindUserControl(surveyControl, SysConst.SourceTypeOrder, SourceNo);
                    //purchase
                    UIUtility.BindUserControl(PurchaseControl1, SysConst.SourceTypeMaching, mach.Mach_No);
                    //machining table
                    MachiningLineItem1.IsRefineInstead = mach.IsRefineInstead;
                    MachiningLineItem1.RefineNo        = mach.RefineNo;
                    MachiningLineItem1.RefineIntro     = mach.InsteadIntro;
                    MachiningLineItem1.OrderNo         = order.Order_No;
                    MachiningLineItem1.MachId          = mach.Mach_Id;
                    UIUtility.BindUserControl(MachiningLineItem1, SysConst.SourceTypeMaching, mach.Mach_No);

                    //maching summary
                    MachiningSummaryControl1.MachId = mach.Mach_Id;
                    UIUtility.BindUserControl(MachiningSummaryControl1, SysConst.SourceTypeMaching, mach.Mach_No);
                    //status
                    ddlMachiningStatus.SelectedValue = mach.Status;
                    //followup
                    UIUtility.BindUserControl(followUpControl, SysConst.SourceTypeOrder, order.Order_No);
                }
            }
        }
Exemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility.BindDataToDropdown(ddlSurveyStatus, Utility.GetSurveyStatusList());
                Utility.BindDataToDropdown(ddlEnqOrdMan, Utility.GetUserList2(true));
                Utility.BindDataToDropdown(ddlSurveyMan, Utility.GetUserList2(true));
                if (!string.IsNullOrEmpty(SourceType) && !string.IsNullOrEmpty(SourceNo))
                {
                    //link
                    if (string.Equals(SourceType, SysConst.SourceTypeEnquiry, StringComparison.OrdinalIgnoreCase))
                    {
                        EnquiryDAL eDAL = new EnquiryDAL();
                        var        enq  = eDAL.GetEnquiryByNo(SourceNo);
                        lnkSource.NavigateUrl = Page.ResolveUrl(string.Format("~/enquiryform.aspx?enqno={0}&enqid={1}", SourceNo, enq.Enquiry_Id));
                    }
                    else
                    {
                        OrderDAL sDAL = new OrderDAL();
                        var      ord  = sDAL.GetOrderByNo(SourceNo);
                        lnkSource.NavigateUrl = Page.ResolveUrl(string.Format("~/orderform.aspx?ordno={0}&ordid={1}&sourcetype={2}&sourceno={3}", SourceNo, ord.Order_Id, ord.SourceType, ord.SourceNo));
                    }
                    lnkSource.Text = SourceNo;

                    SurveyDAL dal    = new SurveyDAL();
                    var       survey = dal.GetSurveyById(SVId);
                    //basic
                    txtCreatedDate.Text        = survey.CreatedDate.ToString("yyyy-MM-dd");
                    ddlEnqOrdMan.SelectedValue = survey.EnqOrdMan;
                    txtExpectedSurveyDate.Text = survey.ExpectedSurveyDate != null?survey.ExpectedSurveyDate.Value.ToString("yyyy-MM-dd") : string.Empty;

                    txtOnsiteContactName.Text  = survey.OnSiteContactName;
                    txtOnsiteContactPhone.Text = survey.OnSiteContactPhone;
                    txtSurveyIntro.Text        = survey.SurveyIntro;
                    ddlSurveyMan.SelectedValue = survey.SurveyMan;
                    //goods bring
                    Utility.BindDataToCheckBoxList(chklToos, Utility.GetLookupList("测量物品"));
                    string goods = survey.GoodsBring;
                    if (!string.IsNullOrEmpty(goods))
                    {
                        foreach (ListItem item in chklToos.Items)
                        {
                            if (goods.Contains(item.Text))
                            {
                                item.Selected = true;
                            }
                        }
                    }
                    //customer info
                    this.customerInfoControl.SetValue(
                        survey.CustomerCompanyName,
                        survey.CustomerContactName,
                        survey.CustomerAddress,
                        survey.CustomerEmail,
                        survey.CustomerQQ,
                        survey.CustomerPhone1,
                        survey.CustomerPhone2,
                        survey.CustomerOthers);
                    //line content
                    LineItemsControl1.SourceId = survey.Survey_Id;
                    UIUtility.BindUserControl(LineItemsControl1, SysConst.SourceTypeDelivery, survey.Survey_No);

                    //history survey
                    LineItemsControl1.IsPriceColumnVisible = false;
                    LineItemsControl1.IsFooterVisible      = false;
                    LineItemsControl1.SourceId             = survey.Survey_Id;
                    UIUtility.BindUserControl(LineItemsControl1, SysConst.SourceTypeSurvey, survey.Survey_No);
                    //cad refine
                    UIUtility.BindUserControl(cADRefinementControl, SourceType, SourceNo);
                    //customer drawing
                    UIUtility.BindUserControl(customerDrawingControl, SourceType, SourceNo);
                    //refine
                    UIUtility.BindUserControl(surveyControl, SourceType, SourceNo);
                    //survey data
                    if (!string.IsNullOrEmpty(survey.SurveyImagePath))
                    {
                        imgSurveyData.ImageUrl      = Page.ResolveUrl(survey.SurveyImagePath);
                        imgSurveyData.AlternateText = survey.SurveyImageName;
                    }
                    //followup
                    UIUtility.BindUserControl(followUpControl, SysConst.SourceTypeSurvey, survey.Survey_No);

                    //status dropdown
                    ddlSurveyStatus.SelectedValue = survey.Status;
                }
            }
        }
Exemplo n.º 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //dropdown
                Utility.BindDataToDropdown(ddlEnquiryStatus, Utility.GetEnquiryStatusList());
                Utility.BindDataToDropdown(ddlEnqMan, Utility.GetUserList2(true));
                if (!string.IsNullOrWhiteSpace(EnqNo))
                {
                    EnquiryDAL dal = new EnquiryDAL();
                    var        enq = dal.GetEnquiryById(EnqId);
                    txtEnqNo.Text            = enq.Enquiry_No;
                    this.txtCreatedDate.Text = enq.CreatedDate.ToString("yyyy-MM-dd");
                    this.txtRemark.Text      = enq.Remark;
                    this.txtBeginDate.Text   = enq.ExpectedBeginDate != null?enq.ExpectedBeginDate.Value.ToString("yyyy-MM-dd") : string.Empty;

                    this.txtEndDate.Text = enq.ExpectedEndDate != null?enq.ExpectedEndDate.Value.ToString("yyyy-MM-dd") : string.Empty;

                    this.txtTimeLimitRemark.Text = enq.TimeLimitRemark;
                    this.lblStatus.Text          = enq.Status;
                    this.ddlEnqMan.SelectedValue = enq.EnqMan;
                    this.txtEnqSummary.Text      = enq.Summary;
                    //customer info
                    this.customerInfoControl.SetValue(
                        enq.CustomerCompanyName,
                        enq.CustomerContactName,
                        enq.CustomerAddress,
                        enq.CustomerEmail,
                        enq.CustomerQQ,
                        enq.CustomerPhone1,
                        enq.CustomerPhone2,
                        enq.CustomerOthers);
                    //enq content
                    UIUtility.BindUserControl(lineItemsControl, SysConst.SourceTypeEnquiry, enq.Enquiry_Id);
                    //enq img
                    enquiryImageControl.ImagePath = enq.EnquiryImgPath;
                    enquiryImageControl.EnquiryId = enq.Enquiry_Id;
                    UIUtility.BindUserControl(enquiryImageControl, SysConst.SourceTypeSurvey, enq.Enquiry_No);
                    //sample
                    this.SampleControl1.SetValue(enq.IsSampleProvidedToCustomer, enq.IsCustomerProvideSample);
                    UIUtility.BindUserControl(SampleControl1, SysConst.SourceTypeEnquiry, enq.Enquiry_No);
                    //customer drawing
                    customerDrawingControl.IsCustomerProvideImage = enq.IsCustomerProvideImage;
                    UIUtility.BindUserControl(customerDrawingControl, SysConst.SourceTypeEnquiry, enq.Enquiry_No);
                    //survey
                    SurveyEditControl1.IsSurveyNeed = enq.IsSurveyNeeded;
                    SurveyEditControl1.SurveyIntro  = enq.SurveyIntro;
                    UIUtility.BindUserControl(SurveyEditControl1, SysConst.SourceTypeEnquiry, enq.Enquiry_No);
                    SurveyEditControl1.SetSurveyType(enq.SurveyType);
                    //cad
                    CADEditControl1.IsCADRefinementNeeded           = enq.IsCADRefinementNeeded;
                    CADEditControl1.RefineIntro                     = enq.CADRefinementIntro;
                    CADEditControl1.IsCustomerCADConfirmationNeeded = enq.IsCADNeedCustomerConfirmation;
                    UIUtility.BindUserControl(CADEditControl1, SysConst.SourceTypeEnquiry, enq.Enquiry_No);
                    //delivery
                    DeliveryEditControl1.DeliveryIntro     = enq.DeliveryIntro;
                    DeliveryEditControl1.DeliveryToAddress = enq.DeliveryToAddress;
                    UIUtility.BindUserControl(DeliveryEditControl1, SysConst.SourceTypeEnquiry, enq.Enquiry_No);
                    DeliveryEditControl1.SetDeliveryType(enq.DeliveryType);
                    //install
                    InstallEditControl1.IsInstallProvided = enq.IsInstallProvided;
                    InstallEditControl1.InstallIntro      = enq.InstallIntro;
                    UIUtility.BindUserControl(InstallEditControl1, SysConst.SourceTypeEnquiry, enq.Enquiry_No);
                    InstallEditControl1.SetInstallType(enq.InstallType);
                    //quote
                    UIUtility.BindUserControl(quotationControl, SysConst.SourceTypeEnquiry, enq.Enquiry_No);
                    //survey
                    UIUtility.BindUserControl(surveyControl, SysConst.SourceTypeEnquiry, enq.Enquiry_No);
                    //refine
                    UIUtility.BindUserControl(cADRefinementControl, SysConst.SourceTypeEnquiry, enq.Enquiry_No);
                    //intro
                    UIUtility.BindUserControl(FooterIntroControl1, SysConst.SourceTypeEnquiry, enq.Enquiry_No);
                    //status
                    ddlEnquiryStatus.SelectedValue = enq.Status;
                    //followup
                    UIUtility.BindUserControl(followUpControl, SysConst.SourceTypeEnquiry, enq.Enquiry_No);
                }
            }
        }
Exemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //dropdown
                Utility.BindDataToDropdown(ddlOrderStatus, Utility.GetOrderStatusList());
                Utility.BindDataToDropdown(ddlOrdMan, Utility.GetUserList2(true));

                if (!string.IsNullOrWhiteSpace(OrdNo))
                {
                    OrderDAL dal = new OrderDAL();
                    var      ord = dal.GetOrderById(OrdId);
                    txtOrdNo.Text = ord.Order_No;
                    //link
                    if (string.Equals(SourceType, SysConst.SourceTypeEnquiry, StringComparison.OrdinalIgnoreCase))
                    {
                        lnkSource.NavigateUrl = Page.ResolveUrl(string.Format("~/enquiryform.aspx?enqno={0}", SourceNo));
                    }
                    else if (string.Equals(SourceType, SysConst.SourceTypeQuote, StringComparison.OrdinalIgnoreCase))
                    {
                        QuotationDAL qDAL  = new QuotationDAL();
                        var          quote = qDAL.GetQuoteByNo(SourceNo);
                        lnkSource.NavigateUrl = Page.ResolveUrl(string.Format("~/quotationform.aspx?quono={0}&quoid={1}&sourceno={2}&sourcetype={3}", quote.Quotation_No, quote.Quotation_Id, quote.SourceNo, quote.SourceType));
                    }

                    if (!string.IsNullOrEmpty(SourceNo))
                    {
                        this.lnkSource.Text = SourceNo;
                    }
                    this.txtCreatedDate.Text  = ord.CreatedDate.ToString("yyyy-MM-dd");
                    ddlOrdMan.SelectedValue   = ord.OrderMan;
                    this.txtOrderSummary.Text = ord.OrderIntro;
                    //customer info
                    this.customerInfoControl.SetValue(
                        ord.CustomerCompanyName,
                        ord.CustomerContactName,
                        ord.CustomerAddress,
                        ord.CustomerEmail,
                        ord.CustomerQQ,
                        ord.CustomerPhone1,
                        ord.CustomerPhone2,
                        ord.CustomerOthers);
                    //lineitem
                    UIUtility.BindUserControl(lineItemsControl, SysConst.SourceTypeOrder, ord.Order_Id);
                    //sample
                    this.SampleControl1.SetValue(ord.IsSampleProvidedToCustomer, ord.IsCustomerProvideSample);
                    UIUtility.BindUserControl(SampleControl1, SysConst.SourceTypeOrder, ord.Order_No);
                    //customer drawing
                    customerDrawingControl.IsCustomerProvideImage = ord.IsCustomerProvideImage;
                    UIUtility.BindUserControl(customerDrawingControl, SysConst.SourceTypeOrder, ord.Order_No);
                    //survey
                    SurveyEditControl1.IsSurveyNeed = ord.IsSurveyNeeded;
                    SurveyEditControl1.SurveyIntro  = ord.SurveyIntro;
                    UIUtility.BindUserControl(SurveyEditControl1, SysConst.SourceTypeOrder, ord.Order_No);
                    SurveyEditControl1.SetSurveyType(ord.SurveyType);
                    //cad
                    CADEditControl1.IsCADRefinementNeeded           = ord.IsCADRefinementNeeded;
                    CADEditControl1.RefineIntro                     = ord.CADRefinementIntro;
                    CADEditControl1.IsCustomerCADConfirmationNeeded = ord.IsCADNeedCustomerConfirmation;
                    UIUtility.BindUserControl(CADEditControl1, SysConst.SourceTypeOrder, ord.Order_No);
                    //delivery
                    DeliveryEditControl1.DeliveryIntro     = ord.DeliveryIntro;
                    DeliveryEditControl1.DeliveryToAddress = ord.DeliveryToAddress;
                    UIUtility.BindUserControl(DeliveryEditControl1, SysConst.SourceTypeOrder, ord.Order_No);
                    DeliveryEditControl1.SetDeliveryType(ord.DeliveryType);

                    //install
                    InstallEditControl1.IsInstallProvided = ord.IsInstallProvided;
                    InstallEditControl1.InstallIntro      = ord.InstallIntro;
                    UIUtility.BindUserControl(InstallEditControl1, SysConst.SourceTypeOrder, ord.Order_No);
                    InstallEditControl1.SetInstallType(ord.InstallType);
                    //history quote
                    UIUtility.BindUserControl(quotationControl, SysConst.SourceTypeOrder, ord.Order_No);
                    //survey
                    UIUtility.BindUserControl(surveyControl, SysConst.SourceTypeOrder, ord.Order_No);
                    //refine
                    UIUtility.BindUserControl(cADRefinementControl, SysConst.SourceTypeOrder, ord.Order_No);
                    //machining
                    UIUtility.BindUserControl(MachiningControl1, SysConst.SourceTypeOrder, ord.Order_No);
                    //purchase
                    UIUtility.BindUserControl(PurchaseControl1, SysConst.SourceTypeOrder, ord.Order_No);
                    //delivery
                    UIUtility.BindUserControl(DeliveryControl1, SysConst.SourceTypeOrder, ord.Order_No);
                    //settlement
                    UIUtility.BindUserControl(SettlementControl1, SysConst.SourceTypeOrder, ord.Order_No);
                    //receivable
                    UIUtility.BindUserControl(ReceiptControl1, SysConst.SourceTypeOrder, ord.Order_No);
                    //introduction
                    UIUtility.BindUserControl(FooterIntroControl1, SysConst.SourceTypeOrder, ord.Order_No);
                    //status
                    ddlOrderStatus.SelectedValue = ord.Status;
                    //followup
                    UIUtility.BindUserControl(followUpControl, SysConst.SourceTypeOrder, ord.Order_No);
                }
            }
        }
Exemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(SourceType) && !string.IsNullOrEmpty(SourceNo))
                {
                    Utility.BindDataToDropdown(ddlEnqOrdMan, Utility.GetUserList2(true));
                    Utility.BindDataToDropdown(ddlQuoteMan, Utility.GetUserList2(true));
                    //link
                    if (string.Equals(SourceType, SysConst.SourceTypeEnquiry, StringComparison.OrdinalIgnoreCase))
                    {
                        EnquiryDAL eDAL = new EnquiryDAL();
                        var        enq  = eDAL.GetEnquiryByNo(SourceNo);
                        lnkSource.NavigateUrl = Page.ResolveUrl(string.Format("~/enquiryform.aspx?enqno={0}&enqid={1}", SourceNo, enq.Enquiry_Id));
                    }
                    else
                    {
                        OrderDAL sDAL = new OrderDAL();
                        var      ord  = sDAL.GetOrderByNo(SourceNo);
                        lnkSource.NavigateUrl = Page.ResolveUrl(string.Format("~/orderform.aspx?ordno={0}&ordid={1}&sourcetype={2}&sourceno={3}", SourceNo, ord.Order_Id, ord.SourceType, ord.SourceNo));
                    }
                    lnkSource.Text = SourceNo;

                    QuotationDAL dal   = new QuotationDAL();
                    var          quote = dal.GetQuoteByNo(QuoteNo);
                    //basic
                    txtCreatedDate.Text = quote.CreatedDate.ToString("yyyy-MM-dd");

                    ddlEnqOrdMan.SelectedValue = quote.EnqOrdMan;
                    ddlQuoteMan.SelectedValue  = quote.QuotationMan;
                    txtQuoteIntro.Text         = quote.QuotationIntro;

                    //customer info
                    this.customerInfoControl.SetValue(
                        quote.CustomerCompanyName,
                        quote.CustomerContactName,
                        quote.CustomerAddress,
                        quote.CustomerEmail,
                        quote.CustomerQQ,
                        quote.CustomerPhone1,
                        quote.CustomerPhone2,
                        quote.CustomerOthers);
                    //lineitem
                    UIUtility.BindUserControl(lineItemsControl, SysConst.SourceTypeQuote, quote.Quotation_Id);
                    //sample
                    this.SampleControl1.SetValue(quote.IsSampleProvidedToCustomer, quote.IsCustomerProvideSample);
                    UIUtility.BindUserControl(SampleControl1, SysConst.SourceTypeQuote, quote.Quotation_No);
                    //customer drawing
                    customerDrawingControl.IsCustomerProvideImage = quote.IsCustomerProvideImage;
                    UIUtility.BindUserControl(customerDrawingControl, SysConst.SourceTypeQuote, quote.Quotation_No);
                    //survey
                    SurveyEditControl1.IsSurveyNeed = quote.IsSurveyNeeded;
                    SurveyEditControl1.SurveyIntro  = quote.SurveyIntro;
                    UIUtility.BindUserControl(SurveyEditControl1, SysConst.SourceTypeQuote, quote.Quotation_No);
                    SurveyEditControl1.SetSurveyType(quote.SurveyType);
                    //cad
                    CADEditControl1.IsCADRefinementNeeded           = quote.IsCADRefinementNeeded;
                    CADEditControl1.RefineIntro                     = quote.CADRefinementIntro;
                    CADEditControl1.IsCustomerCADConfirmationNeeded = quote.IsCADNeedCustomerConfirmation;
                    UIUtility.BindUserControl(CADEditControl1, SysConst.SourceTypeQuote, quote.Quotation_No);
                    //delivery
                    DeliveryEditControl1.DeliveryIntro     = quote.DeliveryIntro;
                    DeliveryEditControl1.DeliveryToAddress = quote.DeliveryToAddress;
                    UIUtility.BindUserControl(DeliveryEditControl1, SysConst.SourceTypeQuote, quote.Quotation_No);
                    DeliveryEditControl1.SetDeliveryType(quote.DeliveryType);
                    //install
                    InstallEditControl1.IsInstallProvided = quote.IsInstallProvided;
                    InstallEditControl1.InstallIntro      = quote.InstallIntro;
                    UIUtility.BindUserControl(InstallEditControl1, SysConst.SourceTypeQuote, quote.Quotation_No);
                    InstallEditControl1.SetInstallType(quote.InstallType);
                    //quotation
                    UIUtility.BindUserControl(quotationControl, SourceType, SourceNo);
                    //survey
                    UIUtility.BindUserControl(surveyControl, SourceType, SourceNo);
                    //customer provide drawing
                    UIUtility.BindUserControl(customerDrawingControl1, SourceType, SourceNo);
                    //refine
                    UIUtility.BindUserControl(cADRefinementControl, SourceType, SourceNo);
                    //intro
                    UIUtility.BindUserControl(FooterIntroControl1, SysConst.SourceTypeQuote, quote.Quotation_No);
                    //followup
                    UIUtility.BindUserControl(followUpControl, SysConst.SourceTypeQuote, quote.Quotation_No);

                    //status dropdown
                    Utility.BindDataToDropdown(this.ddlQuotationStatus, Utility.GetQuotationStatusList());
                    ddlQuotationStatus.SelectedValue = quote.Status;
                    if (string.Equals(quote.Status, "报价完成", StringComparison.OrdinalIgnoreCase) ||
                        string.Equals(quote.Status, "待确认", StringComparison.OrdinalIgnoreCase) ||
                        string.Equals(quote.Status, "确认", StringComparison.OrdinalIgnoreCase) ||
                        string.Equals(quote.Status, "不确认", StringComparison.OrdinalIgnoreCase)
                        )
                    {
                        SetControlsStatus(false);
                        ddlQuotationStatus.Enabled = true;
                        btnChangeStatus.Enabled    = true;
                        btnPrint.Disabled          = false;
                        btnCopy.Enabled            = true;
                    }

                    if (quote.Status != "编辑中")
                    {
                        SetControlsStatus(false);
                        SetControlEnabled(btnChangeStatus, true);
                        SetControlEnabled(ddlQuotationStatus, true);
                    }
                }
            }
        }
Exemplo n.º 17
0
        protected void btnImport_Click(object sender, EventArgs e)
        {
            DeliveryDAL    dal   = new DeliveryDAL();
            LineItemDAL    lDal  = new LineItemDAL();
            MachSummaryDAL mDAL  = new MachSummaryDAL();
            MachLookupDAL  mlDAL = new MachLookupDAL();

            var                delivery        = dal.GetDeliveryByNo(DeliveryNo);
            StringBuilder      sb              = new StringBuilder(256);
            List <MachSummary> machSummaryList = new List <MachSummary>();

            foreach (ListItem item in cblMach.Items)
            {
                if (item.Selected)
                {
                    sb.Append(item.Text).Append("|");
                    machSummaryList.AddRange(mDAL.GetSummaryByMachId(int.Parse(item.Value)));
                }
            }
            delivery.MachList = sb.ToString();
            dal.Save();


            var lineItems = lDal.GetLineItemsBySource(this.DeliveryId, SysConst.SourceTypeDelivery);

            foreach (var item in lineItems)
            {
                lDal.DeleteItem(item.LineItem_Id);
            }

            foreach (var item in machSummaryList)
            {
                var machLook = mlDAL.GetMachLookupByName(item.MachName);
                var lineItem = new LineItem();
                lineItem.Intro      = item.MachIntro;
                lineItem.Name       = "加工";
                lineItem.Project    = item.MachName;
                lineItem.Quantity   = item.Qty;
                lineItem.Remark     = item.Remark;
                lineItem.SourceId   = DeliveryId;
                lineItem.SourceType = SysConst.SourceTypeDelivery;
                lineItem.Spec       = string.Empty;
                lineItem.Unit       = item.Unit;
                if (string.Equals(item.Unit, "米"))
                {
                    lineItem.UnitPrice = machLook.PriceM;
                }
                else if (string.Equals(item.Unit, "平方米"))
                {
                    lineItem.UnitPrice = machLook.PriceM2;
                }
                else
                {
                    lineItem.UnitPrice = machLook.PriceOther;
                }
                lDal.AddLineItem(lineItem);
            }

            lDal.Save();

            UIUtility.BindUserControl(lineItemControl, SysConst.SourceTypeDelivery, DeliveryId);
        }