75 lines
3.3 KiB
Python
75 lines
3.3 KiB
Python
# =========================
|
|
# SQL (constantes)
|
|
# =========================
|
|
SELECT_CUSTOMER_BY_FACTUGES = (
|
|
"SELECT customers.id FROM customers WHERE customers.factuges_id=%s"
|
|
)
|
|
|
|
INSERT_CUSTOMER = (
|
|
"INSERT INTO customers (id, name, tin, street, city, province, postal_code, country, "
|
|
"phone_primary, phone_secondary, mobile_primary, mobile_secondary, "
|
|
"email_primary, email_secondary, website, factuges_id, company_id, is_company, "
|
|
"language_code, currency_code, status, created_at, updated_at) "
|
|
"VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,1,'es','EUR','active',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP)"
|
|
)
|
|
|
|
UPDATE_CUSTOMER = (
|
|
"UPDATE customers SET name=%s, tin=%s, street=%s, city=%s, province=%s, postal_code=%s, country=%s, "
|
|
"phone_primary=%s, phone_secondary=%s, mobile_primary=%s, mobile_secondary=%s, "
|
|
"email_primary=%s, email_secondary=%s, website=%s, updated_at=CURRENT_TIMESTAMP "
|
|
"WHERE (id=%s)"
|
|
)
|
|
|
|
SELECT_PAYMENT_METHOD_BY_FACTUGES = (
|
|
"SELECT payment_methods.id FROM payment_methods WHERE payment_methods.factuges_id=%s"
|
|
)
|
|
|
|
INSERT_PAYMENT_METHOD = (
|
|
"INSERT INTO payment_methods (id, description, factuges_id, created_at, updated_at) "
|
|
"VALUES (%s,%s,%s,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP)"
|
|
)
|
|
|
|
INSERT_INVOICE = (
|
|
"INSERT INTO customer_invoices (id, company_id, invoice_number, status, series, reference, invoice_date, operation_date, description, "
|
|
"subtotal_amount_value, discount_amount_value, discount_percentage_value, taxable_amount_value, taxes_amount_value, total_amount_value, "
|
|
"customer_id, customer_tin, customer_name, customer_street, customer_city, customer_province, customer_postal_code, customer_country, "
|
|
"payment_method_id, payment_method_description, "
|
|
"subtotal_amount_scale, discount_amount_scale, discount_percentage_scale, taxable_amount_scale, taxes_amount_scale, total_amount_scale, "
|
|
"language_code, currency_code, created_at, updated_at) "
|
|
"VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,2,2,2,2,2,2,'es','EUR',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP)"
|
|
)
|
|
|
|
INSERT_INVOICE_ITEM = (
|
|
"INSERT INTO customer_invoice_items "
|
|
"(item_id, invoice_id, position, description, quantity_value, unit_amount_value, "
|
|
"discount_percentage_value, discount_amount_value, total_amount_value, "
|
|
"quantity_scale, unit_amount_scale, discount_amount_scale, total_amount_scale, discount_percentage_scale, created_at, updated_at) "
|
|
"VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,2,4,2,4,2,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP)"
|
|
)
|
|
|
|
INSERT_INVOICE_TAX = (
|
|
"INSERT INTO customer_invoice_taxes (tax_id, invoice_id, tax_code, taxable_amount_value, taxes_amount_value, "
|
|
"taxable_amount_scale, taxes_amount_scale, created_at, updated_at) "
|
|
"VALUES (%s,%s,%s,%s,%s,2,2,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP)"
|
|
)
|
|
|
|
INSERT_INVOICE_ITEM_TAX = (
|
|
"INSERT INTO customer_invoice_item_taxes "
|
|
"(tax_id, item_id, tax_code, taxable_amount_value, taxes_amount_value, taxable_amount_scale, taxes_amount_scale, created_at, updated_at) "
|
|
"VALUES (%s,%s,%s,%s,%s,4,2,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP)"
|
|
)
|
|
|
|
UPDATE_FACTUGES_LINK = (
|
|
"UPDATE FACTURAS_CLIENTE "
|
|
"SET ID_VERIFACTU=? "
|
|
"WHERE ID=?"
|
|
)
|
|
|
|
LIMPIAR_FACTUGES_LINK = (
|
|
"UPDATE FACTURAS_CLIENTE "
|
|
"SET ID_VERIFACTU = NULL, "
|
|
"VERIFACTU = 0 "
|
|
"WHERE (ID_VERIFACTU = ?)"
|
|
)
|
|
|