private void GetDataFromUSB(List<String> files) { var ds = new DsInventory(); foreach (string strDrive in files) { var s = strDrive.Split('-'); if (s[0].IndexOf(VIRETAILDAL.COMMON.Utils.Company, StringComparison.Ordinal) == -1) { try { ds.ReadXml(strDrive); if (_ds.ITEMTRANSFERMAIN.Rows.Count == 0 && _ds.GetItemsForRemoteUpdate.Rows.Count == 0 && _ds.SUPPLIER.Rows.Count == 0) { var dr = _dsdownload.NewRow(); dr[0] = strDrive; dr[1] = DateTime.Now.Date; dr[3] = "Nothing to download"; _dsdownload.Rows.Add(dr); } else { _ds.Merge(ds); } } catch (Exception ex) { XtraMessageBox.Show(ex.ToString(), "POS", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
public int GetAutoId(int srcid) { var ta = new AUTONOSTableAdapter {Connection = {ConnectionString = _constr}}; var ds = new DsInventory(); ta.FillBy(ds.AUTONOS, srcid); return int.Parse(ds.AUTONOS[0][1].ToString()); }
public DsInventory.STOCKMASTERDataTable GetStockMaster() { var ta = new STOCKMASTERTableAdapter {Connection = {ConnectionString = _constr}}; var stkds = new DsInventory(); ta.Fill(stkds.STOCKMASTER); return stkds.STOCKMASTER; }
public DsInventory.ITEMMAST1DataTable GetItemMastList() { var ta = new ITEMMAST1TableAdapter {Connection = {ConnectionString = _constr}}; var catds = new DsInventory(); ta.Fill(catds.ITEMMAST1); return catds.ITEMMAST1; }
public void GetNotes(string supid,int sourceid) { var ta = new NOTESMASTTableAdapter {Connection = {ConnectionString = _constr}}; var ds = new DsInventory().NOTESMAST; ta.FillByID(ds, supid, sourceid); foreach (DsInventory.NOTESMASTRow d in ds.Rows) { DNotesmastRow = d; } }
public bool SaveNotes(DsInventory.NOTESMASTDataTable notesmastDataTable) { bool saved = false; if (!notesmastDataTable.HasErrors) { var manager = new TableAdapterManager { Connection = {ConnectionString = _constr}, NOTESMASTTableAdapter = new NOTESMASTTableAdapter(), BackupDataSetBeforeUpdate = true }; saved = manager.NOTESMASTTableAdapter.Update(notesmastDataTable) > 0; } return saved; }
void DoCreateOpeningStockMast(string sql, OleDbConnection con) { progressPanel1.Visible = true; try { var ds = new DataSet(); var ta = new OleDbDataAdapter(sql, con); ta.Fill(ds); var dsM = new DsInventory(); foreach (DataRow dr in ds.Tables[0].Rows) { Application.DoEvents(); var row = (DsInventory.STOCKOPENINGRow)dsM.STOCKOPENING.NewRow(); row.ITEMNO = dr["DCODE"].ToString(); row.BARCODE = dr["BARCD"].ToString(); row["TYEAR"] = DateTime.Now.Year; row["TDATE"] = DateTime.Now.ToString("yyyy-MM-dd"); row.BEGQTY = int.Parse(dr["QTY"].ToString()); if (!string.IsNullOrEmpty(dr["EXPIRY"].ToString())) row.MINEXPDATE = DateTime.Parse(dr["EXPIRY"].ToString()); if (!string.IsNullOrEmpty(dr["SPRICE"].ToString())) row.MAXSPRICE = decimal.Parse(dr["SPRICE"].ToString()); row["COMPANY"] = Utils.Company; row["TDATETIME"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); dsM.STOCKOPENING.Rows.Add(row); } var ret = new StockMaster().UpdateOpeningStock(dsM.STOCKOPENING); if (ret == "1") { return; } if (ret != "1") { XtraMessageBox.Show(ret, "POS", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } catch (Exception ex) { XtraMessageBox.Show(ex.ToString(), "POS", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
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(); }
void AddMultipleItems(DsInventory.STOCKMASTERDataTable ds, string itemname, bool isblankrow = false) { _validateoff = true; var dt = dsInventory1.SALESINVDETAIL; foreach (DsInventory.STOCKMASTERRow d in ds.Rows) { var newrow = (DsInventory.SALESINVDETAILRow) dt.NewRow(); if (!d.IsDQNTYNull()) if (d.DQNTY > 0) { var tot = Math.Round((d.DQNTY * d.SPRICE), 2); newrow.ITEMNAME = itemname; newrow.STOCKID = d.STOCKID; newrow.ITEMNO= d.ITEMNO; newrow.SINVNO = txtinvoiceno.Text; newrow.BARCODE = d.BARCODE; var aQty = new BLSales().GetAvailableQty(d["ITEMNO"].ToString()); newrow.STOCK = aQty; newrow.ASTOCK = d.SQTY; newrow.INVRATE= d.SPRICE; newrow.SPRICE= d.SPRICE; newrow.CPRICE= d.CPRICE; newrow.ISRETURN= _isreturn; if (!_isreturn) newrow.DISCONSALE = _DISCONSALE; if (!d.IsEXPDATENull()) { newrow.EXPDATE = d.EXPDATE; newrow.EXPDATE1= d.EXPDATE.ToString("MM-yy"); } else { newrow["EXPDATE"] = DBNull.Value ; newrow.EXPDATE1 = string.Empty; } newrow.BONUS= 0; newrow.LINETOTAL = tot; if(!d.IsDISCNull()) { if(d.DISC > 0) { newrow.LINETOTAL = tot - (tot * d.DISC) / 100; } } newrow.DOCTORID = _doctorid; newrow.EXTDISC = 0; if (_isreturn) newrow.QTY = -d.DQNTY; else { newrow.QTY = d.DQNTY; } dt.Rows.Add(newrow); } if (!isblankrow) { if (!_isreturn) new BLSales().UpdateQty(d.STOCKID, -d.DQNTY); else if (_isreturn) { if(d.STOCKID > 0) { new BLSales().UpdateQty(d.STOCKID, d.DQNTY); } } } var bl = new BLSales().UpdateDetails(dsInventory1.SALESINVDETAIL); } sALESINVDETAILBindingSource.EndEdit(); if (_isreturn) { gridControl1.Focus(); gridView1.FocusedColumn = colINVRATE; colDISC.OptionsColumn.ReadOnly = false; colDISC.OptionsColumn.AllowEdit = true; gridView1.ShowEditor(); } else { colDISC.OptionsColumn.AllowEdit = false; } _validateoff = false; }
public string UpdateQtyAndSalesTable(int stockid,int qty,DsInventory.SALESINVDETAILDataTable salesinvdetail) { string retval = "0"; SqlTransaction tran = null; try { var cn = new SqlConnection(_constr); cn.Open(); tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted); var ds = new DsInventory(); var tasalDetail = new DsInventoryTableAdapters.SALESINVDETAILTableAdapter(); var tastock = new DsInventoryTableAdapters.STOCKMASTERTableAdapter(); tasalDetail.AssignConnection(cn, tran); tastock.AssignConnection(cn, tran); tastock.UpdateSaleQtyByStockid(qty, stockid); tasalDetail.Update(salesinvdetail); tran.Commit(); retval = "1"; } catch (Exception ex) { retval = ex.ToString(); tran.Rollback(); } return retval; }
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(); }
public string DoSave(DsInventory.ADJMASTRow drow, DsInventory.ADJDETAILDataTable adjdetailDataTable) { var dm = new DataManager(); string retval; SqlTransaction tran = null; var isnew = false; try { var cn = new SqlConnection(_constr); cn.Open(); tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted); var ds = new DsInventory(); var dt = ds.ADJMAST; var taAdjMast = new ADJMASTTableAdapter(); var taAdjDetail = new ADJDETAILTableAdapter(); var taStockMaster = new STOCKMASTERTableAdapter(); taStockMaster.Connection.ConnectionString = _constr; taAdjMast.Connection.ConnectionString = _constr; taStockMaster.Fill(ds.STOCKMASTER); taAdjMast.Fill(ds.ADJMAST); // Assaign Transaction taAdjMast.AssignConnection(cn, tran); taAdjDetail.AssignConnection(cn, tran); taStockMaster.AssignConnection(cn, tran); var dr = dt.FindByADJID(drow.ADJID); if (dr != null) { dr.BeginEdit(); } else { dr = (DsInventory.ADJMASTRow )dt.NewRow(); } if (string.IsNullOrEmpty(drow.ADJID)) { var autoid = dm.GetAutoId(10); autoid++; Utils.Adjid = dm.CreateFormatedAutoNo(autoid); dr.ADJID = Utils.Adjid; dr.USERID = Utils.Userid; dr.COMPANY = Utils.Company; isnew = true; } else { Utils.Adjid = drow.ADJID; } dr.STORECODE = drow.STORECODE; dr.TRANDATE = drow.TRANDATE; dr.REASON = drow.REASON; if (isnew) { dt.Rows.Add(dr); taAdjMast.Update(dt); } else { dr.EndEdit(); taAdjMast.Update(dr); } foreach (DataRow purd in adjdetailDataTable.Rows) { if ((purd.RowState != DataRowState.Deleted)) purd["ADJID"] = Utils.Adjid; } taAdjDetail.Update(adjdetailDataTable); Masters.StockMaster.UpdateInventoryItem(ref ds, adjdetailDataTable); taStockMaster.Update(ds.STOCKMASTER); tran.Commit(); dm.UpdateAutoNum(10); retval = "1"; } catch (Exception ex) { if (tran != null) tran.Rollback(); if (isnew) Utils.Adjid = string.Empty; retval = ex.ToString(); } return retval; }
bool DoCreateStockMast(string sql, OleDbConnection con) { progressPanel1.Visible = true; try { var ds = new DataSet(); var ta = new OleDbDataAdapter(sql, con); ta.Fill(ds); var dsM = new DsInventory(); var whid = new Functions().GetSalesStore(); //dsMaster.Merge(new VIRETAILDAL.Masters.StockMaster().UpdateStockDataSet(); int cnt = 0; foreach (DataRow dr in ds.Tables[0].Rows) { cnt++; Application.DoEvents(); var row = (DsInventory.STOCKMASTERRow) dsM.STOCKMASTER.NewRow(); row.ITEMNO= dr["DCODE"].ToString(); row.BARCODE= dr["BARCD"].ToString(); row.QTY = int.Parse(dr["QTY"].ToString()); if (!string.IsNullOrEmpty(dr["EXPIRY"].ToString())) row.EXPDATE = DateTime.Parse(dr["EXPIRY"].ToString()); if (!string.IsNullOrEmpty(dr["SPRICE"].ToString())) row.SPRICE = decimal.Parse(dr["SPRICE"].ToString()); row.CPRICE= Math.Round(decimal.Parse(dr["CPRICE"].ToString()),2); row["STORETYPE"] = "S"; row.SQTY = int.Parse(dr["QTY"].ToString()); row["WHID"] = whid; row["COMPANY"] = Utils.Company; dsM.STOCKMASTER.Rows.Add(row); label1.Text = cnt.ToString(); } label1.Text = cnt.ToString(); var ret = new StockMaster().UpdateStockDataSet(dsM.STOCKMASTER); if (ret == "1") { return true; } if (ret != "1") { XtraMessageBox.Show(ret, "POS", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } } catch(Exception ex) { XtraMessageBox.Show(ex.ToString(),"POS",MessageBoxButtons.OK,MessageBoxIcon.Error); } return true; }
public DsInventory.SALESMAINDataTable GetSalesInvMainBySinvno(string sinvno) { var ta = new DsInventoryTableAdapters.SALESMAINTableAdapter {Connection = {ConnectionString = _constr}}; var ds = new DsInventory().SALESMAIN; ta.FillBySINVNO(ds,sinvno); return ds; }
public DsInventory.ADJMASTDataTable GetAdjMastById(string adjid) { var ta = new ADJMASTTableAdapter(); ta.Connection.ConnectionString = _constr; var ds = new DsInventory().ADJMAST; ta.FillBy(ds, adjid, Utils.Company); return ds; }
public void GetNonSaleInv() { var tasalMain = new DsInventoryTableAdapters.SALESMAINTableAdapter {Connection = {ConnectionString = _constr}}; var tasaldetail = new DsInventoryTableAdapters.SALESINVDETAILTableAdapter {Connection = {ConnectionString = _constr}}; var ds = new DsInventory(); tasalMain.FillByNonPost(ds.SALESMAIN, Environment.MachineName); if (ds.SALESMAIN.Rows.Count > 0) { salesmainRow = ds.SALESMAIN[0]; var sinvno = salesmainRow[0].ToString(); try { tasaldetail.FillBySINVNO(ds.SALESINVDETAIL, sinvno); salesinvdetailData = ds.SALESINVDETAIL; } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); } } }
public DsInventory.SALESMAINDataTable GetHoldedInvoices(string compname) { var ta = new DsInventoryTableAdapters.SALESMAINTableAdapter {Connection = {ConnectionString = _constr}}; var ds = new DsInventory(); ta.FillByHold(ds.SALESMAIN, compname); return ds.SALESMAIN; }
public string DoSalesItemDelete(DsInventory.SALESINVDETAILRow dr) { SqlTransaction tran = null; var retval = "0"; try { var cn = new SqlConnection(_constr); cn.Open(); tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted); var dt = new DsInventory.SALESINVDETAIL_DELDataTable(); var tastock = new DsInventoryTableAdapters.STOCKMASTERTableAdapter(); var tasalede = new DsInventoryTableAdapters.SALESINVDETAIL_DELTableAdapter(); // var tasales = new DsInventoryTableAdapters.SALESINVDETAILTableAdapter(); tastock.AssignConnection(cn, tran); tasalede.AssignConnection(cn, tran); // tasales.AssignConnection(cn,tran); var dr1 = (DsInventory.SALESINVDETAIL_DELRow)dt.NewRow(); dr1.SINVNO = dr.SINVNO; dr1.ITEMNO = dr.ITEMNO; dr1.BARCODE = dr.BARCODE; dr1.QTY = dr.QTY; dr1.INVRATE = dr.INVRATE; dr1.SPRICE = dr.SPRICE; dr1.CPRICE = dr.CPRICE; if (!dr.IsEXPDATENull()) dr1.EXPDATE = dr.EXPDATE; dr1.STOCKID = dr.STOCKID; dr1.STOCK = dr.STOCK; dr1.DOCTORID = dr.DOCTORID; dr1.ITEMNAME = dr.ITEMNAME; dr1.COMPANY = Utils.Company; dr1.TRANDATE = DateTime.Now; dr1.USERID = Utils.Userid; dr1.ISRETURN = dr.ISRETURN; dt.Rows.Add(dr1); //tasalede.Insert(dr.SINVNO, dr.ITEMNO, dr.BARCODE, dr.QTY, dr.INVRATE, dr.SPRICE, dr.CPRICE, dr.EXPDATE, // dr.STOCKID, dr.STOCK, dr.DOCTORID, dr.ITEMNAME, Utils.Company, DateTime.Now, Utils.Userid,dr.ISRETURN); tasalede.Update(dr1); if (dr.STOCKID > 0) { if(dr.ISRETURN) tastock.UpdateSaleQtyByStockid((-1* dr.QTY), dr.STOCKID); else tastock.UpdateSaleQtyByStockid(dr.QTY, dr.STOCKID); } // tasales.Update(salesinvdetail); tran.Commit(); retval = "1"; } catch (Exception ex) { retval = ex.ToString(); tran.Rollback(); } return retval; }
public void DoSalesItemDelete(DsInventory.SALESINVDETAILRow dRow, ref SqlConnection cn, ref SqlTransaction tran) { // tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted); var dt = new DsInventory.SALESINVDETAIL_DELDataTable(); var tastock = new DsInventoryTableAdapters.STOCKMASTERTableAdapter(); var tasalede = new DsInventoryTableAdapters.SALESINVDETAIL_DELTableAdapter(); tastock.AssignConnection(cn, tran); tasalede.AssignConnection(cn, tran); var dr = (DsInventory.SALESINVDETAIL_DELRow) dt.NewRow(); dr.SINVNO = dRow.SINVNO; dr.ITEMNO = dRow.ITEMNO; dr.BARCODE = dRow.BARCODE; dr.QTY = dRow.QTY; dr.INVRATE = dRow.INVRATE; dr.SPRICE = dRow.SPRICE; dr.CPRICE = dRow.CPRICE; if(!dRow.IsEXPDATENull()) dr.EXPDATE = dRow.EXPDATE; dr.STOCKID = dRow.STOCKID; dr.STOCK = dRow.STOCK; dr.DOCTORID = dRow.DOCTORID; dr.ITEMNAME = dRow.ITEMNAME; dr.COMPANY = Utils.Company; dr.TRANDATE = DateTime.Now; dr.USERID = Utils.Userid; tasalede.Update(dr); if (dr.STOCKID > 0) { if (dr.ISRETURN) tastock.UpdateSaleQtyByStockid(-dr.QTY, dr.STOCKID); else tastock.UpdateSaleQtyByStockid(dr.QTY, dr.STOCKID); } //if (dRow.STOCKID > 0) //{ // // tastock.UpdateQtyByStockID(dRow.QTY, dRow.STOCKID); // tastock.UpdateSaleQtyByStockid(dRow.QTY, dRow.STOCKID); //} }
void AddNewItemItemInStock(ref SqlConnection cn, ref SqlTransaction tran, DataRow dr, DsInventory.STOCKMASTERDataTable ds) { new Masters.StockMaster().AddNewItemItemInStock(ref cn,ref tran, dr,ds); }
StockShow LoadQtyMoreForm(string itemno,string itemname,int stock,int qtyorder, int qtybalance,int enteredqty,decimal sprice,bool showsprice,bool isblankrow,DsInventory.STOCKMASTERRow dr,decimal purdiscout) { var f = new StockShow { itemno = itemno, itemname = itemname, qtyonhand = stock, qtyonorder = qtyorder, qtybalance = qtybalance, enterqty = enteredqty, salesprice = sprice, showsalesprice = showsprice, isBlankStock = isblankrow, cdisc = purdiscout, DStockmasterRow =dr }; f.ShowDialog(); return f; }
public string DoSave() { SqlTransaction tran = null; var retval = "0"; try { var dsStockWithItemcodes = GetStockTableWithItemCodes(salesinvdetailData); var cn = new SqlConnection(_constr); cn.Open(); tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted); var ds = new DsInventory(); var dt = ds.SALESMAIN; var tasalMain = new DsInventoryTableAdapters.SALESMAINTableAdapter(); var tasalDetail = new DsInventoryTableAdapters.SALESINVDETAILTableAdapter(); var tasalesamtdetails = new LedgersTableAdapters.SalesAmountDetailsTableAdapter(); tasalesamtdetails.AssignConnection(cn, tran); tasalMain.Connection.ConnectionString = _constr; // tasalMain.Fill(dt); tasalMain.FillBySINVNO(dt,salesmainRow.SINVNO); tasalMain.AssignConnection(cn, tran); tasalDetail.AssignConnection(cn, tran); var dr = dt.FindBySINVNO(salesmainRow.SINVNO); bool isnew = false; if (dr != null) { dr.BeginEdit(); dr.EndEdit(); } else { dr = (DsInventory.SALESMAINRow) dt.NewRow(); dr.ItemArray = salesmainRow.ItemArray; isnew = true; } if (isnew) { dt.Rows.Add(dr); tasalMain.Update(dt); } else { tasalMain.Update(salesmainRow); } //salesmainRow.SALESTYPE if (salesmainRow.SALESTYPE == "I" || salesmainRow.SALESTYPE == "C") { var taaparleder = new LedgersTableAdapters.APARMAINTableAdapter(); var taledger = new LedgersTableAdapters.LEDGERSTableAdapter(); taledger.AssignConnection(cn, tran); taaparleder.AssignConnection(cn, tran); var netamt = 0m; var totaldiscper = 0m; if (salesmainRow.SALESTYPE == "I") { totaldiscper = salesmainRow.CUSTOMERFIXDISC ; netamt = salesmainRow.CREDITAMT; } else { netamt = salesmainRow.CREDITAMT; totaldiscper = salesmainRow.CUSTOMERFIXDISC ; } if (netamt > 0) { string cdno = ""; if (!salesmainRow.IsCARDNONull()) cdno = salesmainRow.CARDNO.ToString(); taaparleder.Insert("C", salesmainRow.CUSTOMERID, salesmainRow.TRANDATE, salesmainRow.TRANDATE, cdno, salesmainRow.SINVNO, netamt, 0, netamt, salesmainRow.COMPANY, 3, salesmainRow.SALESMAN, totaldiscper); taledger.Insert("C", salesmainRow.CUSTOMERID, salesmainRow.TRANDATE, salesmainRow.TRANDATE, cdno, salesmainRow.SINVNO, netamt, 0, 3, salesmainRow.COMPANY, Utils.Userid, "Sales Invoice"); } } foreach (DsInventory.SALESINVDETAILRow drstk in salesinvdetailData.Rows) { if(!drstk.IsSTOCKIDNull()) { if(drstk.STOCKID > 0) { if (drstk.ISRETURN) { UpdateStockQty(ref cn, ref tran, drstk.STOCKID, (drstk.QTY * -1), drstk); } else { UpdateStockQty(ref cn, ref tran, drstk.STOCKID, -drstk.QTY, drstk); } } else { if (drstk.ISRETURN) { AddNewItemItemInStock(ref cn, ref tran, drstk, dsStockWithItemcodes); } } } } tasalDetail.Update(salesinvdetailData); tasalesamtdetails.Update(SalesAmount); tran.Commit(); retval = "1"; } catch (Exception ex) { retval = ex.ToString(); tran.Rollback(); } return retval; }
public string DoSave(DsPurchase.RETURNMASTRow drow, DsPurchase.RETURNDETAILDataTable returndetail) { var dm = new DataManager(); string retval; SqlTransaction tran = null; var isnew = false; try { var cn = new SqlConnection(_constr); cn.Open(); tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted); var ds = new DsPurchase(); var dsStock = new DsInventory(); var dt = ds.RETURNMAST; var taPurMain = new RETURNMASTTableAdapter {Connection = {ConnectionString = _constr}}; var taPurDetail = new RETURNDETAILTableAdapter(); var taStockMaster = new STOCKMASTERTableAdapter {Connection = {ConnectionString = _constr}}; var taapar = new LedgersTableAdapters.APARMAINTableAdapter(); var taledger = new LedgersTableAdapters.LEDGERSTableAdapter(); taStockMaster.Fill(dsStock.STOCKMASTER); taPurMain.Fill(ds.RETURNMAST); // Assaign Transaction taPurMain.AssignConnection(cn, tran); taPurDetail.AssignConnection(cn, tran); taStockMaster.AssignConnection(cn, tran); taapar.AssignConnection(cn, tran); taledger.AssignConnection(cn, tran); var dr = dt.FindByRETURNID(drow.RETURNID); if (dr != null) { dr.BeginEdit(); } else { dr = (DsPurchase.RETURNMASTRow)dt.NewRow(); } if (string.IsNullOrEmpty(drow.RETURNID)) { var autoid = dm.GetAutoId(2); autoid++; Utils.Retinvid = dm.CreateFormatedAutoNo(autoid); dr.RETURNID = Utils.Retinvid; dr.USERID = Utils.Userid; dr.COMPANY = Utils.Company; dr.TRANDATE = System.DateTime.Now; isnew = true; } else { Utils.Retinvid = drow.RETURNID; dr.EDATE = DateTime.Now; dr.EUSERID = Utils.Userid; } dr.SUPID = drow.SUPID; dr.SUPNAME = drow.SUPNAME; dr.INVDATE = drow.INVDATE; dr.INVNO = drow.INVNO; dr.SPDISCOUNT = drow.SPDISCOUNT; dr.WHID = drow.WHID; dr.ADJVALUE = drow.ADJVALUE; dr.NETVALUE = drow.NETVALUE; dr.HOLD = drow.HOLD; if (isnew) { dt.Rows.Add(dr); taPurMain.Update(dt); } else { dr.EndEdit(); taPurMain.Update(dr); } foreach (DataRow purd in returndetail.Rows) { if ((purd.RowState != DataRowState.Deleted)) purd["RETURNID"] = Utils.Retinvid; } taPurDetail.Update(returndetail); //STOCK if (!dr.HOLD) { // Masters.StockMaster.UpdateQtyInStockDataSet(ref dsStock, returndetail, true); // taStockMaster.Update(dsStock.STOCKMASTER); Masters.StockMaster.UpdateQtyInStockDataSet(ref cn,ref tran, returndetail, true); //LEDGER taapar.Insert("S", dr.SUPID, DateTime.Now.Date, dr.INVDATE, Utils.Retinvid, dr.INVNO, -dr.NETVALUE, 0, -dr.NETVALUE, Utils.Company, 2, Utils.Userid, 0); taledger.Insert("S", dr.SUPID, DateTime.Now.Date, dr.INVDATE, Utils.Retinvid, dr.INVNO, dr.NETVALUE,0, 2, Utils.Company, Utils.Userid, "Purchase Retun"); } dm.UpdateAutoNum(2); tran.Commit(); retval = "1"; } catch (Exception ex) { if (tran != null) tran.Rollback(); if (isnew) Utils.Retinvid = string.Empty; retval = ex.ToString(); } return retval; }
public DsInventory.STOCKMASTERDataTable GetStockTableWithItemCodes(DsInventory.SALESINVDETAILDataTable salesinvdetail) { var dsItemCodes = new DsInventory().STOCKMASTER; var ta = new DsInventoryTableAdapters.STOCKMASTERTableAdapter { Connection = { ConnectionString = _constr } }; string itemcodes = string.Empty; foreach (DsInventory.SALESINVDETAILRow drts in salesinvdetail.Rows) { if (drts.ISRETURN) { itemcodes += drts.ITEMNO + ","; } } ta.FillByItemcodes(dsItemCodes, itemcodes); return dsItemCodes; }
public DsInventory.ADJDETAILDataTable GetAdjDetailById(string adjid) { var ta = new ADJDETAILTableAdapter {Connection = {ConnectionString = _constr}}; var ds = new DsInventory().ADJDETAIL; ta.FillBy(ds, adjid); return ds; }
public string UpDateRemoteTransferMain(DsInventory.ITEMTRANSFERMAINDataTable dt) { string retval = "0"; try { foreach (DataRow dr in dt.Rows) { var taPurMain = new ITEMTRANSFERMAINTableAdapter(); taPurMain.Connection.ConnectionString = _syncConstr; taPurMain.UpdateSync(dr["TRANID"].ToString()); } retval = "1"; } catch (Exception ex) { retval = ex.ToString(); } return retval; }
public DsInventory.ADJMASTDataTable GetInventoryList() { var ta = new ADJMASTTableAdapter {Connection = {ConnectionString = _constr}}; var ds = new DsInventory().ADJMAST; ta.Fill(ds); return ds; }
public string DoSaveItemTranferInRemote(DsInventory.ITEMTRANSFERMAINRow drow,DsInventory.ITEMTRANSFERDETAILDataTable itemtransferdetail) { var dm = new DataManager(); string retval=string.Empty; SqlTransaction tran = null; try { var cn = new SqlConnection(_syncConstr); cn.Open(); tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted); var ds = new DsInventory(); var dtdetail = ds.ITEMTRANSFERDETAIL; var dt = ds.ITEMTRANSFERMAIN; var taPurMain = new ITEMTRANSFERMAINTableAdapter(); var taPurDetail = new ITEMTRANSFERDETAILTableAdapter(); taPurMain.Connection.ConnectionString = _syncConstr; // taPurMain.Fill(ds.ITEMTRANSFERMAIN); taPurMain.FillByTranid(dt, drow.TRANID); // Assaign Transaction taPurMain.AssignConnection(cn, tran); taPurDetail.AssignConnection(cn, tran); var dr = dt.FindByTRANID(drow.TRANID); if (dr == null) { dr = (DsInventory.ITEMTRANSFERMAINRow) dt.NewRow(); dr.TRANID = drow.TRANID; dr.COMPANY = drow.COMPANY; if (!drow.IsEDATENull()) dr.EDATE = drow.EDATE; if (!drow.IsEUSERIDNull()) dr.EUSERID = drow.EUSERID; dr.FRMSTOREID = drow.FRMSTOREID; dr.TOSTOREID = drow.TOSTOREID; dr.TRANDATE = drow.TRANDATE; dr.TOTVALUE = drow.TOTVALUE; dr.TOTITEMS = drow.TOTITEMS; dr.HOLD = drow.HOLD; dr.FRMNAME = drow.FRMNAME; dr.TONAME = drow.TONAME; dr.TTYPE = drow.TTYPE; dr.TOCOMP = drow.TOCOMP; dr.USERID = drow.USERID; dr.DOWNFILENO = drow.DOWNFILENO; dt.Rows.Add(dr); taPurMain.Update(dt); foreach (DsInventory.ITEMTRANSFERDETAILRow ditemdetarow in itemtransferdetail) { var newdetrow = dtdetail.NewRow(); foreach (DataColumn dc in itemtransferdetail.Columns) { if (!dc.ReadOnly) { newdetrow[dc.ColumnName] = ditemdetarow[dc.ColumnName]; } } dtdetail.Rows.Add(newdetrow); } taPurDetail.Update(dtdetail); tran.Commit(); retval = "1"; } else { retval = "1"; } } catch (Exception ex) { if (tran != null) tran.Rollback(); retval = ex.ToString(); } return retval; }
public DsInventory.SALESINVDETAIL_DELDataTable GetSalesDeletedItems(DateTime d1,DateTime d2) { var ta = new DsInventoryTableAdapters.SALESINVDETAIL_DELTableAdapter { Connection = { ConnectionString = _constr } }; var ds = new DsInventory().SALESINVDETAIL_DEL; ta.FillBy(ds, d1 , d2); return ds; }
public string UpdateSalesInvDetail(DsInventory.SALESINVDETAILDataTable sales) { string retval = "1"; try { var ta = new DsInventoryTableAdapters.SALESINVDETAILTableAdapter(); ta.Connection.ConnectionString = _constr; ta.Update(sales); } catch (Exception ex) { retval = ex.ToString(); } return retval; }