Example #1
0
        private void SetData(BillData data)
        {
            this.Text += " " + data.CODE;
            this.txtCode.Text = data.CODE;
            this.txtCreateBy.Text = data.CREATEBY;
            this.txtCName.Text = data.CUSTOMERNAME.Trim();
            this.txtDate.Text = data.REQDATE.ToString(Constz.DateFormat);
            this.txtGrandTotal.Text = data.GRANDTOT.ToString(Constz.DblFormat);
            this.txtRefNo.Text = data.REFCODE;
            this.txtTotal.Text = data.TOTAL.ToString(Constz.DblFormat);
            this.txtTotalDiscount.Text = data.TOTDIS.ToString(Constz.DblFormat);
            this.txtTotalVat.Text = data.TOTVAT.ToString(Constz.DblFormat);
            this.txtVat.Text = data.VAT.ToString(Constz.IntFormat);
            this.txtCCode.Text = data.CCODE;
            this.txtCName.Text = data.CNAME;
            this.txtCAddress.Text = data.CADDRESS;
            this.txtCTel.Text = data.CTEL;
            this.txtCFax.Text = data.CFAX;
            this.txtCheque.Text = data.CHEQUE;
            if (data.CHEQUEDATE.Year == 1)
                this.dtpChequeDate.Value = DateTime.Today;
            else
                this.dtpChequeDate.Value = data.CHEQUEDATE;
            this.txtBankName.Text = data.BANKNAME;
            this.txtBankBranch.Text = data.BANKBRANCH;
            this.txtCredit.Text = data.CREDITCARDID;
            this.txtReceiveBy.Text = data.RECEIVEBY;
            if (data.RECEIVEDATE.Year == 1)
                this.dtpReceiveDate.Value = DateTime.Today;
            else
                this.dtpReceiveDate.Value = data.RECEIVEDATE;

            this.rdoCash.Checked = (data.PAYMENT == Constz.Payment.Cash.Code);
            this.rdoCheque.Checked = (data.PAYMENT == Constz.Payment.Cheque.Code);
            this.rdoCredit.Checked = (data.PAYMENT == Constz.Payment.CreditCard.Code);

            this.grvSales.Rows.Clear();
            for (int i = 0; i < data.ITEM.Count; ++i)
            {
                RequisitionItemData itemData = (RequisitionItemData)data.ITEM[i];
                DataGridViewRow gRow = (DataGridViewRow)this.grvSales.Rows[this.grvSales.NewRowIndex].Clone();
                gRow.Cells[indexORDERNO].Value = i + 1;
                gRow.Cells[indexBARCODE].Value = itemData.BarCode;
                gRow.Cells[indexNAME].Value = itemData.ProductName;
                gRow.Cells[indexQTY].Value = itemData.QTY;
                gRow.Cells[indexUNITNAME].Value = itemData.UnitName;
                gRow.Cells[indexPRICE].Value = itemData.PRICE;
                gRow.Cells[indexDISCOUNT].Value = itemData.DISCOUNT;
                gRow.Cells[indexNETPRICE].Value = itemData.NETPRICE;
                gRow.Cells[indexISVAT].Value = (itemData.ISVAT == Constz.VAT.Included.Code);
                this.grvSales.Rows.Add(gRow);
            }
            this.grvSales.AllowUserToAddRows = false;
        }
