Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

pr_settlement_list.h

Go to the documentation of this file.
00001 /*
00002  * $Id: pr_settlement_list.h,v 1.11 2003/02/27 12:32:42 svolokitina Exp $
00003  *
00004  */
00005 
00006 #ifndef pr_settlement_list_h 
00007 #define pr_settlement_list_h
00008 
00009 #include <functional>
00010 #include <list>
00011 #include <string.h>
00012 #include <dsDocument.h>
00013 
00014 using namespace std;
00015 
00016 #include <dsSQLWrapper.h>
00017 
00018 class pr_settlement_list_rset : public dsSQLRset
00019 {
00020 public:
00021     int      Slip_No;
00022     char     Amount[20];
00023     char     Card_No[32];
00024     int      Card_Type;
00025     char     Exp_Date[5];
00026     char     Auth_Code[10];
00027     char     Reference_No[255];
00028     char     Curr_Code[5];
00029     int      Acquirer_ID;
00030     int      Issue_ID;
00031     int      Assist_ID;
00032     int      Proc_Date;
00033     int      Trans_Date;
00034     int      Trans_Type;
00035     char     Spec_Data[255];
00036     int      Bill_Date;
00037     
00038     
00039     virtual void Dump(ostream& os)
00040     {
00041         os << "Slip_No      : '" << Slip_No         << endl;
00042         os << "Amount       : '" << Amount          << endl;
00043         os << "Card_No      : '" << Card_No         << endl;
00044         os << "Card_Type    : '" << Card_Type       << endl;
00045         os << "Exp_Date     : '" << Exp_Date        << endl;
00046         os << "Auth_Code    : '" << Auth_Code       << endl;
00047         os << "Reference_No : '" << Reference_No    << endl;
00048         os << "Curr_Code    : '" << Curr_Code       << endl;
00049         os << "Acquirer_ID  : '" << Acquirer_ID     << endl;
00050         os << "Issue_ID     : '" << Issue_ID        << endl;
00051         os << "Assist_ID    : '" << Assist_ID       << endl;
00052         os << "Proc_Date    : '" << Proc_Date       << endl;
00053         os << "Trans_Date   : '" << Trans_Date      << endl;
00054         os << "Trans_Type   : '" << Trans_Type      << endl;
00055         os << "Spec_Data    : '" << Spec_Data       << endl;
00056         os << "Bill_Date    : '" << Bill_Date       << endl;
00057     }
00058     
00059     void Define(dsCT *d, CS_COMMAND *cmd)
00060     {
00061         d->BindParam(cmd,1,     &Slip_No                            );
00062         d->BindParam(cmd,2,     Amount,         sizeof(Amount)      );
00063         d->BindParam(cmd,3,     Card_No,        sizeof(Card_No)     );
00064         d->BindParam(cmd,4,     &Card_Type                          );
00065         d->BindParam(cmd,5,     Exp_Date,       sizeof(Exp_Date)    );
00066         d->BindParam(cmd,6,     Auth_Code,      sizeof(Auth_Code)   );
00067         d->BindParam(cmd,7,     Reference_No,   sizeof(Reference_No));
00068         d->BindParam(cmd,8,     Curr_Code,      sizeof(Curr_Code)   );
00069         d->BindParam(cmd,9,     &Acquirer_ID                        );
00070         d->BindParam(cmd,10,    &Issue_ID                           );
00071         d->BindParam(cmd,11,    &Assist_ID                          );
00072         d->BindParam(cmd,12,    &Proc_Date                          );
00073         d->BindParam(cmd,13,    &Trans_Date                         );
00074         d->BindParam(cmd,14,    &Trans_Type                         );
00075         d->BindParam(cmd,15,    Spec_Data,      sizeof(Spec_Data)   );
00076         d->BindParam(cmd,16,    &Bill_Date                          );
00077     }
00078 
00079     pr_settlement_list_rset(pr_settlement_list_rset *rs)
00080     {
00081         Slip_No =           rs->Slip_No     ;
00082         strcpy(Amount,      rs->Amount      );
00083         strcpy(Card_No,     rs->Card_No     );
00084         Card_Type =         rs->Card_Type   ;
00085         strcpy(Exp_Date,    rs->Exp_Date    );
00086         strcpy(Auth_Code,   rs->Auth_Code   );
00087         strcpy(Reference_No,rs->Reference_No);
00088         strcpy(Curr_Code,   rs->Curr_Code   );
00089         Acquirer_ID =       rs->Acquirer_ID ;
00090         Issue_ID =          rs->Issue_ID    ;
00091         Assist_ID =         rs->Assist_ID   ;
00092         Proc_Date  =        rs->Proc_Date   ;
00093         Trans_Date =        rs->Trans_Date  ;
00094         Trans_Type =        rs->Trans_Type  ;
00095         strcpy(Spec_Data,   rs->Spec_Data   );
00096         Bill_Date  =        rs->Bill_Date   ;
00097     }
00098     
00099     pr_settlement_list_rset()
00100     { 
00101         
00102         Slip_No = 0;
00103         memset(Amount,      0,  sizeof(Amount)      );
00104         memset(Card_No,     0,  sizeof(Card_No)     );
00105         Card_Type= 0;
00106         memset(Exp_Date,    0,  sizeof(Exp_Date)    );
00107         memset(Auth_Code,   0,  sizeof(Auth_Code)   );
00108         memset(Reference_No,0,  sizeof(Reference_No));
00109         memset(Curr_Code,   0,  sizeof(Curr_Code)   );
00110         Acquirer_ID = 0;
00111         Issue_ID = 0;
00112         Assist_ID = 0;
00113         Proc_Date =  0;
00114         Trans_Date = 0;
00115         Trans_Type = 0;
00116         memset(Spec_Data,   0,  sizeof(Spec_Data)   );
00117         Bill_Date  = 0;
00118     }
00119 
00120 };
00121 
00122 class pr_settlement_list : public pr_settlement_list_rset //dsSPListWrapper 
00123 {
00124 
00125 public:
00126     int     ProcessingSystem_ID;
00127     char    FromDate[9];
00128     char    ToDate[9];
00129     char    BillDate[9];
00130 
00131     list<pr_settlement_list_rset> _lst;
00132        
00133     void execute(dsCT *pg)
00134     {
00135     
00136         CS_COMMAND     *cmd;         
00137         pr_settlement_list_rset rs;
00138         
00139         char query[] = "AssistBuild..RP_ProcessingTransaction";
00140         
00141         cmd = pg->PrepareCall(query);
00142         pg->SetParam(cmd, "@ProcessingSystem_ID",   ProcessingSystem_ID    );
00143         pg->SetParam(cmd, "@FromDate",              FromDate,           8  );
00144         pg->SetParam(cmd, "@ToDate",                ToDate,             8  );
00145         pg->SetParam(cmd, "@BillDate",              BillDate,           8  );
00146     
00147       
00148         pg->Execute(cmd);
00149         rs.Define(pg, cmd);
00150             
00151         while(pg->Fetch(cmd)== CS_SUCCEED)
00152         {
00153             rs.Dump(cout);
00154             _lst.push_back(new pr_settlement_list_rset(rs));
00155         }
00156         
00157         pg->ReleaseCall(cmd);
00158     }
00159 
00160 
00161     void getXML(dsDocument *d)
00162     {
00163         list<pr_settlement_list_rset>::iterator iter;
00164 
00165         d->createDocumentHeader("1.0","windows-1251");
00166 
00167         dsElement *datapacket = d->createElement("DATAPACKET");
00168         datapacket ->setAttribute("version", "1.0");
00169         d->appendChild((dsNode *) datapacket);
00170         
00171         dsElement *metadata = d->createElement("METADATA");
00172         datapacket->appendChild(metadata);
00173         
00174         dsElement *fields = d->createElement("FIELDS");
00175         metadata->appendChild(fields);
00176         
00177         dsElement *field;
00178         field = d->createElement("FIELD");
00179         field ->setAttribute("attrname", "Slip_No");
00180         field ->setAttribute("fieldtype", "i4");
00181         fields->appendChild(field);
00182         
00183         field = d->createElement("FIELD");
00184         field ->setAttribute("attrname", "Amount");
00185         field ->setAttribute("fieldtype", "r8");
00186         fields->appendChild(field);
00187 
00188         field = d->createElement("FIELD");
00189         field ->setAttribute("attrname", "Card_No");
00190         field ->setAttribute("fieldtype", "string");
00191         field ->setAttribute("WIDTH", "32");
00192         fields->appendChild(field);
00193 
00194         field = d->createElement("FIELD");
00195         field ->setAttribute("attrname", "Card_Type");
00196         field ->setAttribute("fieldtype", "i4");
00197         fields->appendChild(field);
00198 
00199         field = d->createElement("FIELD");
00200         field ->setAttribute("attrname", "Exp_Date");
00201         field ->setAttribute("fieldtype", "string");
00202         field ->setAttribute("WIDTH", "4");
00203         fields->appendChild(field);
00204 
00205         field = d->createElement("FIELD");
00206         field ->setAttribute("attrname", "Auth_Code");
00207         field ->setAttribute("fieldtype", "string");
00208         field ->setAttribute("WIDTH", "10");
00209         fields->appendChild(field);
00210 
00211         field = d->createElement("FIELD");
00212         field ->setAttribute("attrname", "Reference_No");
00213         field ->setAttribute("fieldtype", "string");
00214         field ->setAttribute("WIDTH", "10");
00215         fields->appendChild(field);
00216 
00217         field = d->createElement("FIELD");
00218         field ->setAttribute("attrname", "Curr_Code");
00219         field ->setAttribute("fieldtype", "string");
00220         field ->setAttribute("WIDTH", "4");
00221         fields->appendChild(field);
00222 
00223         field = d->createElement("FIELD");
00224         field ->setAttribute("attrname", "Acquirer_ID");
00225         field ->setAttribute("fieldtype", "i4");
00226         fields->appendChild(field);
00227 
00228         field = d->createElement("FIELD");
00229         field ->setAttribute("attrname", "Issue_ID");
00230         field ->setAttribute("fieldtype", "i4");
00231         fields->appendChild(field);
00232 
00233         field = d->createElement("FIELD");
00234         field ->setAttribute("attrname", "Assist_ID");
00235         field ->setAttribute("fieldtype", "i4");
00236         fields->appendChild(field);
00237 
00238         field = d->createElement("FIELD");
00239         field ->setAttribute("attrname", "Proc_Date");
00240         field ->setAttribute("fieldtype", "date");
00241         fields->appendChild(field);
00242 
00243         field = d->createElement("FIELD");
00244         field ->setAttribute("attrname", "Trans_Date");
00245         field ->setAttribute("fieldtype", "date");
00246         fields->appendChild(field);
00247 
00248         field = d->createElement("FIELD");
00249         field ->setAttribute("attrname", "Trans_Type");
00250         field ->setAttribute("fieldtype", "i2");
00251         fields->appendChild(field);
00252 
00253         field = d->createElement("FIELD");
00254         field ->setAttribute("attrname", "Spec_Data");
00255         field ->setAttribute("fieldtype", "string");
00256         field ->setAttribute("WIDTH", "255");
00257         fields->appendChild(field);
00258 
00259         field = d->createElement("FIELD");
00260         field ->setAttribute("attrname", "Bill_Date");
00261         field ->setAttribute("fieldtype", "date");
00262         fields->appendChild(field);
00263 
00264         dsElement *rowdata = d->createElement("ROWDATA");
00265         datapacket->appendChild(rowdata);
00266 
00267         for (iter = _lst.begin(); iter != _lst.end(); ++iter)
00268         {
00269             dsElement *row = d->createElement("ROW");
00270             row ->setAttribute("Slip_No",       (iter)->Slip_No     );
00271             row ->setAttribute("Amount",        (iter)->Amount      );
00272             row ->setAttribute("Card_No",       (iter)->Card_No     );
00273             row ->setAttribute("Card_Type",     (iter)->Card_Type   );
00274             row ->setAttribute("Exp_Date",      (iter)->Exp_Date    );
00275             row ->setAttribute("Auth_Code",     (iter)->Auth_Code   );
00276             row ->setAttribute("Reference_No",  (iter)->Reference_No);
00277             row ->setAttribute("Curr_Code",     (iter)->Curr_Code   );
00278             row ->setAttribute("Acquirer_ID",   (iter)->Acquirer_ID );
00279             row ->setAttribute("Issue_ID",      (iter)->Issue_ID    );
00280             row ->setAttribute("Assist_ID",     (iter)->Assist_ID   );
00281             row ->setAttribute("Proc_Date",     (iter)->Proc_Date   );
00282             row ->setAttribute("Trans_Date",    (iter)->Trans_Date  );
00283             row ->setAttribute("Trans_Type",    (iter)->Trans_Type  );
00284             row ->setAttribute("Spec_Data",     (iter)->Spec_Data   );
00285             row ->setAttribute("Bill_Date",     (iter)->Bill_Date   );
00286             
00287             rowdata->appendChild(row);
00288         }
00289         
00290     }
00291 
00292     pr_settlement_list (int x_ProcessingSystem_ID, char *x_FromDate, char *x_ToDate, char *x_BillDate)
00293     {
00294        ProcessingSystem_ID =   x_ProcessingSystem_ID; 
00295        strcpy(FromDate,        x_FromDate            );
00296        strcpy(ToDate,          x_ToDate              );
00297        strcpy(BillDate,        x_BillDate            );
00298 
00299     }
00300 
00301 };
00302 
00303 
00304 
00305 class SettlementsCompare : greater <pr_settlement_list_rset>
00306 {
00307 public:
00308     bool operator()
00309     (
00310         const pr_settlement_list_rset& _left,
00311         const pr_settlement_list_rset& _right
00312      )
00313     {
00314         return _left.Trans_Date < _right.Trans_Date;
00315     }
00316 
00317 };
00318 
00319 
00320 #endif

Generated on Mon May 16 18:26:58 2005 for libdms4 by doxygen1.3-rc2