예제 #1
0
 public int GetOpeningQty(string itemno)
 {
     var ta = new DsInventoryTableAdapters.YearEndInventoryTableAdapter { Connection = { ConnectionString = _constr } };
     return ta.GetOpeningQty(itemno) ?? 0;
 }
예제 #2
0
        public string DoUpdateInventory(DsInventory.YearEndInventoryDataTable dtyearend,string storetype,string whid)
        {
            SqlTransaction tran = null;
            string retval = string.Empty;
            try
            {
                var cn = new SqlConnection(_constr);
                cn.Open();
                tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted);
                var ta = new DsInventoryTableAdapters.YearEndInventoryTableAdapter();

                var dt = new DsInventory().STOCKMASTER;
                ta.AssignConnection(cn,tran);
                foreach (DsInventory.YearEndInventoryRow dr in dtyearend.Rows)
                {
                    if (dr.NOMASTER == false)
                    {
                        if (dr.PHYSICALSTOCK > 0 && !dr.TRANSFERED)
                        {
                            var drnew = (DsInventory.STOCKMASTERRow) dt.NewRow();
                            drnew.ITEMNO = dr.ITEMNO;
                            drnew.BARCODE = dr.BARCODE;
                           
                            drnew.SPRICE = dr.SPRICE;
                            drnew.CPRICE = dr.CPRICE;
                            if (!dr.IsEXPDATENull())
                                drnew.EXPDATE = dr.EXPDATE;
                            drnew.DQNTY = 0;
                            drnew.QTY = dr.PHYSICALSTOCK;
                            drnew.SQTY = dr.PHYSICALSTOCK;
                            drnew.STORETYPE = storetype;
                            drnew.WHID = Utils.SalesStoreCode;
                            drnew.COMPANY = Utils.Company;
                            drnew.DISC = 0;
                            if (!dr.NOMASTER)
                                 dr.TRANSFERED = true;
                            dt.Rows.Add(drnew);
                        }
                    }
                }
                new StockMaster().CreateStock(ref cn, ref tran, dt, whid, storetype, false, false);
             //   "SELECT DCODE,BARCD,SUM(BQNTY) AS QTY,MAX(SPRICE) as SPRICE,MIN(EXPIRY) as EXPIRY FROM STOCK  WHERE  BQNTY  > 0 GROUP BY DCODE,SPRICE,EXPIRY,BARCD ",
                ta.Update(dtyearend);
                tran.Commit();
                retval = "1";
            }
            catch (Exception ex)
            {
                if (tran != null)
                    tran.Rollback();
                retval = ex.ToString();
            }
            return retval;
        }
예제 #3
0
 public decimal GetCountNonTrasfered()
 {
     var ta = new DsInventoryTableAdapters.YearEndInventoryTableAdapter { Connection = { ConnectionString = _constr } };
     return ta.GetNonTrasfered() ?? 0;
 }
예제 #4
0
 public string SaveDataToInventoryYear(DsInventory.YearEndInventoryDataTable dt)
 {
     string retval = string.Empty;
     try
     {
         var ta = new DsInventoryTableAdapters.YearEndInventoryTableAdapter
                      {Connection = {ConnectionString = _constr}};
         ta.Update(dt);
     }
     catch(Exception ex)
     {
         retval = ex.ToString();
     }
     return retval;
 }
예제 #5
0
 public DsInventory.YearEndInventoryDataTable  LoadYearEndInventory(int year)
 {
    var ta = new DsInventoryTableAdapters.YearEndInventoryTableAdapter { Connection = { ConnectionString = _constr } };
    return ta.GetDataByNonTrasferInventory(year, Utils.Company);
 }