Example #2
0
        public BillData GetData(double requisition)
        {
            BillData data = new BillData();
            DataTable dt = SearchObj.GetRequisitionData(requisition);
            foreach (DataRow dRow in dt.Rows)
            {
                data.REQUISITION = Convert.ToDouble(dRow["LOID"]);
                data.CODE = dRow["CODE"].ToString();
                data.REQDATE = Convert.ToDateTime(dRow["REQDATE"]);
                if (!Convert.IsDBNull(dRow["REFCODE"])) data.REFCODE = dRow["REFCODE"].ToString();
                if (!Convert.IsDBNull(dRow["CNAME"])) data.CUSTOMERNAME = dRow["CNAME"].ToString();
                data.TOTAL = Convert.ToDouble(dRow["TOTAL"]);
                data.TOTDIS = Convert.ToDouble(dRow["TOTDIS"]);
                data.VAT = Convert.ToDouble(dRow["VAT"]);
                data.TOTVAT = Convert.ToDouble(dRow["TOTVAT"]);
                data.GRANDTOT = Convert.ToDouble(dRow["GRANDTOT"]);
                data.CREATEBY = dRow["CREATEBY"].ToString();
                if (!Convert.IsDBNull(dRow["CCODE"])) data.CCODE = dRow["CCODE"].ToString();
                if (!Convert.IsDBNull(dRow["CNAME"])) data.CNAME = dRow["CNAME"].ToString();
                if (!Convert.IsDBNull(dRow["CADDRESS"])) data.CADDRESS = dRow["CADDRESS"].ToString();
                if (!Convert.IsDBNull(dRow["CTEL"])) data.CTEL = dRow["CTEL"].ToString();
                if (!Convert.IsDBNull(dRow["CFAX"])) data.CFAX = dRow["CFAX"].ToString();
                if (!Convert.IsDBNull(dRow["PAYMENT"])) data.PAYMENT = dRow["PAYMENT"].ToString();
                if (!Convert.IsDBNull(dRow["CHEQUE"])) data.CHEQUE = dRow["CHEQUE"].ToString();
                if (!Convert.IsDBNull(dRow["CREDITCARDID"])) data.CREDITCARDID= dRow["CREDITCARDID"].ToString();
                if (!Convert.IsDBNull(dRow["CHEQUEDATE"])) data.CHEQUEDATE = Convert.ToDateTime(dRow["CHEQUEDATE"]);
                if (!Convert.IsDBNull(dRow["BANKNAME"])) data.BANKNAME = dRow["BANKNAME"].ToString();
                if (!Convert.IsDBNull(dRow["BANKBRANCH"])) data.BANKBRANCH = dRow["BANKBRANCH"].ToString();
                if (!Convert.IsDBNull(dRow["RECEIVEBY"])) data.RECEIVEBY = dRow["RECEIVEBY"].ToString();
                if (!Convert.IsDBNull(dRow["RECEIVEDATE"])) data.RECEIVEDATE = Convert.ToDateTime(dRow["RECEIVEDATE"]);
                if (!Convert.IsDBNull(dRow["INVCODE"])) data.INVCODE = dRow["INVCODE"].ToString();
            }
            DataTable dtItem = SearchObj.GetRequisitionItem(requisition);
            foreach (DataRow dRow in dtItem.Rows)
            {
                RequisitionItemData itemData = new RequisitionItemData();
                itemData.LOID = Convert.ToDouble(dRow["RANK"]);
                itemData.BarCode = dRow["BARCODE"].ToString();
                itemData.ProductName = dRow["PRODUCTNAME"].ToString();
                itemData.QTY = Convert.ToDouble(dRow["QTY"]);
                itemData.UnitName = dRow["UNITNAME"].ToString();
                itemData.PRICE = Convert.ToDouble(dRow["PRICE"]);
                itemData.DISCOUNT = Convert.ToDouble(dRow["DISCOUNT"]);
                itemData.NETPRICE = Convert.ToDouble(dRow["NETPRICE"]);
                itemData.ISVAT = dRow["ISVAT"].ToString();

                data.ITEM.Add(itemData);
            }
            return data;
        }
Example #3
0
        public bool UpdateData(string userID, BillData data)
        {
            bool ret = true;
            if (ValidateData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    _dal = new RequisitionDAL();
                    DALObj.OnDB = false;
                    DALObj.GetDataByLOID(data.REQUISITION, obj.zTrans);

                    DALObj.CCODE = data.CCODE;
                    DALObj.CNAME = data.CNAME;
                    DALObj.CADDRESS = data.CADDRESS;
                    DALObj.CTEL = data.CTEL;
                    DALObj.CFAX = data.CFAX;
                    DALObj.PAYMENT = data.PAYMENT;
                    DALObj.CHEQUE = data.CHEQUE;
                    DALObj.CREDITCARDID = data.CREDITCARDID;
                    DALObj.CHEQUEDATE = data.CHEQUEDATE;
                    DALObj.BANKNAME = data.BANKNAME;
                    DALObj.BANKBRANCH = data.BANKBRANCH;
                    DALObj.RECEIVEBY = data.RECEIVEBY;
                    DALObj.RECEIVEDATE = data.RECEIVEDATE;
                    DALObj.REFNO = data.REFCODE;
                    if (DALObj.INVCODE == "") DALObj.INVCODE = OracleDB.GetRunningCode("REQUISITION_INVCODE", DALObj.REQUISITIONTYPE.ToString(), obj.zTrans);

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

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

                    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;
        }
Example #4
0
 public bool ValidateData(BillData data)
 {
     bool ret = true;
     return ret;
 }
Example #5
0
 private BillData GetData()
 {
     BillData data = new BillData();
     data.REQUISITION = Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text);
     data.REFCODE = this.txtRefNo.Text.Trim();
     data.CCODE = this.txtCCode.Text.Trim();
     data.CNAME = this.txtCName.Text.Trim();
     data.CADDRESS = this.txtCAddress.Text.Trim();
     data.CTEL = this.txtCTel.Text.Trim();
     data.CFAX = this.txtCFax.Text.Trim();
     if (rdoCash.Checked)
         data.PAYMENT = Constz.Payment.Cash.Code;
     else if (rdoCheque.Checked)
         data.PAYMENT = Constz.Payment.Cheque.Code;
     else
         data.PAYMENT = Constz.Payment.CreditCard.Code;
     data.CHEQUE = this.txtCheque.Text.Trim();
     data.CREDITCARDID = this.txtCredit.Text.Trim();
     data.CHEQUEDATE = this.dtpChequeDate.Value;
     data.BANKNAME = this.txtBankName.Text.Trim();
     data.BANKBRANCH = this.txtBankBranch.Text.Trim();
     data.RECEIVEBY = this.txtReceiveBy.Text;
     data.RECEIVEDATE = this.dtpReceiveDate.Value;
     return data;
 }