Skip to content

Instantly share code, notes, and snippets.

@suhailvs
Last active August 10, 2021 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suhailvs/80bc763540d90e9ffe51e78dc63c3fc6 to your computer and use it in GitHub Desktop.
Save suhailvs/80bc763540d90e9ffe51e78dc63c3fc6 to your computer and use it in GitHub Desktop.
Milma Esell KT

Milma Documentation

Milma site has two parts frontend and backend

  1. Make Bill Entry frontend backend
  2. Purchase Entry
  3. Stock and Financial Report

Frontend

url: https://milmaesell.donams.com

Frontend is a single page app build using Angular 11

Users

Agent

  1. Make Bill Entry (frontend)[#billing-frontend], (backend)[#billing]
  2. Purchase Entry
  3. Stock and Financial Report

Billing Frontend

Bill entry to customers. Select a product by typing 3 letter of either product code or product name, select UOM(unit of measurement, eg: each, box etc), select a mode which is SP: Selling Price, MRP: Maximum > Retail Price, WP: Wholesale Price, RP: Retail Price or you can select CP for Custom Price. Then type quantity. then you can provide percentage discount or cash discount. Then click on the save button to save the billentry

Functions

app/modules/billing/billentry/components/billentry-cu.components.ts

ngOnInit():

getCessTaxes(): get cess taxes from the database

this.items.valueChanges: when FormArray items changes, then calculate tax, total_kfc, total, amount_excl_tax, discount, itemdiscount. valueChanges is an Observable so you can pipe pairwise to get the previous and next values in the subscription.

doHotkey($event):

shortcut keys

Ctrl+S or F7 = Save | Ctrl+P or F8 = Print | Ctrl+D = Last Row | Ctrl+C = Clear All | Ctrl+N or F9 = New | Ctrl+R= New Row

onGSTINChange(gstin):

on change of gst customer select box. if gst customer remove cess calculations. calculate cess of each item if not a gst customer.

onChange(i, whatchanged):

on change of any of inputs:

  • product
  • qty
  • sellingprice
  • customprice
  • discount
  • cash_discount

on product change:

+ get uoms of that product -  patch value to formarray items[uoms] = [{'name':..,'unit':..,'uom':..} ..]
+ check duplicate product already exists then show error toastr and return
+ if last row changed, append a new row

on qty change:

+ if qty greater than stock alert message and put quantity = stock.
+ set selling price

on sellingprice change:

+ set selling price based on uom_prices

on customprice change:

+ set sellingprice = customprice

if any of the above inputs changes:

+ calculate cess rate
+ if gstin customer we put cess = 0
+ calculate unitprice. unitprice = (sellingprice * 100) / (gst_rate+cess + 100);

on discount or qty change:

+ if discount < 0 or > 100, show error message. set discounts to 0
+ calculate cash_discount = amount * (discount_percentage / 100);
+ set cash_discount

on cash_discount change:

+ calculate discount= 100*cash_discount/amount
+ set discount

again if any of the above inputs changes:

+ calculate amount_excl_tax = (amount * 100) / (gst_rate+cess + 100);
+ items formarray at i set values: freeqty, sellingprice, unitprice, sgst .. etc

onUoMChange(i)

+ getAmounts for the selected UoM 
+ put uom amounts in mode variable 	modes = [{'mode':'SP', 'type':'SP: 100'},{'mode':'MRP', ... ];
+ set sellingprice based on mode, if (mode==='SP') sellingprice = data['SP']
+ calculate unitprice based on mode, unitprice = (sellingprice * 100) / (gst_rate+cess + 100);

discountChange(whatchanged)

+ this is for total billdiscount.

Packages Used

  1. @angular
  2. @angular/material
  3. ng-select
  4. datatables
  5. angular-datatables
  6. bootstrap
  7. font-awesome
  8. highcharts
  9. highcharts-angular
  10. jquery
  11. moment
  12. ngx-bootstrap
  13. ngx-toastr

Example of module

├── menumanagement
│   ├── components
│   │   └── menumanagement.component.ts
│   ├── menumanagement.module.ts
│   ├── menumanagement-routing.module.ts
│   ├── menumanagement.service.ts
│   └── pages
│       └── menumanagement.component.html

Initiate modules in menumanagement.module.ts

import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {MenumanagementRoutingModule} from './menumanagement-routing.module';
import {MenumanagementComponent} from './components/menumanagement.component';
import {TranslateModule} from '@ngx-translate/core';


@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    ReactiveFormsModule,
    MenumanagementRoutingModule,
    TranslateModule,
  ],
  declarations: [
    MenumanagementComponent,
  ]
})
export class MenumanagementModule {
}

Now link routing urls in menumanagement-routing.module.ts

import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {RouterModule, Routes} from '@angular/router';

import {MenumanagementComponent} from './components/menumanagement.component';

const routes: Routes = [
  {path: '', component: MenumanagementComponent},
];

@NgModule({
  imports: [
    RouterModule.forChild(routes),
    CommonModule
  ],
  exports: [RouterModule],
  declarations: []
})

export class MenumanagementRoutingModule {
}

Define Backend(Django) urls in menumanagement.service.ts

import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';

@Injectable({
  providedIn: 'root'
})
export class MenumanagementService {

  constructor(private  httpClient: HttpClient) {
  }

  postMenumanagement(menus) {
    return this.httpClient.post('/dashboard/syncmenus/', menus);
  }

