Monday 29 December 2014

HTML color code from a website



Colors are displayed combining RED, GREEN, and BLUE light.

Color Values

Colors are defined using a hexadecimal (hex) notation for the Red, Green, and Blue values (RGB).
The lowest value for each light source is 0 (hex 00). The highest value is 255 (hex FF).
Hex values are written as # followed by either three or six hex characters.
Three-digit notations (#rgb) are automatically converted to six digits (#rrggbb):

 Useful Link For CSS Designer

1) colors by HEX Value

http://www.w3schools.com/html/html_colorvalues.asp

2) Mix two colors and see the result with Color Code.

http://www.w3schools.com/tags/ref_colormixer.asp

3) Get darker/lighter shades of any color.

http://www.w3schools.com/tags/ref_colorpicker.asp

4) online image color picker

http://imagecolorpicker.com/

Friday 19 December 2014

Print Format For Sales Order In ERPNext

Custom Print Format For Sales Order In ERPNext

{%- macro add_header(page_num, max_pages, doc, letter_head, no_letterhead) -%}
    {% if letter_head and not no_letterhead %}
    <div class="letter-head">{{ letter_head }}</div>
    {% endif %}
    {%- if doc.meta.is_submittable and doc.docstatus==0-%}
    <div class="alert alert-info text-center">
        <h4 style="margin: 0px;">{{ _("DRAFT") }}</h4></div>
    {%- endif -%}
    {%- if doc.meta.is_submittable and doc.docstatus==2-%}
    <div class="alert alert-danger text-center">
        <h4 style="margin: 0px;">{{ _("CANCELLED") }}</h4></div>
    {%- endif -%}
    {% if max_pages > 1 %}
    <p class="text-right">{{ _("Page #{0} of {1}").format(page_num, max_pages) }}</p>
    {% endif %}
{%- endmacro -%}

<style>
    .table-hover>tbody>tr:hover>td, .table-hover>tbody>tr:hover>th {
    background-color: #B7CCF2;
    color:#000000;
    font-size:16px;
    }
    .print-format table, .print-format tr, 
    .print-format td, .print-format div, .print-format p {
        font-family: sans-serif;
        line-height: 90%;
        vertical-align: middle;
    }
    @media screen {
        .print-format {
            width: 210mm;
            padding: 10mm;
            min-height: 297mm;
            footer {page-break-after: always;}
        }
    }
</style>

<small>
{{ add_header(0,1,doc,letter_head, no_letterhead) }}
<table class="table table-condensed table-bordered">
  <tr>
    <td colspan="2">
        <b style="font-size:16px;">{{ doc.select_print_heading or (doc.print_heading if doc.print_heading != None
            else _(doc.doctype)) }}</b>  
    </td>
    <td style="width:34%">           
        <b style="font-size:16px; text-align:left; vertical-align:middle;">{{ _("#") }}{{ doc.name }}</b><br>
    </td>
  </tr>
</table>

<table class = "table table-condensed table-bordered">
  <tr>
     <td style="width: 100%;">
        <b>{{ _("Head") }}:</b><br>
        <b>{{ _("INVOICE") }}:</b> 
    </td>
    <td style="width: 33%;">
        <b>{{ _("To") }}:</b> {{ doc.customer_name }}<br>
        <b>{{ _("Address") }}:</b> {{ doc.address_display }}
    </td>
    <td style="width: 33%;">
        <b>{{ _("Ship To") }}:</b> {{ doc.shipping_address_title }}<br>
        <b>{{ _("Address") }}:</b> {{ doc.shipping_address }}
    </td>
    <td style="width: 34%;">
        <b>{{ _("Date") }}:</b> {{ doc.get_formatted("transaction_date") }}<br>
        <b>{{ _("PO #") }}:</b> {{ doc.po_no }} <br>
        <b>{{ _("PO Date") }}:</b> {{ doc.get_formatted("po_date") }}
    </td>
  </tr>
</table>

<table class="table table-condensed table-hover table-bordered">
        <tr>
            <th>Sr</th>
            <th>Description</th>
            <th class="text-right">Qty</th>
            <th class="text-right">Rate</th>
            <th class="text-right">Amount</th>
        </tr>
        {%- for row in doc.sales_order_details -%}
        <tr>
            <td style="width: 3%;">{{ row.idx }}</td>
            <td style="width: 57%;">{{ row.description }}</td>
            <td style="width: 10%; text-align: right;">{{ row.qty }} {{ row.uom or row.stock_uom }}</td>
            <td style="width: 15%; text-align: right;">{{
                row.get_formatted("rate", doc) }}</td>
            <td style="width: 15%; text-align: right;">{{
                row.get_formatted("amount", doc) }}</td>
        </tr>
        {%- endfor -%}
    </tbody>
</table>
<table class="table table-condensed table-bordered">
  <tr>
    <td width="50%">
        <p>{% if doc.terms %} <b>{{ _("Auxiliary Information") }}: </b>{{ doc.terms or "" }}
        {%- endif -%}
    </p>
       <p style="font-size:12px">{% if doc.in_words_export %}
        <b>{{ _("Total Amount (In Words)") }}: </b><br>
            {{ doc.in_words_export }}
        {%- endif -%}
    </p><br><br>
    <table class="table table-condensed">
      <tr>
        <td height="100px"; valign="top">
            <b>{{ _("Received By:") }}</b>
        </td>
      </tr>
      <tr>
        <td>
            <b>{{ _("Customer Sign") }}</b>
        </td>
      </tr>
    </table>

    </td>
<td>
        <table class="table table-condensed">
            <tr>
                <td class="text-right" style="width: 30%">
                    {{ _("Net Total") }}
                </td>
                <td class="text-right">
                    {{ doc.get_formatted("net_total_export") }}
                </td>
            </tr>
            {%- for row in doc.other_charges -%}
            {%- if not row.included_in_print_rate -%}
            {%- if row.tax_amount -%}
            <tr height:100%>
                <td class="text-right" style="width: 70%">
                    {{ row.description }}
                </td>
                <td class="text-right">
                    {{ row.get_formatted("tax_amount", doc) }}
                </td>
            </tr>
            {%- endif -%}
            {%- endif -%}
            {%- endfor -%}
            {%- if doc.discount_amount -%}
            <tr>
                <td class="text-right" style="width: 70%">
                    {{ _("Discount") }}
                </td>
                <td class="text-right">
                    {{ doc.get_formatted("discount_amount") }}
                </td>
            </tr>
            {%- endif -%}
            <tr>
                <td class="text-right" style="width: 70%">
                    <big><b>{{ _("Grand Total") }}</b></big>
                </td>
                <td class="text-right">
                    <big><b>{{ doc.get_formatted("grand_total_export") }}</b></big>
                </td>
            </tr>
        </td>

        </table>

    </td>
  </tr>
</table>
{% if doc.get("other_charges", filters={"included_in_print_rate": 1}) %}
<hr>
<p><b>Taxes Included:</b></p>
<table class="table table-condensed no-border">
    <tbody>
        {%- for row in doc.other_charges -%}
        {%- if row.included_in_print_rate -%}
        <tr>
            <td class="text-right" style="width: 70%">

                {{ row.description }}
            </td>
            <td class="text-right">
                {{ row.get_formatted("tax_amount", doc) }}
            </td>
        <tr>
        {%- endif -%}
        {%- endfor -%}
    </tbody>
</table>
{%- endif -%}
<hr>
</small>




Taken From: http://pastebin.com/index/3bpm36ya 

Friday 5 December 2014

Convert existing non-empty directory into a Git working directory



How to convert existing non-empty directory into a Git working directory
1) Initialised existing directory with git
git init
2) add all untracked file to git for tracking changes
git add .
3) commit all changes
git commit -m 'message'
4) Add origin where you want to push changes. (i.e path of your online repository) git remote add origin <url>


5) Push files to a remote repository
git push -u origin master

Extra Notes:
1) To remove existing origin
git remote rm origin

2) pull from remote

git pull <URL>

3) push into remote( for push, you need to write access for remote)

git push --repo <URL>

4) URL is in general
https://github.com/username/repo.git

Wednesday 17 September 2014

Github: Steps to solve merge conflict from terminal

Syncing a fork

 When you synchronize your fork with upstream(i.e original developer branch)
 sometime you got merge conflict.  
git fetch upstream
git checkout master
git merge upstream/master 
 
If you got merge conflict. Follow the next steps to solve merge conflict 
and keep your fork updated.
 
 1) grep -lr '<<<<<<<' .\
 2) git checkout --ours Path/File
               OR

    git checkout --theirs Path/File
 3) git commit -am "fix conflict"
 4) git pull --repo= <URL>

Github: Working on opensource project, Make Pull request

GitHub is a GIt repository web-based hosting service which offers all of the distributed revision control and source code management (SCM) functionality of Git as well as adding own features.
 It also provides access control and several collaboration features such as wikis, task management, and bug tracking and feature requests for every project.
Here are few steps to work on an open source project
1. Fork repository- Fork existing repository into your

2. Clone repository locally - 
 git clone <repo URL>

3. Make code changes locally:

4. Commit changes locally -
 git commit -a

5. Push changes to hosted repository -
 git push --repo=<URL>

6. Create a Pull request for original repository

Saturday 6 September 2014

SQL clauses with Order of Execution

SELECT- which you use to specify the fields or calculated fields you want to return.
FROM- which you use to specify table or tables you want to use and usually includes joins.
WHERE- which you use to filter rows
GROUP BY- used to grouped together values using fields or expression you specified
HAVING- filters group by results with aggregate function (doesn't work on row by row basis like WHERE)
ORDER BY- used to specify result order