No automatic signout

Voucher basic working
running tables shifted to cards from buttons, this gives us immense styling oportunities
This commit is contained in:
Amritanshu
2019-07-12 12:36:38 +05:30
parent 4513e8b263
commit bcad4cdae3
31 changed files with 1085 additions and 713 deletions

View File

@ -1,28 +1,28 @@
"\Program Files\PostgreSQL\10\bin\dropdb.exe" -U postgres petty
"\Program Files\PostgreSQL\10\bin\createdb.exe" -U postgres petty
"\Program Files\PostgreSQL\11\bin\dropdb.exe" -U postgres petty
"\Program Files\PostgreSQL\11\bin\createdb.exe" -U postgres petty
..\env\Scripts\initdb.exe ..\development.ini
..\env\Scripts\fixtures.exe ..\development.ini
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < a-Roles.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < b-Permissions.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < c-RolePermissions.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < d-Users.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < e-UserRoles.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < f-Customers.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < g-FoodTables.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < h-Taxes.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < i-ProductGroups.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < j-Products.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < k-Vouchers.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < l-Voucher-Food-Table.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < m-Kots.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < n-Inventories.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < o-Modifiers.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < p-InventoryModifiers.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < q-Locations.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < r-MachineLocations.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < s-Printers.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < t-PrintLocations.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < u-ProductGroupModifiers.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < v-Reprints.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < w-Settings.sql
"\Program Files\PostgreSQL\10\bin\psql.exe" -U postgres petty < x-VoucherSettlements.sql
rem "\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < a-Roles.sql
rem "\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < b-Permissions.sql
rem "\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < c-RolePermissions.sql
rem "\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < d-Users.sql
rem "\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < e-UserRoles.sql
"\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < f-Customers.sql
"\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < g-FoodTables.sql
"\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < h-Taxes.sql
"\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < i-MenuCategories.sql
"\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < j-SaleCategories.sql
"\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < k-Products.sql
"\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < l-Modifiers.sql
"\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < m-Sections.sql
"\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < n-Printers.sql
"\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < o-SectionPrinters.sql
"\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < p-Vouchers.sql
"\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < q-Kots.sql
"\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < r-Inventories.sql
"\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < s-InventoryModifiers.sql
"\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < t-Overview.sql
REM "\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < u-ProductGroupModifiers.sql
REM "\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < v-Reprints.sql
REM "\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < w-Settings.sql
REM "\Program Files\PostgreSQL\11\bin\psql.exe" -U postgres petty < x-VoucherSettlements.sql

View File

@ -4,22 +4,24 @@ call:copyQuery b-Permissions "SELECT 'INSERT INTO permissions(id, name) VALUES (
call:copyQuery c-RolePermissions "SELECT 'INSERT INTO role_permissions(id, permission_id, role_id) VALUES (''' + CAST(RoleGroupID AS Nvarchar(36)) + ''', ''' + CAST(RoleID AS Nvarchar(36)) + ''', ''' + CAST(GroupID AS Nvarchar(36)) + ''');' FROM Test.dbo.Auth_RoleGroups;"
call:copyQuery d-Users "SELECT 'INSERT INTO users(id, name, msr_string, password, locked_out) VALUES (''' + CAST(UserID AS Nvarchar(36)) + ''', ''' + Name + ''', ' + COALESCE('''' + MsrString + '''','null') + ', ''' + Password + ''', ' + CASE WHEN LockedOut = 1 THEN 'true' ELSE 'false' END + ');' FROM Test.dbo.Auth_Users;"
call:copyQuery e-UserRoles "SELECT 'INSERT INTO user_roles(id, user_id, role_id) VALUES (''' + CAST(UserGroupID AS Nvarchar(36)) + ''', ''' + CAST(UserID AS Nvarchar(36)) + ''', ''' + CAST(GroupID AS Nvarchar(36)) + ''');' FROM Test.dbo.Auth_UserGroups;"
call:copyQuery f-Customers "SELECT 'INSERT INTO customers(id, name, address, is_important, phone) VALUES (''' + CAST(CustomerID AS Nvarchar(36)) + ''', ''' + REPLACE(Name, '''', '''''') + ''', ''' + COALESCE(Address, 'null') + ''', ' + CASE WHEN Important = 1 THEN 'true' ELSE 'false' END + ', ''' + COALESCE(Phone, 'null') + ''');' FROM Test.dbo.Customers;"
call:copyQuery g-FoodTables "SELECT 'INSERT INTO food_tables(id, name, is_active, location, sort_order) VALUES (''' + CAST(FoodTableID AS Nvarchar(36)) + ''', ''' + Name + ''', ' + CASE WHEN IsActive = 1 THEN 'true' ELSE 'false' END + ', ''' + COALESCE(Location, 'null') + ''', ' + CAST(SortOrder AS Nvarchar(36)) + ');' FROM Test.dbo.FoodTables;"
call:copyQuery f-Customers "SELECT 'INSERT INTO customers(id, name, address, company, phone) VALUES (''' + CAST(CustomerID AS Nvarchar(36)) + ''', ''' + REPLACE(Name, '''', '''''') + ''', ''' + COALESCE(Address, 'null') + ''', '''', ''' + COALESCE(Phone, Name) + ''');' FROM Test.dbo.Customers WHERE CustomerID != '2c716f4b-0736-429a-ad51-610d7c47cb5e';"
call:copyQuery g-FoodTables "SELECT 'INSERT INTO food_tables(id, name, seats, is_active, section_id, sort_order) VALUES (''' + CAST(FoodTableID AS Nvarchar(36)) + ''', ''' + Name + ''', 0, ' + CASE WHEN IsActive = 1 THEN 'true' ELSE 'false' END + ', ''3f13f6e7-dc76-4fca-8fdb-b2bbf29b35df'', ' + CAST(SortOrder AS Nvarchar(36)) + ');' FROM Test.dbo.FoodTables;"
call:copyQuery h-Taxes "SELECT 'INSERT INTO taxes(id, name, rate, is_fixture) VALUES ('''+ CAST(TaxID AS Nvarchar(36)) + ''', ' + '''' + REPLACE(Name, '''', '''''') + '''' + ', ' + CAST(Rate AS Nvarchar(36)) + ', false);' FROM Test.dbo.Taxes;"
call:copyQuery i-ProductGroups "SELECT 'INSERT INTO menu_categories(id, name, discount_limit, is_active, is_fixture, sort_order) VALUES (''' + CAST(ProductGroupID AS Nvarchar(36)) + ''', ''' + REPLACE(Name, '''', '''''') + ''', ' + CAST(DiscountLimit AS nvarchar(36)) + ', ' + CASE WHEN IsActive = 1 THEN 'true' ELSE 'false' END + ', false, ' + CAST(SortOrder AS Nvarchar(36)) + ');' FROM Test.dbo.ProductGroups;"
call:copyQuery i-SaleCategories "SELECT 'INSERT INTO sale_categories(id, name, tax_id) VALUES (''' + CAST(newid() AS Nvarchar(36)) + ''', ''' + REPLACE(pgo.GroupType, '''', '''''') + ''', ''' + CAST((select top 1 t.TaxID from Test.dbo.Taxes t inner join Test.dbo.Products p on t.TaxID = p.VatID inner join Test.dbo.ProductGroups pg on p.ProductGroupID = pg.ProductGroupID where pg.GroupType = pgo.GroupType) AS Nvarchar(36)) + ''');' from (select distinct pgx.GroupType from Test.dbo.ProductGroups pgx) as pgo;"
call:copyQuery j-Products "SELECT 'INSERT INTO products(id, name, units, menu_category_id, sale_category_id, price, has_happy_hour, is_active, is_not_available, sort_order, quantity) VALUES (''' + CAST(ProductID AS Nvarchar(36)) + ''', ' + '''' + REPLACE(Name, '''', '''''') + '''' + ', ' + '''' + Units + '''' + ', ' + '''' + CAST(ProductGroupID AS Nvarchar(36)) + '''' + ', ' + '(select id from sale_categories where name = ''' + (SELECT GroupType FROM Test.dbo.ProductGroups pgs WHERE pgs.ProductGroupID = Products.ProductGroupID) + ''')' + ', ' + CAST(Price AS Nvarchar(36)) + ', ' + CASE WHEN HasHappyHour = 1 THEN 'true' ELSE 'false' END + ', ' + CASE WHEN IsActive = 1 THEN 'true' ELSE 'false' END + ', ' + CASE WHEN IsNotAvailable = 1 THEN 'true' ELSE 'false' END + ', ' + CAST(SortOrder AS Nvarchar(36)) + ', ' + CAST(Quantity AS Nvarchar(36)) + ');' FROM Test.dbo.Products;"
call:copyQuery k-Vouchers "SELECT 'INSERT INTO vouchers(id, date, pax, user_id, creation_date, last_edit_date, bill_id, food_table_id, customer_id, narration, is_void, void_reason, is_printed, voucher_type, kot_id) VALUES (''' + CAST(VoucherID AS Nvarchar(36)) + ''', ' + '''' + CONVERT(Nvarchar(36), Date, 126) + ''', ' + COALESCE(CAST(Pax AS Nvarchar(36)), 'null') + ', ' + '''' + CAST(UserID AS Nvarchar(36)) + ''', ' + '''' + CONVERT(Nvarchar(36), CreationDate, 126) + ''', ' + '''' + CONVERT(Nvarchar(36), LastEditDate, 126) + ''', ' + COALESCE(CAST(BillID AS Nvarchar(36)), 'null') + ', ' + '''' + CAST(TableID AS Nvarchar(36)) + ''', ' + '''' + CAST(CustomerID AS Nvarchar(36)) + ''', ' + COALESCE('''' + REPLACE(Narration, '''', '''''') + '''', 'null') + ', ' + CASE WHEN Void = 1 THEN 'true' ELSE 'false' END + ', ' + COALESCE('''' + REPLACE(VoidReason, '''', '''''') + '''', 'null') + ', ' + CASE WHEN Printed = 1 THEN 'true' ELSE 'false' END + ', ' + CAST(VoucherType AS Nvarchar(36)) + ', ' + CAST(KotID AS Nvarchar(36)) + ');' FROM Test.dbo.Vouchers;"
call:copyQuery l-Voucher-Food-Table "SELECT 'INSERT INTO voucher_food_table(id, voucher_id, food_table_id, status) VALUES (''' + CAST(newid() AS Nvarchar(36)) + ''', ' + '''' + CAST(VoucherID AS Nvarchar(36)) + ''', ' + '''' + CAST(FoodTableID AS Nvarchar(36)) + ''', ' + '''' + Status + ''');' FROM Test.dbo.FoodTables WHERE VoucherID IS NOT NULL;"
call:copyQuery m-Kots "SELECT 'INSERT INTO kots(id, voucher_id, code, food_table_id, date, user_id) VALUES (''' + CAST(KotID AS Nvarchar(36)) + ''', ' + '''' + CAST(VoucherID AS Nvarchar(36)) + '''' + ', ' + CAST(Code AS Nvarchar(36)) + ', ' + '''' + CAST(TableID AS Nvarchar(36)) + '''' + ', ' + '''' + CONVERT(Nvarchar(36), Date, 126) + ''', ' + '''' + CAST(UserID AS Nvarchar(36)) + '''' + ');' FROM Test.dbo.Kots;"
call:copyQuery n-Inventories "SELECT 'INSERT INTO inventories(id, kot_id, product_id, sort_order, quantity, price, is_happy_hour, service_charge, is_sc_taxable, service_tax_rate, vat_rate, service_tax_id, vat_id, discount) VALUES (''' + CAST(InventoryID AS Nvarchar(36)) + ''', ' + '''' + CAST(KotID AS Nvarchar(36)) + '''' + ', ' + '''' + CAST(ProductID AS Nvarchar(36)) + '''' + ', ' + CAST(SortOrder AS Nvarchar(36)) + ', ' + CAST(Quantity AS Nvarchar(36)) + ', ' + CAST(Price AS Nvarchar(36)) + ', ' + CASE WHEN IsHappyHour = 1 THEN 'true' ELSE 'false' END + ', ' + CAST(ServiceCharge AS Nvarchar(36)) + ', ' + CASE WHEN IsScTaxable = 1 THEN 'true' ELSE 'false' END + ', ' + CAST(ServiceTaxRate AS Nvarchar(36)) + ', ' + CAST(VatRate AS Nvarchar(36)) + ', ' + '''' + CAST(ServiceTaxID AS Nvarchar(36)) + '''' + ', ' + '''' + CAST(VatID AS Nvarchar(36)) + '''' + ', ' + CAST(Discount AS Nvarchar(36)) + ');' FROM Test.dbo.Inventories;"
call:copyQuery o-Modifiers "SELECT 'INSERT INTO modifiers(id, name, show_in_bill, is_active, modifier_category_id, price) VALUES (''' + CAST(ModifierID AS Nvarchar(36)) + ''', ' + '''' + REPLACE(Name, '''', '''''') + '''' + ', ' + CASE WHEN ShowInBill = 1 THEN 'true' ELSE 'false' END + ', true, {ID}, ' + CAST(Price AS Nvarchar(36)) + ');' FROM Test.dbo.Modifiers;"
call:copyQuery p-InventoryModifiers "SELECT 'INSERT INTO inventory_modifiers(id, inventory_id, modifier_id, price) VALUES (''' + CAST(InventoryModifierID AS Nvarchar(36)) + ''', ' + '''' + CAST(InventoryID AS Nvarchar(36)) + '''' + ', ' + '''' + CAST(ModifierID AS Nvarchar(36)) + '''' + ', 0);' FROM Test.dbo.InventoryModifiers;"
call:copyQuery q-Sections "SELECT 'INSERT INTO sections(id, name) VALUES (''' + CAST(NewID() AS Nvarchar(36)) + ''', ''' + Location + ''');' FROM Test.dbo.PrintLocations GROUP BY Location;"
call:copyQuery r-MachineLocations "SELECT 'INSERT INTO machine_locations(id, machine_name, location_id) SELECT ''' + CAST(MachineLocationID AS Nvarchar(36)) + ''', ' + '''' + REPLACE(Machine, '''', '''''') + '''' + ', id from locations where name = ' + '''' + REPLACE(Location, '''', '''''') + '''' + ';' FROM Test.dbo.MachineLocations;"
call:copyQuery s-Printers "SELECT 'INSERT INTO printers(id, name, address, cut_code) VALUES (''' + CAST(NewID() AS Nvarchar(36)) + ''', ''' + Printer + ''', ''' + ''' + Printer + ''', ''' + CutCode + ''');' FROM Test.dbo.PrintLocations GROUP BY Printer, CutCode;"
call:copyQuery t-SectionPrinters "SELECT 'INSERT INTO section_printers(id, menu_category_id, section_id, printer_id, copies) VALUES (''' + CAST(PrintLocationID AS Nvarchar(36)) + ''', ' + COALESCE('''' + CAST(ProductGroupID AS Nvarchar(36)) + '''','null') + ', ' + '(select id from sections where name = ''' + Location + ''')' + ', ' + '(select id from printers where name = ''' + Printer + ''')' + ', ' + CAST(Copies AS nvarchar(36)) + ');' FROM Test.dbo.PrintLocations;"
call:copyQuery i-MenuCategories "SELECT 'INSERT INTO menu_categories(id, name, discount_limit, is_active, is_fixture, sort_order) VALUES (''' + CAST(ProductGroupID AS Nvarchar(36)) + ''', ''' + REPLACE(Name, '''', '''''') + ''', ' + CAST(DiscountLimit AS nvarchar(36)) + ', ' + CASE WHEN IsActive = 1 THEN 'true' ELSE 'false' END + ', false, ' + CAST(SortOrder AS Nvarchar(36)) + ');' FROM Test.dbo.ProductGroups;"
call:copyQuery j-SaleCategories "SELECT 'INSERT INTO sale_categories(id, name, tax_id) VALUES (''' + CAST(newid() AS Nvarchar(36)) + ''', ''' + REPLACE(pgo.GroupType, '''', '''''') + ''', ''' + CAST((select top 1 t.TaxID from Test.dbo.Taxes t inner join Test.dbo.Products p on t.TaxID = p.VatID inner join Test.dbo.ProductGroups pg on p.ProductGroupID = pg.ProductGroupID where pg.GroupType = pgo.GroupType) AS Nvarchar(36)) + ''');' from (select distinct pgx.GroupType from Test.dbo.ProductGroups pgx) as pgo;"
call:copyQuery k-Products "SELECT 'INSERT INTO products(id, name, units, menu_category_id, sale_category_id, price, has_happy_hour, is_active, is_not_available, sort_order, quantity) VALUES (''' + CAST(ProductID AS Nvarchar(36)) + ''', ' + '''' + REPLACE(Name, '''', '''''') + '''' + ', ' + '''' + Units + '''' + ', ' + '''' + CAST(ProductGroupID AS Nvarchar(36)) + '''' + ', ' + '(select id from sale_categories where name = ''' + (SELECT GroupType FROM Test.dbo.ProductGroups pgs WHERE pgs.ProductGroupID = Products.ProductGroupID) + ''')' + ', ' + CAST(Price AS Nvarchar(36)) + ', ' + CASE WHEN HasHappyHour = 1 THEN 'true' ELSE 'false' END + ', ' + CASE WHEN IsActive = 1 THEN 'true' ELSE 'false' END + ', ' + CASE WHEN IsNotAvailable = 1 THEN 'true' ELSE 'false' END + ', ' + CAST(SortOrder AS Nvarchar(36)) + ', ' + CAST(Quantity AS Nvarchar(36)) + ');' FROM Test.dbo.Products;"
call:copyQuery l-Modifiers "SELECT 'INSERT INTO modifiers(id, name, show_in_bill, is_active, modifier_category_id, price) VALUES (''' + CAST(ModifierID AS Nvarchar(36)) + ''', ' + '''' + REPLACE(Name, '''', '''''') + '''' + ', ' + CASE WHEN ShowInBill = 1 THEN 'true' ELSE 'false' END + ', true, {ID}, ' + CAST(Price AS Nvarchar(36)) + ');' FROM Test.dbo.Modifiers;"
call:copyQuery m-Sections "SELECT 'INSERT INTO sections(id, name) VALUES (''' + CAST(NewID() AS Nvarchar(36)) + ''', ''' + Location + ''');' FROM Test.dbo.PrintLocations GROUP BY Location;"
call:copyQuery n-Printers "SELECT 'INSERT INTO printers(id, name, address, cut_code) VALUES (''' + CAST(NewID() AS Nvarchar(36)) + ''', ''' + Printer + ''', ''' + Printer + ''', ''' + CutCode + ''');' FROM Test.dbo.PrintLocations GROUP BY Printer, CutCode;"
call:copyQuery o-SectionPrinters "SELECT 'INSERT INTO section_printers(id, menu_category_id, section_id, printer_id, copies) VALUES (''' + CAST(PrintLocationID AS Nvarchar(36)) + ''', ' + COALESCE('''' + CAST(ProductGroupID AS Nvarchar(36)) + '''','null') + ', ' + '(select id from sections where name = ''' + Location + ''')' + ', ' + '(select id from printers where name = ''' + Printer + ''')' + ', ' + CAST(Copies AS nvarchar(36)) + ');' FROM Test.dbo.PrintLocations;"
call:copyQuery p-Vouchers "SELECT 'INSERT INTO vouchers(id, date, pax, user_id, creation_date, last_edit_date, bill_id, food_table_id, customer_id, narration, is_void, void_reason, is_printed, voucher_type, kot_id) VALUES (''' + CAST(VoucherID AS Nvarchar(36)) + ''', ' + '''' + CONVERT(Nvarchar(36), Date, 126) + ''', ' + COALESCE(CAST(Pax AS Nvarchar(36)), 'null') + ', (SELECT id from users limit 1), ' + '''' + CONVERT(Nvarchar(36), CreationDate, 126) + ''', ' + '''' + CONVERT(Nvarchar(36), LastEditDate, 126) + ''', ' + COALESCE(CAST(BillID AS Nvarchar(36)), 'null') + ', ' + '''' + CAST(TableID AS Nvarchar(36)) + ''', ' + '''' + CAST(CustomerID AS Nvarchar(36)) + ''', ' + COALESCE('''' + REPLACE(Narration, '''', '''''') + '''', 'null') + ', ' + CASE WHEN Void = 1 THEN 'true' ELSE 'false' END + ', ' + COALESCE('''' + REPLACE(VoidReason, '''', '''''') + '''', 'null') + ', ' + CASE WHEN Printed = 1 THEN 'true' ELSE 'false' END + ', ' + CAST(VoucherType AS Nvarchar(36)) + ', ' + CAST(KotID AS Nvarchar(36)) + ');' FROM Test.dbo.Vouchers;"
call:copyQuery q-Kots "SELECT 'INSERT INTO kots(id, voucher_id, code, food_table_id, date, user_id) VALUES (''' + CAST(KotID AS Nvarchar(36)) + ''', ' + '''' + CAST(VoucherID AS Nvarchar(36)) + '''' + ', ' + CAST(Code AS Nvarchar(36)) + ', ' + '''' + CAST(TableID AS Nvarchar(36)) + '''' + ', ' + '''' + CONVERT(Nvarchar(36), Date, 126) + ''', (SELECT id from users limit 1));' FROM Test.dbo.Kots;"
call:copyQuery r-Inventories "SELECT 'INSERT INTO inventories(id, kot_id, product_id, sort_order, quantity, price, is_happy_hour, tax_rate, tax_id, discount) VALUES (''' + CAST(InventoryID AS Nvarchar(36)) + ''', ' + '''' + CAST(KotID AS Nvarchar(36)) + '''' + ', ' + '''' + CAST(ProductID AS Nvarchar(36)) + '''' + ', ' + CAST(SortOrder AS Nvarchar(36)) + ', ' + CAST(Quantity AS Nvarchar(36)) + ', ' + CAST(Price AS Nvarchar(36)) + ', ' + CASE WHEN IsHappyHour = 1 THEN 'true' ELSE 'false' END + ', ' + CAST(VatRate AS Nvarchar(36)) + ', ' + '''' + CAST(VatID AS Nvarchar(36)) + '''' + ', ' + CAST(Discount AS Nvarchar(36)) + ');' FROM Test.dbo.Inventories;"
call:copyQuery s-InventoryModifiers "SELECT 'INSERT INTO inventory_modifiers(id, inventory_id, modifier_id, price) VALUES (''' + CAST(InventoryModifierID AS Nvarchar(36)) + ''', ' + '''' + CAST(InventoryID AS Nvarchar(36)) + '''' + ', ' + '''' + CAST(ModifierID AS Nvarchar(36)) + '''' + ', 0);' FROM Test.dbo.InventoryModifiers;"
call:copyQuery t-Overview "SELECT 'INSERT INTO overview(id, voucher_id, food_table_id, status) VALUES (''' + CAST(newid() AS Nvarchar(36)) + ''', ' + '''' + CAST(VoucherID AS Nvarchar(36)) + ''', ' + '''' + CAST(FoodTableID AS Nvarchar(36)) + ''', ' + '''' + Status + ''');' FROM Test.dbo.FoodTables WHERE VoucherID IS NOT NULL;"
call:copyQuery u-ProductGroupModifiers "SELECT 'INSERT INTO product_group_modifiers(id, product_group_id, modifier_id, show_automatically) VALUES (''' + CAST(ProductGroupModifierID AS Nvarchar(36)) + ''', ' + COALESCE('''' + CAST(ProductGroupID AS Nvarchar(36)) + '''','null') + ', ' + COALESCE('''' + CAST(ModifierID AS Nvarchar(36)) + '''','null') + ', ' + CASE WHEN ShowAutomatically = 1 THEN 'true' ELSE 'false' END + ');' FROM Test.dbo.ProductGroupModifiers;"
call:copyQuery v-Reprints "SELECT 'INSERT INTO reprints(id, user_id, date, voucher_id) VALUES (''' + CAST(ReprintID AS Nvarchar(36)) + ''', ' + '''' + CAST(UserID AS Nvarchar(36)) + '''' + ', ' + '''' + CONVERT(Nvarchar(36), Date, 126) + '''' + ', ' + '''' + CAST(VoucherID AS Nvarchar(36)) + '''' + ');' FROM Test.dbo.Reprints;"
call:copyQuery w-Settings "SELECT 'INSERT INTO public.settings(id, name, data) VALUES (''' + CAST(SettingID AS Nvarchar(36)) + ''', ' + '''' + REPLACE(Name, '''', '''''') + '''' + ', ' + '''' + REPLACE(Details, '''', '''''') + '''' + ');' FROM Test.dbo.Settings;"
@ -30,5 +32,5 @@ goto:eof
:copyQuery - here starts my function identified by it's label
echo.
echo. Copying %~1
bcp "%~2" queryout Data\%~1.sql -c -t',' -S sovereign -U sa -P 123456
bcp "%~2" queryout Data\%~1.sql -c -t',' -S . -U sa -P 123456
goto:eof