示例#1
0
    private PurchaseOrderData GetData()
    {
        PurchaseOrderData data = new PurchaseOrderData();
        data.ACTIVE = Constz.ActiveStatus.Active;
        data.CODE = "";
        data.ORDERDATE = DateTime.Now.Date;
        data.STATUS = Constz.Requisition.Status.Waiting.Code;
        data.VAT = Convert.ToDouble(SysConfigFlow.GetValue(Constz.ConfigName.VAT));

        for (int i = 0; i < this.grvProductPurchase.Rows.Count; ++i)
        {
            CheckBox chk = (CheckBox)this.grvProductPurchase.Rows[i].Cells[indexCheckBox].FindControl("chkItem");
            if (chk.Checked && chk.Enabled && this.grvProductPurchase.Rows[i].Cells[indexCheckBox].CssClass != "zHidden")
            {
                POItemData itemData = new POItemData();
                itemData.PRODUCT = Convert.ToDouble(this.grvProductPurchase.Rows[i].Cells[indexPRODUCT].Text);
                itemData.PRITEM = Convert.ToDouble(this.grvProductPurchase.Rows[i].Cells[indexLOID].Text);
                itemData.QTY = Convert.ToDouble(this.grvProductPurchase.Rows[i].Cells[indexQTY].Text);
                itemData.UNIT = Convert.ToDouble(this.grvProductPurchase.Rows[i].Cells[indexUNIT].Text);
                itemData.PRICE = Convert.ToDouble(this.grvProductPurchase.Rows[i].Cells[indexCURPRICE].Text);
                itemData.DUEDATE = Convert.ToDateTime(this.grvProductPurchase.Rows[i].Cells[indexDUEDATE].Text);
                itemData.ACTIVE = Constz.ActiveStatus.Active;

                data.ITEM.Add(itemData);
            }
        }
        return data;
    }
示例#2
0
 private PurchaseOrderData GetData()
 {
     PurchaseOrderData data = new PurchaseOrderData();
     data.CODE = this.lblCode.Text.Trim();
     data.LOID = this.txtLOID.Text == "" ? 0 : Convert.ToDouble(this.txtLOID.Text);
     data.SENDPODATE = this.DatePickerControl1.DateValue;
     data.SENDPO = this.cmbSendPO.SelectedItem.Value;
     data.SENDOTHER = this.txtSendPO.Text.Trim();
     data.REFSUPPCODE = this.txtRefSuppcode.Text.Trim();
     return data;
 }
示例#3
0
 private void SetData(PurchaseOrderData data)
 {
     if (data.LOID == 0)
     {
         //this.rbtIsType.SelectedIndex = 0;
     }
     this.txtLOID.Text = data.LOID.ToString();
     this.lblCode.Text = data.CODE;
     this.DatePickerControl1.DateValue = data.SENDPODATE;
     this.cmbSendPO.SelectedValue = data.SENDPO;
     this.txtSendPO.Text = data.SENDOTHER;
     this.txtRefSuppcode.Text = data.REFSUPPCODE;
 }
示例#4
0
 public PurchaseOrderData GetData(double loid)
 {
     PurchaseOrderData data = new PurchaseOrderData();
     if (DALObj.GetDataByLOID(loid, null))
     {
         data.LOID = DALObj.LOID;
         data.CODE = DALObj.CODE;
         data.SENDPODATE = DALObj.SENDPODATE;
         data.SENDPO = DALObj.SENDPO;
         data.SENDOTHER = DALObj.SENDOTHER;
         data.REFSUPPCODE = DALObj.REFSUPPCODE;
     }
     return data;
 }
示例#5
0
 public bool ValidateData(PurchaseOrderData data)
 {
     bool ret = true;
     if (data.SENDPO == "0")
     {
         ret = false;
         _error = "¡ÃسÒÃкØÇÔ¸Õ¡ÒÃÊè§ãºÊÑ觫×éÍ";
     }
     if (data.SENDPO == "OT" && data.SENDOTHER == "")
     {
         ret = false;
         _error = "¡ÃسÒÃкØÇÔ¸Õ¡ÒÃÊè§ãºÊÑ觫×éÍ";
     }
     return ret;
 }
