/[phpcompta]/phpcompta/contrib/test-size/simul.py
ViewVC logotype

Diff of /phpcompta/contrib/test-size/simul.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by sparkyx, Thu Oct 20 12:02:13 2005 UTC revision 1.3 by sparkyx, Thu Oct 20 13:23:46 2005 UTC
# Line 42  def usage(): Line 42  def usage():
42    
43  def Add_Attribut_Fiche(p_jft,p_f,p_ad_id,p_value):  def Add_Attribut_Fiche(p_jft,p_f,p_ad_id,p_value):
44          # Ajout du nom          # Ajout du nom
45          print "insert into jnt_fic_att_value(jft_id,f_id,ad_id) values (%d,%d,%d);" % (p_jft,p_f,p_ad_id)          #print "insert into jnt_fic_att_value(jft_id,f_id,ad_id) values (%d,%d,%d);" % (p_jft,p_f,p_ad_id)
46          print "insert into attr_value(jft_id,av_text) values (%d,'%s');" % (p_jft,p_value)          jnt="%d\t%d\t%d" %  (p_jft,p_f,p_ad_id)
47            #print "insert into attr_value(jft_id,av_text) values (%d,'%s');" % (p_jft,p_value)
48            attr="%d\t%s" % (p_jft,p_value)
49            return (jnt,attr)
50    
51  def Creation_fiche (p_seq_f_id,p_seq_jft_id,p_fd_id,p_type,p_base_poste,p_nbfiche):  def Creation_fiche (p_seq_f_id,p_seq_jft_id,p_fd_id,p_type,p_base_poste,p_nbfiche):
52            fiche=[]
53            poste_comptable=[]
54            Attribut=[]
55            jnt=[]
56          for i in range (0,p_nbfiche):          for i in range (0,p_nbfiche):
57                  #def Creation fiche :                  #def Creation fiche :
58                  print "insert into fiche(f_id,fd_id)values (%d,%d);" % (p_seq_f_id,p_fd_id)                  #print "insert into fiche(f_id,fd_id)values (%d,%d);" % (p_seq_f_id,p_fd_id)
59                    fiche.append("%d\t%d" % (p_seq_f_id,p_fd_id))
60                  # ajout nom                  # ajout nom
61                  nom="%s numero %08d" % (p_type,i+100)                  nom="%s numero %08d" % (p_type,i+100)
62                  Add_Attribut_Fiche(p_seq_jft_id,p_seq_f_id,1,nom)                  (t1,t2)=Add_Attribut_Fiche(p_seq_jft_id,p_seq_f_id,1,nom)
63                    jnt.append(t1)
64                    Attribut.append(t2)
65                  #poste comptable                  #poste comptable
66                  poste_comptable='%s%04d'% (p_base_poste,i+100)                  str_poste_comptable='%s%04d'% (p_base_poste,i+100)
67                  print "insert into tmp_pcmn (pcm_val,pcm_lib,pcm_val_parent) values (%s,'%s',%s); " % (poste_comptable,nom,p_base_poste)                  # print "insert into tmp_pcmn (pcm_val,pcm_lib,pcm_val_parent) values (%s,'%s',%s); " % (poste_comptable,nom,p_base_poste)
68                    poste_comptable.append("%s\t%s\t%s" %  (str_poste_comptable,nom,p_base_poste))
69                  p_seq_jft_id+=1                  p_seq_jft_id+=1
70                  Add_Attribut_Fiche(p_seq_jft_id,p_seq_f_id,5,poste_comptable)                  (t1,t2)=Add_Attribut_Fiche(p_seq_jft_id,p_seq_f_id,5,str_poste_comptable)
71                    jnt.append(t1)
72                    Attribut.append(t2)
73                  p_seq_f_id+=1                  p_seq_f_id+=1
74                  p_seq_jft_id+=1                  p_seq_jft_id+=1
75            print "copy fiche(f_id,fd_id) from stdin;"
76            for e in fiche: print e
77            print "\."
78            print "copy tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent) from stdin;"
79            for e in poste_comptable: print e
80            print "\."
81            print "copy  jnt_fic_att_value(jft_id,f_id,ad_id) from stdin;"
82            for e in jnt: print e
83            print "\."
84            print "copy   attr_value(jft_id,av_text) from stdin;"
85            for e in Attribut: print e
86            print "\."
87            
88    
89    
90    
91  def Creation_operation(p_base,p_type):  def Creation_operation(p_base,p_type):
92          jrn="insert into jrn (jr_def_id,jr_montant,jr_comment,jr_date,jr_grpt_id,jr_internal,jr_tech_per)"          #jrn="insert into jrn (jr_def_id,jr_montant,jr_comment,jr_date,jr_grpt_id,jr_internal,jr_tech_per)"
93          jrn+=" values  (%d,%8.2f,'%s',to_date('%d-%d-2005','DD-MM-YYYY'),%d,'%s',%d);"          jrn="%d\t%.2f\t%s\t%d.%d.2005\t%d\t%s\t%d"
94          jrnx="insert into jrnx (j_date,j_montant,j_poste,j_grpt,j_jrn_def,j_debit,j_tech_user,j_tech_per)"          #jrnx="insert into jrnx (j_date,j_montant,j_poste,j_grpt,j_jrn_def,j_debit,j_tech_user,j_tech_per)"
95          jrnx+="values (to_date('%d-%d-2005','DD-MM-YYYY'),%8.2f,%s,%d,%d,%s,'SIMULATION',%d);"          jrnx="%d.%d.2005\t%.2f\t%s\t%d\t%d\t%s\tSIMULATION\t%d"
96            array_jrnx=[]
97            array_jrn=[]
98          for loop_periode in range (53,64):          for loop_periode in range (53,64):
99                  for loop_day in range (1,28):                  for loop_day in range (1,28):
100                          for loop_op in range (0,nb_per_day):                          for loop_op in range (0,nb_per_day):
101                                    j_montant=round(random.randrange(100,5000)/100.0,2)
102                                    j_tva=round(j_montant*0.21,2)
103                                    month=loop_periode-52
104                                  if p_type == 'V':                                  if p_type == 'V':
105                                          j_internal='1VEN-01-%d' % (p_base)                                          j_internal='1VEN-01-%d' % (p_base)
                                         j_montant=round(random.randrange(100,5000)/100.0,2)  
106                                          j_client='400%04d' % (random.randrange(1,nb_fiche)+100)                                          j_client='400%04d' % (random.randrange(1,nb_fiche)+100)
107                                          jrnx1=jrnx % (loop_day,loop_periode-39,j_montant,j_client,p_base,2,'true',loop_periode)                                          #jrnx1=jrnx % (loop_day,loop_periode-39,j_montant,j_client,p_base,2,'true',loop_periode)
108                                          print jrnx1                                          array_jrnx.append(jrnx % (loop_day,month,j_montant,j_client,p_base,2,'true',loop_periode))
109                                          j_tva=round(j_montant*0.21,2)                                          #print jrnx1
110                                          jrnx1=jrnx % (loop_day,loop_periode-39,j_tva,'4511',p_base,2,'true',loop_periode)                                          array_jrnx.append(jrnx % (loop_day,month,j_tva,'4511',p_base,2,'true',loop_periode))
111                                          print jrnx1                                          #print jrnx1
                                         jrnx1=jrnx % (loop_day,loop_periode-39,j_montant+j_tva,'700',p_base,2,'false',loop_periode)  
                                         print jrnx1  
112                                          total=j_montant+j_tva                                          total=j_montant+j_tva
113                                          jrn1=jrn%(2,total,j_internal,loop_day,loop_periode-39,p_base,j_internal,loop_periode)                                          array_jrnx.append( jrnx % (loop_day,month,total,'700',p_base,2,'false',loop_periode))
114                                          print jrn1                                          #print jrnx1
115                                            array_jrn.append(jrn%(2,total,j_internal,loop_day,month,p_base,j_internal,loop_periode))
116                                            #print jrn1
117                                          p_base+=1                                          p_base+=1
118                                  if p_type== 'A':                                  if p_type== 'A':
119                                          j_internal='1ACH-01-%d' % (p_base)                                          j_internal='1ACH-01-%d' % (p_base)
                                         j_montant=round(random.randrange(100,5000)/100.0,2)  
120                                          j_fournisseur='440%04d' % (random.randrange(0,nb_fiche)+100)                                          j_fournisseur='440%04d' % (random.randrange(0,nb_fiche)+100)
121                                          j_charge='61%04d' % (random.randrange(0,nb_charge)+100)                                          j_charge='61%04d' % (random.randrange(0,nb_charge)+100)
122                                          jrnx1=jrnx % (loop_day,loop_periode-39,j_montant,j_fournisseur,p_base,3,'false',loop_periode)                                          array_jrnx.append(jrnx%(loop_day,month,j_montant,j_fournisseur,p_base,3,'false',loop_periode))
123                                          print jrnx1                                          #print jrnx1
124                                          j_tva=round(j_montant*0.21,2)                                          array_jrnx.append(jrnx % (loop_day,month,j_tva,'4111',p_base,3,'false',loop_periode))
125                                          jrnx1=jrnx % (loop_day,loop_periode-39,j_tva,'4111',p_base,3,'false',loop_periode)                                          #print jrnx1
126                                          print jrnx1                                          total=j_montant+j_tva
127                                          jrnx1=jrnx % (loop_day,loop_periode-39,j_montant+j_tva,j_charge,p_base,3,'true',loop_periode)                                          array_jrnx.append(jrnx % (loop_day,month,total,j_charge,p_base,3,'true',loop_periode))
128                                          print jrnx1                                          #print jrnx1
129                                          jrn1=jrn%(3,j_montant+j_tva,j_internal,loop_day,loop_periode-39,p_base,j_internal,loop_periode)                                          array_jrn.append(jrn%(3,total,j_internal,loop_day,month,p_base,j_internal,loop_periode))
130                                          print jrn1                                          ##print jrn1
131                                          p_base+=1                                          p_base+=1
132                    print "copy  jrn (jr_def_id,jr_montant,jr_comment,jr_date,jr_grpt_id,jr_internal,jr_tech_per) from stdin;"
133            for e in array_jrn: print e
134            print "\."
135            print "copy  jrnx (j_date,j_montant,j_poste,j_grpt,j_jrn_def,j_debit,j_tech_user,j_tech_per) from stdin;"
136            for e in array_jrnx: print e
137            print "\."
138    
139  ################################################################################  ################################################################################
140  #  MAIN  #  MAIN
# Line 131  for option,value in a1: Line 168  for option,value in a1:
168                  nb_per_day=500                  nb_per_day=500
169    
170  print "begin;"  print "begin;"
171    print "set DateStyle=European;"
172  # fd_id => client  # fd_id => client
173  fd_id=2  fd_id=2
174  # type fiche  # type fiche

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26