Exemplo n.º 1
0
 private bool UpdateAdjustDetailedEntry(DataTable aTable, int GeneralNumber)
 {
     try
     {
         AdjustInventoryDetailed aAdjustDetailed = new AdjustInventoryDetailed();
         foreach (DataRow aRow in aItemsTable.Rows)
         {
             aAdjustDetailed.Number = GeneralNumber;
             aAdjustDetailed.ItemID = int.Parse(aRow["ItemID"].ToString());
             aAdjustDetailed.OldQty = double.Parse(aRow["NewQty"].ToString());/* bug it should be updated to the next one*/
             aAdjustDetailed.NewQty = double.Parse(aRow["PhysicalCountColumn"].ToString());
             aAdjustDetailed.DifferenceQty = double.Parse(aRow["DifferencesColumn"].ToString());
             aAdjustDetailed.DifferenceValue = double.Parse(aRow["DiffValueColumn"].ToString());
             double CurrentQty = double.Parse(ReportsHelper.FindData(AllItemsTable,"ID","Qty",aRow["ItemID"].ToString()));
             if (AdjustInventoryDetailedMgmt.UpdateDetailedSingleEntry(aAdjustDetailed))
             {
                 if (!ItemsMgmt.UpdateItemQtyByID(aAdjustDetailed.ItemID, (CurrentQty - (aAdjustDetailed.OldQty - aAdjustDetailed.NewQty))))
                 {
                     return false;
                 }
                 continue;
             }
             else
             {
                 return false;
             }
         }
         return true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception in UpdateAdjustDetailedEntry {EXCEPTION}" + ex.ToString(), "PLEASE CONTACT CALCIUM", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return false;
     }
 }
Exemplo n.º 2
0
        public ActionResult ContactUsExportToCsv()
        {
            try
            {
                ConvertToCSV objCSV = new ConvertToCSV();

                string FilePath = "~/Content/Resources/Reports/csvData.csv";
                objCSV.fncDeleteFile(FilePath);

                ReportsHelper        objLedgerHelper = new ReportsHelper();
                ContactUsReportModel objLedgerModel  = new ContactUsReportModel
                {
                    PageNumber = 1,
                    PageSize   = 100000000
                };

                List <ContactUsReportModel> listLedgerModel = objLedgerHelper.GetContactUsReport(objLedgerModel);

                DataTable dt = new DataTable();
                dt.Columns.Add("Name");
                dt.Columns.Add("Email Address");
                dt.Columns.Add("Message");
                dt.Columns.Add("Created On");


                if (listLedgerModel.Count() != 0)
                {
                    foreach (var item in listLedgerModel)
                    {
                        DataRow row = dt.NewRow();
                        row["Name"]          = item.FirstName;
                        row["Email Address"] = item.EmailAddress;
                        row["Message"]       = item.Message;
                        row["Created On"]    = StratasFair.Business.CommonHelper.AppLogic.GetDateFromatForCsv(item.CreatedOn);
                        dt.Rows.Add(row);
                    }
                }



                if (dt.Rows.Count > 0)
                {
                    objCSV.CreateCSVFile(dt, Server.MapPath("~/Content/Resources/Reports/") + "csvData.csv");

                    objCSV.FncDownLoadFiles("ContactUs_" + DateTime.Now.ToShortDateString() + ".csv", FilePath);
                }
            }
            catch (Exception Ex)
            {
                string Err = Ex.Message.ToString();
            }
            return(Redirect(Url.Content("~/securehost/rootlogin/report/contactus")));
        }
Exemplo n.º 3
0
        public ActionResult UpcomingRenewalExportToCsv()
        {
            try
            {
                ConvertToCSV objCSV = new ConvertToCSV();

                string FilePath = "~/Content/Resources/Reports/csvData.csv";
                objCSV.fncDeleteFile(FilePath);

                ReportsHelper objLedgerHelper             = new ReportsHelper();
                UpcomingRenewalReportModel objLedgerModel = new UpcomingRenewalReportModel
                {
                    PageNumber = 1,
                    PageSize   = 100000000
                };

                List <UpcomingRenewalReportModel> listLedgerModel = objLedgerHelper.GetUpcomingRenewalReport(objLedgerModel);
                DataTable dt = new DataTable();
                dt.Columns.Add("Name");
                dt.Columns.Add("Email address");
                dt.Columns.Add("Strata name");
                dt.Columns.Add("Contact number");
                dt.Columns.Add("Register on");
                dt.Columns.Add("Unique name");
                dt.Columns.Add("Subscription expiring on");
                if (listLedgerModel.Count() != 0)
                {
                    foreach (var item in listLedgerModel)
                    {
                        DataRow row = dt.NewRow();
                        row["Name"]                     = item.FirstName + " " + item.LastName;
                        row["Email address"]            = item.EmailId;
                        row["Strata name"]              = item.StratasBoardName;
                        row["Contact number"]           = item.ContactNumber;
                        row["Register on"]              = AppLogic.GetDateFromatForCsv(item.CreatedOn);
                        row["Unique name"]              = item.PortalLink;
                        row["Subscription expiring on"] = AppLogic.GetDateFromatForCsv(item.ExpiryDate);
                        dt.Rows.Add(row);
                    }
                }

                if (dt.Rows.Count > 0)
                {
                    objCSV.CreateCSVFile(dt, Server.MapPath("~/Content/Resources/Reports/") + "csvData.csv");
                    objCSV.FncDownLoadFiles("UpcomingRenewal_" + DateTime.Now.ToShortDateString() + ".csv", FilePath);
                }
            }
            catch (Exception Ex)
            {
                string Err = Ex.Message.ToString();
            }
            return(Redirect(Url.Content("~/securehost/rootlogin/report/upcomingrenewal")));
        }
