Beispiel #1
0
        public static void executeCustomerMissingReport(string salesOrg)
        {
            var                idaLog   = new IdaLog();
            string             id       = $"{DateTime.Now} {Environment.MachineName}";
            IDBServerConnector dbServer = Create.dbServer();
            ISAPLib            sap      = Create.sapLib();

            idaLog.insertToActivityLog("missingCustomers", "startTime", id, salesOrg);
            var       dcServer            = new DataCollectorServer(dbServer);
            var       dcSap               = new DataCollectorSap(sap, Create.exportParses());
            var       distList            = new DistributionListCalculator(dbServer);
            var       dc                  = new DataCollectorServiceMCR(dcServer, dcSap);
            var       dcService           = new DataCollectorServiceMCR(dcServer, dcSap);
            var       customerMissingList = dcService.getMissingCustomers(salesOrg);
            IMailUtil mu                  = Create.mailUtil();
            string    email               = distList.getDistList(salesOrg, "missingCustomers");

            if (customerMissingList is null)
            {
                idaLog.insertToActivityLog("missingCustomers", "empty list", id, salesOrg);
                mu.mailSimple(email, $"{salesOrg} Customers missing in the Database {DateTime.Now}", $"Hello<br><br>There are no orders in ZV04HN<br><br>Kind Regards<br>IDA");
                return;
            }

            if (customerMissingList.Count > 0)
            {
                mu.mailSimple(email, $"{salesOrg} Customers missing in the Database {DateTime.Now}", $"Hello<br><br><br>{mu.listToHTMLtable(customerMissingList)}<br><br>Kind Regards<br>IDA");
                idaLog.insertToActivityLog("missingCustomers", "success", id, salesOrg);
            }
            else
            {
                idaLog.insertToActivityLog("missingCustomers", "empty list", id, salesOrg);
                mu.mailSimple(email, $"{salesOrg} Customers missing in the Database {DateTime.Now}", $"Hello<br><br><br>There are no missing customers in the database<br><br>Kind Regards<br>IDA");
            }
        }
Beispiel #2
0
        public static void executeDistressReport(string salesOrg)
        {
            IDBServerConnector            dbServer = Create.dbServer();
            ISAPLib                       sap      = Create.sapLib();
            IDataCollectorServer          dcServer = new DataCollectorServer(dbServer);
            IDataCollectorSap             dcSap    = new DataCollectorSap(sap, Create.exportParses());
            IDataCollectorServiceDistress dc       = new DataCollectorServiceDistress(dcServer, dcSap);
            IDistributionListCalculator   distList = new DistributionListCalculator(dbServer);

            string email = distList.getDistList(salesOrg, "distress");

            var executor = new DistressReportExecutor(salesOrg);

            executor.startLogs();

            if (!(executor.calculateGenericDistress(dc)))
            {
                executor.emptyListAction(email);
                return;
            }

            if (executor.calculateSalesOrgSpecifficDistress())
            {
                executor.sendInfo(email);
                executor.finishLogs();
            }
            else
            {
                executor.emptyListAction(email);
            }
        }
