added website pages for orders, tickets and added sales invoice print format

This commit is contained in:
Rushabh Mehta 2013-03-21 17:12:25 +05:30
parent a75efa76f9
commit bed19ac4d3
24 changed files with 490 additions and 174 deletions

View File

@ -0,0 +1,137 @@
{%- if doc.letter_head -%}
{{ webnotes.conn.get_value("Letter Head", doc.letter_head, "content") }}
{%- endif -%}
<!-- Page Layout Settings -->
<div class='common page-header'>
<table class='header-table' cellspacing=0>
<thead>
<tr><td colspan="2"><h1>{{ doc.select_print_heading or 'Invoice' }}</h1></td></tr>
<tr><td colspan="2"><h3>{{ doc.name }}</h3></td></tr>
</thead>
<tbody>
<tr>
<td width=60%><table width=100% cellspacing=0><tbody>
<tr>
<td width=39%><b>Name</b></td>
<td>{{ doc.customer_name }}</td>
</tr>
<tr>
<td><b>Address</b></td>
<td>{{ doc.address_display.replace("\n", "<br>") }}</td>
</tr>
<tr>
<td><b>Contact</b></td>
<td>{{ doc.contact_display }}</td>
</tr>
</tbody></table></td>
<td><table width=100% cellspacing=0><tbody>
<tr>
<td width=40%><b>Invoice Date</b></td>
<td>{{ utils.formatdate(doc.posting_date) }}</td>
<tr>
{%- if doc.convert_into_recurring_invoice and doc.recurring_id -%}
<tr>
<td width=40%><b>Invoice Period</b></td>
<td>{{ (utils.formatdate(doc.invoice_period_from_date)) +
' to ' + utils.formatdate(doc.invoice_period_to_date) }}</td>
<tr>
{%- endif -%}
<tr>
<td><b>Due Date</b></td>
<td>{{ utils.formatdate(doc.due_date) }}</td>
<tr>
</tbody></table></td>
</tr>
</tbody>
<tfoot>
</tfoot>
</table>
</div>
<div class='common page-body'>
<!--
Page Body will contain
+ table 2
- Sales Invoice Data
-->
<table class="table table-bordered">
<tbody>
<tr>
<th>Sr</th>
<th>Item Name</th>
<th>Description</th>
<th>Qty</th>
<th>UoM</th>
<th>Basic Rate</th>
<th>Amount</th>
</tr>
{%- for row in doclist.get({"doctype":"Sales Invoice Item"}) %}
<tr>
<td style="width: 3%;">{{ row.idx }}</td>
<td style="width: 20%;">{{ row.item_name }}</td>
<td style="width: 37%;">{{ row.description }}</td>
<td style="width: 5%;">{{ row.qty }}</td>
<td style="width: 5%;">{{ row.stock_uom }}</td>
<td style="width: 15%;">{{ utils.fmt_money(row.export_rate) }}</td>
<td style="width: 15%;">{{ utils.fmt_money(row.export_amount) }}</td>
</tr>
{% endfor -%}
</tbody>
</table>
</div>
<div class='common page-footer'>
<!--
Page Footer will contain
+ table 3
- Terms and Conditions
- Total Rounded Amount Calculation
- Total Rounded Amount in Words
-->
<table class='footer-table' width=100% cellspacing=0>
<thead>
</thead>
<tbody>
<tr>
<td width=60% style='padding-right: 10px;'>
<b>Terms, Conditions &amp; Other Information:</b><br />
{{ doc.terms }}
</td>
<td>
<table cellspacing=0 width=100%><tbody>
<tr>
<td>Net Total</td>
<td></td>
<td width=38%>{{
utils.fmt_money(doc.net_total/doc.conversion_rate)
}}</td>
</tr>
{%- for charge in doclist.get({"doctype":"Sales Taxes and Charges"}) -%}
{%- if not charge.included_in_print_rate -%}
<tr>
<td>{{ charge.description }}</td>
<td></td>
<td>{{ utils.fmt_money(charge.tax_amount / doc.conversion_rate) }}</td>
</tr>
{%- endif -%}
{%- endfor -%}
<tr>
<td>Grand Total</td>
<td></td>
<td>{{ utils.fmt_money(doc.grand_total_export) }}</td>
</tr>
<tr style='font-weight: bold'>
<td>Rounded Total</td>
<td>{{ doc.currency }}</td>
<td>{{ utils.fmt_money(doc.rounded_total_export) }}</td>
</tr>
</tbody></table>
<br /><b>In Words</b><br />
<i>{{ doc.in_words_export }}</i>
</td>
</tr>
</tbody>
<tfoot>
</tfoot>
</table>
</div>

