Ejemplo n.º 1
0
        // METHOD HEADER COMMENT -------------------------------------------------------------------------------

        /**
         *	\fn             SummerizeTrip
         *	\brief			This method generates a summary of route trip data
         *	\param[in]      List<FC_RouteSeg> inData
         *	\param[out]	    none
         *	\return		    RouteSumData
         * ---------------------------------------------------------------------------------------------------- */
        public RouteSumData SummerizeTrip(List <FC_RouteSeg> inData)
        {
            RouteSumData outData = new RouteSumData();

            foreach (FC_RouteSeg x in inData)
            {
                outData.totalDriveTime += x.DrivenTime;

                outData.totalTripTime += x.DrivenTime;

                outData.totalTripTime += x.PickUpTime;
                outData.totalTripTime += x.DropOffTime;
                outData.totalTripTime += x.LtlTime;

                outData.totalKM += x.KM;
            }

            TMSLogger.LogIt(" | " + "MappingClass.cs" + " | " + "RouteSumData" + " | " + "SummerizeTrip" + " | " + "Confirmation" + " | " + "Trip summarized" + " | ");

            return(outData);
        }
Ejemplo n.º 2
0
        public static double GenerateInvoiceTotal(FC_LocalContract inContract)
        {
            List <FC_TripTicket> AllTickets = ConnectedTickets_Populate(inContract);

            MappingClass       map           = new MappingClass();
            List <FC_RouteSeg> TempRouteSegs = map.GetTravelData(inContract.Origin, inContract.Destination, 1, 1);

            double Total_Cost = 0;

            foreach (FC_TripTicket x in AllTickets)
            {
                List <FC_RouteSeg> TotalContractSegments = new List <FC_RouteSeg>();

                List <FC_RouteSeg> segments = RoutSegsPerTicket_Populate(x);

                for (int i = 0; i < TempRouteSegs.Count; i++)
                {
                    TotalContractSegments.Add(segments[i]);
                }

                RouteSumData sumData = new RouteSumData();
                sumData = sumData.SummerizeTrip(TotalContractSegments);

                string query = "select FC_CarrierID, CityName, FTL_Availibility, LTL_Availibility, FTL_Rate, LTL_Rate, Reefer_Charge " +
                               "from FC_DepotCity " +
                               "where FC_CarrierID = " + x.FC_CarrierID.ToString() + " and CityName = \"" + inContract.Origin + "\";";

                FC_DepotCity        d            = new FC_DepotCity();
                List <FC_DepotCity> theDepotCity = d.ObjToTable(SQL.Select(d, query));

                double tempPrice = 0;

                if (inContract.Job_type == 0)
                {
                    tempPrice = sumData.totalKM * theDepotCity[0].FTL_Rate * 1.08;
                }
                else
                {
                    query = "select * from FC_TripTicketLine where FC_TripTicketID = " + x.FC_TripTicketID.ToString() + " and FC_LocalContractID =  " + inContract.FC_LocalContractID.ToString() + " ;";

                    FC_TripTicketLine        t             = new FC_TripTicketLine();
                    List <FC_TripTicketLine> theTicketLine = t.ObjToTable(SQL.Select(t, query));

                    int QuantityOnTruck = theTicketLine[0].PalletsOnTicket;

                    if (QuantityOnTruck == 0)
                    {
                        QuantityOnTruck = 26;
                    }

                    tempPrice = sumData.totalKM * theDepotCity[0].LTL_Rate * QuantityOnTruck * 1.05;
                }

                if (inContract.Van_type == 1)
                {
                    tempPrice *= (theDepotCity[0].Reefer_Charge + 1);
                }

                Total_Cost += tempPrice;
            }

            try
            {
                Total_Cost = Math.Round(Total_Cost, 2);
            }
            catch (Exception e)
            {
                TMSLogger.LogIt(" | " + "PlannerClass.cs" + " | " + "PlannerClass" + " | " + "GenerateInvoiceTotal" + " | " + e.GetType().ToString() + " | " + e.Message + " | ");
            }


            TMSLogger.LogIt(" | " + "PlannerClass.cs" + " | " + "PlannerClass" + " | " + "GenerateInvoiceTotal" + " | " + "Confirmation" + " | " + "Invoice total generated" + " | ");

            return(Total_Cost);
        }