Ejemplo n.º 1
0
    private void SetData(ProductReturnData data)
    {
        this.txtLOID.Text = data.LOID.ToString();
        this.txtCode.Text = data.CODE.ToString();
        this.txtSTCode.Text = FlowObj.GetSTCode(data.REFLOID);
        this.txtStatus.Text = data.STATUS;
        this.txtSTLoid.Text = data.REFLOID.ToString();
        this.txtSupplier.Text = data.SUPPLIER.ToString();
        this.txtRemark.Text = data.REMARK;
        this.txtReason.Text = data.REASON;
        this.txtName.Text = data.CNAME;
        this.txtAddress.Text = data.CADDRESS;
        this.txtTel.Text = data.CTEL;
        this.txtFax.Text = data.CFAX;
        this.ctlPDReturnDate.DateValue = data.PDRETURNDATE;
        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.ctlSTDate.DateValue = FlowObj.GetSTDate(data.REFLOID);
        ABB.Data.Purchase.SupplierData sData = FlowObj.GetSupplierData(data.SUPPLIER);
        this.txtSupplierName.Text = sData.SUPPLIERNAME;
        this.grvPDReturn.DataSource = FlowObj.GetPDReturnItemList(data.LOID);
        this.grvPDReturn.DataBind();

        if (data.STATUS == Constz.Requisition.Status.Approved.Code || data.STATUS == Constz.Requisition.Status.Void.Code)
        {
            this.ctlToolbar.BtnSaveShow = false;
            this.ctlToolbar.BtnCancelShow = false;
            this.ctlToolbar.BtnSubmitShow = false;
            this.btnSearch.Visible = false;
        }
        this.ctlToolbar.ClientClickPrint = ABB.Global.Appz.ReportScript(Constz.Report.ProductReturn, data.LOID) + " return false;";
    }
Ejemplo n.º 2
0
 private ProductReturnData GetData()
 {
     ProductReturnData data = new ProductReturnData();
     data.CODEFROM = this.txtCodeFrom.Text.Trim();
     data.CODETO = this.txtCodeTo.Text.Trim();
     data.DATEFROM = this.ctlDateFrom.DateValue;
     data.DATETO = this.ctlDateTo.DateValue;
     data.PRODUCT = Convert.ToDouble(this.cmbProduct.SelectedItem.Value);
     data.SUPPLIER = Convert.ToDouble(this.cmbSupplier.SelectedItem.Value);
     data.STATUSFROM = this.cmbStatusFrom.SelectedItem.Value;
     data.STATUSTO = this.cmbStatusTo.SelectedItem.Value;
     return data;
 }
Ejemplo n.º 3
0
        public ProductReturnData GetData(double loid)
        {
            ProductReturnData data = new ProductReturnData();
            if (DALObj.GetDataByLOID(loid, null))
            {
                data.LOID = DALObj.LOID;
                data.CODE = DALObj.CODE;
                data.CREATEBY = DALObj.CREATEBY;
                data.CADDRESS = DALObj.CADDRESS;
                data.CFAX = DALObj.CFAX;
                data.CNAME = DALObj.CNAME;
                data.CTEL = DALObj.CTEL;
                data.PDRETURNDATE = DALObj.PDRETURNDATE;
                data.REASON = DALObj.REASON;
                data.REFLOID = DALObj.REFLOID;
                data.REMARK = DALObj.REMARK;
                data.STATUS = DALObj.STATUS;
                data.SUPPLIER = DALObj.SUPPLIER;

            }
            return data;
        }
Ejemplo n.º 4
0
        public bool ValidateData(ProductReturnData data)
        {
            bool ret = true;

            if (data.REFLOID == 0)
            {
                ret = false;
                _error = "¡ÃسÒàÅ×Í¡ãºá¨é§¤×¹ÊÔ¹¤éÒ/Çѵ¶Ø´Ôº";
            }
            if (data.ITEM.Count == 0)
            {
                ret = false;
                _error = "¡ÃسÒÃкØÃÒ¡Ò÷Õèµéͧ¡ÒÃÊ觤׹";
            }
            return ret;
        }
Ejemplo n.º 5
0
        //public TransportDAL SearchDAL
        //{
        //    get { if (search == null) search = new TransportDAL(); return search; }
        //}

        public DataTable GetPDReturnList(ProductReturnData data)
        {
            return DALObj.GetPDReturnList(data);
        }
