Giter VIP home page Giter VIP logo

moneyplex's People

Contributors

marcus-wiegand avatar roquegv avatar wojosc avatar

Watchers

 avatar

moneyplex's Issues

Feature: Automated Moneyplex Export

General purpose: add a function to export the Payment Requests entries into a Excel file.

TODOs:

  • Add a button on the listview of Payment Request, named "Noneyplexexport gebuchter Einträge"
  • Use the provided SQL query to get the data and download a Excel file.
  • Only documents with "Für Moneyplex exportiert" == 0 should be exported.
  • When exported, this field turns to 1.
  • Add new fields to the Payment Request doctype.
  • The exported file should keep the order according to creation datetime.
  • #6
  • The field "Für Moneyplex exportiert" should also be created on Payment Entry.
  • Disable the sending of email when submitting the Payment Request.

SQL query:

SELECT
    `tabPayment Request`.company AS "Kontoname",
    `tabPayment Request`.bank_account_no AS "Kontonummer",
    `tabPayment Request`.branch_code AS "Bankleitzahl",
--    ursprüngliche Variante:
--    `tabPayment Request`.transaction_date AS "Datum",
--    `tabPayment Request`.valuta AS "Valuta",
    TO_CHAR(`tabPayment Request`.transaction_date, 'DD.MM.YYYY') AS "Datum",
    TO_CHAR(`tabPayment Request`.valuta, 'DD.MM.YYYY') AS "Valuta",
    `tabPayment Request`.supplier_name AS "Name",
    `tabPayment Request`.party_iban AS "Iban",
    `tabPayment Request`.party_bic AS "Bic",
    `tabPayment Request`.reference_name AS "Zweck",
    `tabPayment Request`.mode_of_payment AS "Kategorie",
-- ursprüngliche Variante:
--    `tabPayment Request`.grand_total AS "Betrag",
    FORMAT(`tabPayment Request`.grand_total, 2, 'de_DE') AS "Betrag",
    `tabPayment Request`.currency AS "Währung"
FROM
    `tabPayment Request`
WHERE
    `tabPayment Request`.docstatus = 1 AND `tabPayment Request`._für_moneyplex_exportiert = 0

New fields in Payment Request:

Line 3:
Label: Valuta
Name:valuta
Type:Date

Line 7:
Label: Company
Name: company
Type: Link
Description: Wird über den Bankaccount des eigenen Unternehmens gezogen.
Fetch From; bank_account.company
Options: Company

Line 8:
Label:  Für Moneyplex exportiert
Name: _für_moneyplex_exportiert
Type: Check
Activated options:
In List View
Allow on Submit

Line 12:
Label: Supplier Name
Name:supplier_name
Type: Data
Description: Leeres Feld? Dann muss noch auf dem bei Partei eingetragenen Lieferanten das Feld "Standard-Bankkonto des Unternehmens" ausgefüllt werden. (Bankkonto, IBAN, BIC werden danach ebenfalls gezogen.)
In List View x
Fetch from party.supplier_name

Line 13:
Label: Bank Account
Name:party_bank_account
Type:Link
Options: Bank Account
Fetch from: party.default_bank_account

Line 14:
Label: IBAN
Name: party_iban
Type:Data
Detch from: party_bank_account.iban

Line 15:
Label: BIC
Name:party_bic
Type: Data
Fetch from: party_bank_account.branch_code

create Report view for export

This is a php script that was used in the past to do this from the docType Payment

#!/bin/bash

set -e

function cleanup()
{
	
	# echo "\"${last_command}\" command filed with exit code $?."
	rm -f /tmp/projects2.lock
}

lockfile -r 0 /tmp/projects2.lock || exit 1

trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
trap 'cleanup $?' EXIT

! $verbose && sleep 5

echo -e 'Start projects2.sh' | mail --content-type 'text/plain; charset=utf-8' -s 'Start Project' [email protected]


TARGETDIR="$HOME/owncloud/projects/ERPNext/Temp-Projektverzeichnisse"

MOUNT="/usr/bin/mount"
UMOUNT="/usr/bin/umount"
MAIL="/usr/bin/mailmail3"

RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color

verbose=false
debug=false
help=false

while getopts :vdh option; do
    case "${option}" in
        v)	verbose=true;;
        d)	debug=true;;
        h)	help=true;;
    esac
done

if [ -d "$TARGETDIR" ]; then
	$verbose && echo -e "${GREEN}Folder ${TARGETDIR} exists ....${NC}"
else
	$verbose && echo -e "${RED}Folder ${TARGETDIR} not exists ....${NC}"
	$MOUNT ~/owncloud/projects
	
	if [ -d "$TARGETDIR" ]; then
		$verbose && echo -e "${GREEN}Folder ${TARGETDIR} could be mounted ....${NC}"
	else
		$verbose && echo -e "${RED}Folder ${TARGETDIR} cannot be mounted ....${NC}"
		exit 1
	fi
fi

# ls -la $TARGETDIR

LASTLINE=`wc -l < /home/pdW9PwKp/frappe-bench/logs/project.log`
$verbose && echo -e "lastline = ${RED}$LASTLINE${NC}"

COUNTER=0
while IFS=';' read -r -a my_array; do
	let COUNTER=COUNTER+1
	# $verbose && echo -e $COUNTER
	
	if [ $COUNTER = $LASTLINE ]; then
		$verbose && echo -e ${my_array[0]} ${my_array[1]} ${my_array[2]} ${my_array[3]} ${my_array[4]} ${my_array[5]}
	else
		continue
	fi
	
	typeof=${my_array[0]}
	projectnumber=${my_array[1]}
	clientcodes=${my_array[2]}
	clientnumber=${my_array[3]}
	projectname=${my_array[4]}
	startdate=${my_array[5]}
	
	projectnumber=${projectnumber//PROJ-/}
	projectname=${projectname// | /-}
	projectname=${projectname// /_}
	
	CLIENTDIR="$TARGETDIR/$clientcodes-$clientnumber"
	ACQUISITIONDIR="$CLIENTDIR/$clientcodes-Akquisition"
	PROJECTDIR="$CLIENTDIR/$projectname-$projectnumber"
	WORKRESULTSDIR="$PROJECTDIR/Arbeitsergebnisse-$projectnumber"
	PMDIR="$PROJECTDIR/PM-$projectnumber"
	CONTRACTSDIR="$PROJECTDIR/Vertraege-$projectnumber"
	
	TOAUTHORITYDIR="$WORKRESULTSDIR/An_Behoerde-$projectnumber"
	TOREVIEWERSDIR="$WORKRESULTSDIR/An_Gutachter$projectnumber"
	TOCLIENTDIR="$WORKRESULTSDIR/An_Kunden-$projectnumber"
	AUTHORIZATIONDIR="$WORKRESULTSDIR/Vollmacht-$projectnumber"
	FROMREVIEWERDIR="$WORKRESULTSDIR/Vom_Gutachter-$projectnumber"
	FROMCLIENTDIR="$WORKRESULTSDIR/Vom_Kunden-$projectnumber"
	FROMAUTHORITYDIR="$WORKRESULTSDIR/Von_Behoerde-$projectnumber"
	WORKSHOPSDIR="$WORKRESULTSDIR/Workshops-$projectnumber"
	
	if [[ "PROJECT" = ${typeof^^} ]]; then
		if [ -d "$TARGETDIR" ]; then
			if [ ! -d "$CLIENTDIR" ]; then
				$verbose && echo -e "mkdir ${RED}$CLIENTDIR${NC}"
				mkdir "$CLIENTDIR"
			fi
			
			if [ ! -d "$ACQUISITIONDIR" ]; then
				$verbose && echo -e "mkdir ${RED}$ACQUISITIONDIR${NC}"
				mkdir "$ACQUISITIONDIR"
			fi
			
			if [ ! -d "$PROJECTDIR" ]; then
				$verbose && echo -e "mkdir ${RED}$PROJECTDIR${NC}"
				mkdir "$PROJECTDIR"
			fi
			
			if [ ! -d "$WORKRESULTSDIR" ]; then
				$verbose && echo -e "mkdir ${RED}$WORKRESULTSDIR${NC}"
				mkdir "$WORKRESULTSDIR"
			fi
			
			if [ ! -d "$PMDIR" ]; then
				$verbose && echo -e "mkdir ${RED}$PMDIR${NC}"
				mkdir "$PMDIR"
			fi
			
			if [ ! -d "$CONTRACTSDIR" ]; then
				$verbose && echo -e "mkdir ${RED}$CONTRACTSDIR${NC}"
				mkdir "$CONTRACTSDIR"
			fi
			
			if [ ! -d "$TOAUTHORITYDIR" ]; then
				$verbose && echo -e "mkdir ${RED}$TOAUTHORITYDIR${NC}"
				mkdir "$TOAUTHORITYDIR"
			fi
			
			if [ ! -d "$TOREVIEWERSDIR" ]; then
				$verbose && echo -e "mkdir ${RED}$TOREVIEWERSDIR${NC}"
				mkdir "$TOREVIEWERSDIR"
			fi
			
			if [ ! -d "$TOCLIENTDIR" ]; then
				$verbose && echo -e "mkdir ${RED}$TOCLIENTDIR${NC}"
				mkdir "$TOCLIENTDIR"
			fi
			
			if [ ! -d "$AUTHORIZATIONDIR" ]; then
				$verbose && echo -e "mkdir ${RED}$AUTHORIZATIONDIR${NC}"
				mkdir "$AUTHORIZATIONDIR"
			fi
			
			if [ ! -d "$FROMREVIEWERDIR" ]; then
				$verbose && echo -e "mkdir ${RED}$FROMREVIEWERDIR${NC}"
				mkdir "$FROMREVIEWERDIR"
			fi
			
			if [ ! -d "$FROMCLIENTDIR" ]; then
				$verbose && echo -e "mkdir ${RED}$FROMCLIENTDIR${NC}"
				mkdir "$FROMCLIENTDIR"
			fi
			
			if [ ! -d "$FROMAUTHORITYDIR" ]; then
				$verbose && echo -e "mkdir ${RED}$FROMAUTHORITYDIR${NC}"
				mkdir "$FROMAUTHORITYDIR"
			fi
			
			if [ ! -d "$WORKSHOPSDIR" ]; then
				$verbose && echo -e "mkdir ${RED}$WORKSHOPSDIR${NC}"
				mkdir "$WORKSHOPSDIR"
			fi
		fi
	fi
	
done <<< $(cat /home/pdW9PwKp/frappe-bench/logs/project.log)

! $verbose && $UMOUNT ~/owncloud/projects 2>&1> /dev/null
$verbose && $UMOUNT -v ~/owncloud/projects

value=`cat /home/pdW9PwKp/frappe-bench/logs/project.log`
value=${value//$'\n'/'\n'}
echo -e $value | mail --content-type 'text/plain; charset=utf-8' -s 'End Project' [email protected]


rm -f /tmp/projects2.lock



Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.