Пример #1
0
        void CreateNegativeNewRow(DataRow dr,int qty,bool showstock)
        {
            var dt = new DsInventory().STOCKMASTER;
            var dStockmasterRow = (DsInventory.STOCKMASTERRow) dt.NewRow();
            dStockmasterRow.ITEMNO = dr["ITEMNO"].ToString();
            dStockmasterRow.BARCODE = dr["BARCODE"].ToString();
            dStockmasterRow.SPRICE =decimal.Parse(dr["SPRICE"].ToString());
            dStockmasterRow.CPRICE = decimal.Parse(dr["CPRICE"].ToString());
            dStockmasterRow.DQNTY = qty;
            new BusinessLogic.BLSales().AddNewItemwithNegativeQty(dStockmasterRow);
            var dnewstock = new BusinessLogic.BLSales().GetStockItem(dStockmasterRow.ITEMNO, "S");
            foreach (DataRow drs  in dnewstock.Rows)
            {
                drs["DQNTY"] = qty;
            }
            AddMultipleItems(dnewstock,dr["ITEMNAME"].ToString(),true);
            onePing();

        }
Пример #2
0
 void ChangeCurrentRowSpriceAndUpdatetheExtingQty(DataRow dr)
 {
     var ds = new DsInventory().STOCKMASTER;
     var drnew = ds.NewRow();
     drnew.ItemArray = dr.ItemArray;
     drnew["DQNTY"] = 1;
     ds.Rows.Add(drnew);
     int cv = gridView1.FocusedRowHandle;
     if (cv < 0)
     {
         cv = _rowhandle;
         gridView1.FocusedRowHandle = cv;
     }
     var sname = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, colITEMNAME).ToString();
     DoDeleteRow(gridView1.GetDataRow(gridView1.FocusedRowHandle));
     AddMultipleItems(ds, sname);
     UpdateTotal();
 }
Пример #3
0
 public void AddItemsToItemMoveDetails(DataTable dt, ref DsInventory.ITEMTRANSFERDETAILDataTable dtitems,string itemno,int reqqty,string tostore)
 {
     int newqty = reqqty;
     bool _add = false;
     foreach (DataRow adr in dt.Rows)
     {
         if (int.Parse(adr["QTY"].ToString()) < newqty && newqty  > 0 )
         {
            newqty = reqqty - int.Parse(adr["QTY"].ToString());
            reqqty = int.Parse(adr["QTY"].ToString());
             _add = true;
         }
         else if (newqty > 0)
         {
             reqqty = newqty;
             newqty -= reqqty;
             _add = true;
         }
         if (_add)
         {
             if (newqty == 0)
                 _add = false;
             var dr = dtitems.NewRow();
             dr["TRANID"] = 0;
             dr["ITEMNO"] = adr["itemno"];
             dr["BARCODE"] = adr["BARCODE"];
             dr["WHID"] = adr["WHID"];
             dr["STOCK"] = adr["QTY"];
             dr["QTY"] = reqqty;
             dr["CPRICE"] = adr["CPRICE"];
             dr["SPRICE"] = adr["SPRICE"];
             dr["EXPDATE"] = adr["EXPDATE"];
             dr["STOCKID"] = adr["STOCKID"];
             dr["LINETOTAL"] = decimal.Parse(adr["SPRICE"].ToString())*reqqty;
             dr["TOSTORE"] = tostore;
             dtitems.Rows.Add(dr);
         }
     }
     }
Пример #4
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;
        }
Пример #5
0
 public DsInventory.STOCKMASTERDataTable GetQtyRows(DsInventory.STOCKMASTERDataTable drstock,int reqqty)
 {
     var dt = new DsInventory().STOCKMASTER;
     int balqty = reqqty;
     foreach (DsInventory.STOCKMASTERRow dr in drstock.Rows)
     {
         if (dr.SQTY != 0)
         {
             var drnew = (DsInventory.STOCKMASTERRow) dt.NewRow();
             if (dr.SQTY - reqqty >= 0)
             {
                 drnew.ItemArray = dr.ItemArray;
                 drnew.DQNTY = reqqty;
                 balqty -= reqqty;
             }
             else if (dr.SQTY - reqqty < 0)
             {
                 drnew.ItemArray = dr.ItemArray;
                 balqty -= dr.SQTY;
                 drnew.DQNTY = dr.SQTY; // balqty;
             }
             dt.Rows.Add(drnew);
             if (balqty == 0)
                 break;
         }
     }
     return dt;
 }