-- 应收首页重新预置
/* 因为首页方案的历史变化原因，有些字段，例如卡片的标题，多项单据统计卡片的每一个项的标题，
这些信息没有记录在多语言表，后来记录到多语言表了。
各个应用的首页可能很早以前预置时就没有生成多语言的信息，所以现在需要重新预置。
*/

/* 由于生产环境运行一段时间后，客户可能会自行设置默认方案
截止目前（2019-07-18）客户设置的方案是会替换出厂预置的方案，也许将来客户预置方案和出厂预置会有所区分，
所以需要根据语义删除默认方案。所以预置sql中最好有以下delete语句，
注意执行顺序不能随便调，要严格按以下顺序执行，否则会出现主表数据已删，字表找不到引用记录导致删除不了的情况。
*/
DELETE from t_bas_cardconfig_l where fid in (select fid from t_bas_cardconfig where fmainpageid in(select fid from t_bas_mainpagelayout where ftype = 'app' and fbizappid = '/BBRH+122=39' and FSCHEMETYPE = '1' and fenable = '1')); 
DELETE from t_bas_cardconfig where fmainpageid in(select fid from t_bas_mainpagelayout where ftype = 'app' and fbizappid = '/BBRH+122=39' and FSCHEMETYPE = '1' and fenable = '1'); 
DELETE from t_bas_mainpagelayout_l where fid in(select fid from t_bas_mainpagelayout where ftype = 'app' and fbizappid = '/BBRH+122=39' and FSCHEMETYPE = '1' and fenable = '1'); 
DELETE from t_bas_mainpagelayout where ftype = 'app' and fbizappid = '/BBRH+122=39' and FSCHEMETYPE = '1' and fenable = '1';

-- INSERT INTO t_bas_mainpagelayout(FID, FUSERID, FTYPE, FBIZAPPID, FLAYOUT, FNUMBER, FENABLE, FCUSTOMABLE, FISPRESET, FCREATORID, FCREATETIME, FMODIFIERID, FMODIFYTIME, FDISABLERID, FDISABLETIME, FSCHEMETYPE, FMASTERID, FFORMNUM) VALUES (449791256864771072, 1, 'app', '/BBRH+122=39', '[{\"w\":12,\"h\":1,\"x\":0,\"y\":0,\"i\":\"449790840303291392\",\"moved\":false,\"static\":false},{\"w\":4,\"h\":1,\"x\":0,\"y\":1,\"i\":\"498270508085699584\",\"moved\":false,\"static\":false},{\"w\":4,\"h\":1,\"x\":4,\"y\":1,\"i\":\"498329271769524224\",\"moved\":false,\"static\":false},{\"w\":4,\"h\":1,\"x\":8,\"y\":1,\"i\":\"498332442176807936\",\"moved\":false,\"static\":false},{\"w\":4,\"h\":2,\"x\":0,\"y\":2,\"i\":\"498333514366739456\",\"moved\":false,\"static\":false},{\"w\":4,\"h\":2,\"x\":8,\"y\":2,\"i\":\"498428331692157952\",\"moved\":false,\"static\":false},{\"w\":4,\"h\":2,\"x\":4,\"y\":2,\"i\":\"499716941921912832\",\"moved\":false,\"static\":false}]', '449791256864771072', '1', '1', '1', 1, {ts'2018-08-08 18:08:08'}, 1, {ts'2018-08-08 18:08:08'}, 0, {ts'2018-08-08 18:08:08'}, '1', 0, ' ');
INSERT INTO t_bas_mainpagelayout(FID, FUSERID, FTYPE, FBIZAPPID, FLAYOUT, FNUMBER, FENABLE, FCUSTOMABLE, FISPRESET, FCREATORID, FCREATETIME, FMODIFIERID, FMODIFYTIME, FDISABLERID, FDISABLETIME, FSCHEMETYPE) VALUES (449791256864771072, 1, 'app', '/BBRH+122=39', '[{\"w\":12,\"h\":1,\"x\":0,\"y\":0,\"i\":\"449790840303291392\",\"moved\":false,\"static\":false},{\"w\":4,\"h\":1,\"x\":0,\"y\":1,\"i\":\"498270508085699584\",\"moved\":false,\"static\":false},{\"w\":4,\"h\":1,\"x\":4,\"y\":1,\"i\":\"498329271769524224\",\"moved\":false,\"static\":false},{\"w\":4,\"h\":1,\"x\":8,\"y\":1,\"i\":\"498332442176807936\",\"moved\":false,\"static\":false},{\"w\":4,\"h\":2,\"x\":0,\"y\":2,\"i\":\"498333514366739456\",\"moved\":false,\"static\":false},{\"w\":4,\"h\":2,\"x\":8,\"y\":2,\"i\":\"498428331692157952\",\"moved\":false,\"static\":false},{\"w\":4,\"h\":2,\"x\":4,\"y\":2,\"i\":\"499716941921912832\",\"moved\":false,\"static\":false}]', '449791256864771072', '1', '1', '1', 1, {ts'2018-08-08 18:08:08'}, 1, {ts'2018-08-08 18:08:08'}, 0, {ts'2018-08-08 18:08:08'}, '1');

