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 CreateLiquidationReport()
        {
            try
            {
                if (Settings.SGVI_Enabled)
                {
                    CreateSGVILiquidationReport();
                    return;
                }
                IReports objReports = isCommonCDOforDeclaration ? ReportsBusinessObject.CreateInstance(ExchangeConst, TicketConst) : ReportsBusinessObject.CreateInstance();

                LogManager.WriteLog("Check whether the Liquidation performed for the batch or not-Starts", LogManager.enumLogLevel.Info);
                int?iLiquidationPerformed          = 0;
                int isLiquidationPerformedForBatch = objReports.CheckLiquidationPerformed(_BatchID, ref iLiquidationPerformed);

                if (isLiquidationPerformedForBatch == 0)
                {
                    MessageBox.ShowBox("MessageID891", BMC_Icon.Information);
                    return;
                }

                using (CReportViewer cReportViewer = new CReportViewer())
                {
                    LogManager.WriteLog("Launch the liquidation report", LogManager.enumLogLevel.Info);
                    cReportViewer.ShowLiquidationReportForRead(_BatchID, null);
                    cReportViewer.SetOwner(Window.GetWindow(this));
                    cReportViewer.ShowDialog();
                }

                LogManager.WriteLog("ShowLiquidationReport Successfull", LogManager.enumLogLevel.Info);
            }

            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
        private void btnConfirm_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (objCommonLiquidation.ProfitShareGroupId <= 0)
                {
                    MessageBox.ShowBox("MessageID490", BMC_Icon.Information);
                    return;
                }

                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")
                {
                    //Calculate the retailer negative net

                    CalculateRetailerNegative();
                    if (oReadLiquidationConfiguration.SaveLiquidation(objCommonLiquidation) == 0)
                    {
                        MessageBox.ShowBox("MessageID488", BMC_Icon.Information);
                        Audit(true, objCommonLiquidation.Read_No);

                        System.Windows.Forms.DialogResult res = MessageBox.ShowBox("MessageID251", 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(null, objCommonLiquidation.Read_No);
                                cReportViewer.SetOwner(this);


                                cReportViewer.Show();
                            }
                        }
                    }

                    else
                    {
                        MessageBox.ShowBox("MessageID489", BMC_Icon.Information);
                        return;
                    }
                    this.Close();
                }
            }

            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }