home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 46 / Mobiclic46.iso / pc / DATA / SHARED / COMMUNS.CST / 00013_Script_magsMilan < prev    next >
Text File  |  2002-07-12  |  12KB  |  321 lines

  1. -----------------------------------------------------------------
  2. --                     MARKETING APPLICATION
  3. --                "MAGAZINES MILAN" MODULE SCRIPTS
  4. --                 Gyorgy Gutierrez, Mai 2002
  5. -----------------------------------------------------------------
  6.  
  7. -----------------------------------------------------------------
  8. ----------------------- global variables ------------------------
  9. -----------------------------------------------------------------
  10.  
  11. global gMyParent, gTestMode, gLastMovie, gCodeEuro
  12. global gMagList, gNomMagList, gTexteMagList, gCadeauList
  13. global gPrixLibEList, gTextePrixLibList
  14. global gPrixClasEList, gTextePrixClasList
  15. global gTypeAboChoisi, gListePrix, gPort, gListeCom, gListeTotal
  16. global gSommeTotalE, gChoixCadeau1, gChoixCadeau2, gNewCad
  17. global gFichierMags, gLiens
  18.  
  19. -----------------------------------------------------------------
  20. -- ajout d'un magazine a la commande et acces ecrans commande ---
  21. -----------------------------------------------------------------
  22.  
  23. on ajoutMag  
  24.   s = the currentSpriteNum
  25.   myref = value(member("my ref").line[s-19])
  26.   
  27.   --si premiere commande passage par ecran abonnement
  28.   --sinon acces directe aux module de commande suivant le
  29.   --type de abonnement deja choisi
  30.   if count(gListeCom) = 0 then
  31.     acces "prom02"
  32.   else
  33.     case gTypeAboChoisi of
  34.       1: acces "pan01_1"       
  35.       2: acces "pan02_1"
  36.     end case    
  37.   end if
  38.   
  39.   -- ajout du magazine α la commande  
  40.   -- creer l'objet magazine si le nombre maximum de commandes n'est pas depasse
  41.   -- cas particulier Moi je lis + 2 hors serie ne peut pas etre commande par
  42.   -- paiement par prelevements
  43.   
  44.   if count(gListeCom) < 2 then
  45.     append gListeCom, new(script"magazine parent",myref)
  46.   else
  47.     alert member("alerte trop d'abo").text
  48.   end if  
  49. end
  50.  
  51. -----------------------------------------------------------------
  52. -------------------- gestion de l'affichage ---------------------
  53. -----------------------------------------------------------------
  54.  
  55. on gestAffich
  56.   inc = 0
  57.   --affichage des magazines commandes
  58.   if count(gListeCom) <> 0 then
  59.     member("abo01").text = EMPTY
  60.     member("abo02").text = EMPTY    
  61.     repeat with i = 1 to count(gListeCom)
  62.       put string(the nmag of gListeCom[i]) into member("abo0" & string(i)).line[1]
  63.       put string(the tmag of gListeCom[i]) into member("abo0" & string(i)).line[2]
  64.       case gTypeAboChoisi of
  65.         1:          
  66.           put string(the tpli of gListeCom[i]) into member("abo0" & string(i)).line[3]
  67.         2:
  68.           put string(the tpcl of gListeCom[i]) into member("abo0" & string(i)).line[3]
  69.       end case
  70.       set the font of field("abo0" & string(i)) = "Arial"
  71.       set the fontSize of line 1 of field("abo0" & string(i)) = 12
  72.       set the fontSize of line 2 of field("abo0" & string(i)) = 10
  73.       set the fontSize of line 3 of field("abo0" & string(i)) = 10
  74.       inc = inc + 49
  75.       afficherPistes i+20, i+24, i+27, i+31, i+35, i+38, i+41   
  76.     end repeat
  77.     
  78.     calculTotal
  79.     
  80.     --affichage de la somme totale
  81.     put gSommeTotalE && gCodeEuro into member("SommeTotalE")
  82.     repeat with i = 1 to 5
  83.       sprite(i+50).locV = sprite(i+50).locV + inc
  84.       afficherPistes i+50
  85.     end repeat
  86.     
  87.     -- gestion et affichage du cadeau
  88.     if count(gListeCom) <> 0 then
  89.       case count(gListeCom) of
  90.         1:
  91.           gChoixCadeau1 = the cad of gListeCom[1]
  92.           sprite(60).member = member("cadeau" & string(gChoixCadeau1))
  93.           afficherPistes 57,60
  94.         2:        
  95.           gChoixCadeau1 = the cad of gListeCom[1]
  96.           gChoixCadeau2 = the cad of gListeCom[2]
  97.           sprite(60).member = member("cadeau" & string(gChoixCadeau1))
  98.           sprite(61).member = member("cadeau" & string(gChoixCadeau2))
  99.           afficherPistes "57>62"
  100.       end case
  101.     end if      
  102.   else
  103.     gSommeTotalE = 0
  104.     put gSommeTotalE into member("SommeTotalE")
  105.   end if  
  106.   updatestage
  107. end
  108.  
  109. -----------------------------------------------------------------
  110. ------------------- gestion du cadeau double --------------------
  111. -----------------------------------------------------------------
  112.  
  113. on changeCadeau
  114.   if count(gListeCom)=2 and gChoixCadeau1 = gChoixCadeau2 then
  115.     afficherPistes "7>9"
  116.     gNewCad=[1,2,3]
  117.     pvc = getPos(gNewCad,gChoixCadeau1)
  118.     deleteAt(gNewCad,pvc)
  119.     put member("les cadeau").line[gNewCad[1]] into member("new cad 1")
  120.     put member("les cadeau").line[gNewCad[2]] into member("new cad 2")
  121.     put member("les cadeau").line[gChoixCadeau1] into member("old cad")
  122.   end if  
  123. end
  124.  
  125. -----------------------------------------------------------------
  126. ------------ suprimer un magazine de la commande ----------------
  127. -----------------------------------------------------------------
  128.  
  129. on supprimer
  130.   s = the currentSpriteNum
  131.   if count(gListeCom)=2 then
  132.     ref2abo = the ref of gListeCom[2]
  133.     cadorigine = gCadeauList[ref2abo]
  134.     set the cad of gListeCom[2] to cadorigine
  135.   end if  
  136.   gListeCom.deleteAt(s-41)
  137.   sprite(51).locV = 95  
  138.   sprite(52).locV = 85
  139.   sprite(53).locV = 95
  140.   sprite(54).locV = 85
  141.   sprite(55).locV = 95  
  142.   sprite(59).locV = 130
  143.   sprite(62).locV = 146
  144.   masquerPistes "21>62"
  145.   masquerPistes "7>10"
  146.   if count(gListeCom) = 0 then gTypeAboChoisi = 0
  147.   gestAffich
  148. end
  149.  
  150. -----------------------------------------------------------------
  151. ------------ calculs des montants de la commande ----------------
  152. -----------------------------------------------------------------
  153.  
  154. on calculTotal
  155.   -- calcul du montant total de la commande
  156.   gSommeTotalE = 0
  157.   case gTypeAboChoisi of
  158.     1:
  159.       repeat with i = 1 to count(gListeCom)
  160.         prixe = the plie of gListeCom[i]
  161.         put string(prixe) && gCodeEuro into member("prixe_" & i)
  162.         gSommeTotalE = gSommeTotalE + prixe
  163.       end repeat
  164.     2:
  165.       repeat with i = 1 to count(gListeCom)
  166.         prixe = the pcle of gListeCom[i]
  167.         put string(prixe) && gCodeEuro into member("prixe_" & i)
  168.         gSommeTotalE = gSommeTotalE + prixe
  169.       end repeat      
  170.   end case
  171. end
  172.  
  173. -----------------------------------------------------------------
  174. ------------ gestion de l'affichage pour impression -------------
  175. -----------------------------------------------------------------
  176.  
  177. on igestAffich
  178.   inc = 0
  179.   --affichage des magazines commandes
  180.   if count(gListeCom) <> 0 then   
  181.     member("iabo01").text = EMPTY
  182.     member("iabo02").text = EMPTY    
  183.     repeat with i = 1 to count(gListeCom)
  184.       put string(the nmag of gListeCom[i]) into member("iabo0" & string(i)).line[1]
  185.       put string(the tmag of gListeCom[i]) into member("iabo0" & string(i)).line[2]
  186.       case gTypeAboChoisi of
  187.         1:          
  188.           put string(the tpli of gListeCom[i]) into member("iabo0" & string(i)).line[3]
  189.         2:
  190.           put string(the tpcl of gListeCom[i]) into member("iabo0" & string(i)).line[3]
  191.       end case
  192.       set the font of field("iabo0" & string(i)) = "Arial"
  193.       set the fontSize of line 1 of field("iabo0" & string(i)) = 11
  194.       set the fontSize of line 2 of field("iabo0" & string(i)) = 10
  195.       set the fontSize of line 3 of field("iabo0" & string(i)) = 10
  196.       inc = inc + 49
  197.       afficherPistes i+20, i+24, i+27, i+31, i+35, i+38, i+41   
  198.     end repeat
  199.     
  200.     icalculTotal
  201.     
  202.     --affichage de la somme totale
  203.     put gSommeTotalE && gCodeEuro into member("iSommeTotalE")
  204.     repeat with i = 1 to 5
  205.       sprite(i+50).locV = sprite(i+50).locV + inc
  206.       afficherPistes i+50
  207.     end repeat
  208.     
  209.     -- gestion et affichage du cadeau
  210.     if count(gListeCom) <> 0 then
  211.       case count(gListeCom) of
  212.         1:
  213.           gChoixCadeau1 = the cad of gListeCom[1]
  214.           put member("les cadeau").line[gChoixCadeau1] into member("icadeau 1")
  215.           s = member("icadeau 1").text.word.count
  216.           put member("code cadeau").line[gChoixCadeau1] into member("icadeau 1").word[s+1]
  217.           afficherPistes 56,60
  218.         2:        
  219.           gChoixCadeau1 = the cad of gListeCom[1]
  220.           gChoixCadeau2 = the cad of gListeCom[2]
  221.           put member("les cadeau").line[gChoixCadeau1] into member("icadeau 1")
  222.           s = member("icadeau 1").text.word.count
  223.           put member("code cadeau").line[gChoixCadeau1] into member("icadeau 1").word[s+1]
  224.           put member("les cadeau").line[gChoixCadeau2] into member("icadeau 2")
  225.           s = member("icadeau 1").text.word.count
  226.           put member("code cadeau").line[gChoixCadeau2] into member("icadeau 2").word[s+1]
  227.           s = member("prime2abos").text.word.count
  228.           --put member("code cadeau").line[4] into member("prime2abos").word[s+1]
  229.           repeat with i = 57 to 61
  230.             sprite(i).locV = sprite(i).locV + 65
  231.           end repeat
  232.           afficherPistes "57>61"
  233.       end case
  234.     end if      
  235.   else
  236.     gSommeTotalE = 0
  237.     put gSommeTotalE into member("iSommeTotalE")
  238.   end if  
  239.   updatestage
  240. end
  241.  
  242. -----------------------------------------------------------------
  243. ------ calculs des montants de la commande pour impression ------
  244. -----------------------------------------------------------------
  245. on icalculTotal
  246.   -- calcul du montant total de la commande
  247.   gSommeTotalE = 0
  248.   case gTypeAboChoisi of
  249.     1:
  250.       repeat with i = 1 to count(gListeCom)
  251.         prixe = the plie of gListeCom[i]
  252.         put string(prixe) && gCodeEuro into member("iprixe_" & i)
  253.         gSommeTotalE = gSommeTotalE + prixe
  254.       end repeat
  255.     2:
  256.       repeat with i = 1 to count(gListeCom)
  257.         prixe = the pcle of gListeCom[i]
  258.         put string(prixe) && gCodeEuro into member("iprixe_" & i)
  259.         gSommeTotalE = gSommeTotalE + prixe
  260.       end repeat      
  261.   end case
  262. end
  263.  
  264. -----------------------------------------------------------------
  265. ---- transfert des valeurs des champs gris vers champs noirs ----
  266. -----------------------------------------------------------------
  267. on gestTransfert
  268.   case gTypeAboChoisi of
  269.     1:      
  270.       repeat with i = 101 to 108
  271.         put member(i,"abo_lib").text into member(i,"interne")
  272.       end repeat
  273.       repeat with i = 111 to 118
  274.         put member(i,"abo_lib").text into member(i,"interne")
  275.       end repeat
  276.       repeat with i = 121 to 134
  277.         put member(i,"abo_lib").text into member(i,"interne")
  278.       end repeat
  279.     2:      
  280.       repeat with i = 101 to 112
  281.         put member(i,"abo_cla").text into member(i,"interne")
  282.       end repeat
  283.       repeat with i = 121 to 128
  284.         put member(i,"abo_cla").text into member(i,"interne")
  285.       end repeat
  286.   end case  
  287. end
  288.  
  289. -----------------------------------------------------------------
  290. ----------------- impression bon de commande --------------------
  291. -----------------------------------------------------------------
  292.  
  293. on imprimeBon
  294.   updateStage
  295.   -- gΘnΘrer un aperτu d'Θcran si la touche option est appuyΘe
  296.   if the optionDown=1 then
  297.     set prevue=1
  298.   end if
  299.   -- gΘnΘrer le fichier impression si validation du format d'impression
  300.   set doc = new(xtra "PrintOMatic")
  301.   -- enregistrement de PrintOMatic
  302.   --register(xtra "PrintOMatic", member("codePom").text)
  303.   if not objectP(doc) then exit
  304.   setPrintableMargins doc
  305.   if doPageSetUp (doc) = true then
  306.     newPage doc
  307.     drawStagePicture doc, Point(10,10),true
  308.     if prevue=1 then
  309.       if doJobSetup (doc) = TRUE then
  310.         setProgressMsg doc , "Impression en cours... "
  311.         printPreview doc
  312.       end if      
  313.     else
  314.       if doJobSetup (doc) = TRUE then
  315.         setProgressMsg doc , "Impression en cours... "
  316.         print doc
  317.       end if
  318.     end if
  319.   end if
  320.   set doc = 0
  321. end