INSERT INTO t_bas_mainpagelayout_l(FPKID, FID, FLOCALEID, FNAME) VALUES ('449791256864771072', 449791256864771072, 'zh_CN', '应收应用首页默认方案');

INSERT INTO t_bas_cardconfig(FID, FUSERID, FTYPE, FCONFIG, FMAINPAGEID, FCARDID) VALUES (738344567706792960, 0, 'bos_card_quicklaunch', '{\"cardType\":\"bos_card_quicklaunch\",\"config\":{\"/K1W1W=B3LKX\":{\"cache_sel_appId\":\"/BBRH+122=39\",\"cache_sel_menuId\":\"/K1W1W=B3LKX\",\"launchType\":\"launchType_menu\"},\"053SZM0E3O4S\":{\"cache_sel_appId\":\"/BBRH+122=39\",\"cache_sel_menuId\":\"053SZM0E3O4S\",\"launchType\":\"launchType_menu\"},\"/K1W7JWJY6N7\":{\"cache_sel_appId\":\"/BBRH+122=39\",\"cache_sel_menuId\":\"/K1W7JWJY6N7\",\"launchType\":\"launchType_menu\"},\"/K25U=JR593Y\":{\"cache_sel_appId\":\"/BBRH+122=39\",\"cache_sel_menuId\":\"/K25U=JR593Y\",\"launchType\":\"launchType_menu\"}}}', 449791256864771072, 449790840303291392);
INSERT INTO t_bas_cardconfig(FID, FUSERID, FTYPE, FCONFIG, FMAINPAGEID, FCARDID) VALUES (738344567706792961, 0, 'bos_card_billstats_list', '{\"cardType\":\"bos_card_billstats_list\",\"config\":{\"3\":{\"appnum\":null,\"datatype\":\"count\",\"filterschema\":\"0=O=/K3ESLUW\",\"scale\":\"0\",\"filterclass\":\"\",\"menuid\":null,\"entityid\":\"ar_finarbill\",\"numtitle\":\"f:customname\",\"numcolor\":\"#FF903D\"},\"4\":{\"appnum\":null,\"datatype\":\"count\",\"filterschema\":\"0=O=/UGW/PTN\",\"scale\":\"0\",\"filterclass\":\"\",\"menuid\":null,\"entityid\":\"ar_finarbill\",\"numtitle\":\"f:customname\",\"numcolor\":\"#666666\"}}}', 449791256864771072, 498270508085699584);
INSERT INTO t_bas_cardconfig(FID, FUSERID, FTYPE, FCONFIG, FMAINPAGEID, FCARDID) VALUES (738344567706792962, 0, 'bos_card_billstats_list', '{\"cardType\":\"bos_card_billstats_list\",\"config\":{\"5\":{\"appnum\":\"ar\",\"datatype\":\"count\",\"filterschema\":\"0=OAAJLUL5M2\",\"scale\":\"0\",\"filterclass\":\"kd.fi.ar.formplugin.HomeInvoice\",\"menuid\":\"/CLG3VN54WHH\",\"entityid\":\"ar_invoice\",\"numtitle\":\"f:customname\",\"numcolor\":\"#FF903D\"},\"6\":{\"appnum\":\"ar\",\"datatype\":\"count\",\"filterschema\":\"0=OAAV/5DCJL\",\"scale\":\"0\",\"filterclass\":\"kd.fi.ar.formplugin.HomeInvoice\",\"menuid\":\"/CLG3VN54WHH\",\"entityid\":\"ar_invoice\",\"numtitle\":\"f:customname\",\"numcolor\":\"#666666\"}}}', 449791256864771072, 498329271769524224);
INSERT INTO t_bas_cardconfig(FID, FUSERID, FTYPE, FCONFIG, FMAINPAGEID, FCARDID) VALUES (738344567706792963, 0, 'bos_card_billstats_list', '{\"cardType\":\"bos_card_billstats_list\",\"config\":{\"2\":{\"appnum\":null,\"datatype\":\"count\",\"filterschema\":\"0=O=02X9DIU6\",\"scale\":\"0\",\"filterclass\":\"\",\"menuid\":null,\"entityid\":\"ar_finarbill\",\"numtitle\":\"f:customname\",\"numcolor\":\"#55A0F5\"}}}', 449791256864771072, 498332442176807936);
INSERT INTO t_bas_cardconfig(FID, FUSERID, FTYPE, FCONFIG, FMAINPAGEID, FCARDID) VALUES (738344567706792964, 0, 'bos_card_custom', '{\"cardformnum\":\"ar_chart_balanceranking\",\"cardType\":\"bos_card_custom\",\"cardformname\":\"应收余额排名图表\"}', 449791256864771072, 498333514366739456);
INSERT INTO t_bas_cardconfig(FID, FUSERID, FTYPE, FCONFIG, FMAINPAGEID, FCARDID) VALUES (738344567706792965, 0, 'bos_card_custom', '{\"cardformnum\":\"ar_chart_acctage\",\"cardType\":\"bos_card_custom\",\"cardformname\":\"应收账龄分析图表\"}', 449791256864771072, 498428331692157952);
INSERT INTO t_bas_cardconfig(FID, FUSERID, FTYPE, FCONFIG, FMAINPAGEID, FCARDID) VALUES (738344567706792966, 0, 'bos_card_custom', '{\"cardformnum\":\"ar_chart_turnover\",\"cardType\":\"bos_card_custom\",\"cardformname\":\"应收账款周转率图表\"}', 449791256864771072, 499716941921912832);

INSERT INTO t_bas_cardconfig_l(FPKID, FID, FLOCALEID, FCARDTITLE, FCUSTOMNAME) VALUES ('0=OAH7HT6ZSI', 738344567706792960, 'zh_CN', '快速发起', ' ');
INSERT INTO t_bas_cardconfig_l(FPKID, FID, FLOCALEID, FCARDTITLE, FCUSTOMNAME) VALUES ('0=OAH7HT6ZSJ', 738344567706792961, 'zh_CN', '应收处理', '待提交,待审核');
INSERT INTO t_bas_cardconfig_l(FPKID, FID, FLOCALEID, FCARDTITLE, FCUSTOMNAME) VALUES ('0=OAH7HT6ZSK', 738344567706792962, 'zh_CN', '发票处理', '待提交,待审核');
INSERT INTO t_bas_cardconfig_l(FPKID, FID, FLOCALEID, FCARDTITLE, FCUSTOMNAME) VALUES ('0=OAH7HT6ZSL', 738344567706792963, 'zh_CN', '结算处理', '待结算');
INSERT INTO t_bas_cardconfig_l(FPKID, FID, FLOCALEID, FCARDTITLE, FCUSTOMNAME) VALUES ('0=OAH7HT6ZSM', 738344567706792964, 'zh_CN', '应收余额排名', ' ');
INSERT INTO t_bas_cardconfig_l(FPKID, FID, FLOCALEID, FCARDTITLE, FCUSTOMNAME) VALUES ('0=OAH7HT6ZSN', 738344567706792965, 'zh_CN', '应收账龄分析', ' ');
INSERT INTO t_bas_cardconfig_l(FPKID, FID, FLOCALEID, FCARDTITLE, FCUSTOMNAME) VALUES ('0=OAH7HT6ZSO', 738344567706792966, 'zh_CN', '应收账款周转率', ' ');