Exemplo n.º 4
0
        private bool print_receipt()
        {
            try
            {
                List <DataTable> aDataTableList = new List <DataTable>();
                DataTable        aDataTable1    = new DataTable();
                aDataTable1.Columns.Add("[border=true1]" + ReceiptText.RctTxtToPayAmount);
                aDataTable1.Columns.Add(PaymentAmountTxtBox.Text);

                aDataTable1.Rows.Add();
                aDataTable1.Rows[0][0] = ReceiptText.RctTxtPayMethod;
                aDataTable1.Rows[0][1] = PaymentMethodCheckBox.Text;
                aDataTable1.Rows.Add();
                double OldCustomerAccountAmountParser = 0;
                if (double.TryParse(CustomerBalanceTxtBox.Text, out OldCustomerAccountAmountParser))
                {
                    aDataTable1.Rows[1][0] = ReceiptText.RctTxtOldBalance;
                    aDataTable1.Rows[1][1] = OldCustomerAccountAmountParser;
                    aDataTable1.Rows.Add();
                    aDataTable1.Rows[2][0] = ReceiptText.RctTxtNewBalance;
                    aDataTable1.Rows[2][1] = OldCustomerAccountAmountParser - double.Parse(PaymentAmountTxtBox.Text);
                }

                aDataTableList.Add(aDataTable1);
                List <string> aStringList = ReportsHelper.ImportReportHeader(0, 0);
                List <string> aFooterList = ReportsHelper.ImportReportHeader(1, 0);
                aStringList.Add(SharedVariables.Line_Solid_10px_Black);
                aStringList.Add(ReceiptName.RctNmsCustomerPay);
                aStringList.Add("<h2>" + ReceiptText.RctTxtDate + "/" + ReceiptText.RctTxtTime + " " + DateTime.Now.ToShortDateString() + "&nbsp;&nbsp;" + DateTime.Now.ToShortTimeString() + "</h2>");
                aStringList.Add("<h2> " + ReceiptText.RctTxtTeller + ":&nbsp;&nbsp;" + SharedFunctions.ReturnLoggedUserName() + "</h2>");
                aStringList.Add(ReceiptText.RctTxtCustomer + ":&nbsp;&nbsp;" + CustomerNameComboBox.Text);
                aStringList.Add(ReceiptText.RctTxtPaymentNum + ":&nbsp; " + PaymentNumberTxtBox.Text);
                aStringList.Add(SharedVariables.Line_Solid_10px_Black);
                // PrintingManager.Instance.PrintTables(aDataTableList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, true, true);
                PrintingManager.Instance.PrintTables(aDataTableList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, !PrintingThermalA4ChkBox.Checked, !PrintingThermalA4ChkBox.Checked, PrintingThermalA4ChkBox.Checked, ReportsHelper.TempOutputPath + ".pdf", false, "", false, PrintingThermalA4ChkBox.Checked);
                if (PrintingThermalA4ChkBox.Checked)
                {
                    Process.Start(ReportsHelper.TempPDFOutputPath);
                }
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(MsgTxt.UnexpectedError + "\n Exception: IN[AddCustomerPayment:Print Receipt [EXCEPTION IS]] \n" + ex.Message, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
Exemplo n.º 5
0
        public static void btnPrint_OnClickStep(IRNReportDetails form, EventArgs args)
        {
            // TODO: Complete business rule implementation
            IAttachment attachment = null;
            string      pluginid   = string.Empty;


            Sage.Entity.Interfaces.IRNReport parentEntity = form.CurrentEntity as Sage.Entity.Interfaces.IRNReport;


            if (ReportsHelper.GetPluginId("RNReport:Irnreport", out pluginid))
            {
                WebReportingClass reporting = new WebReportingClass();

                Sage.Platform.Data.IDataService datasvc = MySlx.Data.CurrentConnection;
                Sage.Entity.Interfaces.IUser    user    = MySlx.Security.CurrentSalesLogixUser;

                string tempPath         = Rules.GetTempAttachmentPath();
                string ConnectionString = datasvc.GetConnectionString();


                string report = reporting.GenerateReport(ConnectionString, datasvc.Server, DatabaseServer.dsMSSQL, tempPath, false, false, "RNREPORT.RNREPORTID", "", pluginid, "", "", "", "SELECT RNREPORT.RNREPORTID FROM RNREPORT", string.Format("(RNREPORT.RNREPORTID = '{0}')", parentEntity.Id), user.Id.ToString(), user.UserName.ToString());

                ReportDocument doc = new ReportDocument();

                report = string.Format("{0}run\\{1}", tempPath, report);

                doc.Load(report);

                string filename = string.Format("{0}\\{1}_v{2}.pdf", Rules.GetAttachmentPath(), parentEntity.ReferenceNumber.Replace(" ", "_"), 1);

                doc.ExportToDisk(ExportFormatType.PortableDocFormat, filename);

                doc.Close();

                attachment             = Sage.Platform.EntityFactory.Create <IAttachment>();
                attachment.Description = string.Format("{0} v{1}", parentEntity.ReferenceNumber, 1);
                attachment.InsertFileAttachment(filename);
                attachment.RNREPORTID = Convert.ToString(parentEntity.Id);

                attachment.Save();

                System.IO.File.Delete(report);
            }
        }
        public async Task EmployeesReportByMonth_Generate_DoesGenerate()
        {
            OuterResource newArea = new OuterResource()
            {
                Name = "My OuterResource 1", Version = 1
            };
            OuterResource newArea1 = new OuterResource()
            {
                Name = "My OuterResource 2", Version = 1
            };
            OuterResource newArea2 = new OuterResource()
            {
                Name = "My OuterResource 3", Version = 1
            };
            InnerResource newMachine = new InnerResource()
            {
                Name = "My InnerResource 1", Version = 1
            };
            InnerResource newMachine1 = new InnerResource()
            {
                Name = "My InnerResource 2", Version = 1
            };
            InnerResource newMachine2 = new InnerResource()
            {
                Name = "My InnerResource 3", Version = 1
            };

            await newArea.Create(DbContext);

            await newArea1.Create(DbContext);

            await newArea2.Create(DbContext);

            await newMachine.Create(DbContext);

            await newMachine1.Create(DbContext);

            await newMachine2.Create(DbContext);

            // Different Month
            ResourceTimeRegistration newTimeRegistrationMonth = new ResourceTimeRegistration()
            {
                OuterResourceId = newArea.Id, Version = 1, SDKSiteId = 1, InnerResourceId = newMachine.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 06, 13)
            };
            ResourceTimeRegistration newTimeRegistrationMonth1 = new ResourceTimeRegistration()
            {
                OuterResourceId = newArea1.Id, Version = 1, SDKSiteId = 1, InnerResourceId = newMachine1.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 07, 14)
            };
            ResourceTimeRegistration newTimeRegistrationMonth2 = new ResourceTimeRegistration()
            {
                OuterResourceId = newArea2.Id, Version = 1, SDKSiteId = 1, InnerResourceId = newMachine2.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 07, 15)
            };
            ResourceTimeRegistration newTimeRegistrationMonth3 = new ResourceTimeRegistration()
            {
                OuterResourceId = newArea.Id, Version = 1, SDKSiteId = 2, InnerResourceId = newMachine.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 08, 13)
            };
            ResourceTimeRegistration newTimeRegistrationMonth4 = new ResourceTimeRegistration()
            {
                OuterResourceId = newArea1.Id, Version = 1, SDKSiteId = 2, InnerResourceId = newMachine1.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 08, 14)
            };
            ResourceTimeRegistration newTimeRegistrationMonth5 = new ResourceTimeRegistration()
            {
                OuterResourceId = newArea1.Id, Version = 1, SDKSiteId = 2, InnerResourceId = newMachine2.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 09, 15)
            };
            ResourceTimeRegistration newTimeRegistrationMonth6 = new ResourceTimeRegistration()
            {
                OuterResourceId = newArea1.Id, Version = 1, SDKSiteId = 2, InnerResourceId = newMachine1.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 09, 15)
            };

            await DbContext.ResourceTimeRegistrations.AddRangeAsync(newTimeRegistrationMonth, newTimeRegistrationMonth1,
                                                                    newTimeRegistrationMonth2, newTimeRegistrationMonth3, newTimeRegistrationMonth4, newTimeRegistrationMonth5,
                                                                    newTimeRegistrationMonth6);

            await DbContext.SaveChangesAsync();

            GenerateReportModel model = new GenerateReportModel()
            {
                DateFrom     = new DateTime(2019, 5, 13),
                DateTo       = new DateTime(2019, 9, 13),
                Relationship = ReportRelationshipType.Employee,
                Type         = ReportType.Month
            };

            List <SiteDto> sitesList = new List <SiteDto>()
            {
                // new SiteDto(1, "Test Site 1", "", "", 1, 1, 1, 1),
                new SiteDto()
                {
                    CustomerNo = 1,
                    Email      = "bla",
                    FirstName  = "Test",
                    LastName   = "Site 1",
                    OtpCode    = 1,
                    SiteId     = 1,
                    SiteName   = "Test Site 1",
                    UnitId     = 1,
                    WorkerUid  = 1
                },
                // new SiteDto(2, "Test Site 2", "", "", 1, 1, 1, 1)
                new SiteDto()
                {
                    CustomerNo = 1,
                    Email      = "bla",
                    FirstName  = "Test",
                    LastName   = "Site 2",
                    OtpCode    = 1,
                    SiteId     = 2,
                    SiteName   = "Test Site 2",
                    UnitId     = 1,
                    WorkerUid  = 1
                }
            };

            DateTime modelDateFrom = new DateTime(
                model.DateFrom.Year,
                model.DateFrom.Month,
                model.DateFrom.Day,
                0, 0, 0);
            DateTime modelDateTo = new DateTime(
                model.DateTo.Year,
                model.DateTo.Month,
                model.DateTo.Day,
                23, 59, 59);

            List <ResourceTimeRegistration> jobsList = await DbContext.ResourceTimeRegistrations
                                                       .Include(x => x.InnerResource)
                                                       .Include(x => x.OuterResource)
                                                       .Where(x => x.DoneAt >= modelDateFrom && x.DoneAt <= modelDateTo)
                                                       .ToListAsync();

            ReportModel reportModel = ReportsHelper.GetReportData(model, jobsList, sitesList, (int)ReportTimeType.Minutes);

            Assert.AreEqual(reportModel.SubReports.Count, 1);
            Assert.AreEqual(reportModel.SubReports[0].TotalTime, 3000);
            Assert.AreEqual(reportModel.SubReports[0].Entities.Count, sitesList.Count);
            Assert.AreEqual(reportModel.SubReports[0].Entities[0].EntityName, sitesList[0].SiteName);
            Assert.AreEqual(reportModel.SubReports[0].Entities[1].EntityName, sitesList[1].SiteName);
            Assert.AreEqual(reportModel.SubReports[0].Entities[0].TotalTime, 1800);
            Assert.AreEqual(reportModel.SubReports[0].Entities[1].TotalTime, 1200);
            Assert.AreEqual(reportModel.SubReports[0].Entities[0].TimePerTimeUnit[0], 0);
            Assert.AreEqual(reportModel.SubReports[0].Entities[0].TimePerTimeUnit[1], 600);
            Assert.AreEqual(reportModel.SubReports[0].Entities[0].TimePerTimeUnit[2], 1200);
            Assert.AreEqual(reportModel.SubReports[0].Entities[0].TimePerTimeUnit[3], 0);
            Assert.AreEqual(reportModel.SubReports[0].Entities[0].TimePerTimeUnit[4], 0);
        }
