public frmAddStockRecord(StockEntry _ObjStockEntry, frmStockEntry _frmparent, StockEntryDetail _ObjStockEntryDetail) { InitializeComponent(); ObjStockEntry = _ObjStockEntry; frmparent = _frmparent; ObjStockEntryDetail = _ObjStockEntryDetail; }
public void RefreshGrid(StockEntryDetail _ObjStockEntryDetail) { try { ObjStockEntryDetail = _ObjStockEntryDetail; int rowhandle = gvStockEntry.LocateByValue("STOCKENTRYDETAILID", ObjStockEntryDetail.STOCKENTRYDETAILID); if (rowhandle > 0) { gvStockEntry.SetRowCellValue(rowhandle, "STOCKENTRYDETAILID", ObjStockEntryDetail.STOCKENTRYDETAILID); gvStockEntry.SetRowCellValue(rowhandle, "ITEMID", ObjStockEntryDetail.ITEMID); gvStockEntry.SetRowCellValue(rowhandle, "ITEMCODEID", ObjStockEntryDetail.ITEMCODEID); gvStockEntry.SetRowCellValue(rowhandle, "ITEMPRICEID", ObjStockEntryDetail.ITEMPRICEID); gvStockEntry.SetRowCellValue(rowhandle, "SKUCODE", ObjStockEntryDetail.SKUCODE); gvStockEntry.SetRowCellValue(rowhandle, "ITEMCODE", ObjStockEntryDetail.ITEMCODE); gvStockEntry.SetRowCellValue(rowhandle, "ITEMNAME", ObjStockEntryDetail.ITEMNAME); gvStockEntry.SetRowCellValue(rowhandle, "COSTPRICEWT", ObjStockEntryDetail.COSTPRICEWT); gvStockEntry.SetRowCellValue(rowhandle, "COSTPRICEWOT", ObjStockEntryDetail.COSTPRICEWOT); gvStockEntry.SetRowCellValue(rowhandle, "MRP", ObjStockEntryDetail.MRP); gvStockEntry.SetRowCellValue(rowhandle, "SALEPRICE", ObjStockEntryDetail.SALEPRICE); gvStockEntry.SetRowCellValue(rowhandle, "QUANTITY", ObjStockEntryDetail.QUANTITY); gvStockEntry.SetRowCellValue(rowhandle, "WEIGHTINKGS", ObjStockEntryDetail.WEIGHTINKGS); gvStockEntry.SetRowCellValue(rowhandle, "FREEQUANTITY", ObjStockEntryDetail.FreeQuantity); gvStockEntry.SetRowCellValue(rowhandle, "DISCOUNTFLAT", ObjStockEntryDetail.DiscountFlat); gvStockEntry.SetRowCellValue(rowhandle, "DISCOUNTPERCENTAGE", ObjStockEntryDetail.DiscountPercentage); gvStockEntry.SetRowCellValue(rowhandle, "SCHEMEPERCENTAGE", ObjStockEntryDetail.SchemePercentage); gvStockEntry.SetRowCellValue(rowhandle, "SCHEMEFLAT", ObjStockEntryDetail.SchemeFlat); gvStockEntry.SetRowCellValue(rowhandle, "TOTALPRICEWT", ObjStockEntryDetail.TotalPriceWT); gvStockEntry.SetRowCellValue(rowhandle, "TOTALPRICEWOT", ObjStockEntryDetail.TotalPriceWOT); gvStockEntry.SetRowCellValue(rowhandle, "APPLIEDDISCOUNT", ObjStockEntryDetail.AppliedDiscount); gvStockEntry.SetRowCellValue(rowhandle, "APPLIEDSCHEME", ObjStockEntryDetail.AppliedScheme); gvStockEntry.SetRowCellValue(rowhandle, "APPLIEDDGST", ObjStockEntryDetail.AppliedGST); gvStockEntry.SetRowCellValue(rowhandle, "FINALPRICE", ObjStockEntryDetail.FinalPrice); gvStockEntry.SetRowCellValue(rowhandle, "CGST", ObjStockEntryDetail.CGST); gvStockEntry.SetRowCellValue(rowhandle, "SGST", ObjStockEntryDetail.SGST); gvStockEntry.SetRowCellValue(rowhandle, "IGST", ObjStockEntryDetail.IGST); gvStockEntry.SetRowCellValue(rowhandle, "CESS", ObjStockEntryDetail.CESS); gvStockEntry.SetRowCellValue(rowhandle, "GSTID", ObjStockEntryDetail.GSTID); } else { gvStockEntry.AddNewRow(); } } catch (Exception ex) { throw ex; } }
private void btnEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { if (gvStockEntry.FocusedRowHandle > 0) { ObjStockEntry.SUPPLIERID = cmbSupplier.EditValue; ObjStockEntry.SUPPLIERINVOICENO = txtInvoiceNumber.EditValue; ObjStockEntry.TAXINCLUSIVE = chkTaxInclusive.EditValue; ObjStockEntry.InvoiceDate = dtpInvoice.EditValue; ObjStockEntryDetail = new StockEntryDetail(); ObjStockEntryDetail.STOCKENTRYDETAILID = gvStockEntry.GetFocusedRowCellValue("STOCKENTRYDETAILID"); ObjStockEntryDetail.ITEMID = gvStockEntry.GetFocusedRowCellValue("ITEMID"); ObjStockEntryDetail.ITEMCODEID = gvStockEntry.GetFocusedRowCellValue("ITEMCODEID"); ObjStockEntryDetail.ITEMPRICEID = gvStockEntry.GetFocusedRowCellValue("ITEMPRICEID"); ObjStockEntryDetail.SKUCODE = gvStockEntry.GetFocusedRowCellValue("SKUCODE"); ObjStockEntryDetail.ITEMCODE = gvStockEntry.GetFocusedRowCellValue("ITEMCODE"); ObjStockEntryDetail.ITEMNAME = gvStockEntry.GetFocusedRowCellValue("ITEMNAME"); ObjStockEntryDetail.COSTPRICEWT = gvStockEntry.GetFocusedRowCellValue("COSTPRICEWT"); ObjStockEntryDetail.COSTPRICEWOT = gvStockEntry.GetFocusedRowCellValue("COSTPRICEWOT"); ObjStockEntryDetail.MRP = gvStockEntry.GetFocusedRowCellValue("MRP"); ObjStockEntryDetail.SALEPRICE = gvStockEntry.GetFocusedRowCellValue("SALEPRICE"); ObjStockEntryDetail.QUANTITY = gvStockEntry.GetFocusedRowCellValue("QUANTITY"); ObjStockEntryDetail.WEIGHTINKGS = gvStockEntry.GetFocusedRowCellValue("WEIGHTINKGS"); ObjStockEntryDetail.FreeQuantity = gvStockEntry.GetFocusedRowCellValue("FREEQUANTITY"); ObjStockEntryDetail.DiscountFlat = gvStockEntry.GetFocusedRowCellValue("DISCOUNTFLAT"); ObjStockEntryDetail.DiscountPercentage = gvStockEntry.GetFocusedRowCellValue("DISCOUNTPERCENTAGE"); ObjStockEntryDetail.SchemePercentage = gvStockEntry.GetFocusedRowCellValue("SCHEMEPERCENTAGE"); ObjStockEntryDetail.SchemeFlat = gvStockEntry.GetFocusedRowCellValue("SCHEMEFLAT"); ObjStockEntryDetail.TotalPriceWT = gvStockEntry.GetFocusedRowCellValue("TOTALPRICEWT"); ObjStockEntryDetail.TotalPriceWOT = gvStockEntry.GetFocusedRowCellValue("TOTALPRICEWOT"); ObjStockEntryDetail.AppliedDiscount = gvStockEntry.GetFocusedRowCellValue("APPLIEDDISCOUNT"); ObjStockEntryDetail.AppliedScheme = gvStockEntry.GetFocusedRowCellValue("APPLIEDSCHEME"); ObjStockEntryDetail.AppliedGST = gvStockEntry.GetFocusedRowCellValue("APPLIEDDGST"); ObjStockEntryDetail.FinalPrice = gvStockEntry.GetFocusedRowCellValue("FINALPRICE"); ObjStockEntryDetail.CGST = gvStockEntry.GetFocusedRowCellValue("CGST"); ObjStockEntryDetail.SGST = gvStockEntry.GetFocusedRowCellValue("SGST"); ObjStockEntryDetail.IGST = gvStockEntry.GetFocusedRowCellValue("IGST"); ObjStockEntryDetail.CESS = gvStockEntry.GetFocusedRowCellValue("CESS"); ObjStockEntryDetail.GSTID = gvStockEntry.GetFocusedRowCellValue("GSTID"); frmAddStockRecord obj = new frmAddStockRecord(ObjStockEntry, this, ObjStockEntryDetail); obj.ShowInTaskbar = false; obj.StartPosition = FormStartPosition.CenterParent; obj.IconOptions.ShowIcon = false; obj.ShowDialog(); } }
private void btnAddItem_Click(object sender, EventArgs e) { if (cmbSupplier.EditValue != null && txtInvoiceNumber.EditValue != null && dtpInvoice.EditValue != null) { ObjStockEntry.SUPPLIERID = cmbSupplier.EditValue; ObjStockEntry.SUPPLIERINVOICENO = txtInvoiceNumber.EditValue; ObjStockEntry.TAXINCLUSIVE = chkTaxInclusive.EditValue; ObjStockEntry.InvoiceDate = dtpInvoice.EditValue; ObjStockEntryDetail = new StockEntryDetail(); frmAddStockRecord obj = new frmAddStockRecord(ObjStockEntry, this, ObjStockEntryDetail); obj.ShowInTaskbar = false; obj.StartPosition = FormStartPosition.CenterParent; obj.IconOptions.ShowIcon = false; obj.ShowDialog(); } }
private StockEntry getStockEntryFromForm(StockEntry original) { if (original == null) { original = new StockEntry(); } original.FromWarehouse = cmbStockFromWarehouse.SelectedItem.ToString(); original.ToWarehouse = cmbStockToWarehouse.SelectedItem.ToString(); // add an item List <StockEntryDetail> entryItems = new List <StockEntryDetail>(); StockEntryDetail sed = new StockEntryDetail(); sed.ItemCode = cmbStockEntryItems.SelectedItem.ToString(); sed.Quantity = Convert.ToDouble(numItemsQty.Value); entryItems.Add(sed); original.Items = entryItems.ToArray(); original.Purpose = Purposes.Manufacture; original.Company = cmbStockEntryCompany.SelectedItem.ToString(); return(original); }
public StockEntryDetail SaveInvoiceDetail(StockEntryDetail ObjStockEntryDetail) { DataTable dt = new DataTable(); int StockEntryDetailID = 0; try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[USP_CU_STOCKENTRYDETAIL]"; cmd.Parameters.AddWithValue("@STOCKENTRYDETAILID", ObjStockEntryDetail.STOCKENTRYDETAILID); cmd.Parameters.AddWithValue("@STOCKENTRYID", ObjStockEntryDetail.STOCKENTRYID); cmd.Parameters.AddWithValue("@ITEMCODEID", ObjStockEntryDetail.ITEMCODEID); cmd.Parameters.AddWithValue("@COSTPRICEWT", ObjStockEntryDetail.COSTPRICEWT); cmd.Parameters.AddWithValue("@COSTPRICEWOT", ObjStockEntryDetail.COSTPRICEWOT); cmd.Parameters.AddWithValue("@MRP", ObjStockEntryDetail.MRP); cmd.Parameters.AddWithValue("@SALEPRICE", ObjStockEntryDetail.SALEPRICE); cmd.Parameters.AddWithValue("@QUANTITY", ObjStockEntryDetail.QUANTITY); cmd.Parameters.AddWithValue("@WEIGHTINKGS", ObjStockEntryDetail.WEIGHTINKGS); cmd.Parameters.AddWithValue("@USERID", ObjStockEntryDetail.UserID); cmd.Parameters.AddWithValue("@GSTID", ObjStockEntryDetail.GSTID); cmd.Parameters.AddWithValue("@FREEQUANTITY", ObjStockEntryDetail.FreeQuantity); cmd.Parameters.AddWithValue("@DISCOUNTFLAT", ObjStockEntryDetail.DiscountFlat); cmd.Parameters.AddWithValue("@DISCOUNTPERCENTAGE", ObjStockEntryDetail.DiscountPercentage); cmd.Parameters.AddWithValue("@SCHEMEPERCENTAGE", ObjStockEntryDetail.SchemePercentage); cmd.Parameters.AddWithValue("@SCHEMEFLAT", ObjStockEntryDetail.SchemeFlat); cmd.Parameters.AddWithValue("@TOTALPRICEWT", ObjStockEntryDetail.TotalPriceWT); cmd.Parameters.AddWithValue("@TOTALPRICEWOT", ObjStockEntryDetail.TotalPriceWOT); cmd.Parameters.AddWithValue("@APPLIEDDISCOUNT", ObjStockEntryDetail.AppliedDiscount); cmd.Parameters.AddWithValue("@APPLIEDSCHEME", ObjStockEntryDetail.AppliedScheme); cmd.Parameters.AddWithValue("@APPLIEDDGST", ObjStockEntryDetail.AppliedGST); cmd.Parameters.AddWithValue("@FINALPRICE", ObjStockEntryDetail.FinalPrice); cmd.Parameters.AddWithValue("@CGST", ObjStockEntryDetail.CGST); cmd.Parameters.AddWithValue("@SGST", ObjStockEntryDetail.SGST); cmd.Parameters.AddWithValue("@IGST", ObjStockEntryDetail.IGST); cmd.Parameters.AddWithValue("@CESS", ObjStockEntryDetail.CESS); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dt); } if (dt != null && dt.Rows.Count > 0) { string str = Convert.ToString(dt.Rows[0][0]); if (!int.TryParse(str, out StockEntryDetailID)) { throw new Exception(str); } else { ObjStockEntryDetail.STOCKENTRYDETAILID = StockEntryDetailID; ObjStockEntryDetail.ITEMPRICEID = dt.Rows[0][1]; } } } } catch (Exception ex) { throw new Exception("Error While Saving Invoice Detail"); } finally { SQLCon.Sqlconn().Close(); } return(ObjStockEntryDetail); }
private void btnSave_Click(object sender, EventArgs e) { try { if (!dxValidationProvider1.Validate()) { return; } if (sluFreeItem.EditValue != null) { if (txtFreeQuantity.EditValue == null) { XtraMessageBox.Show("Free Quantity is Mandatory!"); return; } } if (Convert.ToInt32(ObjStockEntry.STOCKENTRYID) == 0) { frmparent.SaveInvoice(); } if (!IsEditMode) { ObjStockEntryDetail = new StockEntryDetail(); } ObjStockEntryDetail.STOCKENTRYID = ObjStockEntry.STOCKENTRYID; ObjStockEntryDetail.ITEMCODEID = cmbItemCode.EditValue; ObjStockEntryDetail.ITEMID = ((DataRowView)cmbItemCode.GetSelectedDataRow())["ITEMID"]; ObjStockEntryDetail.ITEMPRICEID = ItemPriceID; ObjStockEntryDetail.SKUCODE = ((DataRowView)cmbItemCode.GetSelectedDataRow())["SKUCODE"]; ObjStockEntryDetail.ITEMCODE = cmbItemCode.Text; ObjStockEntryDetail.ITEMNAME = txtItemName.EditValue; ObjStockEntryDetail.COSTPRICEWT = txtCostPriceWT.EditValue; ObjStockEntryDetail.COSTPRICEWOT = txtCostPriceWOT.EditValue; ObjStockEntryDetail.MRP = txtMRP.EditValue; ObjStockEntryDetail.SALEPRICE = txtSalePrice.EditValue; ObjStockEntryDetail.QUANTITY = txtQuantity.EditValue; ObjStockEntryDetail.WEIGHTINKGS = txtWeightInKGs.EditValue; ObjStockEntryDetail.UserID = Utility.UserID; ObjStockEntryDetail.GSTID = cmbGST.EditValue; ObjStockEntryDetail.DiscountPercentage = txtDiscountPer.EditValue; ObjStockEntryDetail.DiscountFlat = txtDiscountFlat.EditValue; ObjStockEntryDetail.SchemePercentage = txtSchemePer.EditValue; ObjStockEntryDetail.SchemeFlat = txtSchemeFlat.EditValue; ObjStockEntryDetail.FreeQuantity = txtFreeQuantity.EditValue; ObjStockEntryDetail.TotalPriceWT = txtTotalPriceWT.EditValue; ObjStockEntryDetail.TotalPriceWOT = txtTotalPriceWOT.EditValue; ObjStockEntryDetail.AppliedDiscount = txtAppliedDiscount.EditValue; ObjStockEntryDetail.AppliedScheme = txtAppliedScheme.EditValue; ObjStockEntryDetail.AppliedGST = txtAppliedGST.EditValue; ObjStockEntryDetail.FinalPrice = txtFinalPrice.EditValue; ObjStockEntryDetail.CGST = txtCGST.EditValue; ObjStockEntryDetail.SGST = txtSGST.EditValue; ObjStockEntryDetail.IGST = txtIGST.EditValue; ObjStockEntryDetail.CESS = txtCESS.EditValue; ObjStockRep.SaveInvoiceDetail(ObjStockEntryDetail); frmparent.RefreshGrid(ObjStockEntryDetail); ObjStockEntryDetail.STOCKENTRYDETAILID = 0; cmbItemCode.EditValue = null; txtItemName.EditValue = null; txtMRP.EditValue = null; txtSalePrice.EditValue = null; txtQuantity.EditValue = null; txtWeightInKGs.EditValue = null; txtCostPriceWOT.EditValue = null; txtCostPriceWT.EditValue = null; txtTotalPriceWT.EditValue = null; txtTotalPriceWOT.EditValue = null; cmbGST.EditValue = null; txtDiscountPer.EditValue = 0.00; txtDiscountFlat.EditValue = 0.00; txtSchemePer.EditValue = 0.00; txtSchemeFlat.EditValue = 0.00; txtFreeQuantity.EditValue = 0.00; txtCGST.EditValue = 0.00; txtSGST.EditValue = 0.00; txtIGST.EditValue = 0.00; txtCESS.EditValue = 0.00; IsEditMode = false; cmbItemCode.Focus(); } catch (Exception ex) { ErrorMgmt.ShowError(ex); ErrorMgmt.Errorlog.Error(ex); } }