Hi Guys!
i need some help, with recurring invoices or payments.

I have Application which i developed recently to my customer.
And inside of App i got a module to invoice clients, for a product, which this product is valid only for one year starting may for each year and end up 30 april each year.

so in this product, if the price is $1200, the client has option to select payments optionsm
if he will pay:
1: Imediate => full payment amount of $1200
2: 3 months => divide $1200 /3 = 400 per month, and email invoices as reminder in interval of 3 months.
3: 6 monhts => divide 1200 /6 = 200 per month, and email invoices as reminder in interval of 6 months.
4: 10 months => divide 1200 /10 = 120 per month, and email invoices as reminder in interval of 10 months.

So what i want to archive here, the payment doesent have fixed date, to send invoice, like send reminders on 28 of each months.
Because if the client signup ex: on 14/09/2016 the next invoice must be generated 2 days before 14/10/2016 and the cicle must repeat till the full amount was paid and payment can be online using Gateway such as PayPal or other gateway.

my invoice table look like this:

CREATE TABLE `invoices` (
  `uuid` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
  `client_id` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
  `number` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `invoice_date` date NOT NULL,
  `due_date` date NOT NULL,
  `status` int(11) NOT NULL,
  `discount` double(8,2) NOT NULL,
  `terms` text COLLATE utf8_unicode_ci NOT NULL,
  `notes` text COLLATE utf8_unicode_ci NOT NULL,
  `currency` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `increment_num` int(11) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `reference_number` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `user_created` varchar(36) COLLATE utf8_unicode_ci DEFAULT NULL,
  `user_updated` varchar(36) COLLATE utf8_unicode_ci DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

And my Invoice Itens look like this:

CREATE TABLE `invoice_items` (
  `uuid` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
  `invoice_id` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
  `item_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `item_description` text COLLATE utf8_unicode_ci NOT NULL,
  `quantity` double(8,2) NOT NULL,
  `price` double(15,2) NOT NULL,
  `tax_id` varchar(36) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

So how do i structure the recurring table to this scenario!
And the reminders must go with Cron Jobs.

Recommended Answers

All 2 Replies

Please describe precisely what each field represents so we can tell if you are missing something.

Member Avatar for diafol

Left the building?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.