T1工贸宝支持U+移动手机端

以下脚本请在对应的T1账套库执行:

/*
如何让工贸宝也可以友加移动 可以手机上查询日报 报警等!
由于工贸宝是在t1批零基础上面开发,开发工贸的时候基础功能已经成熟,后期变化不大,所以就有公用的基础,做做小改动就可以跑了。
*/
iNSERT INTO [master].[dbo].[Sub_List]
([DBName]
,[ZTName]
,[ZTRemark]
,[flgUse]
,[flgVer])
VALUES
(DB_NAME()
,DB_NAME()+'手机帐套'
,DB_NAME()+'手机帐套'
,0
,1)

/*
补齐工贸数据库和t1批零差异
*/
ALTER TABLE dbo.SalesAdv ADD
billstate int 
GO

ALTER TABLE dbo.Employee ADD
EmpStatus int 
GO
update Employee set EmpStatus =0 

ALTER TABLE dbo.product ADD
ProdStatus int 
GO
update Product set prodstatus =0

ALTER TABLE dbo.units ADD
UnitStatus int 
GO
update units set unitstatus =0 

ALTER TABLE dbo.PeriodWarnParam ADD
ifuse int 
GO
ALTER TABLE dbo.MasterBilldft ADD
UnitAYuS numeric(28, 12)
GO
ALTER TABLE dbo.MasterBilldft ADD
UnitAYuF numeric(28, 12)
GO

ALTER TABLE dbo.VIPCard ADD
BirthdayType varchar(4) NULL
GO 
ALTER TABLE dbo.MasterBill ADD
UnitAYuS numeric(28, 12)
GO
ALTER TABLE dbo.MasterBill ADD
UnitAYuF numeric(28, 12)
GO
---ALTER TABLE dbo.Masterbill ADD
-- Ysyf_Money numeric(28, 12) NULL
--GO 

--ALTER TABLE dbo.listsale ADD
-- zs_syb bit NULL
--GO

CREATE TABLE [dbo].[SalesAdvUnits](
[Prom_ID] [int] NULL,
[Unit_ID] [int] NULL,
[Unit_Name] [varchar](60) COLLATE Chinese_PRC_CI_AS NULL,
[Unit_Code] [varchar](60) COLLATE Chinese_PRC_CI_AS NULL,
[s_checkEdit] [timestamp] NOT NULL,
[g_ID] [int] IDENTITY(1,1) NOT NULL
) ON [PRIMARY]

GO
CREATE TABLE [dbo].[WarSetinfo](
[s_ID] [int] IDENTITY(1,1) NOT NULL,
[List_ID] [int] NOT NULL DEFAULT ((-1)),
[Stor_ID] [int] NOT NULL DEFAULT ((-1)),
[DayNum] [int] NOT NULL DEFAULT ((0)),
[Inivalue] [int] NOT NULL DEFAULT ((-1)),
[Remark] [varchar](60) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]

