[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 98/151: Correct simul.py remove old file
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 98/151: Correct simul.py remove old file |
Date: |
Sat, 4 Feb 2017 17:14:31 +0000 (UTC) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit bfb4aa3fe62193b2dff26db77943bc7d6f27331e
Author: Dany De Bontridder <address@hidden>
Date: Sun Dec 18 00:56:50 2016 +0100
Correct simul.py
remove old file
---
dev/plugin_client.txt | 4 --
dev/test-size/simul.py | 121 +++++++++++++++++++++++++++---------------------
2 files changed, 68 insertions(+), 57 deletions(-)
diff --git a/dev/plugin_client.txt b/dev/plugin_client.txt
deleted file mode 100644
index 13e99c5..0000000
--- a/dev/plugin_client.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-"Nom client1","Prénom","C1","Rue de la boite,55"
-"Nom client2","Prénom","C2","Rue du couvercle,55"
-"Nom client3","Prénom","C3","Rue de la chaussure,55"
-"Nom client4","Prénom","C4","Rue de la couleur,55"
diff --git a/dev/test-size/simul.py b/dev/test-size/simul.py
index 5fd48da..920a443 100755
--- a/dev/test-size/simul.py
+++ b/dev/test-size/simul.py
@@ -37,132 +37,131 @@ def usage():
-s generate a sql file for a small database test
-l generate a sql file for a large database test
-x generate a extra large sql for a huge database test
+ -y year
+ -p first periode of the year (parm_periode.p_id)
"""
sys.exit(-1)
def Add_Attribut_Fiche(p_jft,p_f,p_ad_id,p_value):
# Ajout du nom
- #print "insert into jnt_fic_att_value(jft_id,f_id,ad_id) values
(%d,%d,%d);" % (p_jft,p_f,p_ad_id)
- jnt="%d\t%d\t%d" % (p_jft,p_f,p_ad_id)
- #print "insert into attr_value(jft_id,av_text) values (%d,'%s');" %
(p_jft,p_value)
- attr="%d\t%s" % (p_jft,p_value)
- return (jnt,attr)
+ #insert into fiche_detail(jtf_id,f_id,ad_id,ad_value)
+ att="%d\t%d\t%d\t%s" % (p_jft,p_f,p_ad_id,p_value)
+ return att
def Creation_fiche
(p_seq_f_id,p_seq_jft_id,p_fd_id,p_type,p_base_poste,p_nbfiche):
fiche=[]
poste_comptable=[]
Attribut=[]
- jnt=[]
for i in range (0,p_nbfiche):
#def Creation fiche :
#print "insert into fiche(f_id,fd_id)values (%d,%d);" %
(p_seq_f_id,p_fd_id)
fiche.append("%d\t%d" % (p_seq_f_id,p_fd_id))
# ajout nom
nom="%s numero %08d" % (p_type,i+100)
- (t1,t2)=Add_Attribut_Fiche(p_seq_jft_id,p_seq_f_id,1,nom)
- jnt.append(t1)
+ t2=Add_Attribut_Fiche(p_seq_jft_id,p_seq_f_id,1,nom)
Attribut.append(t2)
#poste comptable
str_poste_comptable='%s%04d'% (p_base_poste,i+100)
# print "insert into tmp_pcmn (pcm_val,pcm_lib,pcm_val_parent)
values (%s,'%s',%s); " % (poste_comptable,nom,p_base_poste)
poste_comptable.append("%s\t%s\t%s" %
(str_poste_comptable,nom,p_base_poste))
p_seq_jft_id+=1
-
(t1,t2)=Add_Attribut_Fiche(p_seq_jft_id,p_seq_f_id,5,str_poste_comptable)
- jnt.append(t1)
+
t2=Add_Attribut_Fiche(p_seq_jft_id,p_seq_f_id,5,str_poste_comptable)
Attribut.append(t2)
p_seq_jft_id+=1
str_quick_code="FID%06d" % (p_seq_f_id)
-
(t1,t2)=Add_Attribut_Fiche(p_seq_jft_id,p_seq_f_id,23,str_quick_code)
- jnt.append(t1)
+ t2=Add_Attribut_Fiche(p_seq_jft_id,p_seq_f_id,23,str_quick_code)
Attribut.append(t2)
p_seq_f_id+=1
p_seq_jft_id+=1
+ print "\\echo insert into fiche"
print "copy fiche(f_id,fd_id) from stdin;"
for e in fiche: print e
print "\."
+ print "\\echo insert into tmp_pcmn"
print "copy tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent) from stdin;"
for e in poste_comptable: print e
print "\."
- print "copy jnt_fic_att_value(jft_id,f_id,ad_id) from stdin;"
- for e in jnt: print e
- print "\."
- print "copy attr_value(jft_id,av_text) from stdin;"
+ print "\\echo insert into fiche_detail"
+ print "copy fiche_detail(jft_id,f_id,ad_id,ad_value) from stdin;"
for e in Attribut: print e
print "\."
-def Creation_operation(p_base,p_type):
+def Creation_operation(p_base,p_type,p_year):
#jrn="insert into jrn
(jr_def_id,jr_montant,jr_comment,jr_date,jr_grpt_id,jr_internal,jr_tech_per)"
- jrn="%d\t%.2f\t%s\t%d.%d.2005\t%d\t%s\t%d"
+ jrn="%d\t%.2f\t%s\t%02d.%02d.%d\t%d\t%s\t%d"
#jrnx="insert into jrnx
(j_date,j_montant,j_poste,j_grpt,j_jrn_def,j_debit,j_tech_user,j_tech_per)"
- jrnx="%d.%d.2005\t%.2f\t%s\t%d\t%d\t%s\tSIMULATION\t%d"
+ jrnx="%02d.%02d.%d\t%.2f\t%s\t%d\t%d\t%s\tSIMULATION\t%d"
array_jrnx=[]
array_jrn=[]
- for loop_periode in range (53,64):
+ start_periode=periode
+ end_periode=periode+11
+ for loop_periode in range (start_periode,end_periode):
for loop_day in range (1,28):
for loop_op in range (0,nb_per_day):
j_montant=round(random.randrange(100,5000)/100.0,2)
j_tva=round(j_montant*0.21,2)
- month=loop_periode-52
+ month=loop_periode-start_periode+1
if p_type == 'V':
j_internal='1VEN-01-%d' % (p_base)
j_client='400%04d' %
(random.randrange(1,nb_fiche)+100)
#jrnx1=jrnx %
(loop_day,loop_periode-39,j_montant,j_client,p_base,2,'true',loop_periode)
- array_jrnx.append(jrnx %
(loop_day,month,j_montant,j_client,p_base,2,'true',loop_periode))
+ array_jrnx.append(jrnx %
(loop_day,month,p_year,j_montant,j_client,p_base,2,'true',loop_periode))
#print jrnx1
- array_jrnx.append(jrnx %
(loop_day,month,j_tva,'4511',p_base,2,'false',loop_periode))
+ array_jrnx.append(jrnx %
(loop_day,month,p_year,j_tva,'4511',p_base,2,'true',loop_periode))
#print jrnx1
total=j_montant+j_tva
- array_jrnx.append( jrnx %
(loop_day,month,total,'700',p_base,2,'false',loop_periode))
+ array_jrnx.append( jrnx %
(loop_day,month,p_year,total,'700',p_base,2,'false',loop_periode))
#print jrnx1
-
array_jrn.append(jrn%(2,total,j_internal,loop_day,month,p_base,j_internal,loop_periode))
+
array_jrn.append(jrn%(2,total,j_internal,loop_day,month,p_year,p_base,j_internal,loop_periode))
#print jrn1
p_base+=1
if p_type== 'A':
j_internal='1ACH-01-%d' % (p_base)
j_fournisseur='440%04d' %
(random.randrange(0,nb_fiche)+100)
j_charge='61%04d' %
(random.randrange(0,nb_charge)+100)
-
array_jrnx.append(jrnx%(loop_day,month,j_montant,j_fournisseur,p_base,3,'false',loop_periode))
+
array_jrnx.append(jrnx%(loop_day,month,p_year,j_montant,j_fournisseur,p_base,3,'false',loop_periode))
#print jrnx1
- array_jrnx.append(jrnx %
(loop_day,month,j_tva,'4111',p_base,3,'true',loop_periode))
+ array_jrnx.append(jrnx %
(loop_day,month,p_year,j_tva,'4111',p_base,3,'false',loop_periode))
#print jrnx1
total=j_montant+j_tva
- array_jrnx.append(jrnx %
(loop_day,month,total,j_charge,p_base,3,'true',loop_periode))
+ array_jrnx.append(jrnx %
(loop_day,month,p_year,total,j_charge,p_base,3,'true',loop_periode))
#print jrnx1
-
array_jrn.append(jrn%(3,total,j_internal,loop_day,month,p_base,j_internal,loop_periode))
+
array_jrn.append(jrn%(3,total,j_internal,loop_day,month,p_year,p_base,j_internal,loop_periode))
##print jrn1
p_base+=1
if p_type== 'O':
j_internal='4ODS-01-%d' % (p_base)
j_banque='400'
j_charge='440'
-
array_jrnx.append(jrnx%(loop_day,month,j_montant,j_banque,p_base,4,'false',loop_periode))
- array_jrnx.append(jrnx %
(loop_day,month,j_montant,j_charge,p_base,4,'true',loop_periode))
+
array_jrnx.append(jrnx%(loop_day,month,p_year,j_montant,j_banque,p_base,4,'false',loop_periode))
+ array_jrnx.append(jrnx %
(loop_day,month,p_year,j_montant,j_charge,p_base,4,'true',loop_periode))
#print jrnx1
-
array_jrn.append(jrn%(4,j_montant,j_internal,loop_day,month,p_base,j_internal,loop_periode))
+
array_jrn.append(jrn%(4,j_montant,j_internal,loop_day,month,p_year,p_base,j_internal,loop_periode))
##print jrn1
p_base+=1
if p_type== 'F':
j_internal='1FIN-01-%d' % (p_base)
j_banque='550'
j_charge='400'
-
array_jrnx.append(jrnx%(loop_day,month,j_montant,j_banque,p_base,1,'false',loop_periode))
- array_jrnx.append(jrnx %
(loop_day,month,j_montant,j_charge,p_base,1,'true',loop_periode))
+
array_jrnx.append(jrnx%(loop_day,month,p_year,j_montant,j_banque,p_base,1,'false',loop_periode))
+ array_jrnx.append(jrnx %
(loop_day,month,p_year,j_montant,j_charge,p_base,1,'true',loop_periode))
#print jrnx1
-
array_jrn.append(jrn%(1,j_montant,j_internal,loop_day,month,p_base,j_internal,loop_periode))
+
array_jrn.append(jrn%(1,j_montant,j_internal,loop_day,month,p_year,p_base,j_internal,loop_periode))
##print jrn1
p_base+=1
- print """copy
-jrn
(jr_def_id,jr_montant,jr_comment,jr_date,jr_grpt_id,jr_internal,jr_tech_per)
-from stdin;"""
- for e in array_jrn: print e
- print "\."
+
+ print "\\echo insert into jrnx"
print "copy jrnx
(j_date,j_montant,j_poste,j_grpt,j_jrn_def,j_debit,j_tech_user,j_tech_per) from
stdin;"
for e in array_jrnx: print e
print "\."
+ print "\\echo insert into jrn"
+ print """copy jrn
(jr_def_id,jr_montant,jr_comment,jr_date,jr_grpt_id,jr_internal,jr_tech_per)
from stdin;"""
+ for e in array_jrn: print e
+ print "\."
################################################################################
# MAIN
@@ -170,10 +169,11 @@ from stdin;"""
if len(sys.argv) == 1 :
usage()
+is_year=0
+is_periode=0
cmd_line=sys.argv[1:]
-
try :
-
a1,a2=getopt.getopt(cmd_line,"slxh",['small','large','extra-large','help'])
+
a1,a2=getopt.getopt(cmd_line,"slxhy:p:",['small','large','extra-large','help','year','periode'])
except getopt.GetoptError,msg:
print "ERROR "
print msg.msg
@@ -182,10 +182,9 @@ for option,value in a1:
if option in ('-h','--help'):
usage()
if option in ('-s','--small'):
- nb_fiche=100
- nb_charge=50
- nb_per_day=5
- break
+ nb_fiche=12000
+ nb_charge=1800
+ nb_per_day=2000
if option in ('-l','--large'):
nb_fiche=5000
nb_charge=350
@@ -194,9 +193,23 @@ for option,value in a1:
nb_fiche=10000
nb_charge=1500
nb_per_day=500
+ if option in ('-y','--year'):
+ year=int(value)
+ is_year=1
+ if option in ('-p','--periode'):
+ periode=int(value)
+ is_periode=1
+if is_year == 0 :
+ print "Erreur l'annee est obligatoire"
+ sys.exit(-1)
+if is_periode == 0 :
+ print "Erreur periode (p_id.parm_periode) obligatoire"
+ sys.exit(-1)
print '\\timing'
-print "begin;"
+print 'set search_path to public,comptaproc;'
+# print "\\set ON_ERROR_STOP on"
+# print "begin;"
print "set DateStyle=European;"
# fd_id => client
fd_id=2
@@ -216,7 +229,7 @@ Creation_fiche(f_id,jft_id,fd_id,type,'400',nb_fiche)
fd_id=4
type='Fournisseur'
f_id+=nb_fiche+100
-jft_id+=2*nb_fiche+100
+jft_id+=20*nb_fiche
base_poste='440'
Creation_fiche(f_id,jft_id,fd_id,type,base_poste,nb_fiche)
@@ -225,19 +238,21 @@ Creation_fiche(f_id,jft_id,fd_id,type,base_poste,nb_fiche)
fd_id=5
type='Charge '
f_id+=nb_fiche+100
-jft_id+=2*nb_fiche+100
+jft_id+=20*nb_fiche
base_poste='61'
Creation_fiche(f_id,jft_id,fd_id,type,base_poste,nb_charge)
#Creation_operation Vente
-Creation_operation(1000,'V')
+Creation_operation(1000,'V',year)
#Creation_operation Achat
-Creation_operation(17000,'A')
+Creation_operation(17000,'A',year)
+
#Creation_operation FIN
-Creation_operation(34000,'F')
+Creation_operation(34000,'F',year)
+
#Creation_operation ODS
-Creation_operation(51000,'O')
+Creation_operation(51000,'O',year)
print "commit;"
- [Noalyss-commit] [noalyss] 141/151: ManageTable colorize the row in alternate, (continued)
- [Noalyss-commit] [noalyss] 141/151: ManageTable colorize the row in alternate, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 150/151: Improve Doxygen setting, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 133/151: Correct Manage Table , finish implementing, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 03/151: CSS : Update style mobile, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 57/151: CSS : Update style mobile, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 117/151: Indent properly, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 89/151: remove debug info, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 114/151: Move class_table_sql to lib , since it is usable without Noalyss, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 127/151: Add the noalyss version in the info page, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 121/151: Fix several issue in JS, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 98/151: Correct simul.py remove old file,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 146/151: Merge branch 'master' of ns3:/srv/git/noalyss, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 142/151: Doc : complete documentation, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 119/151: correct syntax, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 151/151: Improve description, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 145/151: change name alternate_row_color, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 137/151: Remove console.log from JS Safer function for XML (problem with escaping), Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 122/151: Test ManageTable ; fix several bugs and add the ajax answer , it not yet finished, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 62/151: Experiment less, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 149/151: Correct doxygen, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 49/151: Remove unused documentation, Dany De Bontridder, 2017/02/04