t=unicode(qApp.clipboard().mimeData().text()) done=0 zzWaitShow(u"Загрузка", t.count("\n")) curOrderUid=None for x in t.split("\n")[1:]: zzWaitStep() row=x.split("\t") if len(row)==52: if row[1-1]:#новый заказ orderDic={} orderDic['DATE']=date orderDic['buyer_id'.upper()]=gi("buyers","email",row[50-1],"buyer_id") orderDic['NOTES']=u"Заказ № %s:%s %s" % (row[1-1],row[30-1],row[14-1]) if num(orderDic['buyer_id'.upper()])==0: orderDic['NOTES']+=u"\n%s, %s (%s)" % (row[20-1],row[23-1],row[50-1]) if not insert("orders",orderDic): zzMess(lastError()) done+=1 ordetDic={} ordetDic['ORDER_ID']=orderDic['ORDER_ID'] ordetDic["QT"]=row[9-1] # ordetDic["PRIM"]=row[14-1] ordetDic["SELLING_PRICE"]=row[8-1].replace(u"руб.","").strip() ordetDic["PRODUCT_ID"]=gi("products","site_id",row[3-1],"product_id") if num(ordetDic["PRODUCT_ID"])==0: ordetDic["PRODUCT_ID"]=gi("products","name",row[4-1],"product_id") ordetDic["PURCHASE_PRICE"]=gi("products","product_id",ordetDic["PRODUCT_ID"],"PURCHASE_PRICE") if num(ordetDic["PRODUCT_ID"])==0: ordetDic["PRIM"]=u"%s (%s)" % (row[4-1],row[3-1]) if not insert("order_details",ordetDic): zzMess(lastError()) zzWaitClose() mem.refresh() zzMess(u"Загружено заказов <b>%s</b><br>" % (done))