|
|
from BWP.B3ButcherManageExport.BO import NcVoucher;
|
|
|
from BWP.B3ButcherManageExport.BO import NcVoucherEntry;
|
|
|
from BWP.B3ButcherManageExport.BO import Items;
|
|
|
from BWP.B3ButcherManageExport.BO import Otheruserdata;
|
|
|
from System import Convert;
|
|
|
|
|
|
class BLMethodEvents(BLMethodEventsBase):
|
|
|
def before(self):
|
|
|
self.proxy.MinDmoProperties.Add("Date");
|
|
|
self.proxy.MinDmoProperties.Add("Supplier_Name");
|
|
|
self.proxy.MinDmoProperties.Add("AccountingUnit_ID");
|
|
|
self.proxy.MinDmoProperties.Add("AccountingUnit_Name");
|
|
|
self.proxy.MinDmoProperties.Add("Employee_Name");
|
|
|
self.proxy.MinDmoProperties.Add("RealNumber");#收购头数
|
|
|
self.proxy.MinDmoProperties.Add("RealWeight");#收购重量
|
|
|
self.proxy.MinDmoProperties.Add("RawPrice");#毛重单价
|
|
|
self.proxy.MinDmoProperties.Add("Money");#应付金额
|
|
|
self.proxy.MinDmoProperties.Add("ActualMoney");#实付金额
|
|
|
|
|
|
|
|
|
def execute(self):
|
|
|
self.proxy.CheckAccountingUnit(dmos);
|
|
|
|
|
|
voucher2 = NcVoucher();
|
|
|
for dmo in dmos:
|
|
|
voucher2.B2BillIDs.Add(dmo.ID);
|
|
|
|
|
|
voucher2.Head.Company = dmo.AccountingUnit_Name;
|
|
|
if dmo.AccountingUnit_ID==5:
|
|
|
voucher2.Head.VoucherType = "QHC凭证";
|
|
|
else:
|
|
|
voucher2.Head.VoucherType = "记账凭证";
|
|
|
voucher2.Head.FiscalYear = self.proxy.GetDateTime(gToday,"yyyy");
|
|
|
voucher2.Head.AccountingPeriod = self.proxy.GetDateTime(gToday,"MM");
|
|
|
voucher2.Head.Date = self.proxy.GetDateTime(gToday,"yyyy-MM-dd");
|
|
|
voucher2.Head.Signature = "Y";
|
|
|
voucher2.Head.VoucherMakingSystem = "总账";
|
|
|
voucher2.Head.Reserve2 = "N";
|
|
|
voucher2.Head.Enter = gUser.Name;
|
|
|
voucher2.Head.VoucherId = "0";
|
|
|
voucher2.Head.AttachmentNumber = "0";
|
|
|
vouchers.Bills.Add(voucher2);
|
|
|
|
|
|
entryid = 0;
|
|
|
num = str(dmo.RealNumber);
|
|
|
weight = str(dmo.RealWeight);
|
|
|
abstract = self.proxy.GetDateTime(dmo.Date,"yyyy-MM-dd")+dmo.Supplier_Name +"购买生猪"+ num + "头"+ weight +"KG";
|
|
|
for dmo in dmos:
|
|
|
if dmo.AccountingUnit_ID == 1:
|
|
|
entryid = entryid + 1;
|
|
|
entry = NcVoucherEntry();
|
|
|
voucher2.Body.Entrys.Add(entry);
|
|
|
entry.EntryId = str(entryid);
|
|
|
entry.AccountCode = "原材料\生猪" ;
|
|
|
entry.Abstract = abstract;
|
|
|
entry.Currency = "CNY";
|
|
|
entry.ExchangeRate2 = "1" ;
|
|
|
entry.PrimaryDebitAmount = str(dmo.Money);
|
|
|
entry.NaturalDebitCurrency = str(dmo.Money);
|
|
|
entry.DebitQuantity = weight;
|
|
|
entry.UnitPrice = str(dmo.RawPrice);
|
|
|
for dmo in dmos:
|
|
|
if dmo.AccountingUnit_ID == 1:
|
|
|
entryid = entryid + 1;
|
|
|
entry = NcVoucherEntry();
|
|
|
voucher2.Body.Entrys.Add(entry);
|
|
|
entry.EntryId = str(entryid);
|
|
|
entry.AccountCode = "预付账款\集团外预付账款\其他预付生猪款" ;
|
|
|
entry.Abstract = abstract;
|
|
|
entry.Currency = "CNY";
|
|
|
entry.ExchangeRate2 = "1" ;
|
|
|
entry.PrimaryCreditAmount = str(dmo.Money);
|
|
|
entry.NaturalCreditCurrency = str(dmo.Money);
|
|
|
item =Items();
|
|
|
item.Name = "供应商辅助核算";
|
|
|
item.Value = dmo.Supplier_Name;
|
|
|
entry.Accountings.Items.Add(item);
|
|
|
for dmo in dmos:
|
|
|
if dmo.AccountingUnit_ID == 1:
|
|
|
entryid = entryid + 1;
|
|
|
entry = NcVoucherEntry();
|
|
|
voucher2.Body.Entrys.Add(entry);
|
|
|
entry.EntryId = str(entryid);
|
|
|
entry.AccountCode = "应付账款\集团外应付账款\应付生猪款";
|
|
|
entry.Abstract = abstract;
|
|
|
entry.Currency = "CNY";
|
|
|
entry.ExchangeRate2 = "1" ;
|
|
|
entry.PrimaryCreditAmount = str(dmo.ActualMoney);
|
|
|
entry.NaturalCreditCurrency = str(dmo.ActualMoney);
|
|
|
item =Items();
|
|
|
item.Name = "供应商辅助核算";
|
|
|
item.Value = dmo.Supplier_Name;
|
|
|
entry.Accountings.Items.Add(item);
|