示例#6
0
        public bool UpdateData(string userID, PurchaseOrderData data)
        {
            bool ret = true;
            if (ValidateData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    DALObj.OnDB = false;
                    DALObj.GetDataByLOID(data.LOID, obj.zTrans);

                    DALObj.CODE = data.CODE;
                    DALObj.SENDPODATE = data.SENDPODATE;
                    DALObj.SENDPO = data.SENDPO;
                    DALObj.SENDOTHER = data.SENDOTHER;
                    DALObj.REFSUPPCODE = data.REFSUPPCODE;

                    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);
                    }
                   
                    obj.zTrans.Commit();
                    obj.CloseConnection();
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    _error = ex.Message;
                }
            }
            else
                ret = false;
            return ret;
        }
示例#7
0
        public bool UpdateData(string userID, PurchaseOrderData data)
        {
            bool ret = true;
            if (ValidateData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    DALObj.OnDB = false;
                    DALObj.GetDataByLOID(data.LOID, obj.zTrans);

                    DALObj.CODE = data.CODE;
                    DALObj.ORDERDATE = data.ORDERDATE;
                    DALObj.ORDERTYPE = data.ORDERTYPE;
                    DALObj.SUPPLIER = data.SUPPLIER;
                    DALObj.CNAME = data.CNAME;
                    DALObj.CADDRESS = data.CADDRESS;
                    DALObj.CTEL = data.CTEL;
                    DALObj.CFAX = data.CFAX;
                    DALObj.APPROVER = data.APPROVER;
                    if (data.APPROVEDATE.Year != 1)
                    {
                        DALObj.APPROVEDATE = data.APPROVEDATE;
                    }
                    DALObj.REMARK = data.REMARK;
                    DALObj.PAYMENTTYPE = data.PAYMENTTYPE;
                    DALObj.PAYMENTDESC = data.PAYMENTDESC;
                    DALObj.TOTAL = data.TOTAL;
                    DALObj.TOTVAT = data.TOTVAT;
                    DALObj.TOTDIS = data.TOTDIS;
                    DALObj.GRANDTOT = data.GRANDTOT;
                    DALObj.REFLOID = data.REFLOID;
                    DALObj.REFTABLE = data.REFTABLE;
                    DALObj.STATUS = data.STATUS;
                    DALObj.ACTIVE = data.ACTIVE;
                    DALObj.DELIVERY = data.DELIVERY;
                    DALObj.OTHER = data.OTHER;
                    DALObj.VAT = data.VAT;
                    DALObj.POTYPE = data.TYPE;

                    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);
                    }

                    ret = DALObj2.UpdatePOOldActive(DALObj.REFLOID, Constz.ActiveStatus.InActive, userID, obj.zTrans);
                    if (!ret) throw new ApplicationException(DALObj.ErrorMessage);

                    POItemDAL itemDAL = new POItemDAL();
                    itemDAL.DeleteDataByPDOrder(data.LOID, obj.zTrans);
                    for (Int16 i = 0; i < data.ITEM.Count; ++i)
                    {
                        POItemData item = (POItemData)data.ITEM[i];
                        itemDAL.PRODUCT = item.PRODUCT;
                        itemDAL.PRITEM = item.PRITEM;
                        itemDAL.PDORDER = DALObj.LOID;
                        itemDAL.QTY = item.QTY;
                        itemDAL.RECEIVEQTY = item.RECEIVEQTY;
                        itemDAL.UNIT = item.UNIT;
                        itemDAL.PRICE = item.PRICE;
                        itemDAL.DISCOUNT = item.DISCOUNT;
                        itemDAL.DUEDATE = item.DUEDATE;
                        itemDAL.ACTIVE = item.ACTIVE;
                        itemDAL.REFPOITEM = item.LOID;
                        itemDAL.STATUS = DALObj.STATUS;
                        itemDAL.ISVAT = item.ISVAT;

                        itemDAL.OnDB = false;
                        ret = itemDAL.InsertCurrentData(userID, obj.zTrans);
                        if (!ret) throw new ApplicationException(itemDAL.ErrorMessage);
                    }
                    obj.zTrans.Commit();
                    obj.CloseConnection();
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    _error = ex.Message;
                }
            }
            else
                ret = false;
            return ret;
        }
示例#8
0
 public bool ValidateData(PurchaseOrderData data)
 {
     bool ret = true;
     if (data.ITEM.Count == 0)
     {
         ret = false;
         _error = "¡ÃسÒÃкØÃÒ¡ÒÃÊÔ¹¤éÒ";
     }
     return ret;
 }
