Saturday, 30 November 2019

What are the Basic Accounting Principles of eCommerce Businesses?

   
       
          We can classify the eCommerce business websites on the basis of Business and Consumer.  On the Business, We can further classify into B2B or B2C eCommerce websites. Similarly, Based on the Consumer, We can further classify into C2B or C2C eCommerce websites. B2B eCommerce websites links different businesses or parts of the businesses. The transaction is taking place between the wholesalers, retailers, industrial manufacturer etc., B2B has a feature of high volume of sales per customer even the lesser number of customers. It has a secured payment system and privacy of information. B2C websites are the sites directly selling the products and services to the Customers. Generally, B2C has low volume per consumer and large number of consumers.
               C2B eCommerce websites are the sites where the consumer will set the prices. then the business enterprises bid to offer products and services. The consumers bond together as a buyer group and make the C2B relationship. These groups are economically motivated groups like demand aggregators or socially oriented group of cost related groups. Similarly, C2C ecommerce websites will enable the consumers to sell or buy each other through auction process. It exchange between and among consumers that includes the third party involvement. Ecommerce operators will conduct the specific event or promotions. In such cases, the planned liability on the account of sale of merchandise or service will be communicated to the vendor. The decision on shared liability will be taken on case to case basis. It will be communicated and debited to the vendors account from time to time.

Revenue for Ecommerce Companies:
        Revenue is the Gross inflow of cash or Receivable arising by ordinary activities due to the sales of goods and rendering services. Revenue can be generated from enterprise resources that yielding the interest, dividends and Royalties etc., The eCommerce companies main revenue are subscription, membership, web hosting, content selling, merchandising and advertising activities. The revenue can be recognized when the goods are sold and services are rendered. It is mainly related to the performance which can be achieved and certain conditions are fulfilled like,
   1. The seller of goods should transfer the property ownership in goods to the buyer for a price
   2. The significant risk and rewards of ownership transfer to the buyer. The seller has no effective control of goods transferred that are associated with ownership.
   3. Once you sold the goods, there should not be any significant uncertainty exists on the sale of goods.
      In the services, the revenue can be generated through the complete service of contract or proportionate completion of contract whichever relates to the revenue of the work can be accomplished. The performance will be considered to be achieved when there is no significant uncertainty derived from rendering of services.
   
Revenue by Merchandising:  In merchandising services, the significant issue is to recognize the revenue as Gross Amount(related to cost of sales) or Net Amount(similar to commission) of revenue. It is happening in the ecommerce companies which are in the business of distribution, reselling to the 3rd party of products and services. It is mainly in the B2C websites.
       If a ecommerce company acting as a principal means it is assuming as a risk on the account of collection, delivery, returns and reward of ownership,  then that ecommerce company should recognize the revenue on cost of Gross Basis only. If an ecommerce company acting as an agent or broker, It means that they sell goods and services, but they do not assume risk and reward of ownership. So, the compensation is in the form of fee and commission. It is an engaged service bringing purchaser and seller together. In such cases, they receive only the service charges. They do not go for the Gross Basis.

Auction Revenue: Some eCommerce companies host auction sites so that users can purchase or sell the goods and services. This auction income is divided into listing fee and transaction fee. Listing fee is a upfront fee received when a seller or purchaser register and maintained over the specific period. This listing fee can be recognized over the period of contract or there is no significant outstanding vendor obligations and the collection should be reasonably certain. So, it is not recognized revenue on the day 1 itself. For ex, OLX provides the auction site where goods and services can be listed. They will collect the upfront fee and accounting entry will be passed as differed revenue. The subscription period amount of 1 month will be considered as revenue of that month and will recognized as revenue over the period of contract. The second auction revenue is transaction fee. It is for facilitating the transaction and in the form of % of revenue earned by the seller. This revenue can be recognized when the transaction is completed and confirmed that no further vendor obligations. For ex, the product sold on OLX for the transaction charge of 2% of sale value will be considered as a direct revenue.

Ecommerce Accounting Principles:  The measurement of cost related to website can be recognized as intangible item. It is to decide and treat as asset to capitalize it or expense. So, We need to classify into research phase and development phase. The expenditure incurred during the research phase are expense(P&L). The expenditure incurred on the development phase of the website and make sure that the future economic benefits can be generated that expenditure are capitalized. The cost incurred in developing the new websites after the 1st website open to the user will be expensed in the period in which it incurred. There are other expenditure in eCommerce companies like acquiring the tangible assets, land and building, computer hardware and software etc.,
    Ecommerce companies sells the content for a price through download facility. The revenue can be recognized when it considered as a sale and delivered to the purchaser. For ex, In online classes, the website content can be provided through username and password. So, it is considered as delivered when userid and password made available to the students. Ecommerce companies provides the webhosting and maintenance services. It recognize the revenue over the period for which the hosting and maintenance service is provided. But, there is a condition that this service should be provided on continuous basis. There is an other method when you come across more systematic and rational.
      In the sales return, the option given to the customer to return the goods are sold. In some cases, the customer has the right to return the goods. There is an uncertainty of possibility of return. So, you can not recognize the revenue till the goods accepted by the customer or till the time period of rejection is elapsed. In some other cases, the eCommerce companies based on the past experience, they can make reliable estimate on amount of goods will return. So, they can recognize the revenue only for the items that are not expected to be returned.

Equity Based Ecommerce Consideration of Accounting: Ecommerce companies will be funding the expenditure through the issue of equity shares when the cash is not available as alternative to attract new business relationships, alliances and supplier agreements. If the products, services and assets are acquired in exchange of equity shares, you need to check the transaction between the related parties or unrelated parties. The transaction is between the unrelated parties, they are acquiring the product, service and asset in exchange of shares. In this case, the value placed is FAIR value will be recognized as revenue.
      If the transaction between the related parties, the value has not been placed on the product, service or asset. Now, we have to see the fair value of product, service, asset is available. If it available, we have to recognize as fair value. If it is not available, we need to see the fair value of the equity transferred available and recognize as fair value of equity.

Points and Loyalty Program in Accounting: This will be given in different structures where the ecommerce companies selling the points to business partners who will in turn issue to the customers based on the purchases and actions of the customer. For ex, the ecommerce company in arrangement with book store will issue the reward points to the customers who will make minimum volume of purchase. The customer will exchange the reward points for using the ecommerce website. In other case, the ecommerce company selling directly to the customer so that it will encourage members to take action which will in turn generate payment from the business partner. The costs are associated with the incentives. If the incentive with reference to the particular customer only, it will be shown as deduction from turnover value. So, the appropriate estimate of cost is required. If the loyalty points are general in nature,  it will go for the general provision and will be treat it as expense(P&L) instead of showing the deduction in turnover.

Risk & Rewards to the Customer: The revenue is an important metric in eCommerce Companies. If you look at the valuation of eCommerce companies that are all revenue multiples. The accounting issue is to determine the revenue presentation are Gross or Net. Ecommerce companies accept the payments through credit cards, debit cards, internet banking and cash on delivery.  The delivery responsibility of the ecommerce company is the risk and rewards transferred to the customer in B2B or B2C. It is important to take into consideration that the insurance and sales return on accounting. The eCommere companies tie up with logistic providers to bear the insurance risk and cost so that the ecommerce companies can recognize the revenue when they dispatch the goods from the warehouse. There is another scenario that the cost of delivery through transport borne by the ecommerce Entity. So, the risk of delivery and risk of loss are still with the ecommerce companies. They can recognize the revenue only when the product is delivered to the customer.
     
Membership & Subscription Fees : The membership and subscription fees can be collected in 3 ways. Those are,
    * Non-Refundable Fee
    * Refundable Fee
    * Periodic Fee
     Non-Refundable fee for use of all services in website by one time payment of indefinite use of services of website or a specified time period. There are two elements involved. Those are
    * Initial Membership
    * Revenue
       The initial membership fees or entrance fees that should be capitalized. The revenue that can arise by rendering of services of supply of products. For ex, the amazon prime is a paid service. During the seasonal sale, the subscriber is given access to their website prior to other customers and it does not include any products purchased.
      For the Non-refundable fee of the use of all services of website indefinitely will collect only the initial fee. Here, the products and services will be provided in future by partly or wholly for the advance payment. It implies that the service on continuous basis after the upfront fee. But, there is uncertainty involved in the usage of service. You should recognize the revenue not less than 5 years  or below 5 years in a systematic and rational basis of more representative of service rendered.
      The refundable fee are subject to certain conditions stipulated by subscription agreement. In such cases, the revenue can not be recognized by the membership fees. You can recognize that fee as a revenue only the reasonably certain conditions will not be fulfilled by the subscriber. Till that time, the amount received will be retained by the customer refundable fees account.
      The subscription and periodic membership fees can be collected on monthly, quarterly and annually. You can recognize as a revenue over the period of subscription. For ex, Our company sells the online inventory tracking software, the customer pays the subscription fees of Rs.5000/- monthly. At the start of each month the sign up fee of Rs.5000/- will be charged. This sign up fee will be used for providing the service in the first month and the beginning of every month the fee will be collected. We can not recognize as a service on day 1 and we need to provide the service for next 30 days. So, this will be retained as a deferred revenue(means money received, service not provided)  account of Rs.5000/-. At the end of the month, once we provide all the services, we can recognize as revenue. Now, it will be credited to revenue account.




Friday, 15 November 2019

How to Build Django eCommerce Web Application?

           
          Django is a web application that comprises bunch of apps. It is a web application has a sub apps of bigger things and has a bunch of components to make the app itself. Django is a tool written in python that used to develop a website. If you look at the  Django website, it describes Django is a high level Python web framework that encourages rapid development in clean and pragmetic design. Web framework is a collection of tools to build a website. Django comes with Object Relational Mapper (ORM) which helps to make a database queries. It has a URL routing which helps to determine what logic to follow depending on the URL of a web request. Another feature is HTML templating which allows us to have presentation logic and insert data into our HTML. It contains a built-in web server for convenience but it is not used outside of the context. When we deploy Django on live website, it works in tandem with web server.
             In order to develop with Django, you need to install the latest version of python3. Once the installation is finished, you can install Django. When you installed python3, it is also installed a script called pip that installs python libraries and tools. You can install django by just typing the command of pip install django==2.2.7. Once you get successfully installed with pytz library which offers timezone support, you are ready to develop a Django project.
Django Files Overview:
           To create a project, just type django-admin.py startproject (projectname), then open that folder in the sublime or Atom text editor and you can see the files and the scripts generated. The manage.py file helps to run various commands for your project. The _init_ file tells python that this folder contains python files. The wsgi or wuzgi file provides a hook for web server. The settings file configure django and url file routes request based on the URL. With these files, you can run the project for the first time. So, just type python manage.py runserver in the terminal and open the browser to see the results. Now, you can see the default screen that Django makes when you create a new project and ready to build completely.

Developing Django App: Django app is a component within an overall Django project or folder with python files. Each Django app has a set of features for a specific purpose. Django app has the features related to forum, wiki, or blog etc., In order to create the app, type the command python manage.py startapp adoptions which will create an adoption app in the terminal.  In the adoptions, there are several files with migration folder. Now, you need to add the Django app to the project. Inside the settings file, you need to add the string of adoptions it installed. The Django has the following types of files and folder that plays an specific role in that application,
   * apps.py - it controls the settings specific to the app
   * models.py - it provides the data layer which the Django uses to construct our database schema and queries.
   * views.py - it defines the logic and control flow for handling request and defines the HTTP responses that are returned.
   * admin.py - it defines the administrative interface of the app. This will allow to see and edit the data
   * urls.py - this will be used for URL routing of the app
   * tests.py - it is used for writing the unit test for the functionality of the app.
   * migrations - this folder uses to migrate the database when you create and change our database schema.

Django Models & Views:
        Django uses a Model View Controller(MVC) architecture. It uses URL patterns, views, models and templates. When Django application receives web request, it uses the URL patterns to decide the views to pass the request for handling. Views provide the logic of the project. It works as a function that takes HTTP request and HTTP response. Each views leverage Django models to perform queries against the database. A Django model is a class with attributes that define the schema or underlying structure of the database table. It has built-in methods for making queries in the tables .Each view leverage templates which help with the presentation layer of the HTML response look like. The template is a separate file consists of HTML along with variables, loops and logic.
     
        URL Patterns   ----------->   Views -----------------> Templates
           (urls.py)                           (views.py)                   (adoptions/templates)                 
                                                       |
                                                       |
                                                       |
                                                  Models
                                                (models.py)
     
         If the request comes into Django with root path of just a slash, it first looks URL patterns to find the view and route the path to functions in adoption/views.py called home. The home function will take the request and make any database calls needed in adoptions/models.py. For ex, htttp://www.ourwebsite.com will be processed as,
   
       /    --------------------->   home ------------------->  adoptions/home.html
(Root Path)
         Models create data layer that create the database structure and query the database. Models.py contains set of models for the django app. Model is a class inheriting from django.db.models. It is used to define fields as class attributes. Model is similar to table in the spreadsheet. Each field of that model is the column for the spreadsheet table and each record in the database is a row in the spreadsheet. To define models fields, you need to define the attributes inside the model by using the fieldClasses with Charfield, or textfield, or integerfield. For each field, you can define the attributes of max_length or blank. To implement the models, open the models.py in the adoptions app. It contains the baseline as from django.db import models. Then, define the class as,

class Dream(models.Model):

   website = models.CharField(max_length = 100)
   mail = models.CharField(max_length = 100)
   name = models.CharField(max_length = 100)
   phonenumber = models.IntegerField()

   class Meta:
      db_table = "dream"

Django Migrations:
        The models define the structure of the database tables. Migrations generate the scripts to change the database structure when we update our code and models. When a new model is defined, the initial migration will create the corresponding database table. Also, the migration is needed when the field is added or removed from an existing model or attributes of the field has changed. The commands in migration are makemigration, showmigration and migrate. Makemigration reads the current model file and inspects the current state of the database to determine the changes need to make the database structure that match the models file. These files are placed in migration folder and numbered starting with one. We can run the migration for the specific app to specific number of migration by,
            Migrate  (appname) number
    Navigate to the folder of manage.py file in the terminal. To make your migration, type python manage.py makemigrations. You can see the output that the adoptions app created the migrations for the models. It is a initial migration, because it does not have the table for these models yet.  You can see the existing migration file by the command of python manage.py showmigrations. To apply the migration, type the command of pyhton manage.py migrate.  You can see the output that the migration applied successfully. The db.sqlite file which helps the database to work. Now, we can see the structure of the database in SQLLite that looks like. Also, you need to run the command of "python manage.py migrate --run-syncdb".  After running the migrations and confirmed that they are applied successfully and ready to use our database.

Django Admin:  It creates an adminstrative interface for our project. In admin.py, you need to import the models by "from .models import ". In order to make an admin interface of this model, you need to inherit the class from admin.modelAdmin. Pass keyword will be used for the valid python class. Then, you need to register this class with the admin to associate the model in it. For ex,

Now, you can see the results in the terminal. Before that, you have to create superuser. So, Just type the command of python manage.py
createsuperuser, set the superuser and password. Once you created the superuser successfully, you can run the project on browser(python manage.py runserver). This will navigate to the admin interface. Now, you can use the superusername and password to the Django admin portal. It lists all the models registered in Django admin.

URL Handlers and Views:  Open the adoptions folder and click on the views file. First, you need to  display the home view. Then, we can display the detail view. To accomplish this, the body of the home view needs to fetch all of the model information. So, we need to import the models and can make query to that models. The HTTP response function will take the responsibility of rendering the HTML on to the template. Also, you can make your view to be concerned with necessary database queries and passing the data to that template.  For ex, the view.py can be defined as,

from django.shortcuts import render
from django.http import HttpResponse

from models import dream

def home(request):
return render(request, 'home.html', {})

Now, we need to create a template folder inside the adoption folder. Inside the folder, we need to create a files for each of our template like home.html, detail.html etc., You may noticed that, if you started the development server, it displays the default welcome page. In order to use your new view, you need to tell the Django to display this view when someone navigates to the home page.  So, update the url.py as,

from django.conf.urls import url
from django.contrib import admin

urlpatterns = [
    url(r'^admin/', admin.site.urls),
]

Now, we are ready to test our views which will work.