def calculate_totals(self):
		self.doc.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist 
			else self.doc.net_total, self.precision("grand_total"))
		self.doc.grand_total_import = flt(self.doc.grand_total / self.doc.conversion_rate,
			self.precision("grand_total_import"))

		self.doc.total_tax = flt(self.doc.grand_total - self.doc.net_total,
			self.precision("total_tax"))

		if self.meta.get_field("rounded_total"):
			self.doc.rounded_total = _round(self.doc.grand_total)
		
		if self.meta.get_field("rounded_total_import"):
			self.doc.rounded_total_import = _round(self.doc.grand_total_import)
				
		if self.meta.get_field("other_charges_added"):
			self.doc.other_charges_added = flt(sum([flt(d.tax_amount) for d in self.tax_doclist 
				if d.add_deduct_tax=="Add" and d.category in ["Valuation and Total", "Total"]]), 
				self.precision("other_charges_added"))
				
		if self.meta.get_field("other_charges_deducted"):
			self.doc.other_charges_deducted = flt(sum([flt(d.tax_amount) for d in self.tax_doclist 
				if d.add_deduct_tax=="Deduct" and d.category in ["Valuation and Total", "Total"]]), 
				self.precision("other_charges_deducted"))
				
		if self.meta.get_field("other_charges_added_import"):
			self.doc.other_charges_added_import = flt(self.doc.other_charges_added / 
				self.doc.conversion_rate, self.precision("other_charges_added_import"))
				
		if self.meta.get_field("other_charges_deducted_import"):
			self.doc.other_charges_deducted_import = flt(self.doc.other_charges_deducted / 
				self.doc.conversion_rate, self.precision("other_charges_deducted_import"))
	def calculate_totals(self):
		self.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist
			else self.net_total, self.precision("grand_total"))
		self.grand_total_import = flt(self.grand_total / self.conversion_rate,
			self.precision("grand_total_import"))

		self.total_tax = flt(self.grand_total - self.net_total,
			self.precision("total_tax"))

		if self.meta.get_field("rounded_total"):
			self.rounded_total = _round(self.grand_total)

		if self.meta.get_field("rounded_total_import"):
			self.rounded_total_import = _round(self.grand_total_import)

		if self.meta.get_field("other_charges_added"):
			self.other_charges_added = flt(sum([flt(d.tax_amount) for d in self.tax_doclist
				if d.add_deduct_tax=="Add" and d.category in ["Valuation and Total", "Total"]]),
				self.precision("other_charges_added"))

		if self.meta.get_field("other_charges_deducted"):
			self.other_charges_deducted = flt(sum([flt(d.tax_amount) for d in self.tax_doclist
				if d.add_deduct_tax=="Deduct" and d.category in ["Valuation and Total", "Total"]]),
				self.precision("other_charges_deducted"))

		if self.meta.get_field("other_charges_added_import"):
			self.other_charges_added_import = flt(self.other_charges_added /
				self.conversion_rate, self.precision("other_charges_added_import"))

		if self.meta.get_field("other_charges_deducted_import"):
			self.other_charges_deducted_import = flt(self.other_charges_deducted /
				self.conversion_rate, self.precision("other_charges_deducted_import"))
	def calculate_totals(self):
		self.doc.grand_total = flt(self.tax_doclist and \
			self.tax_doclist[-1].total or self.doc.net_total, self.precision("grand_total"))
		self.doc.grand_total_export = flt(self.doc.grand_total / self.doc.conversion_rate, 
			self.precision("grand_total_export"))
			
		self.doc.other_charges_total = flt(self.doc.grand_total - self.doc.net_total,
			self.precision("other_charges_total"))

		self.doc.other_charges_total_export = flt(self.doc.grand_total_export - 
			self.doc.net_total_export + flt(self.doc.discount_amount), 
			self.precision("other_charges_total_export"))
		
		self.doc.rounded_total = _round(self.doc.grand_total)
		self.doc.rounded_total_export = _round(self.doc.grand_total_export)
    def calculate_totals(self):
        self.grand_total = flt(
            self.tax_doclist and self.tax_doclist[-1].total or self.net_total, self.precision("grand_total")
        )
        self.grand_total_export = flt(self.grand_total / self.conversion_rate, self.precision("grand_total_export"))

        self.other_charges_total = flt(self.grand_total - self.net_total, self.precision("other_charges_total"))

        self.other_charges_total_export = flt(
            self.grand_total_export - self.net_total_export + flt(self.discount_amount),
            self.precision("other_charges_total_export"),
        )

        self.rounded_total = _round(self.grand_total)
        self.rounded_total_export = _round(self.grand_total_export)
Exemple #5
0
	def calculate_earning_total(self):
		self.gross_pay = flt(self.arrear_amount) + flt(self.leave_encashment_amount)
		for d in self.get("earning_details"):
			if cint(d.e_depends_on_lwp) == 1:
				d.e_modified_amount = _round(flt(d.e_amount) * flt(self.payment_days)
					/ cint(self.total_days_in_month), 2)
			elif not self.payment_days:
				d.e_modified_amount = 0
			else:
				d.e_modified_amount = d.e_amount
			self.gross_pay += flt(d.e_modified_amount)
	def calculate_earning_total(self):
		self.gross_pay = flt(self.arrear_amount) + flt(self.leave_encashment_amount)
		for d in self.get("earning_details"):
			if cint(d.e_depends_on_lwp) == 1:
				d.e_modified_amount = _round(flt(d.e_amount) * flt(self.payment_days)
					/ cint(self.total_days_in_month), 2)
			elif not self.payment_days:
				d.e_modified_amount = 0
			else:
				d.e_modified_amount = d.e_amount
			self.gross_pay += flt(d.e_modified_amount)
Exemple #7
0
	def calculate_ded_total(self):
		self.total_deduction = 0
		for d in self.get('deduction_details'):
			if cint(d.d_depends_on_lwp) == 1:
				d.d_modified_amount = _round(flt(d.d_amount) * flt(self.payment_days)
					/ cint(self.total_days_in_month), 2)
			elif not self.payment_days:
				d.d_modified_amount = 0
			else:
				d.d_modified_amount = d.d_amount

			self.total_deduction += flt(d.d_modified_amount)
	def calculate_ded_total(self):
		self.total_deduction = 0
		for d in self.get('deduction_details'):
			if cint(d.d_depends_on_lwp) == 1:
				d.d_modified_amount = _round(flt(d.d_amount) * flt(self.payment_days)
					/ cint(self.total_days_in_month), 2)
			elif not self.payment_days:
				d.d_modified_amount = 0
			else:
				d.d_modified_amount = d.d_amount

			self.total_deduction += flt(d.d_modified_amount)
Exemple #9
0
	def calculate_net_pay(self):
		self.calculate_earning_total()
		self.calculate_ded_total()
		self.net_pay = flt(self.gross_pay) - flt(self.total_deduction)
		self.rounded_total = _round(self.net_pay)
	def calculate_net_pay(self):
		self.calculate_earning_total()
		self.calculate_ded_total()
		self.net_pay = flt(self.gross_pay) - flt(self.total_deduction)
		self.rounded_total = _round(self.net_pay)