def get_data(self, party_naming_by, args): data = [] partywise_total = self.get_partywise_total(party_naming_by, args) partywise_advance_amount = get_partywise_advanced_payment_amount(args.get("party_type")) or {} for party, party_dict in iteritems(partywise_total): row = [party] if party_naming_by == "Naming Series": row += [self.get_party_name(args.get("party_type"), party)] row += [partywise_advance_amount.get(party, 0)] row += [ party_dict.invoiced_amt, party_dict.paid_amt, party_dict.credit_amt, party_dict.outstanding_amt, party_dict.range1, party_dict.range2, party_dict.range3, party_dict.range4, ] if args.get("party_type") == "Customer": row += [self.get_territory(party), self.get_customer_group(party), ", ".join(set(party_dict.sales_person))] if args.get("party_type") == "Supplier": row += [self.get_supplier_group(party)] row.append(party_dict.currency) data.append(row) return data
def get_data(self, args): self.data = [] self.receivables = ReceivablePayableReport(self.filters).run(args)[1] self.get_party_total(args) party_advance_amount = get_partywise_advanced_payment_amount( self.party_type, self.filters.report_date, self.filters.company) or {} for party, party_dict in iteritems(self.party_total): if party_dict.outstanding == 0: continue row = frappe._dict() row.party = party if self.party_naming_by == "Naming Series": row.party_name = frappe.get_cached_value( self.party_type, party, scrub(self.party_type) + "_name") row.update(party_dict) # Advance against party row.advance = party_advance_amount.get(party, 0) # In AR/AP, advance shown in paid columns, # but in summary report advance shown in separate column row.paid -= row.advance self.data.append(row)
def get_data(self, party_naming_by, args): data = [] partywise_total = self.get_partywise_total(party_naming_by, args) if args.get("party_type") != "Employee": partywise_advance_amount = get_partywise_advanced_payment_amount(args.get("party_type"), self.filters.get("report_date")) or {} else: partywise_advance_amount = {} for party, party_dict in iteritems(partywise_total): row = frappe._dict({"party": party}) if party_naming_by == "Naming Series": row["party_name"] = self.get_party_name(args.get("party_type"), party) row["advance_amount"] = partywise_advance_amount.get(party, 0) row["invoiced_amount"] = party_dict.invoiced_amount row["paid_amount"] = party_dict.paid_amount row["return_amount"] = party_dict.return_amount row["outstanding_amount"] = party_dict.outstanding_amount for i in range(5): row["range{}".format(i+1)] = party_dict.get("range{}".format(i+1)) if args.get("party_type") == "Customer": row["territory"] = self.get_territory(party) row["customer_group"] = self.get_customer_group(party) row["sales_person"] = ", ".join(set(party_dict.sales_person)) if args.get("party_type") == "Supplier": row["supplier_group"] = self.get_supplier_group(party) row["currency"] = party_dict.currency data.append(row) return data