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 sales journal

>>> rt.show(accounting.JournalsOverview)
| **SLS** |  0 Sales invoices |
|---------|-------------------|
| **SSN** |  29 Sales notes |
|---------|-----------------|
>>> rt.show('accounting.Journals', column_names="ref name trade_type")
=========== ================ ================== ============
 Reference   Designation      Designation (bn)   Trade type
----------- ---------------- ------------------ ------------
 SLS         Sales invoices   বিক্রয়ের চালান      Sales
 SSN         Sales notes      বিক্রয় চালান        Sales
=========== ================ ================== ============
>>> 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
==== ============== ================== ======================== ======
>>> 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   Evertz Bernd                        2 299,81        PayPal                                           **Registered**
 28/2021               10/06/2021   Ernst Berta                         11,20           Cash payment     15,00           3,80            **Registered**
 27/2021               09/06/2021   Dobbelstein Dorothée                834,00          bKash                                            **Registered**
 26/2021               08/06/2021   Dobbelstein-Demeulenaere Dorothée   580,00          PayPal                                           **Registered**
 25/2021               07/06/2021   Demeulenaere Dorothée               59,85           Cash payment     60,00           0,15            **Registered**
 24/2021               12/05/2021   Dericum Daniel                      2 359,78        bKash                                            **Registered**
 23/2021               11/05/2021   Dericum Daniel                      3 005,45        PayPal                                           **Registered**
 22/2021               10/05/2021   Chantraine Marc                     239,20          Cash payment     240,00          0,80            **Registered**
 21/2021               09/05/2021   Charlier Ulrike                     990,00          bKash                                            **Registered**
 20/2021               08/05/2021   Collard Charlotte                   279,90          PayPal                                           **Registered**
 19/2021               07/05/2021   Bastiaensen Laurent                 1 199,85        Cash payment     1 200,00        0,15            **Registered**
 18/2021               14/04/2021   Ausdemwald Alfons                   3 319,78        bKash                                            **Registered**
 17/2021               13/04/2021   Altenberg Hans                      140,60          PayPal                                           **Registered**
 16/2021               12/04/2021   Arens Annette                       200,00          Cash payment     205,00          5,00            **Registered**
 15/2021               11/04/2021   Arens Annette                       1 045,00        bKash                                            **Registered**
 14/2021               10/04/2021   Arens Andreas                       831,82          PayPal                                           **Registered**
 13/2021               09/04/2021   Auto École Verte                    1 949,85        Cash payment     1 950,00        0,15            **Registered**
 12/2021               08/04/2021   Moulin Rouge                        2 013,88        bKash                                            **Registered**
 11/2021               07/04/2021   Reinhards Baumschule                548,50          PayPal                                           **Registered**
 10/2021               07/03/2021   Bernd Brechts Bücherladen           320,00          Cash payment     325,00          5,00            **Registered**
 9/2021                10/02/2021   Hans Flott & Co                     815,96          bKash                                            **Registered**
 8/2021                09/02/2021   Van Achter NV                       1 939,82        PayPal                                           **Registered**
 7/2021                08/02/2021   Donderweer BV                       1 499,85        Cash payment     1 500,00        0,15            **Registered**
 6/2021                07/02/2021   Garage Mergelsberg                  1 110,16        bKash                                            **Registered**
 5/2021                11/01/2021   Bäckerei Schmitz                    535,00          PayPal                                           **Registered**
 4/2021                10/01/2021   Bäckerei Mießen                     280,00          Cash payment     285,00          5,00            **Registered**
 3/2021                09/01/2021   Bäckerei Ausdemwald                 679,81          bKash                                            **Registered**
 2/2021                08/01/2021   Rumma & Ko OÜ                       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**                    **8 780,00**    **20,35**
===================== ============ =================================== =============== ================ =============== =============== ================
>>> invoice = rt.models.trading.CashInvoice.objects.get(id=1)
>>> 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)
>>> print(invoice.payment_method)
PayPal
>>> rt.show('accounting.MovementsByVoucher', invoice)
...
======================== =============== ============== ============== ==================== =========
 Account                  Partner         Debit          Credit         Match                Cleared
------------------------ --------------- -------------- -------------- -------------------- ---------
 (7000) Sales                                            2 039,82                            Yes
 (4000) Customers         Rumma & Ko OÜ   2 039,82                      `SSN 2/2021 <…>`__   Yes
 (4000) Customers         Rumma & Ko OÜ                  2 039,82       `SSN 2/2021 <…>`__   Yes
 (5701) Online payments   Rumma & Ko OÜ   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