04.12.2018 admin

Выгрузка в 1с + Синхронизация остатков с Odoo

doctors.csv

по запросам по колонкам:

1 – дата рахунку – invoices.createdate,
2 – № рахунку – invoices.invoicenumber,
3 – ПІП пацієнта – (select patients.fullname from patients where patients.id = treatmentproc.patient_fk),
4 – № картки пацієнта – (select patients.cardbefornumber||patients.cardnumber||patients.cardafternumber from patients where patients.id = treatmentproc.patient_fk),
5 – ПІП Лікаря – (select doctors.fullname from doctors where doctors.id = treatmentproc.doctor),
6 – іпн лікаря – (select doctors.tin from doctors where doctors.id = treatmentproc.doctor),
7 – ПІПАсистента – (select assistants.fullname from assistants where assistants.id = treatmentproc.assistant),
8 – іпн асистента – (select assistants.tin from assistants where assistants.id = treatmentproc.assistant),
9 – назва послуги згідно рахунку – treatmentproc.name,
10 – код послуги – treatmentproc.shifr,
11 – к-сть послуг – treatmentproc.price,
12 – ціна послуги – treatmentproc.proc_count,
13 – сума – treatmentproc.price * treatmentproc.proc_count,
14 – сума знижки – treatmentproc.price * treatmentproc.proc_count * invoices.discount_amount,
15 – номер кабінету – (select rooms.name from rooms where rooms.id = treatmentproc.cabinet_fk),
16 – назва підрозділу – (select subdivision.name from subdivision where subdivision.id = invoices.subdivisionid)

account.csv
по запросам по колонкам:

1 – дата оплати – (select max(accountflow.operationtimestamp) from accountflow where accountflow.oninvoice_fk = invoices.id),
2 – № рахунку – invoices.invoicenumber,
3 – касир – (select account.lastname||’ ‘||account.firstname||’ ‘||account.middlename from account where account.id = invoices.authorid),
4 – ІПН касира – (select account.tax_id from account where account.id = invoices.authorid),
5 – пацієнт – (select patients.fullname from patients where patients.id = invoices.patientid),
6 – № картки пацієнта – (select patients.cardbefornumber||patients.cardnumber||patients.cardafternumber from patients where patients.id = invoices.patientid),
7 – Готівка (0)/безготівка (1) – invoices.is_cashpayment,
8 – чи друкувалось на фіскальний принтер 1-так/0-ні – invoices.is_fiscal,
9 – фактично сплачено – (select coalesce(sum(accountflow.summ), ‘0.00’) from accountflow where accountflow.oninvoice_fk = invoices.id)

download sample files