View File

@ -0,0 +1,20 @@
[
{
"creation": "2013-03-21 15:24:28",
"docstatus": 0,
"modified": "2013-03-21 15:26:21",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doc_type": "Sales Invoice",
"doctype": "Print Format",
"module": "Accounts",
"name": "__common__",
"standard": "Yes"
},
{
"doctype": "Print Format",
"name": "SalesInvoice"
}
]

View File

@ -70,7 +70,8 @@ $(document).ready(function() {
// update login
var full_name = getCookie("full_name");
if(full_name) {
$("#user-tools").html(repl('<a href="account" title="My Account" id="user-full-name">%(full_name)s</a> | \
$("#user-tools").html(repl('<a href="profile" title="My Profile" id="user-full-name">%(full_name)s</a> | \
<a href="account" title="My Account">My Account</a> | \
<a href="cart" title="Shopping Cart"><i class="icon-shopping-cart"></i> (%(count)s)</a> | \
<a href="server.py?cmd=web_logout" title="Sign Out"><i class="icon-signout"></i></a>', {
full_name: full_name,

View File

@ -310,7 +310,8 @@ cur_frm.cscript.barcode = function(doc, cdt, cdn) {
var callback = function(r, rt) {
cur_frm.cscript.item_code(doc, cdt, cdn);
}
get_server_fields('get_barcode_details', d.barcode, cur_frm.cscript.fname, doc, cdt, cdn, 1, callback);
get_server_fields('get_barcode_details', d.barcode, cur_frm.cscript.fname,
doc, cdt, cdn, 1, callback);
}
cur_frm.fields_dict[cur_frm.cscript.fname].grid.get_field('batch_no').get_query =

View File

@ -352,4 +352,20 @@ class DocType(SellingController):
return get_obj('Sales Common').get_item_list( self, is_stopped)
def on_update(self):
pass
pass
@webnotes.whitelist()
def get_orders():
# find customer id
customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user},
"customer")
if customer:
orders = webnotes.conn.sql("""select name, creation, currency from `tabSales Order`
where customer=%s""", customer, as_dict=1)
for order in orders:
order.items = webnotes.conn.sql("""select item_name, qty, export_rate, delivered_qty
from `tabSales Order Item` where parent=%s order by idx""", order.name, as_dict=1)
return orders
else:
return []

View File

@ -113,7 +113,7 @@ def upload_file_to_dropbox(filename, folder, dropbox_client):
while uploader.offset < size:
try:
uploader.upload_chunked()
finish(folder + '/' + os.path.basename(filename), overwrite='True')
uploader.finish(folder + '/' + os.path.basename(filename), overwrite='True')
except rest.ErrorResponse, e:
pass
else:

View File

@ -21,6 +21,7 @@ import webnotes.defaults
from webnotes.utils import cint
keydict = {
"print_style": "print_style",
"fiscal_year": "current_fiscal_year",
'company': 'default_company',
'currency': 'default_currency',

View File

@ -1,8 +1,8 @@
[
{
"creation": "2013-02-19 12:28:27",
"creation": "2013-02-21 12:28:24",
"docstatus": 0,
"modified": "2013-02-20 14:09:00",
"modified": "2013-03-21 15:42:59",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -27,8 +27,6 @@
"permlevel": 0
},
{
"amend": 0,
"cancel": 0,
"create": 1,
"doctype": "DocPerm",
"name": "__common__",
@ -59,6 +57,19 @@
"fieldtype": "Data",
"label": "Session Expiry"
},
{
"doctype": "DocField",
"fieldname": "column_break_3",
"fieldtype": "Column Break"
},
{
"description": "For Server Side Print Formats",
"doctype": "DocField",
"fieldname": "print_style",
"fieldtype": "Select",
"label": "Print Format Style",
"options": "Standard\nClassic\nModern\nSpartan"
},
{
"doctype": "DocField",
"fieldname": "company",
@ -417,6 +428,11 @@
"fieldtype": "Data",
"label": "SMS Sender Name"
},
{
"amend": 0,
"cancel": 0,
"doctype": "DocPerm"
},
{
"doctype": "DocPerm"
}

View File

@ -1,8 +1,8 @@
[
{
"creation": "2013-01-10 16:34:23",
"creation": "2013-01-23 20:00:16",
"docstatus": 0,
"modified": "2013-01-22 14:56:03",
"modified": "2013-03-20 15:09:28",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -123,6 +123,13 @@
"fieldtype": "Text Editor",
"label": "Description"
},
{
"doctype": "DocField",
"fieldname": "item_website_specifications",
"fieldtype": "Table",
"label": "Item Website Specifications",
"options": "Item Website Specification"
},
{
"doctype": "DocField",
"fieldname": "lft",
@ -174,6 +181,20 @@
"no_copy": 1,
"print_hide": 1
},
{
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"role": "System Manager",
"write": 1
},
{
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"role": "Material Master Manager",
"write": 1
},
{
"amend": 0,
"cancel": 0,
@ -189,19 +210,5 @@
"doctype": "DocPerm",
"role": "Material User",
"write": 0
},
{
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"role": "System Manager",
"write": 1
},
{
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"role": "Material Master Manager",
"write": 1
}
]

View File

@ -137,3 +137,17 @@ cur_frm.cscript.on_remove_attachment = function(doc) {
+ wn.meta.get_docfield(doc.doctype, "description_html").label);
}
};
cur_frm.cscript.copy_from_item_group = function(doc) {
wn.model.with_doc("Item Group", doc.item_group, function() {
$.each(wn.model.get("Item Website Specification", {parent:doc.item_group}),
function(i, d) {
var n = wn.model.add_child(doc, "Item Website Specification",
"item_website_specifications");
n.label = d.label;
n.description = d.description;
}
);
cur_frm.refresh();
});
}

View File

@ -1,8 +1,8 @@
[
{
"creation": "2013-02-21 14:54:43",
"creation": "2013-03-07 15:53:11",
"docstatus": 0,
"modified": "2013-03-06 16:02:47",
"modified": "2013-03-20 15:10:12",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -33,7 +33,6 @@
"parent": "Item",
"parentfield": "permissions",
"parenttype": "DocType",
"permlevel": 0,
"read": 1,
"report": 1,
"submit": 0
@ -785,6 +784,12 @@
"fieldname": "sb72",
"fieldtype": "Section Break"
},
{
"doctype": "DocField",
"fieldname": "copy_from_item_group",
"fieldtype": "Button",
"label": "Copy From Item Group"
},
{
"depends_on": "show_in_website",
"doctype": "DocField",
@ -804,6 +809,24 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
"role": "System Manager",
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"role": "Material Master Manager",
"write": 0
},
{
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
"role": "Material Master Manager",
"write": 1
},
@ -812,6 +835,15 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"role": "System Manager"
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"role": "Material Manager",
"write": 0
},
@ -820,6 +852,25 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 0,
"role": "Material Manager",
"write": 0
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"role": "Material User",
"write": 0
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 0,
"role": "Material User",
"write": 0
}

View File

@ -70,4 +70,11 @@ def set_status(name, status):
st = webnotes.bean("Support Ticket", name)
st.doc.status = status
st.save()
@webnotes.whitelist()
def get_tickets():
tickets = webnotes.conn.sql("""select name, subject, status from
`tabSupport Ticket` where raised_by=%s order by modified desc""",
webnotes.session.user, as_dict=1)
return tickets

View File

@ -2,11 +2,10 @@ div.outer {
padding: 30px;
margin: 30px -30px 10px -30px;
min-height: 400px;
overflow: hidden;
}
.outer .navbar {
margin: -30px -30px 10px -30px;
margin: -30px -30px 20px -30px;
}
footer {

View File

@ -1,23 +0,0 @@
# Copyright (c) 2012 Web Notes Technologies Pvt Ltd.
# License: GNU General Public License (v3). For more information see license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cstr
@webnotes.whitelist()
def get_orders():
# find customer id
customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user},
"customer")
if customer:
orders = webnotes.conn.sql("""select name, creation, currency from `tabSales Order`
where customer=%s""", customer, as_dict=1)
for order in orders:
order.items = webnotes.conn.sql("""select item_name, qty, export_rate, delivered_qty
from `tabSales Order Item` where parent=%s order by idx""", order.name, as_dict=1)
return orders
else:
return []

View File

@ -10,21 +10,18 @@
<script type="text/javascript" src="js/wn-web.js"></script>
<link type="text/css" rel="stylesheet" href="css/all-web.css">
<link type="text/css" rel="stylesheet" href="css/wn-web.css">
{% if favicon %}
{%- if favicon %}
<link rel="shortcut icon" href="files/{{ favicon }}" type="image/x-icon">
<link rel="icon" href="files/{{ favicon }}" type="image/x-icon">
{% else %}
<link rel="shortcut icon" href="app/images/favicon.ico" type="image/x-icon">
<link rel="icon" href="app/images/favicon.ico" type="image/x-icon">
{% endif %}
{% if description %}
{% endif -%}
{% if description -%}
<meta name="description" content="{{ description }}">
{% endif %}
{% block header %}
{% endblock %}
{%- endif %}
{% block header -%}
{%- endblock %}
</head>
<body>
{% block body %}

View File

@ -1,7 +1,6 @@
<div class="navbar navbar-inverse"
style="">
<div class="navbar navbar-inverse" style="">
<div class="navbar-inner">
{% if brand_html %}<a class="brand" href="index">{{ brand_html }}</a>{% endif %}
{%- if brand_html %}<a class="brand" href="index">{{ brand_html }}</a>{% endif -%}
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
@ -10,42 +9,27 @@
</button>
<div class="nav-collapse collapse">
<ul class="nav">
{% for page in top_bar_items %}
{% if not page.parent_label %}
<li data-label="{{ page.label }}"
{% if page.child_items %}
class="dropdown"
{% endif %}>
<a href="{{ page.url or '#' }}"
{% if page.child_items %}
class="dropdown-toggle"
onclick="return false;"
data-toggle="dropdown"
{% endif %}
{{ page.target or ''}}>
{{ page.label }}
{% if page.child_items %}
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
{% for child in page.child_items %}
<li data-label="{{ child.label }}">
<a {% if child.indent %}
style="padding-left:
{{(int(child.indent)+1)*15 }}px"
{% endif %}
href="{{ child.url }}" {{ child.target or '' }}>
{{ child.label }}
</a>
</li>
{% endfor %}
</ul>
{% else %}
</a>
{% endif %}
</li>
{% endif %}
{% endfor %}
{%- for page in top_bar_items -%}
{% if not page.parent_label -%}
<li data-label="{{ page.label }}" {% if page.child_items %} class="dropdown"{% endif %}>
<a href="{{ page.url or '#' }}" {% if page.child_items %} class="dropdown-toggle" onclick="return false;" data-toggle="dropdown"{% endif %} {{ page.target or ''}}>
{{ page.label }}
{%- if page.child_items -%}
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
{%- for child in page.child_items -%}
<li data-label="{{ child.label }}">
<a {% if child.indent %} style="padding-left: {{(int(child.indent)+1)*15 }}px"{% endif %} href="{{ child.url }}" {{ child.target or '' }}>{{ child.label }}</a>
</li>
{%- endfor -%}
</ul>
{%- else -%}
</a>
{%- endif -%}
</li>
{%- endif -%}
{%- endfor %}
</ul>
</div>
</div>

View File

@ -12,8 +12,8 @@
<div class="outer">
{% include "html/navbar.html" %}
<div class="content row" id="page-{{ name }}" style="display: block;">
{% block content %}
{% endblock %}
{%- block content -%}
{%- endblock -%}
</div>
</div>
</div>

View File

@ -1,20 +1,20 @@
{% extends "html/outer.html" %}
{% block title %}{{ title }}{% endblock %}
{% block title -%}{{ title }}{%- endblock %}
{% block header %}
{% block header -%}
{{ super() }}
<script>
{% block javascript %}
{% endblock %}
{% block javascript -%}
{%- endblock %}
</script>
{% block css %}
{% if insert_style %}
{% block css -%}
{% if insert_style -%}
<style>{{ css }}</style>
{% endif %}
{% endblock %}
{% endblock %}
{%- endif %}
{%- endblock %}
{%- endblock -%}
{% block content %}
{%- block content -%}
{{ content }}
{% endblock %}
{%- endblock %}

View File

@ -4,62 +4,15 @@
{% block content %}
<div class="span12">
<p class="pull-right"><a href="profile">Change my name, password</a></p>
<h3>My Orders</h3>
<div id="order-list">
<div class="progress progress-striped active">
<div class="bar" style="width: 100%;"></div>
</div>
</div>
<hr>
<h3>My Tickets</h3>
<div id="ticket-list">
<div class="progress progress-striped active">
<div class="bar" style="width: 100%;"></div>
</div>
</div>
<ul class="breadcrumb">
<li><a href="index">Home</a> <span class="divider">/</span></li>
<li class="active">My Account</li>
</ul>
<h3>My Account</h3>
<p><a href="profile"><i class="icon-user"></i> Change my name, password</a></p>
<p><a href="orders"><i class="icon-list"></i> My Orders</a></p>
<p><a href="tickets"><i class="icon-tags"></i> My Tickets</a></p>
<p><a href="server.py?cmd=web_logout"><i class="icon-signout"></i> Logout</a></p>
</ul>
</div>
<script>
$(document).ready(function() {
var order_start = 0,
ticket_start = 0;
wn.call({
method: "website.helpers.account.get_orders",
args: {
start: order_start
},
callback: function(r) {
$("#order-list .progress").remove();
var $list = $("#order-list");
if(!(r.message && r.message.length)) {
$list.html("<div class='alert'>No Orders Yet</div>");
return;
}
$.each(r.message, function(i, order) {
// parent
var $order = $(repl('<div class="row">\
<div class="span4"><a href="order?id=%(name)s">%(name)s</a></span3>\
</div>', order)).appendTo($list);
// items
$.each(order.items || [], function(i, item) {
var $item = $(repl('<div class="span8">\
<div class="row">\
<div class="span4">%(item_name)s</div>\
<div class="span2">%(export_rate)s</div>\
<div class="span2">%(status)s</div>\
</div>\
</div>', item)).appendTo($order);
});
$("<hr>").appendTo($order);
});
}
})
})
</script>
{% endblock %}

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Print Format</title>
<meta name="generator" content="wnframework">
</head>
<body>
{{ webnotes.form_dict }}
</body>
</html>

View File

@ -0,0 +1,62 @@
{% extends "html/page.html" %}
{% set title="My Orders" %}
{% block content %}
<div class="span12">
<ul class="breadcrumb">
<li><a href="index">Home</a> <span class="divider">/</span></li>
<li><a href="account">My Account</a> <span class="divider">/</span></li>
<li class="active">My Orders</li>
</ul>
<h3><i class="icon-list"></i> My Orders</h3>
<hr>
<div id="order-list" style="font-size: 13px;">
<div class="progress progress-striped active">
<div class="bar" style="width: 100%;"></div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
var order_start = 0;
wn.call({
method: "selling.doctype.sales_order.sales_order.get_orders",
args: {
start: order_start
},
callback: function(r) {
$("#order-list .progress").remove();
var $list = $("#order-list");
if(!(r.message && r.message.length)) {
$list.html("<div class='alert'>No Orders Yet</div>");
return;
}
$.each(r.message, function(i, order) {
// parent
var $order = $(repl('<div class="row">\
<div class="span4"><a href="order?id=%(name)s">%(name)s</a></span3>\
</div>', order)).appendTo($list);
// items
$.each(order.items || [], function(i, item) {
var $item = $(repl('<div class="span8">\
<div class="row">\
<div class="span4">%(item_name)s</div>\
<div class="span2">%(export_rate)s</div>\
<div class="span2">%(status)s</div>\
</div>\
</div>', item)).appendTo($order);
});
$("<hr>").appendTo($list);
});
}
})
})
</script>
{% endblock %}

