public DeliverNoteMaterials Get(long ID) { try { SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@ID", ID) }; DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_DeliverNoteMaterialsByID", paramList); DeliverNoteMaterials objDN = new DeliverNoteMaterials(); DeliverNoteMaterials obj = new DeliverNoteMaterials(); obj.AcceptQty = Convert.ToDecimal(dt.Rows[0]["AcceptQty"]); obj.ActualReceivedQty = Convert.ToDecimal(dt.Rows[0]["ActualReceived"]); obj.DeliverNote = Convert.ToString(dt.Rows[0]["DeliverNoteID"]); obj.ID = Convert.ToInt64(dt.Rows[0]["ID"]); obj.MaterialCode = Convert.ToString(dt.Rows[0]["MaterialCode"]); obj.RejectQty = Convert.ToDecimal(dt.Rows[0]["RejectQty"]); obj.RejectRemarks = Convert.ToString(dt.Rows[0]["RejectRemarks"]); obj.ReworkQty = Convert.ToDecimal(dt.Rows[0]["ReworkQty"]); obj.ReworkRemarks = Convert.ToString(dt.Rows[0]["ReworkRemarks"]); obj.ReworkUnitPrice = Convert.ToDecimal(dt.Rows[0]["ReworkUnitPrice"]); obj.Unit = Convert.ToString(dt.Rows[0]["UnitCode"]); obj.DeleverdMaterialQty = Convert.ToDecimal(dt.Rows[0]["Quantity"]); return(obj); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
private void Load_Data() { try { DeliverNoteMaterials obj = new DeliverNoteMaterials(); bool DuplicateFound = false; obj.AcceptQty = 0; obj.ActualReceivedQty = 0; if (txtQuantity.Text != "") { obj.DeleverdMaterialQty = Convert.ToDecimal(txtQuantity.Text); } obj.MaterialCode = objMaterial.MaterialCode; obj.MaterialName = objMaterial.MaterialDescription; obj.RejectQty = 0; obj.RejectRemarks = "No"; obj.ReworkQty = 0; obj.ReworkRemarks = "No"; obj.ReworkUnitPrice = 0; obj.Unit = objMaterial.MatUnit.UnitCode; foreach (DeliverNoteMaterials dn in objCollec) { if (dn.MaterialCode == obj.MaterialCode) { DuplicateFound = true; break; } } if (DuplicateFound == false) { if (obj.DeleverdMaterialQty > 0) { objCollec.Add(obj); } else { MessageBox.Show(this, "Can not GRN to Zero Qty", "Wrong Attempt", MessageBoxButtons.OK); } } dgvDeliverNoteList.AutoGenerateColumns = false; objSourceDeliverNotes.DataSource = objCollec; dgvDeliverNoteList.DataSource = objSourceDeliverNotes; objSourceDeliverNotes.ResetBindings(true); } catch (Exception ex) { throw new Exception(ex.Message, ex);; } }
private void dgvDeliverNoteList_CellClick(object sender, DataGridViewCellEventArgs e) { try { objDeliverNoteMaterials = objDeliverNoteMaterials_DL.Get(Convert.ToInt64(dgvDeliverNoteList.CurrentRow.Cells["ID"].Value)); cmbMaterial.SelectedValue = objDeliverNoteMaterials.MaterialCode; txtQuantity.Text = objDeliverNoteMaterials.DeleverdMaterialQty.ToString(); } catch (Exception ex) { throw new Exception(ex.Message, ex);; } }
public int Update_EditOnly(DeliverNoteMaterials obj) { try { SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@MaterialCode", obj.MaterialCode), new SqlParameter("@Quantity", obj.DeleverdMaterialQty), new SqlParameter("@ID", obj.ID) }; return(Execute.RunSP_RowsEffected(Connection, "SPUPDATE_DeliverNoteMaterials_EditOnly", paramList)); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public int Add(DeliverNoteMaterials obj) { try { SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@MaterialCode", obj.MaterialCode), new SqlParameter("@DeleverNoteID", obj.DeliverNote), new SqlParameter("@Quantity", obj.DeleverdMaterialQty) }; return(Execute.RunSP_RowsEffected(Connection, "SPADD_DeliverNoteMaterials", paramList)); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
private void dgvItemList_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (dgvItemList.CurrentRow.Index != -1) { if (dgvItemList.CurrentRow.Cells["ID"].Value != null) { DeliverNoteMaterials obj = new DeliverNoteMaterials(); obj = objDeliverNoteMaterials_DL.Get(Convert.ToInt64(dgvItemList.CurrentRow.Cells["ID"].Value)); frmMRAResults objForm = new frmMRAResults(obj); objForm.ShowDialog(this); } } Load_Data(); } }
public int Update(DeliverNoteMaterials obj) { try { SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@MaterialCode", obj.MaterialCode), new SqlParameter("@DeliverNoteID", obj.DeliverNote), new SqlParameter("@Quantity", obj.DeleverdMaterialQty), new SqlParameter("@AcceptQty", obj.AcceptQty), new SqlParameter("@ReworkQty", obj.ReworkQty), new SqlParameter("@RejectQty", obj.RejectQty), new SqlParameter("@ReworkRemarks", obj.ReworkRemarks), new SqlParameter("@RejectRemarks", obj.RejectRemarks), new SqlParameter("@ReworkUnitPrice", obj.ReworkUnitPrice), new SqlParameter("@ID", obj.ID) }; return(Execute.RunSP_RowsEffected(Connection, "SPUPDATE_DeliverNoteMaterials", paramList)); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
private void btnGRN_Click(object sender, EventArgs e) { DialogResult TheResult = MessageBox.Show(this, "Have you Finished Entering Details", "Confirmation", MessageBoxButtons.YesNo); if (TheResult == System.Windows.Forms.DialogResult.Yes) { int count = 0; bool CanRaiseGRN = false; foreach (DataGridViewRow dgr in dgvItemList.Rows) { if (Convert.ToBoolean(dgr.Cells["Select"].Value) == true) { count = count + 1; } if (Convert.ToDecimal(dgr.Cells["Quantity"].Value) > 0) { if (Convert.ToDecimal(dgr.Cells["UnitPrice"].Value) > 0) { CanRaiseGRN = true; } else { if (Convert.ToBoolean(dgr.Cells["Select"].Value) == true) { MessageBox.Show(this, "There are some Unit Price With Zeros which is Not allowed", "Error", MessageBoxButtons.OK); } } } else { if (Convert.ToBoolean(dgr.Cells["Select"].Value) == true) { if (Convert.ToDecimal(dgr.Cells["Quantity"].Value) + Convert.ToDecimal(dgr.Cells["RejectQty"].Value) == Convert.ToDecimal(dgr.Cells["TGRNQuantity"].Value)) { DeliverNoteMaterials obj = new DeliverNoteMaterials(); obj = objDeliverNoteMaterials_DL.Get(Convert.ToInt64(dgr.Cells["ID"].Value)); objDeliverNoteMaterials_DL.Update(obj); Clear(); } else { break; } } } } if ((count > 0) && (CanRaiseGRN == true)) { GRN objGRN = new GRN(); objGRN.GRNEnterdBy = CurrentUser.EmployeeID; objGRN.GRNStore = objStore; objGRN.GRNType = GRN.Type.Material; objGRN.GRNStatus = GRN.Status.Initial; objGRN.GRNCategory = 0; int newGRNNO = objGRNDL.Add_Direct_TGRN(objGRN, txtDeliverNote.Text, txtPONo.Text); objGRN.GRNNo = newGRNNO; foreach (DataGridViewRow dgr in dgvItemList.Rows) { if (Convert.ToBoolean(dgr.Cells["Select"].Value) == true) { if (Convert.ToDecimal(dgr.Cells["Quantity"].Value) > 0) { if (Convert.ToDecimal(dgr.Cells["UnitPrice"].Value) > 0) { objGRNMaterials.GRN = objGRN; objGRNMaterials.Material = objMaterialDL.Get(Convert.ToString(dgr.Cells["MaterialCode"].Value)); objGRNMaterials.GrossQty = Convert.ToDecimal(dgr.Cells["Quantity"].Value); objGRNMaterials.NetQty = Convert.ToDecimal(dgr.Cells["Quantity"].Value); objGRNMaterials.UnitPrice = Convert.ToDecimal(dgr.Cells["UnitPrice"].Value); objGRNMaterials.Remarks = "No"; objGRNMaterialsDL.Add_FromDeliverNote(objGRNMaterials, txtDeliverNote.Text); } } } } MessageBox.Show(this, "Sucessfully GRN : GRNNO " + newGRNNO.ToString(), "Successful", MessageBoxButtons.OK); Clear(); } } }
public frmMRAResults(DeliverNoteMaterials obj) { InitializeComponent(); objDeliverNoteMaterials = obj; }