Esempio n. 1
0
 private void btnPrint_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         IReports objReports = ReportsBusinessObject.CreateInstance();
         using (CReportViewer objReportViewer = new CReportViewer())
         {
             DataSet dtPromotionalHistory = objReports.GetPromotionalTicketHistory();
             if (dtPromotionalHistory != null)
             {
                 objReportViewer.PrintPromotionalHistoryReport(dtPromotionalHistory);
                 objReportViewer.SetOwner(Window.GetWindow(this));
                 objReportViewer.ShowDialog();
             }
             else
             {
                 MessageBox.ShowBox("MessageID550", BMC_Icon.Information);
             }
         }
     }
     catch (Exception ex)
     {
         ExceptionManager.Publish(ex);
     }
 }
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (lstReadReport.Items.Count <= 0)
                {
                    MessageBox.ShowBox("MessageID526", BMC_Icon.Information);
                    return;
                }

                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    ReadLiquidationReportRecords lstReadLiqRecords = lstReadReport.SelectedItem as ReadLiquidationReportRecords;
                    if (lstReadLiqRecords == null)
                    {
                        MessageBox.ShowBox("MessageID527", BMC_Icon.Information);
                        return;
                    }

                    cReportViewer.ShowLiquidationReportForRead(null, lstReadLiqRecords.ReadId);
                    cReportViewer.SetOwner(Window.GetWindow(this));
                    cReportViewer.Show();
                }
            }

            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
        private void PrintOrExportDetails(bool Print)
        {
            string sType = string.Empty;

            switch (_iType)
            {
            case 1: sType = "(Day)"; break;

            case 2: sType = "(Drop)"; break;

            case 3: sType = "(Week)"; break;

            case 4: sType = "(Month)"; break;

            default: sType = ""; break;
            }

            string sReportName = txtHeader.Text.Trim() + sType;

            using (CReportViewer cReportViewer = new CReportViewer())
            {
                if (dtPrintDetails.Rows.Count > 0)
                {
                    cReportViewer.ShowReportsAnalysisDetails(dtPrintDetails, sReportName, Print, TotalAvgBet, string.Empty);
                }
            }
        }
