<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Kimi's NutShell

    我荒廢的今日,正是昨日殞身之人祈求的明日

    BlogJava 新隨筆 管理
      141 Posts :: 0 Stories :: 75 Comments :: 0 Trackbacks

    Create Or Replace Package Body Check_Pos_Sales Is

    ?/*
    ? TODO: owner="Administrator" created="2006-4-21"
    ? text="cell procedure"
    ? */
    ?Procedure Exec_Menology_Zsalebymonth(p_Brand In Varchar2, p_Branch In Varchar2, p_Yearid In Varchar2,
    ??????????????????? p_Monthid In Varchar2) Is
    ??Sales?? Number;
    ??Flag??? Number;
    ??Str_Sql Varchar2(1000);
    ??v_Customer_Cc1 Constant Varchar2(20) := 'DP';
    ??v_Customer_Cc2 Constant Varchar2(20) := 'mm';
    ??v_Customer_Cc3 Constant Varchar2(20) := 'yyyy';
    ??-- v_Customer_Cc4 Constant Varchar2(40) := 'yyyy-mm-dd hh24:mi:ss';
    ?
    ?Begin
    ?
    ??Flag := 0;
    ??Select Count(*)
    ??Into Flag
    ??From Dpdt.Menology Ec
    ??Where Ec.Brand = p_Brand And Ec.Branch = p_Branch And Ec.Yearid = p_Yearid And Ec.Monthid = p_Monthid;
    ?
    ??If (Flag = 1) Then
    ???Str_Sql := 'Update dpdt.menology w Set w.seqid=portsequence.nextval ,w.monthsale=(Select Nvl(Sum(Sprc), 0) From? ' ||
    ???????? p_Branch || '.Zsale T1 Where To_Char(T1.Sdate,' || '''' || v_Customer_Cc2 || '''' || ') Like ' || '''' ||
    ???????? p_Monthid || '''' || ' and To_Char(T1.Sdate,' || '''' || v_Customer_Cc3 || '''' || ') Like ' || '''' ||
    ???????? p_Yearid || '''' || '), w.updated_time= sysdate? where w.branch like ' || '''' || p_Branch || '''' ||
    ???????? ' and w.brand like ' || '''' || p_Brand || '''' || ' and w.yearid =' || '''' || p_Yearid || '''' ||
    ???????? ' and w.monthid=' || '''' || p_Monthid || '''' || '';
    ??Elsif (Flag = 0) Then
    ???Str_Sql := 'Insert into dpdt.menology values(Portsequence.Nextval, ' || '''' || p_Brand || '''' || ', ' || '''' ||
    ???????? p_Branch || '''' || ', ' || '''' || p_Yearid || '''' || ', ' || '''' || p_Monthid || '''' ||
    ???????? ' ,(Select Nvl(Sum(Sprc), 0) From? ' || p_Branch || '.Zsale T1 Where To_Char(T1.Sdate,' || '''' ||
    ???????? v_Customer_Cc2 || '''' || ') Like ' || '''' || p_Monthid || '''' || ' and To_Char(T1.Sdate,' || '''' ||
    ???????? v_Customer_Cc3 || '''' || ') Like ' || '''' || p_Yearid || '''' || '),sysdate,sysdate)';
    ??End If;
    ??Execute Immediate Str_Sql;
    ??Commit;
    ?Exception
    ??When Others Then
    ???Dbms_Output.Put_Line(Sqlerrm);
    ???Rollback;
    ??
    ?End Exec_Menology_Zsalebymonth;

    ?/*
    ? TODO: owner="Administrator" created="2006-4-21"
    ? text="job procedure"
    ? */
    ?Procedure Exec_Menology_Actionjob Is
    ?
    ??Cursor C1 Is
    ???Select Name From Pos_Db_User Group By Name;
    ?
    ?Begin
    ??For V1 In C1 Loop
    ???Exec_Menology_Zsalebymonth(Substr(V1.Name, 1, 2), V1.Name, To_Char(Sysdate, 'yyyy'), To_Char(Sysdate, 'mm'));
    ???Exec_Menology_Zsalebymonth(Substr(V1.Name, 1, 2), V1.Name, To_Char(Add_Months(Sysdate, -1), 'yyyy'),
    ???????????????? To_Char(Add_Months(Sysdate, -1), 'mm'));
    ??
    ??End Loop;
    ??Commit;
    ?Exception
    ??When Others Then
    ???Dbms_Output.Put_Line(Sqlerrm);
    ???Rollback;
    ?End Exec_Menology_Actionjob;

    ?Procedure Exec_Meters_Jobs Is
    ??Flag???????? Number;
    ??Flag2??????? Number;
    ??Yearsale???? Number;
    ??Lastyearsale Number;
    ?Begin
    ??Select Sum(Monthsale) Into Yearsale From Dpdt.Menology Where Yearid = To_Char(Sysdate, 'yyyy');
    ??Select Sum(Monthsale)
    ??Into Lastyearsale
    ??From Dpdt.Menology
    ??Where Yearid = To_Char(Add_Months(Sysdate, -12), 'yyyy');
    ??Flag := 0;
    ??Select Count(*) Into Flag From Dpdt.Meters t Where t.Saletype = 'FINISH' And t.Yearid = To_Char(Sysdate, 'yyyy');
    ??If (Flag = 1) Then
    ???Update Dpdt.Meters t
    ???Set t.Salesum = Yearsale, t.Updated_Time = Sysdate, t.Seqid = Portsequence.Nextval
    ???Where t.Saletype = 'FINISH' And t.Yearid = To_Char(Sysdate, 'yyyy');
    ??Elsif (Flag = 0) Then
    ???Insert Into Dpdt.Meters
    ???Values
    ????(Portsequence.Nextval, 'FINISH', Yearsale, To_Char(Sysdate, 'yyyy'), Sysdate, Sysdate);
    ??End If;
    ?
    ??Flag2 := 0;
    ??Select Count(*)
    ??Into Flag2
    ??From Dpdt.Meters t
    ??Where t.Saletype = 'FINISH' And t.Yearid = To_Char(Add_Months(Sysdate, -12), 'yyyy');
    ??If (Flag2 = 1) Then
    ???Update Dpdt.Meters t
    ???Set t.Salesum = Lastyearsale, t.Updated_Time = Sysdate, t.Seqid = Portsequence.Nextval
    ???Where t.Saletype = 'FINISH' And t.Yearid = To_Char(Add_Months(Sysdate, -12), 'yyyy');
    ??Elsif (Flag2 = 0) Then
    ???Insert Into Dpdt.Meters
    ???Values
    ????(Portsequence.Nextval, 'FINISH', Lastyearsale, To_Char(Add_Months(Sysdate, -12), 'yyyy'), Sysdate, Sysdate);
    ??End If;
    ??Commit;
    ?Exception
    ??When Others Then
    ???Dbms_Output.Put_Line(Sqlerrm);
    ???Rollback;
    ?End Exec_Meters_Jobs;

    End Check_Pos_Sales;

    posted on 2006-04-21 16:40 Kimi 閱讀(113) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導航:
     
    主站蜘蛛池模板: 国产免费看JIZZ视频| 今天免费中文字幕视频| 永久免费av无码网站韩国毛片| 亚洲成色999久久网站| 久久国产精品免费专区| 久久亚洲AV午夜福利精品一区| 国产免费拔擦拔擦8X高清在线人| 国产偷v国产偷v亚洲高清| 久久免费精品一区二区| 亚洲avav天堂av在线不卡| 永久免费视频网站在线观看| 亚洲码在线中文在线观看| 久久午夜免费视频| 亚洲 日韩经典 中文字幕| 在线观着免费观看国产黄| 黄色网址在线免费观看| 亚洲人成精品久久久久| 国产成人无码区免费网站| 亚洲一本综合久久| 毛片A级毛片免费播放| 亚洲AV无码一区二区三区网址| 免费大黄网站在线看| 9久热精品免费观看视频| 亚洲精品人成在线观看| 女性无套免费网站在线看| 免费播放国产性色生活片| 亚洲热线99精品视频| 黄页网站在线看免费| 国产精品亚洲综合| 亚洲a在线视频视频| 久久久久久久久免费看无码| 一级毛片免费播放男男| 亚洲男人天堂2017| 国产极品粉嫩泬免费观看| a级毛片免费完整视频| 亚洲综合色区中文字幕| 亚洲精品无码av天堂| **一级毛片免费完整视| 美女视频黄频a免费大全视频| 亚洲精品高清视频| 亚洲精品久久久www|