public GRN Get(long GRNNO) { try { SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@GRNNO", GRNNO) }; DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_GRNByID", paramList); GRN objGRN = new GRN(); objGRN.GRNApprovedBy = Convert.ToString(dt.Rows[0]["GRNApprovedBy"]); objGRN.GRNApprovedDate = Convert.ToDateTime(dt.Rows[0]["GRNApproveDate"]); objGRN.GRNDate = Convert.ToDateTime(dt.Rows[0]["GRNDate"]); objGRN.GRNEnterdBy = Convert.ToString(dt.Rows[0]["GRNEnterdBy"]); objGRN.GRNMR = Convert.ToInt64(dt.Rows[0]["GRNMRNO"]); objGRN.GRNMTNNo = Convert.ToInt64(dt.Rows[0]["GRNMTNNO"]); objGRN.GRNNo = Convert.ToInt64(dt.Rows[0]["GRNNO"]); objGRN.GRNRPDBatch = null; objGRN.GRNStore = objStore_DL.Get(Convert.ToString(dt.Rows[0]["GRNStoreID"])); objGRN.DeliverNoteID = Convert.ToString(dt.Rows[0]["DeliverNoteID"]); return(objGRN); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
protected void btnUpload_OnClick(object sender, EventArgs e) { string invids = Session["invids"].ToString(); string[] arr = invids.Split(','); InventoryLogic il = new InventoryLogic(); RawMaterialLogic rl = new RawMaterialLogic(); GRNLogic gl = new GRNLogic(); GRN g = new GRN(); g.SupplierID = rl.SelectByID(il.SelectByID(Convert.ToInt32(arr[0])).RawMaterialID).SupplierID; string path; string ticks = DateTime.Now.Ticks.ToString(); Inventory inv; if (FileUpload1.HasFile) { FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName)); path = "Images/" + ticks + FileUpload1.FileName; g.GRNPath = path; int id = gl.Insert(g); for (int i = 0; i < arr.Length; i++) { inv = il.SelectByID(Convert.ToInt32(arr[i])); inv.GRNID = id; il.Update(inv); //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage" + arr[i], "alert(" + arr[i] + ")", true); } } // Response.Redirect("QuotationList.aspx"); Response.Redirect("InventoryList.aspx"); }
internal async Task <JsonResult> GRNInfo(GRN grn_header_no) { SqlConnection cn = null; try { cn = Connection.GetConnection(); SqlCommand smd = new SqlCommand("grn_info", cn) { CommandType = CommandType.StoredProcedure }; smd.Parameters.AddWithValue("@grn_header_no", grn_header_no.GRNHeaderNo); smd.Parameters.Add("@jsonOutput", SqlDbType.NVarChar, -1).Direction = ParameterDirection.Output; await smd.ExecuteNonQueryAsync().ConfigureAwait(false); string json = smd.Parameters["@jsonOutput"].Value.ToString(); smd.Dispose(); JArray arr = JArray.Parse(json); return(new JsonResult(arr)); } catch (Exception) { throw; } finally { Connection.CloseConnection(ref cn); } }
public int Add_Direct_TGRN(GRN obj, string DeliverNote, string DeliverPONO) { try { SqlParameter GRNNO = new SqlParameter(); GRNNO.Direction = ParameterDirection.Output; SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@GRNEnterdBy", obj.GRNEnterdBy), new SqlParameter("@GRNStoreID", obj.GRNStore.StoreID), new SqlParameter("@GRNType", obj.GRNType), new SqlParameter("@GRNStatus", obj.GRNStatus), new SqlParameter("@GRNCategory", obj.GRNCategory), new SqlParameter("@DeliverNoteID", DeliverNote), new SqlParameter("@DeliverPONO", DeliverPONO), new SqlParameter("@outParam", SqlDbType.Int) { Direction = ParameterDirection.Output } }; return(Execute.RunSP_Output(Connection, "SPADD_GRN_Direct_TGRN", paramList)); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public int AddGRN(GRN user) { int id = 0; PetaPoco.Database db = null; var dbConn = DataContext.Database.Connection; try { dbConn.Open(); db = new PetaPoco.Database(dbConn); db.EnableAutoSelect = false; id = db.ExecuteScalar <int>("declare @@ret INT; exec @@ret = usp_AddGRN " + " @GRNCreatedDate,@SId; select @@ret;", new { @GRNCreatedDate = user.GRNCreatedDate, @SId = user.SId, }); } catch (Exception ex) { } finally { if (dbConn != null) { dbConn.Close(); } } return(id); }
internal async Task <DataTable> GetBarcodeNo(GRN grn, int no_of_barcode) { SqlConnection cn = null; try { DataTable dt = new DataTable(); cn = Connection.GetConnection(); SqlDataAdapter smd = new SqlDataAdapter("get_barcode_sequence", cn); smd.SelectCommand.CommandType = CommandType.StoredProcedure; smd.SelectCommand.Parameters.AddWithValue("@no_of_barcode", no_of_barcode); smd.SelectCommand.Parameters.AddWithValue("@quantity", grn.Quantity); smd.SelectCommand.Parameters.AddWithValue("@document_no", grn.DocumentNo); smd.SelectCommand.Parameters.AddWithValue("@document_type", grn.DocumentType); smd.SelectCommand.Parameters.AddWithValue("@sales_invoice_no", grn.SalesInvoiceNo); smd.SelectCommand.Parameters.AddWithValue("@document_line_no", grn.DocumentLineNo); smd.Fill(dt); return(dt); } catch (Exception) { throw; } finally { Connection.CloseConnection(ref cn); } }
public GRN GetGRN(int?GRNId) { PetaPoco.Database db = null; var dbConn = DataContext.Database.Connection; GRN user = new GRN(); try { using (DataContext) { dbConn.Open(); db = new PetaPoco.Database(dbConn); db.EnableAutoSelect = false; user = db.Query <GRN>("exec usp_GetGRN " + "@GRNId", new { GRNId = GRNId }).FirstOrDefault(); dbConn.Close(); } } catch (Exception ex) { throw; } finally { if (dbConn != null) { dbConn.Close(); } } return(user); }
private void button2_Click(object sender, EventArgs e) { try { if (objGRN != null) { DialogResult dr = MessageBox.Show(this, "Are you sure you want Approve Selected GRN? Click Yes to Approve", "Confirm Approve", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dr == DialogResult.Yes) { objGRN = objGRNDL.Get(objGRN.GRNNo); if (objGRN != null && objGRN.GRNStatus == GRN.Status.Initial) { objGRN.GRNApprovedBy = CurrentUser.UserEmp.EmployeeID; int y = objGRNDL.Approve(objGRN); objGRN = null; bindItemList.DataSource = null; bindGRNList.DataSource = objGRNDL.GetDataView(objStore.StoreID, GRN.Status.Initial); } else { MessageBox.Show(this, "Another user changed the Status of selected GRN", "Action Stoped", MessageBoxButtons.OK, MessageBoxIcon.Stop); bindGRNList.DataSource = objGRNDL.GetDataView(objStore.StoreID, GRN.Status.Initial); bindItemList.DataSource = null; } } } } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public IEnumerable <PurchaseInvoicePharmacyViewModel> GetPurchaseInvoicesByMonthAndCompany(DateTime date, long companyid) { IEnumerable <PurchaseInvoice> Invoices = Table.Where(a => a.CompanyId != null && a.CompanyId == companyid && a.GRNId != null && a.PurchaseOrderId != null && a.InvoiceDate != null && a.InvoiceDate.Value.Month == date.Month && a.InvoiceDate.Value.Year == date.Year).OrderByDescending(a => a.PurchaseInvoiceId); IList <PurchaseInvoicePharmacyViewModel> InvoiceViews = new List <PurchaseInvoicePharmacyViewModel>(); foreach (PurchaseInvoice Invoice in Invoices) { GRN SelGRN = Db.GRNs.Where(a => a.GRNId == Invoice.GRNId).Include(a => a.GrnItems).FirstOrDefault(); PurchaseInvoicePharmacyViewModel InvoiceView = new PurchaseInvoicePharmacyViewModel() { InvoiceNumber = Invoice.InvoiceNumber, GRNCode = SelGRN.GrnNumber, GRNDate = SelGRN.GrnDate, GRNRemarks = SelGRN.Remarks, InvoiceDate = Invoice.InvoiceDate, TotalPayable = SelGRN.TotalPaymentAmount, TotalQuantity = SelGRN.TotalReceivedQuantity, VendorBillNumber = SelGRN.VendorBillNumber, GrnItems = SelGRN.GrnItems }; InvoiceViews.Add(InvoiceView); } return(InvoiceViews.OrderByDescending(a => a.InvoiceNumber)); }
private void button3_Click(object sender, EventArgs e) { try { if (objGRN != null) { DialogResult dr = MessageBox.Show(this, "Are you sure you want Reject Selected GRN? Click Yes to Reject", "Confirm Reject", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dr == DialogResult.Yes) { objGRN = objGRNDL.Get(objGRN.GRNNo); if (objGRN != null && objGRN.GRNStatus == GRN.Status.Initial) { objGRNDL.Update(objGRN.GRNNo, GRN.Status.Reject); objGRN = null; bindItemList.DataSource = null; txtGRNNO.Text = ""; bindGRNList.DataSource = objGRNDL.GetDataView(objStore.StoreID, GRN.Status.Initial); } else { MessageBox.Show(this, "Another user changed the Status of selected GRN", "Action Stoped", MessageBoxButtons.OK, MessageBoxIcon.Stop); bindGRNList.DataSource = objGRNDL.GetDataView(objStore.StoreID, GRN.Status.Initial); bindItemList.DataSource = null; } } } } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void gvGRNList_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex >= 0) { objGRN = new GRN(); bindItemList.DataSource = null; objGRN = objGRNDL.Get(Convert.ToInt64(gvGRNList.Rows[e.RowIndex].Cells["ColGRNNO"].Value)); if (objGRN != null) { bindItemList.DataSource = objGRNDL.GetDataView_Items(objGRN.GRNNo); txtGRNNO.Text = objGRN.GRNNo.ToString(); DataTable dt = objGRNDL.Get_GRN_Batch(objGRN.GRNNo); if (dt.Rows.Count > 0) { txtBatchNo.Text = dt.Rows[0]["BatchID"].ToString(); txtMTNNO.Text = dt.Rows[0]["MTNNO"].ToString(); } } } } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ActionResult Edit(GRN model) { ViewBag.Title = "Edit"; model.OrganizationId = OrganizationId; model.CreatedDate = System.DateTime.Now; model.CreatedBy = UserID.ToString(); FillWarehouse(); FillCurrency(); SupplierDropdown(); FillAdditionDeduction(); FillEmployee(); var repo = new GRNRepository(); var result1 = new GRNRepository().CHECK(model.GRNId); if (result1 > 0) { TempData["error"] = "Sorry! Already Used."; TempData["GRNNo"] = null; return(View("Edit", model)); } else { try { var result = new GRNRepository().UpdateGRN(model); //var result3 = new GRNItemRepository().DeleteGRNADDDED(model.GRNId); //var result2 = new GRNItemRepository().DeleteGRNItem(model.GRNId); //var result4 = new StockUpdateRepository().DeleteGRNStockUpdate(model.GRNId); //var result5 = new GRNRepository().InsertGRNDT(model); if (result.GRNId > 0) { TempData["success"] = "Updated successfully. (" + result.GRNNo + ")"; TempData["GRNNo"] = result.GRNNo; return(RedirectToAction("PreviousList")); //return View("Edit", model); } else { throw new Exception(); } } catch (SqlException) { TempData["error"] = "Some error occured while connecting to database. Please check your network connection and try again."; } catch (NullReferenceException) { TempData["error"] = "Some required data was missing. Please try again."; } catch (Exception) { TempData["error"] = "Some error occured. Please try again."; } return(RedirectToAction("PreviousList")); } }
public async Task <JsonResult> GRNQuantityInWithoutScan([FromBody] GRN grn) { try { DataTable newBarcodes = new DataTable(); newBarcodes.Columns.Add("Barcode", typeof(string)); newBarcodes.Columns.Add("Quantity", typeof(int)); switch (grn.ProcessType.ToLower()) { case "serial": DataTable serial_dt = await _gRNLogic.GetBarcodeNo(grn, grn.Quantity).ConfigureAwait(false); if (serial_dt.Columns.Count > 0 && serial_dt.Rows[0]["condition"].ToString().Equals("true", StringComparison.OrdinalIgnoreCase) && Convert.ToInt32(serial_dt.Rows[0]["current_value"]) > 1) { long serial_current_no = Convert.ToInt32(serial_dt.Rows[0]["current_value"]); for (int i = 0; i < grn.Quantity; i++) { newBarcodes.Rows.Add(serial_current_no, 1); serial_current_no += 1; } } else { return(new JsonResult(serial_dt)); } break; case "lot": DataTable lot_dt = await _gRNLogic.GetBarcodeNo(grn, 1).ConfigureAwait(false); if (lot_dt.Columns.Count > 0 && lot_dt.Rows[0]["condition"].ToString().Equals("true", StringComparison.OrdinalIgnoreCase) && Convert.ToInt32(lot_dt.Rows[0]["current_value"]) > 1) { long lot_current_no = Convert.ToInt32(lot_dt.Rows[0]["current_value"]); newBarcodes.Rows.Add(lot_current_no, grn.Quantity); } else { return(new JsonResult(lot_dt)); } break; case "item": newBarcodes.Rows.Add(grn.ItemNo, grn.Quantity); break; } if (newBarcodes.Rows.Count > 0) { return(await _gRNLogic.insert_new_barcode(grn, newBarcodes).ConfigureAwait(false)); } else { return(await _gRNLogic.SendRespose("False", "Unable to genrate barcode").ConfigureAwait(false)); } } catch (Exception ee) { return(await _gRNLogic.SendRespose("False", ee.Message).ConfigureAwait(false)); } }
private void navBarItem6_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { GRN ObjGRN = new GRN(); ObjGRN.MdiParent = this; ObjGRN.Show(); ObjGRN.BringToFront(); }
private void Click_Edit(object sender, RoutedEventArgs e) { //this.Frame.Navigate(typeof(Product_RecievesPage), ((RapidCM_WeighBridge.RapidCM_PGS_Dev.Product_ProductReceive)((Windows.UI.Xaml.FrameworkElement)e.OriginalSource).DataContext).ID); GRN report = new GRN(); report.Parameters[0].Visible = false; report.getId(((System.Windows.FrameworkElement)e.Source).DataContext.ToString()); PrintHelper.ShowRibbonPrintPreviewDialog(this, report); }
public ActionResult PrintHtmlGRNPDF(int?GRNId) { StoreService service = new StoreService(); GRN Model = new GRN(); Model = service.GetGRN(GRNId); Model.GRNIList = service.GetGRNItemList(GRNId); return(PartialView("_GRN", Model)); }
public async Task <JsonResult> GRNQuantityInWithScan([FromBody] GRN grn) { try { return(await _gRNLogic.GRNQuantityInWithScan(grn).ConfigureAwait(false)); } catch (Exception ee) { return(await _gRNLogic.SendRespose("False", ee.Message).ConfigureAwait(false)); } }
public async Task <JsonResult> BarcodeInByPOLineInfo([FromBody] GRN lineinfo) { try { return(await _gRNLogic.BarcodeInByPOLineInfo(lineinfo).ConfigureAwait(false)); } catch (Exception ee) { return(await _gRNLogic.SendRespose("False", ee.Message).ConfigureAwait(false)); } }
public ActionResult ReviewGRN(int?GRNId) { StoreService service = new StoreService(); GRN user = new GRN(); //ViewBag.Divisions = new SelectList(AllDivisions(), "Value", "Text"); user = service.GetGRN(GRNId); user.GRNIList = service.GetGRNItemList(GRNId); return(View("ReviewGRN", user)); }
public async Task <JsonResult> GateEntryByDocumentNo([FromBody] GRN document_no) { try { return(await _gRNLogic.GateEntryByDocumentNo(document_no).ConfigureAwait(false)); } catch (Exception ee) { return(await _gRNLogic.SendRespose("False", ee.Message).ConfigureAwait(false)); } }
public async Task <JsonResult> CreateGRNHeader([FromBody] GRN grn) { try { return(await _gRNLogic.CreateGRNHeader(grn).ConfigureAwait(false)); } catch (Exception ee) { return(await _gRNLogic.SendRespose("False", ee.Message).ConfigureAwait(false)); } }
public async Task <JsonResult> GRNInfo([FromBody] GRN grn_header_no) { try { return(await _gRNLogic.GRNInfo(grn_header_no).ConfigureAwait(false)); } catch (Exception ee) { return(await _gRNLogic.SendRespose("False", ee.Message).ConfigureAwait(false)); } }
public IActionResult DeleteGRN(long id) { GRN grn = grn_repo.Find(id); if (grn == null) { return(NotFound()); } grn_repo.Delete(grn); return(Ok()); }
public static Dictionary <string, object> reMapGRNData(GRN GRN) { Dictionary <string, object> keyValues = new Dictionary <string, object>(); if (GRN.Id != Guid.Empty) { keyValues.Add("@id", GRN.Id); } keyValues.Add("@Status", GRN.Status); if (GRN.CreatedOn == DateTime.MinValue) { keyValues.Add("@CreatedOn", DBNull.Value); } else { keyValues.Add("@CreatedOn", GRN.CreatedOn); } keyValues.Add("@CreatedBy", GRN.CreatedBy == null ? Guid.Empty : GRN.CreatedBy.Id); if (GRN.ModifiedOn == DateTime.MinValue) { keyValues.Add("@ModifiedOn", DBNull.Value); } else { keyValues.Add("@ModifiedOn", GRN.ModifiedOn); } keyValues.Add("@ModifiedBy", GRN.ModifiedBy == null ? Guid.Empty : GRN.ModifiedBy.Id); if (GRN.CompletedOn == DateTime.MinValue) { keyValues.Add("@CompletedOn", DBNull.Value); } else { keyValues.Add("@CompletedOn", GRN.CompletedOn); } keyValues.Add("@GRNNumber", GRN.GRNNumber); if (GRN.GRNDate == DateTime.MinValue) { keyValues.Add("@GRNDate", DBNull.Value); } else { keyValues.Add("@GRNDate", GRN.GRNDate); } keyValues.Add("@PODetailId", GRN.PODetail == null ? Guid.Empty : GRN.PODetail.Id); keyValues.Add("@Store", GRN.Store == null ? Guid.Empty : GRN.Store.Id); keyValues.Add("@InvoiceNo", GRN.InvoiceNo); keyValues.Add("@AdjPrice", GRN.AdjPrice); keyValues.Add("@Quantity", GRN.Quantity); keyValues.Add("@Remarks", GRN.Remarks); return(keyValues); }
public ActionResult AddEditGRN(int?GRNId) { StoreService service = new StoreService(); GRN user = new GRN(); user = service.GetGRN(GRNId); if (user == null) { user = new GRN(); } ViewBag.Suppliers = new SelectList(AllSuppliers(), "Value", "Text"); return(View("AddEditGRN", user)); }
public static bool CreateGRN(GRN grn) { try { if (grn.PO != null && grn.PO.Id != Guid.Empty && grn.PODetail != null && grn.PODetail.Id != Guid.Empty) { PurchaseDataManager.CreateGRN(POMap.reMapGRNData(grn)); ResetCache(); /*PurchaseOrder PO = GetPO(grn.PO.Name); * PODetail POD = null; * foreach (PODetail pod in PO.PODetailsList) * { * if (pod.Id == grn.PODetail.Id) * POD = pod; * } * if (POD != null) * { * GRN Grn = NewGRN(); * Grn.PO = new Reference() { Id = PO.Id, Name = PO.PONumber }; * Grn.PODetail = new Reference() { Id = POD.Id, Name = PO.PONumber }; * Grn.GRNDate = keyvalues.ContainsKey("GRNDate") ? DateTime.Parse(keyvalues["GRNDate"]) : DateTime.Now; * if (keyvalues.ContainsKey("Store")) * Grn.Store = StoreManager.GetStoreRef(keyvalues["Store"].ToString()); * Grn.Quantity = keyvalues.ContainsKey("Quantity") ? decimal.Parse(keyvalues["Quantity"]) : 0; * Grn.InvoiceNo = keyvalues.ContainsKey("Invoice") ? keyvalues["Invoice"] : ""; * Grn.AdjPrice = keyvalues.ContainsKey("Price") ? decimal.Parse(keyvalues["Price"]) : 0; * Grn.Remarks = keyvalues.ContainsKey("Remarks") ? keyvalues["Remarks"] : ""; * * POD.GRNsList.Add(Grn); * PurchaseDataManager.CalculatePO(PO); * if (PO.isValid) * PurchaseDataManager.CreateGRN(POMap.reMapGRNData(Grn)); * else * { * ExceptionHandler.Error("Something went wrong! PO Quantity is not valid."); * PurchaseDataManager.ResetCache(); * return null; * } * PurchaseDataManager.ResetCache(); * return Grn; * }*/ } return(true); } catch (Exception ex) { ExceptionHandler.Error("Something went wrong. Details: " + ex.Message, ex); } return(false); }
public int UpdateGRN(GRN user) { int id = 0; try { id = _repository.UpdateGRN(user); } catch (Exception ex) { throw ex; } return(id); }
private void pURCHASEGRNToolStripMenuItem_Click(object sender, EventArgs e) { foreach (Form f in this.MdiChildren) { if (f.GetType() == typeof(GRN)) { f.Activate(); return; } } Form ITEMS = new GRN(); ITEMS.MdiParent = this; ITEMS.Show(); }
private void shapedButton3_Click_1(object sender, EventArgs e) { foreach (Form f in this.MdiChildren) { if (f.GetType() == typeof(GRN)) { f.Activate(); return; } } Form ITEMS = new GRN(); ITEMS.MdiParent = this; ITEMS.Show(); }
private void btn_NewGRN_Click(object sender, EventArgs e) { foreach (Form f in this.MdiChildren) { if (f.GetType() == typeof(GRN)) { f.Activate(); return; } } Form room = new GRN(); room.MdiParent = this; room.Show(); }