예제 #1
0
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import cgi
import op_db_library as db

form = cgi.FieldStorage()
print 'Content-type: text/plain\n'

itemid = int(form.getvalue('item'))
item = db.get_item(itemid)
dist = None
if 'distname' in form:
    distname = form.getvalue('distname')
    if db.is_distributor_byname(distname):
        dist = db.get_distributor_byname(distname)
elif 'distid' in form:
    distid = int(form.getvalue('distid'))
    if db.is_distributor(distid):
        dist = db.get_distributor(distid)

if dist != None:
    dist_item = db.get_distributor_item(item,dist)
    print '%s,%d,%s,%.2f,%.2f,%s' % (dist.get_name(), dist.get_id(),dist_item.get_dist_item_id(), dist_item.get_wholesale_price(), dist_item.get_case_size(), dist_item.get_case_unit())

예제 #2
0
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import op_db_library as db

kehe = db.get_distributor_byname('Kehe')
kehe_items = db.get_distributor_items(show_distributors=[kehe])
for p,item,d,dist_item in kehe_items:  # p and d are unused
    if d.name != 'Kehe':
	    continue
    note = item.get_notes()
    d_id = dist_item.get_dist_item_id()
    note += '\nold kehe id:' + str(d_id)
    item.set_notes(note)

    barcodes = item.get_barcodes()
    if len(barcodes) == 0 :
        dist_item.set_dist_item_id('')
    if len(barcodes) == 1:
        dist_item.set_dist_item_id(barcodes[0])
    else: