Exemplo n.º 1
0
 protected void btnRejectInvoice_Click(object sender, EventArgs e)
 {
     try
     {
         KPOrder kpOrder = TheKPOrderMgr.LoadKPOrder(this.OrderId, true);
         kpOrder.InvoiceStatus = BusinessConstants.CODE_MASTER_INVOICE_STATUS_VALUE_REJECTED;
         //if (kpOrder.CLN_ORDER != null)
         //    UnBindSP(kpOrder);
         TheKPOrderMgr.UpdateKPOrder(kpOrder);
         this.ShowSuccessMessage("MasterData.Bill.RejectInvoice.Successful");
         UpdateView();
     }
     catch (BusinessErrorException ex)
     {
         ShowErrorMessage(ex);
     }
 }
Exemplo n.º 2
0
    protected void UnBindSP(KPOrder kpOrder)
    {
        string[] cln_order = kpOrder.CLN_ORDER.Split(new char[] { ',' });

        foreach (string orderno in cln_order)
        {
            KPOrder ko = TheKPOrderMgr.LoadKPOrder(decimal.Parse(orderno));
            if (ko != null)
            {
                ko.CLN_ORDER = null;

                TheKPOrderMgr.UpdateKPOrder(ko);
            }
        }
        kpOrder.CLN_ORDER  = null;
        kpOrder.CLN_amount = 0;
        TheKPOrderMgr.UpdateKPOrder(kpOrder);
    }
Exemplo n.º 3
0
    protected void btnSubmitInvoice_Click(object sender, EventArgs e)
    {
        try
        {
            KPOrder kpOrder = TheKPOrderMgr.LoadKPOrder(this.OrderId, true);

            decimal invoiceAmountWithoutTax = Convert.ToDecimal(tbInvoiceAmountWithoutTax.Text.Trim());
            if (kpOrder.CLN_ORDER == null)
            {
                process(kpOrder);
            }

            #region 只校验不含税金额
            if (System.Math.Abs(kpOrder.TotalAmount - invoiceAmountWithoutTax - kpOrder.CLN_amount) > 1)
            {
                ShowErrorMessage("MasterData.Bill.InvoiceAmountWithoutTax.AmountMustLessThanOne");
                return;
            }

            #endregion

            kpOrder.InvoiceCount = Convert.ToInt32(tbInvoceCount.Text.Trim());

            kpOrder.InvoiceDate             = DateTime.Parse(tbInvoiceDate.Text.Trim());
            kpOrder.InvoiceNumber           = tbInvoiceNumber.Text.Trim();
            kpOrder.InvoiceRemark           = tbInvoiceRemark.Text.Trim();
            kpOrder.InvoiceTax              = tbInvoiceTax.Text.Trim();
            kpOrder.InvoiceAmountWithoutTax = invoiceAmountWithoutTax;

            kpOrder.InvoiceAmount = Convert.ToDecimal(tbInvoiceAmount.Text.Trim());
            kpOrder.InvoiceStatus = BusinessConstants.CODE_MASTER_INVOICE_STATUS_VALUE_INPROCESS;
            TheKPOrderMgr.UpdateKPOrder(kpOrder);
            this.ShowSuccessMessage("MasterData.Bill.SubmitInvoice.Successful");
            UpdateView();
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
    }
Exemplo n.º 4
0
 protected void process(KPOrder kpOrder)
 {
     if (string.IsNullOrEmpty(kpOrder.CLN_ORDER) &&
         kpOrder.ORDER_TYPE_ID == "KP")
     {
         DetachedCriteria clnorder = DetachedCriteria.For <KPOrder>()
                                     .Add(Expression.Eq("ORDER_TYPE_ID", "SP"))
                                     .Add(Expression.IsNull("CLN_ORDER"))
                                     .Add(Expression.Eq("PARTY_FROM_ID", kpOrder.PARTY_FROM_ID))
                                     .Add(Expression.Eq("SYS_CODE", kpOrder.SYS_CODE));
         IList <KPOrder> kpcln = TheCriteriaMgr.FindAll <KPOrder>(clnorder);
         if (kpcln != null && kpcln.Count > 0)
         {
             decimal?tempamount      = 0;
             decimal offsetamount    = 0;
             decimal tempOrderAmount = kpOrder.TotalAmount;
             string  _clnorder       = string.Empty;
             // tempamount = kpOrder.InvoiceAmountWithoutTax;
             foreach (KPOrder kp in kpcln)
             {
                 tempamount = kp.TotalAmount;
                 if (tempamount.HasValue)
                 {
                     if (tempOrderAmount - tempamount > 0)
                     {
                         _clnorder    += kp.ORDER_ID.ToString() + ",";
                         kp.CLN_ORDER  = kpOrder.ORDER_ID.ToString();
                         offsetamount += (decimal)tempamount;
                         TheKPOrderMgr.UpdateKPOrder(kp);
                     }
                 }
             }
             //kpOrder.InvoiceAmountWithoutTax += offsetamount;
             kpOrder.CLN_amount = offsetamount;
             kpOrder.CLN_ORDER  = _clnorder.Trim(new char[] { ',' });
             TheKPOrderMgr.UpdateKPOrder(kpOrder);
         }
     }
 }
Exemplo n.º 5
0
    protected void btnPrint_Click(object sender, EventArgs e)
    {
        try
        {
            KPOrder        kpOrder = TheKPOrderMgr.LoadKPOrder(this.OrderId, true);
            IList <object> list    = new List <object>();
            if (kpOrder != null)
            {
                list.Add(kpOrder);
                list.Add(kpOrder.KPItems);
            }

            string barCodeUrl = "";
            //测试
            //if (kpOrder.SYS_CODE == "YK")
            //{
            //    barCodeUrl = WriteToFile("Bill_BJ.xls", list);
            //}
            if (kpOrder.SYS_CODE == "YK")
            {
                barCodeUrl = TheReportMgr.WriteToFile("Bill.xls", list);
            }
            if (kpOrder.SYS_CODE == "BJ")
            {
                barCodeUrl = WriteToFile("Bill_BJ.xls", list);
            }
            Page.ClientScript.RegisterStartupScript(GetType(), "method", " <script language='javascript' type='text/javascript'>PrintOrder('" + barCodeUrl + "'); </script>");

            kpOrder.ORDER_PRINT       = "Y";
            kpOrder.PRINT_MODIFY_DATE = DateTime.Now;
            TheKPOrderMgr.UpdateKPOrder(kpOrder);

            this.ShowSuccessMessage("MasterData.Bill.Print.Successful");
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
    }