- feat: Sales estimates.

- feat: Sales invoices.
- feat: Sales payment receives.
- feat: Purchases bills.
- feat: Purchases bills payments that made to the vendors.
This commit is contained in:
Ahmed Bouhuolia
2020-08-03 22:46:50 +02:00
parent 56278a25f0
commit db28cd2aef
56 changed files with 3290 additions and 1208 deletions

View File

@@ -4,7 +4,7 @@ exports.up = function(knex) {
table.increments();
table.string('customer_type');
table.decimal('balance', 13, 3);
table.decimal('balance', 13, 3).defaultTo(0);
table.string('first_name').nullable();
table.string('last_name').nullable();
@@ -36,6 +36,7 @@ exports.up = function(knex) {
table.text('note');
table.boolean('active').defaultTo(true);
table.timestamps();
});
};

View File

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

View File

@@ -2,6 +2,7 @@
exports.up = function(knex) {
return knex.schema.createTable('sales_estimates', (table) => {
table.increments();
table.decimal('amount', 13, 3);
table.integer('customer_id').unsigned();
table.date('estimate_date');
table.date('expiration_date');
@@ -9,6 +10,8 @@ exports.up = function(knex) {
table.string('estimate_number');
table.text('note');
table.text('terms_conditions');
table.integer('user_id').unsigned();
table.timestamps();
});
};

View File

@@ -1,16 +0,0 @@
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

@@ -2,6 +2,7 @@
exports.up = function(knex) {
return knex.schema.createTable('sales_receipts', table => {
table.increments();
table.decimal('amount', 13, 3);
table.integer('deposit_account_id').unsigned();
table.integer('customer_id').unsigned();
table.date('receipt_date');

View File

@@ -13,6 +13,8 @@ exports.up = function(knex) {
table.text('terms_conditions');
table.decimal('balance', 13, 3);
table.decimal('payment_amount', 13, 3);
table.timestamps();
});
};

View File

@@ -5,6 +5,7 @@ exports.up = function(knex) {
table.increments();
table.integer('customer_id').unsigned();
table.date('payment_date');
table.decimal('amount', 13, 3).defaultTo(0);
table.string('reference_no');
table.integer('deposit_account_id').unsigned();
table.string('payment_receive_no');

View File

@@ -1,17 +0,0 @@
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

@@ -2,11 +2,17 @@
exports.up = function(knex) {
return knex.schema.createTable('bills', (table) => {
table.increments();
table.integer('vendor_id').unsigned();
table.string('bill_number');
table.date('bill_date');
table.date('due_date');
table.integer('vendor_id').unsigned();
table.string('reference_no');
table.string('status');
table.text('note');
table.decimal('amount', 13, 3).defaultTo(0);
table.decimal('payment_amount', 13, 3).defaultTo(0);
table.timestamps();
});
};

View File

@@ -6,6 +6,7 @@ exports.up = function(knex) {
table.string('payment_number');
table.date('payment_date');
table.string('payment_method');
table.string('reference');
table.integer('user_id').unsigned();
table.text('description');
table.timestamps();

View File

@@ -0,0 +1,22 @@
exports.up = function(knex) {
return knex.schema.createTable('inventory_transactions', table => {
table.increments('id');
table.date('date');
table.string('direction');
table.integer('item_id');
table.integer('quantity');
table.decimal('rate', 13, 3);
table.integer('remaining');
table.string('transaction_type');
table.integer('transaction_id');
table.integer('inventory_transaction_id');
table.timestamps();
});
};
exports.down = function(knex) {
};

View File

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

View File

@@ -0,0 +1,14 @@
exports.up = function(knex) {
return knex.schema.createTable('bills_payments_entries', table => {
table.increments();
table.integer('bill_payment_id').unsigned();
table.integer('bill_id').unsigned();
table.decimal('payment_amount', 13, 3).unsigned();
})
};
exports.down = function(knex) {
return knex.schema.dropTableIfExists('bills_payments_entries');
};