示例#1
0
文件: BillFlow.cs 项目: SoftSuite/ABB
 public bool SetInvoiceCode(string userID, double requisition)
 {
     bool ret = true;
     OracleDBObj obj = new OracleDBObj();
     obj.CreateConnection();
     obj.CreateTransaction();
     try
     {
         RequisitionDAL reqDAL = new RequisitionDAL();
         reqDAL.GetDataByLOID(requisition, obj.zTrans);
         if (reqDAL.INVCODE == "")
         {
             reqDAL.INVCODE = OracleDB.GetRunningCode("REQUISITION_INVCODE", reqDAL.REQUISITIONTYPE.ToString(), obj.zTrans);
             ret = reqDAL.UpdateCurrentData(userID, obj.zTrans);
             if (!ret) throw new ApplicationException(reqDAL.ErrorMessage);
         }
         obj.zTrans.Commit();
         obj.CloseConnection();
     }
     catch (Exception ex)
     {
         obj.zTrans.Rollback();
         obj.CloseConnection();
         ret = false;
         _error = ex.Message;
     }
     return ret;
 }
示例#2
0
        public bool NewStockOut(string userID, double requisition)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                RequisitionDAL rDAL = new RequisitionDAL();
                rDAL.GetDataByLOID(requisition, obj.zTrans);
                if (rDAL.OnDB)
                {
                    DocTypeDAL dDAL = new DocTypeDAL();
                    dDAL.GetDataByRequisitionType(rDAL.REQUISITIONTYPE, obj.zTrans);

                    DALObj.OnDB = false;
                    DALObj.ACTIVE = Constz.ActiveStatus.Active;
                    DALObj.DOCTYPE = dDAL.LOID;
                    DALObj.RECEIVER = rDAL.WAREHOUSE;
                    DALObj.REFLOID = rDAL.LOID;
                    DALObj.REFTABLE = "REQUISITION";
                    DALObj.REQDATE = DateTime.Today;
                    DALObj.SENDER = rDAL.WAREHOUSE;
                    DALObj.STATUS = Constz.Requisition.Status.Waiting.Code;

                    ret = DALObj.InsertCurrentData(userID, obj.zTrans);
                    if (!ret) throw new ApplicationException(DALObj.ErrorMessage);

                    _LOID = DALObj.LOID;
                }
                else
                {
                    throw new ApplicationException("äÁ辺¢éÍÁÙŤӢÍ");
                }

                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }
            return ret;
        }
示例#3
0
        public bool SubmitStockOut(string userID, double stockOut)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                DALObj.OnDB = false;
                DALObj.GetDataByLOID(stockOut, obj.zTrans);
                if (DALObj.STATUS == Constz.Requisition.Status.Waiting.Code)
                {
                    DALObj.STATUS = Constz.Requisition.Status.Approved.Code;

                    ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                    if (!ret) throw new ApplicationException(DALObj.ErrorMessage);

                    RequisitionDAL rDAL = new RequisitionDAL();
                    rDAL.GetDataByLOID(DALObj.REFLOID, obj.zTrans);
                    rDAL.ACTIVE = Constz.ActiveStatus.InActive;

                    ret = rDAL.UpdateCurrentData(userID, obj.zTrans);
                    if (!ret) throw new ApplicationException(rDAL.ErrorMessage);

                    ret = DALItemObj.UpdateStatusByStockOut(stockOut, DALObj.STATUS, userID, obj.zTrans);
                    if (!ret) throw new ApplicationException(DALItemObj.ErrorMessage);

                    ret = DALObj.CutStock(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;
        }
示例#4
0
        private bool NewRequisition(string UserID, ToDoListMinimumStockRequestData data)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                RequisitionDAL _DAL = new RequisitionDAL();
                _DAL.OnDB = false;
                _DAL.OFFICER = data.REQUESTBY;
                _DAL.REQDATE = DateTime.Now.Date;
                _DAL.ACTIVE = data.ACTIVE;
                _DAL.STATUS = data.STATUS;
                _DAL.WAREHOUSE = data.WAREHOUSE;
                _DAL.REQUISITIONTYPE = data.REQUISITIONTYPE;
                _DAL.RESERVEDATE = DateTime.Now.Date;

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

                _LOID = _DAL.LOID;

                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }

            return ret;

        }