示例#9
0
 public PurchaseOrderData GetData(double loid)
 {
     PurchaseOrderData data = new PurchaseOrderData();
     if (DALObj.GetDataByLOID(loid, null))
     {
         data.LOID = DALObj.LOID;
         data.CODE = DALObj.CODE;
        // data.ORDERDATE = DALObj.ORDERDATE;
         data.SUPPLIER = DALObj.SUPPLIER;
         data.CNAME = DALObj.CNAME;
         data.CADDRESS = DALObj.CADDRESS;
         data.CTEL = DALObj.CTEL;
         data.CFAX = DALObj.CFAX;
        // data.REMARK = DALObj.REMARK;
         data.PAYMENTTYPE = DALObj.PAYMENTTYPE;
         data.PAYMENTDESC = DALObj.PAYMENTDESC;
         data.TOTAL = DALObj.TOTAL;
         data.TOTVAT = DALObj.TOTVAT;
         data.TOTDIS = DALObj.TOTDIS;
         data.GRANDTOT = DALObj.GRANDTOT;
         data.REFLOID = DALObj.REFLOID;
         data.REFTABLE = DALObj.REFTABLE;
        // data.STATUS = DALObj.STATUS;
         data.DELIVERY = DALObj.DELIVERY;
         data.OTHER = DALObj.OTHER;
         data.VAT = DALObj.VAT;
         data.TYPE = DALObj.POTYPE;
     }
     return data;
 }
示例#10
0
        public bool NewPDOrder(string UserID, PurchaseOrderData data)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                PDOrderDAL _DAL = new PDOrderDAL();
                _DAL.OnDB = false;
                _DAL.ACTIVE = data.ACTIVE;
                _DAL.CODE = data.CODE;
                _DAL.ORDERDATE = data.ORDERDATE;
                _DAL.STATUS = data.STATUS;
                _DAL.VAT = data.VAT;
                _DAL.ORDERTYPE = Constz.OrderType.PO.Code;
                _DAL.POTYPE = "N";

                ret = _DAL.InsertCurrentData(UserID, obj.zTrans);
                _LOID = _DAL.LOID;
                if (!ret)
                {
                    throw new ApplicationException(_DAL.ErrorMessage);
                }
                
                POItemDAL _DALItem = new POItemDAL();
                for (int i = 0; i < data.ITEM.Count; ++i)
                {
                    _DALItem.OnDB = false;
                    POItemData itemData = (POItemData)data.ITEM[i];
                    
                    _DALItem.PRODUCT = itemData.PRODUCT;
                    _DALItem.PRITEM = itemData.PRITEM;
                    _DALItem.PDORDER = _DAL.LOID;
                    _DALItem.QTY = itemData.QTY;
                    _DALItem.UNIT = itemData.UNIT;
                    _DALItem.PRICE = itemData.PRICE;
                    _DALItem.DUEDATE = DateTime.Now.Date;
                    _DALItem.ACTIVE = itemData.ACTIVE;

                    ret = _DALItem.InsertCurrentData(UserID, obj.zTrans);
                    if (!ret)
                    {
                        throw new ApplicationException(_DALItem.ErrorMessage);
                    }
                }
                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }

            return ret;

        }
示例#11
0
        public bool ValidateData(PurchaseOrderData data)
        {
            bool ret = true;
            if (data.SUPPLIER == 0)
            {
                ret = false;
                _error = "¡ÃسÒÃкؼÙé¨Ó˹èÒÂ";
            }

            if (data.ITEM.Count == 0)
            {
                ret = false;
                _error = "¡ÃسÒÃкØÃÒ¡ÒÃÊÔ¹¤éÒ";
            }

            if (data.PAYMENTTYPE == "CC" && data.PAYMENTDESC == "")
            {
                ret = false;
                _error = "¡ÃسÒÃкØËÁÒÂàÅ¢ºÑµÃà¤Ã´Ôµ";
            }

            return ret;
        }
