Compare commits
176 Commits
a5d889c067
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 08ce6f9151 | |||
| e50ea5c22c | |||
| a037ac5ea7 | |||
| 9e06f7257b | |||
| c2b75076d0 | |||
| 703d2ecda3 | |||
| fc0e813b2b | |||
| e1623d8007 | |||
| 2930fd4e50 | |||
| f26b3d6816 | |||
| 659c93f3a5 | |||
| 422799ece0 | |||
| 5f398fd1f2 | |||
| aadbb77cbc | |||
| 090aa78a59 | |||
| b5ab432fa9 | |||
| c04c7e848b | |||
| 9f3928e584 | |||
| 61178ceb9f | |||
| c510e166d0 | |||
| 4cf67865b8 | |||
| 539d1bdce2 | |||
| 505b89f696 | |||
| 4e97d0cb02 | |||
| b89280d856 | |||
| 792b301314 | |||
| 3c6cc9041e | |||
| 0214e41ee2 | |||
| bb3729f4ed | |||
| b14265418f | |||
| 1119986fc7 | |||
| 4fc444d380 | |||
| 096c44ba79 | |||
| 61de6db5b5 | |||
| ebf6dc59b0 | |||
| 720894eb2c | |||
| 3cf4ddd12d | |||
| 27ea802619 | |||
| 8fc8199a6d | |||
| 0b61a1df8f | |||
| 8c92460cc2 | |||
| 4b2f046a0d | |||
| e97f518d68 | |||
| 0f9f011d99 | |||
| b635fe1626 | |||
| 2c54583a0b | |||
| e38aa7595a | |||
| f7bf4f29eb | |||
| 85321437ed | |||
| 4992c73359 | |||
| 86c9683f0d | |||
| 1cb7e7dd66 | |||
| 05db391f1b | |||
| f2ca1ffe77 | |||
| 155f882f34 | |||
| 44cda34d49 | |||
| 222dd979a5 | |||
| f609c09ca9 | |||
| bc11cd004b | |||
| 2939bd41ac | |||
| 3d3c43f684 | |||
| 0f246e9acc | |||
| 37393c602d | |||
| c1f25eb61d | |||
| 37465a9ece | |||
| 1d769e2f2e | |||
| 137b5ccc71 | |||
| 9f453b95c3 | |||
| 322f32d499 | |||
| 09bc28bec9 | |||
| e14309725f | |||
| 6db1a8de28 | |||
| 81818eb39b | |||
| 977be7dd80 | |||
| 4d6a1e3cf4 | |||
| b638d333b5 | |||
| 498d04b1d1 | |||
| bd27b02a11 | |||
| 18c08d5c84 | |||
| 9f60606f5c | |||
| 6c15f7efe6 | |||
| 5b9c48ad20 | |||
| ebb844fc13 | |||
| 61dc6c5e34 | |||
|
|
9c7a5542b7 | ||
|
|
8f13ae67ae | ||
| 5f9c8c7472 | |||
| 9cf31189a9 | |||
| f62eb7e820 | |||
| e017818113 | |||
| 46e965b0e0 | |||
| 63cc4c69f0 | |||
| c64e887401 | |||
| c6ff9c4399 | |||
| 9e1b75cf2f | |||
| 744ff47ccd | |||
| 2840fd5926 | |||
| e124a1bac8 | |||
| 93d47d26bb | |||
| 49b85a51c6 | |||
| 21560f9e7b | |||
| a894044132 | |||
| b511d0d892 | |||
| 3793aa9236 | |||
| 5199aef358 | |||
| f7b4bccb06 | |||
| 29d73a34f4 | |||
| 0a22741da3 | |||
| a6cd9fe26d | |||
| d1ec029be9 | |||
| 6cfd3f748c | |||
| 36365d4ecd | |||
| 80f7d8862b | |||
| 07364954d2 | |||
| 8c717b2865 | |||
| 5f57282953 | |||
| c4053eac27 | |||
| 7fcdee854d | |||
| e784c85e36 | |||
| d3e192591e | |||
| f95cf4edd2 | |||
| 8e94eda6bf | |||
| 8550400255 | |||
| 726a35c1a6 | |||
| 15665f7c4c | |||
| e2c12667fb | |||
| 91bc5c73bb | |||
| 29d2276b52 | |||
| 31fbbaba2a | |||
| 28cc27b8c3 | |||
| b0c48d104f | |||
| c7bc0d0443 | |||
| 42b33b30f5 | |||
| 1ffc550abe | |||
| 4bd109c875 | |||
| ddce687c54 | |||
| f275d30e1e | |||
| eac0df0a8a | |||
| 97b835a1d0 | |||
| b91d467653 | |||
| 3235af2544 | |||
| 7ecaa3dbf5 | |||
| 511ec2b742 | |||
| fd0390c27e | |||
| 7e57ec0fec | |||
| e7d48e52fa | |||
| 8adc2700cc | |||
| cbeaf47728 | |||
| 58a95cf008 | |||
| 4a18b4fae0 | |||
| 6955c39c1a | |||
| c10ed52f90 | |||
| 3d3d43eed8 | |||
| ac962fd421 | |||
| 14b8a3d824 | |||
| 7f78885abc | |||
| 36d37af154 | |||
| 5ed6600979 | |||
| 0d3dd87904 | |||
| a6800bedbd | |||
| 40cc39cdee | |||
| dea68e1c47 | |||
| 2e187cfc49 | |||
| 7b211205f6 | |||
| c221fbdc9d | |||
| 2f9de9c6e4 | |||
| deed24193c | |||
| ef9f0dc134 | |||
| b921838aa5 | |||
| e2f8e096c7 | |||
| 60c5bfb60c | |||
| ba2a27ef29 | |||
| f1c8109a42 | |||
| d49445352a | |||
| 28ca2415bb | |||
| daea42590c |
4
.env
4
.env
@@ -1,4 +0,0 @@
|
|||||||
DB_HOST=54.36.188.119
|
|
||||||
DB_USER=michel
|
|
||||||
DB_PASSWORD=#SO2&1nf%mZ@jfh
|
|
||||||
DB_NAME=Commun
|
|
||||||
55
.gitignore
vendored
Normal file
55
.gitignore
vendored
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# ----- Secrets / configs locales -----
|
||||||
|
# Ne versionne JAMAIS de .env (mets un .env.example à la place)
|
||||||
|
*.env
|
||||||
|
|
||||||
|
# ----- Python -----
|
||||||
|
.venv/
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
*.pyo
|
||||||
|
*.pyd
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# ----- PyInstaller (builds) -----
|
||||||
|
build/
|
||||||
|
dist/
|
||||||
|
*.spec
|
||||||
|
*.toc
|
||||||
|
*.pkg
|
||||||
|
*.pyz
|
||||||
|
*.zip
|
||||||
|
|
||||||
|
# ----- Excel -----
|
||||||
|
# Fichiers temporaires d'Excel (~$fichier.xlsm)
|
||||||
|
~$*.xls*
|
||||||
|
~$*.xlsm
|
||||||
|
|
||||||
|
|
||||||
|
# Dossiers générés par Excel — à ne jamais versionner
|
||||||
|
Excel/dev/Desktop/
|
||||||
|
Excel/prod/Desktop/
|
||||||
|
Excel/dev/InventairesCache/
|
||||||
|
Excel/prod/InventairesCache/
|
||||||
|
# Archives prod : on les ignore (elles sont recréées par le .bat)
|
||||||
|
Excel/prod/Ratio_Cuisine_20*.xlsm
|
||||||
|
Excel/prod/Ratio_Restauration_20*.xlsm
|
||||||
|
|
||||||
|
# On versionne uniquement les fichiers prod "pivots"
|
||||||
|
!Excel/prod/Ratio_Cuisine.xlsm
|
||||||
|
!Excel/prod/Ratio_Cuisine_VERSION.txt
|
||||||
|
!Excel/prod/Ratio_Restauration.xlsm
|
||||||
|
!Excel/prod/Ratio_Restauration_VERSION.txt
|
||||||
|
Excel/backup/
|
||||||
|
Softs/
|
||||||
|
Excel/Tableurs modèles/*NEW*.xlsx
|
||||||
|
# On ignore tout le dev (fichiers de travail)
|
||||||
|
Excel/dev/
|
||||||
|
# (Optionnel si tu veux garder le dossier vide dans Git)
|
||||||
|
# !Excel/dev/.gitkeep
|
||||||
|
|
||||||
|
|
||||||
|
# ----- Systèmes / IDE -----
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
@@ -2,9 +2,10 @@
|
|||||||
<module type="PYTHON_MODULE" version="4">
|
<module type="PYTHON_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/.idea/dataSources" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Python 3.13 (Ratio & inventaires)" jdkType="Python SDK" />
|
<orderEntry type="jdk" jdkName="Python 3.11 virtualenv at C:\Users\miche\PycharmProjects\Gestion_sondes\.venv" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
12
.idea/dataSources.xml
generated
Normal file
12
.idea/dataSources.xml
generated
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
|
<data-source source="LOCAL" name="domo91" uuid="d8bef1d2-2e67-4363-960b-e8d2ef8041bd">
|
||||||
|
<driver-ref>mariadb</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:mariadb://162.19.78.131:3306/Acces</jdbc-url>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
14
.idea/deployment.xml
generated
Normal file
14
.idea/deployment.xml
generated
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false">
|
||||||
|
<serverData>
|
||||||
|
<paths name="Vps_Gestion_sondes">
|
||||||
|
<serverdata>
|
||||||
|
<mappings>
|
||||||
|
<mapping local="$PROJECT_DIR$" web="/" />
|
||||||
|
</mappings>
|
||||||
|
</serverdata>
|
||||||
|
</paths>
|
||||||
|
</serverData>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
5
.idea/dictionaries/project.xml
generated
5
.idea/dictionaries/project.xml
generated
@@ -3,6 +3,11 @@
|
|||||||
<words>
|
<words>
|
||||||
<w>acces</w>
|
<w>acces</w>
|
||||||
<w>curdate</w>
|
<w>curdate</w>
|
||||||
|
<w>delims</w>
|
||||||
|
<w>endlocal</w>
|
||||||
|
<w>popd</w>
|
||||||
|
<w>pushd</w>
|
||||||
|
<w>setlocal</w>
|
||||||
</words>
|
</words>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
</component>
|
</component>
|
||||||
1
.idea/misc.xml
generated
1
.idea/misc.xml
generated
@@ -3,4 +3,5 @@
|
|||||||
<component name="Black">
|
<component name="Black">
|
||||||
<option name="sdkName" value="Python 3.13 (Ratio & inventaires)" />
|
<option name="sdkName" value="Python 3.13 (Ratio & inventaires)" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 virtualenv at C:\Users\miche\PycharmProjects\Gestion_sondes\.venv" project-jdk-type="Python SDK" />
|
||||||
</project>
|
</project>
|
||||||
2
.idea/modules.xml
generated
2
.idea/modules.xml
generated
@@ -2,7 +2,7 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/Ratio & inventaires.iml" filepath="$PROJECT_DIR$/.idea/Ratio & inventaires.iml" />
|
<module fileurl="file://$PROJECT_DIR$/.idea/Ratio_Inventaires.iml" filepath="$PROJECT_DIR$/.idea/Ratio_Inventaires.iml" />
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
BIN
Docs/Diaporama_Tableur_Ratio.pptx
Normal file
BIN
Docs/Diaporama_Tableur_Ratio.pptx
Normal file
Binary file not shown.
0
Docs/Logo.bmp
Normal file
0
Docs/Logo.bmp
Normal file
BIN
Docs/Logo.jpg
Normal file
BIN
Docs/Logo.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
BIN
Docs/Ratio origine Ermitage.xlsm
Normal file
BIN
Docs/Ratio origine Ermitage.xlsm
Normal file
Binary file not shown.
80
Docs/Ratio_Gestion_Procedure.pdf
Normal file
80
Docs/Ratio_Gestion_Procedure.pdf
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
%PDF-1.3
|
||||||
|
%<25><><EFBFBD><EFBFBD> ReportLab Generated PDF document http://www.reportlab.com
|
||||||
|
1 0 obj
|
||||||
|
<<
|
||||||
|
/F1 2 0 R /F2 3 0 R /F3 4 0 R
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
2 0 obj
|
||||||
|
<<
|
||||||
|
/BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
3 0 obj
|
||||||
|
<<
|
||||||
|
/BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
4 0 obj
|
||||||
|
<<
|
||||||
|
/BaseFont /ZapfDingbats /Name /F3 /Subtype /Type1 /Type /Font
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
5 0 obj
|
||||||
|
<<
|
||||||
|
/Contents 9 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 8 0 R /Resources <<
|
||||||
|
/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
|
||||||
|
>> /Rotate 0 /Trans <<
|
||||||
|
|
||||||
|
>>
|
||||||
|
/Type /Page
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
6 0 obj
|
||||||
|
<<
|
||||||
|
/PageMode /UseNone /Pages 8 0 R /Type /Catalog
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
7 0 obj
|
||||||
|
<<
|
||||||
|
/Author (anonymous) /CreationDate (D:20250516194039+00'00') /Creator (ReportLab PDF Library - www.reportlab.com) /Keywords () /ModDate (D:20250516194039+00'00') /Producer (ReportLab PDF Library - www.reportlab.com)
|
||||||
|
/Subject (unspecified) /Title (untitled) /Trapped /False
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
8 0 obj
|
||||||
|
<<
|
||||||
|
/Count 1 /Kids [ 5 0 R ] /Type /Pages
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
9 0 obj
|
||||||
|
<<
|
||||||
|
/Filter [ /ASCII85Decode /FlateDecode ] /Length 1194
|
||||||
|
>>
|
||||||
|
stream
|
||||||
|
GauHJD/U=Q&H:NnnL,K^ZjMI4[$O8VKtsSINWQ[CeO<Z@EkG0,AD_.jDSs6(Z$?W`.>iH%JQT_JR<`E,RB[cSl0[+N:P"E(-^P=5*eG=jrD"HN"E*_OY4lVKY.sFq4fpdr'E'P4s58"Ec9@=D7;K&H*hC#di^sN:=Q!6D;W\k(=lkp3p4kmP[.Rain/0:;)oc#4ZB@f-H\:5t_:oD%K%@=@HHu\<rrg-BfNWg_Ku5&*>`;"n^"K#qYVp5[/aN&pQHPK"puM!fm;6Peb;(U&K!?$*IH2S4T_JUH?mU'&UKH$\d*44r[7hcqlT?M_BLK$gg:3CF:'tQI?Rf)4RJ[R5.T@Jh9T&>g@2k8s\@9?+-+cnTU)%So%FoCA,C7h3haHC7[GTU;oa&J\:Fa9tF<t^ZO0V/*)*574Pdaeu7&OIfh/51N?V\If0QIbMK.hlI"MQr+]s7#a2E;c\bF4M/L%?%5%DS@N>\g`nUd=3$W)IJtaOk=P2BCL4mD,'UrIsjf''5mJ@:#>bC8!Hs[Z%Ms"lO[2^r[=O/;P\uhbhmVEO6;r")I-Jog]sRr=2#kkd97-!j"^4"\kLUHCZGS>:#=(C1\+(.]k!pWBlDIgujoaQt:RsPk-:12$FU].2>QFd<re!QqH`Gj!Ch2MQ^`g;#QU=ld-b&otcM[`pOQ?e`VkDAGgZ8&nSSY>bM\.N$si^1I@"W^4r7MTU8iOb%ui,ksHZ$#9<[ISGS_&Oh&.S)FZ;/f<a`2YGT35hJ>7H#JkXCD=.RM9Uo%pLf6MF_A6-)14H.lCjF6$NQXF1'L[P;p41\FKA(B-n83CFM_%ZpgBC&=ek[;U%R^95OEb1QAYm3PWV<o53H"-$'C4+\-FqR^Wi4P8M1h*&Z>7DbRQ^QYGOi^h3d#j3[3uR($\'N;;h9O7jAi=X6)N8/7,*O[MkMR4@]BYdD:HTsR9W@JfAa%XE3'b=g()_ES5TN/M8H(AN3H=?f6!0S9A(_;-@TB,VBT&]F67[('J!_L8E1TuOeWVh8kBf#)L_4IcA;:j]VFcnN>Lo$2>XaU4?"f1_pp.ogGibIAJ2bZH(gPfT'"Y`!`3)2WS4-!Y33?h7q9tgrEqn"#nN5N\PA);)GGQQk^)3:C$=sp[HALfi649=NKAgW?k<mJn%!bS8b2>N,Nj;=G"_eoSK!nedS>)O,)'+u!Y&u7kP~>endstream
|
||||||
|
endobj
|
||||||
|
xref
|
||||||
|
0 10
|
||||||
|
0000000000 65535 f
|
||||||
|
0000000073 00000 n
|
||||||
|
0000000124 00000 n
|
||||||
|
0000000231 00000 n
|
||||||
|
0000000343 00000 n
|
||||||
|
0000000426 00000 n
|
||||||
|
0000000629 00000 n
|
||||||
|
0000000697 00000 n
|
||||||
|
0000000993 00000 n
|
||||||
|
0000001052 00000 n
|
||||||
|
trailer
|
||||||
|
<<
|
||||||
|
/ID
|
||||||
|
[<a59e15b0a2ccd350e715d29c66e41feb><a59e15b0a2ccd350e715d29c66e41feb>]
|
||||||
|
% ReportLab generated PDF document -- digest (http://www.reportlab.com)
|
||||||
|
|
||||||
|
/Info 7 0 R
|
||||||
|
/Root 6 0 R
|
||||||
|
/Size 10
|
||||||
|
>>
|
||||||
|
startxref
|
||||||
|
2337
|
||||||
|
%%EOF
|
||||||
Binary file not shown.
BIN
Excel/Tableurs a problèmes/Ratio_Restauration_dev_old.xlsm
Normal file
BIN
Excel/Tableurs a problèmes/Ratio_Restauration_dev_old.xlsm
Normal file
Binary file not shown.
BIN
Excel/Tableurs a problèmes/Ratios anciens.xlsm
Normal file
BIN
Excel/Tableurs a problèmes/Ratios anciens.xlsm
Normal file
Binary file not shown.
BIN
Excel/Tableurs modèles/Bibliotheque_PQ.xlsm
Normal file
BIN
Excel/Tableurs modèles/Bibliotheque_PQ.xlsm
Normal file
Binary file not shown.
@@ -1 +0,0 @@
|
|||||||
Sabrina
|
|
||||||
BIN
Excel/prod/Démo_Ratio_Cuisine.xlsm
Normal file
BIN
Excel/prod/Démo_Ratio_Cuisine.xlsm
Normal file
Binary file not shown.
BIN
Excel/prod/Ratio_Cuisine.xlsm
Normal file
BIN
Excel/prod/Ratio_Cuisine.xlsm
Normal file
Binary file not shown.
BIN
Excel/prod/Ratio_Restauration.xlsm
Normal file
BIN
Excel/prod/Ratio_Restauration.xlsm
Normal file
Binary file not shown.
@@ -1 +0,0 @@
|
|||||||
Saclay
|
|
||||||
BIN
Images/Logo.jpg
Normal file
BIN
Images/Logo.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 271 KiB |
BIN
Images/cuisine.ico
Normal file
BIN
Images/cuisine.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 108 KiB |
BIN
Images/restauration.ico
Normal file
BIN
Images/restauration.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 124 KiB |
431
README.md
431
README.md
@@ -0,0 +1,431 @@
|
|||||||
|
# Ratio Inventaires
|
||||||
|
|
||||||
|
Projet Excel/VBA permettant de gérer les inventaires, les articles, les fournisseurs, les factures, le chiffre d’affaires et les ratios de consommation pour plusieurs activités.
|
||||||
|
|
||||||
|
Le projet est organisé pour travailler proprement avec PyCharm, Git/Gitea et des scripts de mise en production automatisés.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Objectif du projet
|
||||||
|
|
||||||
|
Le projet permet de maintenir plusieurs classeurs Excel métier :
|
||||||
|
|
||||||
|
- `Ratio_Cuisine.xlsm`
|
||||||
|
- `Ratio_Restauration.xlsm`
|
||||||
|
- `Démo_Ratio_Cuisine.xlsm`
|
||||||
|
|
||||||
|
Les fichiers de développement sont conservés dans `Excel/dev`, puis copiés vers `Excel/prod` par des scripts de mise en production.
|
||||||
|
|
||||||
|
Le numéro de version est géré automatiquement par fichier `.txt` interne, puis écrit directement dans le classeur Excel livré.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Organisation des dossiers
|
||||||
|
|
||||||
|
```text
|
||||||
|
Ratio_Inventaires/
|
||||||
|
│
|
||||||
|
├── Docs/
|
||||||
|
│
|
||||||
|
├── Excel/
|
||||||
|
│ ├── backup/
|
||||||
|
│ │ └── anciennes versions sauvegardées
|
||||||
|
│ │
|
||||||
|
│ ├── dev/
|
||||||
|
│ │ ├── Ratio_Cuisine_dev.xlsm
|
||||||
|
│ │ ├── Ratio_Cuisine_VERSION.txt
|
||||||
|
│ │ ├── Ratio_Restauration_dev.xlsm
|
||||||
|
│ │ └── Ratio_Restauration_VERSION.txt
|
||||||
|
│ │
|
||||||
|
│ └── prod/
|
||||||
|
│ ├── Démo_Ratio_Cuisine.xlsm
|
||||||
|
│ ├── Ratio_Cuisine.xlsm
|
||||||
|
│ └── Ratio_Restauration.xlsm
|
||||||
|
│
|
||||||
|
└── Scripts/
|
||||||
|
├── Maj_prod_Cuisine.bat
|
||||||
|
├── Maj_prod_Restauration.bat
|
||||||
|
├── maj_version.py
|
||||||
|
└── set_cell_silent.vbs
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Rôle des dossiers
|
||||||
|
|
||||||
|
### `Excel/dev`
|
||||||
|
|
||||||
|
Contient les fichiers de travail.
|
||||||
|
|
||||||
|
```text
|
||||||
|
Ratio_Cuisine_dev.xlsm
|
||||||
|
Ratio_Restauration_dev.xlsm
|
||||||
|
```
|
||||||
|
|
||||||
|
Ces fichiers sont les fichiers modifiables.
|
||||||
|
|
||||||
|
Les fichiers `*_VERSION.txt` restent uniquement dans `dev`. Ils servent de compteurs internes pour les scripts de versionnage.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `Excel/prod`
|
||||||
|
|
||||||
|
Contient les fichiers livrables.
|
||||||
|
|
||||||
|
```text
|
||||||
|
Ratio_Cuisine.xlsm
|
||||||
|
Ratio_Restauration.xlsm
|
||||||
|
Démo_Ratio_Cuisine.xlsm
|
||||||
|
```
|
||||||
|
|
||||||
|
Les fichiers de production ne nécessitent plus de fichier `.txt` à côté. La version est directement écrite dans le classeur Excel.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `Excel/backup`
|
||||||
|
|
||||||
|
Contient les anciennes versions de production sauvegardées automatiquement avant remplacement.
|
||||||
|
|
||||||
|
Exemple :
|
||||||
|
|
||||||
|
```text
|
||||||
|
Ratio_Cuisine_Vers1.0.15.xlsm
|
||||||
|
Ratio_Restauration_Vers2.1.3.xlsm
|
||||||
|
```
|
||||||
|
|
||||||
|
Le nombre de sauvegardes conservées est limité dans les scripts `.bat`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `Scripts`
|
||||||
|
|
||||||
|
Contient les scripts d’automatisation :
|
||||||
|
|
||||||
|
```text
|
||||||
|
Maj_prod_Cuisine.bat
|
||||||
|
Maj_prod_Restauration.bat
|
||||||
|
maj_version.py
|
||||||
|
set_cell_silent.vbs
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Versionnage
|
||||||
|
|
||||||
|
Le projet utilise deux familles de versions :
|
||||||
|
|
||||||
|
```text
|
||||||
|
Cuisine → 1.x.x
|
||||||
|
Restauration → 2.x.x
|
||||||
|
```
|
||||||
|
|
||||||
|
Les fichiers de version à conserver sont uniquement :
|
||||||
|
|
||||||
|
```text
|
||||||
|
Excel/dev/Ratio_Cuisine_VERSION.txt
|
||||||
|
Excel/dev/Ratio_Restauration_VERSION.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
Les fichiers `.txt` de version ne doivent plus être copiés dans `Excel/prod`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Fonctionnement du script de version
|
||||||
|
|
||||||
|
Le script :
|
||||||
|
|
||||||
|
```text
|
||||||
|
Scripts/maj_version.py
|
||||||
|
```
|
||||||
|
|
||||||
|
fait les opérations suivantes :
|
||||||
|
|
||||||
|
1. lit le fichier `*_VERSION.txt` dans `Excel/dev` ;
|
||||||
|
2. force le numéro majeur selon le classeur ;
|
||||||
|
3. incrémente le patch ;
|
||||||
|
4. réécrit le fichier `.txt` ;
|
||||||
|
5. écrit la version directement dans le classeur Excel de production.
|
||||||
|
|
||||||
|
Exemple de version écrite dans Excel :
|
||||||
|
|
||||||
|
```text
|
||||||
|
Version : 1.0.12
|
||||||
|
Version : 2.1.4
|
||||||
|
```
|
||||||
|
|
||||||
|
L’écriture dans le classeur Excel est faite par :
|
||||||
|
|
||||||
|
```text
|
||||||
|
Scripts/set_cell_silent.vbs
|
||||||
|
```
|
||||||
|
|
||||||
|
Ce script ouvre Excel en arrière-plan, modifie la cellule de version, sauvegarde et ferme le classeur.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Cellule de version dans Excel
|
||||||
|
|
||||||
|
La version est écrite automatiquement dans la feuille :
|
||||||
|
|
||||||
|
```text
|
||||||
|
Tableau de bord
|
||||||
|
```
|
||||||
|
|
||||||
|
La cellule utilisée doit être réservée à la version.
|
||||||
|
|
||||||
|
Recommandation actuelle :
|
||||||
|
|
||||||
|
```text
|
||||||
|
E1 = Version : x.x.x
|
||||||
|
```
|
||||||
|
|
||||||
|
Attention : `C1` est utilisé par le contexte du site, notamment `SiteCanonique`, et ne doit donc pas être utilisé pour la version.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Mise en production Cuisine
|
||||||
|
|
||||||
|
Depuis le dossier `Scripts`, lancer :
|
||||||
|
|
||||||
|
```bat
|
||||||
|
Maj_prod_Cuisine.bat CUISINE
|
||||||
|
```
|
||||||
|
|
||||||
|
Le script effectue :
|
||||||
|
|
||||||
|
1. sauvegarde de l’ancienne version de production ;
|
||||||
|
2. copie de `Excel/dev/Ratio_Cuisine_dev.xlsm` vers `Excel/prod/Ratio_Cuisine.xlsm` ;
|
||||||
|
3. incrément de `Excel/dev/Ratio_Cuisine_VERSION.txt` ;
|
||||||
|
4. écriture de la version dans le classeur de production ;
|
||||||
|
5. nettoyage des anciennes sauvegardes.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Mise en production Restauration
|
||||||
|
|
||||||
|
Depuis le dossier `Scripts`, lancer :
|
||||||
|
|
||||||
|
```bat
|
||||||
|
Maj_prod_Restauration.bat RESTAURATION
|
||||||
|
```
|
||||||
|
|
||||||
|
Le script effectue :
|
||||||
|
|
||||||
|
1. sauvegarde de l’ancienne version de production ;
|
||||||
|
2. copie de `Excel/dev/Ratio_Restauration_dev.xlsm` vers `Excel/prod/Ratio_Restauration.xlsm` ;
|
||||||
|
3. incrément de `Excel/dev/Ratio_Restauration_VERSION.txt` ;
|
||||||
|
4. écriture de la version dans le classeur de production ;
|
||||||
|
5. nettoyage des anciennes sauvegardes.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Fichier de démonstration
|
||||||
|
|
||||||
|
Le fichier :
|
||||||
|
|
||||||
|
```text
|
||||||
|
Excel/prod/Démo_Ratio_Cuisine.xlsm
|
||||||
|
```
|
||||||
|
|
||||||
|
est destiné à présenter le fonctionnement sans installation réseau obligatoire.
|
||||||
|
|
||||||
|
Il peut contenir des données locales dans des feuilles de type :
|
||||||
|
|
||||||
|
```text
|
||||||
|
DATA_Articles
|
||||||
|
DATA_Fournisseurs
|
||||||
|
DATA_Factures
|
||||||
|
DATA_Ca
|
||||||
|
DATA_Inventaires
|
||||||
|
```
|
||||||
|
|
||||||
|
La version démo peut fonctionner sans connexion MySQL, sans ODBC et sans fichier `.txt` distribué.
|
||||||
|
|
||||||
|
Recommandations pour la version démo :
|
||||||
|
|
||||||
|
- données locales uniquement ;
|
||||||
|
- pas d’identifiants MySQL ;
|
||||||
|
- pas de requêtes Power Query actives ;
|
||||||
|
- pas de fichier de version `.txt` livré ;
|
||||||
|
- limitation volontaire des ajouts pour éviter un usage réel non maîtrisé.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Connexions MySQL et ODBC
|
||||||
|
|
||||||
|
Les classeurs de production connectés peuvent utiliser MySQL via ODBC.
|
||||||
|
|
||||||
|
La version recommandée du pilote est :
|
||||||
|
|
||||||
|
```text
|
||||||
|
MySQL ODBC 8.3 Unicode Driver
|
||||||
|
```
|
||||||
|
|
||||||
|
Sur les postes clients connectés, le pilote doit être installé avant utilisation.
|
||||||
|
|
||||||
|
La version démo locale, elle, ne doit pas dépendre du pilote ODBC.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Installation du pilote MySQL ODBC 8.3
|
||||||
|
|
||||||
|
Télécharger le pilote officiel :
|
||||||
|
|
||||||
|
```text
|
||||||
|
mysql-connector-odbc-8.3.0-winx64.msi
|
||||||
|
```
|
||||||
|
|
||||||
|
Puis le placer dans :
|
||||||
|
|
||||||
|
```text
|
||||||
|
C:\Installers\
|
||||||
|
```
|
||||||
|
|
||||||
|
Exemple de script d’installation silencieuse :
|
||||||
|
|
||||||
|
```bat
|
||||||
|
@echo off
|
||||||
|
echo ===============================
|
||||||
|
echo Installation MySQL ODBC 8.3.0
|
||||||
|
echo ===============================
|
||||||
|
|
||||||
|
set MYPATH=C:\Installers
|
||||||
|
set INSTALLER=%MYPATH%\mysql-connector-odbc-8.3.0-winx64.msi
|
||||||
|
|
||||||
|
if exist "%INSTALLER%" (
|
||||||
|
echo Démarrage de l'installation silencieuse...
|
||||||
|
msiexec /i "%INSTALLER%" /qn
|
||||||
|
echo Installation terminée.
|
||||||
|
) else (
|
||||||
|
echo Fichier MSI non trouvé :
|
||||||
|
echo %INSTALLER%
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
À lancer en administrateur.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Bonnes pratiques Git/Gitea
|
||||||
|
|
||||||
|
À versionner :
|
||||||
|
|
||||||
|
```text
|
||||||
|
Excel/dev/Ratio_Cuisine_dev.xlsm
|
||||||
|
Excel/dev/Ratio_Restauration_dev.xlsm
|
||||||
|
Excel/dev/*_VERSION.txt
|
||||||
|
Scripts/*.bat
|
||||||
|
Scripts/*.py
|
||||||
|
Scripts/*.vbs
|
||||||
|
README.md
|
||||||
|
```
|
||||||
|
|
||||||
|
À ignorer ou éviter de versionner :
|
||||||
|
|
||||||
|
```text
|
||||||
|
Excel/backup/
|
||||||
|
~$*.xlsm
|
||||||
|
*.tmp
|
||||||
|
*.bak
|
||||||
|
```
|
||||||
|
|
||||||
|
Selon la stratégie choisie, les fichiers de `Excel/prod` peuvent être versionnés ou non. Dans ce projet, ils servent de fichiers livrables générés par les scripts.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Exemple de `.gitignore`
|
||||||
|
|
||||||
|
```gitignore
|
||||||
|
# Fichiers temporaires Excel
|
||||||
|
~$*.xlsm
|
||||||
|
~$*.xlsx
|
||||||
|
*.tmp
|
||||||
|
*.bak
|
||||||
|
|
||||||
|
# Sauvegardes générées
|
||||||
|
Excel/backup/
|
||||||
|
|
||||||
|
# Cache Python
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Environnements virtuels
|
||||||
|
.venv/
|
||||||
|
venv/
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Checklist avant mise en production
|
||||||
|
|
||||||
|
Avant de lancer un script de mise en production :
|
||||||
|
|
||||||
|
1. fermer le classeur Excel concerné ;
|
||||||
|
2. vérifier qu’aucun fichier `~$Ratio_*.xlsm` n’est présent ;
|
||||||
|
3. sauvegarder les modifications dans le fichier `dev` ;
|
||||||
|
4. lancer le script `.bat` correspondant ;
|
||||||
|
5. vérifier que la version est bien écrite dans le classeur `prod` ;
|
||||||
|
6. faire un commit Git/Gitea.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Commandes utiles
|
||||||
|
|
||||||
|
Vérifier l’état Git :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git status
|
||||||
|
```
|
||||||
|
|
||||||
|
Ajouter les modifications :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git add README_old.md Scripts/ Excel/dev/
|
||||||
|
```
|
||||||
|
|
||||||
|
Créer un commit :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git commit -m "Normalise versioning and prod deployment scripts"
|
||||||
|
```
|
||||||
|
|
||||||
|
Envoyer vers Gitea :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git push
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Dépannage
|
||||||
|
|
||||||
|
### Erreur : fichier utilisé par un autre processus
|
||||||
|
|
||||||
|
Cause probable : le classeur est encore ouvert dans Excel ou un fichier temporaire existe.
|
||||||
|
|
||||||
|
Solution :
|
||||||
|
|
||||||
|
```bat
|
||||||
|
taskkill /F /IM excel.exe
|
||||||
|
```
|
||||||
|
|
||||||
|
Puis vérifier que le fichier temporaire a disparu :
|
||||||
|
|
||||||
|
```text
|
||||||
|
~$Ratio_Cuisine.xlsm
|
||||||
|
~$Ratio_Restauration.xlsm
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Erreur dans `set_cell_silent.vbs` au moment de fermer Excel
|
||||||
|
|
||||||
|
Cause probable : Excel est resté en arrière-plan.
|
||||||
|
|
||||||
|
Solution : utiliser la version robuste de `set_cell_silent.vbs`, qui ferme explicitement le classeur et l’application Excel après sauvegarde.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Auteur
|
||||||
|
|
||||||
|
Michel
|
||||||
|
|||||||
206
README_old.md
Normal file
206
README_old.md
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
# Inventaire-Gestion
|
||||||
|
|
||||||
|
Ce projet permet de gérer les inventaires et les ratios de plusieurs sites à partir d’un fichier Excel central et d’une base MySQL.
|
||||||
|
|
||||||
|
## Fonctionnalités
|
||||||
|
|
||||||
|
* Mise à jour du pilote ODBC sur machine client
|
||||||
|
* Authentification par site
|
||||||
|
* Lecture automatique du fichier `ratio.xlsm`
|
||||||
|
* Insertion des données dans la base correspondante
|
||||||
|
* Gestion des articles et inventaire par code barres
|
||||||
|
* Affichage dans Streamlit (à venir)
|
||||||
|
|
||||||
|
# 🚀 Installation du pilote MySQL ODBC 8.3
|
||||||
|
|
||||||
|
## ✅ Objectif
|
||||||
|
|
||||||
|
Assurer une compatibilité totale entre les fichiers Excel connectés à MySQL et le pilote ODBC, en uniformisant tous les postes avec la **version 8.3.0 du connecteur MySQL ODBC**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📥 Étapes d'installation
|
||||||
|
|
||||||
|
1. Télécharger le fichier `mysql-connector-odbc-8.3.0-winx64.msi` depuis le site officiel :
|
||||||
|
|
||||||
|
👉 [https://dev.mysql.com/downloads/connector/odbc/](https://dev.mysql.com/downloads/connector/odbc/)
|
||||||
|
|
||||||
|
2. Copier le fichier dans ce dossier sur chaque poste cible :
|
||||||
|
|
||||||
|
```
|
||||||
|
C:\Installers\
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Créer un fichier `Installer_ODBC_93.bat` contenant :
|
||||||
|
|
||||||
|
```bat
|
||||||
|
@echo off
|
||||||
|
echo ===============================
|
||||||
|
echo Installation MySQL ODBC 8.3.0
|
||||||
|
echo ===============================
|
||||||
|
|
||||||
|
SET MYPATH=C:\Installers
|
||||||
|
SET INSTALLER=%MYPATH%\mysql-connector-odbc-8.3.0-winx64.msi
|
||||||
|
|
||||||
|
IF EXIST "%INSTALLER%" (
|
||||||
|
echo >> Démarrage de l'installation silencieuse...
|
||||||
|
msiexec /i "%INSTALLER%" /qn
|
||||||
|
echo >> Installation terminée avec succès.
|
||||||
|
pause
|
||||||
|
) ELSE (
|
||||||
|
echo >> Fichier MSI non trouvé :
|
||||||
|
echo >> %INSTALLER%
|
||||||
|
pause
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Lancer le script :
|
||||||
|
|
||||||
|
* clic droit sur `Installer_ODBC_83.bat`
|
||||||
|
* puis **"Exécuter en tant qu’administrateur"**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔁 (Optionnel) Désinstallation d'une version précédente
|
||||||
|
|
||||||
|
Pour supprimer proprement une version antérieure (ex : 8.2), vous pouvez ajouter :
|
||||||
|
|
||||||
|
```bat
|
||||||
|
msiexec /x {GUID-DE-LA-VERSION-8.2} /qn
|
||||||
|
```
|
||||||
|
|
||||||
|
*(à compléter avec l'identifiant de produit si nécessaire)*
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🧩 Conseils
|
||||||
|
|
||||||
|
* Intégrez ces fichiers dans votre dépôt (ex : dossier `Installers/`)
|
||||||
|
* Versionnez votre script dans Git (Gitea) pour faciliter le déploiement sur tous les sites
|
||||||
|
* Utilisez RustDesk ou accès direct pour l'installation sur les PC distants
|
||||||
|
|
||||||
|
# 🔧 Gestion et distribution du fichier Excel `Ratio_prod.xlsm`
|
||||||
|
|
||||||
|
Ce document décrit le fonctionnement mis en place pour garantir une version stable et toujours à jour du fichier Excel `Ratio_prod.xlsm`, utilisé dans le cadre du projet **Ratio & Inventaires**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🗃️ Organisation des fichiers
|
||||||
|
|
||||||
|
### Structure dans le projet (Git)
|
||||||
|
|
||||||
|
/Excel/
|
||||||
|
├── dev/
|
||||||
|
│ └── Ratio\_dev.xlsm ← Fichier de travail
|
||||||
|
├── prod/
|
||||||
|
│ └── Ratio\_prod.xlsm ← Fichier de production (non suivi par Git)
|
||||||
|
|
||||||
|
* `Ratio_dev.xlsm` : version de développement modifiable, suivie par Git.
|
||||||
|
* `Ratio_prod.xlsm` : version validée, protégée (ajoutée au `.gitignore` pour éviter tout push accidentel).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🖥️ Synchronisation automatique avec le NAS Synology
|
||||||
|
|
||||||
|
Le fichier `Ratio_prod.xlsm` est copié automatiquement sur le NAS Synology, dans un dossier partagé :
|
||||||
|
|
||||||
|
### ⚙️ Configuration
|
||||||
|
|
||||||
|
* **Synology Drive Server** est activé sur le NAS.
|
||||||
|
* **Synology Drive Client** est installé sur le poste de travail.
|
||||||
|
* Dossier synchronisé : `Partage_Ratio`
|
||||||
|
* Mode de synchronisation recommandé : `Téléchargement uniquement`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔌 Copie automatique vers clé USB (via NAS)
|
||||||
|
|
||||||
|
### Prérequis
|
||||||
|
|
||||||
|
* Application **USB Copy** installée et activée sur le NAS.
|
||||||
|
|
||||||
|
### Fonctionnement
|
||||||
|
|
||||||
|
1. Brancher une clé USB sur le port en façade du NAS.
|
||||||
|
2. Le NAS copie automatiquement `Ratio_prod.xlsm` sur la clé USB si une version plus récente est disponible.
|
||||||
|
3. Le fichier est copié dans le dossier racine de la clé, ou dans un dossier `Ratio/`.
|
||||||
|
|
||||||
|
### Avantages
|
||||||
|
|
||||||
|
* Pas besoin d’ordinateur pour copier à la main.
|
||||||
|
* Copie toujours à jour dès que la clé est branchée.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🛠️ Installation manuelle depuis une clé USB
|
||||||
|
|
||||||
|
Contenu du dossier USB :
|
||||||
|
|
||||||
|
```
|
||||||
|
INSTALL_RATIO/
|
||||||
|
├── Ratio_prod.xlsm
|
||||||
|
└── Installer_Prod.bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### Étapes :
|
||||||
|
|
||||||
|
1. Brancher la clé USB sur le poste utilisateur.
|
||||||
|
2. Lancer `Installer_Prod.bat` **en tant qu’administrateur**.
|
||||||
|
3. Le fichier sera copié dans :
|
||||||
|
|
||||||
|
```
|
||||||
|
C:\Program Files\Ratio\Ratio.xlsm
|
||||||
|
```
|
||||||
|
|
||||||
|
et protégé en lecture seule.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ♻️ Restaurer la version de production dans le projet (dev)
|
||||||
|
|
||||||
|
Si la version de travail (`dev`) a été corrompue ou modifiée par erreur :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp Excel/prod/Ratio_Cuisine.xlsm Excel/dev/Ratio_Cuisine_dev_old.xlsm
|
||||||
|
```
|
||||||
|
|
||||||
|
Ou sous Windows :
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Copy-Item -Path "Excel\prod\Ratio_prod.xlsm" -Destination "Excel\dev\Ratio_dev.xlsm" -Force
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🧾 Notes complémentaires
|
||||||
|
|
||||||
|
* Le fichier `Ratio_prod.xlsm` n’est **pas suivi par Git**, car exclu via `.gitignore`.
|
||||||
|
* Il est **protégé en lecture seule** sur le poste utilisateur.
|
||||||
|
* Une sauvegarde automatique est possible via **Hyper Backup** ou les **snapshots** du NAS.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 📋 Checklist Release DEV → PROD
|
||||||
|
|
||||||
|
Pour garantir que DEV reste ouvert et que PROD soit protégé :
|
||||||
|
|
||||||
|
1. **Travailler dans DEV** : `Excel/dev/Ratio_dev.xlsm` (projet VBA non verrouillé).
|
||||||
|
2. **Lancer le script batch** (`build_prod.bat`).
|
||||||
|
|
||||||
|
* Copie DEV → PROD
|
||||||
|
* Application des protections (feuilles, structure, horodatage)
|
||||||
|
* Vérification/verrouillage du projet VBA PROD (manuel si nécessaire)
|
||||||
|
3. **Vérifier PROD** :
|
||||||
|
|
||||||
|
* Feuilles protégées
|
||||||
|
* Structure du classeur protégée
|
||||||
|
* Projet VBA verrouillé (mot de passe, déjà posé une fois)
|
||||||
|
4. **Distribuer PROD** : via NAS, USB ou dossier client.
|
||||||
|
|
||||||
|
👉 DEV reste toujours libre, PROD reste verrouillé et sûr.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Auteur
|
||||||
|
|
||||||
|
Michel
|
||||||
115
Scripts/Maj_prod_Cuisine.bat
Normal file
115
Scripts/Maj_prod_Cuisine.bat
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal ENABLEDELAYEDEXPANSION
|
||||||
|
|
||||||
|
cd /d "%~dp0"
|
||||||
|
|
||||||
|
echo --- Mise en prod Ratio_Cuisine ---
|
||||||
|
|
||||||
|
set "ROOT=%~dp0.."
|
||||||
|
|
||||||
|
set "VERSION_FILE=%ROOT%\Excel\dev\Ratio_Cuisine_VERSION.txt"
|
||||||
|
set "SRC=%ROOT%\Excel\dev\Ratio_Cuisine_dev.xlsm"
|
||||||
|
set "DST_DIR=%ROOT%\Excel\prod"
|
||||||
|
set "DST=%DST_DIR%\Ratio_Cuisine.xlsm"
|
||||||
|
set "BACKUP_DIR=%ROOT%\Excel\backup"
|
||||||
|
set KEEP_BACKUPS=10
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ROOT = %ROOT%
|
||||||
|
echo SRC = %SRC%
|
||||||
|
echo DST = %DST%
|
||||||
|
echo BACKUP_DIR = %BACKUP_DIR%
|
||||||
|
echo VERSION_FILE= %VERSION_FILE%
|
||||||
|
echo.
|
||||||
|
|
||||||
|
set "OLD_VERSION="
|
||||||
|
if exist "%VERSION_FILE%" (
|
||||||
|
set /p OLD_VERSION=<"%VERSION_FILE%"
|
||||||
|
)
|
||||||
|
|
||||||
|
if not exist "%SRC%" (
|
||||||
|
echo ERREUR : fichier source introuvable :
|
||||||
|
echo %SRC%
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
if not exist "%DST_DIR%" (
|
||||||
|
echo ERREUR : dossier de destination introuvable :
|
||||||
|
echo %DST_DIR%
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
if not exist "%BACKUP_DIR%" (
|
||||||
|
echo Creation du dossier backup :
|
||||||
|
echo %BACKUP_DIR%
|
||||||
|
mkdir "%BACKUP_DIR%"
|
||||||
|
)
|
||||||
|
|
||||||
|
if exist "%DST_DIR%\~$Ratio_Cuisine.xlsm" (
|
||||||
|
echo ERREUR : Ratio_Cuisine.xlsm est ouvert dans Excel.
|
||||||
|
echo Ferme le classeur de production avant de relancer la mise en prod.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
if exist "%DST%" (
|
||||||
|
if "%OLD_VERSION%"=="" (
|
||||||
|
set "BACKUP=%BACKUP_DIR%\Ratio_Cuisine_sansVersion.xlsm"
|
||||||
|
) else (
|
||||||
|
set "BACKUP=%BACKUP_DIR%\Ratio_Cuisine_Vers%OLD_VERSION%.xlsm"
|
||||||
|
)
|
||||||
|
|
||||||
|
echo Sauvegarde de l'ancienne production...
|
||||||
|
echo De : %DST%
|
||||||
|
echo Vers : !BACKUP!
|
||||||
|
|
||||||
|
copy /Y "%DST%" "!BACKUP!"
|
||||||
|
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo ERREUR : la sauvegarde de l'ancienne production a echoue.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
if not exist "!BACKUP!" (
|
||||||
|
echo ERREUR : le fichier de sauvegarde n'a pas ete cree.
|
||||||
|
echo Attendu : !BACKUP!
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
echo Sauvegarde OK : !BACKUP!
|
||||||
|
) else (
|
||||||
|
echo Aucun ancien fichier de production trouve, pas de sauvegarde a faire.
|
||||||
|
)
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Copie vers la version de production...
|
||||||
|
copy /Y "%SRC%" "%DST%"
|
||||||
|
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo ERREUR lors de la copie vers production.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
if not exist "%DST%" (
|
||||||
|
echo ERREUR : le fichier de production n'a pas ete cree.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Mise a jour de version...
|
||||||
|
python "%~dp0maj_version.py" "%VERSION_FILE%" "%DST%"
|
||||||
|
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo ERREUR lors de la mise a jour de version.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Nettoyage des anciennes sauvegardes Cuisine...
|
||||||
|
for /f "skip=%KEEP_BACKUPS% delims=" %%F in ('dir /b /a-d /o-d "%BACKUP_DIR%\Ratio_Cuisine_Vers*.xlsm" 2^>nul') do (
|
||||||
|
echo Suppression ancienne sauvegarde : %%F
|
||||||
|
del /q "%BACKUP_DIR%\%%F"
|
||||||
|
)
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo --- Mise en prod terminee ---
|
||||||
|
exit /b 0
|
||||||
114
Scripts/Maj_prod_Restauration.bat
Normal file
114
Scripts/Maj_prod_Restauration.bat
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal ENABLEDELAYEDEXPANSION
|
||||||
|
|
||||||
|
cd /d "%~dp0"
|
||||||
|
|
||||||
|
echo --- Mise en prod Ratio_Restauration ---
|
||||||
|
|
||||||
|
set "ROOT=%~dp0.."
|
||||||
|
|
||||||
|
set "VERSION_FILE=%ROOT%\Excel\dev\Ratio_Restauration_VERSION.txt"
|
||||||
|
set "SRC=%ROOT%\Excel\dev\Ratio_Restauration_dev.xlsm"
|
||||||
|
set "DST_DIR=%ROOT%\Excel\prod"
|
||||||
|
set "DST=%DST_DIR%\Ratio_Restauration.xlsm"
|
||||||
|
set "BACKUP_DIR=%ROOT%\Excel\backup"
|
||||||
|
set KEEP_BACKUPS=10
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ROOT = %ROOT%
|
||||||
|
echo SRC = %SRC%
|
||||||
|
echo DST = %DST%
|
||||||
|
echo BACKUP_DIR = %BACKUP_DIR%
|
||||||
|
echo VERSION_FILE= %VERSION_FILE%
|
||||||
|
echo.
|
||||||
|
|
||||||
|
set "OLD_VERSION="
|
||||||
|
if exist "%VERSION_FILE%" (
|
||||||
|
set /p OLD_VERSION=<"%VERSION_FILE%"
|
||||||
|
)
|
||||||
|
|
||||||
|
if not exist "%SRC%" (
|
||||||
|
echo ERREUR : fichier source introuvable :
|
||||||
|
echo %SRC%
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
if not exist "%DST_DIR%" (
|
||||||
|
echo ERREUR : dossier de destination introuvable :
|
||||||
|
echo %DST_DIR%
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
if not exist "%BACKUP_DIR%" (
|
||||||
|
echo Creation du dossier backup :
|
||||||
|
echo %BACKUP_DIR%
|
||||||
|
mkdir "%BACKUP_DIR%"
|
||||||
|
)
|
||||||
|
|
||||||
|
if exist "%DST_DIR%\~$Ratio_Restauration.xlsm" (
|
||||||
|
echo ERREUR : Ratio_Restauration.xlsm est ouvert dans Excel.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
if exist "%DST%" (
|
||||||
|
if "%OLD_VERSION%"=="" (
|
||||||
|
set "BACKUP=%BACKUP_DIR%\Ratio_Restauration_sansVersion.xlsm"
|
||||||
|
) else (
|
||||||
|
set "BACKUP=%BACKUP_DIR%\Ratio_Restauration_Vers%OLD_VERSION%.xlsm"
|
||||||
|
)
|
||||||
|
|
||||||
|
echo Sauvegarde de l'ancienne production...
|
||||||
|
echo De : %DST%
|
||||||
|
echo Vers : !BACKUP!
|
||||||
|
|
||||||
|
copy /Y "%DST%" "!BACKUP!"
|
||||||
|
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo ERREUR : la sauvegarde de l'ancienne production a echoue.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
if not exist "!BACKUP!" (
|
||||||
|
echo ERREUR : le fichier de sauvegarde n'a pas ete cree.
|
||||||
|
echo Attendu : !BACKUP!
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
echo Sauvegarde OK : !BACKUP!
|
||||||
|
) else (
|
||||||
|
echo Aucun ancien fichier de production trouve, pas de sauvegarde a faire.
|
||||||
|
)
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Copie vers la version de production...
|
||||||
|
copy /Y "%SRC%" "%DST%"
|
||||||
|
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo ERREUR lors de la copie vers production.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
if not exist "%DST%" (
|
||||||
|
echo ERREUR : le fichier de production n'a pas ete cree.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Mise a jour de version...
|
||||||
|
python "%~dp0maj_version.py" "%VERSION_FILE%" "%DST%"
|
||||||
|
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo ERREUR lors de la mise a jour de version.
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Nettoyage des anciennes sauvegardes Restauration...
|
||||||
|
for /f "skip=%KEEP_BACKUPS% delims=" %%F in ('dir /b /a-d /o-d "%BACKUP_DIR%\Ratio_Restauration_Vers*.xlsm" 2^>nul') do (
|
||||||
|
echo Suppression ancienne sauvegarde : %%F
|
||||||
|
del /q "%BACKUP_DIR%\%%F"
|
||||||
|
)
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo --- Mise en prod terminee ---
|
||||||
|
exit /b 0
|
||||||
2
Scripts/Update_Version/Cuisine.bat
Normal file
2
Scripts/Update_Version/Cuisine.bat
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
@echo off
|
||||||
|
powershell -ExecutionPolicy Bypass -File "%~dp0Maj_Ratio_Cuisine.ps1"
|
||||||
42
Scripts/Update_Version/Cuisine.ps1
Normal file
42
Scripts/Update_Version/Cuisine.ps1
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
$source = "\\mj91.fr\PyCharm\Ratio_Inventaires\Excel\prod"
|
||||||
|
$dest = "C:\Users\$env:USERNAME\Domo91"
|
||||||
|
|
||||||
|
$nomFichier = "Ratio_Cuisine.xlsm"
|
||||||
|
$nomVersion = "Ratio_Cuisine_VERSION.txt"
|
||||||
|
|
||||||
|
$sourceXlsm = Join-Path $source $nomFichier
|
||||||
|
$sourceVersion = Join-Path $source $nomVersion
|
||||||
|
|
||||||
|
$destXlsm = Join-Path $dest $nomFichier
|
||||||
|
$destVersion = Join-Path $dest $nomVersion
|
||||||
|
|
||||||
|
if (!(Test-Path $dest)) {
|
||||||
|
New-Item -ItemType Directory -Path $dest -Force | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Test-Path $sourceVersion)) {
|
||||||
|
Add-Type -AssemblyName PresentationFramework
|
||||||
|
[System.Windows.MessageBox]::Show("Le dossier de mise à jour sur le NAS est inaccessible.", "Mise à jour Ratio Cuisine")
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$versionServeur = (Get-Content $sourceVersion -ErrorAction Stop).Trim()
|
||||||
|
|
||||||
|
if (Test-Path $destVersion) {
|
||||||
|
$versionLocale = (Get-Content $destVersion -ErrorAction SilentlyContinue).Trim()
|
||||||
|
} else {
|
||||||
|
$versionLocale = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($versionServeur -ne $versionLocale) {
|
||||||
|
$excel = Get-Process EXCEL -ErrorAction SilentlyContinue
|
||||||
|
if ($excel) {
|
||||||
|
$excel | Stop-Process -Force
|
||||||
|
Start-Sleep -Seconds 2
|
||||||
|
}
|
||||||
|
|
||||||
|
Copy-Item -Path $sourceXlsm -Destination $destXlsm -Force
|
||||||
|
Copy-Item -Path $sourceVersion -Destination $destVersion -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
Start-Process $destXlsm
|
||||||
2
Scripts/Update_Version/Restauration.bat
Normal file
2
Scripts/Update_Version/Restauration.bat
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
@echo off
|
||||||
|
powershell -ExecutionPolicy Bypass -File "%~dp0Maj_Ratio_Restauration.ps1"
|
||||||
42
Scripts/Update_Version/Restauration.ps1
Normal file
42
Scripts/Update_Version/Restauration.ps1
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
$source = "\\mj91.fr\PyCharm\Ratio_Inventaires\Excel\prod"
|
||||||
|
$dest = "C:\Users\$env:USERNAME\Domo91"
|
||||||
|
|
||||||
|
$nomFichier = "Ratio_Restauration.xlsm"
|
||||||
|
$nomVersion = "Ratio_Restauration_VERSION.txt"
|
||||||
|
|
||||||
|
$sourceXlsm = Join-Path $source $nomFichier
|
||||||
|
$sourceVersion = Join-Path $source $nomVersion
|
||||||
|
|
||||||
|
$destXlsm = Join-Path $dest $nomFichier
|
||||||
|
$destVersion = Join-Path $dest $nomVersion
|
||||||
|
|
||||||
|
if (!(Test-Path $dest)) {
|
||||||
|
New-Item -ItemType Directory -Path $dest -Force | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(Test-Path $sourceVersion)) {
|
||||||
|
Add-Type -AssemblyName PresentationFramework
|
||||||
|
[System.Windows.MessageBox]::Show("Le dossier de mise à jour sur le NAS est inaccessible.", "Mise à jour Ratio Restauration")
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$versionServeur = (Get-Content $sourceVersion -ErrorAction Stop).Trim()
|
||||||
|
|
||||||
|
if (Test-Path $destVersion) {
|
||||||
|
$versionLocale = (Get-Content $destVersion -ErrorAction SilentlyContinue).Trim()
|
||||||
|
} else {
|
||||||
|
$versionLocale = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($versionServeur -ne $versionLocale) {
|
||||||
|
$excel = Get-Process EXCEL -ErrorAction SilentlyContinue
|
||||||
|
if ($excel) {
|
||||||
|
$excel | Stop-Process -Force
|
||||||
|
Start-Sleep -Seconds 2
|
||||||
|
}
|
||||||
|
|
||||||
|
Copy-Item -Path $sourceXlsm -Destination $destXlsm -Force
|
||||||
|
Copy-Item -Path $sourceVersion -Destination $destVersion -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
Start-Process $destXlsm
|
||||||
135
Scripts/maj_version.py
Normal file
135
Scripts/maj_version.py
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
from pathlib import Path
|
||||||
|
from datetime import date
|
||||||
|
|
||||||
|
# =========================================================
|
||||||
|
# CONFIG
|
||||||
|
# =========================================================
|
||||||
|
|
||||||
|
VBS_SCRIPT = Path(__file__).parent / "set_cell_silent.vbs"
|
||||||
|
|
||||||
|
# =========================================================
|
||||||
|
# PREFIXE VERSION
|
||||||
|
# =========================================================
|
||||||
|
|
||||||
|
def detecter_major(path: Path) -> int:
|
||||||
|
|
||||||
|
nom = path.name.lower()
|
||||||
|
|
||||||
|
if "restauration" in nom:
|
||||||
|
return 2
|
||||||
|
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
# =========================================================
|
||||||
|
# LECTURE VERSION
|
||||||
|
# =========================================================
|
||||||
|
|
||||||
|
def lire_version(path: Path, major: int):
|
||||||
|
|
||||||
|
if not path.exists():
|
||||||
|
return [major, 0, 0]
|
||||||
|
|
||||||
|
contenu = path.read_text(encoding="utf-8").strip().splitlines()
|
||||||
|
|
||||||
|
if not contenu:
|
||||||
|
return [major, 0, 0]
|
||||||
|
|
||||||
|
try:
|
||||||
|
version = [int(x) for x in contenu[0].split(".")]
|
||||||
|
|
||||||
|
while len(version) < 3:
|
||||||
|
version.append(0)
|
||||||
|
|
||||||
|
version = version[:3]
|
||||||
|
|
||||||
|
# force le major correct
|
||||||
|
version[0] = major
|
||||||
|
|
||||||
|
return version
|
||||||
|
|
||||||
|
except Exception:
|
||||||
|
return [major, 0, 0]
|
||||||
|
|
||||||
|
|
||||||
|
# =========================================================
|
||||||
|
# INCREMENT
|
||||||
|
# =========================================================
|
||||||
|
|
||||||
|
def increment_patch(version):
|
||||||
|
version[2] += 1
|
||||||
|
return version
|
||||||
|
|
||||||
|
|
||||||
|
# =========================================================
|
||||||
|
# ECRITURE TXT
|
||||||
|
# =========================================================
|
||||||
|
|
||||||
|
def ecrire_version_txt(path: Path, version):
|
||||||
|
|
||||||
|
version_str = ".".join(str(x) for x in version)
|
||||||
|
|
||||||
|
contenu = f"{version_str}\n{date.today().isoformat()}\n"
|
||||||
|
|
||||||
|
path.write_text(contenu, encoding="utf-8")
|
||||||
|
|
||||||
|
return version_str
|
||||||
|
|
||||||
|
|
||||||
|
# =========================================================
|
||||||
|
# ECRITURE EXCEL
|
||||||
|
# =========================================================
|
||||||
|
|
||||||
|
def ecrire_version_excel(classeur: Path, version_str: str):
|
||||||
|
|
||||||
|
if not classeur.exists():
|
||||||
|
print(f"Classeur introuvable : {classeur}")
|
||||||
|
return
|
||||||
|
|
||||||
|
valeur = f"Version : {version_str}"
|
||||||
|
|
||||||
|
cmd = [
|
||||||
|
"cscript",
|
||||||
|
"//nologo",
|
||||||
|
str(VBS_SCRIPT),
|
||||||
|
str(classeur),
|
||||||
|
"Tableau de bord",
|
||||||
|
"C1",
|
||||||
|
valeur
|
||||||
|
]
|
||||||
|
|
||||||
|
subprocess.run(cmd, check=True)
|
||||||
|
|
||||||
|
|
||||||
|
# =========================================================
|
||||||
|
# MAIN
|
||||||
|
# =========================================================
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
if len(sys.argv) < 3:
|
||||||
|
print("Usage :")
|
||||||
|
print("python maj_version.py VERSION.txt classeur.xlsm")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
version_file = Path(sys.argv[1])
|
||||||
|
classeur = Path(sys.argv[2])
|
||||||
|
|
||||||
|
major = detecter_major(version_file)
|
||||||
|
|
||||||
|
version = lire_version(version_file, major)
|
||||||
|
|
||||||
|
version = increment_patch(version)
|
||||||
|
|
||||||
|
version_str = ecrire_version_txt(version_file, version)
|
||||||
|
|
||||||
|
ecrire_version_excel(classeur, version_str)
|
||||||
|
|
||||||
|
print(f"Nouvelle version : {version_str}")
|
||||||
|
print(f"Classeur mis à jour : {classeur.name}")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
71
Scripts/set_cell_silent.vbs
Normal file
71
Scripts/set_cell_silent.vbs
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
Option Explicit
|
||||||
|
|
||||||
|
Dim xl, wb
|
||||||
|
Dim filePath, sheetName, cellAddress, cellValue
|
||||||
|
|
||||||
|
If WScript.Arguments.Count < 4 Then
|
||||||
|
WScript.Echo "[ERR] Usage : set_cell_silent.vbs fichier.xlsm feuille cellule valeur"
|
||||||
|
WScript.Quit 1
|
||||||
|
End If
|
||||||
|
|
||||||
|
filePath = WScript.Arguments(0)
|
||||||
|
sheetName = WScript.Arguments(1)
|
||||||
|
cellAddress = WScript.Arguments(2)
|
||||||
|
cellValue = WScript.Arguments(3)
|
||||||
|
|
||||||
|
On Error Resume Next
|
||||||
|
|
||||||
|
Set xl = CreateObject("Excel.Application")
|
||||||
|
If Err.Number <> 0 Then
|
||||||
|
WScript.Echo "[ERR] Creation Excel : " & Err.Description
|
||||||
|
WScript.Quit 1
|
||||||
|
End If
|
||||||
|
|
||||||
|
xl.Visible = False
|
||||||
|
xl.DisplayAlerts = False
|
||||||
|
xl.EnableEvents = False
|
||||||
|
xl.AskToUpdateLinks = False
|
||||||
|
xl.AutomationSecurity = 3
|
||||||
|
|
||||||
|
Err.Clear
|
||||||
|
Set wb = xl.Workbooks.Open(filePath, 0, False)
|
||||||
|
|
||||||
|
If Err.Number <> 0 Then
|
||||||
|
WScript.Echo "[ERR] Ouverture classeur: " & Err.Description
|
||||||
|
xl.Quit
|
||||||
|
Set xl = Nothing
|
||||||
|
WScript.Quit 1
|
||||||
|
End If
|
||||||
|
|
||||||
|
Err.Clear
|
||||||
|
wb.Worksheets(sheetName).Range(cellAddress).Value = cellValue
|
||||||
|
|
||||||
|
If Err.Number <> 0 Then
|
||||||
|
WScript.Echo "[ERR] Ecriture cellule: " & Err.Description
|
||||||
|
wb.Close False
|
||||||
|
xl.Quit
|
||||||
|
Set wb = Nothing
|
||||||
|
Set xl = Nothing
|
||||||
|
WScript.Quit 1
|
||||||
|
End If
|
||||||
|
|
||||||
|
Err.Clear
|
||||||
|
wb.Save
|
||||||
|
|
||||||
|
If Err.Number <> 0 Then
|
||||||
|
WScript.Echo "[ERR] Sauvegarde: " & Err.Description
|
||||||
|
wb.Close False
|
||||||
|
xl.Quit
|
||||||
|
Set wb = Nothing
|
||||||
|
Set xl = Nothing
|
||||||
|
WScript.Quit 1
|
||||||
|
End If
|
||||||
|
|
||||||
|
Err.Clear
|
||||||
|
wb.Close False
|
||||||
|
Set wb = Nothing
|
||||||
|
|
||||||
|
xl.Quit
|
||||||
|
Set xl = Nothing
|
||||||
|
|
||||||
|
WScript.Quit 0
|
||||||
81
connexion.py
81
connexion.py
@@ -1,81 +0,0 @@
|
|||||||
import tkinter as tk
|
|
||||||
from tkinter import messagebox
|
|
||||||
import mysql.connector
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
# Charger les variables d'environnement
|
|
||||||
load_dotenv()
|
|
||||||
|
|
||||||
DB_HOST = os.getenv("DB_HOST")
|
|
||||||
DB_USER = os.getenv("DB_USER")
|
|
||||||
DB_PASSWORD = os.getenv("DB_PASSWORD")
|
|
||||||
DB_NAME = os.getenv("DB_NAME")
|
|
||||||
|
|
||||||
|
|
||||||
def ouvrir_excel(site, login):
|
|
||||||
dossier_excel = os.path.join(os.path.dirname(__file__), "excel")
|
|
||||||
chemin_excel = os.path.join(dossier_excel, "Commun.xlsm")
|
|
||||||
subprocess.Popen(["start", chemin_excel], shell=True)
|
|
||||||
|
|
||||||
# Écrit le nom du site
|
|
||||||
with open(os.path.join(dossier_excel, "site_selectionne.txt"), "w") as f:
|
|
||||||
f.write(site)
|
|
||||||
|
|
||||||
# Écrit le nom de l'utilisateur connecté
|
|
||||||
with open(os.path.join(dossier_excel, "login_utilisateur.txt"), "w") as f:
|
|
||||||
f.write(login)
|
|
||||||
os.chdir(dossier_excel) # On se place dans le dossier pour lancer Excel
|
|
||||||
subprocess.Popen(["start", "Commun.xlsm"], shell=True)
|
|
||||||
|
|
||||||
from datetime import date
|
|
||||||
|
|
||||||
def verifier_connexion():
|
|
||||||
login = entry_login.get()
|
|
||||||
mdp = entry_mdp.get()
|
|
||||||
|
|
||||||
try:
|
|
||||||
conn = mysql.connector.connect(
|
|
||||||
host=DB_HOST,
|
|
||||||
user=DB_USER,
|
|
||||||
password=DB_PASSWORD,
|
|
||||||
database=DB_NAME
|
|
||||||
)
|
|
||||||
cursor = conn.cursor()
|
|
||||||
|
|
||||||
cursor.execute("SELECT Site, DateExpiration FROM AccesUtilisateurs WHERE NomUtilisateur=%s AND MotDePasse=%s", (login, mdp))
|
|
||||||
result = cursor.fetchone()
|
|
||||||
|
|
||||||
if result:
|
|
||||||
site, expiration = result
|
|
||||||
if expiration and expiration < date.today():
|
|
||||||
messagebox.showerror("Compte expiré", f"Votre compte a expiré le {expiration}.")
|
|
||||||
else:
|
|
||||||
root.destroy()
|
|
||||||
ouvrir_excel(site, login)
|
|
||||||
else:
|
|
||||||
messagebox.showerror("Erreur", "Identifiants invalides.")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
messagebox.showerror("Erreur de connexion", str(e))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Interface utilisateur
|
|
||||||
root = tk.Tk()
|
|
||||||
root.title("Connexion à l'inventaire")
|
|
||||||
|
|
||||||
tk.Label(root, text="Nom d'utilisateur").grid(row=0, column=0)
|
|
||||||
tk.Label(root, text="Mot de passe").grid(row=1, column=0)
|
|
||||||
|
|
||||||
entry_login = tk.Entry(root)
|
|
||||||
entry_mdp = tk.Entry(root, show="*")
|
|
||||||
|
|
||||||
entry_login.grid(row=0, column=1)
|
|
||||||
entry_mdp.grid(row=1, column=1)
|
|
||||||
|
|
||||||
tk.Button(root, text="Connexion", command=verifier_connexion).grid(row=2, columnspan=2, pady=10)
|
|
||||||
|
|
||||||
root.mainloop()
|
|
||||||
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
.env
|
|
||||||
*.txt
|
|
||||||
__pycache__/
|
|
||||||
*.pyc
|
|
||||||
*.log
|
|
||||||
.DS_Store
|
|
||||||
3
last_ids.txt
Normal file
3
last_ids.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Meudon:27
|
||||||
|
Roissy:15
|
||||||
|
Saclay:20
|
||||||
Reference in New Issue
Block a user