Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More
cosi5 : a Lino Così for Bangladesh¶
A demo project showing a Lino Così configured for usage in Bangladesh.
It is also a proof of concept for a point of sale.
See also Lino in Bengali.
>>> from lino import startup
>>> startup('lino_book.projects.cosi5.settings')
>>> from lino.api.doctest import *
>>> ses = rt.login('robin')
Overview¶
The lino_book.projects.cosi5 demo project is an example of a Lino Così
having
the
accounting.sales_methodset topos(point of sale)>>> dd.plugins.accounting.sales_method 'pos'
Bengali is second language
>>> [i.django_code for i in settings.SITE.languages] ['en', 'bn']
The sales journal¶
>>> rt.show(accounting.JournalsOverview)
| **SLS** | 0 Sales invoices |
|---------|-------------------|
| **SSN** | 29 Sales notes |
|---------|-----------------|
| **SLC** | 0 Sales credit notes |
|---------|-----------------------|
| **PRC** | 42 Purchase invoices |
|---------|-----------------------|
| **PPR** | 1 PayPal reports |
|---------|-------------------|
| **CSH** | 0 Cash book |
|---------|--------------|
| **BNK** | 5 Bestbank |
|---------|-------------|
| **MSC** | 0 Miscellaneous transactions |
|---------|-------------------------------|
| **PRE** | 1 Preliminary transactions |
|---------|-----------------------------|
| **SAL** | 0 Paychecks |
|---------|--------------|
>>> rt.show('accounting.Journals', column_names="ref name trade_type")
=========== ============================ ========================== ============
Reference Designation Designation (bn) Trade type
----------- ---------------------------- -------------------------- ------------
SLS Sales invoices বিক্রয়ের চালান Sales
SSN Sales notes বিক্রয় চালান Sales
SLC Sales credit notes Sales credit notes Sales
PRC Purchase invoices Purchase invoices Purchases
PPR PayPal reports PayPal reports
CSH Cash book Cash book
BNK Bestbank বেস্টব্যাংক
MSC Miscellaneous transactions বিবিধ লেনদেন
PRE Preliminary transactions Preliminary transactions
SAL Paychecks Paychecks
=========== ============================ ========================== ============
>>> rt.show(accounting.PaymentMethods)
...
==== ============== ================== ======================== ======
ID Designation Designation (bn) Payment account Cash
---- -------------- ------------------ ------------------------ ------
1 Cash payment Cash payment (5700) Cash Yes
2 PayPal PayPal (5701) Online payments No
3 bKash bKash (5701) Online payments No
4 Other অন্যান্য (5703) Other payments No
==== ============== ================== ======================== ======
>>> jnl = rt.models.accounting.Journal.get_by_ref("SSN")
>>> jnl.voucher_type.table_class
lino_xl.lib.trading.ui.CashInvoicesByJournal
>>> rt.show(jnl.voucher_type.table_class, jnl)
...
===================== ============ =================================== =============== ================ =============== =============== ================
No. Date Partner TotIncl Payment method Cash received Cash returned Workflow
--------------------- ------------ ----------------------------------- --------------- ---------------- --------------- --------------- ----------------
29/2021 11/06/2021 Ernst Berta 2 299,81 Cash payment 2 300,00 0,19 **Registered**
28/2021 10/06/2021 Dobbelstein Dorothée 11,20 Other **Registered**
27/2021 09/06/2021 Dobbelstein-Demeulenaere Dorothée 834,00 bKash **Registered**
26/2021 08/06/2021 Demeulenaere Dorothée 580,00 PayPal **Registered**
25/2021 07/06/2021 Dericum Daniel 59,85 Cash payment 60,00 0,15 **Registered**
24/2021 12/05/2021 Chantraine Marc 2 359,78 Other **Registered**
23/2021 11/05/2021 Chantraine Marc 3 005,45 bKash **Registered**
22/2021 10/05/2021 Charlier Ulrike 239,20 PayPal **Registered**
21/2021 09/05/2021 Collard Charlotte 990,00 Cash payment 995,00 5,00 **Registered**
20/2021 08/05/2021 Bastiaensen Laurent 279,90 Other **Registered**
19/2021 07/05/2021 Ausdemwald Alfons 1 199,85 bKash **Registered**
18/2021 14/04/2021 Altenberg Hans 3 319,78 PayPal **Registered**
17/2021 13/04/2021 Arens Annette 140,60 Cash payment 145,00 4,40 **Registered**
16/2021 12/04/2021 Arens Andreas 200,00 Other **Registered**
15/2021 11/04/2021 Arens Andreas 1 045,00 bKash **Registered**
14/2021 10/04/2021 Auto École Verte 831,82 PayPal **Registered**
13/2021 09/04/2021 Moulin Rouge 1 949,85 Cash payment 1 950,00 0,15 **Registered**
12/2021 08/04/2021 Reinhards Baumschule 2 013,88 Other **Registered**
11/2021 07/04/2021 Bernd Brechts Bücherladen 548,50 bKash **Registered**
10/2021 07/03/2021 Hans Flott & Co 320,00 PayPal **Registered**
9/2021 10/02/2021 Van Achter NV 815,96 Cash payment 820,00 4,04 **Registered**
8/2021 09/02/2021 Donderweer BV 1 939,82 Other **Registered**
7/2021 08/02/2021 Garage Mergelsberg 1 499,85 bKash **Registered**
6/2021 07/02/2021 Bäckerei Schmitz 1 110,16 PayPal **Registered**
5/2021 11/01/2021 Bäckerei Mießen 535,00 Cash payment 540,00 5,00 **Registered**
4/2021 10/01/2021 Bäckerei Ausdemwald 280,00 Other **Registered**
3/2021 09/01/2021 Rumma & Ko OÜ 679,81 bKash **Registered**
2/2021 08/01/2021 Bestbank 2 039,82 PayPal **Registered**
1/2021 07/01/2021 Miscellaneous 2 999,85 Cash payment 3 000,00 0,15 **Registered**
**Total (29 rows)** **34 128,74** **9 810,00** **19,08**
===================== ============ =================================== =============== ================ =============== =============== ================
>>> # invoice = rt.models.trading.CashInvoice.objects.get(id=1)
>>> invoice = rt.models.trading.CashInvoice.objects.get(
... number=1, journal__ref="SSN", fiscal_year__ref="2021")
>>> print(invoice.payment_method)
Cash payment
>>> rt.show('accounting.MovementsByVoucher', invoice)
...
================== =============== ============== ============== ==================== =========
Account Partner Debit Credit Match Cleared
------------------ --------------- -------------- -------------- -------------------- ---------
(7000) Sales 2 999,85 Yes
(4000) Customers Miscellaneous 2 999,85 `SSN 1/2021 <…>`__ Yes
(4000) Customers Miscellaneous 2 999,85 `SSN 1/2021 <…>`__ Yes
(5700) Cash Miscellaneous 2 999,85 `SSN 1/2021 <…>`__ No
**5 999,70** **5 999,70**
================== =============== ============== ============== ==================== =========
>>> # invoice = rt.models.trading.CashInvoice.objects.get(id=2)
>>> invoice = rt.models.trading.CashInvoice.objects.get(
... number=2, journal__ref="SSN", fiscal_year__ref="2021")
>>> print(invoice.payment_method)
PayPal
>>> rt.show('accounting.MovementsByVoucher', invoice)
...
======================== ========== ============== ============== ==================== =========
Account Partner Debit Credit Match Cleared
------------------------ ---------- -------------- -------------- -------------------- ---------
(7000) Sales 2 039,82 Yes
(4000) Customers Bestbank 2 039,82 `SSN 2/2021 <…>`__ Yes
(4000) Customers Bestbank 2 039,82 `SSN 2/2021 <…>`__ Yes
(5701) Online payments Bestbank 2 039,82 `SSN 2/2021 <…>`__ No
**4 079,64** **4 079,64**
======================== ========== ============== ============== ==================== =========
Places in Bangladesh¶
The Wikipedia article on Dhaka Division says it contains 13 districts:
Dhaka, Faridpur, Gazipur, Gopalganj, Kishoreganj, Madaripur, Manikganj, Munshiganj, Narayanganj, Narsingdi, Rajbari, Shariatpur and Tangail
Lino and commondata agree with this:
>>> dhaka_div = countries.Place.objects.get(
... name="Dhaka", type=countries.PlaceTypes.division)
>>> ses.show("countries.PlacesByPlace", dhaka_div)
===================== ============ ==========
Place Place Type zip code
--------------------- ------------ ----------
`Dhaka <…>`__ District
`Faridpur <…>`__ District
`Gazipur <…>`__ District
`Gopalganj <…>`__ District
`Kishoreganj <…>`__ District
`Madaripur <…>`__ District
`Manikganj <…>`__ District
`Munshiganj <…>`__ District
`Narayanganj <…>`__ District
`Narsingdi <…>`__ District
`Rajbari <…>`__ District
`Shariatpur <…>`__ District
`Tangail <…>`__ District
===================== ============ ==========
The Wikipedia article on Gazipur District says it contains 5 upazilas (subdistricts):
Gazipur Sadar, Kaliakair, Kaliganj, Kapasia and Sreepur
Lino and commondata agree with this:
>>> gazipur = countries.Place.objects.get(
... name="Gazipur", type=countries.PlaceTypes.district)
>>> ses.show("countries.PlacesByPlace", gazipur)
======================= ============= ==========
Place Place Type zip code
----------------------- ------------- ----------
`Gazipur Sadar <…>`__ Subdistrict
`Kaliakair <…>`__ Subdistrict
`Kaliganj <…>`__ Subdistrict
`Kapasia <…>`__ Subdistrict
`Sreepur <…>`__ Subdistrict
======================= ============= ==========
Formatting Bangladeshi postal addresses¶
The country is being printed in the address depending on the
country_code setting.
>>> rmu(dd.plugins.countries.country_code)
'BD'
>>> dd.plugins.countries.get_my_country()
Country #BD ('Bangladesh')
A domestic address uses just the city name:
>>> bd = countries.Country.objects.get(isocode="BD")
>>> dhanmondi = countries.Place.objects.get(
... name="Dhanmondi", type=countries.PlaceTypes.subdistrict)
>>> p = contacts.Person(first_name="Rahim", last_name="Uddin",
... street="Road 15", street_no="27", street_box="A",
... country=bd, city=dhanmondi)
>>> print(p.address)
Rahim Uddin
Road 15 27 A
Dhanmondi
When a zip code is known the zip code is shown before the city name:
>>> dhaka_city = countries.Place.objects.get(
... name="Dhaka", type=countries.PlaceTypes.city)
>>> p = contacts.Person(first_name="Kazi", last_name="Nazrul",
... street="Mirpur Road", street_no="10",
... zip_code="1216", country=bd, city=dhaka_city)
>>> print(p.address)
Kazi Nazrul
Mirpur Road 10
1216 Dhaka
When the recipient is abroad the country name is appended:
>>> de = countries.Country.objects.get(isocode="DE")
>>> p = contacts.Person(first_name="Kazi", last_name="Nazrul",
... street="Mirpur Road", street_no="10",
... country=de, city=dhaka_city)
>>> print(p.address)
Kazi Nazrul
Mirpur Road 10
Dhaka
Germany
20260425¶
>>> voucher_table = finan.PaymentReportsByJournal
>>> suggestions_table = voucher_table.suggestions_table
There is only one Paypal report in the demo:
>>> obj = finan.PaymentOrder.objects.get(journal__ref="PPR")
>>> rt.show(suggestions_table, master_instance=obj)
+-----------------------------------+-------------+------------+--------------------+-----------------------------------------------------------+--------------+
| Info | Match | Due date | Debts | Payments | Balance |
+===================================+=============+============+====================+===========================================================+==============+
| `Bäckerei Mießen <…>`__ |br| | PRC 19/2021 | 07/03/2021 | `BNK 3/2021 <…>`__ | `PRC 19/2021 <…>`__ `BNK 4/2021 <…>`__ `BNK 5/2021 <…>`__ | 0,06 |
| `(4100) Suppliers <…>`__ | | | | | |
+-----------------------------------+-------------+------------+--------------------+-----------------------------------------------------------+--------------+
| `Rumma & Ko OÜ <…>`__ |br| | PRC 31/2021 | 05/05/2021 | `BNK 5/2021 <…>`__ | `PRC 31/2021 <…>`__ | 30,11 |
| `(4100) Suppliers <…>`__ | | | | | |
+-----------------------------------+-------------+------------+--------------------+-----------------------------------------------------------+--------------+
| `Garage Mergelsberg <…>`__ |br| | PRC 35/2021 | 09/05/2021 | | `PRC 35/2021 <…>`__ | 202,40 |
| `(4100) Suppliers <…>`__ | | | | | |
+-----------------------------------+-------------+------------+--------------------+-----------------------------------------------------------+--------------+
| `Miscellaneous <…>`__ |br| | PRC 36/2021 | 03/06/2021 | | `PRC 36/2021 <…>`__ | 40,00 |
| `(4100) Suppliers <…>`__ | | | | | |
+-----------------------------------+-------------+------------+--------------------+-----------------------------------------------------------+--------------+
| `Bestbank <…>`__ |br| | PRC 37/2021 | 04/06/2021 | | `PRC 37/2021 <…>`__ | 141,30 |
| `(4100) Suppliers <…>`__ | | | | | |
+-----------------------------------+-------------+------------+--------------------+-----------------------------------------------------------+--------------+
| `Rumma & Ko OÜ <…>`__ |br| | PRC 38/2021 | 05/06/2021 | | `PRC 38/2021 <…>`__ | 603,60 |
| `(4100) Suppliers <…>`__ | | | | | |
+-----------------------------------+-------------+------------+--------------------+-----------------------------------------------------------+--------------+
| `Bäckerei Ausdemwald <…>`__ |br| | PRC 39/2021 | 06/06/2021 | | `PRC 39/2021 <…>`__ | 1 199,90 |
| `(4100) Suppliers <…>`__ | | | | | |
+-----------------------------------+-------------+------------+--------------------+-----------------------------------------------------------+--------------+
| `Bäckerei Mießen <…>`__ |br| | PRC 40/2021 | 07/06/2021 | | `PRC 40/2021 <…>`__ | 3 241,68 |
| `(4100) Suppliers <…>`__ | | | | | |
+-----------------------------------+-------------+------------+--------------------+-----------------------------------------------------------+--------------+
| `Bäckerei Schmitz <…>`__ |br| | PRC 41/2021 | 08/06/2021 | | `PRC 41/2021 <…>`__ | 143,40 |
| `(4100) Suppliers <…>`__ | | | | | |
+-----------------------------------+-------------+------------+--------------------+-----------------------------------------------------------+--------------+
| `Garage Mergelsberg <…>`__ |br| | PRC 42/2021 | 09/06/2021 | | `PRC 42/2021 <…>`__ | 199,90 |
| `(4100) Suppliers <…>`__ | | | | | |
+-----------------------------------+-------------+------------+--------------------+-----------------------------------------------------------+--------------+
| **Total (10 rows)** | | | | | **5 802,35** |
+-----------------------------------+-------------+------------+--------------------+-----------------------------------------------------------+--------------+
sar = ar.spawn(ar.actor.suggestions_table, master_instance=obj)