示例#12
0
    private PurchaseOrderData GetRecentData()
    {
        PurchaseOrderData data = new PurchaseOrderData();
        data.LOID = Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text);
        data.CODE = this.txtCode.Text.Trim();
        data.ORDERDATE = this.ctlOrderDate.DateValue;
        data.ORDERTYPE = Constz.OrderType.PO.Code;
        data.SUPPLIER = Convert.ToDouble(this.cmbSupplier.SelectedItem.Value);
        data.CNAME = this.txtCName.Text.Trim();
        data.CADDRESS = this.txtAddress.Text.Trim();
        data.CTEL = this.txtTel.Text.Trim();
        data.CFAX = this.txtFax.Text.Trim();
        data.APPROVER = Authz.CurrentUserInfo.UserID;
        data.APPROVEDATE = DateTime.Now.Date;
        data.REMARK = this.txtRemark.Text.Trim();
        data.REFLOID = Convert.ToDouble(this.txtRefLOID.Text == "" ? "0" : this.txtRefLOID.Text);
        data.REFTABLE = this.txtRefTable.Text;
        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.GRANDTOT = Convert.ToDouble(this.txtGrandTotal.Text == "" ? "0" : this.txtGrandTotal.Text);
        data.REFLOID = Convert.ToDouble(this.txtRefLOID.Text == "" ? "0" : this.txtRefLOID.Text);
        data.REFTABLE = this.txtRefTable.Text;
        data.STATUS = Constz.Requisition.Status.Approved.Code;
        data.ACTIVE = Constz.ActiveStatus.Active;
        data.DELIVERY = this.cmbDelivery.SelectedItem.Value;
        data.OTHER = this.txtOther.Text.Trim();
        data.VAT = Convert.ToDouble(this.txtVat.Text == "" ? "0" : this.txtVat.Text);
        data.TYPE = this.cmbType.SelectedItem.Value;
        data.PAYMENTTYPE = this.cmbPaymentType.SelectedItem.Value;
        data.PAYMENTDESC = this.txtPaymentDesc.Text.Trim();
        data.ITEM = ItemObj.GetItemList();

        return data;
    }
示例#13
0
    private void SetData(PurchaseOrderData data)
    {
        this.txtLOID.Text = data.LOID.ToString();
        this.txtStatus.Text = data.STATUS;
        this.txtRefLOID.Text = data.REFLOID.ToString();
        this.txtRefTable.Text = data.REFTABLE;

        this.cmbType.SelectedIndex = cmbType.Items.IndexOf(cmbType.Items.FindByValue(data.TYPE));
        this.cmbSupplier.SelectedIndex = this.cmbSupplier.Items.IndexOf(this.cmbSupplier.Items.FindByValue(data.SUPPLIER.ToString()));
        this.txtCName.Text = data.CNAME;
        this.txtAddress.Text = data.CADDRESS;
        this.txtTel.Text = data.CTEL;
        this.txtFax.Text = data.CFAX;
        this.cmbPaymentType.SelectedIndex = this.cmbPaymentType.Items.IndexOf(this.cmbPaymentType.Items.FindByValue(data.PAYMENTTYPE.ToString()));
        this.txtPaymentDesc.Text = data.PAYMENTDESC;

        this.txtCode.Text = data.CODE;
        this.ctlOrderDate.DateValue = data.ORDERDATE;

        SetREFPO(data.LOID.ToString());

        this.txtStatusName.Text = (data.STATUS == Constz.Requisition.Status.Approved.Code ? Constz.Requisition.Status.Approved.Name : (data.STATUS == Constz.Requisition.Status.Void.Code ? Constz.Requisition.Status.Void.Name : Constz.Requisition.Status.Waiting.Name));

        this.txtVat.Text = data.VAT.ToString();
        this.txtTotal.Text = data.TOTAL.ToString();
        this.txtTotalVat.Text = data.TOTVAT.ToString();
        this.txtTotalDiscount.Text = data.TOTDIS.ToString();
        this.txtGrandTotal.Text = data.GRANDTOT.ToString();
        
        this.cmbDelivery.SelectedIndex = this.cmbDelivery.Items.IndexOf(this.cmbDelivery.Items.FindByValue(data.DELIVERY.ToString()));
        this.txtOther.Text = data.OTHER;
        this.txtRemark.Text = data.REMARK;
        
        
        SetGrvItem(data.STATUS);
        Calculation();

        if (data.STATUS == Constz.Requisition.Status.Approved.Code || data.STATUS == Constz.Requisition.Status.Void.Code)
        {
            this.ToolbarControlPO1.BtnSaveShow = false;
            this.ToolbarControlPO1.BtnSubmitShow = false;
            this.ctlOrderDate.Enabled = false;
        }
        if (data.STATUS == Constz.Requisition.Status.Approved.Code)
        {
            this.ToolbarControlPO1.BtnSentShow = true;
        }
        else this.ToolbarControlPO1.BtnSentShow = false;
        this.ToolbarControlPO1.ClientClickPrint = Appz.ReportScript(Constz.Report.PurchaseOrder, data.LOID) + "return false;";
    }