  postMenumanagementTwolevel(menus) {
    return this.httpClient.post('/dashboard/syncmenus_twolevel/', menus);
  }
}

this will look at url /dashboard/syncmenus/ url from backend.

Define the component.ts components/menumanagement.component.ts:

import {Component, OnInit} from '@angular/core';
import {MenumanagementService} from '../menumanagement.service';
import {ToastrService} from 'ngx-toastr';
import {TranslateService} from '@ngx-translate/core';

@Component({
  selector: 'app-menumanagement',
  templateUrl: '../pages/menumanagement.component.html'
})

export class MenumanagementComponent implements OnInit {
  menus: any;
  menuType = '3_level';

  constructor(
    private menumanagementService: MenumanagementService,
    public translate: TranslateService,
    private toastr: ToastrService) {
  }

  ngOnInit() {
    this.menuType = localStorage.getItem('menu_type');
  }

  onSubmit(): void {
    const json_data = JSON.stringify(this.menus);

    let myhttpService;
    if (this.menuType == '3_level'){
      myhttpService = this.menumanagementService.postMenumanagement({'menus': this.menus});
    } else if (this.menuType == '2_level'){
      myhttpService = this.menumanagementService.postMenumanagementTwolevel({'menus': this.menus});
    }
    myhttpService.subscribe((response) => {
      this.toastr.success('Success..!', `Menu Items Added Successfully.`);
    }, // success
    error => {
      this.toastr.error('Error!');
    });
  }

}

then you need to add an html page: pages/menumanagement.component.html

Directories

esell
├── dist  <------------- production build files
├── e2e   <------------- i never used this folder
├── node_modules <------ packages automatically created when we run npm install
├── quick_start
├── src	 	<----------- we have look mainly in this folder
│   ├── app
│   ├── assets <-------- some css files
│   ├── environments <-- we set backend url here.
│   └── index.html <---- base html file
├── angular.json <------ here we will reference css and js libraries.
└── package.json <------ packages list here so that npm install will install those packages

Directory: app

