コード例 #1
0
        public frmSaleCarChangeDealConfirm(long SaleCarInBillID, ChangeItem changeItem, string ChangeDesc)
        {
            _changeItem      = changeItem;
            _ChangeDesc      = ChangeDesc;
            _SaleCarInBillID = SaleCarInBillID;
            InitializeComponent();
            this.gbAmoutDeal.Visible = false;
            if (changeItem.NewCarID != changeItem.OldCarID)
            {
                SaleChangeItem item = new SaleChangeItem("车牌号码", changeItem.OldCarNum, changeItem.NewCarNum);
                item.Dock     = DockStyle.Top;
                item.TabIndex = 0;
                item.BringToFront();
                this.gbChange.Controls.Add(item);
            }
            if (changeItem.NewCustomerName != changeItem.OldCustomerName)
            {
                SaleChangeItem item = new SaleChangeItem("客户名称", changeItem.OldCustomerName, changeItem.NewCustomerName);
                item.Dock     = DockStyle.Top;
                item.TabIndex = 0;
                item.BringToFront();
                this.gbChange.Controls.Add(item);
            }
            if (changeItem.NewItemName != changeItem.OldItemName)
            {
                SaleChangeItem item = new SaleChangeItem("货物名称", changeItem.OldItemName, changeItem.NewItemName);
                item.Dock     = DockStyle.Top;
                item.TabIndex = 1;
                item.BringToFront();
                this.gbChange.Controls.Add(item);
            }
            if (changeItem.NewReceiveName != changeItem.OldReceiveName)
            {
                SaleChangeItem item = new SaleChangeItem("收款方式", changeItem.OldReceiveName, changeItem.NewReceiveName);
                item.Dock     = DockStyle.Top;
                item.TabIndex = 2;
                item.BringToFront();
                this.gbChange.Controls.Add(item);
            }
            if (changeItem.NewCalculateName != changeItem.OldCalculateName)
            {
                SaleChangeItem item = new SaleChangeItem("计价方式", changeItem.OldCalculateName, changeItem.NewCalculateName);
                item.Dock     = DockStyle.Top;
                item.TabIndex = 3;
                item.BringToFront();
                this.gbChange.Controls.Add(item);
            }
            if (changeItem.NewPrice != changeItem.OldPrice)
            {
                SaleChangeItem item = new SaleChangeItem("单价", changeItem.OldPrice.ToString("0.000"), changeItem.NewPrice.ToString("0.000"));
                item.Dock     = DockStyle.Top;
                item.TabIndex = 4;
                item.BringToFront();
                this.gbChange.Controls.Add(item);
            }
            if (changeItem.NewAmount != changeItem.OldAmount)
            {
                SaleChangeItem item = new SaleChangeItem("金额", changeItem.OldAmount.ToString("0.00"), changeItem.NewAmount.ToString("0.000"));
                item.Dock     = DockStyle.Top;
                item.TabIndex = 5;
                item.BringToFront();
                this.gbChange.Controls.Add(item);
            }
            StringBuilder strAmountDeal = new StringBuilder();

            if (changeItem.NewAmount != changeItem.OldAmount &&
                changeItem.NewCustomerName == changeItem.OldCustomerName)
            {
                this.gbAmoutDeal.Visible = true;
                if (changeItem.NewAmount > changeItem.OldAmount)
                {
                    this.lblNeedPay1.Text  = (changeItem.NewAmount - changeItem.OldAmount).ToString("0.00");
                    pnlDealAmount1.Visible = true;
                }
                else if (changeItem.NewAmount < changeItem.OldAmount)
                {
                    this.lblNeedPay2.Text  = (changeItem.OldAmount - changeItem.NewAmount).ToString("0.00");
                    pnlDealAmount2.Visible = true;
                }
            }
            else if (changeItem.NewCustomerName != changeItem.OldCustomerName &&
                     changeItem.NewAmount == changeItem.OldAmount)
            {
                this.gbAmoutDeal.Visible   = true;
                pnlDealAmount3.Visible     = true;
                this.lblNeedPay3.Text      = "涉及石款:" + changeItem.NewAmount.ToString();
                this.lblAddToCustomer.Text = changeItem.OldCustomerName;
                this.lblDelToCustomer.Text = changeItem.NewCustomerName;
            }
            else if (changeItem.NewCustomerName != changeItem.OldCustomerName &&
                     changeItem.NewAmount != changeItem.OldAmount)
            {
                this.gbAmoutDeal.Visible    = true;
                pnlDealAmount4.Visible      = true;
                this.lblNewAmount4.Text     = changeItem.NewAmount.ToString();
                this.lblOldAmount4.Text     = changeItem.OldAmount.ToString();
                this.lblAddToCustomer2.Text = changeItem.OldCustomerName;
                this.lblDelToCustomer2.Text = changeItem.NewCustomerName;
            }
        }
