Пример #1
0
        public object Clone()
        {
            SaleChild child = new SaleChild();
            child.orderId = orderId;
            child.detailId = detailId;
            child.commId = commId;
            child.commName = commName;
            child.standard = standard;
            child.unit = unit;
            child.amount = amount;
            child.priceUnit = priceUnit;
            child.priceTotal = priceTotal;
            child.priceTotalActual = priceTotalActual;
            child.priceUnitForSaleMan = priceUnitForSaleMan;
            child.priceTotalForSaleMan = priceTotalForSaleMan;
            child.priceTotalForSaleMan = priceTotalForSaleMan;
            child.remark = remark;
            child.saleKBN = saleKBN;

            return child;
        }
Пример #2
0
        public List<SaleChild> SearchSaleChildByOrderID(string strSaleOrderID)
        {
            List<SaleChild> saleChildList = new List<SaleChild>();

            string sqlStr = dbUtil.getSqlStatement("SQL_Comd_SaleChild_SearchByOrderID");
            SqlParameter[] sqlParms = {
                new SqlParameter("@SaleOrderID",SqlDbType.VarChar,20)
            };
            sqlParms[0].Value = strSaleOrderID;

            DataSet searchResult = null;
            try
            {
                searchResult = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, sqlParms);
                foreach (DataTable dt in searchResult.Tables)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        SaleChild saleChild = new SaleChild();

                        saleChild.OrderId = dr["SaleOrderID"].ToString();
                        saleChild.DetailId = Convert.ToInt32(dr["SaleOrderDetailID"]);
                        saleChild.SaleKBN = Convert.ToInt32(dr["SaleKBN"]);
                        saleChild.Remark = dr["Remark"].ToString();

                        saleChild.CommId = dr["ComdID"].ToString();
                        saleChild.CommName = dr["ComdName"].ToString();
                        saleChild.Standard = dr["ComdStandard"].ToString();

                        saleChild.Unit = dr["Unit"].ToString();
                        saleChild.Amount = Convert.ToInt32(dr["amount"]);

                        saleChild.PriceUnit = Convert.ToSingle(dr["PriceUnit"]);
                        saleChild.PriceTotal = Convert.ToSingle(dr["PriceTotal"]);
                        saleChild.PriceTotalActual = Convert.ToSingle(dr["PriceTotalActual"]);

                        saleChild.PriceUnitForSaleMan = Convert.ToSingle(dr["PriceUnitForSaleMan"]);
                        saleChild.PriceTotalForSaleMan = Convert.ToSingle(dr["PriceTotalForSaleMan"]);
                        saleChild.PriceTotalActualForSaleMan = Convert.ToSingle(dr["PriceTotalActualForSaleMan"]);

                        saleChildList.Add(saleChild);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new DAOException("E0001");
            }

            return saleChildList;
        }
Пример #3
0
        public int AddSaleChild(SaleChild saleChild, string currentUser)
        {
            string sqlStr = dbUtil.getSqlStatement("SQL_Comd_SaleChild_Insert");

            SqlParameter[] sqlParms = {
                new SqlParameter("@SaleOrderID",SqlDbType.VarChar,20),
                new SqlParameter("@SaleOrderDetailID",SqlDbType.Int),
                new SqlParameter("@SaleKBN",SqlDbType.Int),
                new SqlParameter("@ComdID",SqlDbType.VarChar,20),
                new SqlParameter("@amount",SqlDbType.Int),
                new SqlParameter("@PriceUnit",SqlDbType.Float),
                new SqlParameter("@PriceTotal",SqlDbType.Float),
                new SqlParameter("@PriceTotalActual",SqlDbType.Float),
                new SqlParameter("@PriceUnitForSaleMan",SqlDbType.Float),
                new SqlParameter("@PriceTotalForSaleMan",SqlDbType.Float),
                new SqlParameter("@PriceTotalActualForSaleMan",SqlDbType.Float),
                new SqlParameter("@Remark",SqlDbType.NVarChar,800),
                new SqlParameter("@CreateUser",SqlDbType.VarChar,20),
                new SqlParameter("@UpdateUser",SqlDbType.VarChar,20)
            };

            sqlParms[0].Value = saleChild.OrderId;
            sqlParms[1].Value = saleChild.DetailId;
            sqlParms[2].Value = saleChild.SaleKBN;
            sqlParms[3].Value = saleChild.CommId;
            sqlParms[4].Value = saleChild.Amount;
            sqlParms[5].Value = saleChild.PriceUnit;
            sqlParms[6].Value = saleChild.PriceTotal;
            sqlParms[7].Value = saleChild.PriceTotalActual;
            sqlParms[8].Value = saleChild.PriceUnitForSaleMan;
            sqlParms[9].Value = saleChild.PriceTotalForSaleMan;
            sqlParms[10].Value = saleChild.PriceTotalActualForSaleMan;
            sqlParms[11].Value = saleChild.Remark;
            sqlParms[12].Value = currentUser;
            sqlParms[13].Value = currentUser;

            int resultCount = 0;
            try
            {
                resultCount = (int)DAO.DBAccess.ExecuteNonQuery(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, sqlParms);
            }
            catch (Exception ex)
            {
                throw new DAOException("E0001");
            }
            return resultCount;
        }
