- 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');
};

View File

@@ -119,8 +119,8 @@ exports.seed = (knex) => {
name: 'Cost of Goods Sold (COGS)',
key: 'cost_of_goods_sold',
normal: 'debit',
root_type: 'asset',
child_type: 'current_asset',
root_type: 'expenses',
child_type: 'expenses',
balance_sheet: true,
income_sheet: false,
},

View File

@@ -126,6 +126,16 @@ exports.seed = (knex) => {
index: 1,
predefined: 1,
},
{
id: 12,
name: 'Cost of Goods Sold (COGS)',
account_type_id: 12,
predefined: 1,
parent_account_id: null,
index: 1,
active: 1,
description: 1,
}
]);
});
};

View File

@@ -18,6 +18,8 @@ exports.seed = (knex) => {
{ id: 10, name: 'sales_receipts' },
{ id: 11, name: 'sales_invoices' },
{ id: 12, name: 'sales_payment_receives' },
{ id: 13, name: 'bills' },
{ id: 14, name: 'bill_payments' },
]);
});
};

View File

@@ -271,6 +271,154 @@ exports.seed = (knex) => {
predefined: 1,
columnable: true,
},
// Sales Estimates
{
label_name: 'Customer name',
key: 'customer_name',
},
{
label_name: 'Amount',
key: 'amount',
},
{
label_name: 'Estimate number',
key: 'estimate_number',
},
{
label_name: 'Estimate date',
key: 'estimate_date',
},
{
label_name: 'Expiration date',
key: 'expiration_date',
},
{
label_name: 'Reference',
key: 'reference',
},
{
label_name: 'Terms and conditions',
key: 'terms_conditions',
},
{
label_name: 'Note',
key: 'note',
},
// Sales invoices
// {
// label_name: 'Customer name',
// ley: 'customer_name',
// },
// {
// label_name: 'Amount',
// ley: 'amount',
// },
// {
// label_name: 'Invoice number',
// ley: 'invoice_no',
// },
// {
// label_name: 'Invoice date',
// ley: 'invoice_date',
// },
// {
// label_name: 'Reference',
// ley: 'reference',
// },
// {
// label_name: 'Payment amount',
// ley: 'payment_amount',
// },
// {
// label_name: 'Invoice message',
// ley: 'invoice_no',
// },
// {
// label_name: 'Terms and conditions',
// key: 'terms_conditions',
// },
// // Sales receipts
// {
// label_name: 'Deposit account',
// key: 'deposit_account',
// },
// {
// label_name: 'Customer name',
// key: 'customer_name',
// },
// {
// label_name: 'Receipt date',
// key: 'receipt_date',
// },
// {
// label_name: 'Reference No',
// key: 'reference',
// },
// {
// label_name: 'Receipt message',
// key: 'receipt_message',
// },
// {
// label_name: 'Sent to email',
// key: 'email_send_to',
// },
// // Payment Receives
// {
// label_name: 'Customer name',
// key: 'customer_name',
// },
// {
// label_name: 'Payment date',
// key: 'payment_date',
// },
// {
// label_name: 'Amount',
// key: 'amount',
// },
// {
// label_name: 'Reference No',
// key: 'reference',
// },
// {
// label_name: 'Deposit account',
// key: 'deposit_account',
// },
// {
// label_name: 'Payment receive no.',
// key: 'payment_receive_no',
// },
// // Purchases bills.
// {
// label_name: 'Bill number',
// key: 'bill_number'
// },
// {
// label_name: 'Bill date',
// key: 'bill_date'
// },
// {
// label_name: 'Amount',
// key: 'amount'
// },
// {
// label_name: 'Vendor name',
// key: 'vendor_name'
// },
// {
// label_name: 'Due date',
// key: 'due_date'
// },
// {
// label_name: 'Note',
// key: 'note'
// },
]);
});
};