private void lstTree_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { var dtDate = new DateTimePickerEx { CustomFormat = "MM/dd/yyyy", Value = DateTime.Now }; DateTime dtCurrent = ConvertDate.DateConverter(dtDate.Text); var dr = (DataRowView)lstTree.GetDataRecordByNode(lstTree.FocusedNode); if (dr == null) { return; } var adj = new Disposal(); DataTable dtRec; if (dr["ParentID"] == DBNull.Value) { int yr = ((dtCurrent.Month > 10) ? dtCurrent.Year : dtCurrent.Year - 1); DateTime dt1 = new DateTime(Convert.ToInt32(dr["ID"]) - 1, 11, 1); DateTime dt2 = new DateTime(Convert.ToInt32(dr["ID"]), 11, 1); dtRec = adj.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dt1, dt2); lblAdjDate.Text = dr["RefNo"].ToString(); } else { dtRec = adj.GetDocumentByRefNo(dr["RefNo"].ToString(), Convert.ToInt32(cboStores.EditValue), dr["Date"].ToString()); lblAdjDate.Text = Convert.ToDateTime(dr["Date"]).ToString("MM dd,yyyy"); } gridAdjustments.DataSource = dtRec; }
private void btnConfirm_Click(object sender, EventArgs e) { if(XtraMessageBox.Show("Are you sure you want to comfirm the Beginning Balance, once confirm you cannot undo", "Are you sure...", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { if (lkWarehouse.EditValue != null && lkAccount.EditValue != null) { int StoreID = Convert.ToInt32(lkAccount.EditValue); int WarehouseID = Convert.ToInt32(lkWarehouse.EditValue); BLL.Receipt.Confirm(StoreID, WarehouseID); XtraMessageBox.Show("Quantity has been successfully confirmed, Please Print the additional Inventory Count", "Success...", MessageBoxButtons.OK, MessageBoxIcon.Information); HCMIS.Desktop.Reports.InventoryCountSheet xreport = new HCMIS.Desktop.Reports.InventoryCountSheet(CurrentContext.LoggedInUserName); xreport.DataSource = BLL.Receipt.GetInventoryCountbyAccountandWarehouse(Convert.ToInt32(lkAccount.EditValue), Convert.ToInt32(lkWarehouse.EditValue), Convert.ToInt32(lkCategories.EditValue), ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED); DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; xreport.Date.Text = dtDate.Text; xreport.ShowPreview(); } else { XtraMessageBox.Show("Select Activity and Warehouse first", "Warning...", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
private void btnConfirm_Click(object sender, EventArgs e) { if (XtraMessageBox.Show("Are you sure you want to comfirm the Beginning Balance, once confirm you cannot undo", "Are you sure...", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { if (lkWarehouse.EditValue != null && lkAccount.EditValue != null) { int StoreID = Convert.ToInt32(lkAccount.EditValue); int WarehouseID = Convert.ToInt32(lkWarehouse.EditValue); BLL.Receipt.Confirm(StoreID, WarehouseID); XtraMessageBox.Show("Quantity has been successfully confirmed, Please Print the additional Inventory Count", "Success...", MessageBoxButtons.OK, MessageBoxIcon.Information); HCMIS.Desktop.Reports.InventoryCountSheet xreport = new HCMIS.Desktop.Reports.InventoryCountSheet(CurrentContext.LoggedInUserName); xreport.DataSource = BLL.Receipt.GetInventoryCountbyAccountandWarehouse(Convert.ToInt32(lkAccount.EditValue), Convert.ToInt32(lkWarehouse.EditValue), Convert.ToInt32(lkCategories.EditValue), ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED); DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; xreport.Date.Text = dtDate.Text; xreport.ShowPreview(); } else { XtraMessageBox.Show("Select Activity and Warehouse first", "Warning...", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
public static XtraReport CreateCashReprintInvoiceSmaller(Order ord, DataTable dvPriced, Institution rus, BLL.PickList pl, bool deliveryNote, bool hasInsurnance, string activityName, int?_stvLogIdChosen) { CashInvoice_Smaller stvReport = new CashInvoice_Smaller(CurrentContext.LoggedInUserName); PrepareTheReportCash(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dvPriced.AsDataView(), ord.ID, pl.ID, CurrentContext.UserId, _stvLogIdChosen, false, true, hasInsurnance); //stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint(dvPriced.AsDataView(), ord.ID, pl.ID, NewMainWindow.UserId,null); stvReport.From.Text = GeneralInfo.Current.HospitalName; stvReport.To.Text = rus.Name; stvReport.Town.Text = rus.Town; stvReport.Woreda.Text = rus.WoredaText; stvReport.Zone.Text = rus.ZoneText; stvReport.Region.Text = rus.Region; stvReport.TIN.Text = rus.TinNo; stvReport.VAT.Text = rus.VATNo; stvReport.License.Text = (!rus.IsColumnNull("Ownership") && rus.IsPrivatelyOwned) ? rus.LicenseNo : (!ord.IsColumnNull("LetterNo")) ? ord.LetterNo : ""; stvReport.Program.Text = activityName; DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; stvReport.Date.Text = dtDate.Text; if (deliveryNote) { stvReport.TopMargin.HeightF = stvReport.TopMargin.HeightF / 2; stvReport.xrSTVOrInvoiceLabel.Text = "Delivery Note No."; stvReport.GroupFooter1.Visible = false; stvReport.GroupFooter2.Visible = false; } return(stvReport); }
internal DVDateTimePicker() { this.ParentItem = null; this.DisableEvents = false; this.m_DateTime = new DateTimePickerEx(); base.Controls.Add(this.m_DateTime); this.m_DateTime.BringToFront(); this.m_TimeCombo = new DateTimePickerEx(); this.m_TimeCombo.Visible = false; this.m_TimeCombo.Bounds = new Rectangle(0, 0, 60, 0); this.m_TimeCombo.Format = Resco.Controls.DetailView.DateTimePickerFormat.CustomTime; this.m_TimeCombo.TimePickerStartTime = ItemDateTime.DTTimeFrom; this.m_TimeCombo.TimePickerMinuteInterval = ItemDateTime.DTIncrement; this.m_TimeCombo.TimePickerEndTime = ItemDateTime.DTTimeTo; base.Controls.Add(this.m_TimeCombo); this.Style = RescoDateTimePickerStyle.DateTime; this.Format = DateTimeFormatInfo.CurrentInfo.ShortDatePattern; this.m_TimeCombo.ValueChanged += new EventHandler(this.OnValueChanged); this.m_TimeCombo.NoneSelected += new EventHandler(this.OnValueChanged); this.m_DateTime.ValueChanged += new EventHandler(this.OnValueChanged); this.m_DateTime.NoneSelected += new EventHandler(this.OnValueChanged); this.m_TimeCombo.KeyDown += new KeyEventHandler(this.m_TimeCombo_KeyDown); this.m_TimeCombo.KeyPress += new KeyPressEventHandler(this.m_TimeCombo_KeyPress); this.m_TimeCombo.KeyUp += new KeyEventHandler(this.m_TimeCombo_KeyUp); this.m_DateTime.KeyDown += new KeyEventHandler(this.m_DateTime_KeyDown); this.m_DateTime.KeyPress += new KeyPressEventHandler(this.m_DateTime_KeyPress); this.m_DateTime.KeyUp += new KeyEventHandler(this.m_DateTime_KeyUp); this.m_TimeCombo.GotFocus += new EventHandler(this.m_textBox_GotFocus); this.m_TimeCombo.LostFocus += new EventHandler(this.m_textBox_LostFocus); this.m_DateTime.GotFocus += new EventHandler(this.m_textBox_GotFocus); this.m_DateTime.LostFocus += new EventHandler(this.m_textBox_LostFocus); this.AllowNone = true; }
public static DeliveryNoteForIssue CreateDeliveryNote(Order ord, DataTable dvPriced, string stvSentTo, int pickListID, int?stvLogID, bool convertDN, bool generateNewID, bool hasInsurance, string toStoreName) { var iss = new Issue(); DeliveryNoteForIssue stvReport = new DeliveryNoteForIssue(ord.ID, hasInsurance, CurrentContext.LoggedInUserName); PrepareTheReport(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dvPriced.AsDataView(), ord.ID, pickListID, CurrentContext.UserId, stvLogID, convertDN, generateNewID, hasInsurance); stvReport.From.Text = GeneralInfo.Current.HospitalName; //if (rus.RowCount != 0) // stvReport.To.Text = rus.Name; stvReport.To.Text = stvSentTo; DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; if (stvLogID == null) { iss.LoadByPicklist(pickListID); } stvReport.lblOriginalPrintedDate.Text = iss.PrintedDate.ToShortDateString(); stvReport.Date.Text = dtDate.Text; return(stvReport); }
private void simpleButton1_Click(object sender, EventArgs e) { HCMIS.Desktop.Reports.InventoryCountSheet xreport = new HCMIS.Desktop.Reports.InventoryCountSheet(CurrentContext.LoggedInUserName); xreport.DataSource = BLL.Receipt.GetInventoryCountbyAccountandPhysicalStore(Convert.ToInt32(lkAccount.EditValue), Convert.ToInt32(lkWarehouse.EditValue), Convert.ToInt32(lkCategories.EditValue)); DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; xreport.Date.Text = dtDate.Text; xreport.ShowPreview(); }
internal static DateTimePickerEx GetCurrentEthiopianDateText() { DateTimePickerEx dtDate = new DateTimePickerEx(); //if (CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern != "M/d/yyyy") //{ // //CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern = "MM/dd/yyyy"; //} dtDate.CustomFormat = "MM/dd/yyyy"; dtDate.Value = BLL.DateTimeHelper.ServerDateTime; return dtDate; }
internal static DateTimePickerEx GetCurrentEthiopianDateText() { DateTimePickerEx dtDate = new DateTimePickerEx(); //if (CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern != "M/d/yyyy") //{ // //CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern = "MM/dd/yyyy"; //} dtDate.CustomFormat = "MM/dd/yyyy"; dtDate.Value = BLL.DateTimeHelper.ServerDateTime; return(dtDate); }
private void btnShortageOverageAggregate_Click_1(object sender, EventArgs e) { if (lkPeriod.EditValue != null && lkWarehouse.EditValue != null) { var periodIds = lkPeriod.EditValue.ToString(); var xreport = new Desktop.Reports.InventoryOverageShortageReport(CurrentContext.LoggedInUserName); xreport.DataSource = Inventory.GetOverageShortageAggregateReport(Convert.ToInt32(lkAccount.EditValue), Convert.ToInt32(lkWarehouse.EditValue), periodIds); var dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; xreport.Date.Text = dtDate.Text; xreport.ShowPreview(); } }
/// <summary> /// /// </summary> /// <param name="dvPriced"></param> /// <param name="ord"></param> /// <param name="pl"></param> /// <param name="rus"></param> /// <param name="deliveryNote"></param> /// <param name="hasInsurance"></param> /// <param name="activityName"></param> /// <param name="generateNewID"></param> /// <param name="oldStvLogIDToPrint">If generateNewID is set to false, there needs to be a value here.</param> /// <returns></returns> public static CreditInvoice CreateCreditInvoice(DataTable dvPriced, Order ord, BLL.PickList pl, Institution rus, bool deliveryNote, bool hasInsurance, string activityName, bool generateNewID, int?oldStvLogIDToPrint) { CreditInvoice stvReport = new CreditInvoice(CurrentContext.LoggedInUserName); PrepareTheReportCredit(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dvPriced.AsDataView(), ord.ID, pl.ID, CurrentContext.UserId, oldStvLogIDToPrint, false, generateNewID, hasInsurance); stvReport.From.Text = GeneralInfo.Current.HospitalName; if (!Settings.ShowMultipleStoresOnSTV) { stvReport.xrTableCellStore.Visible = false; stvReport.xrTableCellStoreValue.Visible = false; } if (rus.RowCount != 0) { stvReport.To.Text = rus.Name; stvReport.Town.Text = rus.Town; stvReport.Woreda.Text = rus.WoredaText; stvReport.Zone.Text = rus.ZoneText; stvReport.Region.Text = rus.Region; } stvReport.Letter.Text = ord.LetterNo; stvReport.Program.Text = activityName; DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; stvReport.Date.Text = dtDate.Text; if (deliveryNote) { stvReport.TopMargin.HeightF = stvReport.TopMargin.HeightF / 2; stvReport.xrSTVOrInvoiceLabel.Text = "Delivery Note No."; stvReport.GroupFooter1.Visible = false; //stvReport.GroupFooter2.Visible = false; } return(stvReport); }
public static STVonA4 CreateSTVonA4(Order ord, DataTable dvPriced, string stvSentTo, int pickListID, int?stvLogID, bool convertDN, bool generateNewID, bool hasInsurance, string transferType) { var stvReport = new STVonA4(ord.ID, hasInsurance, CurrentContext.LoggedInUserName); PrepareTheReport(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dvPriced.AsDataView(), ord.ID, pickListID, CurrentContext.UserId, stvLogID, convertDN, generateNewID, hasInsurance); stvReport.From.Text = GeneralInfo.Current.HospitalName; stvReport.To.Text = stvSentTo; var dtDate = new DateTimePickerEx(); stvReport.Date.Text = dtDate.Text; dtDate.Value = DateTimeHelper.ServerDateTime; return(stvReport); }
public static XtraReport CreateModel22(Order ord, DataTable dvPriced, string stvSentTo, int pickListID, int?stvLogID, bool convertDN, bool generateNewID, bool hasInsurance, string transferType) { DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; var dataSource = Order.ReorganizeDataViewForSTVPrint_Program(dvPriced.AsDataView(), ord.ID, pickListID, CurrentContext.UserId, stvLogID, convertDN, generateNewID, hasInsurance); return(new Model20Report(GeneralInfo.Current.HospitalName, dtDate.Text, stvSentTo, GeneralInfo.Current.GetLogo()) { DataSource = dataSource }); }
protected override void Dispose(bool disposing) { if (disposing) { if (this.m_DateTime != null) { this.m_DateTime.Dispose(); this.m_DateTime = null; } if (this.m_TimeCombo != null) { this.m_TimeCombo.Dispose(); this.m_TimeCombo = null; } } base.Dispose(disposing); }
private static void PclCreateReportHeaderArea(object sender, DevExpress.XtraPrinting.CreateAreaEventArgs e) { var info = new GeneralInfo(); info.LoadAll(); var dtDate = new DateTimePickerEx { Value = DateTime.Now, CustomFormat = "MM/dd/yyyy" }; DateTime dtCurrent = Convert.ToDateTime(dtDate.Text); //Old header string header = info.HospitalName + " Loss/Adjustment Activity Log " + dtCurrent.ToString("MM dd,yyyy"); TextBrick brick = e.Graph.DrawString(header, Color.Navy, new RectangleF(0, 0, 500, 40), DevExpress.XtraPrinting.BorderSide.None); brick.Font = new Font("Arial", 16); brick.StringFormat = new DevExpress.XtraPrinting.BrickStringFormat(StringAlignment.Center); }
public static STVonHeadedPaper CreateSTVonHeadedPaper(Order ord, DataTable dvPriced, string stvSentTo, int pickListID, int?stvLogID, bool convertDN, bool generateNewID, bool hasInsurance, string transferType) { var iss = new Issue(); var stvReport = new STVonHeadedPaper(ord.ID, hasInsurance, CurrentContext.LoggedInUserName); PrepareTheReport(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dvPriced.AsDataView(), ord.ID, pickListID, CurrentContext.UserId, stvLogID, convertDN, generateNewID, hasInsurance); stvReport.From.Text = GeneralInfo.Current.HospitalName; //if (rus.RowCount != 0) // stvReport.To.Text = rus.Name; stvReport.To.Text = stvSentTo; if (!string.IsNullOrEmpty(transferType)) //If this is store to store transfer { stvReport.xrTransferType.Visible = true; stvReport.xrTransferType.Text = transferType; } DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; if (stvLogID == null) { iss.LoadByPicklist(pickListID); } iss.LoadByPicklist(pickListID); stvReport.lblORiginalPrintedDate.Text = iss.PrintedDate.ToString(); stvReport.Date.Text = dtDate.Text; return(stvReport); }
private void btnFinalPrintout_Click(object sender, EventArgs e) { int periodId = Convert.ToInt32(lkPeriod.EditValue); int activityID = Convert.ToInt32(lkInventoryAccount.EditValue); int physicalStoreID = Convert.ToInt32(lkInventoryStore.EditValue); PhysicalStore physicalStore = new PhysicalStore(); physicalStore.LoadByPrimaryKey(physicalStoreID); try { if (InventoryPeriod.HasUnCommited(periodId, activityID)) { throw new Exception("This inventory has not been commited yet,you are not allow to print before"); } DevExpress.XtraReports.UI.XtraReport xreport; DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; if (Settings.LocalvsTender) { xreport = new HCMIS.Desktop.Reports.InventoryCountSheetLocalTender(CurrentContext.LoggedInUserName); (xreport as HCMIS.Desktop.Reports.InventoryCountSheetLocalTender).Date.Text = dtDate.Text; } else { xreport = new HCMIS.Desktop.Reports.InventoryCountSheet(CurrentContext.LoggedInUserName); (xreport as HCMIS.Desktop.Reports.InventoryCountSheet).Date.Text = dtDate.Text; } xreport.DataSource = BLL.Receipt.GetInventoryCountbyInventoryPeriodID(periodId, physicalStoreID, activityID); xreport.ShowPreview(); } catch (Exception exp) { XtraMessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
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); } }
/// <summary> 设置容器内控件替换为label /// </summary> /// <param name="cnl">容器控件</param> /// <param name="isCanUse">是否可用</param> public static void SetControlForLable(Control pControl, bool isShowButton) { int count = pControl.Controls.Count; for (int i = 0; i < count; i++) { var cnl = pControl.Controls[i]; if (cnl is TextBoxEx) { Label lable = new Label(); lable.AutoSize = false; lable.Size = cnl.Size; //lable.Location = cnl.Location; lable.Location = new System.Drawing.Point(cnl.Location.X, cnl.Location.Y + 4); pControl.Controls.Add(lable); lable.BringToFront(); TextBoxEx txt = cnl as TextBoxEx; lable.Text = txt.Caption; pControl.Controls.Remove(cnl); i--; } if (cnl is TextChooser) { Label lable = new Label(); lable.AutoSize = false; lable.Size = cnl.Size; //lable.Location = cnl.Location; lable.Location = new System.Drawing.Point(cnl.Location.X, cnl.Location.Y + 4); pControl.Controls.Add(lable); lable.BringToFront(); TextChooser txt = cnl as TextChooser; lable.Text = txt.Text; pControl.Controls.Remove(cnl); i--; } if (cnl is ComboBoxEx || cnl is ComboBox) { Label lable = new Label(); lable.AutoSize = false; lable.Size = cnl.Size; //lable.Location = cnl.Location; lable.Location = new System.Drawing.Point(cnl.Location.X, cnl.Location.Y + 4); pControl.Controls.Add(lable); lable.BringToFront(); lable.Text = cnl.Text; if (cnl.Text == "全部" || cnl.Text == "请选择") { lable.Text = ""; } pControl.Controls.Remove(cnl); i--; } else if (cnl is TextBox || cnl is ComboBox) { Label lable = new Label(); lable.AutoSize = false; lable.Size = cnl.Size; //lable.Location = cnl.Location; lable.Location = new System.Drawing.Point(cnl.Location.X, cnl.Location.Y + 4); pControl.Controls.Add(lable); lable.BringToFront(); lable.Text = cnl.Text; pControl.Controls.Remove(cnl); i--; } else if (cnl is NumericUpDown) { Label lable = new Label(); lable.AutoSize = false; lable.Size = cnl.Size; lable.Location = new System.Drawing.Point(cnl.Location.X, cnl.Location.Y + 4); pControl.Controls.Add(lable); lable.BringToFront(); lable.Text = cnl.Text; pControl.Controls.Remove(cnl); i--; } else if (cnl is ServiceStationClient.ComponentUI.DateTimePickerEx) { Label lable = new Label(); lable.AutoSize = false; lable.Size = cnl.Size; lable.Location = cnl.Location; DateTimePickerEx dtp = cnl as DateTimePickerEx; lable.Text = dtp.Value.ToString(dtp.ShowFormat); pControl.Controls.Add(lable); lable.BringToFront(); pControl.Controls.Remove(cnl); i--; } else if (cnl is CheckBox) { Label lable = new Label(); lable.AutoSize = false; lable.Size = cnl.Size; lable.Location = cnl.Location; CheckBox cb = cnl as CheckBox; if (cb.Checked) { lable.Text = "☑" + cb.Text; } else { lable.Text = "□" + cb.Text; } pControl.Controls.Add(lable); lable.BringToFront(); pControl.Controls.Remove(cnl); i--; } else if (cnl is RadioButton) { Label lable = new Label(); lable.AutoSize = false; lable.Size = cnl.Size; lable.Location = cnl.Location; RadioButton rb = cnl as RadioButton; if (rb.Checked) { lable.Text = "☑" + rb.Text; } else { lable.Text = "□" + rb.Text; } pControl.Controls.Add(lable); lable.BringToFront(); pControl.Controls.Remove(cnl); i--; } else if (cnl is DateTimePicker) { Label lable = new Label(); lable.AutoSize = false; lable.Size = cnl.Size; lable.Location = cnl.Location; DateTimePicker dtp = cnl as DateTimePicker; lable.Text = dtp.Value.ToString(dtp.CustomFormat); pControl.Controls.Add(lable); lable.BringToFront(); pControl.Controls.Remove(cnl); i--; } else if (cnl is Button || cnl is ServiceStationClient.ComponentUI.ButtonEx) { cnl.Visible = isShowButton; cnl.Enabled = false; } if (cnl is Label) { if (cnl.Text == "*") { cnl.Visible = false; } } else if (cnl is DataGridView) { DataGridView dgv = cnl as DataGridView; dgv.ReadOnly = true; } else { if (cnl.HasChildren) { SetControlForLable(cnl, isShowButton); } } } }
/// <summary> /// Handles the Click event of the btnConfirmIssue control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> /// <exception cref="System.Exception"></exception> private void btnConfirmIssue_Click(object sender, EventArgs e) { // This is where the Issue is actually recorded and the stv is printed. // Do all kinds of validations. XtraReport STVReport = null; XtraReport DeliveryNoteReport = null; btnConfirmIssue1.Enabled = false; if (!IssueValid()) { XtraMessageBox.Show("Please Correct the Items Marked in Red before Proceeding with Issue", "Errors", MessageBoxButtons.OK, MessageBoxIcon.Error); btnConfirmIssue1.Enabled = (BLL.Settings.UseNewUserManagement && this.HasPermission("Print-Invoice")) ? true : (!BLL.Settings.UseNewUserManagement); return; } if (XtraMessageBox.Show("Are You Sure, You want to save this Transaction?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { DateTimePickerEx dtDate = ConvertDate.GetCurrentEthiopianDateText(); DateTime dtCurrent = ConvertDate.DateConverter(dtDate.Text); // The User is now sure that the STV has to be printed and that // the order is also good to save. // This is the section that does the saving. BLL.Order order = new Order(); order.LoadByPrimaryKey(_orderID); // what are the pick lists, do we have devliery notes too? DataView dv = _dvOutstandingPickList; DataTable dvUnpriced = new DataTable(); DataTable dvPriced = dv.ToTable(); if (BLL.Settings.HandleGRV) { if (BLL.Settings.IsCenter) { dv.RowFilter = "(Cost is null or Cost=0)"; } else { dv.RowFilter = "DeliveryNote = true and (Cost is null or Cost=0)"; } dvUnpriced = dv.ToTable(); dv.RowFilter = "Cost is not null and Cost <> 0"; dvPriced = dv.ToTable(); } else { dvPriced = dv.ToTable(); } string stvPrinterName = ""; string deliveryNotePrinter = ""; if (!ConfirmPrinterSettings(dvPriced, dvUnpriced, out stvPrinterName, out deliveryNotePrinter)) { return; } bool saveSuccessful = false; MyGeneration.dOOdads.TransactionMgr mgr = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr(); try { if (dvPriced.Rows.Count == 0 && dvUnpriced.Rows.Count == 0) { throw new Exception("The Items doesn’t meet the requirement: please check the price status for non-delivery notes!"); } mgr.BeginTransaction(); if (dvPriced.Rows.Count > 0) { STVReport = SaveAndPrintSTV(dvPriced.DefaultView, false, stvPrinterName, dtDate, dtCurrent); } if (dvUnpriced.Rows.Count > 0) { DeliveryNoteReport = SaveAndPrintSTV(dvUnpriced.DefaultView, true, deliveryNotePrinter, dtDate, dtCurrent); } var ordr = new Order(); ordr.LoadByPrimaryKey(_orderID); if (!ordr.IsColumnNull("OrderTypeID") && (ordr.OrderTypeID == BLL.OrderType.CONSTANTS.ACCOUNT_TO_ACCOUNT_TRANSFER || ordr.OrderTypeID == BLL.OrderType.CONSTANTS.STORE_TO_STORE_TRANSFER)) { var transfer = new Transfer(); DateTime convertedEthDate = ConvertDate.DateConverter(dtDate.Text); transfer.CommitAccountToAccountTransfer(ordr.ID, CurrentContext.UserId, convertedEthDate); } mgr.CommitTransaction(); saveSuccessful = true; } catch (Exception exp) { mgr.RollbackTransaction(); //Removed the reset logic //MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgrReset(); XtraMessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); ErrorHandler.Handle(exp); saveSuccessful = false; } if (saveSuccessful) { if (STVReport != null) { if (InstitutionIType.IsVaccine(GeneralInfo.Current)) { for (int i = 0; i < BLL.Settings.STVCopies; i++) { STVReport.Print(stvPrinterName); } } else { STVReport.Print(stvPrinterName); } } if (DeliveryNoteReport != null) { DeliveryNoteReport.Print(deliveryNotePrinter); } XtraMessageBox.Show("Transaction Successfully Saved!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } btnConfirmIssue1.Enabled = (BLL.Settings.UseNewUserManagement && this.HasPermission("Print-Invoice")) ? true : (!BLL.Settings.UseNewUserManagement); BindOutstandingPicklists(); gridOutstandingPicklistDetail.DataSource = null; PalletLocation.GarbageCollection(); if (BLL.Settings.AllowOnlineOrders) { Helpers.RRFServiceIntegration.SubmitOnlineIssue(_orderID); } } }
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> /// Re print STV. /// </summary> /// <param name="dv">The dv.</param> /// <param name="orderId">The order id.</param> /// <param name="pl">The pl.</param> /// <param name="stvLogID">The STV log ID.</param> /// <param name="isConversion">if set to <c>true</c> [is conversion].</param> /// <param name="generateNewPrintID">if set to <c>true</c> [generate new print ID].</param> //public XtraReport RePrintSTV(DataView dv,int orderId, PickList pl,int? stvLogID, bool isConversion, bool generateNewPrintID = true) //{ // var includeInsurance =XtraMessageBox.Show("Include insurance?", "Insurance",MessageBoxButtons.YesNo,MessageBoxIcon.Question)== DialogResult.Yes; // var ord = new Order(); // ord.LoadByPrimaryKey(orderId); // var order = new Order(); // order.LoadByPrimaryKey(orderId); // if (!order.IsPaymentTypeValid()) // { // //TODO: This needs to be handled well. // throw new Exception( // string.Format("PaymentTypeID has a problem. The order has a payment type id of {0}", // ord.PaymentTypeID)); // } // var stores = new Activity(); // stores.LoadByPrimaryKey(order.FromStore); // var textDeliveryNote = ""; // var sendToString = GetReceivingUnitName(order); // if (stvLogID != null) // { // var stvLog = new Issue(); // stvLog.LoadByPrimaryKey(stvLogID.Value); // if (!stvLog.IsColumnNull("IsDeliveryNote") && stvLog.IsDeliveryNote && isConversion) // { // textDeliveryNote = stvLog.IDPrinted.ToString("00000"); // } // } // if (PaymentType.Constants.CASH == ord.PaymentTypeID) // { // var rus = new Institution(); // rus.LoadByPrimaryKey(order.RequestedBy); // var stvReport = new HCMIS.Desktop.Reports.CashInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // stvReport.TIN.Text = rus.TinNo; // stvReport.VAT.Text = rus.VATNo; // stvReport.Town.Text = rus.Town; // stvReport.Woreda.Text = rus.WoredaText; // stvReport.Zone.Text = rus.ZoneText; // stvReport.Region.Text = rus.Region; // stvReport.License.Text = (!rus.IsColumnNull("Ownership") && rus.IsPrivatelyOwned) ? rus.LicenseNo : (!ord.IsColumnNull("LetterNo")) ? ord.LetterNo : ""; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // return stvReport; // } // else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID) // { // var rus = new Institution(); // rus.LoadByPrimaryKey(order.RequestedBy); // HCMIS.Desktop.Reports.CreditInvoice stvReport = // new HCMIS.Desktop.Reports.CreditInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, // CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // //stvReport.Region.Text = rus.Woreda; // stvReport.Zone.Text = rus.Town; // stvReport.Letter.Text = ord.LetterNo; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // } //} /// <summary> /// Re print STV. /// </summary> /// <param name="dv">The dv.</param> /// <param name="orderId">The order id.</param> /// <param name="pl">The pl.</param> /// <param name="stvLogID">The STV log ID.</param> /// <param name="isConversion">if set to <c>true</c> [is conversion].</param> /// <param name="generateNewPrintID">if set to <c>true</c> [generate new print ID].</param> public XtraReport RePrintSTV(DataView dv, int orderId, PickList pl, int? stvLogID, bool isConversion, bool generateNewPrintID = true) { HCMIS.Core.Distribution.Services.PrintLogService pLogService = new HCMIS.Core.Distribution.Services.PrintLogService(); pLogService.StartPrintingSession(); includeInsurance = XtraMessageBox.Show("Include insurance?", "Insurance", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes; var ord = new Order(); ord.LoadByPrimaryKey(orderId); //loading two times var order = new Order(); order.LoadByPrimaryKey(orderId); if (!order.IsPaymentTypeValid()) { //TODO: This needs to be handled well. throw new Exception( string.Format("PaymentTypeID has a problem. The order has a payment type id of {0}", ord.PaymentTypeID)); } var rus = new Institution(); if (ord.PaymentTypeID == PaymentType.Constants.CASH || ord.PaymentTypeID == PaymentType.Constants.CREDIT) { rus.LoadByPrimaryKey(order.RequestedBy); } var stores = new Activity(); stores.LoadByPrimaryKey(order.FromStore); var textDeliveryNote = ""; var sendToString = GetReceivingUnitName(order); if (stvLogID != null) { var stvLog = new Issue(); stvLog.LoadByPrimaryKey(stvLogID.Value); if (!stvLog.IsColumnNull("IsDeliveryNote") && stvLog.IsDeliveryNote && isConversion) { textDeliveryNote = stvLog.IDPrinted.ToString("00000"); } } var xtraReport = new XtraReport(); string stvPrinterName = ""; if (PaymentType.Constants.CASH == ord.PaymentTypeID && !chkDeliveryNotes.Checked) { xtraReport = FormatCashRePrintInvoice(ord, dv.Table, rus, pl, false, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return xtraReport; } else if (PaymentType.Constants.CASH == ord.PaymentTypeID && chkDeliveryNotes.Checked) { xtraReport = FormatCashRePrintInvoice(ord, pl.DefaultView.ToTable(), rus, pl, true, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return xtraReport; } else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID && !chkDeliveryNotes.Checked) { xtraReport = FormatCreditRePrintInvoice(ord, pl.DefaultView.ToTable(), rus, pl, false, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return xtraReport; } else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID && chkDeliveryNotes.Checked) { xtraReport = FormatCreditRePrintInvoice(ord, pl.DefaultView.ToTable(), rus, pl, true, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return xtraReport; } //if (PaymentType.Constants.CASH == ord.PaymentTypeID) //{ // var stvReport = new HCMIS.Desktop.Reports.CashInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // stvReport.TIN.Text = rus.TinNo; // stvReport.VAT.Text = rus.VATNo; // stvReport.Town.Text = rus.Town; // stvReport.Woreda.Text = rus.WoredaText; // stvReport.Zone.Text = rus.ZoneText; // stvReport.Region.Text = rus.Region; // stvReport.License.Text = (!rus.IsColumnNull("Ownership") && rus.IsPrivatelyOwned) ? rus.LicenseNo : (!ord.IsColumnNull("LetterNo")) ? ord.LetterNo : ""; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // return stvReport; //} //else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID) //{ // HCMIS.Desktop.Reports.CreditInvoice stvReport = new HCMIS.Desktop.Reports.CreditInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // //stvReport.Region.Text = rus.Woreda; // stvReport.Zone.Text = rus.Town; // stvReport.Letter.Text = ord.LetterNo; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // return stvReport; //} else if (PaymentType.Constants.STV == ord.PaymentTypeID && generateNewPrintID) { pl.LoadByOrderID(orderId); // check if this is a delivery note Issue sl = new Issue(); sl.LoadByPrimaryKey(stvLogID.Value); if (!sl.IsColumnNull("IsDeliveryNote") && sl.IsDeliveryNote && !isConversion) { var stvReport = new HCMIS.Desktop.Reports.DeliveryNoteForIssue(ord.ID, includeInsurance, CurrentContext.LoggedInUserName); PrepareTheReport(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); stvReport.From.Text = GeneralInfo.Current.HospitalName; stvReport.To.Text = sendToString; stvReport.STVNO.Text = Issue.GetLogFor(ord.RefNo); //stvReport.Date.Text = @"(Reprint) " + Convert.ToDateTime(dv[0]["IssueDate"]).ToString("MM/dd/yyyy"); DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; stvReport.Date.Text = dtDate.Text; //stvReport.ShowPreview(); return stvReport; } else { var stvReport = new HCMIS.Desktop.Reports.STVonHeadedPaper(ord.ID, includeInsurance, CurrentContext.LoggedInUserName); stvReport.DeliveryNoteNo.Text = textDeliveryNote; PrepareTheReport(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); stvReport.From.Text = GeneralInfo.Current.HospitalName; stvReport.To.Text = sendToString; stvReport.STVNO.Text = Issue.GetLogFor(ord.RefNo); //stvReport.Date.Text = @"(Reprint) " + Convert.ToDateTime(dv[0]["IssueDate"]).ToString("MM/dd/yyyy"); DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; stvReport.Date.Text = dtDate.Text; //stvReport.ShowPreview(); return stvReport; } } else if (PaymentType.Constants.STV == ord.PaymentTypeID && !generateNewPrintID) { pl.LoadByOrderID(orderId); //System.Windows.Forms.DialogResult result = XtraMessageBox.Show("Include insurance?", "Insurance", //MessageBoxButtons.YesNo, //MessageBoxIcon.Question); Issue log = new Issue(); log.LoadByPrimaryKey((_reprintId != null) ? _reprintId.Value : stvLogID.Value); if (log.IsColumnNull("HasInsurance") || BLL.Settings.IsCenter) //If it is null, we have no idea about what the insurance status was. So let's ask the user. { System.Windows.Forms.DialogResult result = XtraMessageBox.Show("Include insurance?", "Insurance", MessageBoxButtons.YesNo, MessageBoxIcon.Question); includeInsurance = result == DialogResult.Yes ? true : false; log.HasInsurance = includeInsurance; log.Save(); } else { includeInsurance = log.HasInsurance; } //bool includeInsurance = (!log.IsColumnNull("HasInsurance"))? log.HasInsurance : false; var stvReport = new HCMIS.Desktop.Reports.STVonA4(ord.ID, includeInsurance, CurrentContext.LoggedInUserName); stvReport.DeliveryNoteNo.Text = textDeliveryNote; PrepareTheReport(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, (_reprintId != null) ? _reprintId : stvLogID, isConversion, generateNewPrintID, includeInsurance); stvReport.From.Text = GeneralInfo.Current.HospitalName; stvReport.To.Text = sendToString; //stvReport.STVNO.Text = //STVLog.GetLogFor(ord.RefNo); //stvReport.Date.Text = @"(Reprint) " + Convert.ToDateTime(dv[0]["IssueDate"]).ToString("MM/dd/yyyy"); DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; stvReport.Date.Text = dtDate.Text; return stvReport; } return null; }
/// <summary> /// Re print STV. /// </summary> /// <param name="dv">The dv.</param> /// <param name="orderId">The order id.</param> /// <param name="pl">The pl.</param> /// <param name="stvLogID">The STV log ID.</param> /// <param name="isConversion">if set to <c>true</c> [is conversion].</param> /// <param name="generateNewPrintID">if set to <c>true</c> [generate new print ID].</param> //public XtraReport RePrintSTV(DataView dv,int orderId, PickList pl,int? stvLogID, bool isConversion, bool generateNewPrintID = true) //{ // var includeInsurance =XtraMessageBox.Show("Include insurance?", "Insurance",MessageBoxButtons.YesNo,MessageBoxIcon.Question)== DialogResult.Yes; // var ord = new Order(); // ord.LoadByPrimaryKey(orderId); // var order = new Order(); // order.LoadByPrimaryKey(orderId); // if (!order.IsPaymentTypeValid()) // { // //TODO: This needs to be handled well. // throw new Exception( // string.Format("PaymentTypeID has a problem. The order has a payment type id of {0}", // ord.PaymentTypeID)); // } // var stores = new Activity(); // stores.LoadByPrimaryKey(order.FromStore); // var textDeliveryNote = ""; // var sendToString = GetReceivingUnitName(order); // if (stvLogID != null) // { // var stvLog = new Issue(); // stvLog.LoadByPrimaryKey(stvLogID.Value); // if (!stvLog.IsColumnNull("IsDeliveryNote") && stvLog.IsDeliveryNote && isConversion) // { // textDeliveryNote = stvLog.IDPrinted.ToString("00000"); // } // } // if (PaymentType.Constants.CASH == ord.PaymentTypeID) // { // var rus = new Institution(); // rus.LoadByPrimaryKey(order.RequestedBy); // var stvReport = new HCMIS.Desktop.Reports.CashInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // stvReport.TIN.Text = rus.TinNo; // stvReport.VAT.Text = rus.VATNo; // stvReport.Town.Text = rus.Town; // stvReport.Woreda.Text = rus.WoredaText; // stvReport.Zone.Text = rus.ZoneText; // stvReport.Region.Text = rus.Region; // stvReport.License.Text = (!rus.IsColumnNull("Ownership") && rus.IsPrivatelyOwned) ? rus.LicenseNo : (!ord.IsColumnNull("LetterNo")) ? ord.LetterNo : ""; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // return stvReport; // } // else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID) // { // var rus = new Institution(); // rus.LoadByPrimaryKey(order.RequestedBy); // HCMIS.Desktop.Reports.CreditInvoice stvReport = // new HCMIS.Desktop.Reports.CreditInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, // CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // //stvReport.Region.Text = rus.Woreda; // stvReport.Zone.Text = rus.Town; // stvReport.Letter.Text = ord.LetterNo; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // } //} /// <summary> /// Re print STV. /// </summary> /// <param name="dv">The dv.</param> /// <param name="orderId">The order id.</param> /// <param name="pl">The pl.</param> /// <param name="stvLogID">The STV log ID.</param> /// <param name="isConversion">if set to <c>true</c> [is conversion].</param> /// <param name="generateNewPrintID">if set to <c>true</c> [generate new print ID].</param> public XtraReport RePrintSTV(DataView dv, int orderId, PickList pl, int?stvLogID, bool isConversion, bool generateNewPrintID = true) { HCMIS.Core.Distribution.Services.PrintLogService pLogService = new HCMIS.Core.Distribution.Services.PrintLogService(); pLogService.StartPrintingSession(); includeInsurance = XtraMessageBox.Show("Include insurance?", "Insurance", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes; var ord = new Order(); ord.LoadByPrimaryKey(orderId); //loading two times var order = new Order(); order.LoadByPrimaryKey(orderId); if (!order.IsPaymentTypeValid()) { //TODO: This needs to be handled well. throw new Exception( string.Format("PaymentTypeID has a problem. The order has a payment type id of {0}", ord.PaymentTypeID)); } var rus = new Institution(); if (ord.PaymentTypeID == PaymentType.Constants.CASH || ord.PaymentTypeID == PaymentType.Constants.CREDIT) { rus.LoadByPrimaryKey(order.RequestedBy); } var stores = new Activity(); stores.LoadByPrimaryKey(order.FromStore); var textDeliveryNote = ""; var sendToString = GetReceivingUnitName(order); if (stvLogID != null) { var stvLog = new Issue(); stvLog.LoadByPrimaryKey(stvLogID.Value); if (!stvLog.IsColumnNull("IsDeliveryNote") && stvLog.IsDeliveryNote && isConversion) { textDeliveryNote = stvLog.IDPrinted.ToString("00000"); } } var xtraReport = new XtraReport(); string stvPrinterName = ""; if (PaymentType.Constants.CASH == ord.PaymentTypeID && !chkDeliveryNotes.Checked) { xtraReport = FormatCashRePrintInvoice(ord, dv.Table, rus, pl, false, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return(xtraReport); } else if (PaymentType.Constants.CASH == ord.PaymentTypeID && chkDeliveryNotes.Checked) { xtraReport = FormatCashRePrintInvoice(ord, pl.DefaultView.ToTable(), rus, pl, true, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return(xtraReport); } else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID && !chkDeliveryNotes.Checked) { xtraReport = FormatCreditRePrintInvoice(ord, pl.DefaultView.ToTable(), rus, pl, false, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return(xtraReport); } else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID && chkDeliveryNotes.Checked) { xtraReport = FormatCreditRePrintInvoice(ord, pl.DefaultView.ToTable(), rus, pl, true, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return(xtraReport); } //if (PaymentType.Constants.CASH == ord.PaymentTypeID) //{ // var stvReport = new HCMIS.Desktop.Reports.CashInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // stvReport.TIN.Text = rus.TinNo; // stvReport.VAT.Text = rus.VATNo; // stvReport.Town.Text = rus.Town; // stvReport.Woreda.Text = rus.WoredaText; // stvReport.Zone.Text = rus.ZoneText; // stvReport.Region.Text = rus.Region; // stvReport.License.Text = (!rus.IsColumnNull("Ownership") && rus.IsPrivatelyOwned) ? rus.LicenseNo : (!ord.IsColumnNull("LetterNo")) ? ord.LetterNo : ""; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // return stvReport; //} //else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID) //{ // HCMIS.Desktop.Reports.CreditInvoice stvReport = new HCMIS.Desktop.Reports.CreditInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // //stvReport.Region.Text = rus.Woreda; // stvReport.Zone.Text = rus.Town; // stvReport.Letter.Text = ord.LetterNo; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // return stvReport; //} else if (PaymentType.Constants.STV == ord.PaymentTypeID && generateNewPrintID) { pl.LoadByOrderID(orderId); // check if this is a delivery note Issue sl = new Issue(); sl.LoadByPrimaryKey(stvLogID.Value); if (!sl.IsColumnNull("IsDeliveryNote") && sl.IsDeliveryNote && !isConversion) { var stvReport = new HCMIS.Desktop.Reports.DeliveryNoteForIssue(ord.ID, includeInsurance, CurrentContext.LoggedInUserName); PrepareTheReport(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); stvReport.From.Text = GeneralInfo.Current.HospitalName; stvReport.To.Text = sendToString; stvReport.STVNO.Text = Issue.GetLogFor(ord.RefNo); //stvReport.Date.Text = @"(Reprint) " + Convert.ToDateTime(dv[0]["IssueDate"]).ToString("MM/dd/yyyy"); DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; stvReport.Date.Text = dtDate.Text; //stvReport.ShowPreview(); return(stvReport); } else { var stvReport = new HCMIS.Desktop.Reports.STVonHeadedPaper(ord.ID, includeInsurance, CurrentContext.LoggedInUserName); stvReport.DeliveryNoteNo.Text = textDeliveryNote; PrepareTheReport(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); stvReport.From.Text = GeneralInfo.Current.HospitalName; stvReport.To.Text = sendToString; stvReport.STVNO.Text = Issue.GetLogFor(ord.RefNo); //stvReport.Date.Text = @"(Reprint) " + Convert.ToDateTime(dv[0]["IssueDate"]).ToString("MM/dd/yyyy"); DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; stvReport.Date.Text = dtDate.Text; //stvReport.ShowPreview(); return(stvReport); } } else if (PaymentType.Constants.STV == ord.PaymentTypeID && !generateNewPrintID) { pl.LoadByOrderID(orderId); //System.Windows.Forms.DialogResult result = XtraMessageBox.Show("Include insurance?", "Insurance", //MessageBoxButtons.YesNo, //MessageBoxIcon.Question); Issue log = new Issue(); log.LoadByPrimaryKey((_reprintId != null) ? _reprintId.Value : stvLogID.Value); if (log.IsColumnNull("HasInsurance") || BLL.Settings.IsCenter) //If it is null, we have no idea about what the insurance status was. So let's ask the user. { System.Windows.Forms.DialogResult result = XtraMessageBox.Show("Include insurance?", "Insurance", MessageBoxButtons.YesNo, MessageBoxIcon.Question); includeInsurance = result == DialogResult.Yes ? true : false; log.HasInsurance = includeInsurance; log.Save(); } else { includeInsurance = log.HasInsurance; } //bool includeInsurance = (!log.IsColumnNull("HasInsurance"))? log.HasInsurance : false; var stvReport = new HCMIS.Desktop.Reports.STVonA4(ord.ID, includeInsurance, CurrentContext.LoggedInUserName); stvReport.DeliveryNoteNo.Text = textDeliveryNote; PrepareTheReport(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, (_reprintId != null) ? _reprintId : stvLogID, isConversion, generateNewPrintID, includeInsurance); stvReport.From.Text = GeneralInfo.Current.HospitalName; stvReport.To.Text = sendToString; //stvReport.STVNO.Text = //STVLog.GetLogFor(ord.RefNo); //stvReport.Date.Text = @"(Reprint) " + Convert.ToDateTime(dv[0]["IssueDate"]).ToString("MM/dd/yyyy"); DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; stvReport.Date.Text = dtDate.Text; return(stvReport); } return(null); }
/// <summary> /// Saves the and print STV. /// </summary> /// <param name="pickListDetail">The pick list detail.</param> /// <param name="deliveryNotePrinter">The delivery note printer.</param> /// <param name="stvPrinterName">Name of the STV printer.</param> /// <param name="dtDate">The dt date.</param> /// <param name="dtCurrent">The dt current.</param> /// <exception cref="System.Exception"></exception> private XtraReport SaveAndPrintSTV(DataView pickListDetail, bool isDeliveryNote, string printerName, DateTimePickerEx dtDate, DateTime dtCurrent) { HCMIS.Core.Distribution.Services.PrintLogService pLogService = new HCMIS.Core.Distribution.Services.PrintLogService(); pLogService.StartPrintingSession(); Order ord = IssueDoc.SaveIssueTransaction(_orderID, ref pickListDetail, txtRemarks.Text, CurrentContext.LoggedInUserName, dtCurrent); if (pickListDetail.Count == 0) throw new Exception("An error occurred during saving the issue. Please contact your administrator."); string sendToString = ""; BLL.Order ordr = new BLL.Order(); ordr.LoadByPrimaryKey(_orderID); BLL.Institution rus = new Institution(); if (!ordr.IsColumnNull("RequestedBy")) { rus.LoadByPrimaryKey(ordr.RequestedBy); sendToString = rus.Name; } else if (!ordr.IsColumnNull("OrderTypeID") && ordr.OrderTypeID == BLL.OrderType.CONSTANTS.ACCOUNT_TO_ACCOUNT_TRANSFER) { BLL.Transfer transfer = new Transfer(); transfer.LoadByOrderID(_orderID); var activity = new Activity(); activity.LoadByPrimaryKey(transfer.ToStoreID); sendToString = activity.FullActivityName; } PickList pl = new PickList(); pl.LoadByOrderID(ord.ID); var xtraReport = new XtraReport(); if (ord.PaymentTypeID == PaymentType.Constants.CASH) { xtraReport = FormatCashInvoice(ord, pickListDetail.Table, rus, pl, isDeliveryNote, printerName, pLogService); } else if (ord.PaymentTypeID == PaymentType.Constants.CREDIT) { xtraReport = FormatCreditInvoice(ord, pickListDetail.Table, rus, pl, isDeliveryNote, printerName, pLogService); } else if (ord.PaymentTypeID == PaymentType.Constants.STV) { xtraReport = FormatSTV(ord, pickListDetail.Table, sendToString, pl, isDeliveryNote, printerName, pLogService, _orderID); } SavePdfReport(pLogService, xtraReport); pLogService.CommitPrintLog(); return xtraReport; }
/// <summary> /// Saves the and print STV. /// </summary> /// <param name="pickListDetail">The pick list detail.</param> /// <param name="deliveryNotePrinter">The delivery note printer.</param> /// <param name="stvPrinterName">Name of the STV printer.</param> /// <param name="dtDate">The dt date.</param> /// <param name="dtCurrent">The dt current.</param> /// <exception cref="System.Exception"></exception> private XtraReport SaveAndPrintSTV(DataView pickListDetail, bool isDeliveryNote, string printerName, DateTimePickerEx dtDate, DateTime dtCurrent) { HCMIS.Core.Distribution.Services.PrintLogService pLogService = new HCMIS.Core.Distribution.Services.PrintLogService(); pLogService.StartPrintingSession(); Order ord = IssueDoc.SaveIssueTransaction(_orderID, ref pickListDetail, txtRemarks.Text, CurrentContext.LoggedInUserName, dtCurrent); if (pickListDetail.Count == 0) { throw new Exception("An error occurred during saving the issue. Please contact your administrator."); } string sendToString = ""; BLL.Order ordr = new BLL.Order(); ordr.LoadByPrimaryKey(_orderID); BLL.Institution rus = new Institution(); if (!ordr.IsColumnNull("RequestedBy")) { rus.LoadByPrimaryKey(ordr.RequestedBy); sendToString = rus.Name; } else if (!ordr.IsColumnNull("OrderTypeID") && ordr.OrderTypeID == BLL.OrderType.CONSTANTS.ACCOUNT_TO_ACCOUNT_TRANSFER) { BLL.Transfer transfer = new Transfer(); transfer.LoadByOrderID(_orderID); var activity = new Activity(); activity.LoadByPrimaryKey(transfer.ToStoreID); sendToString = activity.FullActivityName; } PickList pl = new PickList(); pl.LoadByOrderID(ord.ID); var xtraReport = new XtraReport(); if (ord.PaymentTypeID == PaymentType.Constants.CASH) { xtraReport = FormatCashInvoice(ord, pickListDetail.Table, rus, pl, isDeliveryNote, printerName, pLogService); } else if (ord.PaymentTypeID == PaymentType.Constants.CREDIT) { xtraReport = FormatCreditInvoice(ord, pickListDetail.Table, rus, pl, isDeliveryNote, printerName, pLogService); } else if (ord.PaymentTypeID == PaymentType.Constants.STV) { xtraReport = FormatSTV(ord, pickListDetail.Table, sendToString, pl, isDeliveryNote, printerName, pLogService, _orderID); } SavePdfReport(pLogService, xtraReport); pLogService.CommitPrintLog(); return(xtraReport); }
internal void Display(bool visible, int x, int y, Color backColor, Color foreColor, DateTimePickerEx parent) { this.m_DateTime = parent; if (visible) { this.m_captureMouse = false; this.m_doCloseUp = true; this.m_yearUpDown.Hide(); this.BackColor = backColor; this.ForeColor = foreColor; base.Left = x; base.Top = y; base.BringToFront(); this.m_hoverSel = this.m_curSel; } base.Visible = visible; if (base.Visible) { base.Focus(); } }
private void simpleButton1_Click(object sender, EventArgs e) { HCMIS.Desktop.Reports.InventoryCountSheet xreport = new HCMIS.Desktop.Reports.InventoryCountSheet(CurrentContext.LoggedInUserName); xreport.DataSource = BLL.Receipt.GetInventoryCountbyAccountandPhysicalStore(Convert.ToInt32(lkAccount.EditValue),Convert.ToInt32(lkWarehouse.EditValue),Convert.ToInt32(lkCategories.EditValue)); DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; xreport.Date.Text = dtDate.Text; xreport.ShowPreview(); }
private void btnShortageOverage_Click(object sender, EventArgs e) { if (lkPeriod.EditValue != null && lkWarehouse.EditValue != null) { var periodIds = lkPeriod.EditValue.ToString(); var xreport = new Desktop.Reports.InventoryOverageShortageReport(CurrentContext.LoggedInUserName); xreport.DataSource = Inventory.GetOverageShortageReport(Convert.ToInt32(lkAccount.EditValue), Convert.ToInt32(lkWarehouse.EditValue), periodIds); var dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; xreport.Date.Text = dtDate.Text; xreport.ShowPreview(); } }
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 lstTree_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { var dtDate = new DateTimePickerEx { CustomFormat = "MM/dd/yyyy", Value = DateTime.Now }; DateTime dtCurrent = ConvertDate.DateConverter(dtDate.Text); var dr = (DataRowView)lstTree.GetDataRecordByNode(lstTree.FocusedNode); if (dr == null) return; var adj = new Disposal(); DataTable dtRec; if (dr["ParentID"] == DBNull.Value) { int yr = ((dtCurrent.Month > 10) ? dtCurrent.Year : dtCurrent.Year - 1); DateTime dt1 = new DateTime(Convert.ToInt32(dr["ID"]) - 1, 11, 1); DateTime dt2 = new DateTime(Convert.ToInt32(dr["ID"]), 11, 1); dtRec = adj.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dt1, dt2); lblAdjDate.Text = dr["RefNo"].ToString(); } else { dtRec = adj.GetDocumentByRefNo(dr["RefNo"].ToString(), Convert.ToInt32(cboStores.EditValue), dr["Date"].ToString()); lblAdjDate.Text = Convert.ToDateTime(dr["Date"]).ToString("MM dd,yyyy"); } gridAdjustments.DataSource = dtRec; }