Пример #4
0
 private void DgvCommo_SelChanged(object sender, EventArgs e)
 {
     if (DgvCommo.CurrentRow != null)
     {
         if (DgvCommo.CurrentRow.Index < soFormEntity.SaleChildren.Count)
         {
             curSaleChild = soFormEntity.SaleChildren[DgvCommo.CurrentRow.Index];
         }
         UpdateItemDetail();
     }
 }
Пример #5
0
        private bool ReadDetail(SaleChild saleChild)
        {
            if (cmbCommo.SelectedItem == null)
            {
                ShowErrorInfo("必须输入商品名");
                return false;
            }

            if (cmbStandard.SelectedItem == null)
            {
                ShowErrorInfo("必须输入商品规格型号");
                return false;
            }

            saleChild.CommId = (cmbStandard.SelectedItem as ExtItem).Tag.ToString();
            saleChild.CommName = cmbCommo.SelectedItem.ToString();
            saleChild.Standard = (cmbStandard.SelectedItem as ExtItem).Item.ToString();

            saleChild.Unit = txtUnit.Text;
            saleChild.Amount = neAmount.IntValue;

            saleChild.PriceUnit = (float)nePriceUnit.Value;
            saleChild.PriceTotal = saleChild.PriceUnit * saleChild.Amount;
            saleChild.PriceTotalActual = (float)nePriceTotalActual.Value;

            saleChild.PriceUnitForSaleMan = (float)nePriceUnitForSaleMan.Value;
            saleChild.PriceTotalForSaleMan = saleChild.PriceUnitForSaleMan * saleChild.Amount;
            saleChild.PriceTotalActualForSaleMan = (float)nePriceTotalActuaForSaleMan.Value;

            saleChild.Remark = txtChildRemark.Text;

            return true;
        }
Пример #6
0
        private void BtnContinueAdd_Click(object sender, EventArgs e)
        {
            this.HideErrorInfo();

            ReadOrderInfo();

            if (curSaleChild.CommId == null || curSaleChild.CommId.Equals(""))
            {
                if (!ReadDetail(curSaleChild))
                {
                    return;
                }

                soFormEntity.SaleChildren.Add(curSaleChild);
                UpdateOrderMoney();

                UpdatePage();

                ClearSelection(DgvCommo);
                curSaleChild = new SaleChild();
                UpdateItemDetail();
            }
            else
            {
                if (!ReadDetail(curSaleChild))
                {
                    return;
                }

                UpdateOrderMoney();

                UpdatePage();

                DgvCommo.Rows[DgvCommo.Rows.Count - 1].Selected = true;
                DgvCommo.CurrentCell = DgvCommo.Rows[DgvCommo.Rows.Count - 1].Cells[0];
            }
        }
Пример #7
0
        private void BtnCancelAdd_Click(object sender, EventArgs e)
        {
            this.HideErrorInfo();

            if (DgvCommo.CurrentRow == null)
            {
                curSaleChild = null;
            }

            UpdateItemDetail();
        }