View File

@ -4,7 +4,10 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Print Format</title>
<meta name="generator" content="wnframework">
<meta name="generator" content="wnframework">
<style>
{{ css }}
</style>
</head>
<body>
{{ body }}

View File

@ -3,8 +3,13 @@
{% set title="My Profile" %}
{% block content %}
<div class="span9">
<h2>My Profile</h2>
<div class="span12">
<ul class="breadcrumb">
<li><a href="index">Home</a> <span class="divider">/</span></li>
<li><a href="account">My Account</a> <span class="divider">/</span></li>
<li class="active">My Profile</li>
</ul>
<h2><i class="icon-user"></i> My Profile</h2>
<hr>
<div class="alert" id="message" style="display: none;"></div>
<form class="form-horizontal">

View File

@ -0,0 +1,53 @@
{% extends "html/page.html" %}
{% set title="My Orders" %}
{% block content %}
<div class="span12">
<ul class="breadcrumb">
<li><a href="index">Home</a> <span class="divider">/</span></li>
<li><a href="account">My Account</a> <span class="divider">/</span></li>
<li class="active">My Tickets</li>
</ul>
<h3><i class="icon-tags"></i> My Tickets</h3>
<hr>
<div id="ticket-list" style="font-size: 13px;">
<div class="progress progress-striped active">
<div class="bar" style="width: 100%;"></div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
var order_start = 0;
wn.call({
method: "support.doctype.support_ticket.support_ticket.get_tickets",
args: {
start: order_start
},
callback: function(r) {
$("#ticket-list .progress").remove();
var $list = $("#ticket-list");
if(!(r.message && r.message.length)) {
$list.html("<div class='alert'>No Tickets Yet</div>");
return;
}
$.each(r.message, function(i, ticket) {
// parent
var $ticket = $(repl('<div class="row">\
<div class="span2"><span class="label">%(status)s</span></div>\
<div class="span3"><a href="ticket?id=%(name)s">%(name)s</a></div>\
<div class="span7">%(subject)s</div>\
</div>', ticket)).appendTo($list);
$("<hr>").appendTo($list);
});
}
})
})
</script>
{% endblock %}