moved directory structure

This commit is contained in:
Rushabh Mehta
2012-09-24 19:13:42 +05:30
parent e47a6779e9
commit 2fa2f7178d
1637 changed files with 47 additions and 11450 deletions

View File

@@ -0,0 +1 @@
from __future__ import unicode_literals

View File

@@ -0,0 +1 @@
from __future__ import unicode_literals

View File

@@ -0,0 +1,19 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
report.customize_filters = function() {
this.filter_fields_dict['Item'+FILTER_SEP +'ID'].df.in_first_page = 1;
}

View File

@@ -0,0 +1,34 @@
# Search Criteria, itemwise_price_list
[
# These values are common in all dictionaries
{
'creation': '2012-04-03 12:49:51',
'docstatus': 0,
'modified': '2012-04-03 12:49:51',
'modified_by': u'Administrator',
'owner': u'harshada@webnotestech.com'
},
# These values are common for all Search Criteria
{
'columns': u'Item\x01Item Name,Item\x01Item Group,Item Price\x01Price List Name,Item Price\x01Ref Rate,Item Price\x01Currency',
'criteria_name': u'Itemwise Price List',
'doc_type': u'Item Price',
'doctype': 'Search Criteria',
'filters': u"{'Item\x01Saved':1,'Item Price\x01Price List Name':'','Item Price\x01Currency':''}",
'module': u'Stock',
'name': '__common__',
'page_len': 50,
'parent_doc_type': u'Item',
'sort_by': u'`tabItem`.`item_name`',
'sort_order': u'DESC',
'standard': u'Yes'
},
# Search Criteria, itemwise_price_list
{
'doctype': 'Search Criteria',
'name': u'itemwise_price_list'
}
]

View File

@@ -0,0 +1 @@
from __future__ import unicode_literals

View File

@@ -0,0 +1,25 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
report.customize_filters = function() {
this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'From Transaction Date'].df['report_default'] = sys_defaults.year_start_date;
this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'To Transaction Date'].df['report_default'] = dateutil.obj_to_str(new Date());
this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
}

View File