Пример #8
0
        private void BtnAddDetail_Click(object sender, EventArgs e)
        {
            this.HideErrorInfo();

            // 读取界面数据。
            ReadOrderInfo();

            ClearSelection(DgvCommo);
            curSaleChild = new SaleChild();
            UpdateItemDetail();
        }
Пример #9
0
        private void addSaleOrderChild(SaleChild saleChild)
        {
            if (saleChild.OrderId == null || saleChild.OrderId == string.Empty)
            {
                throw new BIZException("W03003");
            }

            if (saleChild.DetailId == 0)
            {
                saleChild.DetailId = this.GenerateSaleOrderDetailId(saleChild.OrderId);
            }

            int resutcount = 0;
            try
            {
                resutcount = comdDAO.AddSaleChild(saleChild, this.currentUser);
                if (resutcount != 1)
                {
                    throw new BIZException("W03002");
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Пример #10
0
        private string addOrUpdateSaleOrder(SaleParent saleParent, List<SaleChild> saleChildList)
        {
            string parentOrderId = "";
            try
            {
                //add parent into db
                if (saleParent == null || saleParent.OrderId == null || saleParent.OrderId == string.Empty)
                {
                    saleParent.StatusKBN = 0;
                    saleParent.DeliveryFLG = false;
                    saleParent.PaymentFLG = false;

                    parentOrderId = this.addSaleOrderParent(saleParent);
                }
                else
                {
                    saleParent.StatusKBN = 0;
                    saleParent.DeliveryFLG = false;
                    saleParent.PaymentFLG = false;
                    this.UpdateSaleOrderParent(saleParent);
                    this.DeleteSaleOrderChild(saleParent.OrderId);

                    parentOrderId = saleParent.OrderId;
                }

                //goods
                foreach (SaleChild saleChild in saleChildList)
                {
                    saleChild.SaleKBN = 1;
                }

                //discount
                SaleChild saleChildDiscount = new SaleChild();
                saleChildDiscount.SaleKBN = 2;
                saleChildDiscount.Amount = 1;

                saleChildDiscount.PriceUnit = saleParent.Rebate;
                saleChildDiscount.PriceTotal = saleParent.Rebate;
                saleChildDiscount.PriceTotalActual = saleParent.Rebate;

                saleChildDiscount.PriceUnitForSaleMan = 0;
                saleChildDiscount.PriceTotalForSaleMan = 0;
                saleChildDiscount.PriceTotalActualForSaleMan = 0;

                //freight
                SaleChild saleChildFreight = new SaleChild();
                saleChildFreight.SaleKBN = 3;
                saleChildFreight.Amount = 1;

                saleChildFreight.PriceUnit = saleParent.Freight;
                saleChildFreight.PriceTotal = saleParent.Freight;
                saleChildFreight.PriceTotalActual = saleParent.Freight;

                saleChildFreight.PriceUnitForSaleMan = 0;
                saleChildFreight.PriceTotalForSaleMan = 0;
                saleChildFreight.PriceTotalActualForSaleMan = 0;

                //other pay
                SaleChild saleChildOtherPay = new SaleChild();
                saleChildOtherPay.SaleKBN = 4;
                saleChildOtherPay.Amount = 1;

                saleChildOtherPay.PriceUnit = saleParent.OtherPay;
                saleChildOtherPay.PriceTotal = saleParent.OtherPay;
                saleChildOtherPay.PriceTotalActual = saleParent.OtherPay;

                saleChildOtherPay.PriceUnitForSaleMan = 0;
                saleChildOtherPay.PriceTotalForSaleMan = 0;
                saleChildOtherPay.PriceTotalActualForSaleMan = 0;

                saleChildList.Add(saleChildDiscount);
                saleChildList.Add(saleChildFreight);
                saleChildList.Add(saleChildOtherPay);

                //add child into db
                foreach (SaleChild saleChild in saleChildList)
                {
                    //saleChild.PurParentId = purchaseParent.OrderId;
                    saleChild.OrderId = parentOrderId;
                    //saleChild.DetailId = this.GeneratePurOrderDetailId(saleChild.PurParentId);
                    this.addSaleOrderChild(saleChild);
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return parentOrderId;
        }