Exemplo n.º 1
0
        private PointOfSaleData GetData()
        {
            PointOfSaleData data = new PointOfSaleData();
            data.ACTIVE = Constz.ActiveStatus.Active;
            data.CASH = Convert.ToDouble(this.txtCash.Text == "" ? "0" : this.txtCash.Text);
            data.CODE = this.lblCode.Text.Trim();
            data.COUPON = Convert.ToDouble(this.txtCoupon.Text == "" ? "0" : this.txtCoupon.Text);
            data.CREDITCARDID = this.txtCreditCardID.Text.Trim();
            data.CREDITCARDPAY = Convert.ToDouble(this.txtCreditCardPay.Text == "" ? "0" : this.txtCreditCardPay.Text);
            data.CREDITTYPE = Convert.ToDouble(this.txtCreditCardType.Text == "" ? "0" : this.txtCreditCardType.Text);
            data.CUSTOMER = Convert.ToDouble(this.txtCustomer.Text == "" ? "0" : this.txtCustomer.Text);
            data.GRANDTOT = Convert.ToDouble(this.txtGrandTotal.Text == "" ? "0" : this.txtGrandTotal.Text);
            data.INVCODE = data.CODE;
            data.LOID = Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text);
            data.REFLOID = Convert.ToDouble(this.txtRefLOID.Text == "" ? "0" : this.txtRefLOID.Text);
            data.REFNO = this.txtRefCode.Text.Trim();
            data.REFTABLE = "REQUISITION";
            data.STATUS = Constz.Requisition.Status.Approved.Code;
            data.TOTAL = Convert.ToDouble(this.txtTotal.Text == "" ? "0" : this.txtTotal.Text);
            data.TOTDIS = Convert.ToDouble(this.txtTotalDiscount.Text == "" ? "0" : this.txtTotalDiscount.Text);
            data.TOTVAT = Convert.ToDouble(this.txtTotalVat.Text == "" ? "0" : this.txtTotalVat.Text);
            data.VAT = Convert.ToDouble(this.txtVat.Text == "" ? "0" : this.txtVat.Text);
            data.WAREHOUSE = Appz.CurrentUserData.Warehouse;
            data.REQDATE = DateTime.Now;
            data.USEMEMBERDISCOUNT = (chkUseMemberDiscount.Checked ? Constz.UseMemberDiscount.Yes : Constz.UseMemberDiscount.No);

            foreach (DataGridViewRow gRow in this.grvSales.Rows)
            {
                RequisitionItemData itemData = new RequisitionItemData();
                if (!gRow.IsNewRow)
                {
                    itemData.ACTIVE = Constz.ActiveStatus.Active;
                    itemData.DISCOUNT = Convert.ToDouble(gRow.Cells[indexDISCOUNT].Value);
                    itemData.ISVAT = (Convert.ToBoolean(gRow.Cells[indexISVAT].Value) ? Constz.VAT.Included.Code : Constz.VAT.NotIncluded.Code);
                    itemData.NETPRICE = Convert.ToDouble(gRow.Cells[indexNETPRICE].Value);
                    itemData.PRICE = Convert.ToDouble(gRow.Cells[indexPRICE].Value);
                    itemData.PRODUCT = Convert.ToDouble(gRow.Cells[indexPRODUCT].Value);
                    itemData.QTY = Convert.ToDouble(gRow.Cells[indexQTY].Value);
                    itemData.UNIT = Convert.ToDouble(gRow.Cells[indexUNIT].Value);
                    data.REQUISITIONITEM.Add(itemData);
                }
            }

            return data;
        }
Exemplo n.º 2
0
        public bool UpdateData(string userID, PointOfSaleData data, bool setInvoice)
        {
            bool ret = true;
            if (ValidateData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    _dal = new RequisitionDAL();
                    DALObj.OnDB = false;
                    DALObj.GetDataByLOID(data.LOID, obj.zTrans);

                    DALObj.REQUISITIONTYPE = Constz.Requisition.RequisitionType.REQ13;
                    DALObj.ACTIVE = data.ACTIVE;
                    DALObj.CASH = data.CASH;
                    DALObj.COUPON = data.COUPON;
                    DALObj.CREDITCARDID = data.CREDITCARDID;
                    DALObj.CREDITCARDPAY = data.CREDITCARDPAY;
                    DALObj.CREDITTYPE = data.CREDITTYPE;
                    DALObj.CUSTOMER = data.CUSTOMER;
                    DALObj.GRANDTOT = data.GRANDTOT;
                    DALObj.REFLOID = data.REFLOID;
                    DALObj.REFNO = data.REFNO;
                    DALObj.REFTABLE = data.REFTABLE;
                    DALObj.STATUS = data.STATUS;
                    DALObj.TOTAL = data.TOTAL;
                    DALObj.TOTDIS = data.TOTDIS;
                    DALObj.TOTVAT = data.TOTVAT;
                    DALObj.VAT = data.VAT;
                    DALObj.WAREHOUSE = data.WAREHOUSE;
                    DALObj.REQDATE = data.REQDATE;
                    if (setInvoice && DALObj.INVCODE != "") DALObj.INVCODE = OracleDB.GetRunningCode("REQUISITION_INVCODE", DALObj.REQUISITIONTYPE.ToString(), obj.zTrans);

                    if (DALObj.OnDB)
                        ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                    else
                        ret = DALObj.InsertCurrentData(userID, obj.zTrans);

                    _LOID = DALObj.LOID;
                    if (!ret)
                    {
                        throw new ApplicationException(DALObj.ErrorMessage);
                    }

                    RequisitionItemDAL itemDAL = new RequisitionItemDAL();
                    itemDAL.DeleteDataByRequisition(data.LOID, obj.zTrans);
                    for (Int16 i = 0; i < data.REQUISITIONITEM.Count; ++i)
                    {
                        RequisitionItemData item = (RequisitionItemData)data.REQUISITIONITEM[i];
                        itemDAL.ACTIVE = item.ACTIVE;
                        itemDAL.DISCOUNT = item.DISCOUNT;
                        itemDAL.DUEDATE = item.DUEDATE;
                        itemDAL.NETPRICE = item.NETPRICE;
                        itemDAL.PRODUCT = item.PRODUCT;
                        itemDAL.QTY = item.QTY;
                        itemDAL.PRICE = item.PRICE;
                        itemDAL.REQUISITION = DALObj.LOID;
                        itemDAL.UNIT = item.UNIT;
                        itemDAL.ISVAT = item.ISVAT;

                        itemDAL.OnDB = false;
                        ret = itemDAL.InsertCurrentData(userID, obj.zTrans);
                        if (!ret) throw new ApplicationException(itemDAL.ErrorMessage);
                    }

                    ret = DALObj.CutStockRequisition(DALObj.LOID, userID, obj.zTrans);
                    if (!ret) throw new ApplicationException(DALObj.ErrorMessage);
                    obj.zTrans.Commit();
                    obj.CloseConnection();
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    _error = ex.Message;
                }
            }
            else
                ret = false;
            return ret;
        }
Exemplo n.º 3
0
 public bool ValidateData(PointOfSaleData data)
 {
     bool ret = true;
     if (data.CUSTOMER == 0)
     {
         ret = false;
         _error = "¡ÃسÒÃкØÅÙ¡¤éÒ";
     }
     else if (data.REQUISITIONITEM.Count == 0)
     {
         ret = false;
         _error = "¡ÃسÒÃкØÃÒ¡ÒÃÊÔ¹¤éÒ";
     }
     return ret;
 }
Exemplo n.º 4
0
        public PointOfSaleData GetData(double loid)
        {
            PointOfSaleData data = new PointOfSaleData();
            if (DALObj.GetDataByLOID(loid, null))
            {
                data.INVCODE = DALObj.INVCODE;
                data.CODE = DALObj.CODE;
                data.ACTIVE = DALObj.ACTIVE;
                data.CASH = DALObj.CASH;
                data.COUPON = DALObj.COUPON;
                data.CREDITCARDID = DALObj.CREDITCARDID;
                data.CREDITCARDPAY = DALObj.CREDITCARDPAY;
                data.CREDITTYPE = DALObj.CREDITTYPE;
                data.CUSTOMER = DALObj.CUSTOMER;
                data.GRANDTOT = DALObj.GRANDTOT;
                data.REFLOID = DALObj.REFLOID;
                data.REFNO = DALObj.REFNO;
                data.REFTABLE = DALObj.REFTABLE;
                data.STATUS = DALObj.STATUS;
                data.TOTAL = DALObj.TOTAL;
                data.TOTDIS = DALObj.TOTDIS;
                data.TOTVAT = DALObj.TOTVAT;
                data.VAT = DALObj.VAT;
                data.WAREHOUSE = DALObj.WAREHOUSE;
                data.REQDATE = DALObj.REQDATE;
                data.CREATEBY = DALObj.CREATEBY;

                RequisitionItemDAL itemDAL = new RequisitionItemDAL();
                DataTable dt = GetRequisitionItem(loid);
                foreach (DataRow dRow in dt.Rows)
                {
                    RequisitionItemData itemData = new RequisitionItemData();
                    itemData.BarCode = dRow["BARCODE"].ToString();
                    itemData.DISCOUNT = Convert.ToDouble(dRow["DISCOUNT"]);
                    itemData.ISVAT = dRow["ISVAT"].ToString();
                    itemData.NETPRICE = Convert.ToDouble(dRow["NETPRICE"]);
                    itemData.PRICE = Convert.ToDouble(dRow["PRICE"]);
                    itemData.PRODUCT = Convert.ToDouble(dRow["PRODUCT"]);
                    itemData.QTY = Convert.ToDouble(dRow["QTY"]);
                    itemData.ProductName = dRow["NAME"].ToString();
                    data.REQUISITIONITEM.Add(itemData);
                }
            }
            return data;
        }