DELETE from t_bas_filterscheme where FFORMID IN ('ar_finarbill','ar_invoice');
INSERT INTO t_bas_filterscheme(FSCHEMEID, FFORMID, FSCHEMENAME, FUSERID, FISDEFAULT, FSCHEME, FISSHARE, FNEXTENTRYSCHEME, FSEQ, FENTRYENTITY, FISFIXED) VALUES ('0=O=/K3ESLUW', 'ar_finarbill', '待提交', 1, '0', 'rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAACdwQAAAACc3IAF2phdmEudXRpbC5MaW5rZWRIYXNoTWFwNMBOXBBswPsCAAFaAAthY2Nlc3NPcmRlcnhyABFqYXZhLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAx3CAAAABAAAAADdAAJRmllbGROYW1lc3EAfgAAAAAAAXcEAAAAAXQACmJpbGxzdGF0dXN4dAAHQ29tcGFyZXNxAH4AAAAAAAF3BAAAAAF0AAMxMDV4dAAFVmFsdWVzcQB+AAAAAAABdwQAAAABdAABQXh4AHNxAH4AAj9AAAAAAAAMdwgAAAAQAAAAA3EAfgAFc3EAfgAAAAAAAXcEAAAAAXQAB2JpemRhdGV4cQB+AAhzcQB+AAAAAAABdwQAAAABdAACNjN4cQB+AAtzcQB+AAAAAAABdwQAAAABdAAAeHgAeA==', '0', '0', 0, 'ar_finarbill', '1');
INSERT INTO t_bas_filterscheme(FSCHEMEID, FFORMID, FSCHEMENAME, FUSERID, FISDEFAULT, FSCHEME, FISSHARE, FNEXTENTRYSCHEME, FSEQ, FENTRYENTITY, FISFIXED) VALUES ('0=O=/UGW/PTN', 'ar_finarbill', '待审核', 1, '0', 'rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAACdwQAAAACc3IAF2phdmEudXRpbC5MaW5rZWRIYXNoTWFwNMBOXBBswPsCAAFaAAthY2Nlc3NPcmRlcnhyABFqYXZhLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAx3CAAAABAAAAADdAAJRmllbGROYW1lc3EAfgAAAAAAAXcEAAAAAXQACmJpbGxzdGF0dXN4dAAHQ29tcGFyZXNxAH4AAAAAAAF3BAAAAAF0AAMxMDV4dAAFVmFsdWVzcQB+AAAAAAABdwQAAAABdAABQnh4AHNxAH4AAj9AAAAAAAAMdwgAAAAQAAAAA3EAfgAFc3EAfgAAAAAAAXcEAAAAAXQAB2JpemRhdGV4cQB+AAhzcQB+AAAAAAABdwQAAAABdAACNjN4cQB+AAtzcQB+AAAAAAABdwQAAAABdAAAeHgAeA==', '0', '0', 0, 'ar_finarbill', '1');
INSERT INTO t_bas_filterscheme(FSCHEMEID, FFORMID, FSCHEMENAME, FUSERID, FISDEFAULT, FSCHEME, FISSHARE, FNEXTENTRYSCHEME, FSEQ, FENTRYENTITY, FISFIXED) VALUES ('0=O=02X9DIU6', 'ar_finarbill', '待结算', 1, '0', 'rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAACdwQAAAACc3IAF2phdmEudXRpbC5MaW5rZWRIYXNoTWFwNMBOXBBswPsCAAFaAAthY2Nlc3NPcmRlcnhyABFqYXZhLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAx3CAAAABAAAAADdAAJRmllbGROYW1lc3EAfgAAAAAAAXcEAAAAAXQADHNldHRsZXN0YXR1c3h0AAdDb21wYXJlc3EAfgAAAAAAAXcEAAAAAXQAAzEwNnh0AAVWYWx1ZXNxAH4AAAAAAAF3BAAAAAF0AAdzZXR0bGVkeHgAc3EAfgACP0AAAAAAAAx3CAAAABAAAAADcQB+AAVzcQB+AAAAAAABdwQAAAABdAAHYml6ZGF0ZXhxAH4ACHNxAH4AAAAAAAF3BAAAAAF0AAI2M3hxAH4AC3NxAH4AAAAAAAF3BAAAAAF0AAB4eAB4', '0', '0', 0, 'ar_finarbill', '1');
INSERT INTO t_bas_filterscheme(FSCHEMEID, FFORMID, FSCHEMENAME, FUSERID, FISDEFAULT, FSCHEME, FISSHARE, FNEXTENTRYSCHEME, FSEQ, FENTRYENTITY, FISFIXED) VALUES ('0=OAAJLUL5M2', 'ar_invoice', '待提交', 1, '0', 'rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAACdwQAAAACc3IAF2phdmEudXRpbC5MaW5rZWRIYXNoTWFwNMBOXBBswPsCAAFaAAthY2Nlc3NPcmRlcnhyABFqYXZhLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAx3CAAAABAAAAADdAAJRmllbGROYW1lc3EAfgAAAAAAAXcEAAAAAXQAB2JpemRhdGV4dAAHQ29tcGFyZXNxAH4AAAAAAAF3BAAAAAF0AAI2M3h0AAVWYWx1ZXNxAH4AAAAAAAF3BAAAAAF0AAB4eABzcQB+AAI/QAAAAAAADHcIAAAAEAAAAANxAH4ABXNxAH4AAAAAAAF3BAAAAAF0AApiaWxsc3RhdHVzeHEAfgAIc3EAfgAAAAAAAXcEAAAAAXQAAzEwNXhxAH4AC3NxAH4AAAAAAAF3BAAAAAF0AAFBeHgAeA==', '0', '0', 0, 'ar_invoice', '1');
INSERT INTO t_bas_filterscheme(FSCHEMEID, FFORMID, FSCHEMENAME, FUSERID, FISDEFAULT, FSCHEME, FISSHARE, FNEXTENTRYSCHEME, FSEQ, FENTRYENTITY, FISFIXED) VALUES ('0=OAAV/5DCJL', 'ar_invoice', '待审核', 1, '0', 'rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAACdwQAAAACc3IAF2phdmEudXRpbC5MaW5rZWRIYXNoTWFwNMBOXBBswPsCAAFaAAthY2Nlc3NPcmRlcnhyABFqYXZhLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAx3CAAAABAAAAADdAAJRmllbGROYW1lc3EAfgAAAAAAAXcEAAAAAXQAB2JpemRhdGV4dAAHQ29tcGFyZXNxAH4AAAAAAAF3BAAAAAF0AAI2M3h0AAVWYWx1ZXNxAH4AAAAAAAF3BAAAAAF0AAB4eABzcQB+AAI/QAAAAAAADHcIAAAAEAAAAANxAH4ABXNxAH4AAAAAAAF3BAAAAAF0AApiaWxsc3RhdHVzeHEAfgAIc3EAfgAAAAAAAXcEAAAAAXQAAzEwNXhxAH4AC3NxAH4AAAAAAAF3BAAAAAF0AAFCeHgAeA==', '0', '0', 0, 'ar_invoice', '1');

DELETE from t_bas_filterscheme_l where FID IN ('0=O=/K3ESLUW','0=O=/UGW/PTN','0=O=02X9DIU6','0=OAAJLUL5M2','0=OAAV/5DCJL');
INSERT INTO t_bas_filterscheme_l(FPKID, FID, FLOCALEID, FNAME, FDESCRIPTION) VALUES ('0=O=/K3ESL5M', '0=O=/K3ESLUW', 'zh_CN', '待提交', ' ');
INSERT INTO t_bas_filterscheme_l(FPKID, FID, FLOCALEID, FNAME, FDESCRIPTION) VALUES ('0=O=/UGW/P4D', '0=O=/UGW/PTN', 'zh_CN', '待审核', ' ');
INSERT INTO t_bas_filterscheme_l(FPKID, FID, FLOCALEID, FNAME, FDESCRIPTION) VALUES ('0=O=02X9DI4Y', '0=O=02X9DIU6', 'zh_CN', '待结算', ' ');
INSERT INTO t_bas_filterscheme_l(FPKID, FID, FLOCALEID, FNAME, FDESCRIPTION) VALUES ('0=OAAJLUL4YU', '0=OAAJLUL5M2', 'zh_CN', '待提交', ' ');
INSERT INTO t_bas_filterscheme_l(FPKID, FID, FLOCALEID, FNAME, FDESCRIPTION) VALUES ('0=OAAV/5DD7V', '0=OAAV/5DCJL', 'zh_CN', '待审核', ' ');