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(); }
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(); }