private void btnSave_Click(object sender, EventArgs e) { BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); if (PONumber.StartsWith("S2S-")) { if (SetFinalCost()) { recDoc.ConfirmGRVPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Store To Store Confirmed"); } } else { recDoc.ConfirmPrice(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.PRICE_CONFIRMED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Price Confirmed"); } this.LogActivity("Confirm-Price", ReceiptID); XtraMessageBox.Show("Received Cost and Margin Set successfully!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); PutAwayListsLoad(null, null); }
internal void SetStatusConfirmQuantityAndLocation(int receiveID, int? userID) { LoadByReceiveDocID(receiveID); BLL.ReceiveDoc rcDoc=new ReceiveDoc(); BLL.Receipt rct = new Receipt(); rcDoc.LoadByPrimaryKey(receiveID); rct.LoadByPrimaryKey(rcDoc.ReceiptID); if (RowCount == 0) { AddNew(); ReceiveDocID = receiveID; } if(userID.HasValue) { ReceiptQuantityConfirmedByUserID = userID.Value; } ReceiptConfirmationStatusID = rct.ReceiptTypeID == BLL.ReceiptType.CONSTANTS.BEGINNING_BALANCE? ReceiptConfirmationStatus.Constants.GRV_PRINTED: ReceiptConfirmationStatus.Constants.RECEIVE_QUANTITY_CONFIRMED; Save(); }
private void gridReceiveView_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e) { // Bind the detail grid var pl = new PalletLocation(); try { String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); BLL.Receipt receiptDoc = new BLL.Receipt(); receiptDoc.LoadByPrimaryKey(ReceiptID); DataTable GRNFDetail = receiptDoc.GetDetailsForGRNF(); gridDetails.DataSource = GRNFDetail; gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF(); int status = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["Status"]); var receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(ReceiptID); } catch { gridDetails.DataSource = null; gridShortage.DataSource = null; } }
private void LoadSelectedGRVDetailForInvoiceEntry(int ReceiptID) { //Display Correct Tab selectTab = grpTabInvoiceValue; FocusOnSelectedTab(); // Load The GRV First GRV = new CenterCostCalculator(); GRV.LoadGRV(ReceiptID); // Display the GRV Detail for Data Entry(Price Per Pack) //Please Make-up ur mind solution if (BLL.Settings.IsDamageIncludedOnTotalFOB) { gridInvoiceDetail.DataSource = GRV.GRVDetail; } else { gridInvoiceDetail.DataSource = GRV.GRVSoundDetail; } gridDiscrenpancy.DataSource = GRV.GRVDiscrepancyDetail; BLL.Receipt receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(ReceiptID); }
private void btnReturn_Click(object sender, EventArgs e) { //TODO: finish updating the changed locations MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr(); if (gridGRVs.DataSource == null) { return; } transaction.BeginTransaction(); try { PalletLocation pl = new PalletLocation(); BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); recDoc.SetStatusAsReceived(null); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Return For Quantity Editing"); transaction.CommitTransaction(); this.LogActivity("Return-Receipt-To-Quantity-Confirmation", ReceiptID); XtraMessageBox.Show("Receipt Returned!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); } catch (Exception exp) { transaction.RollbackTransaction(); throw exp; } PutAwayListsLoad(null, null); }
private void btnReturn_Click(object sender, EventArgs e) { //TODO: finish updating the changed locations MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr(); if (gridGRVs.DataSource == null) return; transaction.BeginTransaction(); try { PalletLocation pl = new PalletLocation(); BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); recDoc.ConfirmGRNFPrinted(null); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRNF_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Return For Price Change"); transaction.CommitTransaction(); this.LogActivity("Return-For-Costing", ReceiptID); XtraMessageBox.Show("Receipt Returned!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); } catch (Exception exp) { transaction.RollbackTransaction(); throw exp; } PutAwayListsLoad(null, null); }
private void ReturnToStoreForQuantityEdit() { //TODO: finish updating the changed locations MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr(); transaction.BeginTransaction(); try { PalletLocation pl = new PalletLocation(); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); if (gridDetailView.DataSource == null) { return; } BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); recDoc.SetStatusAsDraft(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.DRAFT_RECEIPT, null, this.GetFormIdentifier(), CurrentContext.UserId, "Returned To Draft"); transaction.CommitTransaction(); XtraMessageBox.Show("Receipt Returned!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); BindFormContents(); } catch (Exception exp) { transaction.RollbackTransaction(); XtraMessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void gridGRVs_MouseClick(object sender, MouseEventArgs e) { DataRow SelectGRV = gridGRVsView.GetFocusedDataRow(); if (SelectGRV != null) { ReceiptID = Convert.ToInt32(SelectGRV["ReceiptID"]); PONumber = Convert.ToString(SelectGRV["PONumber"]); LoadSelectedGRVDetailForInvoiceEntry(ReceiptID); BLL.Receipt receipt = new BLL.Receipt(); string s = ""; int length = ((string)SelectGRV["InvoiceNumber"]).Length; headerSection.Text = "Invoice No: " + (string)SelectGRV["InvoiceNumber"] + s.PadRight(180 - length) + "GRNF No: " + (string)SelectGRV["RefNo"].ToString(); lblMode.Text = (string)SelectGRV["Mode"]; lblAccount.Text = (string)SelectGRV["AccountName"]; lblSubAccount.Text = (string)SelectGRV["SubAccountName"]; lblActivity.Text = (string)SelectGRV["ActivityName"]; lblWarehouse.Text = (string)SelectGRV["WarehouseName"]; lblCluster.Text = (string)SelectGRV["ClusterName"]; lblReceiptType.Text = (string)SelectGRV["ReceiveType"]; lblRecieptStatus.Text = (string)SelectGRV["ReceiveStatus"]; lblSupplier.Text = (string)SelectGRV["SupplierName"]; lblOrderNo.Text = (string)SelectGRV["PONumber"]; lblConfirmedBy.Text = SelectGRV["ConfirmedBy"] == DBNull.Value ? "-" : (string)SelectGRV["ConfirmedBy"]; lblConfirmedDate.Text = SelectGRV["ConfirmedTime"] != DBNull.Value ? Convert.ToDateTime(SelectGRV["ConfirmedTime"]).ToShortDateString() : "-"; lblReceivedBy.Text = (string)SelectGRV["ReceivedBy"]; lblRecieptDate.Text = ((DateTime)SelectGRV["ReceivedTime"]).ToShortDateString(); lblInsurance.Text = SelectGRV["InsuranceNumber"] == DBNull.Value ? "" : (string)SelectGRV["InsuranceNumber"]; //to handle STVNumber entry receipt.LoadByPrimaryKey(ReceiptID); NoSelection.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; Selection.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; layoutSTVNo.Enabled = true; if (receipt.ReceiptTypeID == ReceiptType.CONSTANTS.DELIVERY_NOTE) { var newInvoiceNo = receipt.GetNewInvoiceNoForConvertedDeliveryNote(); txtSTVNo.EditValue = newInvoiceNo != string.Empty ? newInvoiceNo : string.Empty; layoutSTVNo.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; layoutSTVNo.Enabled = false; } else { layoutSTVNo.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; } } else { ResetForm(); } }
public void Select(int receiptID) { receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(receiptID); btnSave.Enabled = receipt.ReceiptStatusID == ReceiptConfirmationStatus.Constants.GRNF_PRINTED && this.HasPermission("Save"); btnConfirm.Enabled =btnReturn.Enabled = receipt.ReceiptStatusID == ReceiptConfirmationStatus.Constants.PRICE_CALCULATED && this.HasPermission("Confirmation"); grdDetail.DataSource = receipt.GetGRVDetailsforCosting(); }
private void btnInvoice_Click(object sender, EventArgs e) { BLL.Receipt GRV = new BLL.Receipt(); GRV.LoadByPrimaryKey(ReceiptID); ReceiptInvoice invoice = new ReceiptInvoice(); invoice.LoadByPrimaryKey(GRV.ReceiptInvoiceID); ReceiptInvoiceDialog InvoiceDialog = new ReceiptInvoiceDialog(invoice.POID, invoice.ID); InvoiceDialog.ShowDialog(); LoadSelectedGRVDetailForCostBuildUp(ReceiptID); }
public void Select(int receiptID) { receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(receiptID); btnSave.Enabled = receipt.ReceiptStatusID == ReceiptConfirmationStatus.Constants.GRNF_PRINTED && this.HasPermission("Save"); btnConfirm.Enabled = btnReturn.Enabled = receipt.ReceiptStatusID == ReceiptConfirmationStatus.Constants.PRICE_CALCULATED && this.HasPermission("Confirmation"); grdDetail.DataSource = receipt.GetGRVDetailsforCosting(); }
private void simpleButton1_Click(object sender, EventArgs e) { var receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(ReceiptID); var data = BLL.PO.GetOrderSummary(receipt.ReceiptInvoiceID); var orderSummary = new OrderSummary { DataSource = data }; orderSummary.ShowPreview(); }
private void ReturnFromGRVPrinting() { int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); var receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(ReceiptID); receiveDoc.ConfirmGRNFPrinted(null); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.PRICE_CALCULATED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Return For Price Change"); BindFormContents(); this.LogActivity("Return-SRM-To-Costing", ReceiptID); }
private void btnSave_Click(object sender, EventArgs e) { GRV.SaveInsurance(); GRV.SaveCostCoefficientAndTotalValue(CurrentContext.UserId); //ToDo: Remove this When it is safe and Ready for deployement. GRV.RecordAverageCostAndSellingPrice(CurrentContext.UserId); print(); BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); BLL.Receipt receiptStatus = new BLL.Receipt(); if (!BLL.Settings.UseReceiveCostConfirmation && PONumber.StartsWith("S2S-")) { if (SetFinalCost()) { recDoc.ConfirmGRVPrinted(CurrentContext.UserId); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "StoreToStore Confirmed"); } } else if (BLL.Settings.UseReceiveCostConfirmation) { recDoc.SetPrice(CurrentContext.UserId); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.PRICE_CALCULATED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Price Set"); } else { recDoc.ConfirmPrice(CurrentContext.UserId); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.PRICE_CONFIRMED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Price Set"); } XtraMessageBox.Show("Received Cost and Margin Set successfully!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); PutAwayListsLoad(null, null); this.LogActivity("Print-Cost-Analysis", ReceiptID); }
private void ConfirmQuantityAndLocation() { MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr(); transaction.BeginTransaction(); try { PalletLocation pl = new PalletLocation(); DataRow dr = gridReceiveView.GetFocusedDataRow(); if (dr == null) { throw new Exception("Nothing to confirm!"); } int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); if (gridDetailView.DataSource == null) { return; } BLL.ReceiveDoc receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptIDWithReceivePallet(ReceiptID); while (!receiveDoc.EOF) { int palletLocationID = Convert.ToInt32(receiveDoc.GetColumn("PalletLocationID")); pl.LoadByPrimaryKey(palletLocationID); pl.Confirmed = true; pl.Save(); receiveDoc.MoveNext(); } BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); recDoc.ConfirmQuantityAndLocation(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.RECEIVE_QUANTITY_CONFIRMED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Receive Confirmed"); transaction.CommitTransaction(); XtraMessageBox.Show("Receipt Confirmed!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); BindFormContents(); } catch (Exception exp) { transaction.RollbackTransaction(); XtraMessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSTV_Click(object sender, EventArgs e) { BLL.Receipt receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(ReceiptID); receipt.STVOrInvoiceNo = txtSTVNo.EditValue.ToString(); receipt.Save(); ReceiptInvoice invoice = new ReceiptInvoice(); invoice.LoadByPrimaryKey(receipt.ReceiptInvoiceID); invoice.STVOrInvoiceNo = txtSTVNo.EditValue.ToString(); invoice.Save(); this.LogActivity("Set-New-STV-No", ReceiptID); XtraMessageBox.Show("STV Number has been saved"); }
//TODO: Definitly going to BLL but i don't have time to do a clean job here. #region Void Process private void btnVoid_Click(object sender, EventArgs e) { int receiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"].ToString()); if (BLL.Receipt.AreThereIssues(receiptID)) { XtraMessageBox.Show("There are issues with this GRV. You can't void it."); return; } var grv = new ReceiptConfirmationPrintout(); grv.Where.ReceiptID.Value = receiptID; grv.Query.Load(); if (grv.IsColumnNull("VoidRequest") || !grv.VoidRequest) { XtraMessageBox.Show("Void needs to be first requested.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if ( XtraMessageBox.Show(UserLookAndFeel.Default, "Are you sure, you want to Void the Document?", "Are you sure:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { while (!grv.EOF) { grv.IsVoided = true; grv.VoidApprovedByUserID = CurrentContext.UserId; grv.VoidApprovalDateTime = DateTimeHelper.ServerDateTime; grv.MoveNext(); } grv.Save(); ReturnToStoreForQuantityEdit(); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.DRAFT_RECEIPT, null, this.GetFormIdentifier(), CurrentContext.UserId, "GRV Voided"); this.LogActivity("Approve-Receipt-Void", ReceiptID); } }
private static ReceiptConfirmationShortagePrintout PrintReceiptConfirmationForShortage(int receiptID, int printedID, FiscalYear fiscalYear) { var printout = new ReceiptConfirmationShortagePrintout(); var rc = new BLL.ReceiptConfirmationPrintout(); var receiveDoc = new ReceiveDoc(); var receipt = new BLL.Receipt(); receiveDoc.LoadByReceiptID(receiptID); receipt.LoadByPrimaryKey(receiptID); var referenceNumber = receiveDoc.RefNo; if (receipt.ReceiptTypeID == ReceiptType.CONSTANTS.STANDARD_RECEIPT) { rc.PrepareDataForPrintout(receiptID, CurrentContext.UserId, true, 2, printedID, null, fiscalYear); printout.DataSource = rc.DefaultView.ToTable(); } return(printout); }
private void PassReceiveForQtyConfirmation() { if (gridReceiveView.GetFocusedDataRow() != null) { String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); if (gridDetailView.DataSource == null) { return; } BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReferenceNo(reference); recDoc.SetStatusAsReceived(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Quantity edited"); XtraMessageBox.Show("Receipt forwarded for quantity confirmation!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); BindFormContents(); } }
internal void SetStatusConfirmQuantityAndLocation(int receiveID, int?userID) { LoadByReceiveDocID(receiveID); BLL.ReceiveDoc rcDoc = new ReceiveDoc(); BLL.Receipt rct = new Receipt(); rcDoc.LoadByPrimaryKey(receiveID); rct.LoadByPrimaryKey(rcDoc.ReceiptID); if (RowCount == 0) { AddNew(); ReceiveDocID = receiveID; } if (userID.HasValue) { ReceiptQuantityConfirmedByUserID = userID.Value; } ReceiptConfirmationStatusID = rct.ReceiptTypeID == BLL.ReceiptType.CONSTANTS.BEGINNING_BALANCE? ReceiptConfirmationStatus.Constants.GRV_PRINTED: ReceiptConfirmationStatus.Constants.RECEIVE_QUANTITY_CONFIRMED; Save(); }
public static Receipt CreateReceiptInvoiceAndReceiptForTransfer(int receiptTypeID, int POID, int warehouseID, int IDPrinted, int userID) { BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice(); rctInvoice.AddNew(); var po = new BLL.PO(); po.LoadByPrimaryKey(POID); var activityID = po.StoreID; //Enter Invoice Related Information //We should Save the STV Number Here rctInvoice.POID = POID; rctInvoice.STVOrInvoiceNo = IDPrinted.ToString("00000"); rctInvoice.ExchangeRate = 1; rctInvoice.Insurance = 0; rctInvoice.DateOfEntry = DateTimeHelper.ServerDateTime; rctInvoice.SavedByUserID = userID; rctInvoice.ActivityID = activityID; rctInvoice.IsDeliveryNote = false; rctInvoice.InvoiceTypeID = BLL.InvoiceType.InternalSTV; rctInvoice.PrintedDate = DateTimeHelper.ServerDateTime; rctInvoice.Rowguid = Guid.NewGuid(); rctInvoice.IsVoided = false; rctInvoice.ShippingSite = " "; rctInvoice.IsConvertedFromDeliveryNote = false; rctInvoice.DocumentTypeID = DocumentType.CONSTANTS.STV; rctInvoice.Save(); //Save the receipt BLL.Receipt receipt = new Receipt(); int receiptID = receipt.AddNewReceipt(receiptTypeID, warehouseID, userID, rctInvoice.ID, null, ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED); receipt.LoadByPrimaryKey(receiptID); return(receipt); }
private void ReturnToStoreForQuantityEdit() { //TODO: finish updating the changed locations MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr(); transaction.BeginTransaction(); try { PalletLocation pl = new PalletLocation(); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); if (gridDetailView.DataSource == null) return; BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); recDoc.SetStatusAsDraft(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.DRAFT_RECEIPT, null, this.GetFormIdentifier(), CurrentContext.UserId, "Returned To Draft"); transaction.CommitTransaction(); XtraMessageBox.Show("Receipt Returned!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); BindFormContents(); } catch (Exception exp) { transaction.RollbackTransaction(); XtraMessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void SaveTotalCost() { Receipt GRV = new Receipt(); GRV.LoadByPrimaryKey(ReceiptID); GRV.TotalValue = _SubTotal; GRV.Save(); }
private void gridReceiveView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { // Bind the detail grid PalletLocation pl = new PalletLocation(); if (e != null && e.PrevFocusedRowHandle < -1) return; try { DataRow dr = gridReceiveView.GetFocusedDataRow(); if (dr == null) return; ReceiptID = Convert.ToInt32(dr["ReceiptID"]); BLL.Receipt receiptDoc = new BLL.Receipt(); receiptDoc.LoadByPrimaryKey(ReceiptID); DataTable GRNFDetail = receiptDoc.GetDetailsForGRNF(); if (GRNFDetail.Rows.Count > 0) { //var store = new Store(); //store. BLL.PO order = new BLL.PO(); //var Mode = new Mode(); //Mode.LoadByPrimaryKey(order.ModeID); //lblMode.Text = Mode.TypeName; HeaderSection.Text = GRNFDetail.Rows[0]["PONumber"].ToString(); lblRecieveStatus.Text = dr["recieveStatus"].ToString(); lblReceiptNo.Text = dr["ReceiptNo"].ToString(); lblRecievedBy.Text = dr["ReceivedBy"].ToString(); lblRecievedDate.Text = Convert.ToDateTime(dr["Date"]).ToShortDateString(); lblReciveType.Text = (dr["ReceiveType"]).ToString(); lblWayBill.Text = (dr["WayBillNo"]).ToString()!="" ? dr["WayBillNo"].ToString() : "-"; lblTransferVoucherNo.Text = (dr["transferNo"]).ToString() != "" ? dr["transferNo"].ToString() : "-"; var warehouse = new BLL.Warehouse(); warehouse.LoadByPrimaryKey(receiptDoc.WarehouseID); lblWarehouse.Text = warehouse.Name; lblSupplier.Text = dr["Supplier"].ToString(); var cluster = new BLL.Cluster(); cluster.LoadByPrimaryKey(warehouse.ClusterID); lblCluster.Text = cluster.Name; lblDocType.Text =""; lblPoType.Text = dr["POType"].ToString(); //var ps = new BLL.PhysicalStore(); //ps.LoadByPrimaryKey(order.p); //lblStore.Text = ps.Name; txtOrderNo.EditValue = GRNFDetail.Rows[0]["PONumber"]; lblPoNumber.Text = GRNFDetail.Rows[0]["PONumber"].ToString(); lblInvoiceNumber.Text = receiptDoc.STVOrInvoiceNo; lblInsurancePolicy.Text = receiptDoc.InsurancePolicyNo!=""?receiptDoc.InsurancePolicyNo : "-"; var activity = new Activity(); activity.LoadByPrimaryKey(Convert.ToInt32(GRNFDetail.Rows[0]["ActivityID"])); txtActivity.EditValue = activity.FullActivityName; lblActivity.Text = activity.Name; lblSubAccount.Text = activity.SubAccountName; lblMode.Text = activity.ModeName; lblAccount.Text = activity.AccountName; gridDetails.DataSource = GRNFDetail; } if (ReceiveDoc.IsThereShortageOrDamage(ReceiptID)) { gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF(); } } catch { gridDetails.DataSource = null; } }
/// <summary> /// Gets the pick list details for order. /// </summary> /// <param name="ordID">The ord ID.</param> /// <param name="Preparedby">The preparedby.</param> /// <returns></returns> public DataView GetPickListDetailsForOrder(int ordID, string Preparedby) { this.LoadByOrderID(ordID); var query = HCMIS.Repository.Queries.PickList.SelectGetPickListDetailsForOrder(this.ID); this.LoadFromRawSql(query); // Add important columns this.DataTable.Columns.Add("SKUTOPICK", typeof(decimal)); this.DataTable.Columns.Add("SKUPICKED", typeof(decimal)); this.DataTable.Columns.Add("BUPICKED", typeof(decimal)); this.DataTable.Columns.Add("BoxSizeDisplay"); this.DataTable.Columns.Add("SKUBU", typeof(decimal)); this.DataTable.Columns.Add("IsManufacturerLocal", typeof(bool)); this.DataTable.Columns.Add("PrintedSTVNumber", typeof(string)); this.DataTable.Columns.Add("PhysicalStoreName", typeof(string)); this.DataTable.Columns.Add("PhysicalStoreTypeID", typeof(int)); this.DataTable.Columns.Add("PhysicalStoreTypeName", typeof(string)); this.DataTable.Columns.Add("PreparedBy", typeof(string)); int i = 1; while (!this.EOF) { decimal packs = Convert.ToDecimal(this.GetColumn("Packs")); int manufacturer = Convert.ToInt32(this.GetColumn("ManufacturerID")); Manufacturer m = new Manufacturer(); m.LoadByPrimaryKey(manufacturer); if (!m.IsColumnNull("CountryOfOrigin") && m.CountryOfOrigin.Contains("Ethiopia")) this.SetColumn("IsManufacturerLocal", true); else this.SetColumn("IsManufacturerLocal", false); int recPalletID = Convert.ToInt32(this.GetColumn("ReceivePalletID")); ReceivePallet rp = new ReceivePallet(); rp.LoadByPrimaryKey(recPalletID); try { ReceiveDoc receiveDoc = new ReceiveDoc(); Receipt receipt = new Receipt(); receiveDoc.LoadByPrimaryKey(rp.ReceiveID); receipt.LoadByPrimaryKey(receiveDoc.ReceiptID); this.SetColumn("PhysicalStoreName", rp.GetPhysicalStoreName()); int physicalStoreTypeID = rp.GetPhysicalStoreTypeID(); this.SetColumn("PhysicalStoreTypeID", physicalStoreTypeID); Warehouse phyStoreType = new Warehouse(); phyStoreType.LoadByPrimaryKey(physicalStoreTypeID); this.SetColumn("PhysicalStoreTypeName", phyStoreType.Name); if (BLL.Settings.PrintUserNameOnInvoice) { this.SetColumn("PreparedBy", Preparedby); } } catch { } int itemId = Convert.ToInt32(this.GetColumn("ItemID")); int boxLevel = Convert.ToInt32(this.GetColumn("BoxLevel")); decimal qtyPerPack = this.Getint("QtyPerPack"); //im.LoadIMbyLevel(itemId, manufacturer, boxLevel); this.SetColumn("SKUTOPICK", (packs)); this.SetColumn("SKUPICKED", this.GetColumn("SKUTOPICK")); // TODO:show the box size here for Program store this.SetColumn("BoxSizeDisplay", ""); this.SetColumn("SKUBU", qtyPerPack); this.SetColumn("BUPICKED", qtyPerPack * Convert.ToDecimal(this.GetColumn("SKUPICKED"))); this.SetColumn("LineNum", i++); if (this.IsColumnNull("DeliveryNote")) { this.SetColumn("DeliveryNote", false); } this.MoveNext(); } return this.DefaultView; }
/// <summary> /// /// </summary> /// <param name="refNo"></param> /// <param name="userID"></param> /// <param name="shortageAndDamage"></param> /// <param name="preGRVOrGRVOrSRM">1-PreGRV, 2-GRV, 3-SRM, 4-iGRV, 5-DeliveryNote</param> /// <param name="IDToBePrintedOut">Only applicable for the shortage where we need to show the same ID</param> /// <returns></returns> public int PrepareDataForPrintout(int ReceiptID, int?userID, bool shortageAndDamage, int preGRVOrGRVOrSRM, int?IDToBePrintedOut, int?isReprintOfRCPrintoutID, FiscalYear fiscalYear) { string query = ""; if (!shortageAndDamage && preGRVOrGRVOrSRM != 3) { query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintout(ReceiptID, StorageType.Quaranteen); } else if (preGRVOrGRVOrSRM == 3)//SRM { BLL.ReceiveDoc rd = new ReceiveDoc(); rd.LoadAllByReceiptID(ReceiptID); if (rd.IsColumnNull("ReturnedFromIssueDocID")) //This is an SRM done for an issue from the old system. (The issue was done using the old system) { query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintoutIssueDone(ReceiptID); } else //This is a normal SRM (Both the issue and the receive were done using this system) { query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintoutIssueAndReceiveDone(ReceiptID); } } else { //Cost Calculations should be removed from the query below query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintout(ReceiptID); } this.LoadFromRawSql(query); if (this.RowCount == 0) { if (ReceiveDoc.IsThereShortageOrDamage(ReceiptID)) { query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintout(ReceiptID); this.LoadFromRawSql(query); } if (this.RowCount == 0) { throw new Exception("No Data To Print, please receive Document before Trying again"); } } this.Rewind(); this.AddColumn("LineNum", typeof(int)); this.AddColumn("PrintedGRVNumber", typeof(string)); BLL.Receipt receipt = new Receipt(); int receiptID = int.Parse(this.GetColumn("ReceiptID").ToString()); receipt.LoadByPrimaryKey(receiptID); int receiptTypeID = receipt.ReceiptTypeID; int printedGRVNumber; int lineNum = 1; int totalItems = 0; BLL.ReceiptConfirmationPrintout rcp = new ReceiptConfirmationPrintout(); int?supplierID = null; if (preGRVOrGRVOrSRM != 3) { supplierID = this.SupplierID; } if (IDToBePrintedOut.HasValue) { printedGRVNumber = IDToBePrintedOut.Value; } else { printedGRVNumber = rcp.AddNew(this.StoreID, supplierID, receiptTypeID == 2 ? null : userID, receipt.ID, preGRVOrGRVOrSRM, isReprintOfRCPrintoutID); } if (!IDToBePrintedOut.HasValue) //We want to save a new receipt confirmation printout only when a new ID is generated (Not when an ID to be printed has been passed as a parameter) { //For delivery note only, we don't save the saved by user id so that we don't say GRV has been printed. } while (!this.EOF) { this.SetColumn("LineNum", lineNum); lineNum++; this.SetColumn("PrintedGRVNumber", fiscalYear.GetCode(printedGRVNumber)); totalItems++; this.MoveNext(); } return(printedGRVNumber); }
private void PassReceiveForQtyConfirmation() { if (gridReceiveView.GetFocusedDataRow() != null) { String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); if (gridDetailView.DataSource == null) return; BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReferenceNo(reference); recDoc.SetStatusAsReceived(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Quantity edited"); XtraMessageBox.Show("Receipt forwarded for quantity confirmation!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); BindFormContents(); } }
private void ConfirmQuantityAndLocation() { MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr(); transaction.BeginTransaction(); try { PalletLocation pl = new PalletLocation(); DataRow dr = gridReceiveView.GetFocusedDataRow(); if (dr == null) { throw new Exception("Nothing to confirm!"); } int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); if (gridDetailView.DataSource == null) return; BLL.ReceiveDoc receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptIDWithReceivePallet(ReceiptID); while (!receiveDoc.EOF) { int palletLocationID = Convert.ToInt32(receiveDoc.GetColumn("PalletLocationID")); pl.LoadByPrimaryKey(palletLocationID); pl.Confirmed = true; pl.Save(); receiveDoc.MoveNext(); } BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); recDoc.ConfirmQuantityAndLocation(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.RECEIVE_QUANTITY_CONFIRMED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Receive Confirmed"); transaction.CommitTransaction(); XtraMessageBox.Show("Receipt Confirmed!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); BindFormContents(); } catch (Exception exp) { transaction.RollbackTransaction(); XtraMessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private HCMIS.Desktop.Reports.ReceiptConfirmationPrintout PrintReceiptConfirmation(int ReceiptID, int?reprintOfReceiptConfirmationPrintoutID) { ReceiptConfirmationPrintout rc = new ReceiptConfirmationPrintout(); HCMIS.Desktop.Reports.ReceiptConfirmationPrintout printout = new HCMIS.Desktop.Reports.ReceiptConfirmationPrintout(CurrentContext.LoggedInUserName); BLL.ReceiveDoc receiveDoc = new ReceiveDoc(); // receiveDoc.LoadByReferenceNo(reference); receiveDoc.LoadByReceiptID(ReceiptID); var activity = new Activity(); activity.LoadByPrimaryKey(receiveDoc.StoreID); BLL.Supplier supplier = new Supplier(); supplier.LoadByPrimaryKey(receiveDoc.SupplierID); BLL.Receipt receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(receiveDoc.ReceiptID); BLL.ReceiptInvoice receiptInvoice = new ReceiptInvoice(); receiptInvoice.LoadByPrimaryKey(receipt.ReceiptInvoiceID); BLL.PO po = new PO(); po.LoadByPrimaryKey(receiptInvoice.POID); BLL.POType poType = new POType(); poType.LoadByPrimaryKey(po.PurchaseType); int printedID = 0; string GRNFNo = FiscalYear.Current.GetCode(BLL.ReceiptConfirmationPrintout.GetGRNFNo(ReceiptID)); if (currentMode == Modes.GRVPrinting) //The GRVConfirmation is for reprinting { printout.BranchName.Text = GeneralInfo.Current.HospitalName; PrepareGRVPrintout(printout); // String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); if (poType.PurchaseOrderTypeCode == "LP") { printout.xrGRVLabel.Text = "GRV No."; } else { printout.xrGRVLabel.Text = "iGRV No."; } if (supplier.SupplierTypeID == SupplierType.CONSTANTS.HOME_OFFICE || supplier.SupplierTypeID == SupplierType.CONSTANTS.HUBS || supplier.SupplierTypeID == SupplierType.CONSTANTS.ACCOUNTS || supplier.SupplierTypeID == SupplierType.CONSTANTS.STORES) { //printout.xrGRVLabel.Text = "iGRV No."; printout.xrAir.Visible = false; printout.xrAirValue.Visible = false; printout.xrTransit.Visible = false; printout.xrTransitValue.Visible = false; printout.xrInsurance.Visible = false; printout.xrInsuranceValue.Visible = false; printout.xrNumberOfCases.Visible = false; printout.xrNumberOfCasesValue.Visible = false; printout.xrInvoiceNo.Text = "STV No."; printout.xrPurchaseOrderNo.Visible = false; printout.xrPurchaseOrderNoValue.Visible = false; printout.xrLabelGRNF.Text = GRNFNo; printout.xrSTV.Visible = false; printout.xrSTVNoValue.Visible = false; printedID = rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, false, 4, null, reprintOfReceiptConfirmationPrintoutID, FiscalYear.Current); printout.DataSource = rc.DefaultView.ToTable(); CalendarLib.DateTimePickerEx dtDate = new CalendarLib.DateTimePickerEx(); //dtDate.CustomFormat = "dd/MM/yyyy"; dtDate.Value = receiveDoc.EurDate; printout.Date.Text = dtDate.Text; } else { // printout.xrGRVLabel.Text = "GRV No."; printout.xrSTV.Visible = false; printout.xrSTVNoValue.Visible = false; printedID = rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, false, 2, null, reprintOfReceiptConfirmationPrintoutID, FiscalYear.Current); printout.xrLabelGRNF.Text = GRNFNo; printout.DataSource = rc.DefaultView.ToTable(); CalendarLib.DateTimePickerEx dtDate = new CalendarLib.DateTimePickerEx(); //dtDate.CustomFormat = "dd/MM/yyyy"; dtDate.Value = receiveDoc.EurDate; printout.Date.Text = dtDate.Text; } } printout.xrLabelStoreName.Text = activity.FullActivityName; if (ReceiveDoc.IsThereShortageOrDamage(ReceiptID)) { HCMIS.Desktop.Reports.ReceiptConfirmationShortagePrintout printoutShortage = PrintReceiptConfirmationForShortage(ReceiptID, printedID); if (currentMode == Modes.GRVPrinting) { PrepareGRVPrintout(printoutShortage); } printout.xrShortageReport.ReportSource = printoutShortage; printout.PrintingSystem.ContinuousPageNumbering = true; } else { printout.ReportFooter.Visible = false; } //Release Product CostCalculator GRV = new CostCalculator(); GRV.LoadGRV(ReceiptID); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); recDoc.ConfirmGRVPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "GRV Printed"); BindFormContents(); // LOG Cost Analysis printout in PDF Log MemoryStream stream = new MemoryStream(); printout.ExportToPdf(stream); HCMIS.Core.Distribution.Services.PrintLogService.SavePrintLogNoWait(stream, "GRV/IGRV", true, ReceiptID, CurrentContext.UserId, BLL.DateTimeHelper.ServerDateTime); return(printout); }
public static Receipt CreateReceiptInvoiceAndReceiptForTransfer(int receiptTypeID, int POID, int warehouseID, int IDPrinted, int userID) { BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice(); rctInvoice.AddNew(); var po = new BLL.PO(); po.LoadByPrimaryKey(POID); var activityID = po.StoreID; //Enter Invoice Related Information //We should Save the STV Number Here rctInvoice.POID = POID; rctInvoice.STVOrInvoiceNo = IDPrinted.ToString("00000"); rctInvoice.ExchangeRate = 1; rctInvoice.Insurance = 0; rctInvoice.DateOfEntry = DateTimeHelper.ServerDateTime; rctInvoice.SavedByUserID = userID; rctInvoice.ActivityID = activityID; rctInvoice.IsDeliveryNote = false; rctInvoice.InvoiceTypeID = BLL.InvoiceType.InternalSTV; rctInvoice.PrintedDate = DateTimeHelper.ServerDateTime; rctInvoice.Rowguid = Guid.NewGuid(); rctInvoice.IsVoided = false; rctInvoice.ShippingSite = " "; rctInvoice.IsConvertedFromDeliveryNote = false; rctInvoice.DocumentTypeID = DocumentType.CONSTANTS.STV; rctInvoice.Save(); //Save the receipt BLL.Receipt receipt = new Receipt(); int receiptID = receipt.AddNewReceipt(receiptTypeID, warehouseID, userID, rctInvoice.ID, null, ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED); receipt.LoadByPrimaryKey(receiptID); return receipt; }
public static Receipt CreateAutomaticReceiptInvoiceForSTVTransfer(int POID, int warehouseID, int IDPrinted, int userID) { BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice(); rctInvoice.AddNew(); //Enter Invoice Related Information //We should Save the STV Number Here rctInvoice.POID = POID; rctInvoice.STVOrInvoiceNo = IDPrinted.ToString("00000"); rctInvoice.ExchangeRate = 1; rctInvoice.Insurance = 0; rctInvoice.DateOfEntry = DateTimeHelper.ServerDateTime; rctInvoice.IsDeliveryNote = false; rctInvoice.Save(); //Save the receipt BLL.Receipt receipt = new Receipt(); int receiptID = receipt.AddNewReceipt(BLL.ReceiptType.CONSTANTS.STANDARD_RECEIPT, warehouseID, userID, rctInvoice.ID, null, ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED); receipt.LoadByPrimaryKey(receiptID); return receipt; }
private void gridReceiveView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { // Bind the detail grid PalletLocation pl = new PalletLocation(); try { ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); BLL.Receipt receiptDoc = new BLL.Receipt(); var rd = new ReceiveDoc(); rd.LoadByReceiptID(ReceiptID); var ps = new PhysicalStore(); ps.LoadByPrimaryKey(rd.PhysicalStoreID); var w = new BLL.Warehouse(); w.LoadByPrimaryKey(ps.PhysicalStoreTypeID); lblWarehouse.Text = w.Name ?? "-"; var c = new Cluster(); c.LoadByPrimaryKey(w.ClusterID); lblCluster.Text = c.Name ?? "-"; receiptDoc.LoadByPrimaryKey(ReceiptID); DataTable GRNFDetail = receiptDoc.GetDetailsForGRNF(); gridDetails.DataSource = GRNFDetail; gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF(); int status = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["Status"]); var SelectGRV = gridReceiveView.GetFocusedDataRow(); lblMode.Text = (string)SelectGRV["ModeName"]; lblAccount.Text = (string)SelectGRV["AccountName"]; lblSubAccount.Text = (string)SelectGRV["SubAccountName"]; lblActivity.Text = (string)SelectGRV["ActivityName"]; lblSupplier.Text = (string)SelectGRV["SupplierName"]; lblPONumber.Text = (string)SelectGRV["PONo"]; lblType.Text = (string)SelectGRV["ReceiptType"]; lblStatus.Text = (string)SelectGRV["CurrentStatus"]; var lgs = new LogReceiptStatus(); lgs.LoadByReceiptID(ReceiptID); lblCalculatedDate.Text = lgs.StatusChangedDate.ToShortDateString(); var user = new User(); if (SelectGRV["calculatedBy"] != DBNull.Value) { user.LoadByPrimaryKey(Convert.ToInt32(SelectGRV["calculatedBy"])); lblCalculatedBy.Text = user.FullName; } else { lblCalculatedBy.Text = "-"; } lblCostConfirmedBy.Text = SelectGRV["confirmedBy"] != DBNull.Value ? SelectGRV["confirmedBy"].ToString() : "-"; //lblGRVNumber.Text = reference; //lblRecivedDate.Text = ((DateTime)SelectGRV["Date"]).ToShortDateString(); lblCostConfirmedDate.Text = SelectGRV["confirmedDate"] != DBNull.Value ? Convert.ToDateTime(SelectGRV["confirmedDate"]).ToShortDateString() : "-"; string s = ""; int length = ((string)SelectGRV["STVOrInvoiceNo"]).Length; string grv = (Convert.ToInt32(SelectGRV["IDPrinted"])).ToString(); HeaderGroup.Text = "Invoice No: " + (string)SelectGRV["STVOrInvoiceNo"] + s.PadRight(240 - length) + "GRV No: " + grv; //ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); //ds = new DataSet(); //DataTable dvMaster = pl.GetDetailsOfByReceiptID(ReceiptID); //dvMaster.TableName = "Master"; //ds.Tables.Add(dvMaster); //gridDetails.DataSource = ds.Tables[dvMaster.TableName]; //var receipt = new BLL.Receipt(); //receipt.LoadByPrimaryKey(ReceiptID); //int receiptTypeID = receipt.ReceiptTypeID; if (currentMode == Modes.GRVPrinting) { if (status != ReceiptConfirmationStatus.Constants.PRICE_CONFIRMED) { gridDetails.Enabled = false; btnConfirm.Enabled = false; btnPrint.Enabled = false; btnReturn.Enabled = false; } else { gridDetails.Enabled = true; btnConfirm.Enabled = true; btnPrint.Enabled = true; btnReturn.Enabled = true; } } } catch { gridDetails.DataSource = null; gridShortage.DataSource = null; } }
private void btnPrint_Click(object sender, EventArgs e) { DataRow dataRow = gridReceiveView.GetFocusedDataRow(); if (dataRow != null) { if (Convert.ToInt32(dataRow["ReceiptConfirmationStatusID"]) == ReceiptConfirmationStatus.Constants.RECEIVE_QUANTITY_CONFIRMED) { ReceiptID = Convert.ToInt32(dataRow["ReceiptID"]); PrintDialog printDialog = new PrintDialog(); printDialog.PrinterSettings.Copies = BLL.Settings.GRNFCopies; DialogResult dialogResult = printDialog.ShowDialog(); if (dialogResult != DialogResult.OK) { MessageBox.Show("Printing Canceled by user", "Cancel Printint...", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } TransactionMgr transaction = TransactionMgr.ThreadTransactionMgr(); XtraReport printout; try { transaction.BeginTransaction(); printout = WorkflowReportFactory.CreateGRNFPrintout(ReceiptID, null, false, FiscalYear.Current); var receipt = new BLL.Receipt(ReceiptID); var recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); if (receipt.ReceiptInvoice.PO.PurchaseType == BLL.POType.STORE_TO_STORE_TRANSFER || !BLL.Settings.HandleGRV) { recDoc.ConfirmGRVPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Transfer Confirmed"); } else { recDoc.ConfirmGRNFPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRNF_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "GRNF Printed"); } transaction.CommitTransaction(); } catch (Exception exception) { transaction.RollbackTransaction(); XtraMessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } for (int i = 0; i < printDialog.PrinterSettings.Copies; i++) { printout.Print(printDialog.PrinterSettings.PrinterName); } ReceiptConfirmation_Load(null, null); } else { XtraMessageBox.Show("The selected receipt has to be confirmed before GRNF is printed!", "ERROR", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } } }
private void gridReceiveView_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e) { // Bind the detail grid var pl = new PalletLocation(); ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); try { //B1A data var SelectGRV = gridReceiveView.GetFocusedDataRow(); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); lblGRVNo.Text = reference; lblMode.Text = (string)SelectGRV["ModeName"]; lblAccount.Text = (string)SelectGRV["AccountName"]; lblSubAccount.Text = (string)SelectGRV["SubAccountName"]; lblActivity.Text = (string)SelectGRV["ActivityName"]; lblSupplier.Text = (string)SelectGRV["SupplierName"]; lblPoNumber.Text = (string)SelectGRV["PONo"]; lblCluster.Text = (string)SelectGRV["ClusterName"]; lblWarehouse.Text = (string)SelectGRV["WarehouseName"]; lblStore.Text = (string)SelectGRV["PhysicalStoreName"]; lblType.Text = (string)SelectGRV["ReceiptType"]; lblStatus.Text = (string)SelectGRV["ReceiptStatus"]; var logReceiptStatus = new LogReceiptStatus(); var dtHistory = logReceiptStatus.GetLogHistory(ReceiptID, "PRC"); if (dtHistory != null && dtHistory.Count > 0) { lblCalculatedBy.Text = (string)dtHistory[0]["FullName"]; lblCalculatedDate.Text = ((DateTime)dtHistory[0]["Date"]).ToShortDateString(); } else { lblCalculatedDate.Text = lblCalculatedBy.Text = "-"; } var receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(Convert.ToInt32(SelectGRV["ReceiptID"])); lblConfirmedDate.Text = receiveDoc.ConfirmedDateTime.ToString() != "" ? receiveDoc.ConfirmedDateTime.ToShortDateString() : "-"; lblConfirmedBy.Text = SelectGRV["confirmedBy"] != DBNull.Value ? SelectGRV["confirmedBy"].ToString() : "-"; lblGRVNumber.Text = reference; lblRecivedDate.Text = ((DateTime)SelectGRV["Date"]).ToShortDateString(); // lblConfirmedDate.Text =SelectGRV["confirmedDate"] != DBNull.Value ? Convert.ToDateTime(SelectGRV["confirmedDate"]).ToShortDateString() : "-"; ds = new DataSet(); DataTable dvMaster = pl.GetDetailsOfByReceiptID(ReceiptID); dvMaster.TableName = "Master"; ds.Tables.Add(dvMaster); gridDetails.DataSource = ds.Tables[dvMaster.TableName]; int status = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["Status"]); try { StoreID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["StoreID"]); } catch { } var receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(ReceiptID); int receiptTypeID = receipt.ReceiptTypeID; } catch { gridDetails.DataSource = null; } //reset btnCancelVoidRequest.Enabled = true; btnVoidRequest.Enabled = true; btnVoid.Enabled = true; btnReprintGRV.Enabled = true; if (Convert.ToBoolean(gridReceiveView.GetFocusedDataRow()["isreprint"].ToString())) { btnReprintGRV.Enabled = false; } if (Convert.ToBoolean(gridReceiveView.GetFocusedDataRow()["hasreprint"].ToString())) { btnCancelVoidRequest.Enabled = false; btnVoidRequest.Enabled = false; btnVoid.Enabled = false; } }
private void btnVoid_Click(object sender, EventArgs e) { int receiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"].ToString()); if (BLL.Receipt.AreThereIssues(receiptID)) { XtraMessageBox.Show("There are issues with this GRV. You can't void it."); return; } var grv = new ReceiptConfirmationPrintout(); grv.Where.ReceiptID.Value = receiptID; grv.Query.Load(); if (grv.IsColumnNull("VoidRequest") || !grv.VoidRequest) { XtraMessageBox.Show("Void needs to be first requested.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if ( XtraMessageBox.Show(UserLookAndFeel.Default, "Are you sure, you want to Void the Document?", "Are you sure:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { while (!grv.EOF) { grv.IsVoided = true; grv.VoidApprovedByUserID = CurrentContext.UserId; grv.VoidApprovalDateTime = DateTimeHelper.ServerDateTime; grv.MoveNext(); } grv.Save(); ReturnToStoreForQuantityEdit(); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.DRAFT_RECEIPT, null, this.GetFormIdentifier(), CurrentContext.UserId, "GRV Voided"); this.LogActivity("Approve-Receipt-Void", ReceiptID); } }
private void btnPrint_Click(object sender, EventArgs e) { DataRow dataRow = gridReceiveView.GetFocusedDataRow(); if (dataRow != null) { if (Convert.ToInt32(dataRow["ReceiptConfirmationStatusID"]) == ReceiptConfirmationStatus.Constants.RECEIVE_QUANTITY_CONFIRMED) { ReceiptID = Convert.ToInt32(dataRow["ReceiptID"]); PrintDialog printDialog = new PrintDialog(); printDialog.PrinterSettings.Copies = BLL.Settings.GRNFCopies; DialogResult dialogResult = printDialog.ShowDialog(); if (dialogResult != DialogResult.OK) { MessageBox.Show("Printing Canceled by user", "Cancel Printint...", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } TransactionMgr transaction = TransactionMgr.ThreadTransactionMgr(); XtraReport printout; try { transaction.BeginTransaction(); printout = WorkflowReportFactory.CreateGRNFPrintout(ReceiptID, null, false, FiscalYear.Current); var receipt = new BLL.Receipt(ReceiptID); var recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); if (receipt.ReceiptInvoice.PO.PurchaseType == BLL.POType.STORE_TO_STORE_TRANSFER || !BLL.Settings.HandleGRV) { recDoc.ConfirmGRVPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Transfer Confirmed"); } else { recDoc.ConfirmGRNFPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRNF_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "GRNF Printed"); } transaction.CommitTransaction(); } catch (Exception exception) { transaction.RollbackTransaction(); XtraMessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } for (int i = 0; i < printDialog.PrinterSettings.Copies; i++) { printout.Print( printDialog.PrinterSettings.PrinterName); } ReceiptConfirmation_Load(null, null); } else { XtraMessageBox.Show("The selected receipt has to be confirmed before GRNF is printed!", "ERROR", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } } }
private void SaveReceive() { // Merge all Receives with Same Item information and Assigned to Same PhysicalStore as One Item , Quantity Sumed UP! MergeReceiveDocLines(); BLL.ReceiveDoc rec = new ReceiveDoc(); ////int receiptTypeID = srm //// ? ReceiptType.CONSTANTS.STOCK_RETURN //// : (deliveryNoteType != DeliveryNoteType.NotSet) //// ? ReceiptType.CONSTANTS.DELIVERY_NOTE //// : beginningBalance //// ? ReceiptType.CONSTANTS.BEGINNING_BALANCE //// : ReceiptType.CONSTANTS.STANDARD_RECEIPT; int receiptID; int warehouseID = Convert.ToInt32(lkWarehouse.EditValue); receiptID = SaveRelevantReceiptHeaders(_receiptTypeID, warehouseID); DataTable zeroQuantitiesDueToMultipleBatch = null; DataRow [] zeroQuantityRows = _dtRecGrid.Select(string.Format("[Pack Qty] = 0"),"[Ordering] ASC "); if (zeroQuantityRows.Any() && zeroQuantityRows.Any(r => r["ShortageReasonID"] == DBNull.Value)) { zeroQuantityRows = CheckAndRemoveIfFullNotReceiveEntry(zeroQuantityRows); if (zeroQuantityRows.Any()) zeroQuantitiesDueToMultipleBatch = zeroQuantityRows.Where(r => r["ShortageReasonID"] == DBNull.Value).CopyToDataTable(); } var mergeableTables = _dtRecGrid.Select(string.Format("[Pack Qty] > 0 "), "[Ordering] ASC "); DataTable mergedDataTable = null; if (mergeableTables.Any()) { mergedDataTable = _dtRecGrid.Select(string.Format("[Pack Qty] > 0 "), "[Ordering] ASC ").CopyToDataTable(); if (zeroQuantitiesDueToMultipleBatch != null) mergedDataTable.Merge(zeroQuantitiesDueToMultipleBatch); if (grdShortageOrDamaged.DataSource != null) { var shortageOrDamage = (DataTable) grdShortageOrDamaged.DataSource; mergedDataTable.Merge(shortageOrDamage); } } else { if (grdShortageOrDamaged.DataSource != null) { var shortageOrDamage = (DataTable)grdShortageOrDamaged.DataSource; if (zeroQuantitiesDueToMultipleBatch != null) shortageOrDamage.Merge(zeroQuantitiesDueToMultipleBatch); //~ {"[ShortageReasonID] ASC} --> Just to give priority among shortages to Damaged reasons as we will create a receiveDoc entry for this ~// mergedDataTable = mergedDataTable == null ? shortageOrDamage.Select(string.Format("[Pack Qty] >= 0 "), "[ShortageReasonID] ASC ").CopyToDataTable() : shortageOrDamage; } } foreach (DataRowView dr in mergedDataTable.DefaultView) { var shortageReasonID = dr["ShortageReasonID"]; var onlyOneEntryFound = _dtRecGrid.Select(String.Format("GUID = '{0}'", dr["GUID"])); bool zeroQtyDueTomultipleBatchFound = (Convert.ToDecimal(dr["Pack Qty"]) == 0) && (shortageReasonID == DBNull.Value) && (onlyOneEntryFound.Count() == 1); bool fullNotReceivedEntry = (Convert.ToDecimal(dr["BU Qty"]) == 0) && (shortageReasonID != DBNull.Value) && (Convert.ToInt32(shortageReasonID) == ShortageReasons.Constants.NOT_RECEIVED) && (onlyOneEntryFound.Count() == 1); if (fullNotReceivedEntry) { dr["Pack Qty"] = 0; } var item = new Item(); item.LoadByPrimaryKey(Convert.ToInt32(dr["ID"])); if (item.NeedExpiryBatch || (shortageReasonID == DBNull.Value && ((dr["Expiry Date"] != DBNull.Value) && (Convert.ToDateTime(dr["Expiry Date"]) <= DateTimeHelper.ServerDateTime)))) { var expDate = Convert.ToDateTime(dr["Expiry Date"]); if ((shortageReasonID == DBNull.Value && expDate > DateTimeHelper.ServerDateTime) || zeroQtyDueTomultipleBatchFound) { AddNewReceiveDoc(rec, receiptID, dr); } else { //for physically Damaged receives and expired receives if ((shortageReasonID != DBNull.Value && Convert.ToInt32(shortageReasonID) == ShortageReasons.Constants.DAMAGED) || (shortageReasonID == DBNull.Value && expDate <= DateTimeHelper.ServerDateTime) || fullNotReceivedEntry) { AddNewReceiveDoc(rec, receiptID, dr, true); if (shortageReasonID == DBNull.Value) { dr["ShortageReasonID"] = ShortageReasons.Constants.DAMAGED; } } else { HandleReceiveDocShortage(dr, rec); } } } else { if ((shortageReasonID == DBNull.Value) || zeroQtyDueTomultipleBatchFound) { AddNewReceiveDoc(rec, receiptID, dr); } else { //for physically Damaged receives if (shortageReasonID != DBNull.Value && Convert.ToInt32(shortageReasonID) == ShortageReasons.Constants.DAMAGED || fullNotReceivedEntry) { AddNewReceiveDoc(rec, receiptID, dr, true); } else { HandleReceiveDocShortage(dr, rec); } } } } rec.SetStatusAsReceived(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(receiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Received"); if (!BLL.Settings.HandleGRV) //If HandleGRV is true, the price isn't entered in the receive stage meaning { rec.Rewind(); while (!rec.EOF) { if (!ReceiveDoc.DoesPriceNeedToBeChanged(rec.StoreID, rec.ItemID, rec.UnitID, rec.ManufacturerId) && (deliveryNoteType == DeliveryNoteType.NotSet)) { rec.SellingPrice = rec.Cost; rec.UnitCost = Convert.ToDecimal(rec.Cost); // Added by Heny In order to display Unit Cost on Vaccine rec.Margin = 0; } rec.MoveNext(); } } rec.Save(); //TODO: To be removed after the ShortageReasonID in receviedoc is discontinued. //SavePalletization(rdDamaged); _revDocRelatePalletGuid.Clear(); }
private void PrintReceiptConfirmation(string referenceNumber, int?reprintOfReceiptConfirmationPrintoutID) { var rc = new ReceiptConfirmationPrintout(); var srmPrintout = new HCMIS.Desktop.Reports.SRMPrintout(CurrentContext.LoggedInUserName); int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); var receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(ReceiptID); ReceiptConfirmationPrintout.GetGRNFNo(ReceiptID); srmPrintout.BranchName.Text = GeneralInfo.Current.HospitalName; rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, false, 3, null, reprintOfReceiptConfirmationPrintoutID, FiscalYear.Current); srmPrintout.DataSource = rc.DefaultView.ToTable(); var rUnit = new Institution(); var idoc = new IssueDoc(); if (!receiveDoc.IsColumnNull("ReturnedFromIssueDocID")) { idoc.LoadByPrimaryKey(receiveDoc.ReturnedFromIssueDocID); rUnit.LoadByPrimaryKey(idoc.ReceivingUnitID); } else { var po = new PO(); po.LoadByReceiptID(receiveDoc.ReceiptID); rUnit.LoadByPrimaryKey(int.Parse(po.RefNo)); } srmPrintout.xrFromValue.Text = rUnit.Name; srmPrintout.xrWoredaValue.Text = rUnit.WoredaText; srmPrintout.xrRegionValue.Text = rUnit.Region; srmPrintout.xrZoneValue.Text = rUnit.ZoneText; if (!receiveDoc.IsColumnNull("ReturnedFromIssueDocID")) { var stvLog = new BLL.Issue(); stvLog.LoadByPrimaryKey(idoc.STVID); srmPrintout.xrIssueDateValue.Text = idoc.Date.ToString("M/d/yyyy"); var activity = new Activity(); activity.LoadByPrimaryKey(idoc.StoreId); srmPrintout.xrAccountName.Text = activity.FullActivityName; var rct = new BLL.Receipt(); rct.LoadByPrimaryKey(ReceiptID); var rctInvoice = new ReceiptInvoice(); rctInvoice.LoadByPrimaryKey(rct.ReceiptInvoiceID); srmPrintout.xrSTVNoValue.Text = rctInvoice.STVOrInvoiceNo; } else { var activity = new Activity(); activity.LoadByPrimaryKey(receiveDoc.StoreID); srmPrintout.xrAccountName.Text = activity.FullActivityName; srmPrintout.xrSTVNoValue.Text = receiveDoc.RefNo; } var dtDate = new DateTimePickerEx(); dtDate.Value = receiveDoc.EurDate; srmPrintout.Date.Text = dtDate.Text; if (srmPrintout.PrintDialog() != DialogResult.OK) { throw new Exception("Print cancelled by user!"); } //Successfully printed //Release Product var GRV = new CostCalculator(); GRV.LoadGRV(ReceiptID); GRV.ReleaseForIssue(); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); var recDoc = new ReceiveDoc(); recDoc.LoadByReferenceNo(reference); recDoc.ConfirmGRVPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "GRV Printed"); BindFormContents(); }
/// <summary> /// /// </summary> /// <param name="refNo"></param> /// <param name="userID"></param> /// <param name="shortageAndDamage"></param> /// <param name="preGRVOrGRVOrSRM">1-PreGRV, 2-GRV, 3-SRM, 4-iGRV, 5-DeliveryNote</param> /// <param name="IDToBePrintedOut">Only applicable for the shortage where we need to show the same ID</param> /// <returns></returns> public int PrepareDataForPrintout(int ReceiptID, int? userID, bool shortageAndDamage, int preGRVOrGRVOrSRM, int? IDToBePrintedOut, int? isReprintOfRCPrintoutID,FiscalYear fiscalYear) { string query = ""; if (!shortageAndDamage && preGRVOrGRVOrSRM != 3) { query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintout(ReceiptID, StorageType.Quaranteen); } else if (preGRVOrGRVOrSRM == 3)//SRM { BLL.ReceiveDoc rd = new ReceiveDoc(); rd.LoadAllByReceiptID(ReceiptID); if (rd.IsColumnNull("ReturnedFromIssueDocID")) //This is an SRM done for an issue from the old system. (The issue was done using the old system) { query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintoutIssueDone(ReceiptID); } else //This is a normal SRM (Both the issue and the receive were done using this system) { query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintoutIssueAndReceiveDone(ReceiptID); } } else { //Cost Calculations should be removed from the query below query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintout(ReceiptID); } this.LoadFromRawSql(query); if (this.RowCount == 0) { if (ReceiveDoc.IsThereShortageOrDamage(ReceiptID)) { query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintout(ReceiptID); this.LoadFromRawSql(query); } if (this.RowCount == 0) throw new Exception("No Data To Print, please receive Document before Trying again"); } this.Rewind(); this.AddColumn("LineNum", typeof(int)); this.AddColumn("PrintedGRVNumber", typeof(string)); BLL.Receipt receipt = new Receipt(); int receiptID = int.Parse(this.GetColumn("ReceiptID").ToString()); receipt.LoadByPrimaryKey(receiptID); int receiptTypeID = receipt.ReceiptTypeID; int printedGRVNumber; int lineNum = 1; int totalItems = 0; BLL.ReceiptConfirmationPrintout rcp = new ReceiptConfirmationPrintout(); int? supplierID = null; if (preGRVOrGRVOrSRM != 3) supplierID = this.SupplierID; if (IDToBePrintedOut.HasValue) { printedGRVNumber = IDToBePrintedOut.Value; } else { printedGRVNumber = rcp.AddNew(this.StoreID, supplierID, receiptTypeID == 2 ? null : userID, receipt.ID, preGRVOrGRVOrSRM, isReprintOfRCPrintoutID); } if (!IDToBePrintedOut.HasValue) //We want to save a new receipt confirmation printout only when a new ID is generated (Not when an ID to be printed has been passed as a parameter) { //For delivery note only, we don't save the saved by user id so that we don't say GRV has been printed. } while (!this.EOF) { this.SetColumn("LineNum", lineNum); lineNum++; this.SetColumn("PrintedGRVNumber", fiscalYear.GetCode(printedGRVNumber)); totalItems++; this.MoveNext(); } return printedGRVNumber; }
public void LoadByReceiptID(int receiptID) { BLL.Receipt rct = new Receipt(); rct.LoadByPrimaryKey(receiptID); BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice(); rctInvoice.LoadByPrimaryKey(rct.ReceiptInvoiceID); this.LoadByPrimaryKey(rctInvoice.POID); }
private void gridGRVs_MouseClick(object sender, MouseEventArgs e) { DataRow SelectGRV = gridGRVsView.GetFocusedDataRow(); if (SelectGRV != null) { ReceiptID = Convert.ToInt32(SelectGRV["ReceiptID"]); PONumber = Convert.ToString(SelectGRV["PONumber"]); LoadSelectedGRVDetailForInvoiceEntry(ReceiptID); BLL.Receipt receipt = new BLL.Receipt(); string s = ""; int length = ((string) SelectGRV["InvoiceNumber"]).Length; headerSection.Text = "Invoice No: " + (string)SelectGRV["InvoiceNumber"] + s.PadRight(180-length) + "GRNF No: " + (string)SelectGRV["RefNo"].ToString(); lblMode.Text = (string)SelectGRV["Mode"]; lblAccount.Text = (string)SelectGRV["AccountName"]; lblSubAccount.Text = (string)SelectGRV["SubAccountName"]; lblActivity.Text = (string)SelectGRV["ActivityName"]; lblWarehouse.Text = (string)SelectGRV["WarehouseName"]; lblCluster.Text = (string)SelectGRV["ClusterName"]; lblReceiptType.Text = (string)SelectGRV["ReceiveType"]; lblRecieptStatus.Text = (string)SelectGRV["ReceiveStatus"]; lblSupplier.Text = (string)SelectGRV["SupplierName"]; lblOrderNo.Text = (string)SelectGRV["PONumber"]; lblConfirmedBy.Text = SelectGRV["ConfirmedBy"] == DBNull.Value ? "-" : (string)SelectGRV["ConfirmedBy"]; lblConfirmedDate.Text = SelectGRV["ConfirmedTime"] != DBNull.Value ? Convert.ToDateTime(SelectGRV["ConfirmedTime"]).ToShortDateString() : "-"; lblReceivedBy.Text = (string)SelectGRV["ReceivedBy"]; lblRecieptDate.Text = ((DateTime)SelectGRV["ReceivedTime"]).ToShortDateString(); lblInsurance.Text = SelectGRV["InsuranceNumber"] == DBNull.Value ? "" : (string)SelectGRV["InsuranceNumber"]; //to handle STVNumber entry receipt.LoadByPrimaryKey(ReceiptID); NoSelection.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; Selection.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; layoutSTVNo.Enabled = true; if (receipt.ReceiptTypeID == ReceiptType.CONSTANTS.DELIVERY_NOTE) { var newInvoiceNo = receipt.GetNewInvoiceNoForConvertedDeliveryNote(); txtSTVNo.EditValue = newInvoiceNo != string.Empty ? newInvoiceNo : string.Empty; layoutSTVNo.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; layoutSTVNo.Enabled = false; } else { layoutSTVNo.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; } } else { ResetForm(); } }
private void gridReceiveView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { // Bind the detail grid PalletLocation pl = new PalletLocation(); try { ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); BLL.Receipt receiptDoc = new BLL.Receipt(); var rd = new ReceiveDoc(); rd.LoadByReceiptID(ReceiptID); var ps = new PhysicalStore(); ps.LoadByPrimaryKey(rd.PhysicalStoreID); var w = new BLL.Warehouse(); w.LoadByPrimaryKey(ps.PhysicalStoreTypeID); lblWarehouse.Text = w.Name ?? "-"; var c = new Cluster(); c.LoadByPrimaryKey(w.ClusterID); lblCluster.Text = c.Name ?? "-"; receiptDoc.LoadByPrimaryKey(ReceiptID); DataTable GRNFDetail = receiptDoc.GetDetailsForGRNF(); gridDetails.DataSource = GRNFDetail; gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF(); int status = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["Status"]); var SelectGRV = gridReceiveView.GetFocusedDataRow(); lblMode.Text = (string)SelectGRV["ModeName"]; lblAccount.Text = (string)SelectGRV["AccountName"]; lblSubAccount.Text = (string)SelectGRV["SubAccountName"]; lblActivity.Text = (string)SelectGRV["ActivityName"]; lblSupplier.Text = (string)SelectGRV["SupplierName"]; lblPONumber.Text = (string)SelectGRV["PONo"]; lblType.Text = (string)SelectGRV["ReceiptType"]; lblStatus.Text = (string)SelectGRV["CurrentStatus"]; var lgs = new LogReceiptStatus(); lgs.LoadByReceiptID(ReceiptID); lblCalculatedDate.Text = lgs.StatusChangedDate.ToShortDateString(); var user = new User(); if (SelectGRV["calculatedBy"] != DBNull.Value) { user.LoadByPrimaryKey(Convert.ToInt32(SelectGRV["calculatedBy"])); lblCalculatedBy.Text = user.FullName; } else { lblCalculatedBy.Text = "-"; } lblCostConfirmedBy.Text = SelectGRV["confirmedBy"] != DBNull.Value ? SelectGRV["confirmedBy"].ToString() : "-"; //lblGRVNumber.Text = reference; //lblRecivedDate.Text = ((DateTime)SelectGRV["Date"]).ToShortDateString(); lblCostConfirmedDate.Text = SelectGRV["confirmedDate"] != DBNull.Value ? Convert.ToDateTime(SelectGRV["confirmedDate"]).ToShortDateString() : "-"; string s = ""; int length = ((string)SelectGRV["STVOrInvoiceNo"]).Length; string grv = (Convert.ToInt32(SelectGRV["IDPrinted"])).ToString(); HeaderGroup.Text = "Invoice No: " + (string)SelectGRV["STVOrInvoiceNo"] + s.PadRight(240 - length) + "GRV No: " + grv ; //ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); //ds = new DataSet(); //DataTable dvMaster = pl.GetDetailsOfByReceiptID(ReceiptID); //dvMaster.TableName = "Master"; //ds.Tables.Add(dvMaster); //gridDetails.DataSource = ds.Tables[dvMaster.TableName]; //var receipt = new BLL.Receipt(); //receipt.LoadByPrimaryKey(ReceiptID); //int receiptTypeID = receipt.ReceiptTypeID; if (currentMode == Modes.GRVPrinting) { if (status != ReceiptConfirmationStatus.Constants.PRICE_CONFIRMED) { gridDetails.Enabled = false; btnConfirm.Enabled = false; btnPrint.Enabled = false; btnReturn.Enabled = false; } else { gridDetails.Enabled = true; btnConfirm.Enabled = true; btnPrint.Enabled = true; btnReturn.Enabled = true; } } } catch { gridDetails.DataSource = null; gridShortage.DataSource = null; } }
private void LoadSelectedGRVDetailForInvoiceEntry(int ReceiptID) { //Display Correct Tab selectTab = grpTabInvoiceValue; FocusOnSelectedTab(); // Load The GRV First GRV = new CenterCostCalculator(); GRV.LoadGRV(ReceiptID); // Display the GRV Detail for Data Entry(Price Per Pack) //Please Make-up ur mind solution if (BLL.Settings.IsDamageIncludedOnTotalFOB) gridInvoiceDetail.DataSource = GRV.GRVDetail; else gridInvoiceDetail.DataSource = GRV.GRVSoundDetail; gridDiscrenpancy.DataSource = GRV.GRVDiscrepancyDetail; BLL.Receipt receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(ReceiptID); }
private HCMIS.Desktop.Reports.ReceiptConfirmationPrintout PrintReceiptConfirmation(int ReceiptID, int? reprintOfReceiptConfirmationPrintoutID) { ReceiptConfirmationPrintout rc = new ReceiptConfirmationPrintout(); HCMIS.Desktop.Reports.ReceiptConfirmationPrintout printout = new HCMIS.Desktop.Reports.ReceiptConfirmationPrintout(CurrentContext.LoggedInUserName); BLL.ReceiveDoc receiveDoc = new ReceiveDoc(); // receiveDoc.LoadByReferenceNo(reference); receiveDoc.LoadByReceiptID(ReceiptID); var activity = new Activity(); activity.LoadByPrimaryKey(receiveDoc.StoreID); BLL.Supplier supplier = new Supplier(); supplier.LoadByPrimaryKey(receiveDoc.SupplierID); BLL.Receipt receipt=new BLL.Receipt(); receipt.LoadByPrimaryKey(receiveDoc.ReceiptID); BLL.ReceiptInvoice receiptInvoice= new ReceiptInvoice(); receiptInvoice.LoadByPrimaryKey(receipt.ReceiptInvoiceID); BLL.PO po = new PO(); po.LoadByPrimaryKey(receiptInvoice.POID); BLL.POType poType = new POType(); poType.LoadByPrimaryKey(po.PurchaseType); int printedID = 0; string GRNFNo = FiscalYear.Current.GetCode(BLL.ReceiptConfirmationPrintout.GetGRNFNo(ReceiptID)); if (currentMode == Modes.GRVPrinting) //The GRVConfirmation is for reprinting { printout.BranchName.Text = GeneralInfo.Current.HospitalName; PrepareGRVPrintout(printout); // String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); if (poType.PurchaseOrderTypeCode == "LP") printout.xrGRVLabel.Text = "GRV No."; else printout.xrGRVLabel.Text = "iGRV No."; if (supplier.SupplierTypeID == SupplierType.CONSTANTS.HOME_OFFICE || supplier.SupplierTypeID == SupplierType.CONSTANTS.HUBS || supplier.SupplierTypeID == SupplierType.CONSTANTS.ACCOUNTS || supplier.SupplierTypeID == SupplierType.CONSTANTS.STORES) { //printout.xrGRVLabel.Text = "iGRV No."; printout.xrAir.Visible = false; printout.xrAirValue.Visible = false; printout.xrTransit.Visible = false; printout.xrTransitValue.Visible = false; printout.xrInsurance.Visible = false; printout.xrInsuranceValue.Visible = false; printout.xrNumberOfCases.Visible = false; printout.xrNumberOfCasesValue.Visible = false; printout.xrInvoiceNo.Text = "STV No."; printout.xrPurchaseOrderNo.Visible = false; printout.xrPurchaseOrderNoValue.Visible = false; printout.xrLabelGRNF.Text = GRNFNo; printout.xrSTV.Visible = false; printout.xrSTVNoValue.Visible = false; printedID = rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, false, 4, null,reprintOfReceiptConfirmationPrintoutID,FiscalYear.Current); printout.DataSource = rc.DefaultView.ToTable(); CalendarLib.DateTimePickerEx dtDate = new CalendarLib.DateTimePickerEx(); //dtDate.CustomFormat = "dd/MM/yyyy"; dtDate.Value = receiveDoc.EurDate; printout.Date.Text = dtDate.Text; } else { // printout.xrGRVLabel.Text = "GRV No."; printout.xrSTV.Visible = false; printout.xrSTVNoValue.Visible = false; printedID = rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, false, 2, null, reprintOfReceiptConfirmationPrintoutID,FiscalYear.Current); printout.xrLabelGRNF.Text = GRNFNo; printout.DataSource = rc.DefaultView.ToTable(); CalendarLib.DateTimePickerEx dtDate = new CalendarLib.DateTimePickerEx(); //dtDate.CustomFormat = "dd/MM/yyyy"; dtDate.Value = receiveDoc.EurDate; printout.Date.Text = dtDate.Text; } } printout.xrLabelStoreName.Text = activity.FullActivityName; if (ReceiveDoc.IsThereShortageOrDamage(ReceiptID)) { HCMIS.Desktop.Reports.ReceiptConfirmationShortagePrintout printoutShortage = PrintReceiptConfirmationForShortage(ReceiptID, printedID); if (currentMode == Modes.GRVPrinting) PrepareGRVPrintout(printoutShortage); printout.xrShortageReport.ReportSource = printoutShortage; printout.PrintingSystem.ContinuousPageNumbering = true; } else { printout.ReportFooter.Visible = false; } //Release Product CostCalculator GRV = new CostCalculator(); GRV.LoadGRV(ReceiptID); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); recDoc.ConfirmGRVPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "GRV Printed"); BindFormContents(); // LOG Cost Analysis printout in PDF Log MemoryStream stream = new MemoryStream(); printout.ExportToPdf(stream); HCMIS.Core.Distribution.Services.PrintLogService.SavePrintLogNoWait(stream, "GRV/IGRV", true, ReceiptID, CurrentContext.UserId, BLL.DateTimeHelper.ServerDateTime); return printout; }
/// <summary> /// Gets the pick list details for order. /// </summary> /// <param name="ordID">The ord ID.</param> /// <param name="Preparedby">The preparedby.</param> /// <returns></returns> public DataView GetPickListDetailsForOrder(int ordID, string Preparedby) { this.LoadByOrderID(ordID); var query = HCMIS.Repository.Queries.PickList.SelectGetPickListDetailsForOrder(this.ID); this.LoadFromRawSql(query); // Add important columns this.DataTable.Columns.Add("SKUTOPICK", typeof(decimal)); this.DataTable.Columns.Add("SKUPICKED", typeof(decimal)); this.DataTable.Columns.Add("BUPICKED", typeof(decimal)); this.DataTable.Columns.Add("BoxSizeDisplay"); this.DataTable.Columns.Add("SKUBU", typeof(decimal)); this.DataTable.Columns.Add("IsManufacturerLocal", typeof(bool)); this.DataTable.Columns.Add("PrintedSTVNumber", typeof(string)); this.DataTable.Columns.Add("PhysicalStoreName", typeof(string)); this.DataTable.Columns.Add("PhysicalStoreTypeID", typeof(int)); this.DataTable.Columns.Add("PhysicalStoreTypeName", typeof(string)); this.DataTable.Columns.Add("PreparedBy", typeof(string)); int i = 1; while (!this.EOF) { decimal packs = Convert.ToDecimal(this.GetColumn("Packs")); int manufacturer = Convert.ToInt32(this.GetColumn("ManufacturerID")); Manufacturer m = new Manufacturer(); m.LoadByPrimaryKey(manufacturer); if (!m.IsColumnNull("CountryOfOrigin") && m.CountryOfOrigin.Contains("Ethiopia")) { this.SetColumn("IsManufacturerLocal", true); } else { this.SetColumn("IsManufacturerLocal", false); } int recPalletID = Convert.ToInt32(this.GetColumn("ReceivePalletID")); ReceivePallet rp = new ReceivePallet(); rp.LoadByPrimaryKey(recPalletID); try { ReceiveDoc receiveDoc = new ReceiveDoc(); Receipt receipt = new Receipt(); receiveDoc.LoadByPrimaryKey(rp.ReceiveID); receipt.LoadByPrimaryKey(receiveDoc.ReceiptID); this.SetColumn("PhysicalStoreName", rp.GetPhysicalStoreName()); int physicalStoreTypeID = rp.GetPhysicalStoreTypeID(); this.SetColumn("PhysicalStoreTypeID", physicalStoreTypeID); Warehouse phyStoreType = new Warehouse(); phyStoreType.LoadByPrimaryKey(physicalStoreTypeID); this.SetColumn("PhysicalStoreTypeName", phyStoreType.Name); if (BLL.Settings.PrintUserNameOnInvoice) { this.SetColumn("PreparedBy", Preparedby); } } catch { } int itemId = Convert.ToInt32(this.GetColumn("ItemID")); int boxLevel = Convert.ToInt32(this.GetColumn("BoxLevel")); decimal qtyPerPack = this.Getint("QtyPerPack"); //im.LoadIMbyLevel(itemId, manufacturer, boxLevel); this.SetColumn("SKUTOPICK", (packs)); this.SetColumn("SKUPICKED", this.GetColumn("SKUTOPICK")); // TODO:show the box size here for Program store this.SetColumn("BoxSizeDisplay", ""); this.SetColumn("SKUBU", qtyPerPack); this.SetColumn("BUPICKED", qtyPerPack * Convert.ToDecimal(this.GetColumn("SKUPICKED"))); this.SetColumn("LineNum", i++); if (this.IsColumnNull("DeliveryNote")) { this.SetColumn("DeliveryNote", false); } this.MoveNext(); } return(this.DefaultView); }
public void SaveInsurance() { Receipt GRV = new Receipt(); GRV.LoadByPrimaryKey(ReceiptID); GRV.Insurance = _Insurance; GRV.Provision = _OtherExpense; GRV.Save(); }
private void PrintReceiptConfirmation(string referenceNumber, int? reprintOfReceiptConfirmationPrintoutID) { var rc = new ReceiptConfirmationPrintout(); var srmPrintout = new HCMIS.Desktop.Reports.SRMPrintout(CurrentContext.LoggedInUserName); int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); var receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(ReceiptID); ReceiptConfirmationPrintout.GetGRNFNo(ReceiptID); srmPrintout.BranchName.Text = GeneralInfo.Current.HospitalName; rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, false, 3, null, reprintOfReceiptConfirmationPrintoutID,FiscalYear.Current); srmPrintout.DataSource = rc.DefaultView.ToTable(); var rUnit = new Institution(); var idoc = new IssueDoc(); if (!receiveDoc.IsColumnNull("ReturnedFromIssueDocID")) { idoc.LoadByPrimaryKey(receiveDoc.ReturnedFromIssueDocID); rUnit.LoadByPrimaryKey(idoc.ReceivingUnitID); } else { var po = new PO(); po.LoadByReceiptID(receiveDoc.ReceiptID); rUnit.LoadByPrimaryKey(int.Parse(po.RefNo)); } srmPrintout.xrFromValue.Text = rUnit.Name; srmPrintout.xrWoredaValue.Text = rUnit.WoredaText; srmPrintout.xrRegionValue.Text = rUnit.Region; srmPrintout.xrZoneValue.Text = rUnit.ZoneText; if (!receiveDoc.IsColumnNull("ReturnedFromIssueDocID")) { var stvLog = new BLL.Issue(); stvLog.LoadByPrimaryKey(idoc.STVID); srmPrintout.xrIssueDateValue.Text = idoc.Date.ToString("M/d/yyyy"); var activity = new Activity(); activity.LoadByPrimaryKey(idoc.StoreId); srmPrintout.xrAccountName.Text = activity.FullActivityName; var rct = new BLL.Receipt(); rct.LoadByPrimaryKey(ReceiptID); var rctInvoice = new ReceiptInvoice(); rctInvoice.LoadByPrimaryKey(rct.ReceiptInvoiceID); srmPrintout.xrSTVNoValue.Text = rctInvoice.STVOrInvoiceNo; } else { var activity = new Activity(); activity.LoadByPrimaryKey(receiveDoc.StoreID); srmPrintout.xrAccountName.Text = activity.FullActivityName; srmPrintout.xrSTVNoValue.Text = receiveDoc.RefNo; } var dtDate = new DateTimePickerEx(); dtDate.Value = receiveDoc.EurDate; srmPrintout.Date.Text = dtDate.Text; if (srmPrintout.PrintDialog() != DialogResult.OK) { throw new Exception("Print cancelled by user!"); } //Successfully printed //Release Product var GRV = new CostCalculator(); GRV.LoadGRV(ReceiptID); GRV.ReleaseForIssue(); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); var recDoc = new ReceiveDoc(); recDoc.LoadByReferenceNo(reference); recDoc.ConfirmGRVPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "GRV Printed"); BindFormContents(); }
private void gridReceiveView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { // Bind the detail grid PalletLocation pl = new PalletLocation(); if (e != null && e.PrevFocusedRowHandle < -1) return; string warehouseName = string.Empty; try { var dr = gridReceiveView.GetFocusedDataRow(); if (dr == null) return; ReceiptID = Convert.ToInt32(dr["ReceiptID"]); var receiptDoc = new BLL.Receipt(); var receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(ReceiptID); receiptDoc.LoadByPrimaryKey(ReceiptID); var GRNFDetail = receiptDoc.GetDetailsForGRNF(); if (GRNFDetail.Rows.Count > 0) { txtOrderNo.EditValue = dr["PONumber"] == DBNull.Value ? "-" : dr["PONumber"]; lblPONo.Text = (dr["PONumber"] == DBNull.Value ? "-" : dr["PONumber"].ToString()); lblCluster.Text = dr["ClusterName"] == DBNull.Value ? "-" : dr["ClusterName"].ToString(); txtWarehouse.EditValue = lblWarehouse.Text = warehouseName = dr["WarehouseName"] == DBNull.Value ? "-" : dr["WarehouseName"].ToString(); var receiptInvoice = new ReceiptInvoice(receiptDoc.ReceiptInvoiceID); txtInvoiceNo.EditValue = lblInvoiceNo.Text = String.IsNullOrEmpty(receiptInvoice.STVOrInvoiceNo) ? "-" : receiptInvoice.STVOrInvoiceNo; txtInsurance.EditValue = lblInsurancePolicy.Text = String.IsNullOrEmpty(receiptInvoice.InsurancePolicyNo) ? "-" : receiptInvoice.InsurancePolicyNo; txtTransfer.EditValue = lblTransferVoucherNo.Text = String.IsNullOrEmpty(receipt.TransitTransferNo) ? "-" : receipt.TransitTransferNo; txtWayBill.EditValue = lblWayBill.Text = String.IsNullOrEmpty(receiptInvoice.WayBillNo) ? "-" : receiptInvoice.WayBillNo; var activity = new Activity(); activity.LoadByPrimaryKey(Convert.ToInt32(dr["StoreID"])); txtActivity.EditValue = activity.FullActivityName; lblActivity.Text = String.IsNullOrEmpty(activity.Name) ? "-" : activity.Name; lblSubAccount.Text = String.IsNullOrEmpty(activity.SubAccountName) ? "-" : activity.SubAccountName; lblAccount.Text = String.IsNullOrEmpty(activity.AccountName) ? "-" : activity.AccountName; lblMode.Text = String.IsNullOrEmpty(activity.ModeName) ? "-" : activity.ModeName; lblReceiveType.Text = dr["ReceiptType"] == DBNull.Value ? "-" : dr["ReceiptType"].ToString(); lblReceiveStatus.Text = dr["Status"] == DBNull.Value ? "-" : dr["Status"].ToString(); lblDocumentType.Text = dr["DocumentType"] == DBNull.Value ? "-" : dr["DocumentType"].ToString(); lblPOType.Text = dr["POType"] == DBNull.Value ? "-" : dr["POType"].ToString(); lblPaymentType.Text = dr["PaymentType"] == DBNull.Value ? "-" : dr["PaymentType"].ToString(); lblReceiptNo.Text = dr["ReceiptNo"] == DBNull.Value ? "-" : dr["ReceiptNo"].ToString(); lblSupplier.Text = dr["Supplier"] == DBNull.Value ? "-" : dr["Supplier"].ToString(); var user = new User(); user.LoadByPrimaryKey(receiptDoc.SavedByUserID); lblReceivedBy.Text = String.IsNullOrEmpty(user.FullName) ? "-" : user.FullName; var receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(ReceiptID); lblReceivedDate.Text = receiptDoc.IsColumnNull("DateOfEntry") ? "-" :receiveDoc.EurDate.ToShortDateString(); lblConfirmedDate.Text = receiveDoc.IsColumnNull("ConfirmedDateTime") ? "-" : receiveDoc.ConfirmedDateTime.ToShortDateString(); if (!receiveDoc.IsColumnNull("ConfirmedByUserID")) { user.LoadByPrimaryKey(receiveDoc.ConfirmedByUserID); lblConfirmedBy.Text = String.IsNullOrEmpty(user.FullName) ? "-" : user.FullName; } else { lblConfirmedBy.Text = "-"; } var space = string.Empty; var length = warehouseName.Length; HeaderGroup.Text = warehouseName + space.PadRight(180 - length) + "Invoice No: " + receiptInvoice.STVOrInvoiceNo; } gridDetails.DataSource = GRNFDetail; gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF(); } catch { gridDetails.DataSource = null; } }
public static XtraReport PrintReceiptConfirmation(string printedBy, int receiptID, int?previousReceiptConfirmationPrintoutID, bool forExporting, FiscalYear fiscalYear) { var rcPrevious = new BLL.ReceiptConfirmationPrintout(); int?idToBePrintedOut = null; if (forExporting && previousReceiptConfirmationPrintoutID.HasValue) { rcPrevious.LoadByPrimaryKey(previousReceiptConfirmationPrintoutID.Value); idToBePrintedOut = rcPrevious.IDPrinted; } var rc = new BLL.ReceiptConfirmationPrintout(); var printout = new HCMIS.Desktop.Reports.ReceiptConfirmationPrintout(printedBy); var srmPrintout = new HCMIS.Desktop.Reports.SRMPrintout(printedBy); var receiveDoc = new ReceiveDoc(); var receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(receiptID); receiveDoc.LoadByReceiptID(receiptID); var referenceNumber = receiveDoc.RefNo; var activity = new Activity(); activity.LoadByPrimaryKey(receiveDoc.StoreID); var supplier = new Supplier(); supplier.LoadByPrimaryKey(receiveDoc.SupplierID); int printedID = 0; string GRNFNo = fiscalYear.GetCode(BLL.ReceiptConfirmationPrintout.GetGRNFNo(receiptID)); if (receipt.ReceiptTypeID == ReceiptType.CONSTANTS.STANDARD_RECEIPT || receipt.ReceiptTypeID == ReceiptType.CONSTANTS.DELIVERY_NOTE || receipt.ReceiptTypeID == ReceiptType.CONSTANTS.ACCOUNT_TO_ACCOUNT_TRANSFER) { if (!String.IsNullOrEmpty(GeneralInfo.Current.HospitalName)) { printout.BranchName.Text = GeneralInfo.Current.HospitalName; } else { throw new Exception("Branch name could not be read from the database."); } PrepareGRVPrintout(printout); // String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); if (supplier.SupplierTypeID == SupplierType.CONSTANTS.HOME_OFFICE || supplier.SupplierTypeID == SupplierType.CONSTANTS.HUBS || supplier.SupplierTypeID == SupplierType.CONSTANTS.ACCOUNTS || supplier.SupplierTypeID == SupplierType.CONSTANTS.STORES) { printout.xrGRVLabel.Text = "iGRV No."; printout.xrAir.Visible = false; printout.xrAirValue.Visible = false; printout.xrTransit.Visible = false; printout.xrTransitValue.Visible = false; printout.xrInsurance.Visible = false; printout.xrInsuranceValue.Visible = false; printout.xrNumberOfCases.Visible = false; printout.xrNumberOfCasesValue.Visible = false; printout.xrInvoiceNo.Text = "STV No."; printout.xrPurchaseOrderNo.Visible = false; printout.xrPurchaseOrderNoValue.Visible = false; printout.xrLabelGRNF.Text = GRNFNo; printout.xrSTV.Visible = false; printout.xrSTVNoValue.Visible = false; printedID = rc.PrepareDataForPrintout(receiptID, CurrentContext.UserId, false, 4, idToBePrintedOut, previousReceiptConfirmationPrintoutID, fiscalYear); printout.DataSource = rc.DefaultView.ToTable(); var dtDate = new DateTimePickerEx(); //dtDate.CustomFormat = "dd/MM/yyyy"; dtDate.Value = receiveDoc.EurDate; printout.Date.Text = dtDate.Text; } else { printout.xrGRVLabel.Text = "GRV No."; printout.xrSTV.Visible = false; printout.xrSTVNoValue.Visible = false; printedID = rc.PrepareDataForPrintout(receiptID, CurrentContext.UserId, false, 2, idToBePrintedOut, previousReceiptConfirmationPrintoutID, fiscalYear); printout.xrLabelGRNF.Text = GRNFNo; printout.DataSource = rc.DefaultView.ToTable(); var dtDate = new DateTimePickerEx(); //dtDate.CustomFormat = "dd/MM/yyyy"; dtDate.Value = receiveDoc.EurDate; printout.Date.Text = dtDate.Text; } printout.xrLabelStoreName.Text = activity.FullActivityName; if (ReceiveDoc.IsThereShortageOrDamage(receiptID)) { ReceiptConfirmationShortagePrintout printoutShortage = PrintReceiptConfirmationForShortage(receiptID, printedID, fiscalYear); PrepareGRVPrintout(printoutShortage); printout.xrShortageReport.ReportSource = printoutShortage; printout.PrintingSystem.ContinuousPageNumbering = true; } else { printout.ReportFooter.Visible = false; } if (!forExporting) //If this is not for exporting, we print on paper. { if (printout.PrintDialog() != DialogResult.OK) { throw new Exception("Print cancelled by user!"); } } return(printout); } else if (receipt.ReceiptTypeID == ReceiptType.CONSTANTS.STOCK_RETURN) { if (!String.IsNullOrEmpty(GeneralInfo.Current.HospitalName)) { srmPrintout.BranchName.Text = GeneralInfo.Current.HospitalName; } rc.PrepareDataForPrintout(receiptID, CurrentContext.UserId, false, 3, idToBePrintedOut, previousReceiptConfirmationPrintoutID, fiscalYear); srmPrintout.DataSource = rc.DefaultView.ToTable(); var rUnit = new Institution(); var idoc = new IssueDoc(); if (!receiveDoc.IsColumnNull("ReturnedFromIssueDocID")) { idoc.LoadByPrimaryKey(receiveDoc.ReturnedFromIssueDocID); rUnit.LoadByPrimaryKey(idoc.ReceivingUnitID); } else { var po = new PO(); po.LoadByReceiptID(receiveDoc.ReceiptID); rUnit.LoadByPrimaryKey(int.Parse(po.RefNo)); } srmPrintout.xrFromValue.Text = rUnit.Name; srmPrintout.xrWoredaValue.Text = rUnit.WoredaText; srmPrintout.xrRegionValue.Text = rUnit.Region; srmPrintout.xrZoneValue.Text = rUnit.ZoneText; if (!receiveDoc.IsColumnNull("ReturnedFromIssueDocID")) { var stvLog = new Issue(); stvLog.LoadByPrimaryKey(idoc.STVID); var issuedActivity = new Activity(); issuedActivity.LoadByPrimaryKey(idoc.StoreId); srmPrintout.xrAccountName.Text = issuedActivity.FullActivityName; srmPrintout.xrSTVNoValue.Text = stvLog.IDPrinted.ToString("00000"); } else { srmPrintout.xrAccountName.Text = activity.FullActivityName;; srmPrintout.xrSTVNoValue.Text = receiveDoc.RefNo; } var dtDate = new DateTimePickerEx(); dtDate.Value = receiveDoc.EurDate; srmPrintout.Date.Text = dtDate.Text; if (!forExporting) { if (srmPrintout.PrintDialog() != DialogResult.OK) { throw new Exception("Print cancelled by user!"); } } return(srmPrintout); } else //TODO: Implement Delivery notes. { return(null); } }
private void gridReceiveView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { // Bind the detail grid PalletLocation pl = new PalletLocation(); if (e != null && e.PrevFocusedRowHandle < -1) { return; } string warehouseName = string.Empty; try { var dr = gridReceiveView.GetFocusedDataRow(); if (dr == null) { return; } ReceiptID = Convert.ToInt32(dr["ReceiptID"]); var receiptDoc = new BLL.Receipt(); var receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(ReceiptID); receiptDoc.LoadByPrimaryKey(ReceiptID); var GRNFDetail = receiptDoc.GetDetailsForGRNF(); if (GRNFDetail.Rows.Count > 0) { txtOrderNo.EditValue = dr["PONumber"] == DBNull.Value ? "-" : dr["PONumber"]; lblPONo.Text = (dr["PONumber"] == DBNull.Value ? "-" : dr["PONumber"].ToString()); lblCluster.Text = dr["ClusterName"] == DBNull.Value ? "-" : dr["ClusterName"].ToString(); txtWarehouse.EditValue = lblWarehouse.Text = warehouseName = dr["WarehouseName"] == DBNull.Value ? "-" : dr["WarehouseName"].ToString(); var receiptInvoice = new ReceiptInvoice(receiptDoc.ReceiptInvoiceID); txtInvoiceNo.EditValue = lblInvoiceNo.Text = String.IsNullOrEmpty(receiptInvoice.STVOrInvoiceNo) ? "-" : receiptInvoice.STVOrInvoiceNo; txtInsurance.EditValue = lblInsurancePolicy.Text = String.IsNullOrEmpty(receiptInvoice.InsurancePolicyNo) ? "-" : receiptInvoice.InsurancePolicyNo; txtTransfer.EditValue = lblTransferVoucherNo.Text = String.IsNullOrEmpty(receipt.TransitTransferNo) ? "-" : receipt.TransitTransferNo; txtWayBill.EditValue = lblWayBill.Text = String.IsNullOrEmpty(receiptInvoice.WayBillNo) ? "-" : receiptInvoice.WayBillNo; var activity = new Activity(); activity.LoadByPrimaryKey(Convert.ToInt32(dr["StoreID"])); txtActivity.EditValue = activity.FullActivityName; lblActivity.Text = String.IsNullOrEmpty(activity.Name) ? "-" : activity.Name; lblSubAccount.Text = String.IsNullOrEmpty(activity.SubAccountName) ? "-" : activity.SubAccountName; lblAccount.Text = String.IsNullOrEmpty(activity.AccountName) ? "-" : activity.AccountName; lblMode.Text = String.IsNullOrEmpty(activity.ModeName) ? "-" : activity.ModeName; lblReceiveType.Text = dr["ReceiptType"] == DBNull.Value ? "-" : dr["ReceiptType"].ToString(); lblReceiveStatus.Text = dr["Status"] == DBNull.Value ? "-" : dr["Status"].ToString(); lblDocumentType.Text = dr["DocumentType"] == DBNull.Value ? "-" : dr["DocumentType"].ToString(); lblPOType.Text = dr["POType"] == DBNull.Value ? "-" : dr["POType"].ToString(); lblPaymentType.Text = dr["PaymentType"] == DBNull.Value ? "-" : dr["PaymentType"].ToString(); lblReceiptNo.Text = dr["ReceiptNo"] == DBNull.Value ? "-" : dr["ReceiptNo"].ToString(); lblSupplier.Text = dr["Supplier"] == DBNull.Value ? "-" : dr["Supplier"].ToString(); var user = new User(); user.LoadByPrimaryKey(receiptDoc.SavedByUserID); lblReceivedBy.Text = String.IsNullOrEmpty(user.FullName) ? "-" : user.FullName; var receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(ReceiptID); lblReceivedDate.Text = receiptDoc.IsColumnNull("DateOfEntry") ? "-" :receiveDoc.EurDate.ToShortDateString(); lblConfirmedDate.Text = receiveDoc.IsColumnNull("ConfirmedDateTime") ? "-" : receiveDoc.ConfirmedDateTime.ToShortDateString(); if (!receiveDoc.IsColumnNull("ConfirmedByUserID")) { user.LoadByPrimaryKey(receiveDoc.ConfirmedByUserID); lblConfirmedBy.Text = String.IsNullOrEmpty(user.FullName) ? "-" : user.FullName; } else { lblConfirmedBy.Text = "-"; } var space = string.Empty; var length = warehouseName.Length; HeaderGroup.Text = warehouseName + space.PadRight(180 - length) + "Invoice No: " + receiptInvoice.STVOrInvoiceNo; } gridDetails.DataSource = GRNFDetail; gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF(); } catch { gridDetails.DataSource = null; } }
private void gridReceiveView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { // Bind the detail grid PalletLocation pl = new PalletLocation(); if (e != null && e.PrevFocusedRowHandle < -1) { return; } try { DataRow dr = gridReceiveView.GetFocusedDataRow(); if (dr == null) { return; } ReceiptID = Convert.ToInt32(dr["ReceiptID"]); BLL.Receipt receiptDoc = new BLL.Receipt(); receiptDoc.LoadByPrimaryKey(ReceiptID); DataTable GRNFDetail = receiptDoc.GetDetailsForGRNF(); if (GRNFDetail.Rows.Count > 0) { //var store = new Store(); //store. BLL.PO order = new BLL.PO(); //var Mode = new Mode(); //Mode.LoadByPrimaryKey(order.ModeID); //lblMode.Text = Mode.TypeName; HeaderSection.Text = GRNFDetail.Rows[0]["PONumber"].ToString(); lblRecieveStatus.Text = dr["recieveStatus"].ToString(); lblReceiptNo.Text = dr["ReceiptNo"].ToString(); lblRecievedBy.Text = dr["ReceivedBy"].ToString(); lblRecievedDate.Text = Convert.ToDateTime(dr["Date"]).ToShortDateString(); lblReciveType.Text = (dr["ReceiveType"]).ToString(); lblWayBill.Text = (dr["WayBillNo"]).ToString() != "" ? dr["WayBillNo"].ToString() : "-"; lblTransferVoucherNo.Text = (dr["transferNo"]).ToString() != "" ? dr["transferNo"].ToString() : "-"; var warehouse = new BLL.Warehouse(); warehouse.LoadByPrimaryKey(receiptDoc.WarehouseID); lblWarehouse.Text = warehouse.Name; lblSupplier.Text = dr["Supplier"].ToString(); var cluster = new BLL.Cluster(); cluster.LoadByPrimaryKey(warehouse.ClusterID); lblCluster.Text = cluster.Name; lblDocType.Text = ""; lblPoType.Text = dr["POType"].ToString(); //var ps = new BLL.PhysicalStore(); //ps.LoadByPrimaryKey(order.p); //lblStore.Text = ps.Name; txtOrderNo.EditValue = GRNFDetail.Rows[0]["PONumber"]; lblPoNumber.Text = GRNFDetail.Rows[0]["PONumber"].ToString(); lblInvoiceNumber.Text = receiptDoc.STVOrInvoiceNo; lblInsurancePolicy.Text = receiptDoc.InsurancePolicyNo != ""?receiptDoc.InsurancePolicyNo : "-"; var activity = new Activity(); activity.LoadByPrimaryKey(Convert.ToInt32(GRNFDetail.Rows[0]["ActivityID"])); txtActivity.EditValue = activity.FullActivityName; lblActivity.Text = activity.Name; lblSubAccount.Text = activity.SubAccountName; lblMode.Text = activity.ModeName; lblAccount.Text = activity.AccountName; gridDetails.DataSource = GRNFDetail; } if (ReceiveDoc.IsThereShortageOrDamage(ReceiptID)) { gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF(); } } catch { gridDetails.DataSource = null; } }
private void LoadData(int ReceiptID, int InvoiceID, int PoID) { //PO Cost Elements; purchaseOrder.LoadByPrimaryKey(PoID); Invoice.LoadByPrimaryKey(InvoiceID); GRV.LoadByPrimaryKey(ReceiptID); if (Invoice.IsColumnNull("InvoiceTypeID")) { Invoice.InvoiceTypeID = ReceiptInvoiceType.InvoiceType.NON_STANDARD; } if (Invoice.InvoiceTypeID == ReceiptInvoiceType.InvoiceType.INVOICE_SEA) { UseSeaFreight = true; } else { UseSeaFreight = false; } if (!purchaseOrder.IsColumnNull("TotalValue")) { PurchaseOrderTotal = purchaseOrder.TotalValue; } if (!purchaseOrder.IsColumnNull("AirFreight")) { PurchaseOrderAirFreight = purchaseOrder.AirFreight; } if (!purchaseOrder.IsColumnNull("SeaFreight")) { PurchaseOrderSeaFreight = purchaseOrder.SeaFreight; } if (!purchaseOrder.IsColumnNull("Insurance")) { PurchaseOrderInsurance = purchaseOrder.Insurance; } if (!purchaseOrder.IsColumnNull("NBE")) { PurcahseOrderNBE = purchaseOrder.NBE; } //Invoice Cost Elements; if (!Invoice.IsColumnNull("TotalValue")) { InvoiceTotal = Invoice.TotalValue; } if (!Invoice.IsColumnNull("AirFreight")) { InvoiceAirFreight = Invoice.AirFreight; } if (!Invoice.IsColumnNull("SeaFreight")) { InvoiceSeaFreight = Invoice.SeaFreight; } if (!Invoice.IsColumnNull("InlandFreight")) { InvoiceInlandFreight = Invoice.InlandFreight; } if (!Invoice.IsColumnNull("Insurance")) { InvoiceInsurance = Invoice.Insurance; } if (!Invoice.IsColumnNull("NBE")) { InvoiceNBE = Invoice.NBE; } if (!Invoice.IsColumnNull("CBE")) { InvoiceCBE = Invoice.CBE; } if (!Invoice.IsColumnNull("CustomDutyTax")) { InvoiceCustomDutyTax = Invoice.CustomDutyTax; } //GRV Cost Elements if (UseSeaFreight) { if (!GRV.IsColumnNull("SeaFreight")) { GRVSeaFreight = GRV.SeaFreight; } } else { if (!GRV.IsColumnNull("AirFreight")) { GRVAirFreight = GRV.AirFreight; } } if (!GRV.IsColumnNull("InlandFreight")) { GRVInlandFreight = GRV.InlandFreight; } if (!GRV.IsColumnNull("Insurance")) { GRVInsurance = GRV.Insurance; } if (!GRV.IsColumnNull("NBE")) { GRVNBE = GRV.NBE; } if (!GRV.IsColumnNull("CBE")) { GRVCBE = GRV.CBE; } if (!GRV.IsColumnNull("CustomDutyTax")) { GRVCustomDutyTax = GRV.CustomDutyTax; } if (!GRV.IsColumnNull("TransitServiceCharge")) { GRVTransit = GRV.TransitServiceCharge; } else { GRVTransit = UseTransitServiceCharge ? 250 : 0; } //if (!GRV.IsColumnNull("OtherExpenses")) // GRVOtherExpense = GRV; //Exchange rate if (!purchaseOrder.IsColumnNull("ExhangeRate")) { FOBExchangeRate = purchaseOrder.ExhangeRate; } if (!Invoice.IsColumnNull("ExchangeRate")) { FreightExchangeRate = Invoice.ExchangeRate; } }