示例#14
0
    private PurchaseOrderData GetData()
    {
        PurchaseOrderData data = new PurchaseOrderData();
        if (Convert.ToDouble(this.txtNewLoid.Text == "" ? "0" : this.txtNewLoid.Text) == Convert.ToDouble(this.txtOldLoid.Text == "" ? "0" : this.txtOldLoid.Text))
            data.LOID = 0;
        else
            data.LOID = Convert.ToDouble(this.txtNewLoid.Text == "" ? "0" : this.txtNewLoid.Text);

        data.CODE = this.txtPONewCode.Text.Trim();
        data.ORDERDATE = this.ctlOrderDate.DateValue;
        data.ORDERTYPE = Constz.OrderType.PO.Code;
        data.SUPPLIER = Convert.ToDouble(this.cmbSupplier.SelectedItem.Value);
        data.CNAME = this.txtCName.Text.Trim();
        data.CADDRESS = this.txtAddress.Text.Trim();
        data.CTEL = this.txtTel.Text.Trim();
        data.CFAX = this.txtFax.Text.Trim();
        // data.REMARK = this.txtRemark.Text.Trim();
        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.GRANDTOT = Convert.ToDouble(this.txtGrandTotal.Text == "" ? "0" : this.txtGrandTotal.Text);
        data.DELIVERY = this.cmbDelivery.SelectedItem.Value;
        data.OTHER = this.txtOther.Text.Trim();
        data.PAYMENTDESC = this.txtPaymentDesc.Text;
        data.PAYMENTTYPE = this.cmbPaymentType.SelectedItem.Value;
        data.VAT = Convert.ToDouble(this.txtVat.Text == "" ? "0" : this.txtVat.Text);
        data.REFLOID = Convert.ToDouble(this.txtOldLoid.Text == "" ? "0" : this.txtOldLoid.Text);
        data.REFTABLE = "PDORDER";
        data.STATUS = this.txtStatus.Text.Trim();
        data.ACTIVE = Constz.ActiveStatus.Active;
        data.TYPE = this.txtPOType.Text.Trim();
        data.ITEM = ItemObj.GetItemList();

        return data;
    }
示例#15
0
    private void SetDataNew(PurchaseOrderData data)
    {
        this.txtPONewCode.Text = data.CODE;
        this.txtNewLoid.Text = data.LOID.ToString();
        this.txtOldLoid.Text = data.REFLOID.ToString();
        //this.txtStatus.Text = data.STATUS;
        this.txtRefLOID.Text = data.REFLOID.ToString();
        this.txtRefTable.Text = data.REFTABLE;

        this.cmbSupplier.SelectedIndex = this.cmbSupplier.Items.IndexOf(this.cmbSupplier.Items.FindByValue(data.SUPPLIER.ToString()));
        this.txtCName.Text = data.CNAME;
        this.txtAddress.Text = data.CADDRESS;
        this.txtTel.Text = data.CTEL;
        this.txtFax.Text = data.CFAX;

        this.txtVat.Text = data.VAT.ToString();
        this.txtTotal.Text = data.TOTAL.ToString();
        this.txtTotalVat.Text = data.TOTVAT.ToString();
        this.txtTotalDiscount.Text = data.TOTDIS.ToString();
        this.txtGrandTotal.Text = data.GRANDTOT.ToString();

        this.cmbPaymentType.SelectedIndex = this.cmbPaymentType.Items.IndexOf(this.cmbPaymentType.Items.FindByValue(data.PAYMENTTYPE.ToString()));
        this.txtPaymentDesc.Text = data.PAYMENTDESC;
        this.cmbDelivery.SelectedIndex = this.cmbDelivery.Items.IndexOf(this.cmbDelivery.Items.FindByValue(data.DELIVERY.ToString()));
        this.txtOther.Text = data.OTHER;
        this.txtPOType.Text = data.TYPE;
        this.txtPOOldCode.Text = FlowObj.GetPOOldCode(data.REFLOID);
        SetGrvItem(this.txtStatus.Text.Trim());
        Calculation();

    }