GO
/*
创建视图
*/
CREATE VIEW [dbo].[c_vw_BillSale_Prod_io_ZSD]
AS
SELECT 
BillType, BillDate,BillSN,AutoID,UnitFullID,AreaFullID, BillTime,
EmpFullID,OperFullID,AuditFullID, DeptFullID,Product.s_FullID AS ProdFullID,
dbo.StorHouse.s_FullID AS StorFullID,b_vw_Master_Type.s_Syb,b_vw_Master_Type.Period,
LYUserFullID,OutStorFullID,InStorFullID,
dbo.ListSale.Prod_ID AS Prod_ID,
dbo.ListSale.InorOut,dbo.ListSale.List_ID,
Product.u_code AS ProdCode, 
Product.u_name AS ProdName, 
Product.PrePrice6 As RetailPrice,
CASE When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=2 THEN - dbo.ListSale.Prod_Number 
When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=1 THEN dbo.ListSale.Prod_Number 
ELSE 0 END Prod_Number,
CASE When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=2 THEN - dbo.ListSale.Prod_Number2 
When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=1 THEN dbo.ListSale.Prod_Number2 
ELSE 0 END Prod_Number2,
dbo.ListSale.Prod_ProdDw AS Prod_ProdDw, 
dbo.ListSale.pDW_Ratio AS pDW_Ratio, 
CASE When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=2 THEN - dbo.ListSale.pDW_Num 
When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=1 THEN dbo.ListSale.pDW_Num 
ELSE 0 END pDW_Num,
CASE When dbo.ListSale.ZS_Syb=1 and dbo.ListSale.InorOut=2 THEN - dbo.ListSale.pDW_Num 
When dbo.ListSale.ZS_Syb=1 and dbo.ListSale.InorOut=1 THEN dbo.ListSale.pDW_Num 
ELSE 0 END pDW_ZSNum,
CASE When dbo.ListSale.ZS_Syb=1 and dbo.ListSale.InorOut=2 THEN - (dbo.ListSale.pDW_Num* dbo.ListSale.CostPrice) 
When dbo.ListSale.ZS_Syb=1 and dbo.ListSale.InorOut=1 THEN (dbo.ListSale.pDW_Num * dbo.ListSale.CostPrice)
ELSE 0 END P_ZSMoney,
dbo.ListSale.CostPrice AS CostPrice, 
CASE When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=2 THEN - dbo.ListSale.CostMoney 
When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=1 THEN dbo.ListSale.CostMoney 
When dbo.ListSale.ZS_Syb=1 and dbo.ListSale.InorOut=2 THEN - dbo.ListSale.CostMoney 
When dbo.ListSale.ZS_Syb=1 and dbo.ListSale.InorOut=1 THEN dbo.ListSale.CostMoney 
ELSE 0 END CostMoney,
dbo.ListSale.Prod_Price AS Prod_Price, 
CASE When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=2 THEN - dbo.ListSale.Prod_Money 
When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=1 THEN dbo.ListSale.Prod_Money 
ELSE 0 END Prod_Money,
dbo.ListSale.Discount AS Discount, 
dbo.ListSale.DisPrice AS DisPrice, 
CASE When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=2 THEN - dbo.ListSale.DisMoney 
When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=1 THEN dbo.ListSale.DisMoney 
ELSE 0 END DisMoney,
CASE When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=2 THEN - dbo.ListSale.DisMoney0 
When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=1 THEN dbo.ListSale.DisMoney0 
ELSE 0 END DisMoney0,
CASE When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=2 THEN -(dbo.ListSale.DisMoney - dbo.ListSale.CostMoney)
When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=1 THEN dbo.ListSale.DisMoney - dbo.ListSale.CostMoney
ELSE 0 END ProfitMoney,
dbo.ListSale.Tax AS Tax, dbo.ListSale.TaxPrice AS TaxPrice, 
CASE When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=2 THEN - dbo.ListSale.TaxMoney 
When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=1 THEN dbo.ListSale.TaxMoney 
ELSE 0 END TaxMoney,
CASE When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=2 THEN - dbo.ListSale.TaxMoney0 
When dbo.ListSale.ZS_Syb=0 and dbo.ListSale.InorOut=1 THEN dbo.ListSale.TaxMoney0 
ELSE 0 END TaxMoney0,Promotion
FROM dbo.ListSale INNER JOIN Product ON dbo.ListSale.Prod_ID = Product.s_ID 
INNER JOIN dbo.b_vw_Master_Type ON dbo.ListSale.Bill_ID = dbo.b_vw_Master_Type.AutoID
LEFT OUTER JOIN dbo.StorHouse ON dbo.ListSale.Stor_ID = dbo.StorHouse.s_ID
union all
SELECT 
BillType, BillDate,BillSN,AutoID,UnitFullID,AreaFullID, BillTime,
EmpFullID,OperFullID,AuditFullID, DeptFullID,Product.s_FullID AS ProdFullID,
dbo.StorHouse.s_FullID AS StorFullID,b_vw_Master_Type.s_Syb,b_vw_Master_Type.Period,
LYUserFullID,OutStorFullID,InStorFullID,
dbo.ListOther.Prod_ID AS Prod_ID,
dbo.ListOther.InorOut,dbo.ListOther.List_ID,
Product.u_code AS ProdCode, 
Product.u_name AS ProdName, 
Product.PrePrice6 As RetailPrice,
Prod_Number,Prod_Number,
dbo.ListOther.Prod_ProdDw AS Prod_ProdDw, 
dbo.ListOther.pDW_Ratio AS pDW_Ratio, 
0,
pdw_num,pdw_num*CostPrice,
dbo.ListOther.CostPrice AS CostPrice, 0,
dbo.ListOther.Prod_Price AS Prod_Price, 
0,
dbo.ListOther.Discount AS Discount, 
0, 
0,
DisMoney0,
0,
dbo.ListOther.Tax AS Tax, 
0, 
0,
TaxMoney0,''
FROM dbo.ListOther INNER JOIN Product ON dbo.ListOther.Prod_ID = Product.s_ID 
INNER JOIN dbo.b_vw_Master_Type ON dbo.ListOther.Bill_ID = dbo.b_vw_Master_Type.AutoID
LEFT OUTER JOIN dbo.StorHouse ON dbo.ListOther.Stor_ID = dbo.StorHouse.s_ID