app
├── app.component.css <------------------------------------- empty file we can remove this file
├── app.component.html <------------------------------------ <router-outlet></router-outlet>
├── app.component.spec.ts <--------------------------------- never used this. seems it is for testing
├── app.component.ts <-------------------------------------- nothing there
├── app.module.ts <----------------------------------------- main module with root url config
├── app-routing.module.ts <--------------------------------- routing for layout and login pages
├── modules
│   ├── accounts <------------------------------------------ we didn't use this
│   │   ├── accounts.component.ts
│   │   ├── accountsledger
│   │   │   ├── accountsledger.module.ts
│   │   │   ├── accountsledger-routing.module.ts
│   │   │   ├── accountsledger.service.ts
│   │   │   ├── components
│   │   │   │   ├── accountsledger.component.ts
│   │   │   │   └── accountsledger-cu.component.ts
│   │   │   └── pages
│   │   │       └── accountsledger-cu.component.html
│   │   ├── accounts.module.ts
│   │   ├── accounts-routing.module.ts
│   │   └── dailyaccountclosing
│   │       ├── components
│   │       │   ├── dailyaccountclosing.component.ts
│   │       │   └── dailyaccountclosing-cu.component.ts
│   │       ├── dailyaccountclosing.module.ts
│   │       ├── dailyaccountclosing-routing.module.ts
│   │       ├── dailyaccountclosing.service.ts
│   │       └── pages
│   │           └── dailyaccountclosing-cu.component.html
│   ├── agents
│   │   ├── agent
│   │   │   ├── agent.module.ts
│   │   │   ├── agent-routing.module.ts
│   │   │   ├── agent.service.ts
│   │   │   ├── components
│   │   │   │   ├── agent.component.ts
│   │   │   │   ├── agent-cu.component.ts
│   │   │   │   ├── agent-filter.component.ts
│   │   │   │   └── agent-view.component.ts
│   │   │   └── pages
│   │   │       ├── agent-cu.component.html
│   │   │       ├── agent-filter.component.html
│   │   │       └── agent-view.component.html
│   │   ├── agentemployee
│   │   │   ├── agentemployee.module.ts
│   │   │   ├── agentemployee-routing.module.ts
│   │   │   ├── agentemployee.service.ts
│   │   │   ├── components
│   │   │   │   ├── agentemployee.component.ts
│   │   │   │   └── agentemployee-cu.component.ts
│   │   │   └── pages
│   │   │       └── agentemployee-cu.component.html
│   │   ├── agentitemstock
│   │   │   ├── agentitemstock.module.ts
│   │   │   ├── agentitemstock-routing.module.ts
│   │   │   ├── agentitemstock.service.ts
│   │   │   ├── components
│   │   │   │   └── agentitemstock.component.ts
│   │   │   └── pages
│   │   │       └── agentitemstock.component.html
│   │   ├── agentorders
│   │   │   ├── agentorders.module.ts
│   │   │   ├── agentorders-routing.module.ts
│   │   │   ├── agentorders.service.ts
│   │   │   ├── components
│   │   │   │   ├── agentorders.component.ts
│   │   │   │   ├── agentorders-cu.component.ts
│   │   │   │   └── agentorders-filter.component.ts
│   │   │   └── pages
│   │   │       ├── agentorders-cu.component.html
│   │   │       └── agentorders-filter.component.html
│   │   ├── agents.component.ts
│   │   ├── agents.module.ts
│   │   └── agents-routing.module.ts
│   ├── billing
│   │   ├── billentry
│   │   │   ├── billentry.module.ts
│   │   │   ├── billentry-routing.module.ts
│   │   │   ├── billentry.service.ts
│   │   │   ├── components
│   │   │   │   ├── billentry.component.ts
│   │   │   │   ├── billentry-cu.component.ts
│   │   │   │   ├── billentry-view.component.ts
│   │   │   │   └── product-select.component.ts
│   │   │   └── pages
│   │   │       ├── billentry-cu.component.css
│   │   │       ├── billentry-cu.component.html
│   │   │       ├── billentry-view.component.html
│   │   │       └── product-select.component.html
│   │   ├── billing.component.ts
│   │   ├── billing.module.ts
│   │   ├── billing-routing.module.ts
│   │   ├── billreturn
│   │   │   ├── billreturn.module.ts
│   │   │   ├── billreturn-routing.module.ts
│   │   │   ├── billreturn.service.ts
│   │   │   ├── components
│   │   │   │   ├── billreturn.component.ts
│   │   │   │   ├── billreturn-filter.component.ts
│   │   │   │   └── billreturn-new.component.ts
│   │   │   └── pages
│   │   │       ├── billreturn-filter.component.html
│   │   │       └── billreturn-new.component.html
│   │   ├── creditbill
│   │   │   ├── components
│   │   │   │   └── creditbill.component.ts
│   │   │   ├── creditbill.module.ts
│   │   │   ├── creditbill-routing.module.ts
│   │   │   ├── creditbill.service.ts
│   │   │   └── pages
│   │   │       └── creditbill.component.html
│   │   ├── customer
│   │   │   ├── components
│   │   │   │   ├── customer.component.ts
│   │   │   │   └── customer_cu.component.ts
│   │   │   ├── customer.module.ts
│   │   │   ├── customer-routing.module.ts
│   │   │   ├── customer.service.ts
│   │   │   └── pages
│   │   │       ├── customer.component.css
│   │   │       └── customer_cu.component.html
│   │   └── customerimport
│   │       ├── components
│   │       │   ├── customerimport.component.ts
│   │       │   └── customerimportmessage.component.ts
│   │       ├── customerimport.module.ts
│   │       ├── customerimport-routing.module.ts
│   │       ├── customerimport.service.ts
│   │       └── pages
│   │           └── customerimport.component.html
│   ├── dashboard
│   │   ├── aclpermission
│   │   │   ├── aclpermission.module.ts
│   │   │   ├── aclpermission-routing.module.ts
│   │   │   ├── aclpermission.service.ts
│   │   │   ├── components
│   │   │   │   └── aclpermission.component.ts
│   │   │   └── pages
│   │   │       └── aclpermission.component.html
│   │   ├── aclpermissiontwolevel
│   │   │   ├── aclpermission-routingtwolevel.module.ts
│   │   │   ├── aclpermissiontwolevel.module.ts
│   │   │   ├── aclpermissiontwolevel.service.ts
│   │   │   ├── components
│   │   │   │   └── aclpermissiontwolevel.component.ts
│   │   │   └── pages
│   │   │       └── aclpermissiontwolevel.component.html
│   │   ├── celeryhistory
│   │   │   ├── celeryhistory.module.ts
│   │   │   ├── celeryhistory-routing.module.ts
│   │   │   ├── celeryhistory.service.ts
│   │   │   └── components
│   │   │       └── celeryhistory.component.ts
│   │   ├── dashboard.component.ts
│   │   ├── dashboard.module.ts
│   │   ├── dashboard-routing.module.ts
│   │   ├── menuitems
│   │   │   ├── components
│   │   │   │   ├── accountsettings.component.ts
│   │   │   │   ├── billingsettings.component.ts
│   │   │   │   ├── generalchecklist.component.ts
│   │   │   │   ├── generalsettings.component.ts
│   │   │   │   ├── helpdoc.component.ts
│   │   │   │   ├── mobileappsettings.component.ts
│   │   │   │   ├── printersetup.component.ts
│   │   │   │   ├── purchasesettings.component.ts
│   │   │   │   └── switch.component.ts
│   │   │   ├── menuitems.module.ts
│   │   │   ├── menuitems-routing.module.ts
│   │   │   ├── menuitems.service.ts
│   │   │   └── pages
│   │   │       ├── accountsettings.component.html
│   │   │       ├── billingsettings.component.html
│   │   │       ├── generalchecklist.component.html
│   │   │       ├── generalsettings.component.html
│   │   │       ├── helpdoc.component.html
│   │   │       ├── mobileappsettings.component.html
│   │   │       ├── printersetup.component.html
│   │   │       ├── purchasesettings.component.html
│   │   │       └── switch.component.css
│   │   ├── menumanagement
│   │   │   ├── components
│   │   │   │   └── menumanagement.component.ts
│   │   │   ├── menumanagement.module.ts
│   │   │   ├── menumanagement-routing.module.ts
│   │   │   ├── menumanagement.service.ts
│   │   │   └── pages
│   │   │       └── menumanagement.component.html
│   │   ├── roles
│   │   │   ├── components
│   │   │   │   ├── roles.component.ts
│   │   │   │   ├── roles-cu.component.ts
│   │   │   │   └── roles-view.component.ts
│   │   │   ├── pages
│   │   │   │   ├── roles-cu.component.html
│   │   │   │   └── roles-view.component.html
│   │   │   ├── roles.module.ts
│   │   │   ├── roles-routing.module.ts
│   │   │   └── roles.service.ts
│   │   ├── sqlqueries
│   │   │   ├── components
│   │   │   │   └── sqlqueries.component.ts
│   │   │   ├── pages
│   │   │   │   └── sqlqueries.component.html
│   │   │   ├── sqlqueries.module.ts
│   │   │   ├── sqlqueries-routing.module.ts
│   │   │   └── sqlqueries.service.ts
│   │   ├── testing
│   │   │   ├── testingcomponent
│   │   │   │   ├── testing.component.css
│   │   │   │   ├── testing.component.html
│   │   │   │   └── testing.component.ts
│   │   │   ├── testing.module.ts
│   │   │   ├── testing-routing.module.ts
│   │   │   └── testing.service.ts
│   │   ├── userroles
│   │   │   ├── components
│   │   │   │   ├── userroles.component.ts
│   │   │   │   └── userroles-cu.component.ts
│   │   │   ├── pages
│   │   │   │   └── userroles-cu.component.html
│   │   │   ├── userroles.module.ts
│   │   │   ├── userroles-routing.module.ts
│   │   │   └── userroles.service.ts
│   │   ├── users
│   │   │   ├── components
│   │   │   │   ├── equal-validator.directive.ts
│   │   │   │   ├── users.component.ts
│   │   │   │   ├── users-cu.component.ts
│   │   │   │   ├── users-filter.component.ts
│   │   │   │   └── users-view.component.ts
│   │   │   ├── pages
│   │   │   │   ├── users.component.html
│   │   │   │   ├── users-cu.component.html
│   │   │   │   ├── users-filter.component.html
│   │   │   │   └── users-view.component.html
│   │   │   ├── users.module.ts
│   │   │   ├── users-routing.module.ts
│   │   │   └── users.service.ts
│   │   └── widgetpermission
│   │       ├── components
│   │       │   └── widgetpermission.component.ts
│   │       ├── pages
│   │       │   └── widgetpermission.component.html
│   │       ├── widgetpermission.module.ts
│   │       ├── widgetpermission-routing.module.ts
│   │       └── widgetpermission.service.ts
│   ├── expense
│   │   ├── agentexpenses
│   │   │   ├── agentexpenses.module.ts
│   │   │   ├── agentexpenses-routing.module.ts
│   │   │   ├── agentexpenses.service.ts
│   │   │   ├── components
│   │   │   │   ├── agentexpenses.component.ts
│   │   │   │   ├── agentexpenses-cu.component.ts
│   │   │   │   ├── agentexpenses-edit.component.ts
│   │   │   │   ├── agentexpenses-filter.component.ts
│   │   │   │   └── dailyexpenses.component.ts
│   │   │   └── pages
│   │   │       ├── agentexpenses-cu.component.html
│   │   │       ├── agentexpenses-edit.component.html
│   │   │       ├── agentexpenses-filter.component.html
│   │   │       └── dailyexpenses.component.html
│   │   ├── expense.component.ts
│   │   ├── expense.module.ts
│   │   ├── expense-routing.module.ts
│   │   └── expenses
│   │       ├── components
│   │       │   ├── expenses.component.ts
│   │       │   └── expenses-cu.component.ts
│   │       ├── expenses.module.ts
│   │       ├── expenses-routing.module.ts
│   │       ├── expenses.service.ts
│   │       └── pages
│   │           └── expenses-cu.component.html
│   ├── home
│   │   ├── home.component.ts
│   │   ├── home.module.ts
│   │   ├── homepage
│   │   │   ├── components
│   │   │   │   ├── admin.component.ts
│   │   │   │   ├── agents.component.ts
│   │   │   │   ├── commonwidgets
│   │   │   │   │   ├── preloader.component.ts
│   │   │   │   │   └── profile.component.ts
│   │   │   │   ├── dashboard.component.ts
│   │   │   │   ├── dialog.component.ts
│   │   │   │   ├── superadmin.component.ts
│   │   │   │   └── superadminwidgets
│   │   │   │       └── superadmincpuutil.component.ts
│   │   │   ├── homepage.module.ts
│   │   │   ├── homepage-routing.module.ts
│   │   │   ├── homepage.service.ts
│   │   │   └── pages
│   │   │       ├── admin.component.html
│   │   │       ├── agents.component.html
│   │   │       ├── dashboard.component.html
│   │   │       └── superadmin.component.html
│   │   ├── home-routing.module.ts
│   │   └── profilepage
│   │       ├── components
│   │       │   ├── profile.component.ts
│   │       │   ├── profile-edit-address.component.ts
│   │       │   ├── profile-edit-password.component.ts
│   │       │   ├── profile-edit-userprofile.component.ts
│   │       │   ├── profile-others.component.ts
│   │       │   ├── sidebar.component.ts
│   │       │   ├── tabs
│   │       │   │   ├── tab-address.component.ts
│   │       │   │   └── tab-personaldetails.component.ts
│   │       │   └── verify
│   │       │       ├── verify-email.component.ts
│   │       │       ├── verify-mobile.component.ts
│   │       │       └── verify-topbar.component.ts
│   │       ├── pages
│   │       │   ├── profile-edit-addresss.component.html
│   │       │   ├── profile-edit-password.component.html
│   │       │   ├── profile-edit-userprofile.component.html
│   │       │   ├── profile-others.component.html
│   │       │   ├── sidebar.component.html
│   │       │   └── tabs
│   │       │       ├── tab-assignmentteacher.component.html
│   │       │       └── tab-dashboarddiary.component.html
│   │       ├── profilepage.module.ts
│   │       ├── profilepage-routing.module.ts
│   │       └── profilepage.service.ts
│   ├── layout.component.html
│   ├── layout.component.ts
│   ├── layout.module.ts
│   ├── layout-routing.module.ts
│   ├── myproducts
│   │   ├── agentproducts
│   │   │   ├── agentproducts.module.ts
│   │   │   ├── agentproducts-routing.module.ts
│   │   │   ├── agentproducts.service.ts
│   │   │   ├── components
│   │   │   │   ├── agentproducts.component.ts
│   │   │   │   ├── agentproducts-cu.component.ts
│   │   │   │   └── agentproducts-view.component.ts
│   │   │   └── pages
│   │   │       ├── agentproducts-cu.component.html
│   │   │       └── agentproducts-view.component.html
│   │   ├── agentproductsettings
│   │   │   ├── agentproductsettings.module.ts
│   │   │   ├── agentproductsettings-routing.module.ts
│   │   │   ├── agentproductsettings.service.ts
│   │   │   ├── components
│   │   │   │   ├── agentproductsettings.component.ts
│   │   │   │   └── agentproductsettings-cu.component.ts
│   │   │   └── pages
│   │   │       └── agentproductsettings-cu.component.html
│   │   ├── myproducts.component.ts
│   │   ├── myproducts.module.ts
│   │   └── myproducts-routing.module.ts
│   ├── outlets
│   │   ├── billinghistory
│   │   │   ├── billinghistory.module.ts
│   │   │   ├── billinghistory-routing.module.ts
│   │   │   ├── billinghistory.service.ts
│   │   │   ├── components
│   │   │   │   ├── billinghistory.components.ts
│   │   │   │   └── billinghistory-item.components.ts
│   │   │   └── pages
│   │   │       └── billinghistory-item.component.html
│   │   ├── location
│   │   │   ├── components
│   │   │   │   ├── location.component.ts
│   │   │   │   └── location-cu.component.ts
│   │   │   ├── location.module.ts
│   │   │   ├── location-routing.module.ts
│   │   │   ├── location.service.ts
│   │   │   └── pages
│   │   │       └── location-cu.component.html
│   │   ├── outlet
│   │   │   ├── components
│   │   │   │   ├── outlet.component.ts
│   │   │   │   └── outlet-cu.component.ts
│   │   │   ├── outlet.module.ts
│   │   │   ├── outlet-routing.module.ts
│   │   │   ├── outlet.service.ts
│   │   │   └── pages
│   │   │       └── outlet-cu.component.html
│   │   ├── outlets.component.ts
│   │   ├── outlets.module.ts
│   │   └── outlets-routing.module.ts
│   ├── products
│   │   ├── cess
│   │   │   ├── cess.module.ts
│   │   │   ├── cess-routing.module.ts
│   │   │   ├── cess.service.ts
│   │   │   ├── components
│   │   │   │   ├── cess.component.ts
│   │   │   │   └── cess-cu.component.ts
│   │   │   └── pages
│   │   │       └── cess-cu.component.html
│   │   ├── exports
│   │   │   ├── components
│   │   │   │   └── productstockexport.component.ts
│   │   │   ├── exports.module.ts
│   │   │   ├── exports-routing.module.ts
│   │   │   ├── exports.service.ts
│   │   │   └── pages
│   │   │       └── productstockexport.component.html
│   │   ├── item
│   │   │   ├── components
│   │   │   │   ├── item.component.ts
│   │   │   │   ├── item-cu.component.ts
│   │   │   │   ├── item-cu-multiple.component.ts
│   │   │   │   ├── item-filter.component.ts
│   │   │   │   └── item-view.component.ts
│   │   │   ├── item.module.ts
│   │   │   ├── item-routing.module.ts
│   │   │   ├── item.service.ts
│   │   │   └── pages
│   │   │       ├── item-cu.component.html
│   │   │       ├── item-cu-multiple.component.html
│   │   │       ├── item-filter.component.html
│   │   │       └── item-view.component.html
│   │   ├── itemsimport
│   │   │   ├── components
│   │   │   │   ├── itemsimport.component.ts
│   │   │   │   └── itemsimportmessage.component.ts
│   │   │   ├── itemsimport.module.ts
│   │   │   ├── itemsimport-routing.module.ts
│   │   │   ├── itemsimport.service.ts
│   │   │   └── pages
│   │   │       └── itemsimport.component.html
│   │   ├── products.component.ts
│   │   ├── products.module.ts
│   │   ├── products-routing.module.ts
│   │   └── uom
│   │       ├── components
│   │       │   ├── uom.component.ts
│   │       │   └── uom-cu.component.ts
│   │       ├── pages
│   │       │   └── uom-cu.component.html
│   │       ├── unitconversions_component
│   │       │   ├── unitconversions.component.ts
│   │       │   ├── unitconversions_cu.component.html
│   │       │   └── unitconversions_cu.component.ts
│   │       ├── uom.module.ts
│   │       ├── uom-routing.module.ts
│   │       └── uom.service.ts
│   ├── purchase
│   │   ├── purchaseentry
│   │   │   ├── components
│   │   │   │   ├── changestock.component.ts
│   │   │   │   ├── itemstocks.component.ts
│   │   │   │   ├── purchaseentry.component.ts
│   │   │   │   ├── purchaseentry-filter.component.ts
│   │   │   │   ├── stock_purchase.component.ts
│   │   │   │   └── stock_purchase-view.component.ts
│   │   │   ├── pages
│   │   │   │   ├── changestock.component.html
│   │   │   │   ├── itemstocks.component.html
│   │   │   │   ├── purchaseentry.component.css
│   │   │   │   ├── purchaseentry.component.html
│   │   │   │   ├── purchaseentry-filter.component.html
│   │   │   │   └── stock_purchase-view.component.html
│   │   │   ├── purchaseentry.module.ts
│   │   │   ├── purchaseentry-routing.module.ts
│   │   │   └── purchaseentry.service.ts
│   │   ├── purchasereturn
│   │   │   ├── components
│   │   │   │   ├── purchasereturn.component.ts
│   │   │   │   ├── purchasereturn-cu.component.ts
│   │   │   │   └── purchasereturn-edit.component.ts
│   │   │   ├── pages
│   │   │   │   ├── purchasereturn-cu.component.html
│   │   │   │   └── purchasereturn-edit.component.html
│   │   │   ├── purchasereturn.module.ts
│   │   │   ├── purchasereturn-routing.module.ts
│   │   │   └── purchasereturn.service.ts
│   │   ├── stock_purchase.component.ts
│   │   ├── stock_purchase.module.ts
│   │   ├── stock_purchase-routing.module.ts
│   │   └── supplier
│   │       ├── components
│   │       │   ├── supplier.component.ts
│   │       │   ├── supplier-cu.component.ts
│   │       │   ├── supplierimport.component.ts
│   │       │   └── supplierimportmessage.component.ts
│   │       ├── pages
│   │       │   ├── supplier-cu.component.html
│   │       │   └── supplierimport.component.html
│   │       ├── supplier.module.ts
│   │       ├── supplier-routing.module.ts
│   │       └── supplier.service.ts
│   ├── reports_all_product
│   │   ├── graphs
│   │   │   ├── components
│   │   │   │   ├── mostselling_products_in_number.component.ts
│   │   │   │   ├── mostselling_products_in_revenue.component.ts
│   │   │   │   ├── outletwisesales.component.ts
│   │   │   │   ├── productwisesales.component.ts
│   │   │   │   └── timeseriesgraph.component.ts
│   │   │   ├── graphs_all.module.ts
│   │   │   ├── graphs_all-routing.module.ts
│   │   │   ├── graphs_all.service.ts
│   │   │   └── pages
│   │   │       ├── mostselling_products_in_number.component.html
│   │   │       ├── mostselling_products_in_revenue.component.html
│   │   │       ├── outletwisesales.component.html
│   │   │       ├── productwisesales.component.html
│   │   │       └── timeseriesgraph.component.html
│   │   ├── gstreports
│   │   │   ├── components
│   │   │   │   └── gstreports.component.ts
│   │   │   ├── gstallreports.module.ts
│   │   │   ├── gstallreports-routing.module.ts
│   │   │   ├── gstallreports.service.ts
│   │   │   └── pages
│   │   │       └── gstreports.component.html
│   │   ├── pdfreports
│   │   │   ├── components
│   │   │   │   └── pdfreports.component.ts
│   │   │   ├── pages
│   │   │   │   └── pdfreports.component.html
│   │   │   ├── pdfreports.module.ts
│   │   │   ├── pdfreports-routing.module.ts
│   │   │   └── pdfreports.service.ts
│   │   ├── reports_all_product.component.ts
│   │   ├── reports_all_product.module.ts
│   │   ├── reports_all_product-routing.module.ts
│   │   └── stocks
│   │       ├── components
│   │       │   ├── balance_sheet.component.ts
│   │       │   ├── expired_product.component.ts
│   │       │   ├── financialreports.component.ts
│   │       │   ├── physicalstocks.component.ts
│   │       │   ├── reorder_level.component.ts
│   │       │   └── stockreport.component.ts
│   │       ├── pages
│   │       │   ├── balance_sheet.component.html
│   │       │   ├── expired_product.component.html
│   │       │   ├── financialreports.component.html
│   │       │   ├── physicalstocks.component.html
│   │       │   ├── reorder_level.component.html
│   │       │   └── stockreport.component.html
│   │       ├── stocks_all.module.ts
│   │       ├── stocks_all-routing.module.ts
│   │       └── stocks_all.service.ts
│   ├── stocktransfer
│   │   ├── materialin
│   │   │   ├── components
│   │   │   │   ├── materialin.component.ts
│   │   │   │   └── materialout.component.ts
│   │   │   ├── materialin.module.ts
│   │   │   ├── materialin-routing.module.ts
│   │   │   ├── materialin.service.ts
│   │   │   └── pages
│   │   │       ├── materialin.component.html
│   │   │       └── materialout.component.html
│   │   ├── stocktransfer.component.ts
│   │   ├── stocktransfer.module.ts
│   │   └── stocktransfer-routing.module.ts
│   └── systemconfig
│       ├── bankaccount
│       │   ├── bankaccount.module.ts
│       │   ├── bankaccount-routing.module.ts
│       │   ├── bankaccount.service.ts
│       │   ├── components
│       │   │   ├── bankaccount.component.ts
│       │   │   └── bankaccount-cu.component.ts
│       │   └── pages
│       │       └── bankaccount-cu.component.html
│       ├── caste
│       │   ├── caste.module.ts
│       │   ├── caste-routing.module.ts
│       │   ├── caste.service.ts
│       │   ├── components
│       │   │   ├── caste.component.ts
│       │   │   └── caste-cu.component.ts
│       │   └── pages
│       │       └── caste-cu.component.html
│       ├── citytown
│       │   ├── citytown.module.ts
│       │   ├── citytown-routing.module.ts
│       │   ├── citytown.service.ts
│       │   ├── components
│       │   │   ├── citytown.component.ts
│       │   │   ├── citytown-cu.component.ts
│       │   │   └── citytown-message.component.ts
│       │   └── pages
│       │       └── citytown-cu.component.html
│       ├── country
│       │   ├── components
│       │   │   ├── country.component.ts
│       │   │   └── country-cu.component.ts
│       │   ├── country.module.ts
│       │   ├── country-routing.module.ts
│       │   ├── country.service.ts
│       │   └── pages
│       │       └── country-cu.component.html
│       ├── district
│       │   ├── components
│       │   │   ├── district.component.ts
│       │   │   ├── district-cu.component.ts
│       │   │   └── district-message.component.ts
│       │   ├── district.module.ts
│       │   ├── district-routing.module.ts
│       │   ├── district.service.ts
│       │   └── pages
│       │       └── district-cu.component.html
│       ├── emailconfig
│       │   ├── components
│       │   │   ├── emailconfig.component.ts
│       │   │   ├── emailconfig-cu.component.ts
│       │   │   ├── emailhistory.component.ts
│       │   │   └── emailhistory-filter.component.ts
│       │   ├── emailconfig.module.ts
│       │   ├── emailconfig-routing.module.ts
│       │   ├── emailconfig.service.ts
│       │   └── pages
│       │       ├── emailconfig-cu.component.html
│       │       └── emailhistory-filter.component.html
│       ├── emailcredentials
│       │   ├── components
│       │   │   ├── emailcredentials.component.ts
│       │   │   └── emailcredentials-cu.component.ts
│       │   ├── emailcredentials.module.ts
│       │   ├── emailcredentials-routing.module.ts
│       │   ├── emailcredentials.service.ts
│       │   └── pages
│       │       └── emailcredentials-cu.component.html
│       ├── hobbies
│       │   ├── components
│       │   │   ├── hobbies.component.ts
│       │   │   └── hobbies-cu.component.ts
│       │   ├── hobbies.module.ts
│       │   ├── hobbies-routing.module.ts
│       │   ├── hobbies.service.ts
│       │   └── pages
│       │       └── hobbies-cu.component.html
│       ├── languages
│       │   ├── components
│       │   │   ├── languages.component.ts
│       │   │   └── languages-cu.component.ts
│       │   ├── languages.module.ts
│       │   ├── languages-routing.module.ts
│       │   ├── languages.service.ts
│       │   └── pages
│       │       └── languages-cu.component.html
│       ├── languagesettings
│       │   ├── components
│       │   │   ├── languagesettings.component.ts
│       │   │   └── languagesettings-cu.component.ts
│       │   ├── languagesettings.module.ts
│       │   ├── languagesettings-routing.module.ts
│       │   ├── languagesettings.service.ts
│       │   └── pages
│       │       └── languagesettings-cu.component.html
│       ├── nationality
│       │   ├── components
│       │   │   ├── nationality.component.ts
│       │   │   └── nationality-cu.component.ts
│       │   ├── nationality.module.ts
│       │   ├── nationality-routing.module.ts
│       │   ├── nationality.service.ts
│       │   └── pages
│       │       └── nationality-cu.component.html
│       ├── occupation
│       │   ├── components
│       │   │   ├── occupation.component.ts
│       │   │   └── occupation-cu.component.ts
│       │   ├── occupation.module.ts
│       │   ├── occupation-routing.module.ts
│       │   ├── occupation.service.ts
│       │   └── pages
│       │       └── occupation-cu.component.html
│       ├── organization
│       │   ├── components
│       │   │   ├── organization.component.ts
│       │   │   ├── organization-cu.component.ts
│       │   │   └── organization-view.component.ts
│       │   ├── organization.module.ts
│       │   ├── organization-routing.module.ts
│       │   ├── organization.service.ts
│       │   └── pages
│       │       ├── organization-cu.component.html
│       │       └── organization-view.component.html
│       ├── relationship
│       │   ├── components
│       │   │   ├── relationship.component.ts
│       │   │   └── relationship-cu.component.ts
│       │   ├── pages
│       │   │   └── relationship-cu.component.html
│       │   ├── relationship.module.ts
│       │   ├── relationship-routing.module.ts
│       │   └── relationship.service.ts
│       ├── religion
│       │   ├── components
│       │   │   ├── religion.component.ts
│       │   │   └── religion-cu.component.ts
│       │   ├── pages
│       │   │   └── religion-cu.component.html
│       │   ├── religion.module.ts
│       │   ├── religion-routing.module.ts
│       │   └── religion.service.ts
│       ├── smsconfig
│       │   ├── components
│       │   │   ├── smsconfig.component.ts
│       │   │   ├── smsconfig-cu.component.ts
│       │   │   ├── smshistory.component.ts
│       │   │   └── smshistory-filter.component.ts
│       │   ├── pages
│       │   │   ├── smsconfig-cu.component.html
│       │   │   └── smshistory-filter.component.html
│       │   ├── smsconfig.module.ts
│       │   ├── smsconfig-routing.module.ts
│       │   └── smsconfig.service.ts
│       ├── smscredentials
│       │   ├── components
│       │   │   ├── smscredentials.component.ts
│       │   │   └── smscredentials-cu.component.ts
│       │   ├── pages
│       │   │   └── smscredentials-cu.component.html
│       │   ├── smscredentials.module.ts
│       │   ├── smscredentials-routing.module.ts
│       │   └── smscredentials.service.ts
│       ├── state
│       │   ├── components
│       │   │   ├── state.component.ts
│       │   │   ├── state-cu.component.ts
│       │   │   └── state-message.component.ts
│       │   ├── pages
│       │   │   └── state-cu.component.html
│       │   ├── state.module.ts
│       │   ├── state-routing.module.ts
│       │   └── state.service.ts
│       ├── systemconfig.component.ts
│       ├── systemconfig.module.ts
│       └── systemconfig-routing.module.ts
└── shared
    ├── datatables
    │   ├── datatable.component.html
    │   ├── datatable.component.ts
    │   └── datatable.service.ts
    ├── dateadapter
    │   └── pickdateadapter.component.ts
    ├── errorpages
    │   ├── errorpages.module.ts
    │   ├── errorpages-routing.module.ts
    │   ├── maintenance.component.ts
    │   ├── not-found.component.css
    │   └── not-found.component.ts
    ├── guards
    │   ├── auth.guard.spec.ts
    │   └── auth.guard.ts
    ├── jwt.interceptor.ts
    ├── login
    │   ├── auth.service.spec.ts
    │   ├── auth.service.ts
    │   ├── login.component.css
    │   ├── login.component.html
    │   ├── login.component.spec.ts
    │   ├── login.component.ts
    │   ├── login.module.ts
    │   ├── login-routing.module.ts
    │   ├── logout.component.ts
    │   ├── particles.component.ts
    │   └── verify_emailtoken.component.ts
    ├── partials
    │   ├── footer.component.html
    │   ├── footer.component.ts
    │   ├── menu.component.css
    │   ├── menu.component.html
    │   ├── menu.component.ts
    │   ├── toolbar.component.html
    │   ├── toolbar.component.ts
    │   ├── topnavbar.component.html
    │   ├── topnavbar.component.ts
    │   ├── topnavbarmessage.component.css
    │   └── topnavbar.service.ts
    ├── shared.module.ts
    ├── shared.service.ts
    ├── tinymce.ts
    └── toolbar_datatable.component.ts

Backend

We use python programming language. Here is a quick tutorial. We use Django a python module for webdevelopment.

Billing

Flood Cess Calculations

The flood cess in Kerala is calculated on the value of the supply(CGST and SGST are not included in the value of supply).

eg:

  • The value of the goods supplied is Rs. 1000.
  • The GST rate is 12%. CGST is Rs. 60 and SGST is Rs. 60.
  • The flood CESS is 1% and will have a value of Rs. 10.
  • The total of your invoice will be Rs. 1130 only.
MRP = 1130
value = 1130*100/(12+1+100)

Here is the live example: billings/views/billentry.py line 165: amount_excl_tax = (amount * 100) / (item.gst_rate+cess_rate + 100)

Thermal print

https://forum.ionicframework.com/t/printing-on-bluetooth-printers/17886/23

TXT_BOLD_OFF: '\x1b\x45\x00', // Bold font OFF
TXT_BOLD_ON: '\x1b\x45\x01', // Bold font ON

TXT_FONT_A: '\x1b\x4d\x00', // Font type A //normal font
TXT_FONT_B: '\x1b\x4d\x01', // Font type B //small font
TXT_FONT_C: '\x1b\x4d\x02', // Font type C //normal font

TXT_NORMAL: '\x1b\x21\x00', // Normal text
TXT_2HEIGHT: '\x1b\x21\x10', // Double height text
TXT_2WIDTH: '\x1b\x21\x20', // Double width text
TXT_4SQUARE: '\x1b\x21\x30', // Double width & height text

TXT_UNDERL_OFF: '\x1b\x2d\x00', // Underline font OFF
TXT_UNDERL_ON: '\x1b\x2d\x01', // Underline font 1-dot ON
TXT_UNDERL2_ON: '\x1b\x2d\x02', // Underline font 2-dot ON
TXT_ITALIC_OFF: '\x1b\x35', // Italic font ON
TXT_ITALIC_ON: '\x1b\x34', // Italic font ON

TXT_FONT_A: '\x1b\x4d\x00', // Font type A //normal font
TXT_FONT_B: '\x1b\x4d\x01', // Font type B //small font
TXT_FONT_C: '\x1b\x4d\x02', // Font type C //normal font

Reports

Stock and Financial Report Calculations

Closing Balance(Stock)= opening balance + purchase - sales - stock adjustment
Closing Balance(Financial)= closing balance(stock) * purchase rate
Difference(Financial)= opening balance + purchase - sales - closing balance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment