コード例 #1
0
        private void printTransferData(string transferStatus)
        {
            //Load the data in cashtransfervo object for printing
            CashTransferVO shoptransfervo = new CashTransferVO();

            shoptransfervo.TransferNumber      = selectedTransferNumber;
            shoptransfervo.TransferAmount      = Utilities.GetDecimalValue(transferAmount);
            shoptransfervo.TransferStatus      = transferStatus;
            shoptransfervo.SourceComment       = labelSourceComment.Text;
            shoptransfervo.DestinationComment  = richTextBoxDestComment.Text;
            shoptransfervo.DestinationEmployee = GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile.UserName + "," +
                                                 GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile.EmployeeNumber;
            shoptransfervo.SourceEmployee = sourceEmployee;

            SiteId sourceSite = new SiteId();

            sourceSite.StoreNumber        = labelSourceShop.Text;
            sourceSite.StoreName          = sourceShopName;
            sourceSite.StorePhoneNo       = labelSourceShopPhone.Text;
            sourceSite.StoreAddress1      = labelSourceShopAddr1.Text;
            sourceSite.StoreAddress2      = labelSourceShopAddr2.Text;
            shoptransfervo.SourceShopInfo = sourceSite;


            SiteId destSite = new SiteId();

            destSite.StoreNumber               = labelDestShop.Text;
            destSite.StoreName                 = destinationShopName;
            destSite.StorePhoneNo              = labelDestPhone.Text;
            destSite.StoreAddress1             = labelDestAddr1.Text;
            destSite.StoreAddress2             = labelDestAddr2.Text;
            shoptransfervo.DestinationShopInfo = destSite;


            ShopToShopCashTransfer shopTransferFrm = new ShopToShopCashTransfer();

            shopTransferFrm.ShopTransferData = shoptransfervo;
            shopTransferFrm.ShowDialog();
        }
