// METHOD HEADER COMMENT ------------------------------------------------------------------------------- /** * \fn CreatTripInfo * \brief This inserts data into the columns for the Trip Ticket table * \param[in] FC_LocalContract inContract, FC_Carrier inCarrier, FC_TripTicket partTicket * \param[out] None * \return None * ---------------------------------------------------------------------------------------------------- */ public CreateTripInfo(FC_LocalContract inContract, FC_Carrier inCarrier, FC_TripTicket partTicket) { FC_TripTicket theTicket = new FC_TripTicket(); theTicket.FC_TripTicketID = SQL.GetNextID("FC_TripTicket"); theTicket.FC_CarrierID = inCarrier.FC_CarrierID; theTicket.Days_Passes = 0; theTicket.Size_in_Palettes = partTicket.Size_in_Palettes; theTicket.Is_Complete = 0; //0 is not done. 1 is done theTicket.CurrentLocation = inContract.Origin; SQL.Insert(theTicket); MappingClass mapping = new MappingClass(); List <FC_RouteSeg> routeSegs = mapping.GetTravelData(inContract.Origin, inContract.Destination, inContract.Job_type, theTicket.FC_TripTicketID); foreach (FC_RouteSeg x in routeSegs) { SQL.Insert(x); } FC_TripTicketLine tripTicketLine = new FC_TripTicketLine(theTicket.FC_TripTicketID, inContract.FC_LocalContractID, partTicket.Size_in_Palettes); SQL.Insert(tripTicketLine); TMSLogger.LogIt(" | " + "CreateTripInfo.cs" + " | " + "CreateTripInfo" + " | " + "CreateTripInfo" + " | " + "Confirmation" + " | " + "Trip info created" + " | "); }
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); }
public static int AddContractToTicket(FC_TripTicket OriginalTick, FC_TripTicket TempTicket, FC_LocalContract TheContract) { string Query = "select * from FC_RouteSeg where FC_TripTicketID = " + OriginalTick.FC_TripTicketID + ";"; FC_RouteSeg r = new FC_RouteSeg(); List <FC_RouteSeg> OriginalSegs = r.ObjToTable(SQL.Select(r, Query)); MappingClass map = new MappingClass(); List <FC_RouteSeg> NewSegs = map.GetTravelData(TheContract.Origin, TheContract.Destination, 0, -1); //check that these tickets are going in the same direction if (OriginalSegs[0].CityA == NewSegs[0].CityA && OriginalSegs[0].CityB == NewSegs[0].CityB && TempTicket.Size_in_Palettes != 0) { int PalletesAddedToOgrinal = 26 - OriginalTick.Size_in_Palettes; if (PalletesAddedToOgrinal > TempTicket.Size_in_Palettes) { PalletesAddedToOgrinal = TempTicket.Size_in_Palettes; } int OrignalTickNewSize = OriginalTick.Size_in_Palettes + PalletesAddedToOgrinal; if (OrignalTickNewSize == 26) { OrignalTickNewSize = 0; } string query = "update FC_TripTicket " + "set Size_in_Palettes = " + OrignalTickNewSize + " where FC_TripTicketID = " + OriginalTick.FC_TripTicketID + ";"; SQL.GenericFunction(query); int FTL = 0; List <FC_RouteSeg> NewSegmentsFTL = new List <FC_RouteSeg>(); List <FC_RouteSeg> NewSegmentsLTL = new List <FC_RouteSeg>(); if (NewSegs.Count > OriginalSegs.Count) { string orginCity = LoadCSV.ToCityName(OriginalSegs[0].CityA); string EndOfFTL = LoadCSV.ToCityName(OriginalSegs[OriginalSegs.Count - 1].CityB); string startLTL = LoadCSV.ToCityName(NewSegs[OriginalSegs.Count].CityA); string endCity = LoadCSV.ToCityName(NewSegs[NewSegs.Count - 1].CityB); NewSegmentsFTL = map.GetTravelData(orginCity, EndOfFTL, FTL, OriginalTick.FC_TripTicketID); NewSegmentsLTL = map.GetTravelData(startLTL, endCity, 1, OriginalTick.FC_TripTicketID); } else if (NewSegs.Count < OriginalSegs.Count) { string orginCity = LoadCSV.ToCityName(OriginalSegs[0].CityA); string EndOfFTL = LoadCSV.ToCityName(NewSegs[NewSegs.Count - 1].CityB); string startLTL = LoadCSV.ToCityName(OriginalSegs[NewSegs.Count].CityA); string endCity = LoadCSV.ToCityName(OriginalSegs[OriginalSegs.Count - 1].CityB); NewSegmentsFTL = map.GetTravelData(orginCity, EndOfFTL, FTL, OriginalTick.FC_TripTicketID); NewSegmentsLTL = map.GetTravelData(startLTL, endCity, 1, OriginalTick.FC_TripTicketID); } else { string orginCity = LoadCSV.ToCityName(OriginalSegs[0].CityA); string endCity = LoadCSV.ToCityName(OriginalSegs[NewSegs.Count - 1].CityB); NewSegmentsLTL = map.GetTravelData(orginCity, endCity, FTL, OriginalTick.FC_TripTicketID); } if (NewSegmentsLTL != null) { NewSegmentsLTL[0].PickUpTime = 0; } query = "delete from FC_RouteSeg where FC_TripTicketID = " + OriginalTick.FC_TripTicketID + ";"; SQL.GenericFunction(query); foreach (FC_RouteSeg x in NewSegmentsFTL) { SQL.Insert(x); } foreach (FC_RouteSeg x in NewSegmentsLTL) { SQL.Insert(x); } FC_TripTicketLine NewLine = new FC_TripTicketLine(OriginalTick.FC_TripTicketID, TheContract.FC_LocalContractID, PalletesAddedToOgrinal); SQL.Insert(NewLine); TMSLogger.LogIt(" | " + "PlannerClass.cs" + " | " + "PlannerClass" + " | " + "AddContractToTicket" + " | " + "Confirmation" + " | " + "Contract added to ticket" + " | "); return(PalletesAddedToOgrinal); } return(-1); }