Ejemplo n.º 6
0
        public bool CommitData(string userID, ProductReturnData data)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                DALObj.GetDataByLOID(data.LOID, obj.zTrans);
                if (DALObj.STATUS == Constz.Requisition.Status.Waiting.Code)
                {
                    UpdateData(userID, data, obj.zTrans);
                    ret = DALObj.CutStockPDReturn(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;
            }
            return ret;
        }
Ejemplo n.º 7
0
 public bool UpdateData(string userID, ProductReturnData data)
 {
     bool ret = true;
     OracleDBObj obj = new OracleDBObj();
     obj.CreateConnection();
     obj.CreateTransaction();
     try
     {
         DALObj.GetDataByLOID(data.LOID, obj.zTrans);
         UpdateData(userID, data, obj.zTrans);
         
         obj.zTrans.Commit();
         obj.CloseConnection();
     }
     catch (Exception ex)
     {
         obj.zTrans.Rollback();
         obj.CloseConnection();
         ret = false;
         _error = ex.Message;
     }
     return ret;
 }
Ejemplo n.º 8
0
        private void UpdateData(string userID, ProductReturnData data, System.Data.OracleClient.OracleTransaction trans)
        {
            bool ret = true;
            if (ValidateData(data))
            {
                DALObj.ACTIVE = data.ACTIVE;
                DALObj.STATUS = data.STATUS;
                DALObj.SUPPLIER = data.SUPPLIER;
                DALObj.CADDRESS = data.CADDRESS;
                DALObj.CFAX = data.CFAX;
                DALObj.CNAME = data.CNAME;
                DALObj.CTEL = data.CTEL;
                DALObj.PDRETURNDATE = data.PDRETURNDATE;
                DALObj.REASON = data.REASON;
                DALObj.REFLOID = data.REFLOID;
                DALObj.REFTABLE = data.REFTABLE;
                DALObj.REMARK = data.REMARK;
                DALObj.TYPE = data.TYPE;

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

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

                PDReturnItemDAL itemDAL = new PDReturnItemDAL();
                itemDAL.DeleteDataByPDReturn(data.LOID, trans);
                for (Int16 i = 0; i < data.ITEM.Count; ++i)
                {
                    ProductReturnItemData item = (ProductReturnItemData)data.ITEM[i];
                    itemDAL.ACTIVE = Constz.ActiveStatus.Active;
                    itemDAL.PDRETURN = DALObj.LOID;
                    itemDAL.PRODUCT = item.PRODUCT;
                    itemDAL.PRICE = item.PRICE;
                    itemDAL.QTY = item.QTY;
                    itemDAL.REFLOID = item.LOID;
                    itemDAL.REFTABLE = "STOCKOUTITEM";
                    itemDAL.UNIT = item.UNIT;
                    itemDAL.STATUS = Constz.Requisition.Status.Waiting.Code;
                    itemDAL.LOTNO = item.LOTNO;

                    itemDAL.OnDB = false;
                    ret = itemDAL.InsertCurrentData(userID, trans);
                    if (!ret) throw new ApplicationException(itemDAL.ErrorMessage);
                }
            }
            else
                throw new ApplicationException(_error);
        }
Ejemplo n.º 9
0
    private ProductReturnData GetData()
    {
        ProductReturnData data = new ProductReturnData();
        data.LOID = Convert.ToDouble(txtLOID.Text.Trim());
        data.REFLOID = Convert.ToDouble(this.txtSTLoid.Text.Trim());
        data.CODE = this.txtCode.Text.Trim();
        data.STATUS = this.txtStatus.Text.Trim();
        data.ACTIVE = Constz.ActiveStatus.Active;
        data.REFLOID = Convert.ToDouble(this.txtSTLoid.Text.Trim());
        data.REFTABLE = "STOCKOUT";
        data.CNAME = this.txtName.Text.Trim();
        data.CADDRESS = this.txtAddress.Text.Trim();
        data.CTEL = this.txtTel.Text.Trim();
        data.CFAX = this.txtFax.Text.Trim();
        data.SUPPLIER = Convert.ToDouble(this.txtSupplier.Text.Trim());
        data.REMARK = this.txtRemark.Text.Trim();
        data.REASON = this.txtReason.Text.Trim();
        data.PDRETURNDATE = this.ctlPDReturnDate.DateValue;
        data.ITEM = FlowObj.GetItemList(data.REFLOID);
        data.TYPE = "1";

        return data;
    }