コード例 #2
0
        private void ShopTransferOut_Load(object sender, EventArgs e)
        {
            if (GlobalDataAccessor.Instance.DesktopSession.CashTransferData != null)
            {
                CashTransferVO cashTransferData = GlobalDataAccessor.Instance.DesktopSession.CashTransferData;
                labelSourceShopNo.Text = Utilities.GetStringValue(cashTransferData.SourceShopInfo.StoreNumber);
                labelSourceAddr1.Text  = Utilities.GetStringValue(cashTransferData.SourceShopInfo.StoreAddress1);
                labelSourceAddr2.Text  = Utilities.GetStringValue(cashTransferData.SourceShopInfo.StoreCityName) +
                                         "," + Utilities.GetStringValue(cashTransferData.SourceShopInfo.State) +
                                         " " + Utilities.GetStringValue(cashTransferData.SourceShopInfo.StoreZipCode);
                labelSourceManager.Text       = Utilities.GetStringValue(cashTransferData.SourceShopInfo.StoreManager);
                labelSourcePhone.Text         = Utilities.GetStringValue(cashTransferData.SourceShopInfo.StorePhoneNo);
                customTextBoxTransporter.Text = Utilities.GetStringValue(cashTransferData.Transporter);
                customTextBoxBagNo.Text       = Utilities.GetStringValue(cashTransferData.DepositBagNo);
                richTextBoxComment.Text       = Utilities.GetStringValue(cashTransferData.SourceComment);
                customTextBoxDestShopNo.Text  = Utilities.GetStringValue(cashTransferData.DestinationShopInfo.StoreNumber);
                labelDestAddr1.Text           = Utilities.GetStringValue(cashTransferData.DestinationShopInfo.StoreAddress1);
                labelDestAddr2.Text           = Utilities.GetStringValue(cashTransferData.DestinationShopInfo.StoreCityName) +
                                                "," + Utilities.GetStringValue(cashTransferData.DestinationShopInfo.State) +
                                                " " + Utilities.GetStringValue(cashTransferData.DestinationShopInfo.StoreZipCode);
                labelDestManager.Text            = Utilities.GetStringValue(cashTransferData.DestinationShopInfo.StoreManager);
                transferAmount                   = Utilities.GetDecimalValue(cashTransferData.TransferAmount);
                customTextBoxTrAmount.Text       = string.Format("{0:C}", transferAmount);
                labelDestPhone.Text              = Utilities.GetStringValue(cashTransferData.DestinationShopInfo.StorePhoneNo);
                labelTransferDate.Text           = Utilities.GetDateTimeValue(cashTransferData.TransferDate).ToShortDateString();
                labelTransferTime.Visible        = false;
                labelTransferTimeHeading.Visible = false;
                labelTransferStatus.Text         = Utilities.GetStringValue(cashTransferData.TransferStatus);
                labelCashDrawerName.Text         = GlobalDataAccessor.Instance.DesktopSession.StoreSafeName;
                //disable buttons and make controls readonly
                customButtonFind.Visible         = false;
                pictureBox1.Visible              = false;
                customTextBoxDestShopNo.Enabled  = false;
                customTextBoxTrAmount.Enabled    = false;
                customTextBoxTransporter.Enabled = false;
                customTextBoxBagNo.Enabled       = false;
                richTextBoxComment.Enabled       = false;
                customLabelComment.Visible       = true;
                customTextBoxComment.Visible     = true;
                customButtonSubmit.Text          = VOID;
                customButtonSubmit.Enabled       = true;
            }
            else
            {
                SiteId currentSite = GlobalDataAccessor.Instance.CurrentSiteId;
                labelSourceAddr1.Text    = currentSite.StoreAddress1;
                labelSourceAddr2.Text    = currentSite.StoreCityName + "," + currentSite.State + " " + currentSite.StoreZipCode;
                labelSourcePhone.Text    = currentSite.StorePhoneNo;
                labelSourceShopNo.Text   = currentSite.StoreNumber;
                labelSourceManager.Text  = currentSite.StoreManager;
                labelCashDrawerName.Text = GlobalDataAccessor.Instance.DesktopSession.StoreSafeName;
                labelTransferDate.Text   = ShopDateTime.Instance.ShopDate.ToShortDateString();
                labelTransferTime.Text   = string.Format("{0:t}", ShopDateTime.Instance.ShopDateCurTime);

                currencyEntry1.Calculate        += currencyEntry1_Calculate;
                currencyEntry1.OtherTenderClick += currencyEntry1_OtherTenderClick;
                customButtonSubmit.Enabled       = false;
            }
            //Do not show the currency panel when it first loads
            panelCurrency.Visible = false;
            pictureBox1.Image     = Common.Properties.Resources.plus_icon_small;
            panel2.Location       = new Point(3, 106);
            this.Size             = new Size(777, 492);
        }
コード例 #3
0
 private void customButtonSubmit_Click(object sender, EventArgs e)
 {
     if (customButtonSubmit.Text == VOID)
     {
         GlobalDataAccessor.Instance.beginTransactionBlock();
         bool retValue = VoidProcedures.VoidStoreCashTransfer(GlobalDataAccessor.Instance.OracleDA,
                                                              GlobalDataAccessor.Instance.DesktopSession.CashTransferData.TransferId,
                                                              GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber,
                                                              "",
                                                              customTextBoxComment.Text,
                                                              GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile.UserID,
                                                              ShopDateTime.Instance.ShopDate.FormatDate() + " " + ShopDateTime.Instance.ShopTime.ToString(),
                                                              transferAmount.ToString(),
                                                              GlobalDataAccessor.Instance.DesktopSession.StoreSafeID,
                                                              out errorCode,
                                                              out errorText);
         if (!retValue)
         {
             GlobalDataAccessor.Instance.DesktopSession.endTransactionBlock(EndTransactionType.ROLLBACK);
             FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Void store to store cash Transfer failed " + errorText);
         }
         else
         {
             GlobalDataAccessor.Instance.DesktopSession.endTransactionBlock(EndTransactionType.COMMIT);
             MessageBox.Show(@"Void store to store cash Transfer completed successfully");
         }
     }
     else
     {
         List <string> denominationData = new List <string>();
         if (panelCurrency.Visible)
         {
             denominationData = currencyEntry1.CurrencyEntryData();
         }
         else
         {
             denominationData.Add("");
         }
         if (string.IsNullOrEmpty(customTextBoxDestShopNo.Text) || string.IsNullOrEmpty(customTextBoxTrAmount.Text) ||
             string.IsNullOrEmpty(customTextBoxTransporter.Text) && destinationStoreDataFound)
         {
             MessageBox.Show(@"Fill in the required information and submit");
             return;
         }
         if (customTextBoxDestShopNo.Text == labelSourceShopNo.Text)
         {
             MessageBox.Show(@"Source and destination stores cannot be the same");
             return;
         }
         GlobalDataAccessor.Instance.beginTransactionBlock();
         string transferAmount = customTextBoxTrAmount.Text;
         if (transferAmount.StartsWith("$"))
         {
             transferAmount = transferAmount.Substring(1);
         }
         int  transferNumber = 0;
         bool retVal         = ShopCashProcedures.InsertShopTransfer(
             CashTransferTypes.SHOPTOSHOP.ToString(),
             labelSourceShopNo.Text,
             customTextBoxDestShopNo.Text,
             Utilities.GetDecimalValue(transferAmount),
             customTextBoxTransporter.Text,
             customTextBoxBagNo.Text,
             richTextBoxComment.Text,
             GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile.UserID,
             ShopDateTime.Instance.ShopDate.FormatDate() + " " + ShopDateTime.Instance.ShopTime.ToString(),
             GlobalDataAccessor.Instance.DesktopSession.StoreSafeID,
             DENOMINATIONCURRENCY,
             denominationData,
             GlobalDataAccessor.Instance.DesktopSession,
             out transferNumber,
             out errorCode,
             out errorText);
         if (retVal)
         {
             GlobalDataAccessor.Instance.DesktopSession.endTransactionBlock(EndTransactionType.COMMIT);
             MessageBox.Show(@"Shop cash transfer successfully entered");
             //Load the data in cashtransfervo object for printing
             CashTransferVO shoptransfervo = new CashTransferVO();
             shoptransfervo.TransferNumber = Utilities.GetIntegerValue(transferNumber, 0);
             shoptransfervo.TransferAmount = Utilities.GetDecimalValue(transferAmount);
             shoptransfervo.TransferStatus = CashTransferStatusCodes.PENDING.ToString();
             shoptransfervo.Transporter    = customTextBoxTransporter.Text;
             shoptransfervo.SourceComment  = richTextBoxComment.Text;
             shoptransfervo.SourceEmployee = GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile.UserName + "," +
                                             GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile.EmployeeNumber;
             shoptransfervo.SourceShopInfo = GlobalDataAccessor.Instance.CurrentSiteId;
             SiteId destSite = new SiteId();
             destSite.StoreNumber               = customTextBoxDestShopNo.Text;
             destSite.StoreName                 = destShopName;
             destSite.StorePhoneNo              = labelDestPhone.Text;
             destSite.StoreAddress1             = labelDestAddr1.Text;
             destSite.StoreAddress2             = labelDestAddr2.Text;
             shoptransfervo.DestinationShopInfo = destSite;
             ShopToShopCashTransfer shopTransferFrm = new ShopToShopCashTransfer();
             shopTransferFrm.ShopTransferData = shoptransfervo;
             shopTransferFrm.ShowDialog();
         }
         else
         {
             GlobalDataAccessor.Instance.DesktopSession.endTransactionBlock(EndTransactionType.ROLLBACK);
             FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Shop transfer data not saved " + errorText);
         }
     }
     this.Close();
 }
コード例 #4
0
        private void VoidBankTransfer_Load(object sender, EventArgs e)
        {
            bankCashTransferData = GlobalDataAccessor.Instance.DesktopSession.CashTransferData;

            customLabelTransferNumber.Text = "";
            customLabelDate.Text           = "";
            customLabelUserId.Text         = "";
            customLabelSafe.Text           = "";
            customLabelTrAmount.Text       = "";
            customLabelBankName.Text       = "";
            customLabelAcctNumber.Text     = "";
            customLabelCheckNumber.Text    = "";
            customButtonVoid.Enabled       = false;

            try
            {
                //BZ # 419
                if (bankCashTransferData != null)
                {
                    if (isBankToShop)
                    {
                        this.labelHeading.Text = "Transfer To Shop";

                        this.customLabelSafeHeading.Location = new System.Drawing.Point(327, 181);
                        this.customLabelSafe.Location        = new System.Drawing.Point(400, 181);

                        this.customLabelBankNameHeading.Location = new System.Drawing.Point(61, 181);
                        customLabelBankName.Location             = new System.Drawing.Point(147, 181);

                        this.customLabelAcctNumHeading.Location = new System.Drawing.Point(61, 202);
                        customLabelAcctNumber.Location          = new System.Drawing.Point(147, 202);

                        this.customLabelChkNumHeading.Location = new System.Drawing.Point(61, 223);
                        customLabelCheckNumber.Location        = new System.Drawing.Point(147, 223);

                        //customLabelTrAmount.Location = new System.Drawing.Point(147, 244);
                        this.customLabelTrAmtHeading.Location = new System.Drawing.Point(61, 244);
                        this.customLabelTrAmount.Location     = new System.Drawing.Point(155, 244);

                        this.customLabelComment.Location   = new System.Drawing.Point(61, 282);
                        this.customTextBoxComment.Location = new System.Drawing.Point(141, 282);
                    }
                    else
                    {
                        this.labelHeading.Text = "Transfer To Bank";
                    }
                    selectedTransferId             = bankCashTransferData.TransferId;
                    selectedTransferType           = bankCashTransferData.TransferType;
                    customLabelTransferNumber.Text = bankCashTransferData.TransferNumber.ToString();
                    var dtTransferDate = Utilities.GetDateTimeValue(bankCashTransferData.TransferDate, DateTime.Now);
                    customLabelDate.Text        = string.Format("{0} {1}", dtTransferDate.FormatDate(), dtTransferDate.ToShortTimeString());
                    customLabelUserId.Text      = bankCashTransferData.SourceEmployee;
                    customLabelSafe.Text        = GlobalDataAccessor.Instance.DesktopSession.StoreSafeName;
                    transferAmount              = bankCashTransferData.TransferAmount;
                    customLabelTrAmount.Text    = String.Format("{0:C}", transferAmount);
                    customLabelBankName.Text    = bankCashTransferData.BankName;
                    customLabelAcctNumber.Text  = bankCashTransferData.BankAccountNumber;
                    customLabelCheckNumber.Text = bankCashTransferData.CheckNumber;
                    customButtonVoid.Enabled    = true;
                }
            }
            catch (Exception ex)
            {
                FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Error when fetching bank transfer details " + ex.Message);
            }
        }
コード例 #5
0
        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;
            }
        }
