stok_aktar.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. import sqlite3 as lite
  4. import sys
  5. import datetime
  6. import os
  7. import decimal
  8. import pyodbc
  9. import time
  10. import codecs
  11. from logcu import *
  12. from iniparse import INIConfig
  13. from iniparse import ConfigParser
  14. import random
  15. import re
  16. import sqlite3 as lite
  17. import sys
  18. import urllib2, urllib
  19. import MultipartPostHandler
  20. from random import randint
  21. import datetime
  22. from mysqlmak import *
  23. from cari import *
  24. from stok import *
  25. from fatura import *
  26. from htmlrapor import *
  27. #from mysqllab import *
  28. sqlmak=sqlmak()
  29. mak=mysqlmak()
  30. rapor=statikrapor()
  31. logla=Logcu()
  32. #mak.test()
  33. stoklar=sqlmak.calistirtum("select * from tblstsabit") # WHERE STOK_KODU='BAKLIYAT-6015'
  34. i=0
  35. gec=""
  36. for stok in stoklar:
  37. j=0
  38. for sto in stok:
  39. if sto is None:
  40. stok[j]=""
  41. j=j+1
  42. sql=open('./altyapi/stok/stok_ekle_detayli.sql','r').read()
  43. sql=sql.replace('@kod@',stok[2])
  44. sql=sql.replace('@isim@',stok[4])
  45. sql=sql.replace('@barkod1@',str(stok[54]))
  46. sql=sql.replace('@barkod2@',str(stok[55]))
  47. sql=sql.replace('@barkod3@',str(stok[56]))
  48. sql=sql.replace('@barkod4@',"")
  49. sql=sql.replace('@barkod5@',"")
  50. sql=sql.replace('@barkod6@',"")
  51. sql=sql.replace('@alkdv@',str(stok[57]))
  52. sql=sql.replace('@satkdv@',str(stok[37]))
  53. sql=sql.replace('@satis_fiat3@',str(stok[28]))
  54. sql=sql.replace('@satis_fiat2@',str(stok[27]))
  55. sql=sql.replace('@satis_fiat1@',str(stok[26]))
  56. sql=sql.replace('@alis_fiat1@',str(stok[58]))
  57. sql=sql.replace('@alis_fiat2@',"0")
  58. sql=sql.replace('@alis_fiat3@',"0")
  59. sql=sql.replace('@satici_kodu@',str(stok[11]))
  60. sql=sql.replace('@olcu_br1@',str(stok[12]))
  61. sql=sql.replace('@olcu_br2@',str(stok[13]))
  62. sql=sql.replace('@pay_1@',str(stok[14]))
  63. sql=sql.replace('@payda_1@',str(stok[15]))
  64. sql=sql.replace('@pay_2@',str(stok[17]))
  65. sql=sql.replace('@payda_2@',str(stok[18]))
  66. sql=sql.replace('@grupkod@',str(stok[5]))
  67. sql=sql.replace('@kod_1@',str(stok[6]))
  68. sql=sql.replace('@kod_2@',str(stok[7]))
  69. sql=sql.replace('@kod_3@',str(stok[8]))
  70. sql=sql.replace('@kod_4@',str(stok[9]))
  71. sql=sql.replace('@kod_5@',str(stok[10]))
  72. sql=sql.replace('@birim_agirlik@',"0")
  73. gec+=sql+"\n"
  74. open("stok_kart_data.sql",'w').write(gec)
  75. #mak.calistir(sql)