diff --git a/accounts/doctype/purchase_invoice/purchase_invoice_list.js b/accounts/doctype/purchase_invoice/purchase_invoice_list.js index a3f667f212..7b410a3085 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice_list.js +++ b/accounts/doctype/purchase_invoice/purchase_invoice_list.js @@ -1,9 +1,9 @@ // render wn.listview_settings['Purchase Invoice'] = { add_fields: ["`tabPurchase Invoice`.grand_total", "`tabPurchase Invoice`.outstanding_amount"], - add_columns: [{"content":"outstanding_amount", width:"10%", type:"bar-graph", label: "Paid"}], + add_columns: [{"content":"paid_amount", width:"10%", type:"bar-graph", label: "Paid"}], prepare_data: function(data) { - data.outstanding_amount = ((flt(data.grand_total) - - flt(data.outstanding_amount)) / flt(data.grand_total)) * 100; + data.paid_amount = flt(data.grand_total) ? (((flt(data.grand_total) - + flt(data.outstanding_amount)) / flt(data.grand_total)) * 100) : 0; } }; diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index 7863306de1..be6ec3d001 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -159,7 +159,6 @@ cur_frm.cscript.update_stock = function(doc, dt, dn) { cur_frm.cscript.hide_fields(doc, dt, dn); } - cur_frm.cscript.warehouse = function(doc, cdt , cdn) { var d = locals[cdt][cdn]; if (!d.item_code) { msgprint("please enter item code first"); return }; diff --git a/accounts/doctype/sales_invoice/sales_invoice.txt b/accounts/doctype/sales_invoice/sales_invoice.txt index cf6e994c11..2464cb6333 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.txt +++ b/accounts/doctype/sales_invoice/sales_invoice.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-03-22 18:37:25", + "creation": "2013-04-19 11:00:14", "docstatus": 0, - "modified": "2013-03-22 18:38:13", + "modified": "2013-04-22 11:59:28", "modified_by": "Administrator", "owner": "Administrator" }, @@ -44,7 +44,8 @@ "fieldtype": "Section Break", "label": "Basic Info", "oldfieldtype": "Section Break", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -52,6 +53,7 @@ "fieldtype": "Column Break", "oldfieldtype": "Column Break", "print_hide": 0, + "read_only": 0, "width": "50%" }, { @@ -65,6 +67,7 @@ "oldfieldtype": "Select", "options": "INV\nINV/10-11/", "print_hide": 1, + "read_only": 0, "reqd": 1 }, { @@ -74,7 +77,8 @@ "label": "Is POS", "oldfieldname": "is_pos", "oldfieldtype": "Check", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "depends_on": "eval:doc.is_pos==1", @@ -84,7 +88,8 @@ "label": "Update Stock", "oldfieldname": "update_stock", "oldfieldtype": "Check", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "description": "The account to which you will pay (have paid) the money to.", @@ -97,6 +102,7 @@ "oldfieldtype": "Link", "options": "Account", "print_hide": 1, + "read_only": 0, "reqd": 1, "search_index": 1 }, @@ -110,7 +116,8 @@ "oldfieldname": "customer", "oldfieldtype": "Link", "options": "Customer", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -160,7 +167,8 @@ "doctype": "DocField", "fieldname": "column_break1", "fieldtype": "Column Break", - "oldfieldtype": "Column Break" + "oldfieldtype": "Column Break", + "read_only": 0 }, { "default": "Today", @@ -174,6 +182,7 @@ "oldfieldname": "posting_date", "oldfieldtype": "Date", "print_hide": 0, + "read_only": 0, "reqd": 1, "search_index": 1 }, @@ -188,6 +197,7 @@ "no_copy": 1, "oldfieldname": "due_date", "oldfieldtype": "Date", + "read_only": 0, "reqd": 1, "search_index": 0 }, @@ -198,14 +208,16 @@ "label": "Mode of Payment", "oldfieldname": "mode_of_payment", "oldfieldtype": "Select", - "options": "link:Mode of Payment" + "options": "link:Mode of Payment", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "items", "fieldtype": "Section Break", "label": "Items", - "oldfieldtype": "Section Break" + "oldfieldtype": "Section Break", + "read_only": 0 }, { "allow_on_submit": 1, @@ -215,25 +227,29 @@ "label": "Entries", "oldfieldname": "entries", "oldfieldtype": "Table", - "options": "Sales Invoice Item" + "options": "Sales Invoice Item", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "sales_bom_help", "fieldtype": "HTML", "label": "Sales BOM Help", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", "fieldname": "section_break0", "fieldtype": "Section Break", - "options": "Simple" + "options": "Simple", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "col_break26", "fieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -255,12 +271,14 @@ "fieldtype": "Button", "label": "Re-Calculate Values", "oldfieldtype": "Button", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", "fieldname": "col_break25", "fieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -272,7 +290,8 @@ "oldfieldname": "sales_order_main", "oldfieldtype": "Link", "options": "Sales Order", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "description": "Select Items from Delivery Note", @@ -283,7 +302,8 @@ "oldfieldname": "delivery_note_main", "oldfieldtype": "Link", "options": "Delivery Note", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -291,18 +311,21 @@ "fieldtype": "Button", "label": "Get Items", "oldfieldtype": "Button", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", "fieldname": "currency_section", "fieldtype": "Section Break", - "label": "Price List and Currency" + "label": "Price List and Currency", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "col_break27", "fieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -314,6 +337,7 @@ "oldfieldtype": "Select", "options": "link:Price List", "print_hide": 1, + "read_only": 0, "reqd": 1 }, { @@ -324,6 +348,7 @@ "label": "Price List Currency", "options": "Currency", "print_hide": 1, + "read_only": 0, "reqd": 1 }, { @@ -333,12 +358,14 @@ "fieldtype": "Float", "label": "Price List Currency Conversion Rate", "print_hide": 1, + "read_only": 0, "reqd": 1 }, { "doctype": "DocField", "fieldname": "column_break2", "fieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -350,6 +377,7 @@ "oldfieldtype": "Select", "options": "Currency", "print_hide": 1, + "read_only": 0, "reqd": 1 }, { @@ -362,6 +390,7 @@ "oldfieldname": "conversion_rate", "oldfieldtype": "Currency", "print_hide": 1, + "read_only": 0, "reqd": 1 }, { @@ -369,7 +398,8 @@ "fieldname": "taxes", "fieldtype": "Section Break", "label": "Taxes and Charges", - "oldfieldtype": "Section Break" + "oldfieldtype": "Section Break", + "read_only": 0 }, { "doctype": "DocField", @@ -379,7 +409,8 @@ "oldfieldname": "charge", "oldfieldtype": "Link", "options": "Sales Taxes and Charges Master", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -387,7 +418,8 @@ "fieldtype": "Button", "label": "Get Taxes and Charges", "oldfieldtype": "Button", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "allow_on_submit": 1, @@ -397,7 +429,8 @@ "label": "Taxes and Charges1", "oldfieldname": "other_charges", "oldfieldtype": "Table", - "options": "Sales Taxes and Charges" + "options": "Sales Taxes and Charges", + "read_only": 0 }, { "doctype": "DocField", @@ -405,7 +438,8 @@ "fieldtype": "Button", "label": "Calculate Taxes and Charges", "oldfieldtype": "Button", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -424,7 +458,8 @@ "fieldtype": "HTML", "label": "Taxes and Charges Calculation", "oldfieldtype": "HTML", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -432,7 +467,8 @@ "fieldtype": "Section Break", "label": "Totals", "oldfieldtype": "Section Break", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -440,6 +476,7 @@ "fieldtype": "Column Break", "oldfieldtype": "Column Break", "print_hide": 1, + "read_only": 0, "width": "50%" }, { @@ -508,6 +545,7 @@ "fieldtype": "Column Break", "oldfieldtype": "Column Break", "print_hide": 1, + "read_only": 0, "width": "50%" }, { @@ -569,12 +607,14 @@ "doctype": "DocField", "fieldname": "payments_section", "fieldtype": "Section Break", - "label": "Payments" + "label": "Payments", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "column_break3", "fieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -585,7 +625,8 @@ "oldfieldname": "paid_amount", "oldfieldtype": "Currency", "options": "Company:company:default_currency", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -595,12 +636,14 @@ "oldfieldname": "cash_bank_account", "oldfieldtype": "Link", "options": "Account", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", "fieldname": "column_break4", "fieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -608,7 +651,8 @@ "fieldname": "write_off_outstanding_amount_automatically", "fieldtype": "Check", "label": "Write Off Outstanding Amount", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -616,7 +660,8 @@ "fieldtype": "Currency", "label": "Write Off Amount", "options": "Company:company:default_currency", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -624,7 +669,8 @@ "fieldtype": "Link", "label": "Write Off Account", "options": "Account", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -632,14 +678,16 @@ "fieldtype": "Link", "label": "Write Off Cost Center", "options": "Cost Center", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", "fieldname": "terms_section_break", "fieldtype": "Section Break", "label": "Terms and Conditions", - "oldfieldtype": "Section Break" + "oldfieldtype": "Section Break", + "read_only": 0 }, { "doctype": "DocField", @@ -649,7 +697,8 @@ "oldfieldname": "tc_name", "oldfieldtype": "Link", "options": "Terms and Conditions", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -658,7 +707,8 @@ "label": "Get Terms and Conditions", "oldfieldtype": "Button", "options": "get_tc_details", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -667,7 +717,8 @@ "label": "Terms and Conditions HTML", "oldfieldtype": "HTML", "options": "You can add Terms and Notes that will be printed in the Transaction", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -675,18 +726,21 @@ "fieldtype": "Text Editor", "label": "Terms and Conditions Details", "oldfieldname": "terms", - "oldfieldtype": "Text Editor" + "oldfieldtype": "Text Editor", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "contact_section", "fieldtype": "Section Break", - "label": "Contact Info" + "label": "Contact Info", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "col_break23", "fieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -695,7 +749,8 @@ "fieldtype": "Link", "label": "Customer Address", "options": "Address", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -703,12 +758,14 @@ "fieldtype": "Link", "label": "Contact Person", "options": "Contact", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", "fieldname": "col_break24", "fieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -719,6 +776,7 @@ "label": "Territory", "options": "Territory", "print_hide": 1, + "read_only": 0, "reqd": 1, "search_index": 0 }, @@ -730,6 +788,7 @@ "label": "Customer Group", "options": "Customer Group", "print_hide": 1, + "read_only": 0, "search_index": 0 }, { @@ -738,7 +797,8 @@ "fieldtype": "Section Break", "label": "More Info", "oldfieldtype": "Section Break", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -746,6 +806,7 @@ "fieldtype": "Column Break", "oldfieldtype": "Column Break", "print_hide": 1, + "read_only": 0, "width": "50%" }, { @@ -760,6 +821,7 @@ "oldfieldtype": "Select", "options": "No\nYes", "print_hide": 1, + "read_only": 0, "search_index": 0 }, { @@ -770,7 +832,8 @@ "label": "Aging Date", "oldfieldname": "aging_date", "oldfieldtype": "Date", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -780,7 +843,8 @@ "no_copy": 1, "oldfieldname": "posting_time", "oldfieldtype": "Time", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "allow_on_submit": 1, @@ -791,7 +855,8 @@ "oldfieldname": "letter_head", "oldfieldtype": "Select", "options": "link:Letter Head", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -801,6 +866,7 @@ "no_copy": 1, "options": "No\nYes", "print_hide": 1, + "read_only": 0, "report_hide": 0 }, { @@ -822,7 +888,8 @@ "oldfieldname": "campaign", "oldfieldtype": "Link", "options": "Campaign", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "description": "Track this Sales Invoice against any Project", @@ -834,6 +901,7 @@ "oldfieldname": "project_name", "oldfieldtype": "Link", "options": "Project", + "read_only": 0, "search_index": 1 }, { @@ -847,6 +915,7 @@ "oldfieldtype": "Link", "options": "Print Heading", "print_hide": 1, + "read_only": 0, "report_hide": 1 }, { @@ -854,7 +923,8 @@ "fieldname": "column_break8", "fieldtype": "Column Break", "oldfieldtype": "Column Break", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -864,7 +934,8 @@ "oldfieldname": "source", "oldfieldtype": "Select", "options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -876,6 +947,7 @@ "oldfieldtype": "Link", "options": "Company", "print_hide": 1, + "read_only": 0, "reqd": 1, "search_index": 0 }, @@ -890,6 +962,7 @@ "oldfieldtype": "Select", "options": "link:Fiscal Year", "print_hide": 1, + "read_only": 0, "reqd": 1, "search_index": 0 }, @@ -914,7 +987,8 @@ "no_copy": 1, "oldfieldname": "amendment_date", "oldfieldtype": "Date", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "depends_on": "eval:!doc.__islocal", @@ -936,6 +1010,7 @@ "oldfieldname": "remarks", "oldfieldtype": "Text", "print_hide": 1, + "read_only": 0, "reqd": 0 }, { @@ -944,7 +1019,8 @@ "fieldtype": "Section Break", "label": "Advances", "oldfieldtype": "Section Break", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -953,7 +1029,8 @@ "label": "Get Advances Received", "oldfieldtype": "Button", "options": "get_advances", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -963,14 +1040,16 @@ "oldfieldname": "advance_adjustment_details", "oldfieldtype": "Table", "options": "Sales Invoice Advance", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", "fieldname": "packing_list", "fieldtype": "Section Break", "label": "Packing List", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -978,7 +1057,8 @@ "fieldtype": "Table", "label": "Packing Details", "options": "Delivery Note Packing Item", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -986,7 +1066,8 @@ "fieldtype": "Section Break", "label": "Sales Team", "oldfieldtype": "Section Break", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -994,6 +1075,7 @@ "fieldtype": "Column Break", "oldfieldtype": "Column Break", "print_hide": 1, + "read_only": 0, "width": "50%" }, { @@ -1005,7 +1087,8 @@ "oldfieldname": "sales_partner", "oldfieldtype": "Link", "options": "Sales Partner", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -1013,6 +1096,7 @@ "fieldtype": "Column Break", "oldfieldtype": "Column Break", "print_hide": 1, + "read_only": 0, "width": "50%" }, { @@ -1022,7 +1106,8 @@ "label": "Commission Rate (%)", "oldfieldname": "commission_rate", "oldfieldtype": "Currency", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -1032,14 +1117,16 @@ "oldfieldname": "total_commission", "oldfieldtype": "Currency", "options": "Company:company:default_currency", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", "fieldname": "section_break2", "fieldtype": "Section Break", "options": "Simple", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -1049,7 +1136,8 @@ "oldfieldname": "sales_team", "oldfieldtype": "Table", "options": "Sales Team", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "depends_on": "eval:doc.docstatus<2", @@ -1057,13 +1145,15 @@ "fieldname": "recurring_invoice", "fieldtype": "Section Break", "label": "Recurring Invoice", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", "fieldname": "column_break11", "fieldtype": "Column Break", "print_hide": 1, + "read_only": 0, "width": "50%" }, { @@ -1075,7 +1165,8 @@ "fieldtype": "Check", "label": "Convert into Recurring Invoice", "no_copy": 1, - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "allow_on_submit": 1, @@ -1087,7 +1178,8 @@ "label": "Recurring Type", "no_copy": 1, "options": "Monthly\nQuarterly\nHalf-yearly\nYearly", - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "allow_on_submit": 1, @@ -1098,7 +1190,8 @@ "fieldtype": "Int", "label": "Repeat on Day of Month", "no_copy": 1, - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "allow_on_submit": 1, @@ -1109,7 +1202,8 @@ "fieldtype": "Date", "label": "Invoice Period From Date", "no_copy": 1, - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "allow_on_submit": 1, @@ -1120,7 +1214,8 @@ "fieldtype": "Date", "label": "Invoice Period To Date", "no_copy": 1, - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -1128,6 +1223,7 @@ "fieldtype": "Column Break", "no_copy": 0, "print_hide": 1, + "read_only": 0, "width": "50%" }, { @@ -1139,7 +1235,8 @@ "fieldtype": "Small Text", "label": "Notification Email Address", "no_copy": 1, - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "depends_on": "eval:doc.convert_into_recurring_invoice==1", @@ -1172,7 +1269,8 @@ "fieldtype": "Date", "label": "End Date", "no_copy": 1, - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -1184,6 +1282,7 @@ "oldfieldname": "against_income_account", "oldfieldtype": "Small Text", "print_hide": 1, + "read_only": 0, "report_hide": 1 }, { @@ -1193,7 +1292,8 @@ "hidden": 1, "label": "File List", "no_copy": 1, - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "amend": 1, diff --git a/accounts/doctype/sales_invoice/sales_invoice_list.js b/accounts/doctype/sales_invoice/sales_invoice_list.js index 14d92f2f38..e83611aff0 100644 --- a/accounts/doctype/sales_invoice/sales_invoice_list.js +++ b/accounts/doctype/sales_invoice/sales_invoice_list.js @@ -1,10 +1,10 @@ // render wn.listview_settings['Sales Invoice'] = { add_fields: ["`tabSales Invoice`.grand_total", "`tabSales Invoice`.outstanding_amount"], - add_columns: [{"content":"outstanding_amount", width:"10%", type:"bar-graph", + add_columns: [{"content":"paid_amount", width:"10%", type:"bar-graph", label: "Payment Received"}], prepare_data: function(data) { - data.outstanding_amount = (flt(data.grand_total) - - flt(data.outstanding_amount)) / flt(data.grand_total) * 100; + data.paid_amount = flt(data.grand_total) ? (((flt(data.grand_total) - + flt(data.outstanding_amount)) / flt(data.grand_total)) * 100) : 0; } }; diff --git a/accounts/page/accounts_home/accounts_home.js b/accounts/page/accounts_home/accounts_home.js index 9981ee9a97..0dd00ed659 100644 --- a/accounts/page/accounts_home/accounts_home.js +++ b/accounts/page/accounts_home/accounts_home.js @@ -139,6 +139,11 @@ wn.module_page["Accounts"] = [ "page":"Financial Statements", "label": wn._("Financial Statements") }, + { + "label":wn._("Accounts Receivable"), + route: "query-report/Accounts Receivable", + doctype: "Sales Invoice" + }, ] }, { diff --git a/accounts/report/accounts_receivable/__init__.py b/accounts/report/accounts_receivable/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/accounts/report/accounts_receivable/accounts_receivable.js b/accounts/report/accounts_receivable/accounts_receivable.js new file mode 100644 index 0000000000..68c8593dd6 --- /dev/null +++ b/accounts/report/accounts_receivable/accounts_receivable.js @@ -0,0 +1,42 @@ +wn.query_reports["Accounts Receivable"] = { + "filters": [ + { + "fieldname":"company", + "label": "Company", + "fieldtype": "Link", + "options": "Company", + "default": sys_defaults.company + }, + { + "fieldname":"account", + "label": "Account", + "fieldtype": "Link", + "options": "Account", + "get_query": function() { + var company = wn.query_report.filters_by_name.company.get_value(); + return { + "query": "accounts.utils.get_account_list", + "filters": { + "is_pl_account": "No", + "debit_or_credit": "Debit", + "company": company, + "master_type": "Customer" + } + } + } + }, + { + "fieldname":"report_date", + "label": "Date", + "fieldtype": "Date", + "default": get_today() + }, + { + "fieldname":"ageing_based_on", + "label": "Ageing Based On", + "fieldtype": "Select", + "options": 'Posting Date' + NEWLINE + 'Due Date', + "default": "Posting Date" + } + ] +} \ No newline at end of file diff --git a/accounts/report/accounts_receivable/accounts_receivable.py b/accounts/report/accounts_receivable/accounts_receivable.py new file mode 100644 index 0000000000..4c0d4e11d3 --- /dev/null +++ b/accounts/report/accounts_receivable/accounts_receivable.py @@ -0,0 +1,141 @@ +from __future__ import unicode_literals +import webnotes +from webnotes.utils import getdate, nowdate, flt, cstr + +def execute(filters=None): + if not filters: filters = {} + columns = get_columns() + entries = get_gl_entries(filters) + + entries_after_report_date = [[gle.voucher_type, gle.voucher_no] + for gle in get_gl_entries(filters, upto_report_date=False)] + + account_territory_map = get_account_territory_map() + si_due_date_map = get_si_due_date_map() + + # Age of the invoice on this date + age_on = getdate(filters.get("report_date")) > getdate(nowdate()) \ + and nowdate() or filters.get("report_date") + + data = [] + total_invoiced_amount = total_payment = total_outstanding = 0 + for gle in entries: + if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \ + or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date: + + due_date = (gle.voucher_type == "Sales Invoice") \ + and si_due_date_map.get(gle.voucher_no) or "" + + invoiced_amount = gle.debit > 0 and gle.debit or 0 + payment_amount = get_payment_amount(gle, filters.get("report_date") or nowdate(), + entries_after_report_date) + outstanding_amount = invoiced_amount - payment_amount + + if abs(flt(outstanding_amount)) > 0.01: + row = [gle.posting_date, gle.account, gle.voucher_type, gle.voucher_no, + gle.remarks, due_date, account_territory_map.get(gle.account), + invoiced_amount, payment_amount, outstanding_amount] + # Ageing + if filters.get("ageing_based_on") == "Due Date": + ageing_based_on_date = due_date + else: + ageing_based_on_date = gle.posting_date + row += get_ageing_data(ageing_based_on_date, age_on, outstanding_amount) + + # Add to total + total_invoiced_amount += flt(invoiced_amount) + total_payment += flt(payment_amount) + total_outstanding += flt(outstanding_amount) + + data.append(row) + if data: + data.append(["", "", "", "", "", "", "Total", total_invoiced_amount, total_payment, + total_outstanding, "", "", "", ""]) + + return columns, data + +def get_columns(): + return [ + "Posting Date:Date:80", "Account:Link/Account:150", "Voucher Type::110", + "Voucher No::120", "Remarks::150", "Due Date:Date:80", "Territory:Link/Territory:80", + "Invoiced Amount:Currency:100", "Payment Amount:Currency:100", + "Outstanding Amount:Currency:100", "Age:Int:50", "0-30:Currency:100", + "30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100" + ] + +def get_gl_entries(filters, upto_report_date=True): + conditions, customer_accounts = get_conditions(filters, upto_report_date) + return webnotes.conn.sql("""select * from `tabGL Entry` + where ifnull(is_cancelled, 'No') = 'No' %s order by posting_date, account""" % + (conditions) % (", ".join(['%s']*len(customer_accounts))), + tuple(customer_accounts), as_dict=1) + +def get_conditions(filters, upto_report_date=True): + conditions = "" + if filters.get("company"): + conditions += " and company='%s'" % filters["company"] + + customer_accounts = [] + if filters.get("account"): + customer_accounts = [filters["account"]] + elif filters.get("company"): + customer_accounts = webnotes.conn.sql_list("""select name from `tabAccount` + where ifnull(master_type, '') = 'Customer' and docstatus < 2 %s""" % + conditions, filters) + + if customer_accounts: + conditions += " and account in (%s)" + + if filters.get("report_date"): + if upto_report_date: + conditions += " and posting_date<='%s'" % filters["report_date"] + else: + conditions += " and posting_date>'%s'" % filters["report_date"] + + return conditions, customer_accounts + +def get_account_territory_map(): + account_territory_map = {} + for each in webnotes.conn.sql("""select t2.name, t1.territory from `tabCustomer` t1, + `tabAccount` t2 where t1.name = t2.master_name group by t2.name"""): + account_territory_map[each[0]] = each[1] + + return account_territory_map + +def get_si_due_date_map(): + """ get due_date from sales invoice """ + si_due_date_map = {} + for t in webnotes.conn.sql("""select name, due_date from `tabSales Invoice` group by name"""): + si_due_date_map[t[0]] = t[1] + + return si_due_date_map + +def get_payment_amount(gle, report_date, entries_after_report_date): + payment_amount = 0 + if flt(gle.credit) > 0 and (not gle.against_voucher or + [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date): + payment_amount = gle.credit + elif flt(gle.debit) > 0: + payment_amount = webnotes.conn.sql(""" + select sum(ifnull(credit, 0)) - sum(ifnull(debit, 0)) from `tabGL Entry` + where account = %s and posting_date <= %s and against_voucher_type = %s + and against_voucher = %s and name != %s and ifnull(is_cancelled, 'No') = 'No'""", + (gle.account, report_date, gle.voucher_type, gle.voucher_no, gle.name))[0][0] + + return flt(payment_amount) + +def get_ageing_data(ageing_based_on_date, age_on, outstanding_amount): + val1 = val2 = val3 = val4 = diff = 0 + diff = age_on and ageing_based_on_date \ + and (getdate(age_on) - getdate(ageing_based_on_date)).days or 0 + + if diff <= 30: + val1 = outstanding_amount + elif 30 < diff <= 60: + val2 = outstanding_amount + elif 60 < diff <= 90: + val3 = outstanding_amount + elif diff > 90: + val4 = outstanding_amount + + return [diff, val1, val2, val3, val4] \ No newline at end of file diff --git a/accounts/report/accounts_receivable/accounts_receivable.txt b/accounts/report/accounts_receivable/accounts_receivable.txt new file mode 100644 index 0000000000..28f7e4f44d --- /dev/null +++ b/accounts/report/accounts_receivable/accounts_receivable.txt @@ -0,0 +1,21 @@ +[ + { + "creation": "2013-04-16 11:31:13", + "docstatus": 0, + "modified": "2013-04-16 11:31:13", + "modified_by": "Administrator", + "owner": "Administrator" + }, + { + "doctype": "Report", + "is_standard": "Yes", + "name": "__common__", + "ref_doctype": "Sales Invoice", + "report_name": "Accounts Receivable", + "report_type": "Script Report" + }, + { + "doctype": "Report", + "name": "Accounts Receivable" + } +] \ No newline at end of file diff --git a/accounts/search_criteria/accounts_receivable/accounts_receivable.sql b/accounts/search_criteria/accounts_receivable/accounts_receivable.sql index e9f392200d..6f1c459fdb 100644 --- a/accounts/search_criteria/accounts_receivable/accounts_receivable.sql +++ b/accounts/search_criteria/accounts_receivable/accounts_receivable.sql @@ -13,4 +13,4 @@ WHERE AND `tabGL Entry`.`is_cancelled` = 'No' AND `tabAccount`.`master_type` = 'Customer' AND `tabAccount`.`name` = `tabGL Entry`.`account` -ORDER BY `tabGL Entry`.`posting_date` +ORDER BY `tabGL Entry`.`posting_date`, `tabGL Entry`.`account` diff --git a/hr/doctype/salary_structure/salary_structure.txt b/hr/doctype/salary_structure/salary_structure.txt index c2efac6a8d..43b36626f6 100644 --- a/hr/doctype/salary_structure/salary_structure.txt +++ b/hr/doctype/salary_structure/salary_structure.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-01-23 19:57:18", + "creation": "2013-03-07 18:50:29", "docstatus": 0, - "modified": "2013-01-29 17:35:34", + "modified": "2013-04-22 14:09:04", "modified_by": "Administrator", "owner": "Administrator" }, @@ -41,6 +41,7 @@ "doctype": "DocField", "fieldname": "column_break0", "fieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -52,6 +53,7 @@ "oldfieldname": "employee", "oldfieldtype": "Link", "options": "Employee", + "read_only": 0, "reqd": 1 }, { @@ -116,6 +118,7 @@ "doctype": "DocField", "fieldname": "column_break1", "fieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -129,6 +132,7 @@ "oldfieldname": "is_active", "oldfieldtype": "Select", "options": "\nYes\nNo", + "read_only": 0, "reqd": 1 }, { @@ -139,6 +143,7 @@ "label": "From Date", "oldfieldname": "from_date", "oldfieldtype": "Date", + "read_only": 0, "reqd": 1 }, { @@ -148,7 +153,8 @@ "in_list_view": 1, "label": "To Date", "oldfieldname": "to_date", - "oldfieldtype": "Date" + "oldfieldtype": "Date", + "read_only": 0 }, { "description": "Cost to Company", @@ -156,10 +162,11 @@ "fieldname": "ctc", "fieldtype": "Currency", "in_filter": 1, - "label": "CTC", + "label": "Annual Cost To Company", "oldfieldname": "ctc", "oldfieldtype": "Currency", "options": "Company:company:default_currency", + "read_only": 0, "reqd": 1 }, { @@ -169,6 +176,7 @@ "in_filter": 1, "label": "Company", "options": "link:Company", + "read_only": 0, "reqd": 1 }, { @@ -178,7 +186,8 @@ "fieldtype": "Section Break", "label": "Earning & Deduction", "oldfieldname": "earning_deduction", - "oldfieldtype": "Section Break" + "oldfieldtype": "Section Break", + "read_only": 0 }, { "doctype": "DocField", @@ -188,6 +197,7 @@ "label": "Earning", "oldfieldname": "col_brk2", "oldfieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -198,7 +208,8 @@ "label": "Earning1", "oldfieldname": "earning_details", "oldfieldtype": "Table", - "options": "Salary Structure Earning" + "options": "Salary Structure Earning", + "read_only": 0 }, { "doctype": "DocField", @@ -208,6 +219,7 @@ "label": "Deduction", "oldfieldname": "col_brk3", "oldfieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -218,18 +230,21 @@ "label": "Deduction1", "oldfieldname": "deduction_details", "oldfieldtype": "Table", - "options": "Salary Structure Deduction" + "options": "Salary Structure Deduction", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "section_break0", "fieldtype": "Section Break", - "options": "Simple" + "options": "Simple", + "read_only": 0 }, { "doctype": "DocField", "fieldname": "column_break2", "fieldtype": "Column Break", + "read_only": 0, "width": "50%" }, { @@ -256,6 +271,7 @@ "doctype": "DocField", "fieldname": "column_break3", "fieldtype": "Column Break", + "read_only": 0, "width": "50%" }, {