go

CREATE TABLE [dbo].[UnitAddress](
[id] [int] NOT NULL,
[u_id] [int] NULL,
[ADDRESS] [varchar](200) COLLATE Chinese_PRC_CI_AS NULL,
[LinkMan] [varchar](40) COLLATE Chinese_PRC_CI_AS NULL,
[LinkTel] [varchar](20) COLLATE Chinese_PRC_CI_AS NULL,
[MobileTel] [varchar](20) COLLATE Chinese_PRC_CI_AS NULL,
[fax] [varchar](20) COLLATE Chinese_PRC_CI_AS NULL,
[zipCode] [varchar](10) COLLATE Chinese_PRC_CI_AS NULL,
PRIMARY KEY CLUSTERED 
(
[id] ASC
)--WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

GO
/*
有个别字段 这个视图中没有YSYF_Money 加起.......
*/
ALTER VIEW [dbo].[c_vw_AllMoneyList]
AS
SELECT a.s_Syb, a.Bill_ID, a.BillDate, a.BillType, a.Act_ID, a.Unit_ID, a.User_ID, a.Audit_ID, a.Oper_ID, a.Act_Money AS Act_Money_Add, b.Period, 
a.Act_Money AS Act_Money_Reduce, a.Act_Money, a.Act_Money AS Act_Money_YE, b.BillSN, b.RedDate, CASE a.s_Syb WHEN 0 THEN '' ELSE '红字' END AS Redflg, 
b.AutoID, CASE WHEN a.BillType = - 100 THEN '会员卡充值记录' WHEN a.BillType <> - 100 THEN b.Abst END AS Abst, b.Remark, ISNULL(b.Area_ID, - 1) AS Area_ID, 
ISNULL(b.Dept_ID, - 1) AS Dept_ID, CASE WHEN a.BillType = - 100 THEN '会员卡充值' WHEN a.BillType <> - 100 THEN Type.BillName END AS BillName, b.BillTime, 
b.SumNumber, b.LastDate, Acc.u_Name AS ActName, Acc.u_Code AS ActCode, Acc.s_FullID AS ActFullID, Users.u_Name AS EmpName, Users.u_Code AS EmpCode, 
Users.s_FullID AS EmpFullid, Audit.u_Name AS AuditName, Audit.u_Code AS AuditCode, Audit.s_FullID AS AuditFullID, Oper.u_Name AS OperName, 
Oper.u_Code AS OperCode, Oper.s_FullID AS OperFullID, dbo.Units.u_Name AS UnitName, dbo.Units.u_Code AS UnitCode, ISNULL(dbo.Units.s_FullID, '99999') 
AS UnitFullID, Dept.u_Name AS DeptName, Dept.u_Code AS DeptCode, ISNULL(Dept.s_FullID, '99999') AS DeptFullID, Area.u_Name AS AreaName, 
Area.u_Code AS AreaCode, ISNULL(Area.s_FullID, '99999') AS AreaFullID, b.BillState, a.VIP_Code, b.YSYF_Money
FROM dbo.MoneyList AS a LEFT OUTER JOIN
dbo.MasterBill AS b ON a.Bill_ID = b.AutoID LEFT OUTER JOIN
dbo.Department AS Dept ON Dept.s_ID = b.Dept_ID LEFT OUTER JOIN
dbo.Area AS Area ON Area.s_ID = b.Area_ID LEFT OUTER JOIN
dbo.MoneyAccount AS Acc ON a.Act_ID = Acc.s_ID LEFT OUTER JOIN
dbo.Employee AS Users ON a.User_ID = Users.s_ID LEFT OUTER JOIN
dbo.Employee AS Audit ON a.Audit_ID = Audit.s_ID LEFT OUTER JOIN
dbo.Employee AS Oper ON a.Oper_ID = Oper.s_ID LEFT OUTER JOIN
dbo.Units ON a.Unit_ID = dbo.Units.s_ID LEFT OUTER JOIN
dbo.BillType AS Type ON a.BillType = Type.BillType
GO

ALTER VIEW [dbo].[c_vw_BillSale_Mx_io]
AS
SELECT dbo.ListSale.List_ID, CASE dbo.ListSale.InorOut WHEN 2 THEN - dbo.ListSale.Prod_Number ELSE dbo.ListSale.Prod_Number END AS Prod_Number, 
dbo.ListSale.Prod_ProdDw, dbo.ListSale.pDW_Ratio, dbo.ListSale.Prod_ID, CASE WHEN dbo.ListSale.ZS_Syb = 0 AND 
dbo.ListSale.InorOut = 2 THEN - dbo.ListSale.pDW_Num WHEN dbo.ListSale.ZS_Syb = 0 AND isnull(dbo.ListSale.InorOut, 1) 
= 1 THEN dbo.ListSale.pDW_Num ELSE 0 END AS pDW_Num, dbo.ListSale.DisPrice, dbo.ListSale.CostPrice, CASE WHEN dbo.ListSale.ZS_Syb = 0 AND 
dbo.ListSale.InorOut = 2 THEN - dbo.ListSale.CostMoney WHEN dbo.ListSale.ZS_Syb = 0 AND 
dbo.ListSale.InorOut = 1 THEN dbo.ListSale.CostMoney ELSE 0 END AS CostMoney, CASE WHEN dbo.ListSale.ZS_Syb = 0 AND 
dbo.ListSale.InorOut = 2 THEN - dbo.ListSale.DisMoney WHEN dbo.ListSale.ZS_Syb = 0 AND isnull(dbo.ListSale.InorOut, 1) 
= 1 THEN dbo.ListSale.DisMoney ELSE 0 END AS DisMoney, CASE WHEN dbo.ListSale.ZS_Syb = 0 AND 
dbo.ListSale.InorOut = 2 THEN - (dbo.ListSale.DisMoney - dbo.ListSale.CostMoney) WHEN dbo.ListSale.ZS_Syb = 0 AND 
dbo.ListSale.InorOut = 1 THEN dbo.ListSale.DisMoney - dbo.ListSale.CostMoney ELSE 0 END AS ProfitMoney, dbo.ListSale.Tax, dbo.ListSale.TaxPrice, 
CASE WHEN dbo.ListSale.ZS_Syb = 0 AND dbo.ListSale.InorOut = 2 THEN - dbo.ListSale.TaxMoney WHEN dbo.ListSale.ZS_Syb = 0 AND 
dbo.ListSale.InorOut = 1 THEN dbo.ListSale.TaxMoney ELSE 0 END AS TaxMoney, CASE WHEN dbo.ListSale.ZS_Syb = 0 AND 
dbo.ListSale.InorOut = 2 THEN - dbo.ListSale.TaxMoney0 WHEN dbo.ListSale.ZS_Syb = 0 AND 
dbo.ListSale.InorOut = 1 THEN dbo.ListSale.TaxMoney0 ELSE 0 END AS TaxMoney0, dbo.StorHouse.u_Code AS StorCode, dbo.StorHouse.u_Name AS StorName, 
dbo.a_vw_InfoProd.u_Code AS ProdCode, dbo.a_vw_InfoProd.u_Name AS ProdName, dbo.a_vw_InfoProd.s_FullID AS ProdFullID, dbo.StorHouse.s_ID AS Stor_ID, 
dbo.StorHouse.s_FullID AS StorFullID, dbo.a_vw_InfoProd.pDWname, dbo.b_vw_Master_Name.BillTime, dbo.b_vw_Master_Name.AutoID, 
dbo.b_vw_Master_Name.Unit_ID, dbo.b_vw_Master_Name.Oper_ID, dbo.b_vw_Master_Name.Audit_ID, dbo.b_vw_Master_Name.s_ID, 
dbo.b_vw_Master_Name.Stor_Syb, dbo.b_vw_Master_Name.s_Syb, dbo.b_vw_Master_Name.BillType, dbo.b_vw_Master_Name.BillDate, 
dbo.b_vw_Master_Name.BillSN, dbo.b_vw_Master_Name.Abst, dbo.b_vw_Master_Name.Remark, dbo.b_vw_Master_Name.Redflg, 
dbo.b_vw_Master_Name.UnitName, dbo.b_vw_Master_Name.AreaName, dbo.b_vw_Master_Name.EmpName, dbo.b_vw_Master_Name.OperName, 
dbo.b_vw_Master_Name.AuditName, dbo.b_vw_Master_Name.BillName, dbo.b_vw_Master_Name.UnitFullID, dbo.b_vw_Master_Name.AreaFullID, 
dbo.b_vw_Master_Name.EmpFullID, dbo.b_vw_Master_Name.OperFullID, dbo.b_vw_Master_Name.LYUserFullID, dbo.b_vw_Master_Name.AuditFullID, 
dbo.b_vw_Master_Name.AccountFullID, dbo.b_vw_Master_Name.UnitCode, dbo.b_vw_Master_Name.AccountCode, dbo.b_vw_Master_Name.AreaCode, 
dbo.b_vw_Master_Name.EmpCode, dbo.b_vw_Master_Name.DeptFullID, dbo.b_vw_Master_Name.DeptCode, dbo.b_vw_Master_Name.DeptName, 
dbo.b_vw_Master_Name.OperCode, dbo.b_vw_Master_Name.AuditCode, dbo.b_vw_Master_Name.s_Fullid, dbo.b_vw_Master_Name.s_ParentID, 
dbo.b_vw_Master_Name.InStorFullID, dbo.b_vw_Master_Name.InStorCode, dbo.b_vw_Master_Name.InStorName, dbo.b_vw_Master_Name.OutStorFullID, 
dbo.b_vw_Master_Name.OutStorCode, dbo.b_vw_Master_Name.OutStorName, dbo.CommonInfo.u_Name AS ProdUnit, dbo.ListSale.ZS_Syb
FROM dbo.ListSale INNER JOIN
dbo.a_vw_InfoProd ON dbo.ListSale.Prod_ID = dbo.a_vw_InfoProd.s_ID LEFT OUTER JOIN
dbo.CommonInfo ON dbo.ListSale.Prod_ProdDw = dbo.CommonInfo.s_ID INNER JOIN
dbo.b_vw_Master_Name ON dbo.ListSale.Bill_ID = dbo.b_vw_Master_Name.AutoID LEFT OUTER JOIN
dbo.StorHouse ON dbo.ListSale.Stor_ID = dbo.StorHouse.s_ID
GO
/*阴历生日也是新加的功能,字段BirthdayType加上*/
ALTER VIEW [dbo].[b_vw_VIPCard]
AS
SELECT VIP.s_ID, VIP.u_Name, VIP.s_Syb, VIP.DateB, VIP.DateE, VIP.PWD, VIP.UUNo, 
CASE VIP.s_Syb WHEN - 1 THEN '作废' WHEN 0 THEN '' WHEN 1 THEN '使用' WHEN 2 THEN '停用' WHEN 3 THEN '挂失' WHEN 4 THEN '失效' END AS s_SybName, 
VIP.u_Code, VIP.BarCode, VIP.u_Remark, VIP.CardType_ID, VIP.Holder, VIP.Sex, VIP.Birthday, VIP.IDTType, 
CASE VIP.IDTType WHEN 0 THEN '身份证' WHEN 1 THEN '教师证' WHEN 2 THEN '军官证' END AS IDTTypeName, VIP.IDTCard, VIP.LinkTel, VIP.MobileTel, VIP.EMail, 
VIP.Address, VIP.Education, VIP.Postcode, VIP.ICQ, VIP.Unit_ID, CASE VIPCardType.Syb_Dis WHEN 1 THEN isNull(VIP.Discount, 100) ELSE 100 END AS Discount, 
VIP.IntegralPre, VIP.IntegralAll, VIP.Integral, VIP.MoneyAll, VIP.CountAll, VIP.VerifyBit, VIP.UseMoney, VIP.CreditLimit, dbo.Units.u_Code AS WLDWCode, 
dbo.Units.s_FullID AS UnitFullID, dbo.Units.u_Name AS WLDWName, dbo.VIPCardType.u_Name AS VIPTypeName, dbo.VIPCardType.s_FullID, 
dbo.VIPCardType.CardType, dbo.VIPCardType.UseAutoDis, dbo.VIPCardType.UseLimit, dbo.VIPCardType.UseIntegral, dbo.VIPCardType.DealIntegral, 
dbo.VIPCardType.LimitMoney, dbo.VIPCardType.LimitCount, dbo.VIPCardType.LimitDateRange, dbo.VIPCardType.LimitDateB, dbo.VIPCardType.LimitDateE, 
dbo.VIPCardType.IntegralMoney, dbo.VIPCardType.UsePWD, dbo.VIPCardType.Syb_Integral, dbo.VIPCardType.Syb_Dis, dbo.VIPCardType.Syb_Money, VIP.Nation, 
dbo.VIPCardType.Syb_Limit, dbo.Units.BankNO AS WLDWBank, dbo.Units.TaxNO AS WLDWTax, VIP.ImDate, VIP.Emp_ID, dbo.Employee.u_Name AS EmpName, 
VIP.Employment, VIP.Duty, VIP.newVipTime, VIP.BirthdayType
FROM dbo.VIPCard AS VIP INNER JOIN
dbo.VIPCardType ON VIP.CardType_ID = dbo.VIPCardType.s_ID LEFT OUTER JOIN
dbo.Units ON VIP.Unit_ID = dbo.Units.s_ID LEFT OUTER JOIN
dbo.Employee ON VIP.Emp_ID = dbo.Employee.s_ID
GO


/*
手工去改改 或者执行下面的alter语句
打开存储过程P_GetBillSN 增加参数 @i_isGetBillSNByRecordMove bit=1
使 过程最终如下
ALTER PROCEDURE [dbo].[P_GetBillSN] 
@i_MacMark varchar(30),
@i_BillType int,
@i_BillDate varchar(10),
@i_OperID int,
@i_DftOper int = -1,
@i_isGetBillSNByRecordMove bit=1,
@i_BillSN varchar(100) = '',
@o_BillSN varchar(100) output
AS
*/

ALTER PROCEDURE [dbo].[P_GetBillSN] 
@i_MacMark varchar(30),
@i_BillType int,
@i_BillDate varchar(10),
@i_OperID int,
@i_DftOper int = -1,
@i_isGetBillSNByRecordMove bit=1,
@i_BillSN varchar(100) = '',
@o_BillSN varchar(100) output
AS
Declare @Result int,
@Rule1 int,
@Rule2 int,
@Rule3 int,
@Rule4 int,
@DispMac bit,
@Sign1 varchar(30),
@Sign2 varchar(30),
@Sign3 varchar(30),
@Sign4 varchar(30),
@Sign5 varchar(30),
@Sign6 varchar(30),
@Sign7 varchar(30),
@Sign8 varchar(30),
@Sign9 varchar(30),
@Sign10 varchar(30),
@OperCode varchar(50),
@tmpSN varchar(100)
Declare @tmpSign varchar(30),
@j int,
@TranSyb smallint
set nocount on
set @i_BillSN = isNull(@i_BillSN, '')
if @i_DftOper = -2
begin
set @TranSyb = 0
set @i_DftOper = -1
end else
set @TranSyb = 1
if (@i_BillSN = '') and (@TranSyb = 1)
begin
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE 
begin tran GetBillSNPrc
end
Select @OperCode=u_Code from Employee where s_ID=@i_OperID
Select @Rule1=Rule1, @Rule2=Rule2, @Rule3=Rule3, @Rule4=Rule4, @DispMac=MacMark from BillSNRule where s_ID=1
if @i_BillType in (15, 16)
begin
select @Rule1 = 0,
@Rule2 = 0,
@Rule3 = 0,
@Rule4 = 2
end
Select @Sign1=IsNull(Sign1,''), @Sign2=IsNull(Sign2,''), @Sign3=IsNull(Sign3,''), @Sign4=IsNull(Sign4,''), @Sign5=IsNull(Sign5,''), @Sign6=IsNull(Sign6,''), 
@Sign7=IsNull(Sign7,''), @Sign8=IsNull(Sign8,''), @Sign9=IsNull(Sign9,''), @Sign10=IsNull(Sign10,'') 
from BillType where BillType=@i_BillType
set @o_BillSN=''
if @DispMac=1
set @o_BillSN = @i_MacMark + '-'
else
set @i_MacMark = ''
set @j=1
while @j<=10 
begin
select @tmpSign = case @j when 1 then @Sign1 when 2 then @Sign2
when 3 then @Sign3 when 4 then @Sign4
when 5 then @Sign5 when 6 then @Sign6
when 7 then @Sign7 when 8 then @Sign8
when 9 then @Sign9 when 10 then @Sign10
end
if @tmpSign<>''
begin
exec P_SetBillSN @i_MacMark, @i_BillType, @i_BillDate, @i_OperID, @OperCode, @Rule1, @Rule2, @Rule3, @Rule4,
@tmpSign, @i_DftOper, @tmpSN output
set @o_BillSN=@o_BillSN+@tmpSN
end
set @j=@j+1
end
if ((@i_BillSN='') and (@Rule3=0)) or (@i_BillType in (66, 67)) 
begin
exec @Result = P_SetBillCount @i_MacMark, @i_BillDate, @i_BillType, @i_OperID, @Rule1, @Rule2, @Rule3, @Rule4, @i_BillSN
if @@Error<>0 or @Result<0 return -1003
end
Success:
if (@i_BillSN = '') and (@TranSyb = 1)
begin
Commit tran GetBillSNPrc
SET TRANSACTION ISOLATION LEVEL READ COMMITTED
end
return 0
Error:
if (@i_BillSN = '') and (@TranSyb = 1)
begin
rollback tran GetBillSNPrc
SET TRANSACTION ISOLATION LEVEL READ COMMITTED
end
return -1
GO

/*
然后移动化帐套设置操作员权限(注意操作员必须有密码约不然手机上不允许登录).......

好了 大家可以试试看看效果啦
*/ 

/* 执行下面的语句可以删除刚才加的字段,也可以手工去删除增加的的字段,
删除增加的字段 ,然后执行t1 的升级脚本 不影响后续t1升级,如果不执行一下语句 有可能t1升级脚本执行不了 导致升级不成功。升级后再执行这个脚本又可以移动化
ALTER TABLE dbo.Units
DROP COLUMN UnitStatus
ALTER TABLE dbo.SalesAdv
DROP COLUMN billstate
GO

ALTER TABLE dbo.Employee DROP COLUMN
EmpStatus
GO


ALTER TABLE dbo.product DROP COLUMN
ProdStatus
GO


ALTER TABLE dbo.units DROP COLUMN
UnitStatus
GO

ALTER TABLE dbo.PeriodWarnParam DROP COLUMN
ifuse
GO
ALTER TABLE dbo.MasterBilldft DROP COLUMN
UnitAYuS
GO
ALTER TABLE dbo.MasterBilldft DROP COLUMN
UnitAYuF
GO

ALTER TABLE dbo.MasterBill DROP COLUMN
UnitAYuS
GO
ALTER TABLE dbo.MasterBill DROP COLUMN
UnitAYuF
GO

ALTER TABLE dbo.VIPCard DROP COLUMN
BirthdayType
GO

drop table [WarSetinfo]
drop table [UnitAddress]
drop table [SalesAdvUnits]
*/


更多精彩内容:
首部科技
友加畅捷

你可能感兴趣的:(T1工贸宝支持U+移动手机端)