public void InitializeWithGeneralNumber(int RefNumber) { SEMAPHORE = true; aAdjustGeneralList = AdjustInventoryGeneralMgmt.SelectAllAdjustsGeneral(RefNumber, string.Empty, string.Empty); aItemsTable = AdjustInventoryDetailedMgmt.SelectAllAdjustsDetailed(RefNumber, -1); AllItemsTable = ItemsMgmt.SelectAllItems(); aUserRow = UsersMgmt.SelectUserInfoByID(int.Parse(aAdjustGeneralList.Rows[0]["TellerID"].ToString())); if (aItemsTable.Rows.Count > 0) { aItemsTable.Columns.Add("PhysicalCountColumn", typeof(double)); aItemsTable.Columns.Add("DifferencesColumn", typeof(double)); aItemsTable.Columns.Add("DiffValueColumn", typeof(double)); page(1); } else { MatchLbl.Visible = true; } AdjDatePicker.Text = aAdjustGeneralList.Rows[0]["Date"].ToString(); ReferenceNumberTxtBox.Text = aAdjustGeneralList.Rows[0]["Number"].ToString(); SEMAPHORE = false; }
private int AddAdjustGeneralEntry(DataTable aTable) { try { if (!ValidateAdjustTable(aTable)) { return -1; } AdjustInventoryGeneral aAdjustGeneral = new AdjustInventoryGeneral(); aAdjustGeneral.Number = AdjustInventoryGeneralMgmt.NextBillNumber(); aAdjustGeneral.TellerID = Convert.ToInt32(UsersMgmt.SelectUserIDByUserName(SharedFunctions.ReturnLoggedUserName()).ToString()); aAdjustGeneral.Date = DateTime.Now.ToShortDateString(); aAdjustGeneral.IsChecked = 0; if (AdjustInventoryGeneralMgmt.AddAdjustGeneralItem(aAdjustGeneral)) { return aAdjustGeneral.Number; } else { return aAdjustGeneral.Number; } } catch (Exception ex) { MessageBox.Show("NOT ADDED \n ERROR IN ADJUSTITEMSFRM: FUNCTION:AddAdjustToDataBase {EXCEPTION }" + ex.ToString(), MsgTxt.UnexpectedError, MessageBoxButtons.OK, MessageBoxIcon.Error); return -1; } }
private void AddAdjustToDataBase(DataTable aTable) { int GeneralNumber = AddAdjustGeneralEntry(aTable); if (-1 != GeneralNumber) { if (AddAdjustDetailedEntry(aTable, GeneralNumber)) { MessageBox.Show(MsgTxt.AddedSuccessfully, MsgTxt.AddedSuccessfully, MessageBoxButtons.OK, MessageBoxIcon.Information); ExportToPDF(GeneralNumber); Initialize(); } else { /*First added successfully , one or more in adjust detailed entry not added you should delete everything*/ MessageBox.Show("NOT_ADDED", MsgTxt.UnexpectedError, MessageBoxButtons.OK, MessageBoxIcon.Error); AdjustInventoryGeneralMgmt.DeleteAdjustEntry(GeneralNumber); AdjustInventoryDetailedMgmt.DeleteDetailedEntries(GeneralNumber); } } else { // MessageBox.Show(MsgTxt.UnexpectedError+"Please report it to calcium", MsgTxt.UnexpectedError, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Initialize_Adding_Mode() { AdjustDgView.Rows.Clear(); SaveAndPrintBtn.Text = "Save"; ReferenceNumberTxtBox.Text = AdjustInventoryGeneralMgmt.NextBillNumber().ToString(); AdjDatePicker.Text = DateTime.Today.ToShortDateString(); ExportAsPdfBtn.Visible = false; }
private void ListAdjustsBtn_Click(object sender, EventArgs e) { try { aAdjustList = AdjustInventoryGeneralMgmt.SelectAllAdjustsGeneral(-1, string.Empty, string.Empty); aAdjustDetailedSumVal = AdjustInventoryDetailedMgmt.SelectAllAdjustsDetailedSUMValue(-1, -1); aUsersTable = UsersMgmt.SelectAllUsers(); page(1); } catch (Exception ex) { MessageBox.Show("ERROR IN LIST ADJUST ITEMS" + ex.ToString(), MsgTxt.UnexpectedError, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static bool InventoryAdjustReport(int ReferenceNumber, bool TableBorder = false, bool Preview = true, bool PrintToThermal = false, bool ExportToPdf = false, bool ExportToExcel = false, string ExportPath = "", bool colored = false) { bool GenerateReportIs100Matched = false; DataTable InventoryGeneral = AdjustInventoryGeneralMgmt.SelectAllAdjustsGeneral(ReferenceNumber, string.Empty, string.Empty); if (InventoryGeneral == null) { return(false); } if (InventoryGeneral.Rows.Count == 0) { return(false); } DataTable InventoryDetailedTable = AdjustInventoryDetailedMgmt.SelectAllAdjustsDetailed(ReferenceNumber, -1); if (InventoryDetailedTable == null) { GenerateReportIs100Matched = true; } if (InventoryDetailedTable.Rows.Count == 0) { GenerateReportIs100Matched = true; } List <DataTable> aDataTableList = new List <DataTable>(); DataTable aDataTable1 = new DataTable(); aDataTable1.Columns.Add("[border=true1]" + "<th width=15%>" + ReportsText.BarcodeRepTxt); aDataTable1.Columns.Add("<th width=20%>" + ReportsText.DescriptionRepTxt); aDataTable1.Columns.Add("<th width=9%>" + ReportsText.AvgCostRepTxt); aDataTable1.Columns.Add("<th width=9%>" + ReportsText.AvaQtyRepTxt); aDataTable1.Columns.Add(ReportsText.PhysicalCountRepTxt); aDataTable1.Columns.Add(ReportsText.DifferencesRepTxt); aDataTable1.Columns.Add(ReportsText.DifferenceValueRepTxt); double TotalPositive = 0.00, TotalNegative = 0.00, ParsingTester = 0.00;; DataTable ItemsTable = ItemsMgmt.SelectAllItems(); foreach (DataRow aRow in InventoryDetailedTable.Rows) { if (double.Parse(aRow["DifferenceQty"].ToString()) == 0) { continue; } DataRow aToAddRow = aDataTable1.Rows.Add(); aToAddRow[0] = ReportsHelper.FindData(ItemsTable, "ID", "Barcode", aRow["ItemID"].ToString()); aToAddRow[1] = ReportsHelper.FindData(ItemsTable, "ID", "Description", aRow["ItemID"].ToString()); aToAddRow[2] = Math.Round(double.Parse(ReportsHelper.FindData(ItemsTable, "ID", "AvgUnitCost", aRow["ItemID"].ToString())), 3); aToAddRow[3] = Math.Round(double.Parse(aRow["OldQty"].ToString()), 3); aToAddRow[4] = aRow["NewQty"]; aToAddRow[5] = aRow["DifferenceQty"]; ParsingTester = double.Parse(aRow["DifferenceValue"].ToString()); aToAddRow[6] = ParsingTester; if (ParsingTester > 0) { TotalPositive += ParsingTester; } else { TotalNegative += ParsingTester; } } if (aDataTable1.Rows.Count == 0 || GenerateReportIs100Matched) { DataTable aEmptyTable = new DataTable(); aEmptyTable.Columns.Add("INVENTORY STOCK AVAILABLE QTY MATCHES 100% THE PHYSICAL COUNT"); aDataTableList.Add(aEmptyTable); } else { aDataTableList.Add(aDataTable1); DataRow NetRow = aDataTable1.Rows.Add(); string EmptyNoborderRow = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + ReportsHelper.MANUAL_TD_END; NetRow[0] = EmptyNoborderRow; NetRow[1] = EmptyNoborderRow; NetRow[2] = EmptyNoborderRow; NetRow[3] = EmptyNoborderRow; NetRow[4] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + ReportsText.TotalRepTxt + ReportsHelper.MANUAL_TD_END; NetRow[5] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + ReportsText.PosAdjValueRepTxt + ReportsHelper.MANUAL_TD_END; NetRow[6] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + TotalPositive + ReportsHelper.MANUAL_TD_END; NetRow = aDataTable1.Rows.Add(); NetRow[0] = EmptyNoborderRow; NetRow[1] = EmptyNoborderRow; NetRow[2] = EmptyNoborderRow; NetRow[3] = EmptyNoborderRow; NetRow[4] = EmptyNoborderRow; NetRow[5] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + ReportsText.NegAdjValueRepTxt + ReportsHelper.MANUAL_TD_END; NetRow[6] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + TotalNegative + ReportsHelper.MANUAL_TD_END; NetRow = aDataTable1.Rows.Add(); NetRow[0] = EmptyNoborderRow; NetRow[1] = EmptyNoborderRow; NetRow[2] = EmptyNoborderRow; NetRow[3] = EmptyNoborderRow; NetRow[4] = EmptyNoborderRow; NetRow[5] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + "<b>" + ReportsText.NetValueRepTxt + "<b>" + ReportsHelper.MANUAL_TD_END; NetRow[6] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + (TotalNegative + TotalPositive) + ReportsHelper.MANUAL_TD_END; } List <string> aStringList = ReportsHelper.ImportReportHeader(0, 1); List <string> aFooterList = ReportsHelper.ImportReportHeader(1, 1); aStringList.Add(SharedVariables.Line_Solid_10px_Black); aStringList.Add(ReportsNames.InventoryStockAdjustRepName); aStringList.Add("<h2>" + "Added On" + " " + InventoryGeneral.Rows[0]["Date"].ToString() + "</h2>"); aStringList.Add("<h2> " + "Added By" + ": " + UsersMgmt.SelectUserNameByID(int.Parse(InventoryGeneral.Rows[0]["TellerID"].ToString())) + "</h2>"); aStringList.Add("<h2>" + ReceiptText.RctTxtReprintedOn + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "</h2>"); aStringList.Add("<h2> " + ReceiptText.RctTxtReprintedBy + ": " + SharedFunctions.ReturnLoggedUserName() + "</h2>"); aStringList.Add(ReceiptText.RctTxtInvoiceNum + ": " + ReferenceNumber); aStringList.Add(SharedVariables.Line_Solid_10px_Black); if (Preview) { PrintingManager.Instance.PrintTables(aDataTableList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, PrintToThermal, false, false, "", false, "", colored); return(true); } else if (ExportToPdf) { PrintingManager.Instance.PrintTables(aDataTableList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, PrintToThermal, false, true, ExportPath, false, "", colored); return(true); } else if (ExportToExcel) { PrintingManager.Instance.PrintTables(aDataTableList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, PrintToThermal, false, false, "", true, ExportPath, colored); return(true); } else if (PrintToThermal) { PrintingManager.Instance.PrintTables(aDataTableList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, true, true, false, "", false, "", colored); return(true); } else { return(false); } }