Exemple #1
0
        public CompanyLadeAssignmentDetailReport(string FromDate, string FromTime, string ToDate, string ToTime, String LaderTypeID, String CompanyID, String GoodIDlist, String DestinationCityIDList, String PortPlaceList)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            try
            {
                HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmenFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory();
                DataTable LaderTypeReportTable = new DataTable();
                LadeAssignmenFactory.SelectCompanyLadeAssignmentDetail(FromDate, FromTime, ToDate, ToTime, LaderTypeID, CompanyID, GoodIDlist, DestinationCityIDList, PortPlaceList, string.Empty, ref LaderTypeReportTable);
                this.DataSource         = LaderTypeReportTable;
                FromDatetxt.Text        = FromDate;
                FromTimetxt.Text        = FromTime;
                ToDatetxt.Text          = ToDate;
                ToTimetxt.Text          = ToTime;
                UserNametxt.Text        = HPS.Common.CurrentUser.user.UserName_nvc;
                Datetxt.Text            = LadeAssignmenFactory.ServerJalaliDate;
                Timetxt.Text            = LadeAssignmenFactory.ServerTime;
                Companytxt.DataField    = "Company_nvc";
                Goodtxt.DataField       = "Good_nvc";
                Addresstxt.DataField    = "Address_nvc";
                CarCounttxt.DataField   = "CarCount_int";
                LaderTypetxt.DataField  = "LaderType_nvc";
                PortPlacetxt.DataField  = "PortPlaces_nvc";
                PortageFeetxt.DataField = "PortageFee_dec";
                Commenttxt.DataField    = "Comment_nvc";
                LadBilltxt.DataField    = "LadBillCount_int";
                Remaindertxt.DataField  = "RemainderCount_int";

                Int64?AllcountRecords = (from row in LaderTypeReportTable.AsEnumerable() select(Int32) row["CarCount_int"]).Sum();
                AllCounttxt.Text = AllcountRecords.HasValue ? AllcountRecords.ToString() : "0";

                decimal?AllPriceRecords = (from row in LaderTypeReportTable.AsEnumerable() select(decimal) row["PortageFee_dec"]).Sum();
                AllPricetxt.Text = AllPriceRecords.HasValue ? AllPriceRecords.ToString() : "0";

                Int64?AllLadBillRecords = (from row in LaderTypeReportTable.AsEnumerable() select(Int32) row["LadBillCount_int"]).Sum();
                AllLadBilltxt.Text = AllLadBillRecords.HasValue ? AllLadBillRecords.ToString() : "0";

                Int64?AllRemainderCountRecords = (from row in LaderTypeReportTable.AsEnumerable() select(Int32) row["RemainderCount_int"]).Sum();
                AllRemainderCounttxt.Text = AllRemainderCountRecords.HasValue ? AllRemainderCountRecords.ToString() : "0";
            }
            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