示例#5
0
        public bool NewStockOut(string userID, double requisition, double warehouse)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                RequisitionDAL reqDAL = new RequisitionDAL();
                reqDAL.GetDataByLOID(requisition, obj.zTrans);

                ReqMaterialDAL reqItemDAL = new ReqMaterialDAL();
                DataTable dt = CompareLot(reqItemDAL.GetDataByRequisition(requisition, obj.zTrans),warehouse);

                DocTypeDAL docDAL = new DocTypeDAL();
                docDAL.GetDataByRequisitionType(reqDAL.REQUISITIONTYPE, obj.zTrans);

                StockOutDAL _DAL = new StockOutDAL();
                _DAL.OnDB = false;
                _DAL.ACTIVE = Constz.ActiveStatus.Active;
                _DAL.DOCTYPE = docDAL.LOID;
                _DAL.RECEIVER = (reqDAL.CUSTOMER != 0 ? reqDAL.CUSTOMER : reqDAL.WAREHOUSE);
                _DAL.REFLOID = reqDAL.LOID;
                _DAL.REFTABLE = reqDAL.TableName;
                _DAL.REQDATE = reqDAL.REQDATE;
                _DAL.SENDER = warehouse;
                _DAL.STATUS = Constz.Requisition.Status.Waiting.Code;
                _DAL.PRODUCTREF = "PDPRODUCT";
                _DAL.PRODUCTLOID = reqDAL.REFLOID;

                ret = _DAL.InsertCurrentData(userID, obj.zTrans);
                if (!ret)
                {
                    throw new ApplicationException(_DAL.ErrorMessage);
                }
                StockOutItemDAL _DALItem = new StockOutItemDAL();
                foreach (DataRow dRow in dt.Rows)
                {
                    _DALItem.OnDB = false;
                    _DALItem.LOTNO = dRow["LOTNO"].ToString();
                    _DALItem.PRODUCT = Convert.ToDouble(dRow["PRODUCT"]);
                    _DALItem.QTY = Convert.ToDouble(dRow["MASTER"]);
                    _DALItem.REFLOID = Convert.ToDouble(dRow["LOID"]);
                    _DALItem.REFTABLE = "REQUISITIONITEM";
                    _DALItem.STATUS = Constz.Requisition.Status.Waiting.Code;
                    _DALItem.STOCKOUT = _DAL.LOID;
                    _DALItem.UNIT = Convert.ToDouble(dRow["UNIT"]);
                    _DALItem.ACTIVE = Constz.ActiveStatus.Active;
                    _DALItem.REMAIN = Convert.ToDouble(dRow["REMAINQTY"]);

                    ret = _DALItem.InsertCurrentData(userID, obj.zTrans);
                    if (!ret)
                    {
                        throw new ApplicationException(_DALItem.ErrorMessage);
                    }
                }

                _LOID = _DAL.LOID;

                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }
            return ret;
        }
示例#6
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;
        }
示例#7
0
        public bool NewStockOut(string userID, double requisition, double warehouse)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                RequisitionDAL reqDAL = new RequisitionDAL();
                reqDAL.GetDataByLOID(requisition, obj.zTrans);

                RequisitionItemDAL reqItemDAL = new RequisitionItemDAL();
                DataTable dt = reqItemDAL.GetDataByRequisition(requisition, obj.zTrans);

                DocTypeDAL docDAL = new DocTypeDAL();
                docDAL.GetDataByRequisitionType(reqDAL.REQUISITIONTYPE, obj.zTrans);

                StockOutDAL _DAL = new StockOutDAL();
                _DAL.OnDB = false;
                _DAL.ACTIVE = Constz.ActiveStatus.Active;
                _DAL.DOCTYPE = docDAL.LOID;
                _DAL.RECEIVER = (reqDAL.CUSTOMER != 0 ? reqDAL.CUSTOMER : reqDAL.WAREHOUSE);
                _DAL.REFLOID = reqDAL.LOID;
                _DAL.REFTABLE = reqDAL.TableName;
                _DAL.REQDATE = reqDAL.REQDATE;
                _DAL.SENDER = warehouse;
                _DAL.STATUS = Constz.Requisition.Status.Waiting.Code;
                _DAL.CTITLE = reqDAL.CTITLE;
                _DAL.CNAME = reqDAL.CNAME;
                _DAL.CLASTNAME = reqDAL.CLASTNAME;
                _DAL.CADDRESS = reqDAL.CADDRESS;
                _DAL.CFAX = reqDAL.CFAX;
                _DAL.CTEL = reqDAL.CTEL;

                ret = _DAL.InsertCurrentData(userID, obj.zTrans);
                if (!ret)
                {
                    throw new ApplicationException(_DAL.ErrorMessage);
                }
                StockOutItemDAL _DALItem = new StockOutItemDAL();
                foreach (DataRow dRow in dt.Rows)
                {
                    StockFGDAL fgDAL = new StockFGDAL();
                    double qty = Convert.ToDouble(dRow["QTY"]);
                    DataTable dtStock = fgDAL.GetProductStock(warehouse, Convert.ToDouble(dRow["PRODUCT"]), obj.zTrans);
                    foreach (DataRow sRow in dtStock.Rows)
                    {
                        _DALItem.OnDB = false;
                        _DALItem.LOTNO = sRow["LOTNO"].ToString();
                        _DALItem.PRODUCT = Convert.ToDouble(dRow["PRODUCT"]);
                        if (qty >= Convert.ToDouble(sRow["QTY"]))
                            _DALItem.QTY = Convert.ToDouble(sRow["QTY"]);
                        else
                            _DALItem.QTY = qty;
                        _DALItem.REFLOID = Convert.ToDouble(dRow["LOID"]);
                        _DALItem.REFTABLE = "REQUISITIONITEM";
                        _DALItem.STATUS = Constz.Requisition.Status.Waiting.Code;
                        _DALItem.STOCKOUT = _DAL.LOID;
                        _DALItem.UNIT = Convert.ToDouble(dRow["UNIT"]);
                        _DALItem.ACTIVE = Constz.ActiveStatus.Active;
                        _DALItem.PRICE = Convert.ToDouble(dRow["PRICE"]);
                        double remain = _DALItem.GetRemainQTYStockFG(_DALItem.LOTNO, _DALItem.PRODUCT, obj.zTrans);
                        _DALItem.REMAIN = remain;
                        qty -= Convert.ToDouble(sRow["QTY"]);

                        ret = _DALItem.InsertCurrentData(userID, obj.zTrans);
                        if (!ret)
                        {
                            throw new ApplicationException(_DALItem.ErrorMessage);
                        }

                        if (qty <= 0) break;
                    }

                }

                _LOID = _DAL.LOID;

                obj.zTrans.Commit();
                obj.CloseConnection();
            }
            catch (Exception ex)
            {
                obj.zTrans.Rollback();
                obj.CloseConnection();
                ret = false;
                _error = ex.Message;
            }
            return ret;
        }
示例#8
0
 public StockInShopData GetStockOutData(double stockOut)
 {
     StockInShopData data = new StockInShopData();
     StockOutDAL sDAL = new StockOutDAL();
     sDAL.TableName = "STOCKOUT" + Constz.ABBSERV + "";
     sDAL.GetDataByLOID(stockOut, null);
     data.CODE = sDAL.CODE;
     data.RECEIVER = sDAL.RECEIVER;
     data.REFLOID = sDAL.LOID;
     data.SENDER = sDAL.RECEIVER;
     RequisitionDAL rDAL = new RequisitionDAL();
     rDAL.TableName = "REQUISITION" + Constz.ABBSERV + "";
     rDAL.GetDataByLOID(sDAL.REFLOID, null);
     data.REQUISITIONCODE = rDAL.CODE;
     DataTable dt = SearchObj.GetStockOutProductList(stockOut);
     int i = 1;
     foreach (DataRow dRow in dt.Rows)
     {
         dRow["ORDERNO"] = i;
         i += 1;
     }
     data.ITEM = dt;
     return data;
 }
示例#9
0
 public StockInShopData GetStockOutData(string requisitionCode, double currentStockIn)
 {
     double stockOut = 0;
     ABB.Data.Search.StockOutProductSearchData searchData = new ABB.Data.Search.StockOutProductSearchData();
     searchData.REQUISITIONCODEFROM = requisitionCode;
     searchData.REQUISITIONCODETO = requisitionCode;
     DataTable dtSearch = GetStockOutList(searchData, currentStockIn);
     if (dtSearch.Rows.Count == 1)
     {
         stockOut = Convert.ToDouble(dtSearch.Rows[0]["STOCKOUT"]);
     }
     StockInShopData data = new StockInShopData();
     StockOutDAL sDAL = new StockOutDAL();
     sDAL.TableName = "STOCKOUT" + Constz.ABBSERV + "";
     sDAL.GetDataByLOID(stockOut, null);
     data.CODE = sDAL.CODE;
     data.RECEIVER = sDAL.RECEIVER;
     data.REFLOID = sDAL.LOID;
     data.SENDER = sDAL.RECEIVER;
     RequisitionDAL rDAL = new RequisitionDAL();
     rDAL.TableName = "REQUISITION" + Constz.ABBSERV + "";
     rDAL.GetDataByLOID(sDAL.REFLOID, null);
     data.REQUISITIONCODE = rDAL.CODE;
     DataTable dt = SearchObj.GetStockOutProductList(stockOut);
     int i = 1;
     foreach (DataRow dRow in dt.Rows)
     {
         dRow["ORDERNO"] = i;
         i += 1;
     }
     data.ITEM = dt;
     return data;
 }