コード例 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                long    lNewCarID           = LBConverter.ToInt64(this.txtCarID.TextBox.SelectedItemID);
                long    lNewItemID          = LBConverter.ToInt64(this.txtItemID.TextBox.SelectedItemID);
                long    lNewCustomerID      = LBConverter.ToInt64(this.txtCustomerID.TextBox.SelectedItemID);
                int     iNewReceiveType     = LBConverter.ToInt32(this.txtReceiveType.SelectedValue);
                int     iNewCalculateType   = LBConverter.ToInt32(this.txtCalculateType.SelectedValue);
                decimal decNewAmount        = _SaleCarOutBillID > 0 ? LBConverter.ToDecimal(this.txtAmount.Text):0;
                decimal decNewPrice         = _SaleCarOutBillID > 0?LBConverter.ToDecimal(this.txtPrice.Text):0;
                string  strNewDescription   = this.txtDescription.Text;
                string  strNewItemName      = this.txtItemID.TextBox.Text;
                string  strNewCarNum        = this.txtCarID.TextBox.Text;
                string  strNewCustomerName  = this.txtCustomerID.TextBox.Text;
                string  strNewReceiveName   = this.GetReceiveTypeName(iNewReceiveType);
                string  strNewCalculateName = this.GetCalculateTypeName(iNewCalculateType);

                long    lOldCarID           = LBConverter.ToInt64(this._OrgBill["CarID"]);
                long    lOldItemID          = LBConverter.ToInt64(this._OrgBill["ItemID"]);
                long    lOldCustomerID      = LBConverter.ToInt64(this._OrgBill["CustomerID"]);
                string  strOldItemName      = this._OrgBill["ItemName"].ToString().TrimEnd();
                string  strOldCustomerName  = this._OrgBill["CustomerName"].ToString().TrimEnd();
                string  strOldCarNum        = this._OrgBill["CarNum"].ToString().TrimEnd();
                int     iOldReceiveType     = LBConverter.ToInt32(this._OrgBill["ReceiveType"]);
                int     iOldCalculateType   = LBConverter.ToInt32(this._OrgBill["CalculateType"]);
                decimal decOldAmount        = _SaleCarOutBillID > 0 ? LBConverter.ToDecimal(this._OrgBill["Amount"]):0;
                decimal decOldPrice         = _SaleCarOutBillID > 0 ? LBConverter.ToDecimal(this._OrgBill["Price"]):0;
                string  strOldDescription   = this._OrgBill["Description"].ToString();
                string  strOldReceiveName   = this.GetReceiveTypeName(iOldReceiveType);
                string  strOldCalculateName = this.GetCalculateTypeName(iOldCalculateType);

                string strChangeDesc = "";
                bool   bolIsChanged  = false;
                if (this._OrgBill["ItemID"].ToString() != lNewItemID.ToString())
                {
                    bolIsChanged = true;
                    if (strChangeDesc != "")
                    {
                        strChangeDesc += ";";
                    }
                    strChangeDesc += this._OrgBill["ItemName"].ToString() + " -> " + this.txtItemID.TextBox.Text;
                }

                if (this._OrgBill["CarID"].ToString() != lNewCarID.ToString())
                {
                    bolIsChanged = true;
                    if (strChangeDesc != "")
                    {
                        strChangeDesc += ";";
                    }
                    strChangeDesc += this._OrgBill["CarNum"].ToString() + " -> " + this.txtCarID.TextBox.Text;
                }

                if (this._OrgBill["CustomerID"].ToString() != lNewCustomerID.ToString())
                {
                    bolIsChanged = true;
                    if (strChangeDesc != "")
                    {
                        strChangeDesc += ";";
                    }
                    strChangeDesc += this._OrgBill["CustomerName"].ToString() + " -> " + this.txtCustomerID.TextBox.Text;
                }

                if (this._OrgBill["Description"].ToString() != strNewDescription)
                {
                    bolIsChanged = true;
                    if (strChangeDesc != "")
                    {
                        strChangeDesc += ";";
                    }
                    strChangeDesc += this._OrgBill["Description"].ToString() + " -> " + this.txtDescription.TextBox.Text;
                }

                if (_SaleCarOutBillID > 0)
                {
                    if (this._OrgBill["ReceiveType"].ToString() != iNewReceiveType.ToString())
                    {
                        bolIsChanged = true;
                        if (strChangeDesc != "")
                        {
                            strChangeDesc += ";";
                        }
                        strChangeDesc += this.GetReceiveTypeName(LBConverter.ToInt32(this._OrgBill["ReceiveType"])) + " -> " + this.GetReceiveTypeName(iNewReceiveType);
                    }

                    if (this._OrgBill["CalculateType"].ToString() != iNewCalculateType.ToString())
                    {
                        bolIsChanged = true;
                        if (strChangeDesc != "")
                        {
                            strChangeDesc += ";";
                        }
                        strChangeDesc += this.GetCalculateTypeName(LBConverter.ToInt32(this._OrgBill["CalculateType"])) + " -> " + this.GetCalculateTypeName(iNewCalculateType);
                    }

                    if (LBConverter.ToDecimal(this._OrgBill["Price"]) != decNewPrice)
                    {
                        bolIsChanged = true;
                        if (strChangeDesc != "")
                        {
                            strChangeDesc += ";";
                        }
                        strChangeDesc += LBConverter.ToDecimal(this._OrgBill["Price"]).ToString("0.000") + " -> " + decNewPrice.ToString("0.000");
                    }

                    if (LBConverter.ToDecimal(this._OrgBill["Amount"]) != decNewAmount)
                    {
                        bolIsChanged = true;
                        if (strChangeDesc != "")
                        {
                            strChangeDesc += ";";
                        }
                        strChangeDesc += LBConverter.ToDecimal(this._OrgBill["Amount"]).ToString("0.000") + " -> " + decNewAmount.ToString("0.000");
                    }
                }

                if (!bolIsChanged)
                {
                    LB.WinFunction.LBCommonHelper.ShowCommonMessage("变更前后信息一致!");
                    return;
                }

                ChangeItem changeItem = new ChangeItem(lNewItemID, lNewCustomerID, iNewReceiveType, iNewCalculateType,
                                                       strNewCarNum, strNewItemName, strNewCustomerName, strNewReceiveName, strNewCalculateName, decNewPrice, decNewAmount, lNewCarID, strNewDescription,
                                                       lOldItemID, lOldCustomerID, iOldReceiveType, iOldCalculateType,
                                                       strOldCarNum, strOldItemName, strOldCustomerName, strOldReceiveName, strOldCalculateName, decOldPrice, decOldAmount, lOldCarID, strOldDescription);

                frmSaleCarChangeDealConfirm frmConfirm = new MI.frmSaleCarChangeDealConfirm(_SaleCarInBillID, changeItem, strChangeDesc);
                LBShowForm.ShowDialog(frmConfirm);

                if (frmConfirm.IsSuccess)
                {
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }