Exemplo n.º 1
0
        private void submitButton_Click(object sender, EventArgs e)
        {
            string errorCode;
            string errorText;

            CustomerVO customerObj = null;
            LayawayVO  layawayObj  = null;

            bool retVal = RetailProcedures.GetLayawayData(GlobalDataAccessor.Instance.DesktopSession, GlobalDataAccessor.Instance.OracleDA, Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0),
                                                          Utilities.GetIntegerValue(txtLayawayNumber.Text, 0), "0", StateStatus.BLNK, "LAY", true, out layawayObj, out customerObj, out errorCode, out errorText);

            if (!retVal || layawayObj == null)
            {
                MessageBox.Show("No records found or not the originating shop of the number entered.");
                txtLayawayNumber.Focus();
                return;
            }
            //Check if the layaway has a status of PAID in which case only the sale can be refunded and not the layaway payment
            if (layawayObj.LoanStatus == ProductStatus.PAID)
            {
                MessageBox.Show("Layaway has been paid out. Can only refund sale at this point.");
                txtLayawayNumber.Focus();
                return;
            }
            //SR 07/01/2011 Check if the layaway has a status of LAY. Any other status cannot be refunded.
            if (layawayObj.LoanStatus != ProductStatus.ACT)
            {
                MessageBox.Show("Layaway is in " + layawayObj.LoanStatus.ToString() + " status. Cannot be refunded.");
                txtLayawayNumber.Focus();
                return;
            }

            /*int maxDaysForRefundEligibility = BusinessRulesProcedures.GetMaxDaysForRefundEligibility(CDS.CurrentSiteId);
             * if (ShopDateTime.Instance.FullShopDateTime > layawayObj.DateMade.AddDays(maxDaysForRefundEligibility))
             * {
             *  MessageBox.Show("The number of days eligible for refund has expired for the MSR number entered");
             *  return;
             * }?*/

            GlobalDataAccessor.Instance.DesktopSession.Layaways = new List <LayawayVO>();
            GlobalDataAccessor.Instance.DesktopSession.Layaways.Add(layawayObj);
            GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj;
            NavControlBox.IsCustom     = true;
            NavControlBox.CustomDetail = "SHOWITEMS";
            NavControlBox.Action       = NavBox.NavAction.BACKANDSUBMIT;
        }
        private void customButtonOK_Click(object sender, EventArgs e)
        {
            labelErrorMessage.Visible = false;
            noDataFound = false;
            PurchaseVO     purchaseObj         = null;
            CustomerVO     customerObj         = null;
            SaleVO         saleObj             = null;
            LayawayVO      layawayObj          = null;
            CashTransferVO bankTransferObj     = null;
            CashTransferVO shopCashTransferObj = null;
            DataSet        mdseInfo            = null;
            string         errorCode;
            string         errorText;

            getCustomerInfo = true;
            string tenderType;

            GlobalDataAccessor.Instance.DesktopSession.Purchases = new List <PurchaseVO>();
            GlobalDataAccessor.Instance.DesktopSession.Sales     = new List <SaleVO>();
            GlobalDataAccessor.Instance.DesktopSession.Layaways  = new List <LayawayVO>();
            ReleaseFingerprintsInfo releaseFingerprintsequest = null;
            bool retValue = false;

            if (voidBuyReturn)
            {
                retValue = PurchaseProcedures.GetPurchaseData(Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0),
                                                              Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "2", StateStatus.BLNK, "RET", true, out purchaseObj, out customerObj, out tenderType, out errorCode, out errorText);
            }
            else if (voidBuy)
            {
                retValue = PurchaseProcedures.GetPurchaseData(Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0),
                                                              Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "2", StateStatus.BLNK, "", true, out purchaseObj, out customerObj, out tenderType, out errorCode, out errorText);
            }
            else if (voidSale)
            {
                retValue = RetailProcedures.GetSaleData(GlobalDataAccessor.Instance.DesktopSession, GlobalDataAccessor.Instance.OracleDA, Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0),
                                                        Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "3", StateStatus.BLNK, "SALE", false, out saleObj, out customerObj, out errorCode, out errorText);
            }
            else if (voidLayaway)
            {
                retValue = RetailProcedures.GetLayawayData(GlobalDataAccessor.Instance.DesktopSession, GlobalDataAccessor.Instance.OracleDA, Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0),
                                                           Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "4", StateStatus.BLNK, "ALL", false, out layawayObj, out customerObj, out errorCode, out errorText);
            }
            else if (voidSaleRefund)
            {
                retValue = RetailProcedures.GetSaleData(GlobalDataAccessor.Instance.DesktopSession, GlobalDataAccessor.Instance.OracleDA, Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0),
                                                        Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "3", StateStatus.BLNK, "REFUND", false, out saleObj, out customerObj, out errorCode, out errorText);
            } //BZ # 419
            else if (voidBanktoShopCashTransfer)
            {
                retValue = ShopCashProcedures.GetBankTransferDetails(customTextBoxTranNo.Text, "BANKTOSHOP", GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, GlobalDataAccessor.Instance.DesktopSession,
                                                                     out bankTransferObj, out errorCode, out errorText);
            }
            else if (voidShopToBankCashTransfer)
            {
                retValue = ShopCashProcedures.GetBankTransferDetails(customTextBoxTranNo.Text, "SHOPTOBANK", GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, GlobalDataAccessor.Instance.DesktopSession,
                                                                     out bankTransferObj, out errorCode, out errorText);
            }//BZ # 419 end

            else if (voidStoreCashTransfer)
            {
                string storeNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
                retValue = ShopCashProcedures.GetShopCashTransferData(customTextBoxTranNo.Text, "", storeNumber, GlobalDataAccessor.Instance.DesktopSession, out shopCashTransferObj, out errorCode, out errorText);
            }
            else if (voidMerchandiseTransfer)
            {
                string storeNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
                string tranNo      = customTextBoxTranNo.Text;

                if (customTextBoxTranNo.Text.Length > 6)
                {
                    tranNo = tranNo.Substring(5);
                }

                retValue = VoidProcedures.getTransferToVoid(Utilities.GetIntegerValue(tranNo, 0),
                                                            storeNumber, out mdseInfo, out errorCode, out errorText);
                //                retValue = VoidProcedures.GetEligibleToScrapItems(Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0),
                //                    storeNumber, out mdse , out errorCode, out errorText);
            }
            else if (voidReleaseFingerprints)
            {
                string storeNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
                string tranNo      = customTextBoxTranNo.Text;

                if (tranNo.Length > 6)
                {
                    tranNo = tranNo.Substring(5);
                }

                // Add procedure to VoidsProcedurees to Locate the Release Fingerprint Authorization
                GlobalDataAccessor.Instance.FingerPrintRelaseAuthorizationInfo =
                    HoldsProcedures.GetReleaseFingerprintAuthorization(tranNo,
                                                                       storeNumber, out errorCode, out errorText);
            }

            if (voidBuy || voidBuyReturn)
            {
                if (retValue && purchaseObj != null)
                {
                    GlobalDataAccessor.Instance.DesktopSession.Purchases.Add(purchaseObj);
                    if (purchaseObj.EntityType != "V" && customerObj != null)
                    {
                        GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj;
                    }

                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                }
                else
                {
                    noDataFound = true;
                }
            }
            else if (voidSale || voidSaleRefund)
            {
                if (retValue && saleObj != null)
                {
                    if (saleObj.RefType == "4")
                    {
                        MessageBox.Show("This sale originated from a layaway. You have to void the last layaway payment and not the sale");
                        return;
                    }
                    GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj;
                    GlobalDataAccessor.Instance.DesktopSession.Sales.Add(saleObj);
                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                }
                else
                {
                    noDataFound = true;
                }
            }
            else if (voidLayaway)
            {
                if (retValue && layawayObj != null)
                {
                    GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj;
                    GlobalDataAccessor.Instance.DesktopSession.Layaways.Add(layawayObj);
                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                }
                else
                {
                    noDataFound = true;
                }
            }
            //BZ # 419
            //else if (voidCashTransfer)
            else if (voidBanktoShopCashTransfer || voidShopToBankCashTransfer)
            {
                //BZ # 419 end
                if (retValue && bankTransferObj != null)
                {
                    GlobalDataAccessor.Instance.DesktopSession.CashTransferData = bankTransferObj;
                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                }
                else
                {
                    noDataFound = true;
                }
            }
            else if (voidStoreCashTransfer)
            {
                if (retValue && shopCashTransferObj != null)
                {
                    GlobalDataAccessor.Instance.DesktopSession.CashTransferData = shopCashTransferObj;
                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                }
                else
                {
                    noDataFound = true;
                }
            }
            else if (voidMerchandiseTransfer)
            {
                if (retValue && mdseInfo != null && mdseInfo.Tables.Count > 0)
                {
                    if (isFaultyTransferINOUT(mdseInfo))
                    {
                        noDataFound = true;
                    }
                    else
                    {
                        GlobalDataAccessor.Instance.DesktopSession.MdseTransferData       = mdseInfo;
                        GlobalDataAccessor.Instance.DesktopSession.SelectedTransferNumber = customTextBoxTranNo.Text;
                        GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                    }
                }
                else
                {
                    noDataFound = true;
                }
            }
            else if (voidReleaseFingerprints && GlobalDataAccessor.Instance.FingerPrintRelaseAuthorizationInfo != null)
            {
                this.DialogResult = DialogResult.OK;
                //GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
            }

            if (noDataFound)
            {
                labelErrorMessage.Text    = "The number entered is not valid. Please enter another number";
                labelErrorMessage.Visible = true;
                return;
            }
        }
Exemplo n.º 3
0
 void bwLookupLayawayTicket_DoWork(object sender, DoWorkEventArgs e)
 {
     _retValue = RetailProcedures.GetLayawayData(GlobalDataAccessor.Instance.DesktopSession, GlobalDataAccessor.Instance.OracleDA, Convert.ToInt32(_storeNumber),
                                                 _ticketNumber, "0", StateStatus.BLNK, "LAY", true, out _layaway, out _custObject, out _errorCode, out _errorText);
 }