示例#10
0
        public bool DeleteData(string userID, ArrayList arrLOID)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                RequisitionItemDAL itemDAL;
                for (int i = 0; i < arrLOID.Count; ++i)
                {
                    _dal = new RequisitionDAL();
                    double loid = Convert.ToDouble(arrLOID[i]);
                    DALObj.OnDB = false;
                    DALObj.GetDataByLOID(loid, obj.zTrans);
                    if (DALObj.STATUS == Constz.Requisition.Status.Waiting.Code)
                    {
                        itemDAL = new RequisitionItemDAL();
                        ret = itemDAL.DeleteDataByRequisition(loid, obj.zTrans);
                        if (!ret) throw new ApplicationException(itemDAL.ErrorMessage);

                        ret = DALObj.DeleteCurrentData(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;
        }
示例#11
0
        public bool UpdateStockOutStatus(string userID, double stockOut, string status)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                DALObj.OnDB = false;
                DALObj.GetDataByLOID(stockOut, obj.zTrans);
                DALObj.STATUS = status;

                if (DALObj.OnDB)
                    ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                if (!ret) throw new ApplicationException(DALObj.ErrorMessage);

                RequisitionDAL rDAL = new RequisitionDAL();
                rDAL.GetDataByLOID(DALObj.REFLOID, obj.zTrans);
                rDAL.ACTIVE = Constz.ActiveStatus.InActive;
                if (rDAL.OnDB)
                    ret = rDAL.UpdateCurrentData(userID, obj.zTrans);
                if (!ret) throw new ApplicationException(rDAL.ErrorMessage);

                ret = DALItemObj.UpdateStatusByStockOut(stockOut, status, userID, obj.zTrans);
                if (!ret) throw new ApplicationException(DALItemObj.ErrorMessage);

                PDProductDAL pdDAL = new PDProductDAL();
                pdDAL.GetDataByLOID(rDAL.REFLOID, obj.zTrans);

                PDOrderDAL poDAL = new PDOrderDAL();
                poDAL.GetDataByLOID(pdDAL.PDORDER, obj.zTrans);
                poDAL.STATUS = Constz.Requisition.Status.RW.Code;
                ret = poDAL.UpdateCurrentData(userID, obj.zTrans);
                if (!ret) throw new ApplicationException(poDAL.ErrorMessage);

                ret = DALObj.CutStock(stockOut, 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;
        }
示例#12
0
        public bool CommitData(string userID, RequisitionData 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.LOID, obj.zTrans);
                    if (DALObj.STATUS == Constz.Requisition.Status.Waiting.Code)
                    {
                        data.STATUS = Constz.Requisition.Status.Approved.Code;
                        UpdateData(userID, data, obj.zTrans);
                        _LOID = DALObj.LOID;

                        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;
        }
示例#13
0
        public bool UpdateData(string userID, RequisitionData 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.LOID, obj.zTrans);
                    UpdateData(userID, data, obj.zTrans);
                    _LOID = DALObj.LOID;

                    obj.zTrans.Commit();
                    obj.CloseConnection();
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    _error = ex.Message;
                }
            }
            else
                ret = false;
            return ret;
        }
示例#14
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;
        }
示例#15
0
 public bool UpdateRequisition(string userID, RequisitionData data)
 {
     bool ret = true;
     V_SUPPORT_LIST_DAL v_spport_listt_dal = new V_SUPPORT_LIST_DAL();
     ret = v_spport_listt_dal.UpdateRequsitionData(userID.ToString(), data);
     if (ret != true)
     {
         _error = v_spport_listt_dal.ErrorMessage;
         return ret;
     }
     else
     {
         RequisitionDAL rDAL = new RequisitionDAL();
         bool rr = rDAL.CutStockRequisition(data.LOID, userID, null);
         return ret;
     }
 }
示例#16
0
        public double InsertRequisition(string UserId, RequisitionData data)
        {
            Boolean ret = true;
            RequisitionDAL oDAL = new RequisitionDAL();
            oDAL.REQDATE = Convert.ToDateTime(data.REQDATE);
            oDAL.REQUISITIONTYPE = Convert.ToDouble(data.REQUISITIONTYPE);
            oDAL.STATUS = data.STATUS.ToString();
            oDAL.WAREHOUSE = Convert.ToDouble(data.WAREHOUSE);
            oDAL.RESERVEDATE = Convert.ToDateTime(data.RESERVEDATE);
            oDAL.ACTIVE = data.ACTIVE.ToString();

            ret = oDAL.InsertCurrentData(UserId, null);

            if (ret == false)
            {
                _error = oDAL.ErrorMessage;
                return 0;
            }
            else
                return oDAL.LOID;
        }