Skip to content

Instantly share code, notes, and snippets.

View scmmishra's full-sized avatar
🎯
Focusing

Shivam Mishra scmmishra

🎯
Focusing
View GitHub Profile
<p>With globalization in full force, companies have customers, suppliers, investors, and other business partners across the globe. So it's important that business management software supports multiple currency accounting(MCA).</p>
<h3 id="whydoweneedmulticurrencyaccounting">1. Why Do We Need Multi-currency Accounting?</h3>
<p>Let’s understand this with an example. We, Frappe Technologies Pvt Ltd are based in India and the local currency is INR. We use ERPNext to manage our business(no surprise here :P). Can we post all our transactions in INR to simplify the bookkeeping? For example, when we receive a payment from a client based in a foreign country, can we calculate the amount in INR as of the prevailing exchange rate and post the receipt and be done with it?</p>
<p>No, we can’t. And there are multiple reasons for that.</p>
<ol>
<li>Clients would like to receive the invoice in their currency and not in INR. At the same time, we need to record our income in INR.</li>
<li>We need file reports about payments
def cache_result(key, for_user=False, expiry=None):
def innerfn(function):
def wrapper(*args, **kwargs):
_cache = cache()
user = None
if for_user:
user = session.user
if kwargs.get("cache"):
value = _cache.get_value(key, user=user)
import java.util.Arrays;
import java.util.*;
class Marksheet {
int roll_no, total;
String name;
public void set_roll(int roll_number) {
roll_no = roll_number;
}
@scmmishra
scmmishra / grid_gen.js
Last active December 12, 2019 10:45
Generate CSS grid template area using JS
function add(a, b) {
return a + b;
}
const data = [
{
name: 'A',
columns: 3,
rows: 3
},
Executing frappe.patches.v11_0.create_contact_for_user in test_site (test_frappe)
Traceback (most recent call last):
File "/opt/python/2.7.14/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/opt/python/2.7.14/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/travis/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module>
main()
File "/home/travis/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
click.Group(commands=commands)(prog_name='bench')
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import pdfkit, os, frappe
from frappe.utils import scrub_urls
from frappe import _
from bs4 import BeautifulSoup
from PyPDF2 import PdfFileReader, PdfFileWriter
import re, io
@scmmishra
scmmishra / app.py
Last active March 8, 2019 10:48
Flask Workshop
import os
import datetime
from flask import (Flask, flash, redirect, render_template, request,
Response, url_for, session)
from peewee import *
from playhouse.flask_utils import FlaskDB, get_object_or_404, object_list
from playhouse.sqlite_ext import *
SECRET_KEY = "secret"
Filter by Country
<div class="text-center mt-2 mx-auto">
<select id="select-country" onchange="setCountry(this)" style="width: 250px;" class="select-country">
<option value="all">All</option>
{% for country in country_list %}
<option value="{{ country.name }}">{{ country.name }}</option>
{% endfor %}
</select>
</div>
function awesomeStuff() { … }
function done() { … }
var Student = function() {
this.name = name;
}
Person.prototype.doWork = function() {
do { awesomeStuff(); } while (!done());
}
@scmmishra
scmmishra / draw_neural_net.py
Created May 24, 2018 12:02 — forked from craffel/draw_neural_net.py
Draw a neural network diagram with matplotlib!
import matplotlib.pyplot as plt
def draw_neural_net(ax, left, right, bottom, top, layer_sizes):
'''
Draw a neural network cartoon using matplotilb.
:usage:
>>> fig = plt.figure(figsize=(12, 12))
>>> draw_neural_net(fig.gca(), .1, .9, .1, .9, [4, 7, 2])