コード例 #6
0
        private void customButtonSubmit_Click(object sender, EventArgs e)
        {
            string selectedBankId = comboBoxBankData.SelectedValue.ToString();

            if (!string.IsNullOrEmpty(selectedBankId) && !string.IsNullOrEmpty(customTextBoxTrAmount.Text) &&
                customTextBoxBagNo.isValid)
            {
                string bankName          = string.Empty;
                string bankRoutingNumber = string.Empty;
                string bankAccountNumber = string.Empty;
                if (selectedBankId.Equals(BNL))
                {
                    selectedBankId    = string.Empty;
                    bankName          = customTextBoxBankName.Text;
                    bankRoutingNumber = customTextBoxRoutingNumber.Text;
                    bankAccountNumber = customTextBoxAcctNumber.Text;
                    if (string.IsNullOrEmpty(bankName) || string.IsNullOrEmpty(bankRoutingNumber) ||
                        string.IsNullOrEmpty(bankAccountNumber))
                    {
                        MessageBox.Show("Enter Bank details and submit");
                        return;
                    }
                }
                string transferAmount = customTextBoxTrAmount.Text;
                if (transferAmount.StartsWith("$"))
                {
                    transferAmount = transferAmount.Substring(1);
                }
                if (Utilities.GetDecimalValue(transferAmount, 0) > 0)
                {
                    GlobalDataAccessor.Instance.beginTransactionBlock();
                    bool retVal = ShopCashProcedures.InsertBankTransfer(selectedBankId, DENOMINATIONCURRENCY,
                                                                        GlobalDataAccessor.Instance.DesktopSession.StoreSafeID,
                                                                        string.Format("{0} {1}", ShopDateTime.Instance.ShopDate.FormatDate(), ShopDateTime.Instance.ShopTime.ToString()),
                                                                        "", GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile.UserID,
                                                                        Utilities.GetDecimalValue(transferAmount).ToString(), CashTransferTypes.SHOPTOBANK.ToString(),
                                                                        GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, "",
                                                                        customTextBoxBagNo.Text, bankName, bankAccountNumber, bankRoutingNumber, GlobalDataAccessor.Instance.DesktopSession,
                                                                        out transferNumber, out errorCode, out errorText);
                    if (retVal)
                    {
                        MessageBox.Show(@"Bank Transfer data successfully inserted");
                        GlobalDataAccessor.Instance.DesktopSession.endTransactionBlock(EndTransactionType.COMMIT);

                        CashTransferVO bankTransferdata = new CashTransferVO();
                        bankTransferdata.TransferNumber            = transferNumber;
                        bankTransferdata.TransferStatus            = CashTransferStatusCodes.ACCEPTED.ToString();
                        bankTransferdata.TransferAmount            = Utilities.GetDecimalValue(transferAmount, 0);
                        bankTransferdata.BankName                  = comboBoxBankData.Text.ToString();
                        bankTransferdata.DepositBagNo              = customTextBoxBagNo.Text;
                        bankTransferdata.DestinationEmployeeName   = GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile.UserName;
                        bankTransferdata.DestinationEmployeeNumber = GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile.EmployeeNumber;
                        SiteId sourceSite = new SiteId();
                        sourceSite = GlobalDataAccessor.Instance.CurrentSiteId;
                        bankTransferdata.SourceShopInfo = sourceSite;
                        BankAndInternalCashTransfer bankTransferFrm = new BankAndInternalCashTransfer();
                        bankTransferFrm.CashTransferdata = bankTransferdata;
                        bankTransferFrm.TransferToBank   = true;
                        bankTransferFrm.ShowDialog();
                    }
                    else
                    {
                        GlobalDataAccessor.Instance.DesktopSession.endTransactionBlock(EndTransactionType.ROLLBACK);
                        FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Bank Transfer from store failed " + errorText);
                    }
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Transfer amount cannot be 0");
                    return;
                }
            }
            else
            {
                MessageBox.Show(@"Fill in all the required information and submit");
                return;
            }
        }
コード例 #7
0
        private void customButtonSubmit_Click(object sender, EventArgs e)
        {
            string errorCode;
            string errorText;

            //Validate the user
            if (callLdap(customTextBoxDestUser.Text, customTextBoxDestUserPwd.Text))
            {
                var cashdrawerstatus = string.Empty;
                if ((TransferToSafe && transferUserSafeAccess) || (!TransferToSafe && GlobalDataAccessor.Instance.DesktopSession.IsUserAssignedCashDrawer(customTextBoxDestUser.Text,
                                                                                                                                                          comboBoxCashDrawerData.Text.ToString(), out cashdrawerstatus)))
                {
                    if (cashdrawerstatus != "1")
                    {
                        //Check if the cash drawer was balanced today
                        //If it is we show a message that the cash drawer needs to be rebalanced
                        //else proceed.
                        bool cashdrawerbalanced;
                        ShopCashProcedures.CheckCashDrawerBalanced(comboBoxCashDrawerData.SelectedValue.ToString(),
                                                                   ShopDateTime.Instance.ShopDate.FormatDate(), GlobalDataAccessor.Instance.DesktopSession,
                                                                   out cashdrawerbalanced, out errorCode, out errorText);
                        if (cashdrawerbalanced)
                        {
                            MessageBox.Show(Commons.GetMessageString("WM02RebalanceDrawerRequired") + " " +
                                            comboBoxCashDrawerData.Text);
                        }
                        //Open the cash drawer of the destination user
                        string    errorMsg;
                        string    cdID             = comboBoxCashDrawerData.SelectedValue.ToString();
                        const int cashDrawerStatus = (int)CASHDRAWERSTATUS.OPEN;
                        string    workstationID    = SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.WorkstationId;

                        if (!ShopCashProcedures.UpdateSafeStatus(cdID, GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber,
                                                                 customTextBoxDestUser.Text.ToString(), ShopDateTime.Instance.ShopDate.FormatDate(), cashDrawerStatus.ToString(),
                                                                 workstationID, GlobalDataAccessor.Instance.DesktopSession,
                                                                 out errorCode, out errorMsg))
                        {
                            FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Error when trying to open the cash drawer" + errorMsg);
                        }
                    }
                    DestinationUserValidated = true;
                }
                else
                {
                    MessageBox.Show(@"The destination user is not authorized to receive transfer to the selected cash drawer or safe");
                    return;
                }
            }
            else
            {
                MessageBox.Show(@"Destination user credentials invalid");
                return;
            }
            string transferAmount = customTextBoxTrAmount.Text;

            if (transferAmount.StartsWith("$"))
            {
                transferAmount = transferAmount.Substring(1);
            }

            if (Utilities.GetDecimalValue(transferAmount, 0) == 0)
            {
                MessageBox.Show("Transfer amount cannot be 0");
                return;
            }
            string sourceCashDrawerId;

            if (TransferFromSafe)
            {
                sourceCashDrawerId = GlobalDataAccessor.Instance.DesktopSession.StoreSafeID;
            }
            else
            {
                sourceCashDrawerId = GlobalDataAccessor.Instance.DesktopSession.CashDrawerId;
            }
            string selectedCashDrawerId = comboBoxCashDrawerData.SelectedValue.ToString();

            if (!string.IsNullOrEmpty(selectedCashDrawerId) && !string.IsNullOrEmpty(customTextBoxTrAmount.Text) &&
                DestinationUserValidated)
            {
                int transferNumber;
                GlobalDataAccessor.Instance.beginTransactionBlock();
                bool retVal = ShopCashProcedures.InsertcashTransfer(sourceCashDrawerId, selectedCashDrawerId,
                                                                    Utilities.GetDecimalValue(transferAmount, 0), DENOMINATIONCURRENCY,
                                                                    ShopDateTime.Instance.ShopDate.FormatDate().ToString() + " " + ShopDateTime.Instance.ShopTime.ToString(), GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile.UserID,
                                                                    customTextBoxDestUser.Text, GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, GlobalDataAccessor.Instance.DesktopSession,
                                                                    out transferNumber, out errorCode, out errorText);

                if (retVal)
                {
                    GlobalDataAccessor.Instance.endTransactionBlock(EndTransactionType.COMMIT);
                    MessageBox.Show(@"Internal Cash Transfer Created Successfully");
                    string         destinationUser  = customTextBoxDestUser.Text;
                    CashTransferVO cashTransferdata = new CashTransferVO();
                    cashTransferdata.TransferNumber     = transferNumber;
                    cashTransferdata.TransferStatus     = CashTransferStatusCodes.ACCEPTED.ToString();
                    cashTransferdata.TransferAmount     = Utilities.GetDecimalValue(transferAmount, 0);
                    cashTransferdata.SourceEmployeeName = GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile.UserFirstName + " " + GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile.UserLastName;
                    string sourceUserName = GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile.UserName;
                    cashTransferdata.SourceEmployeeNumber = sourceUserName.Substring(sourceUserName.Length - 5, 5);
                    if (TransferFromSafe)
                    {
                        cashTransferdata.SourceDrawerName = GlobalDataAccessor.Instance.DesktopSession.StoreSafeName;
                    }
                    else
                    {
                        cashTransferdata.SourceDrawerName = GlobalDataAccessor.Instance.DesktopSession.CashDrawerName;
                    }
                    cashTransferdata.DestinationDrawerName     = comboBoxCashDrawerData.Text.ToString();
                    cashTransferdata.DestinationEmployeeName   = userDisplayName;
                    cashTransferdata.DestinationEmployeeNumber = destinationUser.Substring(destinationUser.Length - 5, 5);
                    var sourceSite = new SiteId();
                    sourceSite = GlobalDataAccessor.Instance.CurrentSiteId;
                    cashTransferdata.SourceShopInfo = sourceSite;
                    var bankTransferFrm = new BankAndInternalCashTransfer();
                    bankTransferFrm.CashTransferdata = cashTransferdata;
                    bankTransferFrm.TransferToBank   = false;
                    bankTransferFrm.InternalTransfer = true;
                    bankTransferFrm.ShowDialog();
                }
                else
                {
                    FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Internal Cash Transfer from store failed " + errorText);
                    GlobalDataAccessor.Instance.endTransactionBlock(EndTransactionType.ROLLBACK);
                }
                this.Close();
            }
            else
            {
                MessageBox.Show(@"Fill in all the required information and submit");
                return;
            }
        }
コード例 #8
0
        private void ShopTransferIn_Load(object sender, EventArgs e)
        {
            selectedTransferNumber   = GlobalDataAccessor.Instance.DesktopSession.SelectedStoreCashTransferNumber;
            selectedTransferId       = GlobalDataAccessor.Instance.DesktopSession.SelectedStoreCashTransferID;
            labelTransferNumber.Text = selectedTransferNumber.ToString();
            string    errorCode;
            string    errorText;
            DataTable transferDetails;
            DataTable denominationDetails;

            Back = false;
            if (GlobalDataAccessor.Instance.DesktopSession.CashTransferData != null)
            {
                CashTransferVO cashTransferData = GlobalDataAccessor.Instance.DesktopSession.CashTransferData;
                labelSourceShopNo.Text    = Utilities.GetStringValue(cashTransferData.SourceShopInfo.StoreNumber);
                labelSourceShopAddr1.Text = Utilities.GetStringValue(cashTransferData.SourceShopInfo.StoreAddress1);
                labelSourceShopAddr2.Text = Utilities.GetStringValue(cashTransferData.SourceShopInfo.StoreCityName) +
                                            "," + Utilities.GetStringValue(cashTransferData.SourceShopInfo.State) +
                                            " " + Utilities.GetStringValue(cashTransferData.SourceShopInfo.StoreZipCode);
                labelManagerName.Text       = Utilities.GetStringValue(cashTransferData.SourceShopInfo.StoreManager);
                labelSourceShopPhone.Text   = Utilities.GetStringValue(cashTransferData.SourceShopInfo.StorePhoneNo);
                labelTransporterName.Text   = Utilities.GetStringValue(cashTransferData.Transporter);
                labelBagNo.Text             = Utilities.GetStringValue(cashTransferData.DepositBagNo);
                richTextBoxDestComment.Text = Utilities.GetStringValue(cashTransferData.SourceComment);
                labelDestShop.Text          = Utilities.GetStringValue(cashTransferData.DestinationShopInfo.StoreNumber);
                labelDestAddr1.Text         = Utilities.GetStringValue(cashTransferData.DestinationShopInfo.StoreAddress1);
                labelDestAddr2.Text         = Utilities.GetStringValue(cashTransferData.DestinationShopInfo.StoreCityName) +
                                              "," + Utilities.GetStringValue(cashTransferData.DestinationShopInfo.State) +
                                              " " + Utilities.GetStringValue(cashTransferData.DestinationShopInfo.StoreZipCode);
                labelDestMgrName.Text    = Utilities.GetStringValue(cashTransferData.DestinationShopInfo.StoreManager);
                transferAmount           = Utilities.GetDecimalValue(cashTransferData.TransferAmount);
                labelTrAmount.Text       = string.Format("{0:C}", transferAmount);
                labelDestPhone.Text      = Utilities.GetStringValue(cashTransferData.DestinationShopInfo.StorePhoneNo);
                labelTransferDate.Text   = Utilities.GetDateTimeValue(cashTransferData.TransferDate).ToShortDateString();
                labelStatus.Text         = Utilities.GetStringValue(cashTransferData.TransferStatus);
                labelTransferNumber.Text = Utilities.GetStringValue(cashTransferData.TransferNumber);
                //disable buttons and make controls readonly
                pictureBox1.Visible            = false;
                richTextBoxDestComment.Enabled = false;
                customButtonAccept.Text        = VOID;
                customButtonBack.Visible       = false;
                customButtonReject.Visible     = false;
                customLabelComment.Visible     = true;
                customTextBoxComment.Visible   = true;
            }
            else
            {
                try
                {
                    //Get the transfer details
                    string storeNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
                    bool   retval      = ShopCashProcedures.GetShopTransferDetails(selectedTransferNumber.ToString(), selectedTransferId,
                                                                                   storeNumber, GlobalDataAccessor.Instance.DesktopSession, out transferDetails, out denominationDetails, out errorCode, out errorText);
                    //Parse the transferdetails datatable to get all the information to show in the screen
                    //transferdetails should have only row for the selected transfer number
                    if (transferDetails != null && transferDetails.Rows.Count > 0)
                    {
                        labelSourceShop.Text      = Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.STORENUMBER]);
                        labelSourceShopAddr1.Text = Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.STOREADDRESS1]);
                        labelSourceShopAddr2.Text = Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.STORECITYNAME]) +
                                                    "," + Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.STORESTATE]) +
                                                    " " + Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.STOREZIPCODE]);
                        labelManagerName.Text     = Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.STOREMANAGER]);
                        labelSourceShopPhone.Text = Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.STOREPHONENO]);
                        labelTransporterName.Text = Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.TRANSPORTEDBY]);
                        labelBagNo.Text           = Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.DEPOSITBAGNUMBER]);
                        labelSourceComment.Text   = Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.SOURCECOMMENT]);
                        labelDestShop.Text        = Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.V_DEST_STORENUMBER]);
                        labelDestAddr1.Text       = Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.V_DEST_STOREADDRESS]);
                        labelDestAddr2.Text       = Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.V_DEST_STORECITYNAME]) +
                                                    "," + Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.V_DEST_STORESTATE]) +
                                                    " " + Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.V_DEST_STOREZIPCODE]);
                        labelDestMgrName.Text  = Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.V_DEST_STOREMANAGER]);
                        transferAmount         = Utilities.GetDecimalValue(transferDetails.Rows[0][(int)TransferDetailsRecord.TRANSFERAMOUNT]);
                        labelTrAmount.Text     = string.Format("{0:C}", transferAmount);
                        labelDestPhone.Text    = Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.V_DEST_STOREPHONENO]);
                        labelTransferDate.Text = Utilities.GetDateTimeValue(transferDetails.Rows[0][(int)TransferDetailsRecord.TRANSFERDATE]).ToShortDateString();
                        labelStatus.Text       = Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.TRANSFERSTATUS]);
                        sourceShopName         = Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.STORENAME]);
                        destinationShopName    = Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.V_DEST_STORENAME]);
                        sourceEmployee         = Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.USERNAME])
                                                 + "," +
                                                 Utilities.GetStringValue(transferDetails.Rows[0][(int)TransferDetailsRecord.USEREMPLOYEENUMBER]);
                        if (labelStatus.Text == CashTransferStatusCodes.REJECTED.ToString())
                        {
                            customButtonAccept.Enabled     = string.IsNullOrEmpty(labelTransporterName.Text);
                            processRejected                = string.IsNullOrEmpty(labelTransporterName.Text);
                            customButtonReject.Enabled     = false;
                            richTextBoxDestComment.Enabled = false;
                        }
                    }
                    //DenominationDetails datatable will have data for the currency user control
                    if (denominationDetails != null && denominationDetails.Rows.Count > 0)
                    {
                        List <String> currencyData = new List <string>();
                        foreach (DataRow dr in denominationDetails.Rows)
                        {
                            string displayName   = Utilities.GetStringValue(dr["displayname"], "");
                            string currencyDenom = Utilities.GetDecimalValue(dr["denomination_amount"]).ToString();
                            //The following is necessary since in the DB both coin and dollar 1 is
                            //the same as far as amount is concerned but is different only in display name
                            if (displayName == "USD COIN 1")
                            {
                                currencyDenom = "1.00";
                            }
                            currencyData.Add(currencyDenom);
                            currencyData.Add(Utilities.GetStringValue(dr["amount"]));
                        }

                        var  errorMesg = string.Empty;
                        bool retVal    = currencyEntry1.SetCurrencyData(currencyData, true, out errorMesg);
                        currencyEntry1.Enabled           = false;
                        currencyEntry1.Calculate        += (currencyEntry1_Calculate);
                        currencyEntry1.OtherTenderClick += (currencyEntry1_OtherTenderClick);

                        if (!retval)
                        {
                            FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Cannot load currency data for shop transfer " + selectedTransferNumber + errorMesg);
                        }
                    }
                }
                catch (Exception ex)
                {
                    FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Cannot load shop transfer details " + ex.Message);
                }
            }

            //Do not show the currency panel when it first loads
            panelCurrency.Visible = false;
            pictureBox1.Image     = Common.Properties.Resources.plus_icon_small;
            panel1.Location       = new Point(6, 111);
            this.Size             = new Size(773, 454);
        }