Esempio n. 4
0
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                IReports objReports = ReportsBusinessObject.CreateInstance();
                using (CReportViewer objReportViewer = new CReportViewer())
                {
                    DataSet dtTISPromotionalDetails = objReports.GetTISPromotionalDetails(this.StartDate, this.EndDate, NoOfRecordsInPage);
                    if (dtTISPromotionalDetails != null)
                    {
                        objReportViewer.PrintTISDetailsReport(dtTISPromotionalDetails, this.StartDate, this.EndDate, NoOfRecordsInPage);
                        objReportViewer.SetOwner(this);

                        objReportViewer.ShowDialog();
                    }
                    else
                    {
                        MessageBox.ShowBox("MessageID550", BMC_Icon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
        private void PrintOrExportDetails(bool Print)
        {
            try
            {
                string sType = string.Empty;
                if (ParentElement != AnalysisDetailsParent.SiteInterrogration)
                {
                    switch (_iType)
                    {
                    case 1: sType = "(Day)"; break;

                    case 2: sType = "(Drop)"; break;

                    case 3: sType = "(Week)"; break;

                    case 4: sType = "(Month)"; break;

                    default: sType = ""; break;
                    }
                }

                string sReportName = this.Caption.Trim() + sType;

                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    if (dtPrintDetails.Rows.Count > 0)
                    {
                        string sAnalysisDetails = string.Empty;
                        lstAnalysisDetails.SelectAllCells();
                        lstAnalysisDetails.ClipboardCopyMode = (Microsoft.Windows.Controls.DataGridClipboardCopyMode)DataGridClipboardCopyMode.IncludeHeader;
                        ApplicationCommands.Copy.Execute(null, lstAnalysisDetails);
                        lstAnalysisDetails.UnselectAllCells();
                        try
                        {
                            sAnalysisDetails = (string)Clipboard.GetData(DataFormats.CommaSeparatedValue);
                            Clipboard.Clear();
                        }
                        catch
                        {
                            MessageBox.ShowBox("MessageID56");
                        }

                        cReportViewer.ShowReportsAnalysisDetails(dtPrintDetails, sReportName, Print, TotalAvgBet, sAnalysisDetails);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
 private void CreateVaultEventDetailsReport(int Vault_Id, string Type, int No_Of_Records, string SearchKey, DateTime StartDate, DateTime EndDate)
 {
     try
     {
         using (CReportViewer cReportViewer = new CReportViewer())
         {
             LogManager.WriteLog("Report data fetched successfully from database", LogManager.enumLogLevel.Info);
             cReportViewer.ShowVaultEventDetailReport(Vault_Id, Type, No_Of_Records, SearchKey, StartDate, EndDate);
             cReportViewer.SetOwner(System.Windows.Window.GetWindow(this));
             cReportViewer.Show();
         }
         LogManager.WriteLog("Show Undeclared Drop Report Successfull", LogManager.enumLogLevel.Info);
     }
     catch (Exception ex)
     {
         ExceptionManager.Publish(ex);
     }
 }
 private void CreateOutstandingVaultdropReport()
 {
     try
     {
         using (CReportViewer cReportViewer = new CReportViewer())
         {
             LogManager.WriteLog("Report data fetched successfully from database", LogManager.enumLogLevel.Info);
             cReportViewer.ShowOutstandingVaultReport(false);
             cReportViewer.SetOwner(Window.GetWindow(this));
             cReportViewer.Show();
         }
         LogManager.WriteLog("Show Undeclared Drop Report Successfull", LogManager.enumLogLevel.Info);
     }
     catch (Exception ex)
     {
         ExceptionManager.Publish(ex);
     }
 }
 private void CreateOutstandingVaultdropReport()
 {
     try
     {               
         using (CReportViewer cReportViewer = new CReportViewer())
         {
             LogManager.WriteLog("Report data fetched successfully from database", LogManager.enumLogLevel.Info);
             cReportViewer.ShowOutstandingVaultReport(false);
             cReportViewer.SetOwner(Window.GetWindow(this));
             cReportViewer.Show();
         }
         LogManager.WriteLog("Show Undeclared Drop Report Successfull", LogManager.enumLogLevel.Info);
     }
     catch (Exception ex)
     {
         ExceptionManager.Publish(ex);
     }
 }
        private void GetVoucherCouponLiabilityReport(DateTime dtIssueDate,string sDeviceType,string sVoucherStatus )
        {
            try
            {
                LogManager.WriteLog("Inside GetVoucherCouponLiabilityReport method", LogManager.enumLogLevel.Info);

                if (dtIssueDate > System.DateTime.Now)
                {
                    MessageBox.ShowBox("MessageID285", BMC_Icon.Information);
                    return;
                }

                IReports objReports = ReportsBusinessObject.CreateInstance();
                DataSet dtDetails = objReports.GetVoucherCouponLiabilityReport(dtIssueDate, sDeviceType, sVoucherStatus);

                if (dtDetails.Tables[0].Rows.Count == 0)
                {
                    MessageBox.ShowBox("MessageID261", BMC_Icon.Information);
                    return;
                }

                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    cReportViewer.ShowVoucherCouponLiabilityReport("VoucherCouponLiabilityReport", dtDetails, dtIssueDate, sDeviceType, sVoucherStatus);
                    cReportViewer.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                MessageBox.ShowBox("MessageID262", BMC_Icon.Error);
            }
        }
        private void ShowAccountingWinLossReport(int ZoneNo, int MachineCategoryNo, DateTime StartDate, DateTime EndDate, string ZoneName, string Category, bool IncludeNonCashable)
        {
            try
            {
                LogManager.WriteLog("Inside ShowAccountingWinLossReport method", LogManager.enumLogLevel.Info);

                if (StartDate > EndDate)
                {
                    MessageBox.ShowBox("MessageID286", BMC_Icon.Information);
                    return;
                }

                if (StartDate > System.DateTime.Now)
                {
                    MessageBox.ShowBox("MessageID287", BMC_Icon.Information);
                    return;
                }

                if (EndDate > System.DateTime.Now)
                {
                    MessageBox.ShowBox("MessageID288", BMC_Icon.Information);
                    return;
                }

                IReports objReports = ReportsBusinessObject.CreateInstance();
                DataSet dtDataset = objReports.GetAccountingWinLossReport(ZoneNo,MachineCategoryNo,StartDate, EndDate, IncludeNonCashable);

                if (dtDataset.Tables[0].Rows.Count == 0)
                {
                    MessageBox.ShowBox("MessageID261", BMC_Icon.Information);
                    return;
                }

                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    cReportViewer.ShowAccountingWinLossReport("AccountingWinLossReport", dtDataset, ZoneNo, MachineCategoryNo, StartDate, EndDate, ZoneName, Category, IncludeNonCashable);
                    cReportViewer.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                MessageBox.ShowBox("MessageID262", BMC_Icon.Error);
            }
        }
        void PrintDrop(DataRow drBalance)
        {

            try
            {
                if (drBalance != null)
                {
                    using (CReportViewer cReportViewer = new CReportViewer())
                    {
                        cReportViewer.ShowVaultCurrentDropSlip(int.Parse(cmb_DeviceName.SelectedValue.ToString()), drBalance["Name"].ToString(), drBalance["Serial_NO"].ToString(), drBalance["Manufacturer_Name"].ToString(),
                                                 drBalance["Type_Prefix"].ToString(), SecurityHelper.CurrentUser.DisplayName, Convert.ToDateTime(drBalance["CreatedDate"]), Convert.ToBoolean(drBalance["IsWebServiceEnabled"]),
                                                 Convert.ToDecimal(drBalance["FillAmount"]), Convert.ToDecimal(drBalance["TotalAmountOnFill"]), Convert.ToDecimal(drBalance["CurrentBalance"]), _IsFinalDrop);
                        cReportViewer.SetOwner(System.Windows.Window.GetWindow(this));
                        cReportViewer.Show();
                    }
                }
            }
            catch (Exception Ex)
            {
                ExceptionManager.Publish(Ex);
            }
        }
        private void ShowMeterListReport(string installationNo, string assetNo)
        {
            DataSet dsMeterDetails = null;
            DataSet dsMeterDetail = null;

            try
            {
                LogManager.WriteLog("Inside ShowMeterListReport method", LogManager.enumLogLevel.Info);

                dsMeterDetails = new DataSet();

                IReports objReports = ReportsBusinessObject.CreateInstance();

                if (installationNo == "ALL")
                {
                    LogManager.WriteLog("Fetching Asset Numbers from database....", LogManager.enumLogLevel.Info);

                    DataTable dtAssetNumbers = objReports.GetAssetNumberforActiveInstallations();

                    if (dtAssetNumbers.Rows.Count > 0)
                    {
                        LogManager.WriteLog("Asset Numbers fetched successfully from database", LogManager.enumLogLevel.Info);

                        foreach (DataRow dataRow in dtAssetNumbers.Rows)
                        {
                            LogManager.WriteLog(string.Format("{0} - {1}", "Fetching report data from database for Installation No", 
                                dataRow["InstallationNo"].ToString()), LogManager.enumLogLevel.Info);

                            dsMeterDetail = objReports.GetMeterDetails(Convert.ToInt32(dataRow["InstallationNo"]));

                            LogManager.WriteLog("Report data fetched successfully from database", LogManager.enumLogLevel.Info);

                            LogManager.WriteLog("Merging dataset...", LogManager.enumLogLevel.Info);

                            dsMeterDetails.Merge(dsMeterDetail);

                            LogManager.WriteLog("Merge dataset Successfull", LogManager.enumLogLevel.Info);                            

                            if (dsMeterDetail != null) { dsMeterDetail = null; }
                        }
                    }
                    else
                    {
                        LogManager.WriteLog("Asset Number not available - Return", LogManager.enumLogLevel.Info);

                        MessageBox.ShowBox("MessageID261", BMC_Icon.Information);
                        return;
                    }
                }
                else
                {
                    LogManager.WriteLog("Fetching report data from database...", LogManager.enumLogLevel.Info);

                    dsMeterDetails = objReports.GetMeterDetails(Convert.ToInt32(installationNo));

                    LogManager.WriteLog("Report data fetched successfully from database", LogManager.enumLogLevel.Info);
                }

                if (dsMeterDetails.Tables[0].Rows.Count == 0)
                {
                    LogManager.WriteLog("No Records found for the selected criteria - Return", LogManager.enumLogLevel.Info);

                    MessageBox.ShowBox("MessageID261", BMC_Icon.Information);
                    return;
                }

                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    cReportViewer.ShowMeterListReport(dsMeterDetails, assetNo);
                    cReportViewer.ShowDialog();
                }

                LogManager.WriteLog("ShowMeterListReport Successfull", LogManager.enumLogLevel.Info);
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                MessageBox.ShowBox("MessageID262", BMC_Icon.Error);
            }            
        }
        private void ShowExceptionVoucherDetailReport(DateTime dtFromDate, DateTime dtToDate, Int32 BatchNumber,string SiteCode)
        {
            try
            {
                LogManager.WriteLog("Inside GetExceptionVoucherDetailReport method", LogManager.enumLogLevel.Info);

                if (dtFromDate > dtToDate)
                {
                    MessageBox.ShowBox("MessageID286", BMC_Icon.Information);
                    return;
                }

                if (dtFromDate > System.DateTime.Now)
                {
                    MessageBox.ShowBox("MessageID287", BMC_Icon.Information);
                    return;
                }

                if (dtToDate > System.DateTime.Now)
                {
                    MessageBox.ShowBox("MessageID288", BMC_Icon.Information);
                    return;
                }

                IReports objReports = ReportsBusinessObject.CreateInstance();

                DataSet dtDataset = objReports.GetExceptionVoucherDetails(dtFromDate, dtToDate, chkDropBased.IsChecked, BatchNumber);

                if (dtDataset.Tables[0].Rows.Count == 0)
                {
                    MessageBox.ShowBox("MessageID261", BMC_Icon.Information);
                    return;
                }

                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    cReportViewer.ShowExceptionVoucherDetail("ExceptionVoucherDetails", dtDataset, dtFromDate, dtToDate, chkDropBased.IsChecked, BatchNumber,SiteCode);
                    cReportViewer.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                MessageBox.ShowBox("MessageID262", BMC_Icon.Error);
            }
        }
        private void button_Click(object sender, RoutedEventArgs e)
        {
            try
            {

                int InstallationNumber = 0;
                int ValidationLength = 0;
                string _Barcode = this.ucValueCalc.txtDisplay.Text.Trim();
                System.Windows.Forms.DialogResult _diagResult;
                btnVerify.IsEnabled = false;
                if (isScannerFired) //check done not to fire the verify event twice while verifying a ticket using scanner
                {
                    isScannerFired = false;
                    return;
                }
                if ((sender is System.Windows.Controls.TextBox))
                    isScannerFired = true;
                else
                    isScannerFired = false;


                if (this.ucValueCalc.txtDisplay.Text.Trim().Length > 0)
                {
                    //8-digit ticket validation.
                    //Slot ticket cannot be redeemed via cashdesk.
                    if (this.ucValueCalc.txtDisplay.Text.Trim().Length != 18)
                    {
                        LinqDataAccessDataContext linqDBExchange = new LinqDataAccessDataContext(CommonDataAccess.ExchangeConnectionString);
                        IEnumerable<InstallationFromTicket> InstallationTicket = linqDBExchange.GetInstallationNumber(_Barcode);
                        if (InstallationTicket != null)
                        {
                            foreach (var item in InstallationTicket)
                            {
                                InstallationNumber = item.installation_no.Value;
                                _Barcode = item.strbarcode;

                            }
                            DataTable InstallationDetails = (new CommonDataAccess()).GetInstallationDetails(0, InstallationNumber, false, false);
                            if (InstallationDetails.Rows.Count > 0)
                            {
                                int.TryParse(InstallationDetails.Rows[0]["Validation_length"].ToString(), out ValidationLength);
                                if (ValidationLength != _Barcode.Length)
                                {
                                    MessageBox.ShowBox("MessageID403", BMC_Icon.Error);
                                    return;
                                }
                            }                          
                        }
                    }

                    TicketsHelper objTicketsHelper = new TicketsHelper();

                    int? nResult = -1;
                    decimal dAmount = 0;
                    int iTransactionNo = 0;
                    int iSequenceNo = 0;

                    //foreach (var obj in objTicketsHelper.ValidateVoidVoucher(this.ucValueCalc.txtDisplay.Text.Trim(), ref nResult))
                    //{
                    //    dAmount = Convert.ToDecimal(obj.iAmount)/100;                        
                    //}
                    dAmount = objTicketsHelper.ValidateVoidVoucher(_Barcode, Security.SecurityHelper.CurrentUser.User_No, ref nResult);

                    switch (nResult)
                    {
                        case 0:
                            {
                                if (Convert.ToBoolean(AppSettings.REDEEM_TICKET_POP_UP_ALERT_VISIBILITY))
                                {
                                    //Message: Are you sure you want to Void the Voucher?
                                    _diagResult = MessageBox.ShowBox("MessageID512", BMC_Icon.Question, BMC_Button.YesNo, this.ucValueCalc.txtDisplay.Text.Trim(), Convert.ToString(dAmount));
                                    if (_diagResult == System.Windows.Forms.DialogResult.No)
                                        return;
                                }
                                else
                                {
                                    _diagResult = System.Windows.Forms.DialogResult.Yes;
                                }
                                if (_diagResult == System.Windows.Forms.DialogResult.Yes)
                                {

                                    string barcode = this.ucValueCalc.txtDisplay.Text.Trim();

                                    foreach (var obj in objTicketsHelper.UpdateVoidVoucher(barcode,
                                                           System.Environment.MachineName,
                                                           Security.SecurityHelper.CurrentUser.User_No,
                                                           txtNotes.Text))
                                    {
                                        iTransactionNo = (int)obj.iTransactionNo;
                                        iSequenceNo = obj.TE_ID;
                                    }

                                    // TIS Printed Tickets
                                    if (VoucherHelper.IsTISPrintedTicket(barcode))
                                    {
                                        VoucherHelper.SendTISVoidTicket(barcode, Security.SecurityHelper.CurrentUser.User_No);
                                    }

                                    //Message: "Voucher Voided Successfully."
                                    MessageBox.ShowBox("MessageID513", BMC_Icon.Information);
                                    //Receipt                                
                                    BMC.Business.CashDeskOperator.Reports objReports = new BMC.Business.CashDeskOperator.Reports();
                                    string sCode = BMC.Transport.Settings.SiteCode;
                                    using (CReportViewer objReportViewer = new CReportViewer())
                                    {
                                        objReportViewer.PrintVoidVoucherReceipt(System.Environment.MachineName, this.ucValueCalc.txtDisplay.Text.Trim(),
                                                                                dAmount, iTransactionNo, sCode, iSequenceNo);
                                        //objReportViewer.ShowDialog();
                                    }

                                    Audit(this.ucValueCalc.txtDisplay.Text.Trim(), dAmount, "Voucher Voided Successfully");
                                    lblVoidAmountValue.Visibility = Visibility.Visible;
                                    lblVoidAmount.Visibility = Visibility.Visible;
                                    lblVoidAmountValue.Text = string.Empty;
                                    lblVoidAmountValue.Text = dAmount.ToString("0.00");


                                }
                                break;
                            }


                        case 1:
                            {
                                //Voucher Not Found
                                //Message: "Voucher is not available in System"
                                MessageBox.ShowBox("MessageID514", BMC_Icon.Error);
                                Audit(this.ucValueCalc.txtDisplay.Text.Trim(), dAmount, "Voucher Not Found");
                                lblVoidAmount.Visibility = Visibility.Hidden;
                                lblVoidAmountValue.Visibility = Visibility.Hidden;
                                //Audit
                                break;
                            }
                        case 2:
                            {
                                // Invalid for Slots, only CashDesk is allowed.
                                //Message: "Void is applicable only for Cash Desk Vouchers"
                                MessageBox.ShowBox("MessageID515", BMC_Icon.Error);
                                Audit(this.ucValueCalc.txtDisplay.Text.Trim(), dAmount, "Void is applicable only for Cash Desk Vouchers");
                                //Audit
                                lblVoidAmount.Visibility = Visibility.Hidden;
                                lblVoidAmountValue.Visibility = Visibility.Hidden;
                                break;
                            }
                        case 3:
                            {
                                //PAID Status
                                // Message: "Voucher has already been redeemed."
                                MessageBox.ShowBox("MessageID516", BMC_Icon.Error);
                                Audit(this.ucValueCalc.txtDisplay.Text.Trim(), dAmount, "Voucher has already been redeemed");
                                lblVoidAmount.Visibility = Visibility.Hidden;
                                lblVoidAmountValue.Visibility = Visibility.Hidden;
                                //Audit
                                break;
                            }
                        case 4:
                            {
                                //Already Voided
                                // Message: "Voucher has already been Voided."
                                MessageBox.ShowBox("MessageID517", BMC_Icon.Error);
                                Audit(this.ucValueCalc.txtDisplay.Text.Trim(), dAmount, "Voucher has already been Voided");
                                lblVoidAmount.Visibility = Visibility.Hidden;
                                lblVoidAmountValue.Visibility = Visibility.Hidden;
                                //Audit
                                break;
                            }
                        case 5:
                            {
                                //Expired Date
                                // Message: "Voucher has expired."
                                MessageBox.ShowBox("MessageID518", BMC_Icon.Error);
                                Audit(this.ucValueCalc.txtDisplay.Text.Trim(), dAmount, "Voucher has expired");
                                lblVoidAmount.Visibility = Visibility.Hidden;
                                lblVoidAmountValue.Visibility = Visibility.Hidden;
                                //Audit
                                break;
                            }

                    }


                }
                else
                {
                    //Message: "Please enter or scan a valid Voucher Number
                    MessageBox.ShowBox("MessageID519", BMC_Icon.Warning);
                    this.ucValueCalc.txtDisplay.Focus();
                }

                ClearAll();

            }
            catch (Exception ex)
            {
                MessageBox.ShowBox("MessageID520", BMC_Icon.Error);
                BMC.Common.ExceptionManagement.ExceptionManager.Publish(ex);
                ClearAll();
            }
            finally
            {
                btnVerify.IsEnabled = true;
            }
        }
        private void ShowExpenseDetailsReport(DateTime reportDate, string reportPeriod,bool IsGamingDayBasedReport,string SiteCode)
        {
            try
            {
                LogManager.WriteLog("Inside ShowExpenseDetailsReport method", LogManager.enumLogLevel.Info);

                if (reportDate > System.DateTime.Now)
                {   
                    MessageBox.ShowBox("MessageID281", BMC_Icon.Information);
                    return;
                }

                IReports objReports = ReportsBusinessObject.CreateInstance();

                LogManager.WriteLog("Fetching report data from database...", LogManager.enumLogLevel.Info);

                DataSet expenseDetails = objReports.GetExpenseDetails(reportDate, reportPeriod, IsGamingDayBasedReport);

                if (expenseDetails.Tables[0].Rows.Count == 0)
                {
                    LogManager.WriteLog("No Records found for the selected criteria - Return", LogManager.enumLogLevel.Info);
                    MessageBox.ShowBox("MessageID261", BMC_Icon.Information);
                    return;
                }

                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    LogManager.WriteLog("Report data fetched successfully from database", LogManager.enumLogLevel.Info);

                    cReportViewer.ShowExpenseDetailsReport(expenseDetails, reportDate, reportPeriod, IsGamingDayBasedReport,SiteCode);
                    cReportViewer.ShowDialog();                    
                }

				LogManager.WriteLog("ShowExpenseDetailsReport Successfull", LogManager.enumLogLevel.Info);
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
				MessageBox.ShowBox("MessageID262", BMC_Icon.Error);
            }
        }
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                IReports objReports = ReportsBusinessObject.CreateInstance();
                using (CReportViewer objReportViewer = new CReportViewer())
                {

                    DataSet dtPromotionalHistory = objReports.GetPromotionalTicketHistory();
                    if (dtPromotionalHistory != null)
                    {
                        objReportViewer.PrintPromotionalHistoryReport(dtPromotionalHistory);
                        objReportViewer.SetOwner(Window.GetWindow(this));
                        objReportViewer.ShowDialog();
                    }
                    else
                    {
                        MessageBox.ShowBox("MessageID550", BMC_Icon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
        private void PrintSpotCheckReport()
        {
            Installations objInstallationDetails = tvMachineList.SelectedItem as Installations;
            if (objInstallationDetails == null) return;

            List<SpotCheck> lstSpotCheck = new List<SpotCheck>();
            lstSpotCheck = lstSpotCheckSummaryDetails.Where(item => item.InstallationNo == objInstallationDetails.Installation_No).ToList();
            if (lstSpotCheck == null || lstSpotCheck.Count <= 0) return;

            using (CReportViewer cReportViewer = new CReportViewer())
            {
                cReportViewer.ShowSpotCheckReport(
                                                    objInstallationDetails.Bar_Position_Name,
                                                    objInstallationDetails.Zone_Name.IsNullOrEmpty() ? string.Empty : objInstallationDetails.Zone_Name,
                                                    objInstallationDetails.GameTitle,//(Convert.ToDecimal(objInstallationDetails.POP) / 100).ToString(),
                                                    (Convert.ToDecimal(objInstallationDetails.POP)).ToString(),
                                                    lstSpotCheck[0].DateTimeStamp,
                                                    (lstSpotCheck[0].CashIn - lstSpotCheck[0].CashOut),
                                                    lstSpotCheck[0].CashIn,
                                                    Convert.ToDecimal(lstSpotCheck[0].Payout),
                                                    Convert.ToDecimal(lstSpotCheck[0].CoinsDrop.ToString("#,##0.00")),
                                                    lstSpotCheck[0].HandPay,
                                                    lstSpotCheck[0].Date,
                                                    Settings.SiteCode
                                                 );
                cReportViewer.ShowDialog();
            }
        }
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                CancelTask(ClearBinding: false);
                btnPrint.IsEnabled = false;
                lblStatus.Content = "";
                progressBar1.Visibility = Visibility.Hidden;
                string sReportName = string.Empty;
                if ((bool)chkDay.IsChecked)
                {
                    sReportName = chkDay.Content.ToString();
                    Audit_Print("Current Day Report ", DateTime.Now);
                }
                else if ((bool)chkDrop.IsChecked)
                {
                    sReportName = chkDrop.Content.ToString();
                    Audit_Print("Current Drop Report ", DateTime.Now);
                }
                else if ((bool)chkWeek.IsChecked)
                {
                    sReportName = chkWeek.Content.ToString();
                    Audit_Print("Current Week Report ", DateTime.Now);
                }
                else if ((bool)chkMonth.IsChecked)
                {
                    sReportName = chkMonth.Content.ToString();
                    if (!Settings.ShowSystemCalendar)
                        Audit_Print("Current Period Report ", DateTime.Now);
                    else
                        Audit_Print("Current Month Report ", DateTime.Now);
                }

                using (CReportViewer cReportViewer = new CReportViewer())
                    cReportViewer.ShowReportsPrintTab(dtPrint, sReportName, Settings.SiteCode);
            }
            finally
            {
                btnPrint.IsEnabled = true;
            }

        }
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                bool TicketShow = true;
                if (!Security.SecurityHelper.HasAccess("BMC.Presentation.CashDeskManager.UserControls.CashDeskManagerAllDetails.lvViewAll.TicketValue"))
                {
                    TicketShow = false;
                }
                btnPrint.IsEnabled = false;
                //DataSet _DtDetails = BMC.Common.Utilities.CollectionExtensions.ToDataSet<CashierTransactionsDetails>(lstCashierTransactionsDetails, "DetailsView");

                BMC.Business.CashDeskOperator.Reports objReports = new BMC.Business.CashDeskOperator.Reports();

                //DataSet _DtDetails = objReports.GetCashierTransactionsDetails(true, true, true, true,
                //                                                              true, true, true, true,
                //                                                              true, true,
                //                                                              true, true, true, true,
                //                                                              true, true,
                //                                                              true, true,
                //                                                              StartDate, EndDate, user, iRoute_No);

                if (dtTickets.Tables[0].Rows.Count == 0)
                {
                    MessageBox.ShowBox("MessageID47");
                    return;
                }

                using (CReportViewer objReportViewer = new CReportViewer())
                {
                    objReportViewer.showDetailedReport(dtTickets, StartDate, EndDate, sFooterText, TicketShow);
                    objReportViewer.SetOwner(this);
                    objReportViewer.ShowDialog();
                }
            }
            finally
            {
                btnPrint.IsEnabled = true;
            }


        }
        private void btnBalancing_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                btnBalancing.IsEnabled = false;
                if (StartDate > EndDate)
                {
                    MessageBox.ShowBox("MessageID282", BMC_Icon.Information);
                    return;
                }

                if (StartDate > System.DateTime.Now)
                {
                    MessageBox.ShowBox("MessageID283", BMC_Icon.Information);
                    return;
                }

                if (EndDate > System.DateTime.Now)
                {
                    MessageBox.ShowBox("MessageID284", BMC_Icon.Information);
                    return;
                }


                IReports objReports = ReportsBusinessObject.CreateInstance();

                LogManager.WriteLog("Fetching report data from database...", LogManager.enumLogLevel.Info);

                DataSet SystemBalancingDetails = null;

                switch (URoleBased.Count)
                {
                    case 0:
                        {
                            if (Security.SecurityHelper.CurrentUser.User_No == UserNo)
                            {
                                SystemBalancingDetails = objReports.GetSystemBalancingDetails(StartDate, EndDate, UserNo, iRoute_No);
                            }
                            break;
                        }
                    case 1:
                        {
                            if (UserNo == 0)
                            {
                                SystemBalancingDetails = objReports.GetSystemBalancingDetails(StartDate, EndDate, 0, iRoute_No);
                            }
                            else
                            {
                                SystemBalancingDetails = objReports.GetSystemBalancingDetails(StartDate, EndDate, UserNo, iRoute_No);
                            }
                            break;
                        }
                }
                if (SystemBalancingDetails.Tables[0].Rows.Count == 0)
                {
                    LogManager.WriteLog("No Records found for the selected criteria - Return", LogManager.enumLogLevel.Info);

                    MessageBox.ShowBox("MessageID261", BMC_Icon.Information);
                    return;
                }


                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    LogManager.WriteLog("Report data fetched successfully from database", LogManager.enumLogLevel.Info);

                    cReportViewer.ShowSystemBalancingReport(SystemBalancingDetails, StartDate, EndDate);
                    cReportViewer.SetOwner(System.Windows.Window.GetWindow(this));

                    cReportViewer.Show();
                }


                LogManager.WriteLog("ShowSystemBalancingReport Successfull", LogManager.enumLogLevel.Info);
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
            finally
            {
                btnBalancing.IsEnabled = true;
            }
        }
        private void GetRedeemedTicketByDeviceReport(DateTime dtFromDate,DateTime dtToDate, string sDeviceType)
        {
            try
            {
                LogManager.WriteLog("Inside GetRedeemedTicketByDeviceReport method", LogManager.enumLogLevel.Info);

                if (dtFromDate > dtToDate)
                {
                    MessageBox.ShowBox("MessageID286", BMC_Icon.Information);
                    return;
                }

                if (dtFromDate > System.DateTime.Now)
                {
                    MessageBox.ShowBox("MessageID287", BMC_Icon.Information);
                    return;
                }

                if (dtToDate > System.DateTime.Now)
                {
                    MessageBox.ShowBox("MessageID288", BMC_Icon.Information);
                    return;
                }

                IReports objReports = ReportsBusinessObject.CreateInstance();
                DataSet dtDataset = objReports.GetRedeemedTicketByDevice(dtFromDate, dtToDate, sDeviceType);

                //if (dtDataset.Tables[0].Rows.Count == 0)
                //{
                //    MessageBox.ShowBox("MessageID261", BMC_Icon.Information);
                //    return;
                //}

                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    cReportViewer.ShowRedeemedTicketByDevice("RedeemedTicketByDevice", dtDataset, dtFromDate, dtToDate, sDeviceType,SiteCode);
                    cReportViewer.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                MessageBox.ShowBox("MessageID262", BMC_Icon.Error);
            }
        }
 private void CreateVaultEventDetailsReport(int Vault_Id, string Type, int No_Of_Records, string SearchKey, DateTime StartDate, DateTime EndDate)
 {
     try
     {
         using (CReportViewer cReportViewer = new CReportViewer())
         {
             LogManager.WriteLog("Report data fetched successfully from database", LogManager.enumLogLevel.Info);
             cReportViewer.ShowVaultEventDetailReport(Vault_Id, Type, No_Of_Records, SearchKey, StartDate, EndDate);
             cReportViewer.SetOwner(System.Windows.Window.GetWindow(this));
             cReportViewer.Show();
         }
         LogManager.WriteLog("Show Undeclared Drop Report Successfull", LogManager.enumLogLevel.Info);
     }
     catch (Exception ex)
     {
         ExceptionManager.Publish(ex);
     }
 }
        private void ShowStackerLevelDetailReport(int StackerLevel)
        {
            try
            {
                IReports objReports = ReportsBusinessObject.CreateInstance();
                LogManager.WriteLog("Fetching report data from database...", LogManager.enumLogLevel.Info);

                DataSet dsStackerDetails = objReports.GetStackerDetails(StackerLevel);

                //if (dsStackerDetails.Tables[0].Rows.Count == 0)
                //{
                //    LogManager.WriteLog("No Records found for the selected criteria - Return", LogManager.enumLogLevel.Info);
                //    MessageBox.ShowBox("MessageID261", BMC_Icon.Information);
                //    return;
                //}
                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    LogManager.WriteLog("Report data fetched successfully from database", LogManager.enumLogLevel.Info);

                    cReportViewer.ShowStackerLevelDetailReport(dsStackerDetails, StackerLevel,SiteCode);
                    cReportViewer.ShowDialog();
                }

                LogManager.WriteLog("ShowStackerLevelDetailReport Successfull", LogManager.enumLogLevel.Info);
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
				MessageBox.ShowBox("MessageID262", BMC_Icon.Error);
            }

        }
        private void btnConfirm_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtAdvanceToRetailer.Text))
                {
                    MessageBox.ShowBox("MessageID370", BMC_Icon.Information);
                    return;
                }

                decimal dAdvanceToRetailer = 0.0M;
                if (!CheckForValidAdvanceToRetailValue(out dAdvanceToRetailer))
                {
                    MessageBox.ShowBox("MessageID434", BMC_Icon.Information);
                    return;
                }

                System.Windows.Forms.DialogResult dr = MessageBox.ShowBox("MessageID371", BMC_Icon.Question, BMC_Button.YesNo);

                if (dr.ToString() == "Yes")
                {
                    //Update advance retailer value
                    //UpdateAdvanceRetailer();

                    //Calculate the retailer negative net

                    //CalculateRetailerNegative();
                    //CalculateCarriedForwardAmount();

                    if (Entity.ProfitShareGroupId > 0)
                    {
                        //Sp call for profit share details
                        CommonLiquidationDataContext objCommonLiquidation = new CommonLiquidationDataContext(CommonUtilities.ExchangeConnectionString);
                        int LiquidationProfitShareResult = objCommonLiquidation.PerformLiquidationForProfitShare(null,
                                                                                                                 _BatchNo,
                                                                                                                 _entity.ProfitShareGroupId,
                                                                                                                 _entity.ExpenseShareGroupID,
                                                                                                                 _entity.ExpenseShareAmount,
                                                                                                                 _entity.WriteOffAmount,
                                                                                                                 _entity.PayPeriodId,
                                                                                                                 _entity.Gross,
                                                                                                                 _entity.Tickets_Expected,
                                                                                                                 _entity.Net_Percentage,
                                                                                                                 _entity.Retailer_Negative_Net,
                                                                                                                 _entity.Net_Percentage,
                                                                                                                 _entity.Tickets_Paid,
                                                                                                                 _entity.Advance_To_Retailer,
                                                                                                                 _entity.Retailer_Share,
                                                                                                                 _entity.Balance_Due,
                                                                                                                 _entity.Retailer,
                                                                                                                 _entity.RetailerShareBeforeFixedExpense,
                                                                                                                 _entity.CarriedForwardExpense,
                                                                                                                 _entity.RetailerExpenseShareAmount,
                                                                                                                 _entity.FixedExpenseAmount,
                                                                                                                 _entity.PrevCarriedForwardExpense);

                        //Report
                        MessageBox.ShowBox("MessageID488", BMC_Icon.Information);
                        //calling Audit Method
                        Audit(true, _BatchNo);
                        System.Windows.Forms.DialogResult res = MessageBox.ShowBox("MessageID491", BMC_Icon.Question, BMC_Button.YesNo);
                        if (res == System.Windows.Forms.DialogResult.Yes)
                        {
                            using (CReportViewer cReportViewer = new CReportViewer())
                            {
                                LogManager.WriteLog("Report data fetched successfully from database", LogManager.enumLogLevel.Info);
                                cReportViewer.ShowLiquidationReportForRead(_BatchNo, null);
                                cReportViewer.ShowDialog();
                            }
                        }
                    }
                    else
                    {
                        MessageBox.ShowBox("MessageID490", BMC_Icon.Information);
                        return;
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
        private void ShowJackpotSlipSummaryReport(DateTime reportStartDateTime, DateTime reportEndDateTime)
        {
            try
            {
                LogManager.WriteLog("Inside ShowJackportSlipSummaryReport method", LogManager.enumLogLevel.Info);

                if (reportStartDateTime > reportEndDateTime)
                {
                    MessageBox.ShowBox("MessageID282", BMC_Icon.Information);
                    return;
                }

                if (reportStartDateTime > System.DateTime.Now)
                {
                    MessageBox.ShowBox("MessageID283", BMC_Icon.Information);
                    return;
                }

                if (reportEndDateTime > System.DateTime.Now)
                {
                    MessageBox.ShowBox("MessageID288", BMC_Icon.Information);
                    return;
                }

                IReports objReports = ReportsBusinessObject.CreateInstance();

                LogManager.WriteLog("Fetching report data from database...", LogManager.enumLogLevel.Info);

                DataSet jackpotSlipSummaryDetails = objReports.GetJackpotSlipSummaryDetails(reportStartDateTime, 
                    reportEndDateTime,chkIncludeHandpay.IsChecked,chkIncludeJackpot.IsChecked);

                if (jackpotSlipSummaryDetails.Tables[0].Rows.Count == 0)
                {
                    LogManager.WriteLog("No Records found for the selected criteria - Return", LogManager.enumLogLevel.Info);

                    MessageBox.ShowBox("MessageID261", BMC_Icon.Information);
                    return;
                }

                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    LogManager.WriteLog("Report data fetched successfully from database", LogManager.enumLogLevel.Info);

                    cReportViewer.ShowJackpotSlipSummaryReport(jackpotSlipSummaryDetails, reportStartDateTime, reportEndDateTime,
                        chkIncludeHandpay.IsChecked,chkIncludeJackpot.IsChecked);
                    cReportViewer.ShowDialog();
                }

                LogManager.WriteLog("ShowJackportSlipSummaryReport Successfull", LogManager.enumLogLevel.Info);
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                MessageBox.ShowBox("MessageID262", BMC_Icon.Error);
            }
        }
        private void btnTicketAnomalies_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (StartDate > EndDate)
                {
                    MessageBox.ShowBox("MessageID282", BMC_Icon.Information);
                    return;
                }

                if (StartDate > System.DateTime.Now)
                {
                    MessageBox.ShowBox("MessageID283", BMC_Icon.Information);
                    return;
                }

                if (EndDate > System.DateTime.Now)
                {
                    MessageBox.ShowBox("MessageID284", BMC_Icon.Information);
                    return;
                }
                IReports objReports = ReportsBusinessObject.CreateInstance();
                DataSet TicketAnomalies = null;
                TicketAnomalies = objReports.GetTicketAnomalies(StartDate, EndDate);
                LogManager.WriteLog("Fetching report data from database...", LogManager.enumLogLevel.Info);
                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    LogManager.WriteLog("Report data fetched successfully from database Ticket Anomalies Report", LogManager.enumLogLevel.Info);
                    cReportViewer.ShowTicketAnomaliesReport(StartDate, EndDate);
                    cReportViewer.SetOwner(System.Windows.Window.GetWindow(this));

                    cReportViewer.Show();
                }

                LogManager.WriteLog("Ticket Anomalies Report Successfull", LogManager.enumLogLevel.Info);
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
        private void GetIssuedTicketReport(DateTime dtFromDate, DateTime dtToDate, string sStatus, string sSlot)
        {
            try
            {
                LogManager.WriteLog("Inside GetIssuedTicketReport method", LogManager.enumLogLevel.Info);

                if (dtFromDate > dtToDate)
                {
                    MessageBox.ShowBox("MessageID286", BMC_Icon.Information);
                    return;
                }

                if (dtFromDate > System.DateTime.Now)
                {
                    MessageBox.ShowBox("MessageID287", BMC_Icon.Information);
                    return;
                }

                if (dtToDate > System.DateTime.Now)
                {
                    MessageBox.ShowBox("MessageID288", BMC_Icon.Information);
                    return;
                }

                IReports objReports = ReportsBusinessObject.CreateInstance();
                DataSet dtDataset = objReports.GetVoucherListingReport(dtFromDate, dtToDate, sStatus,sSlot);

				if (dtDataset.Tables[0].Rows.Count == 0)
                {
                    MessageBox.ShowBox("MessageID261", BMC_Icon.Information);
                    return;
                }

                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    cReportViewer.ShowVoucherListingReport("VoucherListingReport", dtDataset, dtFromDate, dtToDate, sStatus,sSlot);
                    cReportViewer.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                MessageBox.ShowBox("MessageID262", BMC_Icon.Error);
            }
        }
        public void CreateVaultCassettesCurrentDropReport(usp_Vault_DropResult Vault)
        {
            try
            {
                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    cReportViewer.ShowVaultCurrentDropSlip(Vault.Vault_ID, Vault.Name, Vault.Serial_NO, Vault.Manufacturer_Name, Vault.Type_Prefix, SecurityHelper.CurrentUser.DisplayName,
                                                              Convert.ToDateTime(Vault.CreatedDate), Vault.IsWebServiceEnabled, Convert.ToDecimal(Vault.FillAmount),
                                                              Convert.ToDecimal(Vault.TotalAmountOnFill), Convert.ToDecimal(Vault.CurrentBalance), _isfinaldrop);


                    cReportViewer.ShowDialog();
                }
                LogManager.WriteLog("Show Vault Drop Transaction Slip Report Successfull", LogManager.enumLogLevel.Info);
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
        private void ShowCrossPropertyLiabilityTransferSummaryReport(DateTime StartDate, DateTime EndDate)
        {
            try
            {
                LogManager.WriteLog("Inside ShowCrossPropertyLiabilityTransferSummaryReport method", LogManager.enumLogLevel.Info);

                if (StartDate > EndDate)
                {
                    MessageBox.ShowBox("MessageID286", BMC_Icon.Information);
                    return;
                }

                if (StartDate > System.DateTime.Now)
                {
                    MessageBox.ShowBox("MessageID287", BMC_Icon.Information);
                    return;
                }

                if (EndDate > System.DateTime.Now)
                {
                    MessageBox.ShowBox("MessageID288", BMC_Icon.Information);
                    return;
                }

                IReports objReports = ReportsBusinessObject.CreateInstance();
                DataSet dtDataset = objReports.GetCrossPropertyLiabilityTransferSummaryReport(StartDate, EndDate);

                if (dtDataset.Tables[0].Rows.Count == 0)
                {
                    MessageBox.ShowBox("MessageID261", BMC_Icon.Information);
                    return;
                }

                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    cReportViewer.ShowCrossPropertyLiabilityTransferSummaryReport("CrossPropertyLiabilityTransferDetailsReport", dtDataset, StartDate, EndDate);
                    cReportViewer.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                MessageBox.ShowBox("MessageID262", BMC_Icon.Error);
            }
        }
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {


            try
            {
                btnPrint.IsEnabled = false;



                if (_worker.IsBusy)
                {
                    MessageBox.ShowBox("MessageID368", BMC_Icon.Information);
                    return;
                }
                if (StartDate > EndDate)
                {
                    MessageBox.ShowBox("MessageID282", BMC_Icon.Information);
                    return;
                }

                if (StartDate > System.DateTime.Now)
                {
                    MessageBox.ShowBox("MessageID283", BMC_Icon.Information);
                    return;
                }

                if (EndDate > System.DateTime.Now)
                {
                    MessageBox.ShowBox("MessageID284", BMC_Icon.Information);
                    return;
                }

                if (isDateChanged)
                {
                    btnProcess_Click(sender, e);
                }

                IReports objReports = ReportsBusinessObject.CreateInstance();

                LogManager.WriteLog("Fetching report data from database...", LogManager.enumLogLevel.Info);

                DataSet CashdeskDetails = null;
                String UserName = string.Empty;
                User lstUser = cboUser.SelectedItem as User;
                if (lstUser == null || String.IsNullOrEmpty(lstUser.UserName))
                {
                    UserName = SecurityHelper.CurrentUser.UserName;
                }
                else
                {
                    UserName = lstUser.UserName;
                }

                CashdeskDetails = new DataSet();

                //Add this list in order amount/count 
                CashdeskDetails.Tables.Add("CDSummary");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("CDPaidAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("CDPaidCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("CDPrintedAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("CDPrintedCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("HandPayAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("HandPayCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("JackpotAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("JackpotCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("ProgAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("ProgCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("ShortPayAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("ShortPayCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("OfflineVoucherAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("OfflineVoucherCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("VoidAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("VoidCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("MCPaidAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("MCPaidCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("MCPrintAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("MCPrintCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("ActiveCashableVoucherAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("ActiveCashableVoucherCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("VoidTicketsAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("VoidTicketsCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("VoidVoucherAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("VoidVoucherCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("CancelledAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("CancelledCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("ExpiredAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("ExpiredCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("TicketInExceptionAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("TicketInExceptionCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("TicketOutExceptionAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("TicketOutExceptionCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("CashableVoucherLiabilityAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("CashableVoucherLiabilityCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("PromoCashableAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("PromoCashableCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("NonCashableINAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("NonCashableINCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("NonCashableOutAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("NonCashableOutCount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("OutstandingHandpaysAmount");
                CashdeskDetails.Tables["CDSummary"].Columns.Add("OutstandingHandpaysCount");



                CashdeskDetails.Tables["CDSummary"].Rows.Add(CashdeskDetails.Tables["CDSummary"].NewRow());


                foreach (rsp_CDM_GetCashierTransactionsSummary item in _CashierHistory.Summary)
                {
                    if (CashdeskDetails.Tables["CDSummary"].Columns.IndexOf(item.Summary_Type) < 0)
                        continue;
                    CashdeskDetails.Tables["CDSummary"].Rows[0][item.Summary_Type] = item.Amount.ToString();
                    CashdeskDetails.Tables["CDSummary"].Rows[0][CashdeskDetails.Tables["CDSummary"].Columns.IndexOf(item.Summary_Type) + 1] = item.Count_Summary.ToString();
                }


                //= objReports.GetCashDeskReconcilationDetails(StartDate, EndDate);
                // CashdeskDetails = objReports.GetCashierTransactions(StartDate, EndDate, UserNo, iRoute_No);

                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    LogManager.WriteLog("Report data fetched successfully from database", LogManager.enumLogLevel.Info);

                    cReportViewer.ShowCashierTransactionsHistoryReport(CashdeskDetails, StartDate, EndDate, UserNo, UserName, sRoute_Name, iRoute_No, CashdeskDetails.GetXml());
                    cReportViewer.SetOwner(System.Windows.Window.GetWindow(this));

                    cReportViewer.Show();
                }

                LogManager.WriteLog("ShowCashDeskReconcilationReport Successfull", LogManager.enumLogLevel.Info);
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
            finally
            {
                btnPrint.IsEnabled = true;
            }
        }
 public void CreateVaultCurrentBalanceSlipReport(int Vault_Id, string VaultName, string Serial_No, string Manufacturer_Name, string Type_Prefix, string LoginUser,
                                                    DateTime CreatedDate, bool IsWebServiceEnabled, decimal FillAmount, decimal TotalAmountOnFill, decimal CurrentBalance)
 {
     try
     {
         using (CReportViewer cReportViewer = new CReportViewer())
         {
             LogManager.WriteLog("Report data fetched successfully from database", LogManager.enumLogLevel.Info);
             cReportViewer.ShowVaultCurrentBalanceSlip(Vault_Id, VaultName, Serial_No, Manufacturer_Name, Type_Prefix, LoginUser, CreatedDate,
                                                                  IsWebServiceEnabled, Convert.ToDecimal(FillAmount), Convert.ToDecimal(TotalAmountOnFill), Convert.ToDecimal(CurrentBalance));
             cReportViewer.SetOwner(System.Windows.Window.GetWindow(this));
             cReportViewer.Show();
         }
         LogManager.WriteLog("Show Vault Current Balance Slip Report Successfull", LogManager.enumLogLevel.Info);
     }
     catch (Exception ex)
     {
         ExceptionManager.Publish(ex);
     }
 }
        private void PrintOrExportDetails(bool Print)
        {
            string sType = string.Empty;
            switch (_iType)
            {
                case 1: sType = "(Day)"; break;
                case 2: sType = "(Drop)"; break;
                case 3: sType = "(Week)"; break;
                case 4: sType = "(Month)"; break;
                default: sType = ""; break;
            }

            string sReportName = txtHeader.Text.Trim() + sType;

            using (CReportViewer cReportViewer = new CReportViewer())
            {
                if (dtPrintDetails.Rows.Count > 0)
                {
                    cReportViewer.ShowReportsAnalysisDetails(dtPrintDetails, sReportName, Print, TotalAvgBet,string.Empty);
                }
            }
        }
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DataTable dtHistory = null;
                if (cmb_SelectTop.SelectedValue.ToString() == "All")
                {
                    dtHistory = objVaultBiz.GetFillHistory(0, 0, ((rsp_Vault_GetTransactionTypesResult)cmbTransType.SelectedItem).TYPE_ID);
                }
                else
                {
                    dtHistory = objVaultBiz.GetFillHistory(0, int.Parse(cmb_SelectTop.SelectedValue.ToString()), ((rsp_Vault_GetTransactionTypesResult)cmbTransType.SelectedItem).TYPE_ID);
                }

                if (dtHistory.Rows.Count == 0 || dtHistory.Rows.Count == 0)
                {
                    LogManager.WriteLog("No Records found for the selected criteria - Return", LogManager.enumLogLevel.Info);

                    MessageBox.ShowBox("MessageID261", BMC_Icon.Information);
                    return;
                }
                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    LogManager.WriteLog("Report data fetched successfully from database", LogManager.enumLogLevel.Info);
                    if (cmb_SelectTop.SelectedValue.ToString() == "All")
                    {
                        cReportViewer.ShowVaultFillHistory(dtHistory, 0, 0);
                    }
                    else
                        cReportViewer.ShowVaultFillHistory(dtHistory, 0, int.Parse(cmb_SelectTop.SelectedValue.ToString()));
                    cReportViewer.SetOwner(Window.GetWindow(this));
                    cReportViewer.Show();
                }
                LogManager.WriteLog("ShowLiquidationReport Successfull", LogManager.enumLogLevel.Info);
            }
            catch (Exception Ex)
            {

                ExceptionManager.Publish(Ex);
            }
        }
        //
        /// <summary>
        /// Performs the auto cash dispense.
        /// </summary>
        /// <returns>True if succeeded; otherwise false.</returns>
        public bool AutoCashDispense(string fieldName, string fieldValue, decimal value)
        {
            DispenserWorkerResult result = DispenserWorkerResult.None;
            string message = string.Empty;
            this.EnsureDecksAreLoaded();
            IDictionary<string, DeckDenomValue> pairs =
                new SortedDictionary<string, DeckDenomValue>(StringComparer.InvariantCultureIgnoreCase);
            string keyLower = "LOWER";
            string keyUpper = "UPPER";

            decimal upperCount = 0;
            decimal lowerCount = 0;
            decimal receiptAmount = 0;

            try
            {
                // Determine the number of counts from lower and upper deck
                decimal upperAvailAmount = this.UpperDeck.RemainingValueCalculated;
                decimal lowerAvailAmount = this.LowerDeck.RemainingValueCalculated;

                // denominations
                decimal upperDenom = this.UpperDeck.Denimination;
                decimal lowerDenom = this.LowerDeck.Denimination;
                if (lowerDenom > upperDenom)
                {
                    // denom
                    decimal tempDenom = lowerDenom;
                    lowerDenom = upperDenom;
                    upperDenom = tempDenom;

                    // total amount
                    decimal tempAmount = lowerAvailAmount;
                    lowerAvailAmount = upperAvailAmount;
                    upperAvailAmount = tempAmount;

                    keyLower = "UPPER";
                    keyUpper = "LOWER";
                }

                // mapping for upper and lower deck
                pairs.Add(keyLower, new DeckDenomValue() { Denomination = lowerDenom, Value = lowerAvailAmount });
                pairs.Add(keyUpper, new DeckDenomValue() { Denomination = upperDenom, Value = upperAvailAmount });

                // if valid amount is passed
                if (value > 0)
                {
                    decimal inputValue = value;

                    // upper count
                    upperCount = Math.Floor(inputValue / pairs[keyUpper].Denomination);
                    if (upperCount > pairs[keyUpper].TotalCount)
                    {
                        upperCount = pairs[keyUpper].TotalCount;
                    }
                    inputValue -= (upperCount * pairs[keyUpper].Denomination);

                    // lower count
                    lowerCount = Math.Floor(inputValue / pairs[keyLower].Denomination);
                    if (lowerCount > pairs[keyLower].TotalCount)
                    {
                        lowerCount = pairs[keyLower].TotalCount;
                    }
                    inputValue -= (lowerCount * pairs[keyLower].Denomination);

                    // updated values
                    pairs[keyUpper].Value = upperCount;
                    pairs[keyLower].Value = lowerCount;
                    receiptAmount = inputValue;
                }

                // dispense
                result = this.Dispense(pairs["UPPER"].Value, pairs["LOWER"].Value, out message);
                if (result != (DispenserWorkerResult.Success |
                    DispenserWorkerResult.LowerDeckOK |
                    DispenserWorkerResult.UpperDeckOK))
                {
                    LogManager.WriteLog(message, LogManager.enumLogLevel.Error);
                }
                else
                {
                    LogManager.WriteLog(message, LogManager.enumLogLevel.Info);
                }

                // try to print the remaing amount as receipt
                if (receiptAmount > 0)
                {
                    try
                    {
                        using (CReportViewer objReportViewer = new CReportViewer())
                        {
                            objReportViewer.PrintCashDispenserReceipt(System.Environment.MachineName, fieldName, fieldValue,
                                                                    Convert.ToDecimal(receiptAmount));
                            
                        }
                    }
                    catch (Exception ex)
                    {
                        ExceptionManager.Publish(ex);
                    }
                }

                WriteAuditLog(this.UpperDeck, this.LowerDeck, upperCount, lowerCount, "Receipt", receiptAmount);
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }

            return (result == (DispenserWorkerResult.Success |
                    DispenserWorkerResult.LowerDeckOK |
                    DispenserWorkerResult.UpperDeckOK));
        }
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string SiteCode    = "";
                string AssetNumber = "";
                string PosNumber   = "";
                this.Cursor        = Cursors.Wait;
                btnPrint.IsEnabled = false;
                LogManager.WriteLog("Inside btnPrint_Click", LogManager.enumLogLevel.Info);

                IMeterLife meterLife = MeterLifeBusinessObject.CreateInstance();
                meterLife.GetAssetDetails(this.InstallationNo, ref SiteCode, ref AssetNumber, ref PosNumber);

                if (lstView != null)
                {
                    if (lstView.Items.Count > 0)
                    {
                        DataTable meterData = new DataTable();

                        meterData.TableName = "MachineMeters";

                        meterData.Columns.Add("Meter");
                        meterData.Columns.Add("Start");
                        meterData.Columns.Add("Current");
                        meterData.Columns.Add("Difference");
                        meterData.Columns.Add("Value");
                        meterData.Columns.Add("SiteCode");
                        meterData.Columns.Add("PosNumber");
                        meterData.Columns.Add("AssetNumber");

                        LogManager.WriteLog("Filling the Meter Datatable for Print Report...", LogManager.enumLogLevel.Info);

                        foreach (DataRowView dvItem in lstView.Items)
                        {
                            DataRow meterRow = meterData.NewRow();

                            meterRow["Meter"]       = dvItem["Meter"].ToString();
                            meterRow["Start"]       = dvItem["Start"].ToString();
                            meterRow["Current"]     = dvItem["Current"].ToString();
                            meterRow["Difference"]  = dvItem["Difference"].ToString();
                            meterRow["Value"]       = dvItem["Value"].ToString() != string.Empty ? Convert.ToDecimal(dvItem["Value"]).GetUniversalCurrencyFormatWithSymbol() : "NA";
                            meterRow["SiteCode"]    = SiteCode;
                            meterRow["PosNumber"]   = PosNumber;
                            meterRow["AssetNumber"] = AssetNumber;
                            meterData.Rows.Add(meterRow);
                        }

                        LogManager.WriteLog("Meter Datatable filled successfully with Print Report Data.", LogManager.enumLogLevel.Info);

                        CReportViewer cReportViewer = new CReportViewer();

                        cReportViewer.PrintMeterLifeReport(meterData);

                        cReportViewer = null;
                        meterData     = null;
                    }
                    else
                    {
                        MessageBox.ShowBox("MessageID47");
                    }
                }
                else
                {
                    MessageBox.ShowBox("MessageID47");
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
            finally
            {
                this.Cursor        = Cursors.Arrow;
                btnPrint.IsEnabled = true;
            }
        }
        private void btnConfirm_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtAdvanceToRetailer.Text))
                {
                    MessageBox.ShowBox("MessageID370", BMC_Icon.Information);
                    return;
                }

                decimal dAdvanceToRetailer = 0.0M;
                if (!CheckForValidAdvanceToRetailValue(out dAdvanceToRetailer))
                {
                    MessageBox.ShowBox("MessageID434", BMC_Icon.Information);
                    return;
                }

                System.Windows.Forms.DialogResult dr = MessageBox.ShowBox("MessageID371", BMC_Icon.Question, BMC_Button.YesNo);

                if (dr.ToString() == "Yes")
                {
                    //Update advance retailer value
                    //UpdateAdvanceRetailer();

                    //Calculate the retailer negative net

                    //CalculateRetailerNegative();
                    //CalculateCarriedForwardAmount();

                    if (Entity.ProfitShareGroupId > 0)
                    {

                        //Sp call for profit share details
                        CommonLiquidationDataContext objCommonLiquidation = new CommonLiquidationDataContext(CommonUtilities.ExchangeConnectionString);
                        int LiquidationProfitShareResult = objCommonLiquidation.PerformLiquidationForProfitShare(null, 
                                                                                                                    _BatchNo, 
                                                                                                                    _entity.ProfitShareGroupId,
                                                                                                                    _entity.ExpenseShareGroupID,
                                                                                                                    _entity.ExpenseShareAmount,
                                                                                                                    _entity.WriteOffAmount,
                                                                                                                    _entity.PayPeriodId,
                                                                                                                    _entity.Gross,
                                                                                                                    _entity.Tickets_Expected,
                                                                                                                    _entity.Net_Percentage,
                                                                                                                    _entity.Retailer_Negative_Net,
                                                                                                                    _entity.Net_Percentage,
                                                                                                                    _entity.Tickets_Paid,
                                                                                                                    _entity.Advance_To_Retailer,
                                                                                                                    _entity.Retailer_Share,
                                                                                                                    _entity.Balance_Due,
                                                                                                                    _entity.Retailer,
                                                                                                                    _entity.RetailerShareBeforeFixedExpense,
                                                                                                                    _entity.CarriedForwardExpense,
                                                                                                                    _entity.RetailerExpenseShareAmount,
                                                                                                                    _entity.FixedExpenseAmount,
                                                                                                                    _entity.PrevCarriedForwardExpense);

                        //Report
                        MessageBox.ShowBox("MessageID488", BMC_Icon.Information);
                        //calling Audit Method
                        Audit(true,_BatchNo);
                        System.Windows.Forms.DialogResult res = MessageBox.ShowBox("MessageID491", BMC_Icon.Question, BMC_Button.YesNo);
                        if (res == System.Windows.Forms.DialogResult.Yes)
                        {
                            using (CReportViewer cReportViewer = new CReportViewer())
                            {
                                LogManager.WriteLog("Report data fetched successfully from database", LogManager.enumLogLevel.Info);
                                cReportViewer.ShowLiquidationReportForRead(_BatchNo, null);
                                cReportViewer.ShowDialog();
                            }
                        }
                    }
                    else
                    {
                        MessageBox.ShowBox("MessageID490", BMC_Icon.Information);
                        return;
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }

        }
        private void PrintonDrop(IList<UndeclaredCollectionRecord> collectionRecords, string userName)
        {
            // DataSet DeclarationPrint = CollectionExtensions.ToDataSet<UndeclaredCollectionRecord>(((IEnumerable<UndeclaredCollectionRecord>)Source), "DeclarationPrint");

            int batchNo = 0;
            int nMachineCount = 0;
            string sDropType = string.Empty;
            var lineHeader = new DataTable();
            var lineItem = new DataTable("DeclarationPrint");
            var isFirstRecord = true;
            ILiquidationDetails details = LiquidationBusinessObject.CreateInstance();
            bool bSGVIEnable = false;
            string sAutoTicketDeclare = string.Empty;

            lineHeader.Columns.Add("Date");
            lineHeader.Columns.Add("DropNo");
            lineHeader.Columns.Add("NoOfMachine");
            lineHeader.Columns.Add("user");

            lineHeader.Columns.Add("Bills");
            lineHeader.Columns.Add("CoinsIn");
            lineHeader.Columns.Add("TicketsIn");
            lineHeader.Columns.Add("EFTIn");
            lineHeader.Columns.Add("TotalCashIn");

            lineHeader.Columns.Add("TicketsOut");
            lineHeader.Columns.Add("EFTOut");
            lineHeader.Columns.Add("CancelledCredits");
            lineHeader.Columns.Add("Jackpots");
            lineHeader.Columns.Add("CoinsOut");
            lineHeader.Columns.Add("TotalCashOut");


            lineHeader.Columns.Add("Asset");
            lineHeader.Columns.Add("Pos");
            //lineHeader.Columns.Add("NetWin");

            lineItem.Columns.Add("Asset", typeof(string));
            lineItem.Columns.Add("Pos", typeof(string));

            lineItem.Columns.Add("Bills", typeof(decimal));
            lineItem.Columns.Add("CoinsIn", typeof(decimal));
            lineItem.Columns.Add("TicketsIn", typeof(decimal));
            lineItem.Columns.Add("EFTIn", typeof(decimal));
            lineItem.Columns.Add("TotalCashIn", typeof(decimal));


            lineItem.Columns.Add("TicketsOut");
            //lineItem.Columns.Add("EFTOut");
            lineItem.Columns.Add("CancelledCredits", typeof(decimal));
            //lineItem.Columns.Add("Jackpots");
            //lineItem.Columns.Add("CoinsOut"); 
            //lineItem.Columns.Add("TotalCashOut");

            //lineItem.Columns.Add("NetWin");

            try
            {
                batchNo = _batchnumberfordropPrint;
                nMachineCount = collectionRecords.Count - 1;
                bSGVIEnable = (Convert.ToBoolean(details.GetSetting("SGVI_Enabled")) && (details.GetSetting("Client") == "SGVI"));
                sAutoTicketDeclare = Convert.ToString(details.GetSetting("TicketDeclarationMethod"));

                foreach (var collectionRecord in collectionRecords)
                {
                    //var dr = isFirstRecord ? lineHeader.NewRow() : lineItem.NewRow();
                    //if (isFirstRecord) { isFirstRecord = false; 

                    //                     continue;
                    //}
                    var dr = lineItem.NewRow();
                    sDropType = collectionRecord.Type == "defloat" ? "Final" : "Standard";
                    dr["Bills"] = collectionRecord.TotalBillValue;
                    dr["CoinsIn"] = collectionRecord.TotalCoinsValue;
                    dr["TicketsIn"] = collectionRecord.TicketsInValue;
                    dr["EFTIn"] = collectionRecord.EFTInValue;
                    dr["TotalCashIn"] = (collectionRecord.TotalBillValue + collectionRecord.TotalCoinsValue + collectionRecord.TicketsInValue);
                    //dr["TotalCashIn"] = (collectionRecord.TotalBillValue + collectionRecord.TotalCoinsValue + collectionRecord.TicketsInValue)+ collectionRecord.EFTInValue);


                    if (bSGVIEnable)
                    {
                        dr["TicketsOut"] = collectionRecord.TicketsOutValue;// + collectionRecord.ShortPayValue);
                        dr["CancelledCredits"] = collectionRecord.AttendantPayValue;
                    }
                    else
                    {
                        if (sAutoTicketDeclare.ToUpper() == "AUTO")
                            dr["TicketsOut"] = collectionRecord.TicketsOutValue;
                        else
                            dr["TicketsOut"] = (collectionRecord.TicketsOutValue + collectionRecord.ShortPayValue);
                        dr["CancelledCredits"] = collectionRecord.AttendantPayValue + collectionRecord.JackpotValue;
                    }
                    //dr["Jackpots"] = collectionRecord.Jackpot;
                    //dr["CoinsOut"] = ((decimal)collectionRecord.CoinOutValue).GetUniversalCurrencyFormatWithSymbol(); 
                    //dr["EFTOut"] = ((decimal)0).GetUniversalCurrencyFormatWithSymbol();
                    //dr["TotalCashOut"] = (collectionRecord.TicketsOutValue + collectionRecord.ShortPayValue + collectionRecord.HandpayValue + collectionRecord.JackpotValue + collectionRecord.CoinOutValue).GetUniversalCurrencyFormatWithSymbol();

                    //dr["NetWin"] = ((collectionRecord.TotalBillValue + collectionRecord.TotalCoinsValue + collectionRecord.TicketsInValue + collectionRecord.EFTInValue)
                    //    - (collectionRecord.TicketsOutValue + collectionRecord.HandpayValue + collectionRecord.JackpotValue + collectionRecord.ShortPayValue + collectionRecord.CoinOutValue)).GetUniversalCurrencyFormatWithSymbol();

                    //if (isFirstRecord)
                    //{
                    //    dr["Date"] = DateTime.Now.GetUniversalDateFormat();

                    //    dr["DropNo"] = collectionRecords[1].CollectionBatchNo == 0
                    //                       ? (object)"Interm Collection"
                    //                       : collectionRecords[1].CollectionBatchNo;

                    //    dr["NoOfMachine"] = collectionRecords.Count - 1;
                    //    dr["user"] = userName;
                    //    lineHeader.Rows.Add(dr);
                    //}
                    //else
                    //{
                    dr["Asset"] = collectionRecord.AssetNo;
                    dr["Pos"] = collectionRecord.Position;
                    lineItem.Rows.Add(dr);
                    // }
                    isFirstRecord = false;

                }

                DataSet DSDeclaration = new DataSet("DeclarationPrint");
                DSDeclaration.Tables.Add(lineItem);

                IReports objReports = ReportsBusinessObject.CreateInstance();

                if (DSDeclaration.Tables[0].Rows.Count == 0)
                {
                    MessageBox.ShowBox("MessageID261", BMC_Icon.Information);
                    return;
                }

                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    cReportViewer.DropSummaryReport(DSDeclaration, userName, batchNo, nMachineCount, sDropType);
                    cReportViewer.SetOwner(Window.GetWindow(this));
                    cReportViewer.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                MessageBox.ShowBox("MessageID262", BMC_Icon.Error);
            }

        }
        //
        private void Print(IList<UndeclaredCollectionRecord> collectionRecords, string userName)
        {
            int batchNo = 0;
            int nMachineCount = 0;
            string sDropType = string.Empty;
            string sExchangeConnectionString = string.Empty;
            string sTicketConnectionString = string.Empty;
            DataSet DSDeclaration;
            ILiquidationDetails details = LiquidationBusinessObject.CreateInstance();
            try
            {
                batchNo = ((UndeclaredCollection)cboMachineType.SelectedItem).Collection_Batch_No;
                nMachineCount = collectionRecords.Count - 1;
                sDropType = string.Empty;
                foreach (UndeclaredCollectionRecord Collection in collectionRecords)
                {
                    /*if (sDropType == string.Empty)
                    {
                        sDropType = Collection.Type == "Defloat" ? "Final" : "Standard";
                    }
                    else*/
                    {
                        switch (Collection.Type)
                        {
                            case "Defloat":
                                if (!sDropType.Contains("Final"))
                                    sDropType = sDropType + (sDropType.Length >0?", ":"") + "Final";
                                break;
                            case "Total":
                                break;
                            default:
                                if (!sDropType.Contains("Standard"))
                                    sDropType = sDropType + (sDropType.Length > 0 ? ", " : "") + "Standard";
                                break;
                        }
                        
                }
                }
                

                if (collectionRecords.Count >1)
                {
                    if (collectionRecords[1].CollectionBatchNo == 0)
                    {
                        sDropType = "Part";
                    }
                }

                bool bAddShortPay = false;
                try
                {   bAddShortPay = Convert.ToBoolean(details.GetSetting("AddShortpayInVoucherOut"));    }
                catch{}

                DSDeclaration = GetBatchDataset(collectionRecords, bAddShortPay);
                if (DSDeclaration.Tables[0].Rows.Count == 0)
                {
                    MessageBox.ShowBox("MessageID261", BMC_Icon.Information);
                    return;
                }
                if (isCommonCDOforDeclaration)
                {
                    sExchangeConnectionString = (cboSiteCode.SelectedItem as SiteConfig).ExchangeConnectionString;
                    sTicketConnectionString = (cboSiteCode.SelectedItem as SiteConfig).TicketConnectionString;
                }
                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    cReportViewer.ShowDeclarationReport(DSDeclaration, userName, batchNo, nMachineCount, sDropType,
                        sExchangeConnectionString, sTicketConnectionString);
                    cReportViewer.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                MessageBox.ShowBox("MessageID262", BMC_Icon.Error);
            }

        }