mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
- 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:
@@ -306,5 +306,85 @@ export default (tenantDb) => {
|
||||
};
|
||||
});
|
||||
|
||||
factory.define('sale_estimate', 'sales_estimates', async () => {
|
||||
const customer = await factory.create('customer');
|
||||
|
||||
return {
|
||||
customer_id: customer.id,
|
||||
estimate_date: faker.date.past,
|
||||
expiration_date: faker.date.future,
|
||||
reference: '',
|
||||
estimate_number: faker.random.number,
|
||||
note: '',
|
||||
terms_conditions: '',
|
||||
};
|
||||
});
|
||||
|
||||
factory.define('sale_estimate_entry', 'sales_estimate_entries', async () => {
|
||||
const estimate = await factory.create('sale_estimate');
|
||||
const item = await factory.create('item');
|
||||
|
||||
return {
|
||||
estimate_id: estimate.id,
|
||||
item_id: item.id,
|
||||
description: '',
|
||||
discount: faker.random.number,
|
||||
quantity: faker.random.number,
|
||||
rate: faker.random.number,
|
||||
};
|
||||
});
|
||||
|
||||
factory.define('sale_receipt', 'sales_receipts', async () => {
|
||||
const depositAccount = await factory.create('account');
|
||||
const customer = await factory.create('customer');
|
||||
|
||||
return {
|
||||
deposit_account_id: depositAccount.id,
|
||||
customer_id: customer.id,
|
||||
reference_no: faker.random.number,
|
||||
receipt_date: faker.date.past,
|
||||
};
|
||||
});
|
||||
|
||||
factory.define('sale_receipt_entry', 'sales_receipt_entries', async () => {
|
||||
const saleReceipt = await factory.create('sale_receipt');
|
||||
const item = await factory.create('item');
|
||||
|
||||
return {
|
||||
sale_receipt_id: saleReceipt.id,
|
||||
item_id: item.id,
|
||||
rate: faker.random.number,
|
||||
quantity: faker.random.number,
|
||||
};
|
||||
});
|
||||
|
||||
factory.define('sale_invoice', 'sales_invoices', async () => {
|
||||
|
||||
return {
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
factory.define('sale_invoice_entry', 'sales_invoices_entries', async () => {
|
||||
return {
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
factory.define('payment_receive', 'payment_receives', async () => {
|
||||
|
||||
});
|
||||
|
||||
factory.define('payment_receive_entry', 'payment_receives_entries', async () => {
|
||||
|
||||
});
|
||||
|
||||
|
||||
factory.define('bill', 'bills', async () => {
|
||||
return {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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');
|
||||
};
|
||||
@@ -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');
|
||||
};
|
||||
@@ -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');
|
||||
};
|
||||
@@ -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') ;
|
||||
};
|
||||
@@ -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');
|
||||
};
|
||||
@@ -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');
|
||||
};
|
||||
@@ -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');
|
||||
};
|
||||
@@ -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');
|
||||
};
|
||||
@@ -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');
|
||||
};
|
||||
@@ -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) {
|
||||
|
||||
};
|
||||
@@ -14,6 +14,10 @@ exports.seed = (knex) => {
|
||||
{ id: 5, name: 'items_categories' },
|
||||
{ id: 6, name: 'customers' },
|
||||
{ id: 7, name: 'vendors' },
|
||||
{ id: 9, name: 'sales_estimates' },
|
||||
{ id: 10, name: 'sales_receipts' },
|
||||
{ id: 11, name: 'sales_invoices' },
|
||||
{ id: 12, name: 'sales_payment_receives' },
|
||||
]);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user