Beispiel #3
0
        public static void executeRDDTask(string salesOrg)
        {
            string id       = $"{DateTime.Now} {Environment.MachineName}";
            var    dbServer = Create.dbServer();
            var    sap      = Create.sapLib();
            var    dcServer = new DataCollectorServer(dbServer);
            var    dcSap    = new DataCollectorSap(sap, Create.exportParses());
            var    distList = new DistributionListCalculator(dbServer);
            var    dc       = new DataCollectorServiceRDD(dcServer, dcSap);
            string email    = distList.getDistList(salesOrg, "deliveryDateChanges");
            var    executor = new RddTaskExecutor(salesOrg);

            try {
                //executor.startLogs(salesOrg, id);
                executor.setRddList(salesOrg, id, dc);

                // check when sap is empty
                if (executor.rddList is null)
                {
                    executor.emptyListAction(salesOrg, id, email, true);
                    return;
                }

                executor.setBHList(salesOrg, dc);
                executor.prepareList();
                executor.calculateLists();

                if (executor.calculatedList.Count > 0)
                {
                    executor.populateDeliveryDatesLog(dbServer);
                    executor.sendEmailWithChanges(salesOrg, email);
                    // TODO: move to multisession
                    executor.runVA02(sap);
                    executor.sendFailedRdds(salesOrg, email, dbServer);
                }
                else
                {
                    executor.emptyListAction(salesOrg, id, email, false);
                }

                //If salesOrg = "IT01" Then executor.sendIT01Report(salesOrg, email, dbServer)
            } catch (Exception ex) {
                executor.sendFailedRdds(salesOrg, email, dbServer);
                executor.handleError(salesOrg, id, ex);
                dbServer.closeConnection();
                return;
            }

            executor.finishLogs(salesOrg, id, "success");
            dbServer.closeConnection();
        }
Beispiel #4
0
        public bool calculateSwitches(DataCollectorServer dcServer, DataCollectorSap dcSap)
        {
            var DCSS = new DataCollectorServiceSwitches(dcServer, dcSap);
            var list = DCSS.getSwitchesList(salesOrg, id);

            if (list is null)
            {
                return(false);
            }
            else
            {
                switchList            = list;
                AutomaticSwitchesList = switchList.Where(x => x.switchAutomatic == true).ToList();
                ManualSwitchesList    = switchList.Where(x => x.switchAutomatic == false).ToList();
                return(true);
            }
        }
Beispiel #5
0
        public static void executeDeliveryBlocks(string salesOrg)
        {
            string               id                      = $"{DateTime.Now} {Environment.MachineName}";
            IDBServerConnector   dbServer                = Create.dbServer();
            ISAPLib              sap                     = Create.sapLib();
            IDataCollectorServer dcServer                = new DataCollectorServer(dbServer);
            IDataCollectorSap    dcSap                   = new DataCollectorSap(sap, Create.exportParses());
            IDataCollectorServiceDeliveryBlocks dc       = new DataCollectorServiceDeliveryBlocks(id: id, dataCollectorServer: dcServer, dataCollectorSap: dcSap, salesOrg: salesOrg);
            IDistributionListCalculator         distList = new DistributionListCalculator(dbServer);
            IMailUtil mu = Create.mailUtil();

            string email    = distList.getDistList(salesOrg, "deliveryBlocks");
            var    executor = new DeliveryBlocksExecutor(salesOrg: salesOrg, id: id);

            string[] salesOrgsWithNoDelBlockAction = { "ES01", "PT01" };

            executor.startLog();

            if (executor.calculateDeliveryBlockList(dc))
            {
                executor.populateDeliveryBlocksLog(dbServer);
                executor.sendEmail(email: email, mu: mu, isEmptyList: false);
                executor.runDeliveryBlocksInVA02();
                executor.finishLog(isEmpty: false);
            }
            else
            {
                if (!salesOrgsWithNoDelBlockAction.Contains(salesOrg))
                {
                    executor.sendEmail(email: email, mu: mu, isEmptyList: true);
                    executor.finishLog(isEmpty: true);
                }
            }

            executor.sendFailedDeliveryBlocks(salesOrg, email, dbServer, mu);

            executor.rejectLastReleaseBlockedOrders(dbServer, dcSap, dcServer, mu, email);

            executor.sendCurrentBlocksInSystem(mu, dcSap, email);

            if (salesOrgsWithNoDelBlockAction.Contains(salesOrg))
            {
                executor.finishLog(isEmpty: false);
            }
        }
