BMS-HOSxP Community

HOSxP => การเขียน SQL Script => ข้อความที่เริ่มโดย: sukkla_01 ที่ พฤศจิกายน 28, 2011, 14:35:16 PM

หัวข้อ: มี Script มาฝากครับ
เริ่มหัวข้อโดย: sukkla_01 ที่ พฤศจิกายน 28, 2011, 14:35:16 PM
เป็น script สำหรับดึงค่า trx ที่หายกลับมาใช้ใหม่ โดยสามารถดึงตามวันที่ และ an 
เพื่อโรงบาลไหนนำไปใช้ประโยชน์ครับ
หัวข้อ: Re: มี Script มาฝากครับ
เริ่มหัวข้อโดย: leonet ที่ พฤศจิกายน 28, 2011, 16:29:33 PM
ใช้แล้ว OK ครับ :)
หัวข้อ: Re: มี Script มาฝากครับ
เริ่มหัวข้อโดย: Man Of Romance ที่ พฤศจิกายน 28, 2011, 18:38:52 PM
ไม่บอกวิธีใช้หน่อยหรือครับ (ก่อนหรือ หลังอาหาร)
หัวข้อ: Re: มี Script มาฝากครับ
เริ่มหัวข้อโดย: taewan ที่ พฤศจิกายน 29, 2011, 09:13:25 AM
ขอบคุณมากครับ

รบกวนสอบถาม ไม่ทราบว่า วันที่ คือ วันที่ Admit หรือ วันที่ Discharge ครับ
หัวข้อ: Re: มี Script มาฝากครับ
เริ่มหัวข้อโดย: sukkla_01 ที่ พฤศจิกายน 29, 2011, 09:47:55 AM
วิธีการใช้ครับ
จะมี 2 ส่วน คือ
1 ดึงตาม an ในกรณีที่ต้องการดึงคนเดียวครับ
2 ดึงตามช่วงเวลา ในกรณที่ต้องการดึงค่าใช้จ่าย trx หลายคน
หัวข้อ: Re: มี Script มาฝากครับ
เริ่มหัวข้อโดย: kkko ที่ ธันวาคม 15, 2011, 16:06:38 PM
ทดลองใช้จริงแล้วมันไม่ยอมดึงค่า TRX กลับมาให้ครับ ตรงสเกลไม่เห็นมันวิ่งเลยครับก็ขึ้นว่าเสร็จเรียบร้อย พอตรวจสอบดูปรากฏว่ามันไม่มีค่า TRX กลับมาครับ รบกวนแนะนำด้วยครับ
หัวข้อ: Re: มี Script มาฝากครับ
เริ่มหัวข้อโดย: มดตานอย ครับ.. ที่ มีนาคม 15, 2012, 11:03:41 AM
วิธีการใช้ครับ
จะมี 2 ส่วน คือ
1 ดึงตาม an ในกรณีที่ต้องการดึงคนเดียวครับ
2 ดึงตามช่วงเวลา ในกรณที่ต้องการดึงค่าใช้จ่าย trx หลายคน

มีวิธีติดตั้งไหมครับ
หัวข้อ: Re: มี Script มาฝากครับ
เริ่มหัวข้อโดย: niyomstd ที่ มีนาคม 15, 2012, 11:13:54 AM
 
วิธีการใช้ครับ
จะมี 2 ส่วน คือ
1 ดึงตาม an ในกรณีที่ต้องการดึงคนเดียวครับ
2 ดึงตามช่วงเวลา ในกรณที่ต้องการดึงค่าใช้จ่าย trx หลายคน

มีวิธีติดตั้งไหมครับ

http://hosxp.net/index.php?option=com_smf&Itemid=28&topic=21448.0
ตามนี้ครับ
หัวข้อ: Re: มี Script มาฝากครับ
เริ่มหัวข้อโดย: bannok ที่ ธันวาคม 26, 2012, 14:22:47 PM
เป็น script สำหรับดึงค่า trx ที่หายกลับมาใช้ใหม่ โดยสามารถดึงตามวันที่ และ an 
เพื่อโรงบาลไหนนำไปใช้ประโยชน์ครับ
ลองติดตั้งดูแล้วไม่ได้ครับ มันไม่นำเข้าให้ append แล้วก็ไม่ได้ รกวนขอโค๊ดของ script หน่อย
หัวข้อ: Re: มี Script มาฝากครับ
เริ่มหัวข้อโดย: sukkla_01 ที่ ธันวาคม 27, 2012, 11:51:12 AM
เป็น script สำหรับดึงค่า trx ที่หายกลับมาใช้ใหม่ โดยสามารถดึงตามวันที่ และ an 
เพื่อโรงบาลไหนนำไปใช้ประโยชน์ครับ
ลองติดตั้งดูแล้วไม่ได้ครับ มันไม่นำเข้าให้ append แล้วก็ไม่ได้ รกวนขอโค๊ดของ script หน่อย

souce

unit beforeDelAdmit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls;

type
  TForm1 = class(TForm)
    Edit2: TEdit;
    Label2: TLabel;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Edit3: TEdit;
    Label3: TLabel;
    pg: TProgressBar;
    procedure Button1Click(Sender: TObject);
  private

  public
    //function MessageDlgPos ( const Message : string; DialogType : TMsgDlgType; Buttons : TMsgDlgButtons; HelpContext : Longint; X, Y : Integer ) : Integer;
  end;
function MessageDlgPos ( const Message : string; DialogType : TMsgDlgType; Buttons : TMsgDlgButtons; HelpContext : Longint; X, Y : Integer ) : Integer;
var
  Form1: TForm1;
  ds1:String;           // Begin date
  ds2:String;           // End date
  C_DATE1 : String;     // Condition Date 1
  C_DATE2 : String;
   aa :string;
implementation

{$R *.dfm}
 //=============================
procedure TForm1.Button1Click(Sender: TObject);
var tc,ts:tclientdataset;  i:integer;
 begin
   if Application.MessageBox(
      'á¹èã¨ÇèÒ¨Ðà¾ÔèÁ¢ÑÍÁÙÅËÃ×ÍäÁè?',
      'CONFIRM',
      MB_YESNO Or MB_ICONQUESTION) = '6'  then
   begin
   get_initial;
   tc:=tclientdataset.create(nil);
   ts:=tclientdataset.create(nil);
   tc.data:=hosxp_getdataset('select order_no from opitemrece_trx where vstdate between "'+ds1+'" and "'+ds2+'"   and  an is not null and order_no not in (select order_no from opitemrece where vstdate between "'+ds1+'" and "'+ds2+'"   and  an is not null) ');
   pg.position:=0;
   pg.max:=tc.recordcount;
   while not tc.eof do
   begin
     //showmessage(tc.fields[0].asstring);
     hosxp_getdataset('insert into opitemrece select * from opitemrece_trx where vstdate between "'+ds1+'" and "'+ds2+'"   and  an is not null and order_no not in (select order_no from opitemrece where vstdate between "'+ds1+'" and "'+ds2+'"   and  an is not null)');
     pg.position:=pg.position+1;
     application.processmessages;
     tc.next;
   end;
   showmessage('àÃÕºÃéÍÂáÅéÇ');
   tc.free;
   ts.free;
  end;

end;
//=============================

procedure TForm1.Button2Click(Sender: TObject);
var tc,ts:tclientdataset;  i:integer;
 begin
   if Application.MessageBox(
      'á¹èã¨ÇèÒ¨Ðà¾ÔèÁ¢ÑÍÁÙÅËÃ×ÍäÁè?',
      'CONFIRM',
      MB_YESNO Or MB_ICONQUESTION) = '6'  then
   begin
    get_initial;
    tc:=tclientdataset.create(nil);
    ts:=tclientdataset.create(nil);
    tc.data:=hosxp_getdataset('select order_no,icode from opitemrece_trx where an="'+txAN.text+'"');
    pg.position:=0;
    pg.max:=tc.recordcount;
    while not tc.eof do
     begin
     //showmessage(tc.fields[0].asstring);
     hosxp_getdataset('insert into opitemrece select * from opitemrece_trx where an="'+txAN.text+'"');
     pg.position:=pg.position+1;
     application.processmessages;
     tc.next;
    end;
    showmessage('àÃÕºÃéÍÂáÅéÇ');
    tc.free;
    ts.free;
  end;


