...
ServContrHeader."Invoice Period"::"Half Year": DateFormula := '<6M>';
ServContrHeader."Invoice Period"::Year: DateFormula := '<1Y>';
END;
EntryNo := 0;
IF DATE2DMY(ServContrHeader."Starting Date",1) > 1 THEN BEGIN
// Delete the following lines.
InvoiceTo := FirstDate(CALCDATE('<CM>',ServContrHeader."Starting Date"),
ServContrHeader."Expiration Date");
InsertServLedgEntry(ServContrHeader."Starting Date",InvoiceTo);
InvoiceFrom := CALCDATE('<1D>',InvoiceTo);
END ELSE
InvoiceFrom := ServContrHeader."Starting Date";
InvoiceTo := CALCDATE(DateFormula,InvoiceFrom);
InvoiceTo := CALCDATE('<-CM>',InvoiceTo);
InvoiceTo := FirstDate(CALCDATE('<-1D>',InvoiceTo),ServContrHeader."Expiration Date");
// End of the lines.
InsertServLedgEntry(InvoiceFrom,InvoiceTo);
Stop := FALSE;
WHILE (InvoiceFrom <= InvoiceToDate) AND (NOT Stop) DO BEGIN
InvoiceFrom := CALCDATE('<1D>',InvoiceTo);
InvoiceTo := CALCDATE(DateFormula,InvoiceFrom);
...
...
ServContrHeader."Invoice Period"::"Half Year": DateFormula := '<6M>';
ServContrHeader."Invoice Period"::Year: DateFormula := '<1Y>';
END;
EntryNo := 0;
IF DATE2DMY(ServContrHeader."Starting Date",1) > 1 THEN BEGIN
// Add the following lines.
IF ServContrHeader."Expiration Date" <> 0D THEN BEGIN
InvoiceTo := FirstDate(CALCDATE('<CM>',ServContrHeader."Starting Date"),
ServContrHeader."Expiration Date");
InvoiceFrom := CALCDATE('<1D>',InvoiceTo);
END ELSE
InvoiceFrom := ServContrHeader."Starting Date";
InsertServLedgEntry(ServContrHeader."Starting Date",InvoiceTo);
END ELSE
InvoiceFrom := ServContrHeader."Starting Date";
InvoiceTo := CALCDATE(DateFormula,InvoiceFrom);
InvoiceTo := CALCDATE('<-CM>',InvoiceTo);
IF ServContrHeader."Expiration Date" <> 0D THEN
InvoiceTo := FirstDate(CALCDATE('<-1D>',InvoiceTo),ServContrHeader."Expiration Date");
// End of the lines.
InsertServLedgEntry(InvoiceFrom,InvoiceTo);
Stop := FALSE;
WHILE (InvoiceFrom <= InvoiceToDate) AND (NOT Stop) DO BEGIN
InvoiceFrom := CALCDATE('<1D>',InvoiceTo);
InvoiceTo := CALCDATE(DateFormula,InvoiceFrom);
...
...
Stop := FALSE;
WHILE (InvoiceFrom <= InvoiceToDate) AND (NOT Stop) DO BEGIN
InvoiceFrom := CALCDATE('<1D>',InvoiceTo);
InvoiceTo := CALCDATE(DateFormula,InvoiceFrom);
InvoiceTo := CALCDATE('<-CM>',InvoiceTo);
// Delete the following line.
InvoiceTo := FirstDate(CALCDATE('<-1D>',InvoiceTo),ServContrHeader."Expiration Date");
IF InvoiceFrom <= InvoiceToDate THEN
InsertServLedgEntry(InvoiceFrom,InvoiceTo);
IF (InvoiceTo = ServContrHeader."Expiration Date") THEN
Stop := TRUE;
END;
...
...
Stop := FALSE;
WHILE (InvoiceFrom <= InvoiceToDate) AND (NOT Stop) DO BEGIN
InvoiceFrom := CALCDATE('<1D>',InvoiceTo);
InvoiceTo := CALCDATE(DateFormula,InvoiceFrom);
InvoiceTo := CALCDATE('<-CM>',InvoiceTo);
// Add the following lines.
IF ServContrHeader."Expiration Date" <> 0D THEN
InvoiceTo := FirstDate(CALCDATE('<-1D>',InvoiceTo),ServContrHeader."Expiration Date");
// End of the lines.
IF InvoiceFrom <= InvoiceToDate THEN
InsertServLedgEntry(InvoiceFrom,InvoiceTo);
IF (InvoiceTo = ServContrHeader."Expiration Date") THEN
Stop := TRUE;
END;
...