Beispiel #6
0
        public static void executeMissingCMIRReport(string salesOrg)
        {
            var    idaLog = new IdaLog();
            string id     = $"{DateTime.Now} {Environment.MachineName}";

            // idaLog.insertToActivityLog("missingCMIR", "startTime", id, salesOrg);

            var dbServer = Create.dbServer();
            var sap      = Create.sapLib();

            DataCollectorServer        dcServer        = new DataCollectorServer(dbServer);
            DataCollectorSap           dcSap           = new DataCollectorSap(sap, Create.exportParses());
            DistributionListCalculator distList        = new DistributionListCalculator(dbServer);
            DataCollectorServiceCMIR   dcService       = new DataCollectorServiceCMIR(dcServer, dcSap);
            List <MissingCMIRProperty> missingCMIRList = dcService.getMissingCMIRS(salesOrg);

            IMailUtil mu    = Create.mailUtil();
            string    email = distList.getDistList(salesOrg, "cmirCheck");

            if (missingCMIRList is null)
            {
                idaLog.insertToActivityLog("missingCMIR", "empty list", id, salesOrg);
                mu.mailSimple(email, $"{salesOrg} CMIR's missing in orders {DateTime.Now}", $"Hello<br><br><br>There are no orders in the ZV04P report<br><br>Kind Regards<br>IDA");
                return;
            }

            if (missingCMIRList.Count > 0)
            {
                sendEmailWithExcelFile(salesOrg, missingCMIRList, mu, email);
                idaLog.insertToActivityLog("missingCMIR", "success", id, salesOrg);
            }
            else
            {
                idaLog.insertToActivityLog("missingCMIR", "empty list", id, salesOrg);
                mu.mailSimple(email, $"{salesOrg} CMIR's missing in orders {DateTime.Now}", $"Hello<br><br><br>There are no missing CMIR's<br><br>Kind Regards<br>IDA");
            }
        }
 public DataCollectorServiceMCR(DataCollectorServer dataCollectorServer, DataCollectorSap dataCollectorSap)
 {
     this.dataCollectorServer = dataCollectorServer;
     this.dataCollectorSap    = dataCollectorSap;
 }
Beispiel #8
0
        public static void executeSwitchTask(string salesOrg)
        {
            #region properties
            string id       = $"{DateTime.Now} {Environment.MachineName}";
            var    dbServer = Create.dbServer();
            var    sap      = Create.sapLib();
            //var mu = Create.mailUtil();
            var    dcServer = new DataCollectorServer(dbServer);
            var    dcSap    = new DataCollectorSap(sap, Create.exportParses());
            var    distList = new DistributionListCalculator(dbServer);
            var    dc       = new DataCollectorServiceSwitches(dcServer, dcSap);
            var    executor = new SwitchesTaskExecutor(salesOrg, id);
            string email    = distList.getDistList(salesOrg, "switches");
            #endregion

            //executor.startLogs(salesOrg);

            if (!executor.calculateSwitches(dcServer, dcSap))
            {
                //  mu.mailSimple(email, $"{salesOrg} No manual or automatic switches {DateTime.Now}", $"Hello<br><br>There are no orders in ZV04I<br><br>Kind Regards<br>IDA");
                //executor.endLogs(salesOrg, "Manual Switches", "empty list");
                //executor.endLogs(salesOrg, "Automatic Switches", "empty list");
                return;
            }

            if (executor.switchList.Count > 0)
            {
                executor.populateSwitchesLog(dbServer);
            }
            if (executor.ManualSwitchesList.Count > 0)
            {
                // mu.mailSimple(email, $"{salesOrg} Manual Switches {DateTime.Now}", $"Hello<br><br>{mu.listToHTMLtable(executor.ManualSwitchesList)}<br><br>Kind Regards<br>IDA");
                executor.endLogs(salesOrg, "Manual Switches", "success");
            }
            else
            {
                //mu.mailSimple(email, $"{salesOrg} No Manual Switches {DateTime.Now}", $"Hello<br><br>There are no manual switches for you to action<br><br>Kind Regards<br>IDA");
                executor.endLogs(salesOrg, "Manual Switches", "empty list");
            }

            if (executor.AutomaticSwitchesList.Count > 0)
            {
                //mu.mailSimple(email, $"{salesOrg} Automatic Switches {DateTime.Now}", $"Hello<br><br>{mu.listToHTMLtable(executor.AutomaticSwitchesList)}<br><br>Kind Regards<br>IDA");
                executor.createAutomaticSwitchObjectList();

                try {
                    executor.runSwitchesInVA02();
                    executor.endLogs(salesOrg, "Automatic Switches", "success");
                    // executor.sendFailedSwitches(salesOrg, email, dbServer, mu);
                    //executor.sendReplacedCMIRs(salesOrg, email, mu, dbServer);
                } catch (Exception ex) {
                    GlobalErrorHandler.handle(salesOrg, "Automatic Switches", ex);
                    // executor.sendFailedSwitches(salesOrg, email + ";[email protected]", dbServer, mu);
                }
            }
            else
            {
                //mu.mailSimple(email, $"{salesOrg} No Automatic Switches {DateTime.Now}", $"Hello<br><br>There are no automatic switches for IDA to action<br><br>Kind Regards<br>IDA");
                executor.endLogs(salesOrg, "Automatic Switches", "empty list");
            }
        }
Beispiel #9
0
        public static void executeRejections(string salesOrg, bool isRelease)
        {
            #region properties
            string id = $"{DateTime.Now} {Environment.MachineName}";

            IIdaLog                          idaLog         = new IdaLog();
            IDBServerConnector               dbServer       = Create.dbServer();
            ISAPLib                          sap            = Create.sapLib();
            IMailUtil                        mu             = Create.mailUtil();
            IDataCollectorServer             dcServer       = new DataCollectorServer(dbServer);
            IDataCollectorSap                dcSap          = new DataCollectorSap(sap, Create.exportParses());
            IDataCollectorServiceRejections  dataCollector  = new DataCollectorServiceRejections(dcServer, dcSap);
            IDataCalculatorServiceRejections dataCalculator = new DataCalculatorServiceRejections(id);
            IDistributionListCalculator      dlc            = new DistributionListCalculator(dbServer);

            RejectionsOrderPropertyFactory rejectionOrderObj = new RejectionsOrderPropertyFactory();

            string email    = dlc.getDistList(salesOrg, "rejections");
            var    executor = new RejectionsTaskExecutor(salesOrg, id, isRelease, idaLog);
            #endregion

            executor.startLogs(salesOrg, isRelease ? "Release Rejections" : "After Release Rejections", "start");

            if (!executor.calculateLists(dataCollector, dataCalculator))
            {
                string tempText = isRelease ? " " : " after ";
                mu.mailSimple(email, $"{salesOrg} No Rejections {DateTime.Now}", $"Hello<br><br>There are no{tempText}release rejections<br><br>Kind Regards<br>IDA");
                executor.endLogs(salesOrg, isRelease ? "Release Rejections" : "After Release Rejections", "empty list");
                return;
            }

            if (isRelease)
            {
                #region releaseExecution
                executor.populateRejectionLog(dbServer);

                if (executor.afterReleaseRejectionList.Count > 0)
                {
                    mu.mailSimple(email, $"{salesOrg} After release rejections {DateTime.Now}", $"Hello<br><br>Here are the rejections that will be executed after last release today:<br><br>{mu.listToHTMLtable(executor.afterReleaseRejectionList)}<br><br>Kind Regards<br>IDA");
                }
                else
                {
                    mu.mailSimple(email, $"{salesOrg} No after release rejections {DateTime.Now}", $"Hello<br><br>There are no after release rejections found in this release<br><br>Kind Regards<br>IDA");
                    executor.endLogs(salesOrg, "After Release Rejections", "empty list");
                }

                if (executor.releaseRejectionList.Count > 0)
                {
                    executor.createAutomaticRejectionObjectList(rejectionOrderObj);
                    mu.mailSimple(email, $"{salesOrg} Release rejections {DateTime.Now}", $"Hello<br><br>Here are the rejections during release:<br><br>{mu.listToHTMLtable(executor.releaseRejectionList)}<br><br>Kind Regards<br>IDA");
                    executor.runRejectionsInVA02(email, dbServer, mu);
                    executor.endLogs(salesOrg, "Release Rejections", "success");
                }
                else
                {
                    mu.mailSimple(email, $"{salesOrg} No release rejections {DateTime.Now}", $"Hello<br><br>There are no rejections found for this release<br><br>Kind Regards<br>IDA");
                    executor.endLogs(salesOrg, "Release Rejections", "empty list");
                }
                #endregion
            }
            else
            {
                #region afterReleaseExecution
                executor.createAutomaticRejectionObjectList(rejectionOrderObj);
                mu.mailSimple(email, $"{salesOrg} After release rejections {DateTime.Now}", $"Hello<br><br>Here are the after release rejections gathered throughout the day that are about to be executed:<br><br>{mu.listToHTMLtable(executor.afterReleaseRejectionList)}<br><br>Kind Regards<br>IDA");
                executor.runRejectionsInVA02(email, dbServer, mu);
                executor.endLogs(salesOrg, "After Release Rejections", "success");
                #endregion
            }
        }
Beispiel #10
0
 public DataCollectorServiceFloorCut(DataCollectorServer dataCollectorServer, DataCollectorSap dataCollectorSap)
 {
     this.dataCollectorServer = dataCollectorServer;
     this.dataCollectorSap    = dataCollectorSap;
 }
Beispiel #11
0
        public static void Main()
        {
            var                log      = Create.serverLogger(135);
            var                idaLog   = new IdaLog();
            string             salesOrg = "ZA01";
            IDBServerConnector dbServer = Create.dbServer();
            string             id       = $"{DateTime.Now} {Environment.MachineName}";

            idaLog.insertToActivityLog("KiwiConversions", "start", id, salesOrg);
            log.start();
            ISAPLib                 sapLib           = Create.sapLib();
            DataCollectorSap        dataCollector    = new DataCollectorSap(sapLib, Create.exportParses());
            List <ZV04IProperty>    zv04IList        = dataCollector.getZV04IList(salesOrg, IDAEnum.Task.quantityConversion);
            KiwiConversionException kiwiExceptionObj = new KiwiConversionException();

            //removes lines that match exception criteria from zv04iList for furthur calculation
            zv04IList = zv04IList.Where(x => !(kiwiExceptionObj.material.Contains(x.material) && kiwiExceptionObj.soldTo.Contains(x.soldTo))).ToList();

            var  orderList              = zv04IList.Select(x => x.order);
            long maxOrder               = orderList.Max();
            long minOrder               = orderList.Min();
            var  conversionDAO          = new ConversionDAO(dbServer);
            var  materialConversionList = conversionDAO.getQuantityConversionMaterialList();
            var  shipToConversionList   = conversionDAO.getQuantityConversionShipToList();
            var  logConversionList      = conversionDAO.getQuantityConversionLogList(minOrder, maxOrder);
            var  dataCompareService     = new DataCompareService();
            var  salesDocumetList       = dataCompareService.getSalesDocumentToChangeQuantity(zv04IList, shipToConversionList, materialConversionList);

            dataCompareService.removeAlreadyConvertedLines(logConversionList, ref salesDocumetList);
            var    mailUtil     = Create.mailUtil();
            var    emailService = new EmailService(mailUtil);
            var    distList     = new DistributionListCalculator(dbServer);
            string emails       = distList.getDistList(salesOrg, "quantityConversions");

            if (salesDocumetList.Count > 0)
            {
                try {
                    emailService.sendEmailNotification(emails, "", "ZA01 Kiwi conversion", salesDocumetList);
                } catch (Exception) {
                    mailUtil.mailSimple(IDAConsts.adminEmail, $"{salesOrg} Kiwi Conv: Error {Information.Err().Description}", $"Empty mail list for this task");
                }
                IVA02 va02 = new VA02(sapLib, idaLog);
                QuantityConversionVA02Runner va02Runner = new QuantityConversionVA02Runner(sapLib, idaLog, va02);

                try {
                    foreach (var document in salesDocumetList)
                    {
                        va02Runner.runQuantityChange(document);
                    }
                } catch (Exception ex) {
                    string filepath  = $"{IDAConsts.Paths.errorFilePath}{salesOrg} Kiwi error: {DateTime.Now}";
                    var    sTextFile = new System.Text.StringBuilder();
                    if (!System.IO.File.Exists(filepath))
                    {
                        System.IO.File.Create(filepath).Dispose();
                    }

                    sTextFile.AppendLine(ex.StackTrace);
                    System.IO.File.AppendAllText(filepath, sTextFile.ToString());
                    mailUtil.mailSimple(IDAConsts.adminEmail, $"{salesOrg} Kiwi Conv: Error {Information.Err().Number}", $"{mailUtil.getLink(filepath, "Your error info is here")}");
                    log.finish("fail");
                    idaLog.insertToActivityLog("KiwiConversions", "fail", id, salesOrg);
                    return;
                }

                log.finish("success");
                idaLog.insertToActivityLog("KiwiConversions", "success", id, salesOrg);
                logConversionList = conversionDAO.getQuantityConversionLogList(minOrder, maxOrder);
                dataCompareService.removeAlreadyConvertedLines(logConversionList, ref salesDocumetList);
                if (salesDocumetList.Count > 0)
                {
                    emailService.sendEmailNotification(emails, "", "ZA01 Kiwi conversion failed items", salesDocumetList);
                }
            }
            else
            {
                try {
                    mailUtil.mailSimple(emails, $"ZA01 Kiwi conversion {DateTime.Now}", "No Kiwi conversions found");
                } catch (Exception) {
                    mailUtil.mailSimple($"{IDAConsts.adminEmail};{Environment.UserName}", $"{salesOrg} Kiwi Conv: Error {Information.Err().Description}", $"Empty mail list for this task");
                }

                idaLog.insertToActivityLog("KiwiConversions", "empty list", id, salesOrg);
                log.finish("empty list");
            }
        }
