import ypologismoi as ypol
s_ika=0
s_for=0
s_plir=0
mistos=open('d:/arxeia/salary.txt','r')
apotel=open("d:/arxeia/analysi.txt",'w')
for rec in mistos:
    rec=rec.strip()
    pedio=rec.split(",")
    am=int(pedio[0])
    epon=pedio[1]
    bm=float(pedio[2])
    wres=float(pedio[3])
    yperwr=ypol.yper(wres,bm)
    mikta,ikaer,ikaep,foreis=ypol.ypol_kr(bm,yperwr)
    ikaer=round(ikaer,2)
    ikaep = round(ikaep, 2)
    ika=round(ikaer+ikaep,2)
    foros=ypol.yp_forou(foreis)
    plir=round(mikta-ikaer-foros,2)
    s_ika += ika
    s_for += foros
    s_plir += plir
    gr="{},{},{},{},{},{},{},{},{}, {}\n".format(am,epon,bm,yperwr,mikta,ikaer,ikaep,ika,foros,plir)
    apotel.write(gr)
mistos.close()
print("Σύνολο ΙΚΑ       :",s_ika)
print("Σύνολο Φόρου     :",s_for)
print("Σύνολο Πληρωτέου :",s_plir)