Ejemplo n.º 10
0
        public DataTable GetPDReturnList(ProductReturnData whereData)
        {
            string whereString = "";
            if (whereData.CODEFROM.Trim() != "")
                whereString += (whereString == "" ? "" : "AND ") + "CODE >= '" + OracleDB.QRText(whereData.CODEFROM.Trim()) + "' ";
            if (whereData.CODETO.Trim() != "")
                whereString += (whereString == "" ? "" : "AND ") + "CODE <= '" + OracleDB.QRText(whereData.CODETO.Trim()) + "' ";
            if (whereData.DATEFROM.Year != 1)
                whereString += (whereString == "" ? "" : "AND ") + "PDRETURNDATE >= " + OracleDB.QRDate(whereData.DATEFROM) + " ";
            if (whereData.DATETO.Year != 1)
                whereString += (whereString == "" ? "" : "AND ") + "PDRETURNDATE <= " + OracleDB.QRDate(whereData.DATETO) + " ";
            if (whereData.PRODUCT != 0)
                whereString += (whereString == "" ? "" : "AND ") + "PRODUCT = " + whereData.PRODUCT.ToString() + " ";
            if (whereData.SUPPLIER != 0)
                whereString += (whereString == "" ? "" : "AND ") + "SUPPLIER = " + whereData.SUPPLIER.ToString() + " ";
            if (whereData.STATUSFROM.Trim() != "")
                whereString += (whereString == "" ? "" : "AND ") + "RANK >= '" + OracleDB.QRText(whereData.STATUSFROM.Trim()) + "' ";
            if (whereData.STATUSTO.Trim() != "")
                whereString += (whereString == "" ? "" : "AND ") + "RANK <= '" + OracleDB.QRText(whereData.STATUSTO.Trim()) + "' ";

            string sql = "SELECT ROWNUM NO, B.* FROM (SELECT PT.LOID,PT.CODE,PT.PDRETURNDATE,PTI.LOID PTILOID,PTI.PRODUCT,PD.NAME PRODUCTNAME,PTI.QTY,PTI.UNIT, ";
            sql += "CASE PT.STATUS WHEN '" + Constz.Requisition.Status.Waiting.Code + "' THEN '" + Constz.Requisition.Status.Waiting.Name + "' ";
            sql += "WHEN '" + Constz.Requisition.Status.Approved.Code + "' THEN '" + Constz.Requisition.Status.Approved.Name + "' ";
            sql += "WHEN '" + Constz.Requisition.Status.Void.Code + "' THEN '" + Constz.Requisition.Status.Void.Name + "' ";
            sql += "ELSE '' END AS STATUSNAME, ";
            sql += "CASE PT.STATUS WHEN '" + Constz.Requisition.Status.Waiting.Code + "' THEN '" + Constz.Requisition.Status.Waiting.Rank + "' ";
            sql += "WHEN '" + Constz.Requisition.Status.Approved.Code + "' THEN '" + Constz.Requisition.Status.Approved.Rank + "' ";
            sql += "WHEN '" + Constz.Requisition.Status.Void.Code + "' THEN '" + Constz.Requisition.Status.Void.Rank + "' ";
            sql += "ELSE '' END AS RANK,U.NAME UNITNAME,PT.SUPPLIER,S.SUPPLIERNAME,ST.CODE STCODE FROM PDRETURN PT ";
            sql += "INNER JOIN (SELECT MIN(LOID) LOID,PDRETURN FROM PDRETURNITEM GROUP BY PDRETURN)A ON PT.LOID = A.PDRETURN ";
            sql += "INNER JOIN PDRETURNITEM PTI ON A.LOID = PTI.LOID ";
            sql += "INNER JOIN STOCKOUT ST ON PT.REFTABLE = 'STOCKOUT' AND PT.REFLOID = ST.LOID INNER JOIN SUPPLIER S ON PT.SUPPLIER = S.LOID ";
            sql += "INNER JOIN PRODUCT PD ON PTI.PRODUCT = PD.LOID INNER JOIN UNIT U ON PTI.UNIT = U.LOID)B ";
            sql += (whereString == "" ? "" : "WHERE " + whereString);
            sql += "ORDER BY NO ";

            return OracleDB.ExecListCmd(sql);
        }