Beispiel #12
0
        public static void executePastPOdate(string salesOrg)
        {
            var    idaLog = new IdaLog();
            string id     = $"{DateTime.Now} {Environment.MachineName}";


            // idaLog.insertToActivityLog("FloorCuts", "startTime", id, salesOrg);

            var dbServer = Create.dbServer();

            var sap = Create.sapLib();
            DataCollectorServer          dcServer  = new DataCollectorServer(dbServer);
            DataCollectorSap             dcSap     = new DataCollectorSap(sap, Create.exportParses());
            DataCollectorServiceFloorCut dcService = new DataCollectorServiceFloorCut(dcServer, dcSap);

            DistributionListCalculator distList = new DistributionListCalculator(dbServer);
            string email = distList.getDistList(salesOrg, "FloorCuts");
            //string email = "*****@*****.**";
            List <int> ZPURRSList = dcService.getpastPOdates(salesOrg);
            IMailUtil  mu         = Create.mailUtil();

            //List<List<int>> list = new List<List<int>>();
            if (ZPURRSList is null)
            {
                mu.mailSimple(email, $"{salesOrg} Orders with past PO date {DateTime.Now}", $"Hello<br><br><br>There are no Orders with past PO date<br><br>Kind Regards<br>IDA");

                return;
            }
            List <string> MD04List = new List <string>();
            var           listMD04 = new List <MD04Property>();

            foreach (int item in ZPURRSList)
            {
                string item1 = item.ToString();
                listMD04 = dcService.getMD04(item1, listMD04, salesOrg);
            }
            List <ZV04IProperty> finalList = new List <ZV04IProperty>();

            if (listMD04.Count == 0)
            {
                mu.mailSimple(email, $"{salesOrg} Orders with past PO date {DateTime.Now}", $"Hello<br><br><br>There are no Orders with past PO date<br><br>Kind Regards<br>IDA");
                return;
            }



            else
            {
                finalList = dcService.checkStock(listMD04, salesOrg);
            }
            //ArrayList cats = new ArrayList();
            if (!(finalList is null) && (finalList.Count > 0))
            {
                switch (salesOrg.ToUpper())
                {
                case "ES01":
                case "PT01":
                case "PL01":
                case "CZ01":
                    //foreach (MD04Property item in listMD04) {
                    //    cats.AddRange(item.sku, item.plant);
                    //}
                    //var cats = (from item in listMD04
                    //            select new { item.sku, item.plant })
                    //                          .ToList();
                    //var results = listMD04.Select(x => new MD04Property() {
                    //    plant = x.plant,

                    //}).ToList();
                    var results = (from a in finalList
                                   select new  ES_PT_PL_CZ_list {
                        OrderNumber = a.order, RDD = a.reqDelDate, Material = a.material, MaterialDescription = a.materialDescription, UPC = a.upc, orderQty = a.orderQty, confirmedQty = a.confirmedQty, pONumber = a.pONumber, shipToName = a.shipToName
                    }).ToList();

                    mu.mailSimple(email, $"{salesOrg} {DateTime.Now} PO past report date:", $"Hello<br><br>{mu.listToHTMLtable(results)}<br><br>Find report with PO Past of today<br>IDA");

                    //sendEmailWithExcelFile(salesOrg, results, mu, email);


                    break;

                case "ZA01":
                case "NG01":
                case "KE02":
                    var results1 = (from a in finalList
                                    select new ZA_NG_KElist {
                        OrderNumber = a.order, docTyp = a.docTyp, docDate = a.docDate, RDD = a.reqDelDate, Material = a.material, MaterialDescription = a.materialDescription, orderQty = a.orderQty, confirmedQty = a.confirmedQty, pONumber = a.pONumber, shipToName = a.shipToName
                    }).ToList();

                    mu.mailSimple(email, $"{salesOrg} {DateTime.Now} PO past report date:", $"Hello<br><br>{mu.listToHTMLtable(results1)}<br><br>Find report with PO Past of today<br>IDA");
                    //sendEmailWithExcelFile(salesOrg, results1, mu, email);
                    break;

                case "GB01":
                case "NL01":
                    var results2 = (from a in finalList
                                    select new GB_NL_list {
                        OrderNumber = a.order, docTyp = a.docTyp, RDD = a.reqDelDate, Material = a.material, MaterialDescription = a.materialDescription, orderQty = a.orderQty, confirmedQty = a.confirmedQty, pONumber = a.pONumber, soldTo = a.soldTo, soldToName = a.soldToName, shipToName = a.shipToName, shipTo = a.shipTo
                    }).ToList();

                    mu.mailSimple(email, $"{salesOrg} {DateTime.Now} PO past report date:", $"Hello<br><br>{mu.listToHTMLtable(results2)}<br><br>Find report with PO Past of today<br>IDA");
                    break;

                case "IT01":
                case "RO01":
                    var results3 = (from a in finalList
                                    select new IT_RO_list {
                        OrderNumber = a.order, docTyp = a.docTyp, RDD = a.reqDelDate, Material = a.material, MaterialDescription = a.materialDescription, UPC = a.upc, orderQty = a.orderQty, confirmedQty = a.confirmedQty, pONumber = a.pONumber, soldTo = a.soldTo, soldToName = a.soldToName, shipToName = a.shipToName, shipTo = a.shipTo
                    }).ToList();

                    mu.mailSimple(email, $"{salesOrg} {DateTime.Now} PO past report date:", $"Hello<br><br>{mu.listToHTMLtable(results3)}<br><br>Find report with PO Past of today<br>IDA");

                    break;

                case "DE01":
                    var results4 = (from a in finalList
                                    select new DE_list {
                        OrderNumber = a.order, RDD = a.reqDelDate, Material = a.material, MaterialDescription = a.materialDescription, UPC = a.upc, plant = a.plant, orderQty = a.orderQty, confirmedQty = a.confirmedQty, pONumber = a.pONumber, shipToName = a.shipToName, shipTo = a.shipTo, csrAsr = a.csrAsr
                    }).ToList();

                    mu.mailSimple(email, $"{salesOrg} {DateTime.Now} PO past report date:", $"Hello<br><br>{mu.listToHTMLtable(results4)}<br><br>Find report with PO Past of today<br>IDA");
                    break;

                case "FR01":
                    var results5 = (from a in finalList
                                    select new FR_list {
                        OrderNumber = a.order, docTyp = a.docTyp, RDD = a.reqDelDate, Material = a.material, MaterialDescription = a.materialDescription, orderQty = a.orderQty, confirmedQty = a.confirmedQty, pONumber = a.pONumber, soldTo = a.soldTo, soldToName = a.soldToName, shipToName = a.shipToName, shipTo = a.shipTo, csrAsr = a.csrAsr
                    }).ToList();

                    mu.mailSimple(email, $"{salesOrg} {DateTime.Now} PO past report date:", $"Hello<br><br>{mu.listToHTMLtable(results5)}<br><br>Find report with PO Past of today<br>IDA");
                    break;

                case "GR01":
                    var results6 = (from a in finalList
                                    select new GR_list {
                        OrderNumber = a.order, RDD = a.reqDelDate, Material = a.material, MaterialDescription = a.materialDescription, orderQty = a.orderQty, confirmedQty = a.confirmedQty, pONumber = a.pONumber, soldTo = a.soldTo, soldToName = a.soldToName, shipToName = a.shipToName, shipTo = a.shipTo
                    }).ToList();

                    mu.mailSimple(email, $"{salesOrg} {DateTime.Now} PO past report date:", $"Hello<br><br>{mu.listToHTMLtable(results6)}<br><br>Find report with PO Past of today<br>IDA");
                    break;

                case "RU01":
                    var results7 = (from a in finalList
                                    select new RU_list {
                        OrderNumber = a.order, docDate = a.docDate, RDD = a.reqDelDate, Material = a.material, MaterialDescription = a.materialDescription, orderQty = a.orderQty, confirmedQty = a.confirmedQty, pONumber = a.pONumber, soldTo = a.soldTo, soldToName = a.soldToName
                    }).ToList();

                    mu.mailSimple(email, $"{salesOrg} {DateTime.Now} PO past report date:", $"Hello<br><br>{mu.listToHTMLtable(results7)}<br><br>Find report with PO Past of today<br>IDA");
                    break;

                case "TR01":
                    var results8 = (from a in finalList
                                    select new TR_list {
                        OrderNumber = a.order, docDate = a.docDate, RDD = a.reqDelDate, Material = a.material, MaterialDescription = a.materialDescription, orderQty = a.orderQty, confirmedQty = a.confirmedQty, pONumber = a.pONumber, soldTo = a.soldTo, soldToName = a.soldToName, shipToName = a.shipToName, shipTo = a.shipTo
                    }).ToList();

                    mu.mailSimple(email, $"{salesOrg} {DateTime.Now} PO past report date:", $"Hello<br><br>{mu.listToHTMLtable(results8)}<br><br>Find report with PO Past of today<br>IDA");
                    break;

                default:

                    break;
                }
            }