@@ -0,0 +1,34 @@
# Search Criteria, itemwise_receipt_details
[
# These values are common in all dictionaries
{
'creation': '2012-04-11 13:16:55',
'docstatus': 0,
'modified': '2012-04-13 11:16:40',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all Search Criteria
{
'columns': u'Purchase Receipt\x01ID,Purchase Receipt\x01Posting Date,Purchase Receipt Item\x01Item Code,Purchase Receipt Item\x01Item Name,Purchase Receipt Item\x01Accepted Quantity,Purchase Receipt Item\x01Rejected Quantity,Purchase Receipt Item\x01UOM,Purchase Receipt Item\x01Accepted Warehouse,Purchase Receipt Item\x01Rejected Warehouse,Purchase Receipt Item\x01Amount',
'criteria_name': u'Itemwise Receipt Details',
'doc_type': u'Purchase Receipt Item',
'doctype': 'Search Criteria',
'filters': u'{"Purchase Receipt\\u0001Submitted":1,"Purchase Receipt\\u0001Status":[""],"Purchase Receipt\\u0001Fiscal Year":[""]}',
'module': u'Stock',
'name': '__common__',
'page_len': 50,
'parent_doc_type': u'Purchase Receipt',
'sort_by': u'`tabPurchase Receipt`.`name`',
'sort_order': u'DESC',
'standard': u'Yes'
},
# Search Criteria, itemwise_receipt_details
{
'doctype': 'Search Criteria',
'name': u'itemwise_receipt_details'
}
]

View File

@@ -0,0 +1 @@
from __future__ import unicode_literals

View File

@@ -0,0 +1,33 @@
# Search Criteria, shortage_to_purchase_request
[
# These values are common in all dictionaries
{
'creation': '2012-03-30 14:50:44',
'docstatus': 0,
'modified': '2012-03-30 14:50:44',
'modified_by': u'Administrator',
'owner': u'wasim@webnotestech.com'
},
# These values are common for all Search Criteria
{
'columns': u'Item\x01ID,Item\x01Item Name,Item\x01Description,Item\x01Lead Time Days',
'criteria_name': u'Shortage To Purchase Request',
'doc_type': u'Item',
'doctype': 'Search Criteria',
'filters': u"{'Item\x01Saved':1}",
'module': u'Stock',
'name': '__common__',
'page_len': 50,
'sort_by': u'`tabItem`.`name`',
'sort_order': u'DESC',
'standard': u'Yes'
},
# Search Criteria, shortage_to_purchase_request
{
'doctype': 'Search Criteria',
'name': u'shortage_to_purchase_request'
}
]

View File

@@ -0,0 +1 @@
from __future__ import unicode_literals

View File

@@ -0,0 +1,28 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
report.customize_filters = function() {
//this.hide_all_filters();
this.filter_fields_dict['Serial No'+FILTER_SEP +'Status'].df.filter_hide = 1;
this.filter_fields_dict['Serial No'+FILTER_SEP +'ID'].df.in_first_page = 1;
this.filter_fields_dict['Serial No'+FILTER_SEP +'From Purchase Date'].df.in_first_page = 1;
this.filter_fields_dict['Serial No'+FILTER_SEP +'To Purchase Date'].df.in_first_page = 1;
}
//this.mytabs.items['Select Columns'].hide();
this.mytabs.items['More Filters'].hide();

View File

@@ -0,0 +1,32 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
col = [['In Store Period (in days)', 'Data', '']]
for c in col:
colnames.append(str(c[0]))
coltypes.append(str(c[1]))
colwidths.append('150px')
coloptions.append(str(c[2]))
col_idx[str(c)] = len(colnames) - 1
import datetime
for r in res:
if r[col_idx['Purchase Date']]:
dt = (datetime.date.today() - getdate(r[col_idx['Purchase Date']])).days
else:
dt = ''
r.append(dt)

View File

@@ -0,0 +1,34 @@
# Search Criteria, stock_aging_report
[
# These values are common in all dictionaries
{
'creation': '2012-04-03 12:49:53',
'docstatus': 0,
'modified': '2012-04-03 12:49:53',
'modified_by': u'Administrator',
'owner': u'ashwini@webnotestech.com'
},
# These values are common for all Search Criteria
{
'add_cond': u"`tabSerial No`.status = 'In Store'",
'columns': u'Serial No\x01ID,Serial No\x01Item Code,Serial No\x01Description,Serial No\x01Item Group,Serial No\x01Purchase Date',
'criteria_name': u'Stock Aging Report',
'doc_type': u'Serial No',
'doctype': 'Search Criteria',
'filters': u"{'Serial No\x01Saved':1,'Serial No\x01Submitted':1,'Serial No\x01Status':'In Store','Serial No\x01Maintenance Status':''}",
'module': u'Stock',
'name': '__common__',
'page_len': 1000,
'sort_by': u'`tabSerial No`.`name`',
'sort_order': u'DESC',
'standard': u'Yes'
},
# Search Criteria, stock_aging_report
{
'doctype': 'Search Criteria',
'name': u'stock_aging_report'
}
]

View File

@@ -0,0 +1 @@
from __future__ import unicode_literals

View File

@@ -0,0 +1,20 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
report.customize_filters = function() {
this.add_filter({fieldname:'item_name', label:'Item Name', fieldtype:'Data', options:'', parent:'Item'});
this.add_filter({fieldname:'description', label:'Description', fieldtype:'Small Text', options: '', parent:'Item'});
}

View File

@@ -0,0 +1,36 @@
# Search Criteria, stock_ledger
[
# These values are common in all dictionaries
{
'creation': '2012-09-13 15:18:44',
'docstatus': 0,
'modified': '2012-09-13 15:38:45',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all Search Criteria
{
'add_col': u'`tabItem`.`item_name`\n`tabItem`.`description`',
'add_cond': u'`tabItem`.`name` = `tabStock Ledger Entry`.`item_code`',
'add_tab': u'`tabItem`',
'columns': u'Stock Ledger Entry\x01Item Code,Stock Ledger Entry\x01Warehouse,Stock Ledger Entry\x01Posting Date,Stock Ledger Entry\x01Posting Time,Stock Ledger Entry\x01Actual Quantity,Stock Ledger Entry\x01Bin Actual Qty After Transaction,Stock Ledger Entry\x01Voucher Type,Stock Ledger Entry\x01Voucher No',
'criteria_name': u'Stock Ledger',
'doc_type': u'Stock Ledger Entry',
'doctype': 'Search Criteria',
'filters': u'{"Stock Ledger Entry\\u0001Warehouse Type":[""],"Stock Ledger Entry\\u0001Company":[""],"Stock Ledger Entry\\u0001Is Cancelled":[""],"Stock Ledger Entry\\u0001Is Stock Entry":[""]}',
'module': u'Stock',
'name': '__common__',
'page_len': 50,
'sort_by': u'`tabStock Ledger Entry`.`posting_date`, `tabStock Ledger Entry`.`posting_time`, `tabStock Ledger Entry`.`name`',
'sort_order': u'ASC',
'standard': u'Yes'
},
# Search Criteria, stock_ledger
{
'doctype': 'Search Criteria',
'name': u'stock_ledger'
}
]

View File

@@ -0,0 +1 @@
from __future__ import unicode_literals

View File

@@ -0,0 +1,22 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
report.customize_filters = function() {
this.add_filter({fieldname:'item_name', label:'Item Name', fieldtype:'Data', options:'', parent:'Item', in_first_page : 0});
this.add_filter({fieldname:'description', label:'Description', fieldtype:'Small Text', options: '', parent:'Item', in_first_page : 0});
this.add_filter({fieldname:'item_group', label:'Item Group', fieldtype:'link', options: 'Item Group', parent:'Item', in_first_page : 1});
this.add_filter({fieldname:'brand', label:'Brand', fieldtype:'link', options: 'Brand', parent:'Item', in_first_page : 1});
}

View File

@@ -0,0 +1,19 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
colwidths[col_idx['Reserved Quantity']]= "120px"
colwidths[col_idx['Ordered Quantity']] = "120px"

View File

@@ -0,0 +1,36 @@
# Search Criteria, stock_level
[
# These values are common in all dictionaries
{
'creation': '2012-04-03 12:49:53',
'docstatus': 0,
'modified': '2012-04-03 12:49:53',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all Search Criteria
{
'add_col': u'`tabItem`.`item_name`\n`tabItem`.`description`',
'add_cond': u'`tabItem`.name = `tabBin`.item_code',
'add_tab': u'`tabItem`',
'columns': u'Bin\x01Warehouse,Bin\x01Item Code,Bin\x01UOM,Bin\x01Reserved Quantity,Bin\x01Actual Quantity,Bin\x01Ordered Quantity,Bin\x01Planned Qty,Bin\x01Projected Qty,Bin\x01Quantity Requested for Purchase,Bin\x01Valuation Rate,Bin\x01Stock Value',
'criteria_name': u'Stock Level',
'doc_type': u'Bin',
'doctype': 'Search Criteria',
'filters': u'{}',
'module': u'Stock',
'name': '__common__',
'page_len': 50,
'sort_by': u'`tabBin`.`warehouse`',
'sort_order': u'DESC',
'standard': u'Yes'
},
# Search Criteria, stock_level
{
'doctype': 'Search Criteria',
'name': u'stock_level'
}
]

View File

@@ -0,0 +1 @@
from __future__ import unicode_literals

View File

@@ -0,0 +1,89 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//233
report.customize_filters = function() {
this.mytabs.items['Select Columns'].hide()
this.mytabs.items['More Filters'].hide()
this.hide_all_filters();
this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Warehouse'+NEWLINE+'Item Code',ignore : 1,parent:'Stock Ledger Entry'});
this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'Item Code'].df.filter_hide = 0;
this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'Warehouse'].df.filter_hide = 0;
this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'Warehouse Type'].df.filter_hide = 0;
this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'From Posting Date'].df.filter_hide = 1;
this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'Item Code'].df.in_first_page = 1;
this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'Warehouse'].df.in_first_page = 1;
this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'Based On'].df.in_first_page = 1;
this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'Warehouse Type'].df.in_first_page = 1;
this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
}
report.get_query = function(){
based_on = this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP+'Based On'].get_value();
as_on = this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP+'To Posting Date'].get_value();
warehouse = this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP+'Warehouse'].get_value();
warehouse_type = this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP+'Warehouse Type'].get_value();
item_code = this.filter_fields_dict['Stock Ledger Entry'+FILTER_SEP+'Item Code'].get_value();
cond = '';
date_cond = '';
tables = '';
cols = '';
group_by = '';
ware_type_cond = '';
war = '';
if(!as_on) as_on = get_today();
date_cond = repl(' AND `tabStock Ledger Entry`.posting_date <= "%(as_on)s" ', {as_on:as_on});
if(warehouse_type.length > 0 && warehouse_type != ''){
for(var i = 0; i<warehouse_type.length; i++) war += "'"+warehouse_type[i]+"',";
ware_type_cond = repl(' AND `tabWarehouse`.warehouse_type IN (%(war)s)', {war: war.substr(0,war.length-1)})
}
if(based_on.length == 1 && based_on[0]){
if(based_on[0] == 'Item Code'){
cols = '`tabItem`.name AS "Item Code", `tabItem`.item_name AS "Item Name", `tabItem`.description AS "Description", `tabItem`.stock_uom AS "Stock UOM"';
cond = '(IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.is_stock_item = "Yes"';
if(item_code) cond += repl(' AND `tabItem`.name = %(item)s', {item:'"'+item_code+'"'});
cond += ' AND `tabStock Ledger Entry`.item_code = `tabItem`.name'
tables = '`tabItem`';
group_by = '`tabStock Ledger Entry`.item_code';
}
else if(based_on[0] == 'Warehouse'){
cols = '`tabWarehouse`.name AS "Warehouse", `tabWarehouse`.warehouse_type AS "Warehouse Type"';
cond = '`tabWarehouse`.docstatus < 2'
if(warehouse) cond += repl(' AND `tabWarehouse`.name = %(warehouse)s', {warehouse:'"'+warehouse+'"'});
cond += repl(' AND `tabStock Ledger Entry`.warehouse = `tabWarehouse`.name %(ware_type_cond)s', {ware_type_cond:ware_type_cond})
tables = '`tabWarehouse`';
group_by = '`tabStock Ledger Entry`.warehouse';
}
} else {
cols = '`tabItem`.name AS "Item Code", `tabItem`.item_name AS "Item Name", `tabItem`.description AS "Description", `tabItem`.stock_uom AS "Stock UOM", `tabWarehouse`.name AS "Warehouse", `tabWarehouse`.warehouse_type AS "Warehouse Type"';
cond = '(IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.is_stock_item = "Yes" AND `tabWarehouse`.docstatus < 2';
if(item_code) cond += repl(" AND `tabItem`.name = %(item)s", {item:"'"+item_code+"'"});
if(warehouse) cond += repl(" AND `tabWarehouse`.name = %(warehouse)s", {warehouse:"'"+warehouse+"'"});
cond += repl(' AND `tabStock Ledger Entry`.item_code = `tabItem`.name AND `tabStock Ledger Entry`.warehouse = `tabWarehouse`.name %(ware_type_cond)s', {ware_type_cond:ware_type_cond})
tables = '`tabItem`, `tabWarehouse`';
group_by = '`tabStock Ledger Entry`.item_code, `tabStock Ledger Entry`.warehouse';
}
q = repl("SELECT %(cols)s FROM %(tables)s, `tabStock Ledger Entry` WHERE %(cond)s %(date_cond)s GROUP BY %(group_by)s", {cols:cols, tables:tables, cond:cond, date_cond:date_cond, group_by:group_by});
return q;
}

