- feat: Sales estimates APIs.

- feat: Sales invoices APIs.
- feat: Sales receipts APIs.
- WIP: Sales payment receipts.
- WIP: Purchases bills.
- WIP: Purchases payments made.
This commit is contained in:
Ahmed Bouhuolia
2020-07-22 02:03:12 +02:00
parent 9d9c7c1568
commit 56278a25f0
83 changed files with 5330 additions and 76 deletions

View File

@@ -5,13 +5,18 @@ exports.up = function (knex) {
table.string('name');
table.string('type');
table.string('sku');
table.decimal('cost_price', 13, 3).unsigned();
table.boolean('sellable');
table.boolean('purchasable');
table.decimal('sell_price', 13, 3).unsigned();
table.decimal('cost_price', 13, 3).unsigned();
table.string('currency_code', 3);
table.string('picture_uri');
table.integer('cost_account_id').unsigned();
table.integer('sell_account_id').unsigned();
table.integer('inventory_account_id').unsigned();
table.text('sell_description').nullable();
table.text('purchase_description').nullable();
table.integer('quantity_on_hand');
table.text('note').nullable();
table.integer('category_id').unsigned();
table.integer('user_id').unsigned();

View File

@@ -4,6 +4,8 @@ exports.up = function(knex) {
table.increments();
table.string('customer_type');
table.decimal('balance', 13, 3);
table.string('first_name').nullable();
table.string('last_name').nullable();
table.string('company_name').nullable();

View File

@@ -4,6 +4,8 @@ exports.up = function(knex) {
table.increments();
table.string('customer_type');
table.decimal('balance', 13, 3);
table.string('first_name').nullable();
table.string('last_name').nullable();
table.string('company_name').nullable();

View File

@@ -0,0 +1,18 @@
exports.up = function(knex) {
return knex.schema.createTable('sales_estimates', (table) => {
table.increments();
table.integer('customer_id').unsigned();
table.date('estimate_date');
table.date('expiration_date');
table.string('reference');
table.string('estimate_number');
table.text('note');
table.text('terms_conditions');
table.timestamps();
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('sales_estimates');
};

View File

@@ -0,0 +1,16 @@
exports.up = function(knex) {
return knex.schema.createTable('sales_estimate_entries', table => {
table.increments();
table.integer('estimate_id').unsigned();
table.integer('item_id').unsigned();
table.text('description');
table.integer('discount').unsigned();
table.integer('quantity').unsigned();
table.integer('rate').unsigned();
})
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('sales_estimate_entries');
};

View File

@@ -0,0 +1,18 @@
exports.up = function(knex) {
return knex.schema.createTable('sales_receipts', table => {
table.increments();
table.integer('deposit_account_id').unsigned();
table.integer('customer_id').unsigned();
table.date('receipt_date');
table.string('reference_no');
table.string('email_send_to');
table.text('receipt_message');
table.text('statement');
table.timestamps();
})
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('sales_receipts');
};

View File

@@ -0,0 +1,17 @@
exports.up = function(knex) {
return knex.schema.createTable('sales_receipt_entries', table => {
table.increments();
table.integer('sale_receipt_id').unsigned();
table.integer('index').unsigned();
table.integer('item_id');
table.text('description');
table.integer('discount').unsigned();
table.integer('quantity').unsigned();
table.integer('rate').unsigned();
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('sales_receipt_entries') ;
};

View File

@@ -0,0 +1,22 @@
exports.up = function(knex) {
return knex.schema.createTable('sales_invoices', table => {
table.increments();
table.integer('customer_id');
table.date('invoice_date');
table.date('due_date');
table.string('invoice_no');
table.string('reference_no');
table.string('status');
table.text('invoice_message');
table.text('terms_conditions');
table.decimal('balance', 13, 3);
table.timestamps();
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('sales_invoices');
};

View File

@@ -0,0 +1,17 @@
const { knexSnakeCaseMappers } = require("objection");
exports.up = function(knex) {
return knex.schema.createTable('payment_receives', (table) => {
table.increments();
table.integer('customer_id').unsigned();
table.date('payment_date');
table.string('reference_no');
table.integer('deposit_account_id').unsigned();
table.string('payment_receive_no');
table.timestamps();
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('payment_receives');
};

View File

@@ -0,0 +1,17 @@
exports.up = function(knex) {
return knex.schema.createTable('sales_invoices_entries', table => {
table.increments();
table.integer('sale_invoice_id').unsigned();
table.integer('item_id').unsigned();
table.integer('index').unsigned();
table.text('description');
table.integer('discount').unsigned();
table.integer('quantity').unsigned();
table.integer('rate').unsigned();
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('sales_invoices_entries');
};

View File

@@ -0,0 +1,13 @@
exports.up = function(knex) {
return knex.schema.createTable('payment_receives_entries', table => {
table.increments();
table.integer('payment_receive_id').unsigned();
table.integer('invoice_id').unsigned();
table.decimal('payment_amount').unsigned();
})
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('payment_receives_entries');
};

View File

@@ -0,0 +1,16 @@
exports.up = function(knex) {
return knex.schema.createTable('bills', (table) => {
table.increments();
table.string('bill_number');
table.date('bill_date');
table.date('due_date');
table.integer('vendor_id').unsigned();
table.text('note');
table.timestamps();
});
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('bills');
};

View File

@@ -0,0 +1,17 @@
exports.up = function(knex) {
return knex.schema.createTable('bills_payments', table => {
table.increments();
table.integer('payment_account_id');
table.string('payment_number');
table.date('payment_date');
table.string('payment_method');
table.integer('user_id').unsigned();
table.text('description');
table.timestamps();
});
};
exports.down = function(knex) {
};