Exemplo n.º 7
0
 public TestsFixture()
 {
     reportsHelper = new ReportsHelper("Workflow");
 }
Exemplo n.º 8
0
        /// <summary>
        /// Get Filters for reports page
        /// </summary>
        /// <param name="filters"></param>
        /// <param name="userName"></param>
        /// <returns></returns>
        public dynamic GetAllReportsFilters(FilterReports filters, string userName)
        {
            using (SqlConnection sqlCon = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CC_ProdConn"].ConnectionString))
            {
                FilterReports f = new FilterReports()
                {
                    filters = filters.filters, range = filters.range
                };
#pragma warning disable CS0436 // Type conflicts with imported type
                SqlCommand sqlComm = ReportsHelper.GetFiltersParameters(f, "[GetAllReportsFilters]", userName);
#pragma warning restore CS0436 // Type conflicts with imported type

                sqlComm.Connection = sqlCon;

                FiltersFormDataReports pageFiltersData = new FiltersFormDataReports();
                sqlCon.Open();
                try
                {
                    SqlDataAdapter adapter = new System.Data.SqlClient.SqlDataAdapter(sqlComm);
                    DataSet        ds      = new DataSet();
                    adapter.Fill(ds);

                    DataTable tblAgentgroup     = ds.Tables[0];
                    DataTable tblAgentCampain   = ds.Tables[1];
                    DataTable tblAgentAPP       = ds.Tables[2];
                    DataTable tblAgentScorecard = ds.Tables[3];


                    DataTable tblRangeCount = ds.Tables[4];
                    List <FilterGroupValue>   AgentGrouplLst  = new List <FilterGroupValue>();
                    List <FilterCampainValue> AgentCampainLst = new List <FilterCampainValue>();
                    List <FilterAppValue>     AgentAppLst     = new List <FilterAppValue>();
                    //List<FilterAgentValue> AgentAgentsLst = new List<FilterAgentValue>();
                    List <FilterScorecardValue> AgentScorecardLst = new List <FilterScorecardValue>();
                    //List<FilterQAValue> AgentQALst = new List<FilterQAValue>();
                    //List<FilterTeamLeadValue> teamLeads = new List<FilterTeamLeadValue>();
                    RangeCalls rangeCalls = new RangeCalls();
                    //Dim AgentMissedItemsLst As List(Of PageFiltersData.FilterValue) = New List(Of PageFiltersData.FilterValue)

                    foreach (DataRow row in tblAgentgroup.Rows)
                    {
                        AgentGrouplLst.Add(new FilterGroupValue()
                        {
                            name       = row[0].ToString(),
                            id         = row[0].ToString(),
                            count      = int.Parse(row[1].ToString()),
                            top3Agents = null
                        });
                    }
                    pageFiltersData.groups = AgentGrouplLst;

                    foreach (DataRow row in tblAgentCampain.Rows)
                    {
                        AgentCampainLst.Add(new FilterCampainValue()
                        {
                            name  = row[0].ToString(),
                            id    = row[0].ToString(),
                            count = int.Parse(row[1].ToString())
                        });
                    }
                    pageFiltersData.campaigns = AgentCampainLst;


                    foreach (DataRow row in tblAgentAPP.Rows)
                    {
                        AgentAppLst.Add(new FilterAppValue()
                        {
                            name  = row[0].ToString(),
                            id    = row[0].ToString(),
                            count = int.Parse(row[1].ToString())
                        });
                    }
                    pageFiltersData.apps = AgentAppLst;

                    foreach (DataRow row in tblAgentScorecard.Rows)
                    {
                        try
                        {
                            int _failScore = 0;
                            int.TryParse(row[3].ToString(), out _failScore);
                            AgentScorecardLst.Add(new FilterScorecardValue()
                            {
                                id        = int.Parse(row[0].ToString()),
                                name      = row[2].ToString(),
                                count     = int.Parse(row[1].ToString()),
                                failScore = _failScore,
                            });
                        }
                        catch (Exception ex1)
                        {
                            throw ex1;
                        }
                    }
                    pageFiltersData.scorecards = AgentScorecardLst;



                    if (tblRangeCount.Rows.Count > 0)
                    {
                        rangeCalls.total    = int.Parse(tblRangeCount.Rows[0][0].ToString());
                        rangeCalls.filtered = int.Parse(tblRangeCount.Rows[0][1].ToString());
                    }
                    pageFiltersData.rangeCalls = rangeCalls;


                    return(pageFiltersData);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Exemplo n.º 9
0
        private bool print_receipt()
        {
            try
            {
                List <DataTable> aDataTableList = new List <DataTable>();
                DataTable        aDataTable1    = new DataTable();
                aDataTable1.Columns.Add("[border=true1]<th width=45%>" + ReceiptText.RctTxtItemName);
                aDataTable1.Columns.Add(ReceiptText.RctTxtUnitPrice);
                aDataTable1.Columns.Add(ReceiptText.RctTxtQty);
                aDataTable1.Columns.Add(ReceiptText.RctTxtTotal);
                aDataTable1.Columns.Add(ReceiptText.RctTxtDiscount + " %");

                bool NoDiscount = true;
                foreach (DataGridViewRow aRow in TeldgView.Rows)
                {
                    aDataTable1.Rows.Add();
                    aDataTable1.Rows[aRow.Index][0] = aRow.Cells["Description"].Value.ToString();
                    aDataTable1.Rows[aRow.Index][1] = aRow.Cells["PricePerUnit"].Value.ToString();
                    aDataTable1.Rows[aRow.Index][2] = aRow.Cells["Qty"].Value.ToString();
                    aDataTable1.Rows[aRow.Index][3] = aRow.Cells["PriceTotal"].Value.ToString();

                    aDataTable1.Rows[aRow.Index][4] = aRow.Cells["DiscountPerc"].Value.ToString();
                    if (double.Parse(aRow.Cells["DiscountPerc"].Value.ToString()) > 0)
                    {
                        NoDiscount = false;
                    }
                }

                if (NoDiscount)
                {
                    aDataTable1.Columns.Remove(aDataTable1.Columns[4]);
                }
                int       RowCnt      = 0;
                DataTable aDataTable3 = new DataTable();
                aDataTable3.Columns.Add("[border=true1]<th>" + ReceiptText.RctTxtSubTotal);
                aDataTable3.Columns.Add(SubtotalTxtBox.Text + "JOD");
                RowCnt = 0;

                aDataTable3.Rows.Add();
                aDataTable3.Rows[RowCnt][0]   = ReceiptText.RctTxtTax;
                aDataTable3.Rows[RowCnt++][1] = TotalTaxTxtBox.Text + "<b> JOD";

                if (double.Parse(DiscountTxtBox.Text) != 0)
                {
                    aDataTable3.Rows.Add();
                    aDataTable3.Rows[RowCnt][0]   = ReceiptText.RctTxtVoucherDiscount;
                    aDataTable3.Rows[RowCnt++][1] = "@" + DiscountPercTxtBox.Text + "% =" + DiscountTxtBox.Text + "<b> JOD";
                }
                if (double.Parse(ItemsDiscountTxtBox.Text) != 0)
                {
                    aDataTable3.Rows.Add();
                    aDataTable3.Rows[RowCnt][0]   = ReceiptText.RctTxtItemsDiscount;
                    aDataTable3.Rows[RowCnt++][1] = ItemsDiscountTxtBox.Text + "<b> JOD";
                }
                if (double.Parse(TotalDiscountTxtBox.Text) != 0)
                {
                    aDataTable3.Rows.Add();
                    aDataTable3.Rows[RowCnt][0]   = ReceiptText.RctTxtTotalDiscount;
                    aDataTable3.Rows[RowCnt++][1] = TotalDiscountTxtBox.Text + "<b> JOD";
                }
                if (double.Parse(FeesTxtBox.Text) != 0)
                {
                    aDataTable3.Rows.Add();
                    aDataTable3.Rows[RowCnt][0]   = ReceiptText.RctTxtFees;
                    aDataTable3.Rows[RowCnt++][1] = FeesTxtBox.Text + "<b> JOD";
                }


                aDataTable3.Rows.Add();
                aDataTable3.Rows[RowCnt][0]   = "<td style=\"background-color:#000;color:#fff;border-right-color:#fff;\"><b><font size=4>" + ReceiptText.RctTxtToPayAmount + "</font>";
                aDataTable3.Rows[RowCnt++][1] = "<td style=\"background-color:#000;color:#fff;border-left-color:#fff\"><b><font size=5>" + TotalTxtBox.Text + " JOD </font>";

                aDataTable3.Rows.Add();
                aDataTable3.Rows[RowCnt][0]   = ReceiptText.RctTxtPayMethod;
                aDataTable3.Rows[RowCnt++][1] = PaymentMethodCheckBox.Text;
                if (PaymentMethodCheckBox.Text.ToUpper() == "CASH")
                {
                    if (CashMethodComboBox.Text == "Cash")
                    {
                        aDataTable3.Rows.Add();
                        aDataTable3.Rows[RowCnt][0]   = ReceiptText.RctTxtCashIn;
                        aDataTable3.Rows[RowCnt++][1] = CashInTxtBox.Text + "<b> " + " JOD";
                        double tempamt = 0;
                        if (double.TryParse(ExchangeTxtBox.Text, out tempamt))
                        {
                            if (tempamt != 0)
                            {
                                aDataTable3.Rows.Add();
                                aDataTable3.Rows[RowCnt][0]   = ReceiptText.RctTxtExchange;
                                aDataTable3.Rows[RowCnt++][1] = ExchangeTxtBox.Text + "<b> JOD";
                            }
                        }
                    }
                    else if (CashMethodComboBox.Text == "Invoice")
                    {
                        aDataTable3.Rows.Add();
                        aDataTable3.Rows[RowCnt][0] = ReceiptText.RctTxtPayable;
                        double VendorAccountAmountParserChk = 0;
                        if (double.TryParse(VendorAccountAmountTxtBox.Text, out VendorAccountAmountParserChk))
                        {
                            aDataTable3.Rows[RowCnt++][1] = ReceiptText.RctTxtOldBalance + " = " + VendorAccountAmountParserChk + "&nbsp;&nbsp;" + SharedVariables.Line_Solid_10px_Black +
                                                            ReceiptText.RctTxtNewBalance + " = " + Math.Round((VendorAccountAmountParserChk + double.Parse(TotalTxtBox.Text)), 3);
                        }
                    }
                }

                aDataTableList.Add(aDataTable1);
                // aDataTableList.Add(aDataTable2);
                aDataTableList.Add(aDataTable3);

                List <string> aStringList = ReportsHelper.ImportReportHeader(0, 0);
                List <string> aFooterList = ReportsHelper.ImportReportHeader(1, 0);

                aStringList.Add(SharedVariables.Line_Solid_10px_Black);
                aStringList.Add(ReceiptName.RctNmsPurchase);


                aStringList.Add("*** " + ReceiptText.RctTxtDuplicate + " ***");
                if (aPurchaseDataRow["IsRevised"].ToString() == "1")
                {
                    aStringList.Add("*** " + ReceiptText.RctTxtReversed + " ***");
                    aStringList.Add("<h2> " + ReceiptText.RctTxtReversedBy + ":&nbsp;&nbsp;" + RevisedBylbl.Text + "</h2>");
                    aStringList.Add("<h2> " + ReceiptText.RctTxtReversedOn + ":&nbsp;&nbsp;" + ReviseDatelbl.Text + "</h2>");
                }

                aStringList.Add("<h2>" + ReceiptText.RctTxtOrgDate + "/" + ReceiptText.RctTxtOrgTime + " " + DateLbl.Text + "&nbsp;&nbsp;" + TimeLbl.Text + "</h2>");
                aStringList.Add("<h2> " + ReceiptText.RctTxtOrgTeller + ":&nbsp;&nbsp;" + TellerLbl.Text + "</h2>");
                aStringList.Add("<h2>" + ReceiptText.RctTxtReprintedOn + " " + DateTime.Now.ToShortDateString() + "&nbsp;&nbsp;" + DateTime.Now.ToShortTimeString() + "</h2>");
                aStringList.Add("<h2> " + ReceiptText.RctTxtReprintedBy + ":&nbsp;&nbsp;" + SharedFunctions.ReturnLoggedUserName() + "</h2>");

                aStringList.Add("<h2> " + ReceiptText.RctTxtVendor + ":&nbsp;&nbsp;" + VendorsComboBox.Text + "</h2>");


                aStringList.Add(ReceiptText.RctTxtPurchaseNumber + ":&nbsp; " + PurchaseVoucherNumTxtBox.Text);
                aStringList.Add(SharedVariables.Line_Solid_10px_Black);

                PrintingManager.Instance.PrintTables(aDataTableList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, true, true);
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(MsgTxt.UnexpectedError + "\n Exception: IN[Edit PurchaseVoucher:Print Receipt [EXCEPTION IS]] \n" + ex.Message, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
Exemplo n.º 10
0
 private void BTDT_FormClosed(object sender, FormClosedEventArgs e)
 {
     ReportsHelper.CleanReport();
 }
Exemplo n.º 11
0
        public async Task <OperationDataResult <ReportModel> > GenerateReport(GenerateReportModel model)
        {
            try
            {
                var  reportTimeType = _options.Value.ReportTimeType;
                Core core           = await _coreHelper.GetCore();

                List <SiteDto> sitesList = await core.SiteReadAll(false);

                DateTime modelDateFrom = new DateTime(
                    model.DateFrom.Year,
                    model.DateFrom.Month,
                    model.DateFrom.Day,
                    0, 0, 0);
                DateTime modelDateTo = new DateTime(
                    model.DateTo.Year,
                    model.DateTo.Month,
                    model.DateTo.Day,
                    23, 59, 59);

                // results to exclude

                string        outerResourceName = "";
                OuterResource areaToExclude;
                InnerResource machineToExclude;
                string        innerResourceName = "";
                List <ResourceTimeRegistration> jobsList;

                outerResourceName = _dbContext.PluginConfigurationValues.SingleOrDefault(x => x.Name == "OuterInnerResourceSettings:OuterTotalTimeName")?.Value;
                areaToExclude     = _dbContext.OuterResources.SingleOrDefaultAsync(x => x.Name == outerResourceName).Result;
                innerResourceName = _dbContext.PluginConfigurationValues.SingleOrDefault(x => x.Name == "OuterInnerResourceSettings:InnerTotalTimeName")?.Value;
                machineToExclude  = await _dbContext.InnerResources.SingleOrDefaultAsync(x => x.Name == innerResourceName);

                IQueryable <ResourceTimeRegistration> query = _dbContext.ResourceTimeRegistrations
                                                              .Include(x => x.InnerResource)
                                                              .Include(x => x.OuterResource);

                if (areaToExclude != null && machineToExclude != null)
                {
                    if (model.Relationship == ReportRelationshipType.EmployeeTotal)
                    {
                        query = query.Where(x =>
                                            x.OuterResourceId == areaToExclude.Id && x.InnerResourceId == machineToExclude.Id);
                    }
                    else
                    {
                        query = query.Where(x =>
                                            x.OuterResourceId != areaToExclude.Id && x.InnerResourceId != machineToExclude.Id);
                    }
                }
                else
                {
                    query = query
                            .Where(x => x.DoneAt >= modelDateFrom && x.DoneAt <= modelDateTo);
                }

                jobsList = await query.ToListAsync();

                ReportModel reportModel = ReportsHelper.GetReportData(model, jobsList, sitesList, reportTimeType);

                return(new OperationDataResult <ReportModel>(true, reportModel));
            }
            catch (Exception e)
            {
                Trace.TraceError(e.Message);
                _logger.LogError(e.Message);
                return(new OperationDataResult <ReportModel>(false,
                                                             _outerInnerResourceLocalizationService.GetString("ErrorWhileGeneratingReport")));
            }
        }
Exemplo n.º 12
0
        private bool ExportToPDF(int GeneralNumber)
        {
            try
            {
                List<DataTable> aDataTableList = new List<DataTable>();
                DataTable aDataTable1 = new DataTable();
                aDataTable1.Columns.Add("[border=true1]" + "<th width=15%>" + ReportsText.BarcodeRepTxt);
                aDataTable1.Columns.Add("<th width=20%>" + ReportsText.DescriptionRepTxt);
                aDataTable1.Columns.Add("<th width=9%>" + ReportsText.AvgCostRepTxt);
                aDataTable1.Columns.Add("<th width=9%>" + ReportsText.AvaQtyRepTxt);
                aDataTable1.Columns.Add(ReportsText.PhysicalCountRepTxt);
                aDataTable1.Columns.Add(ReportsText.DifferencesRepTxt);
                aDataTable1.Columns.Add(ReportsText.DifferenceValueRepTxt);

                double TotalPositive = 0.00, TotalNegative = 0.00, ParsingTester = 0.00; ;
                foreach (DataRow aRow in aItemsTable.Rows)
                {
                    if (double.Parse(aRow["DifferencesColumn"].ToString()) == 0)
                    {
                        if (ACTIVE_MODE == AdjustItemsFrmModes.EDIT_MODE)
                        {
                            AdjustInventoryDetailedMgmt.DeleteDetailedEntries(GeneralNumber,int.Parse(aRow["ID"].ToString()));
                        }

                        continue;
                    }
                    DataRow aToAddRow = aDataTable1.Rows.Add();
                    if (ACTIVE_MODE==AdjustItemsFrmModes.ADDING_MODE)
                    {
                        aToAddRow[0] = aRow["Barcode"];
                        aToAddRow[1] = aRow["Description"];
                        aToAddRow[2] = Math.Round(double.Parse(aRow["AvgUnitCost"].ToString()), 3);
                        aToAddRow[3] = Math.Round(double.Parse(aRow["Qty"].ToString()), 3);
                        aToAddRow[4] = aRow["PhysicalCountColumn"];
                        aToAddRow[5] = aRow["DifferencesColumn"];
                        ParsingTester = double.Parse(aRow["DiffValueColumn"].ToString());
                        aToAddRow[6] = ParsingTester;  
                    }
                    else if (ACTIVE_MODE == AdjustItemsFrmModes.EDIT_MODE)
                    {
                        aToAddRow[0] = ReportsHelper.FindData(AllItemsTable, "ID", "Barcode", aRow["ItemID"].ToString());
                        aToAddRow[1] = ReportsHelper.FindData(AllItemsTable, "ID", "Description", aRow["ItemID"].ToString());
                        aToAddRow[2] = Math.Round(double.Parse(ReportsHelper.FindData(AllItemsTable, "ID", "AvgUnitCost", aRow["ItemID"].ToString())), 3);
                        aToAddRow[3] = Math.Round(double.Parse(ReportsHelper.FindData(AllItemsTable, "ID", "Qty", aRow["ItemID"].ToString())), 3);
                        aToAddRow[4] = aRow["PhysicalCountColumn"];
                        aToAddRow[5] = aRow["DifferencesColumn"];
                        ParsingTester = double.Parse(aRow["DiffValueColumn"].ToString());
                        aToAddRow[6] = ParsingTester; 
                    }
                    
                    if (ParsingTester > 0)
                    {
                        TotalPositive += ParsingTester;
                    }
                    else
                    {
                        TotalNegative += ParsingTester;
                    }
                }

                if (aDataTable1.Rows.Count == 0)
                {
                    DataTable aEmptyTable = new DataTable();
                    aEmptyTable.Columns.Add("INVENTORY STOCK AVAILABLE QTY MATCHES 100% THE PHYSICAL COUNT");
                    aDataTableList.Add(aEmptyTable);
                }
                else
                {

                    aDataTableList.Add(aDataTable1);
                    DataRow NetRow = aDataTable1.Rows.Add();
                    string EmptyNoborderRow = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + ReportsHelper.MANUAL_TD_END;
                    NetRow[0] = EmptyNoborderRow;
                    NetRow[1] = EmptyNoborderRow;
                    NetRow[2] = EmptyNoborderRow;
                    NetRow[3] = EmptyNoborderRow;
                    NetRow[4] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + ReportsText.TotalRepTxt + ReportsHelper.MANUAL_TD_END;
                    NetRow[5] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + ReportsText.PosAdjValueRepTxt + ReportsHelper.MANUAL_TD_END;
                    NetRow[6] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + TotalPositive + ReportsHelper.MANUAL_TD_END;
                    NetRow = aDataTable1.Rows.Add();
                    NetRow[0] = EmptyNoborderRow;
                    NetRow[1] = EmptyNoborderRow;
                    NetRow[2] = EmptyNoborderRow;
                    NetRow[3] = EmptyNoborderRow;
                    NetRow[4] = EmptyNoborderRow;
                    NetRow[5] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + ReportsText.NegAdjValueRepTxt + ReportsHelper.MANUAL_TD_END;
                    NetRow[6] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + TotalNegative + ReportsHelper.MANUAL_TD_END;
                    NetRow = aDataTable1.Rows.Add();
                    NetRow[0] = EmptyNoborderRow;
                    NetRow[1] = EmptyNoborderRow;
                    NetRow[2] = EmptyNoborderRow;
                    NetRow[3] = EmptyNoborderRow;
                    NetRow[4] = EmptyNoborderRow;
                    NetRow[5] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + "<b>" + ReportsText.NetValueRepTxt + "<b>" + ReportsHelper.MANUAL_TD_END;
                    NetRow[6] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + (TotalNegative + TotalPositive) + ReportsHelper.MANUAL_TD_END;

                }
                List<string> aStringList = ReportsHelper.ImportReportHeader(0, 1);
                List<string> aFooterList = ReportsHelper.ImportReportHeader(1, 1);

                aStringList.Add(SharedVariables.Line_Solid_10px_Black);
              
                if (ACTIVE_MODE==AdjustItemsFrmModes.ADDING_MODE)
                {
                    aStringList.Add(ReportsNames.InventoryStockAdjustRepName);
                    aStringList.Add("<h2>" + ReportsText.PrintedOnrepTxt + " " + DateTime.Now.ToShortDateString() + "&nbsp;&nbsp;" + DateTime.Now.ToShortTimeString() + "</h2>");
                    aStringList.Add("<h2> " + ReportsText.PrintedByrepTxt + ":&nbsp;&nbsp;" + SharedFunctions.ReturnLoggedUserName() + "</h2>");
                }
                else
                {
                    aStringList.Add("Update "+ReportsNames.InventoryStockAdjustRepName );
                    aStringList.Add("<h2>" + ReceiptText.RctTxtOrgDate + " " +DateTime.Parse( aAdjustGeneralList.Rows[0]["Date"].ToString()).ToShortDateString() + "</h2>");
                    aStringList.Add("<h2> " + ReceiptText.RctTxtOrgTeller + ":&nbsp;&nbsp;" +aUserRow["UserName"].ToString() + "</h2>");

                    aStringList.Add("<h2>" + ReceiptText.RctTxtReprintedOn + " " + DateTime.Now.ToShortDateString() + "&nbsp;&nbsp;" + DateTime.Now.ToShortTimeString() + "</h2>");
                    aStringList.Add("<h2> " + ReceiptText.RctTxtReprintedBy + ":&nbsp;&nbsp;" + SharedFunctions.ReturnLoggedUserName() + "</h2>");
                }

                aStringList.Add(ReceiptText.RctTxtInvoiceNum + ":&nbsp; " + GeneralNumber);
                aStringList.Add(SharedVariables.Line_Solid_10px_Black);

                PrintingManager.Instance.PrintTables(aDataTableList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, false, false, !XlsChkBox.Checked, ReportsHelper.TempPDFOutputPath, XlsChkBox.Checked, ReportsHelper.TempOutputPathExcel, false, false);

                if (XlsChkBox.Checked)
                {
                    Process.Start(ReportsHelper.TempOutputPathExcel);
                }
                else
                {
                    Process.Start(ReportsHelper.TempPDFOutputPath);
                }
                return true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(MsgTxt.UnexpectedError + "\n Exception: IN[AdjustItemsFrm:ExportToPDF [EXCEPTION IS]] \n" + ex.Message, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

        }
Exemplo n.º 13
0
        //To Make Size Always Normal For Non-Grid Forms

        private bool print_receipt()
        {
            try
            {
                List <DataTable> aDataTableList = new List <DataTable>();
                DataTable        aDataTable1    = new DataTable();
                aDataTable1.Columns.Add("[border=true1]" + ReceiptText.RctTxtToPayAmount);
                aDataTable1.Columns.Add(PaymentAmountTxtBox.Text);

                aDataTable1.Rows.Add();
                aDataTable1.Rows[0][0] = ReceiptText.RctTxtPayMethod;
                aDataTable1.Rows[0][1] = PaymentMethodCheckBox.Text;
                aDataTable1.Rows.Add();
                double OldCustomerAccountAmountParser = 0;
                if (double.TryParse(CustomerBalanceTxtBox.Text, out OldCustomerAccountAmountParser))
                {
                    aDataTable1.Rows[1][0] = ReceiptText.RctTxtOldBalance;
                    aDataTable1.Rows[1][1] = OldCustomerAccountAmountParser;
                    aDataTable1.Rows.Add();
                    aDataTable1.Rows[2][0] = ReceiptText.RctTxtNewBalance;
                    aDataTable1.Rows[2][1] = OldCustomerAccountAmountParser + double.Parse(PaymentAmountTxtBox.Text);
                    if (double.TryParse(CurrentBalanceTxtBox.Text, out OldCustomerAccountAmountParser))
                    {
                        aDataTable1.Rows.Add();
                        aDataTable1.Rows[3][0] = ReceiptText.RctTxtCurrenctBalance;
                        aDataTable1.Rows[3][1] = OldCustomerAccountAmountParser.ToString();
                    }
                }

                aDataTableList.Add(aDataTable1);
                List <string> aStringList = ReportsHelper.ImportReportHeader(0, 0);
                List <string> aFooterList = ReportsHelper.ImportReportHeader(1, 0);
                aStringList.Add(SharedVariables.Line_Solid_10px_Black);
                aStringList.Add(ReceiptName.RctNmsCustomerPay);
                aStringList.Add(ReceiptText.RctTxtDuplicate);

                if (aCustomerPaymentRowGlobal["IsRevised"].ToString() == "1")
                {
                    aStringList.Add("*** " + ReceiptText.RctTxtReversed + " ***");
                    aStringList.Add("<h2> " + ReceiptText.RctTxtReversedBy + ":&nbsp;&nbsp;" + RevisedBylbl.Text + "</h2>");
                    aStringList.Add("<h2> " + ReceiptText.RctTxtReversedOn + ":&nbsp;&nbsp;" + ReviseDatelbl.Text + "</h2>");
                }

                aStringList.Add("<h2>" + ReceiptText.RctTxtOrgDate + "/" + ReceiptText.RctTxtOrgTime + " " + DateLbl.Text + "&nbsp;&nbsp;" + TimeLbl.Text + "</h2>");
                aStringList.Add("<h2> " + ReceiptText.RctTxtOrgTeller + ":&nbsp;&nbsp;" + TellerLbl.Text + "</h2>");
                aStringList.Add("<h2>" + ReceiptText.RctTxtReprintedOn + " " + DateTime.Now.ToShortDateString() + "&nbsp;&nbsp;" + DateTime.Now.ToShortTimeString() + "</h2>");
                aStringList.Add("<h2> " + ReceiptText.RctTxtReprintedBy + ":&nbsp;&nbsp;" + SharedFunctions.ReturnLoggedUserName() + "</h2>");


                aStringList.Add(ReceiptText.RctTxtCustomer + ":&nbsp;&nbsp;" + CustomerNameTxtBox.Text);
                aStringList.Add(ReceiptText.RctTxtPaymentNum + ":&nbsp; " + PaymentNumberTxtBox.Text);
                aStringList.Add(SharedVariables.Line_Solid_10px_Black);
                PrintingManager.Instance.PrintTables(aDataTableList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, true, true);
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(MsgTxt.UnexpectedError + "\n Exception: IN[EditCustomerPayment:Print Receipt [EXCEPTION IS]] \n" + ex.Message, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
Exemplo n.º 14
0
        //年區間選單
        public ActionResult Year(string date, string table)
        {
            List <SelectMenu> Year = ReportsHelper.GetYear(date, table);

            return(PartialView("SelectItem", Year));
        }
Exemplo n.º 15
0
 private void exitToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ReportsHelper.CleanReport();
     this.Dispose();
     this.Close();
 }
Exemplo n.º 16
0
        private bool print_receipt()
        {
            try
            {
                List <DataTable> aDataTableList = new List <DataTable>();
                DataTable        aDataTable1    = new DataTable();
                aDataTable1.Columns.Add("[border=true1]<th width=45%>" + ReceiptText.RctTxtItemName);
                aDataTable1.Columns.Add(ReceiptText.RctTxtUnitCost);
                aDataTable1.Columns.Add(ReceiptText.RctTxtQty);
                aDataTable1.Columns.Add(ReceiptText.RctTxtTotal);

                foreach (DataGridViewRow aRow in TeldgView.Rows)
                {
                    aDataTable1.Rows.Add();
                    aDataTable1.Rows[aRow.Index][0] = aRow.Cells["Description"].Value.ToString();
                    aDataTable1.Rows[aRow.Index][1] = aRow.Cells["PricePerUnit"].Value.ToString();
                    aDataTable1.Rows[aRow.Index][2] = aRow.Cells["Qty"].Value.ToString();
                    aDataTable1.Rows[aRow.Index][3] = aRow.Cells["PriceTotal"].Value.ToString();
                }
                int       RowCnt      = 0;
                DataTable aDataTable3 = new DataTable();
                aDataTable3.Columns.Add("[border=true1]<th>" + ReceiptText.RctTxtTax);
                aDataTable3.Columns.Add(TaxTxtBox.Text + "JOD");
                RowCnt = 0;


                aDataTable3.Rows.Add();
                aDataTable3.Rows[RowCnt][0]   = "<td style=\"background-color:#000;color:#fff;border-right-color:#fff;\"><b><font size=4>" + ReceiptText.RctTxtTotal + "</font>";
                aDataTable3.Rows[RowCnt++][1] = "<td style=\"background-color:#000;color:#fff;border-left-color:#fff\"><b><font size=5>" + TotalTxtBox.Text + " JOD </font>";

                aDataTable3.Rows.Add();
                aDataTable3.Rows[RowCnt][0]   = ReceiptText.RctTxtDisposalReason;
                aDataTable3.Rows[RowCnt++][1] = DisposalReasonComboBox.Text;

                aDataTableList.Add(aDataTable1);
                // aDataTableList.Add(aDataTable2);
                aDataTableList.Add(aDataTable3);

                List <string> aStringList = ReportsHelper.ImportReportHeader(0, 0);
                List <string> aFooterList = ReportsHelper.ImportReportHeader(1, 0);

                aStringList.Add(SharedVariables.Line_Solid_10px_Black);
                aStringList.Add(ReceiptName.RctNmsDisposeitems);
                aStringList.Add("<h2>" + ReceiptText.RctTxtDate + "/" + ReceiptText.RctTxtTime + " " + DateTime.Now.ToShortDateString() + "&nbsp;&nbsp;" + DateTime.Now.ToShortTimeString() + "</h2>");
                aStringList.Add("<h2> " + ReceiptText.RctTxtTeller + ":&nbsp;&nbsp;" + SharedFunctions.ReturnLoggedUserName() + "</h2>");

                aStringList.Add(ReceiptText.RctTxtDisposeInvNumber + ":&nbsp; " + InvoiceNumTxtBox.Text);
                aStringList.Add(SharedVariables.Line_Solid_10px_Black);
                PrintingManager.Instance.PrintTables(aDataTableList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, !PrintingThermalA4ChkBox.Checked, !PrintingThermalA4ChkBox.Checked, PrintingThermalA4ChkBox.Checked, ReportsHelper.TempOutputPath + ".pdf", false, "", false, PrintingThermalA4ChkBox.Checked);
                if (PrintingThermalA4ChkBox.Checked)
                {
                    Process.Start(ReportsHelper.TempPDFOutputPath);
                }
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(MsgTxt.UnexpectedError + "\n Exception: IN[DisposeItems:Print Receipt [EXCEPTION IS]] \n" + ex.Message, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
        public async Task EmployeesReportByDay_Generate_DoesGenerate()
        {
            OuterResource newArea = new OuterResource()
            {
                Name = "My OuterResource 1", Version = 1
            };
            OuterResource newArea1 = new OuterResource()
            {
                Name = "My OuterResource 2", Version = 1
            };
            OuterResource newArea2 = new OuterResource()
            {
                Name = "My OuterResource 3", Version = 1
            };
            InnerResource newMachine = new InnerResource()
            {
                Name = "My InnerResource 1", Version = 1
            };
            InnerResource newMachine1 = new InnerResource()
            {
                Name = "My InnerResource 2", Version = 1
            };
            InnerResource newMachine2 = new InnerResource()
            {
                Name = "My InnerResource 3", Version = 1
            };
            await newArea.Create(DbContext);

            await newArea1.Create(DbContext);

            await newArea2.Create(DbContext);

            await newMachine.Create(DbContext);

            await newMachine1.Create(DbContext);

            await newMachine2.Create(DbContext);

            // Different days
            ResourceTimeRegistration newTimeRegistrationDay = new ResourceTimeRegistration()
            {
                OuterResourceId = newArea.Id, Version = 1, SDKSiteId = 1, InnerResourceId = newMachine.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 05, 13)
            };
            ResourceTimeRegistration newTimeRegistrationDay1 = new ResourceTimeRegistration()
            {
                OuterResourceId = newArea1.Id, Version = 1, SDKSiteId = 1, InnerResourceId = newMachine1.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 05, 14)
            };
            ResourceTimeRegistration newTimeRegistrationDay2 = new ResourceTimeRegistration()
            {
                OuterResourceId = newArea2.Id, Version = 1, SDKSiteId = 1, InnerResourceId = newMachine2.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 05, 15)
            };
            ResourceTimeRegistration newTimeRegistrationDay3 = new ResourceTimeRegistration()
            {
                OuterResourceId = newArea.Id, Version = 1, SDKSiteId = 2, InnerResourceId = newMachine.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 05, 13)
            };
            ResourceTimeRegistration newTimeRegistrationDay4 = new ResourceTimeRegistration()
            {
                OuterResourceId = newArea1.Id, Version = 1, SDKSiteId = 2, InnerResourceId = newMachine1.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 05, 14)
            };
            ResourceTimeRegistration newTimeRegistrationDay5 = new ResourceTimeRegistration()
            {
                OuterResourceId = newArea1.Id, Version = 1, SDKSiteId = 2, InnerResourceId = newMachine2.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 05, 15)
            };
            ResourceTimeRegistration newTimeRegistrationDay6 = new ResourceTimeRegistration()
            {
                OuterResourceId = newArea1.Id, Version = 1, SDKSiteId = 2, InnerResourceId = newMachine1.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 05, 15)
            };

            await DbContext.ResourceTimeRegistrations.AddRangeAsync(newTimeRegistrationDay, newTimeRegistrationDay1,
                                                                    newTimeRegistrationDay2, newTimeRegistrationDay3, newTimeRegistrationDay4, newTimeRegistrationDay5,
                                                                    newTimeRegistrationDay6);

            await DbContext.SaveChangesAsync();

            GenerateReportModel model = new GenerateReportModel()
            {
                DateFrom     = new DateTime(2019, 5, 13),
                DateTo       = new DateTime(2019, 5, 16),
                Relationship = ReportRelationshipType.Employee,
                Type         = ReportType.Day
            };

            List <SiteDto> sitesList = new List <SiteDto>()
            {
                new SiteDto(1, "Test Site 1", "", "", 1, 1, 1, 1),
                new SiteDto(2, "Test Site 2", "", "", 1, 1, 1, 1)
            };

            DateTime modelDateFrom = new DateTime(
                model.DateFrom.Year,
                model.DateFrom.Month,
                model.DateFrom.Day,
                0, 0, 0);
            DateTime modelDateTo = new DateTime(
                model.DateTo.Year,
                model.DateTo.Month,
                model.DateTo.Day,
                23, 59, 59);

            List <ResourceTimeRegistration> jobsList = await DbContext.ResourceTimeRegistrations
                                                       .Include(x => x.InnerResource)
                                                       .Include(x => x.OuterResource)
                                                       .Where(x => x.DoneAt >= modelDateFrom && x.DoneAt <= modelDateTo)
                                                       .ToListAsync();

            ReportModel reportModel = ReportsHelper.GetReportData(model, jobsList, sitesList, (int)ReportTimeType.Minutes);

            Assert.AreEqual(reportModel.SubReports.Count, 1);
            Assert.AreEqual(reportModel.SubReports[0].TotalTime, 4200);
            Assert.AreEqual(reportModel.SubReports[0].Entities.Count, sitesList.Count);
            Assert.AreEqual(reportModel.SubReports[0].Entities[0].EntityName, sitesList[0].SiteName);
            Assert.AreEqual(reportModel.SubReports[0].Entities[1].EntityName, sitesList[1].SiteName);
            Assert.AreEqual(reportModel.SubReports[0].Entities[0].TotalTime, 1800);
            Assert.AreEqual(reportModel.SubReports[0].Entities[1].TotalTime, 2400);
            Assert.AreEqual(reportModel.SubReports[0].Entities[0].TimePerTimeUnit[0], 600);
            Assert.AreEqual(reportModel.SubReports[0].Entities[0].TimePerTimeUnit[1], 600);
        }
Exemplo n.º 18
0
        public async Task OuterResourcesReportByWeek_Generate_DoesGenerate()
        {
            OuterResource newOuterResource = new OuterResource()
            {
                Name = "My OuterResource 1", Version = 1
            };
            OuterResource newOuterResource1 = new OuterResource()
            {
                Name = "My OuterResource 2", Version = 1
            };
            OuterResource newOuterResource2 = new OuterResource()
            {
                Name = "My OuterResource 3", Version = 1
            };
            InnerResource newMachine = new InnerResource()
            {
                Name = "My InnerResource 1", Version = 1
            };
            InnerResource newMachine1 = new InnerResource()
            {
                Name = "My InnerResource 2", Version = 1
            };
            InnerResource newMachine2 = new InnerResource()
            {
                Name = "My InnerResource 3", Version = 1
            };

            await newOuterResource.Create(DbContext);

            await newOuterResource1.Create(DbContext);

            await newOuterResource2.Create(DbContext);

            await newMachine.Create(DbContext);

            await newMachine1.Create(DbContext);

            await newMachine2.Create(DbContext);

            // Different Weeks
            ResourceTimeRegistration newTimeRegistrationWeek = new ResourceTimeRegistration()
            {
                OuterResourceId = newOuterResource.Id, Version = 1, SDKSiteId = 1, InnerResourceId = newMachine.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 05, 20)
            };
            ResourceTimeRegistration newTimeRegistrationWeek1 = new ResourceTimeRegistration()
            {
                OuterResourceId = newOuterResource1.Id, Version = 1, SDKSiteId = 1, InnerResourceId = newMachine1.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 05, 20)
            };
            ResourceTimeRegistration newTimeRegistrationWeek2 = new ResourceTimeRegistration()
            {
                OuterResourceId = newOuterResource2.Id, Version = 1, SDKSiteId = 1, InnerResourceId = newMachine2.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 05, 27)
            };
            ResourceTimeRegistration newTimeRegistrationWeek3 = new ResourceTimeRegistration()
            {
                OuterResourceId = newOuterResource.Id, Version = 1, SDKSiteId = 2, InnerResourceId = newMachine.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 06, 27)
            };
            ResourceTimeRegistration newTimeRegistrationWeek4 = new ResourceTimeRegistration()
            {
                OuterResourceId = newOuterResource1.Id, Version = 1, SDKSiteId = 2, InnerResourceId = newMachine1.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 06, 05)
            };
            ResourceTimeRegistration newTimeRegistrationWeek5 = new ResourceTimeRegistration()
            {
                OuterResourceId = newOuterResource1.Id, Version = 1, SDKSiteId = 2, InnerResourceId = newMachine2.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 06, 05)
            };
            ResourceTimeRegistration newTimeRegistrationWeek6 = new ResourceTimeRegistration()
            {
                OuterResourceId = newOuterResource1.Id, Version = 1, SDKSiteId = 2, InnerResourceId = newMachine1.Id, TimeInSeconds = 36000, DoneAt = new DateTime(2019, 06, 06)
            };

            await DbContext.ResourceTimeRegistrations.AddRangeAsync(newTimeRegistrationWeek, newTimeRegistrationWeek1,
                                                                    newTimeRegistrationWeek2, newTimeRegistrationWeek3, newTimeRegistrationWeek4, newTimeRegistrationWeek5,
                                                                    newTimeRegistrationWeek6);

            await DbContext.SaveChangesAsync();

            GenerateReportModel model = new GenerateReportModel()
            {
                DateFrom     = new DateTime(2019, 5, 13),
                DateTo       = new DateTime(2019, 6, 07),
                Relationship = ReportRelationshipType.OuterResource,
                Type         = ReportType.Week
            };

            List <SiteDto> sitesList = new List <SiteDto>()
            {
                new SiteDto(1, "Test Site 1", "", "", 1, 1, 1, 1),
                new SiteDto(2, "Test Site 2", "", "", 1, 1, 1, 1)
            };

            DateTime modelDateFrom = new DateTime(
                model.DateFrom.Year,
                model.DateFrom.Month,
                model.DateFrom.Day,
                0, 0, 0);
            DateTime modelDateTo = new DateTime(
                model.DateTo.Year,
                model.DateTo.Month,
                model.DateTo.Day,
                23, 59, 59);

            List <ResourceTimeRegistration> jobsList = await DbContext.ResourceTimeRegistrations
                                                       .Include(x => x.InnerResource)
                                                       .Include(x => x.OuterResource)
                                                       .Where(x => x.DoneAt >= modelDateFrom && x.DoneAt <= modelDateTo)
                                                       .ToListAsync();

            ReportModel reportModel = ReportsHelper.GetReportData(model, jobsList, sitesList, (int)ReportTimeType.Minutes);

            Assert.AreEqual(reportModel.SubReports.Count, 1);
            Assert.AreEqual(reportModel.SubReports[0].TotalTime, 3600);
            Assert.AreEqual(reportModel.SubReports[0].Entities.Count, 3);
            Assert.AreEqual(reportModel.SubReports[0].Entities[0].EntityName, newOuterResource.Name);
            Assert.AreEqual(reportModel.SubReports[0].Entities[1].EntityName, newOuterResource1.Name);
            Assert.AreEqual(reportModel.SubReports[0].Entities[2].EntityName, newOuterResource2.Name);

            Assert.AreEqual(reportModel.SubReports[0].Entities[0].TotalTime, 600);
            Assert.AreEqual(reportModel.SubReports[0].Entities[1].TotalTime, 2400);

            Assert.AreEqual(reportModel.SubReports[0].Entities[0].TimePerTimeUnit[0], 0);
            Assert.AreEqual(reportModel.SubReports[0].Entities[0].TimePerTimeUnit[1], 600);
            Assert.AreEqual(reportModel.SubReports[0].Entities[0].TimePerTimeUnit[2], 0);
            Assert.AreEqual(reportModel.SubReports[0].Entities[0].TimePerTimeUnit[3], 0);

            Assert.AreEqual(reportModel.SubReports[0].Entities[1].TimePerTimeUnit[0], 0);
            Assert.AreEqual(reportModel.SubReports[0].Entities[1].TimePerTimeUnit[1], 600);
            Assert.AreEqual(reportModel.SubReports[0].Entities[1].TimePerTimeUnit[2], 0);
            Assert.AreEqual(reportModel.SubReports[0].Entities[1].TimePerTimeUnit[3], 1800);
        }