View File

@@ -0,0 +1,88 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
cols, columns = [], []
# Add columns
# ------------
based_on = filter_values.get('based_on').split(NEWLINE)
if len(based_on) == 1 and based_on[0]:
if based_on[0] == 'Item Code':
cols = ["Item Code", "Item Name", "Description", "Stock UOM"]
elif based_on[0] == 'Warehouse':
cols = ["Warehouse", "Warehouse Type"]
else:
cols = ["Item Code", "Item Name", "Description", "Stock UOM", "Warehouse", "Warehouse Type"]
for d in cols:
columns.append([d,'Data','150px',''])
columns.append(['Closing Balance','Currency','200px',''])
columns.append(['Stock Value','Currency','150px',''])
posting_date = filter_values.get('posting_date1')
if not posting_date: posting_date = nowdate()
for c in columns:
colnames.append(c[0])
coltypes.append(c[1])
colwidths.append(c[2])
coloptions.append(c[3])
col_idx[c[0]] = len(colnames)-1
def get_values(msgprint, flt, posting_date, item_code = '', warehouse = ''):
cl_bal, stock_val = 0,0
if item_code and not warehouse:
war_list = sql("select distinct warehouse from `tabStock Ledger Entry` where item_code = %s", item_code)
for d in war_list:
act = sql("select bin_aqat, stock_value from `tabStock Ledger Entry` where item_code = %s and warehouse = %s and ifnull(is_cancelled, 'No') = 'No' and timestamp(posting_date, posting_time) <= timestamp(%s, %s) Order by timestamp(posting_date, posting_time) DESC, name DESC LIMIT 1", (item_code, d[0], posting_date, '23:55'))
cl_bal += act and flt(act[0][0]) or 0.00
stock_val += act and flt(act[0][1]) or 0.00
elif warehouse and not item_code:
item_list = sql("select distinct item_code from `tabStock Ledger Entry` where warehouse = %s", warehouse)
for d in item_list:
act = sql("select bin_aqat, stock_value from `tabStock Ledger Entry` where item_code = %s and warehouse = %s and ifnull(is_cancelled, 'No') = 'No' and timestamp(posting_date, posting_time) <= timestamp(%s, %s) Order by timestamp(posting_date, posting_time) DESC, name DESC LIMIT 1", (d[0], warehouse, posting_date, '23:55'))
cl_bal += act and flt(act[0][0]) or 0.00
stock_val += act and flt(act[0][1]) or 0.00
return cl_bal, stock_val
out=[]
cl_bal,tot_stock = 0,0
for r in res:
if len(based_on) == 1 and based_on[0]:
if based_on[0] == 'Item Code': closing_balance, stock_value = get_values(msgprint, flt, posting_date, item_code = r[col_idx['Item Code']])
elif based_on[0] == 'Warehouse': closing_balance, stock_value = get_values(msgprint, flt, posting_date, warehouse = r[col_idx['Warehouse']])
r.append(closing_balance)
r.append(stock_value)
else:
det = sql("select bin_aqat, stock_value from `tabStock Ledger Entry` where item_code = %s and warehouse = %s and ifnull(is_cancelled, 'No') = 'No' and timestamp(posting_date, posting_time) <= timestamp(%s, %s) Order by timestamp(posting_date, posting_time) DESC, name DESC LIMIT 1", (r[col_idx['Item Code']], r[col_idx['Warehouse']], posting_date, '23:55'))
r.append(det and flt(det[0][0]) or 0.00)
r.append(det and flt(det[0][1]) or 0.00)
cl_bal += flt(r[col_idx['Closing Balance']])
tot_stock += flt(r[col_idx['Stock Value']])
out.append(r)
# Add the totals row
l_row = ['' for i in range(len(colnames))]
if len(based_on) == 1 and based_on[0] == 'Warehouse':
l_row[col_idx['Warehouse Type']] = '<b>TOTALS</b>'
else:
l_row[col_idx['Stock UOM']] = '<b>TOTALS</b>'
l_row[col_idx['Closing Balance']] = cl_bal
l_row[col_idx['Stock Value']] = tot_stock
out.append(l_row)

View File

@@ -0,0 +1,33 @@
# Search Criteria, stock_report
[
# These values are common in all dictionaries
{
'creation': '2012-04-03 12:49:53',
'docstatus': 0,
'modified': '2012-04-03 12:49:53',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all Search Criteria
{
'columns': u'Stock Ledger Entry\x01ID',
'criteria_name': u'Stock Report',
'doc_type': u'Stock Ledger Entry',
'doctype': 'Search Criteria',
'filters': u"{'Stock Ledger Entry\x01Is Cancelled':'','Stock Ledger Entry\x01Is Stock Entry':''}",
'module': u'Stock',
'name': '__common__',
'page_len': 50,
'sort_by': u'`tabStock Ledger Entry`.`name`',
'sort_order': u'DESC',
'standard': u'Yes'
},
# Search Criteria, stock_report
{
'doctype': 'Search Criteria',
'name': u'stock_report'
}
]