Exemple #2
0
        public CompanyRemainderLadeReport(string FromDate, string FromTime, string ToDate, string ToTime, String LaderTypeID, String CompanyID, string OrderColumns_nvc, bool JustRemained, String GoodIDlist, String DestinationCityIDList, String PortPlaceList)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            try
            {
                HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmenFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory();
                DataTable LaderTypeReportTable = new DataTable();
                LadeAssignmenFactory.SelectCompanyLadeAssignmentDetail(FromDate, FromTime, ToDate, ToTime, LaderTypeID, CompanyID, GoodIDlist, DestinationCityIDList, PortPlaceList, OrderColumns_nvc, ref LaderTypeReportTable);
                LaderTypeReportTable.DefaultView.RowFilter = "RemainderCount_int <>0";
                DataTable dt = null;
                if (JustRemained)
                {
                    dt = LaderTypeReportTable.DefaultView.ToTable();
                }
                else
                {
                    dt = LaderTypeReportTable;
                }

                this.DataSource = dt;
                dt.Columns.Add("RemainedPercent");
                foreach (DataRow row  in dt.Rows)
                {
                    double RemainedPercent = (Convert.ToDouble(row["RemainderCount_int"]) * 100) / (Convert.ToDouble(row["CarCount_int"]));
                    row["RemainedPercent"] = RemainedPercent.ToString("0.##");
                }
                FromDatetxt.Text                       = FromDate;
                FromTimetxt.Text                       = FromTime;
                ToDatetxt.Text                         = ToDate;
                ToTimetxt.Text                         = ToTime;
                UserNametxt.Text                       = HPS.Common.CurrentUser.user.UserName_nvc;
                Datetxt.Text                           = LadeAssignmenFactory.ServerJalaliDate;
                Timetxt.Text                           = LadeAssignmenFactory.ServerTime;
                Companytxt.DataField                   = "Company_nvc";
                Goodtxt.DataField                      = "Good_nvc";
                Addresstxt.DataField                   = "Address_nvc";
                LaderTypetxt.DataField                 = "LaderType_nvc";
                PortPlacetxt.DataField                 = "PortPlaces_nvc";
                PortageFeetxt.DataField                = "PortageFee_dec";
                Commenttxt.DataField                   = "Comment_nvc";
                Remaindertxt.DataField                 = "RemainderCount_int";
                AllRequestTextBox.DataField            = "CarCount_int";
                LadeDatetxt.DataField                  = "Date_nvc";
                RemainedPercenttxt.DataField           = "RemainedPercent";
                CanceledByCompanytxt.DataField         = "CanceledByCompany";
                CanceledByLadBillCanceledtxt.DataField = "CanceledByLadBillCanceled";

                decimal?AllPriceRecords = (from row in dt.AsEnumerable() select(decimal) row["PortageFee_dec"]).Sum();
                AllPricetxt.Text = AllPriceRecords.HasValue ? AllPriceRecords.ToString() : "0";


                Int64?AllRemainderCountRecords = (from row in dt.AsEnumerable() select(Int32) row["RemainderCount_int"]).Sum();
                AllRemainderCounttxt.Text = AllRemainderCountRecords.HasValue ? AllRemainderCountRecords.ToString() : "0";

                Int64?AllRequestCountRecords = (from row in dt.AsEnumerable() select(Int32) row["CarCount_int"]).Sum();
                AllRequesttxt.Text = AllRequestCountRecords.HasValue ? AllRequestCountRecords.ToString() : "0";

                Int64?AllCanceledByCompany = (from row in dt.AsEnumerable() select(Int32) row["CanceledByCompany"]).Sum();
                AllCanceledByCompanytxt.Text = AllCanceledByCompany.HasValue ? AllCanceledByCompany.ToString() : "0";

                Int64?AllCanceledByLadBillCanceled = (from row in dt.AsEnumerable() select(Int32) row["CanceledByLadBillCanceled"]).Sum();
                AllCanceledByLadBillCanceledtxt.Text = AllCanceledByLadBillCanceled.HasValue ? AllCanceledByLadBillCanceled.ToString() : "0";

                AllPercentTxt.Text = (Convert.ToDouble(AllRemainderCounttxt.Text) * 100 / Convert.ToDouble(AllRequesttxt.Text)).ToString("0.##");
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
Exemple #3
0
        private void ShowButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (FromDatefaDatePicker.IsNull)
                {
                    throw new ApplicationException("از تاریخ خالی است");
                }
                else if (string.IsNullOrEmpty(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(FromTimeTextBox)))
                {
                    throw new ApplicationException("از ساعت خالی است");
                }
                else if (ToDatefaDatePicker.IsNull)
                {
                    throw new ApplicationException("تا تاریخ خالی است");
                }
                else if (string.IsNullOrEmpty(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(ToTimeTextBox)))
                {
                    throw new ApplicationException("تا ساعت خالی است");
                }
                Hepsa.Core.Validation.DateRule <string> FromDateValidator = new Hepsa.Core.Validation.DateRule <string>("FromDate", "از تاریخ", null, null);
                if (FromDateValidator.Validate(FromDatefaDatePicker.Text) == false)
                {
                    throw new ApplicationException(FromDateValidator.Description);
                }

                Hepsa.Core.Validation.DateRule <string> ToDateValidator = new Hepsa.Core.Validation.DateRule <string>("ToDate", "تا تاریخ", null, null);
                if (ToDateValidator.Validate(ToDatefaDatePicker.Text) == false)
                {
                    throw new ApplicationException(ToDateValidator.Description);
                }
                Hepsa.Core.Validation.TimeRule <string> FromTimeValidator = new Hepsa.Core.Validation.TimeRule <string>("FromTime", "از ساعت", null, null);
                if (FromTimeValidator.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(FromTimeTextBox)) == false)
                {
                    throw new ApplicationException(FromTimeValidator.Description);
                }

                Hepsa.Core.Validation.TimeRule <string> ToTimeValidator = new Hepsa.Core.Validation.TimeRule <string>("ToTime", "تا ساعت", null, null);
                if (ToTimeValidator.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(ToTimeTextBox)) == false)
                {
                    throw new ApplicationException(ToTimeValidator.Description);
                }


                string CompanyList_nvc = string.Empty;
                foreach (Janus.Windows.GridEX.GridEXRow itm in companyGrid.GetCheckedRows())
                {
                    CompanyList_nvc += itm.Cells["CompanyID_int"].Value.ToString() + ",";
                }
                if (CompanyList_nvc.EndsWith(","))
                {
                    CompanyList_nvc = CompanyList_nvc.Remove(CompanyList_nvc.Length - 1);
                }
                companyGrid.UnCheckAllRecords();

                string LaderTypeList_nvc = string.Empty;
                foreach (Janus.Windows.GridEX.GridEXRow itm in laderTypeGrid.GetCheckedRows())
                {
                    LaderTypeList_nvc += itm.Cells["LaderTypeID_int"].Value.ToString() + ",";
                }
                if (LaderTypeList_nvc.EndsWith(","))
                {
                    LaderTypeList_nvc = LaderTypeList_nvc.Remove(LaderTypeList_nvc.Length - 1);
                }
                laderTypeGrid.UnCheckAllRecords();

                //////create Order list
                string OrderColumns_nvc = string.Empty;

                OrderColumns_nvc = " T1.LadeDate_nvc ";
                bool justRemained = false;
                if (JustRemainedCheckBox.Checked)
                {
                    justRemained = true;
                }
                string GoodList_nvc = string.Empty;
                foreach (Janus.Windows.GridEX.GridEXRow itm in goodGrid.GetCheckedRows())
                {
                    GoodList_nvc += itm.Cells["GoodID_int"].Value.ToString() + ",";
                }
                if (GoodList_nvc.EndsWith(","))
                {
                    GoodList_nvc = GoodList_nvc.Remove(GoodList_nvc.Length - 1);
                }
                goodGrid.UnCheckAllRecords();

                string PortPlaceList_nvc = string.Empty;
                foreach (Janus.Windows.GridEX.GridEXRow itm in portPlaceGrid.GetCheckedRows())
                {
                    PortPlaceList_nvc += itm.Cells["PortPlacesID_int"].Value.ToString() + ",";
                }
                if (PortPlaceList_nvc.EndsWith(","))
                {
                    PortPlaceList_nvc = PortPlaceList_nvc.Remove(PortPlaceList_nvc.Length - 1);
                }
                portPlaceGrid.UnCheckAllRecords();

                string DestinationCityList_nvc = string.Empty;
                foreach (Janus.Windows.GridEX.GridEXRow itm in destinationCityGrid.GetCheckedRows())
                {
                    DestinationCityList_nvc += itm.Cells["CityID_int"].Value.ToString() + ",";
                }
                if (DestinationCityList_nvc.EndsWith(","))
                {
                    DestinationCityList_nvc = DestinationCityList_nvc.Remove(DestinationCityList_nvc.Length - 1);
                }
                destinationCityGrid.UnCheckAllRecords();
                ////////////////////////////////////////
                //HPS.Reports.ReportDoc.CompanyRemanedLadBillWithDateReport rpt = new HPS.Reports.ReportDoc.CompanyRemanedLadBillWithDateReport(FromDatefaDatePicker.Text, FromTimeTextBox.Text, ToDatefaDatePicker.Text, ToTimeTextBox.Text, LaderTypeList_nvc, CompanyList_nvc, OrderColumns_nvc, justRemained, GoodList_nvc, DestinationCityList_nvc, PortPlaceList_nvc);
                //viewer1.Document = rpt.Document;
                //rpt.Document.Printer.PrinterName = string.Empty;
                //rpt.Run();

                HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmenFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory();
                DataTable LaderTypeReportTable = new DataTable();
                DataSet   LaderTypeDataset     = new DataSet();
                LadeAssignmenFactory.SelectCompanyLadeAssignmentDetail(FromDatefaDatePicker.Text, FromTimeTextBox.Text, ToDatefaDatePicker.Text, ToTimeTextBox.Text, LaderTypeList_nvc, CompanyList_nvc, GoodList_nvc, DestinationCityList_nvc, PortPlaceList_nvc, OrderColumns_nvc, ref LaderTypeReportTable);
                DataTable dt = null;
                if (JustRemainedCheckBox.Checked)
                {
                    LaderTypeReportTable.DefaultView.RowFilter = "RemainderCount_int <>0";
                    dt = LaderTypeReportTable.DefaultView.ToTable();
                }
                else if (JustCanceledCheckBox.Checked)
                {
                    LaderTypeReportTable.DefaultView.RowFilter = "CanceledByCompany <>0 OR CanceledByLadBillCanceled<>0";
                    dt = LaderTypeReportTable.DefaultView.ToTable();
                }
                else
                {
                    dt = LaderTypeReportTable;
                }

                dt.Columns.Add("RemainedPercent");
                foreach (DataRow row in dt.Rows)
                {
                    double RemainedPercent = (Convert.ToDouble(row["RemainderCount_int"]) * 100) / (Convert.ToDouble(row["CarCount_int"]));
                    row["RemainedPercent"] = RemainedPercent.ToString("0.##");
                }
                LaderTypeDataset.Tables.Add(dt.Copy());
                CompanyRemanedLadBillStiReport.Dictionary.Synchronize();
                CompanyRemanedLadBillStiReport.Dictionary.Databases.Clear();
                CompanyRemanedLadBillStiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", Hepsa.Core.Common.ConnectionString.ConnectionString));
                CompanyRemanedLadBillStiReport.RegData(LaderTypeDataset);
                CompanyRemanedLadBillStiReport.Compile();
                CompanyRemanedLadBillStiReport["organ"] = new HPS.BLL.SettingsBLL.BLLSetting_TFactory().GetBy(new BLL.SettingsBLL.BLLSetting_TKeys()
                {
                    SettingID_int = 1029
                }).Value_nvc.ToString();
                HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaceFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory();
                CompanyRemanedLadBillStiReport["fromDate_nvc"] = FromDatefaDatePicker.Text;
                CompanyRemanedLadBillStiReport["fromTime_nvc"] = FromTimeTextBox.Text;
                CompanyRemanedLadBillStiReport["toTime_nvc"]   = ToTimeTextBox.Text;
                CompanyRemanedLadBillStiReport["toDate_nvc"]   = ToDatefaDatePicker.Text;
                CompanyRemanedLadBillStiReport["date_vc"]      = PortPlaceFactory.ServerJalaliDate + "   " + PortPlaceFactory.ServerTime;;
                CompanyRemanedLadBillStiReport["UserName_vc"]  = HPS.Common.CurrentUser.user.UserName_nvc;
                if (JustRemainedCheckBox.Checked)
                {
                    CompanyRemanedLadBillStiReport["title_nvc"] = "بارهای جامانده شرکت های حمل و نقل";
                }
                else if (JustCanceledCheckBox.Checked)
                {
                    CompanyRemanedLadBillStiReport["title_nvc"] = "بارهای ابطالی شرکت های حمل و نقل";
                }
                else
                {
                    CompanyRemanedLadBillStiReport["title_nvc"] = "بارهای درخواستی و جامانده شرکت های حمل و نقل";
                }
                //
                //CompanyRemanedLadBillStiReport["@fromdate_nvc"] = FromDatefaDatePicker.Text;
                //CompanyRemanedLadBillStiReport["@fromtime_nvc"] = FromTimeTextBox.Text;
                //CompanyRemanedLadBillStiReport["@totime_nvc"] = ToTimeTextBox.Text;
                //CompanyRemanedLadBillStiReport["@todate_nvc"] = ToDatefaDatePicker.Text;

                //if (string.IsNullOrEmpty(LaderTypeList_nvc))
                //    CompanyRemanedLadBillStiReport["@LaderTypeID_int"] = DBNull.Value;
                //else
                //    CompanyRemanedLadBillStiReport["@LaderTypeID_int"] = LaderTypeList_nvc;

                //if (string.IsNullOrEmpty(CompanyList_nvc))
                //    CompanyRemanedLadBillStiReport["@CompanyID_int"] = DBNull.Value;
                //else
                //    CompanyRemanedLadBillStiReport["@CompanyID_int"] = CompanyList_nvc;

                //if (string.IsNullOrEmpty(GoodList_nvc))
                //    CompanyRemanedLadBillStiReport["@GoodIDList_nvc"] = DBNull.Value;
                //else
                //    CompanyRemanedLadBillStiReport["@GoodIDList_nvc"] = GoodList_nvc;

                //if (string.IsNullOrEmpty(DestinationCityList_nvc))
                //    CompanyRemanedLadBillStiReport["@DestinationCityIDList_nvc"] = DBNull.Value;
                //else
                //    CompanyRemanedLadBillStiReport["@DestinationCityIDList_nvc"] = DestinationCityList_nvc;

                //if (string.IsNullOrEmpty(PortPlaceList_nvc))
                //    CompanyRemanedLadBillStiReport["@PortPlaceIDList_nvc"] = DBNull.Value;
                //else
                //    CompanyRemanedLadBillStiReport["@PortPlaceIDList_nvc"] = PortPlaceList_nvc;

                //if (string.IsNullOrEmpty(OrderColumns_nvc))
                //    CompanyRemanedLadBillStiReport["@OrderColumns_nvc"] = DBNull.Value;
                //else
                //    CompanyRemanedLadBillStiReport["@OrderColumns_nvc"] = OrderColumns_nvc;

                CompanyRemanedLadBillStiReport.Render();
                stiViewerControl1.Report = CompanyRemanedLadBillStiReport;
            }
            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }