Issue 7 printed and uploaded
This commit is contained in:
70
auswert.awk
Normal file
70
auswert.awk
Normal file
@@ -0,0 +1,70 @@
|
||||
# printrun.awk
|
||||
#
|
||||
# calculate cost of a fanzine printrun
|
||||
#
|
||||
# usage:
|
||||
#
|
||||
# awk -f printrun.awk verteiler
|
||||
#
|
||||
# verteiler:
|
||||
#
|
||||
# csv file with info on subscriptions.
|
||||
#
|
||||
# format:
|
||||
# best, beleg, gezahlt, verschickt, anschrift
|
||||
#
|
||||
# with best: zines ordered
|
||||
# beleg: free zines because of submission
|
||||
# gezahlt: this much has been payed
|
||||
# verschickt: 0 = nothing sent yet, n = this many zines have been sent
|
||||
# anschrift: postal address of subscriber
|
||||
#
|
||||
BEGIN {
|
||||
FS=", "
|
||||
bestell=0
|
||||
beleg=0
|
||||
zahlungen=0
|
||||
# get data from file printrun
|
||||
while ( getline <"printrun" ) {
|
||||
split($0,a,": ")
|
||||
if (a[1] == "auflage")
|
||||
auflage=a[2]
|
||||
else if (a[1] == "versand")
|
||||
heftversand=a[2]
|
||||
else if (a[1] == "druck")
|
||||
druck=a[2]
|
||||
else if (a[1] == "preis")
|
||||
preis=a[2]
|
||||
}
|
||||
}
|
||||
!/#.*/{
|
||||
bestell=bestell+$1
|
||||
beleg=beleg+$2
|
||||
zahlungen=zahlungen+$3
|
||||
if ( $1 !=0 && $3 > 0 ) {
|
||||
porto=porto+($3 - ($1 * preis))
|
||||
hefte=hefte+($1 * preis)
|
||||
}
|
||||
if ( $2 != 0 ) {
|
||||
belegversand=$2*heftversand
|
||||
}
|
||||
}
|
||||
END {
|
||||
versand=porto+belegversand
|
||||
heftkosten=(druck+beleg*belegvers)/(auflage-beleg)
|
||||
printf "-----------------------------------------------------\n"
|
||||
printf "Auflage: \t%i\tBelegexemplare:\t%i\n", auflage, beleg
|
||||
printf "Bestellungen: \t%i\tRest: \t%i\n", bestell, auflage-(beleg+bestell)
|
||||
printf "-----------------------------------------------------\n"
|
||||
printf "Einzelpreis: %7.2f €\n", preis
|
||||
printf "Heftkosten: %7.2f €\n", heftkosten
|
||||
printf "Differenz: %7.2f €\n", preis-heftkosten
|
||||
printf "-----------------------------------------------------\n"
|
||||
printf "Einnahmen:\n"
|
||||
printf "\tHeftpreis:\t%7.2f €\n", hefte
|
||||
printf "\tPorto: \t%7.2f €\t%7.2f €\n\n", porto, hefte+porto
|
||||
printf "Ausgaben:\n"
|
||||
printf "\tDruckkosten:\t%7.2f €\n", druck
|
||||
printf "\tVersand: \t%7.2f €\t%7.2f €\n\n", versand, druck+versand
|
||||
printf "Ergebnis:\t\t\t\t%7.2f €\n", (hefte+porto)-(druck+versand)
|
||||
}
|
||||
Reference in New Issue
Block a user