end;

procedure get_initial;
begin
  ds1 := formatdatetime('yyyy-mm-dd', cxdateedit1.date);  // Set ds1 = dateedit1
  ds2 := formatdatetime('yyyy-mm-dd', cxdateedit2.date);  // Set ds2 = dateedit2
  //linelimit := txLimit.Text;    // set linelimit
  //C_MESSAGE := '';
  // set date state
  //showmessage(ds1);
end;
end.



DFM

object Form1: TForm1
  Left =100
  Top = 100
  Caption = 'Script ´Ö¤èÒ TRX ¡ÅѺÁÒãªéãËÁè '
  ClientHeight = 492
  ClientWidth = 567
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  Position = poScreenCenter
  PixelsPerInch = 96
  TextHeight = 13
  object JvNavPanelHeader1: TJvNavPanelHeader
    Left = 0
    Top = 0
    Width = 839
    Height = 40
    Align = alTop
    Caption = ''
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWhite
    Font.Height = -16
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
    ImageIndex = 0
  end
  object SeSkinPanel2: TSeSkinPanel
    Left = 0
    Top = 43
    Width = 839
    Height = 101
    Performance = kspNoBuffer
    Transparent = False
    Align = alTop
    AnimateRoll = False
    BevelWidth = 1
    BorderWidth = 3
    ButtonKind = pbkRoll
    Caption = '  ÊÒÁÒáÓ˹´à×è͹ä¢àÅ×Í¡ªèÇÇѹ·ÕèÁÒÃѺºÃÔ¡ÒÃä´é'
    Rolled = False
    ParentRoll = False
    ShowBevel = True
    ShowButton = True
    ShowCaption = True
    SkinObject = 'Panel'
    ExplicitWidth = 634
    NormalHeight = {00000000}


  object Label2: TLabel
    Left = 70
    Top = 60
    Width = 50
    Height = 18
    Caption = 'µÑéáµèÇѹ·Õè'
  end
  object LbAN: TLabel
    Left = 45
    Top = 30
    Width = 50
    Height = 18
    Caption = 'AN ·ÕèµéÍ¡ÒôÖ'
  end
  object Lbto: TLabel
    Left = 250
    Top = 60
    Width = 50
    Height = 18
    Caption = 'Ö'
  end
  object cxDateEdit1: TcxDateEdit
      Left = 140
      Top = 55
      TabOrder = 1
      Width = 100
    end
    object cxDateEdit2: TcxDateEdit
      Left = 280
      Top = 55
      TabOrder = 1
      Width = 100
    end
    object txAN: TEdit
    Left = 140
    Top = 25
    Width = 70
    Height = 31
    TabOrder = 10
    Text = '123456789'
  end
  end
  object Button1: TButton
    Left = 80
    Top = 290
    Width = 393
    Height = 73
    Caption = ' ´Ö TRX ¡ÅѺÁÒãªéãËÁè µÒÁÇѹ·Õè'
    TabOrder = 2
    OnClick = Button1Click
  end
   object Button2: TButton
    Left = 80
    Top = 180
    Width = 393
    Height = 73
    Caption = ' ´Ö TRX ¡ÅѺÁÒãªéãËÁè µÒÁ AN  '
    TabOrder = 2
    OnClick = Button2Click
  end
  object pg: TProgressBar
    Left = 80
    Top = 400
    Width = 393
    Height = 17
    TabOrder = 6
  end
end