public void GetInventoryChargeOffReport(InventoryChargeOffFields invFields)
        {
            //First get Report Object
            bool print = true;

            reportObject = GetReportObject("Inventory Charge Off", (int)ReportIDs.InventoryChargeOff, "InventoryChargeOff", "InventoryChargeOff.PDF");
            reportObject.InventoryChargeOffFields = invFields;
            InventoryChargeOffReport inv = new InventoryChargeOffReport(PdfLauncher.Instance);

            inv.ReportObject = reportObject;

            if (print)
            {
                inv.CreateReport(false);
                PrintAndStoreReport(Convert.ToInt32(invFields.ChargeOffNumber), "Inventory Charge Off");
            }
            else
            {
                inv.CreateReport(true);
            }
        }
Ejemplo n.º 2
0
        private void customButtonSubmit_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.None;

            if (richTextBoxComment.Text.Trim().Count() == 0)
            {
                MessageBox.Show("Comment should be entered");
                return;
            }
            if (comboBoxReason.SelectedItem.ToString() == "Donation" && charityOrg == null)
            {
                MessageBox.Show("Charge-off reason requires additional information that was not provided, please reselect reason and enter required information.");
                return;
            }
            System.Windows.Forms.Cursor currentCursor = this.Cursor;
            this.Cursor = Cursors.WaitCursor;

            if (customTextBoxAuthBy.isValid || !customTextBoxAuthBy.Required)
            {
                List <string> icn = new List <string>();
                icn.Add(ChargeOffItem.Icn);
                List <string> retailPrice = new List <string>();
                retailPrice.Add("0");
                List <string> jCase = new List <string>();
                jCase.Add("");
                List <string> statusReason = new List <string>();
                statusReason.Add(chargeoffReason);
                List <int> qty = new List <int>();
                qty.Add(ChargeOffItem.Quantity);
                string errorCode;
                string errorText;
                int    saleTicketNumber;

                bool retValue = MerchandiseProcedures.InsertInventoryChargeOff(GlobalDataAccessor.Instance.OracleDA,
                                                                               GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber,
                                                                               ShopDateTime.Instance.ShopDate.ToShortDateString(),
                                                                               ShopDateTime.Instance.ShopDate.ToShortDateString() + " " + ShopDateTime.Instance.ShopTime.ToString(),
                                                                               "",
                                                                               GlobalDataAccessor.Instance.DesktopSession.FullUserName,
                                                                               icn,
                                                                               qty,
                                                                               statusReason,
                                                                               retailPrice,
                                                                               "",
                                                                               "",
                                                                               "",
                                                                               "0",
                                                                               GlobalDataAccessor.Instance.DesktopSession.CashDrawerName,
                                                                               "SALE",
                                                                               "0",
                                                                               "0",
                                                                               jCase,
                                                                               customTextBoxAuthBy.Text,
                                                                               atfNumber,
                                                                               caseNumber,
                                                                               charityOrg,
                                                                               charityAddr,
                                                                               charityCity,
                                                                               charityState,
                                                                               charityZip,
                                                                               replacedICN,
                                                                               richTextBoxComment.Text.ToString(),
                                                                               out saleTicketNumber,
                                                                               out errorCode,
                                                                               out errorText);
                if (!retValue)
                {
                    FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Error trying to complete chargeoff " + errorText);
                    MessageBox.Show("Error completing charge off ");
                    return;
                }
                MessageBox.Show("Charge off completed successfully");

                this.DialogResult = DialogResult.OK;

                //set fields
                InventoryChargeOffFields invFields = new InventoryChargeOffFields();
                invFields.ATFIncidentNumber      = atfNumber;
                invFields.AuthorizedBy           = customTextBoxAuthBy.Text;
                invFields.ChargeOffAmount        = ChargeOffItem.ItemAmount.ToString("C");
                invFields.ChargeOffNumber        = saleTicketNumber.ToString();
                invFields.CharitableOrganization = charityOrg;
                invFields.Comment = richTextBoxComment.Text.ToString();

                if (!string.IsNullOrEmpty(GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.LastName) && !string.IsNullOrEmpty(GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.FirstName))
                {
                    invFields.CustomerName = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.LastName + ", " +
                                             GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.FirstName;
                }
                else
                {
                    invFields.CustomerName = string.Empty;
                }

                invFields.EmployeeNumber         = GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile.EmployeeNumber;
                invFields.ICN                    = ChargeOffItem.Icn;
                invFields.MerchandiseDescription = ChargeOffItem.TicketDescription;
                invFields.PoliceCaseNumber       = caseNumber;
                invFields.ReasonForChargeOff     = chargeoffReason;
                invFields.ReplacementLoanNumber  = string.Empty;
                invFields.GunNumber              = ChargeOffItem.GunNumber;
                invFields.IsGun                  = ChargeOffItem.IsGun;
                CreateReportObject cro = new CreateReportObject();
                cro.GetInventoryChargeOffReport(invFields);
                //document generation here
                //chargeoffReason, charityOrg, caseNumber, atfNumber, customTextBoxAuthBy.Text,saleTicketNumber,  ChargeOffItem.TicketDescription
                // richTextBoxComment.Text.ToString()
                this.Close();
            }
            else
            {
                MessageBox.Show("Authorized by should be entered");
                return;
            }
        }