00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <iostream>
00013 #include <iomanip>
00014 #include "cgiTemplates.h"
00015 #include "connectstring"
00016 #include "forms.h"
00017 #include "ocTypes.h"
00018 #include "ocString.h"
00019 #include "read_write_base.hpp"
00020 #include "forms_base.hpp"
00021 #include "cgiTemplates.h"
00022 #include "Commission_Check.hpp"
00023 #include "openLogin.h"
00024 #include "diaButtons.h"
00025 #include "../source/commissionsReport.hpp"
00026 using namespace std;
00027 openLogin oLogin;
00028
00029 #include "sublist_base.hpp"
00030
00031
00032
00033 class Commission_Check_List: public sublist_base
00034 {
00035
00036 public:
00037 ocString Parent_Id;
00038
00039 Commission_Check_List(cgiScript&sc):sublist_base(sc){;}
00040 ~Commission_Check_List(){;}
00041
00042 bool list_display( void )
00043 {
00044 bool breturn = true;
00045 string sql = "select "
00046 "Id, "
00047 "Paid_Date, "
00048 "Check_Number "
00049 "Notes "
00050 "from Commission_Check where Affiliate = " ;
00051 sql += Parent_Id;
00052 sql += " order by Paid_Date desc";
00053
00054 hotCol=-2;
00055 editLink = listTemplate.getParagraph("peerlink");
00056 editLink = editLink.replace("$prog$","Commission_Check_Popup.cgi");
00057 string heading =
00058 "Id| "
00059 "Check Date| "
00060 "Check Number "
00061 ;
00062 emitHeadings(heading);
00063
00064 getData( sql );
00065 emitData();
00066
00067 emitEnd();
00068 return breturn;
00069 }
00070 };
00071 class Commission_Check_form: public Commission_Check_Obj, public forms_base
00072 {
00073 ocString Title;
00074 public:
00075 Commission_Check_form(cgiScript & script):Commission_Check_Obj(),forms_base(script)
00076 {
00077 setKey(*this);
00078 }
00079 virtual ~Commission_Check_form(){;}
00080
00081 void form_id_transfer( void )
00082 {
00083 llongFXfer( "Id", Id );
00084 }
00085 void form_data_transfer( void )
00086 {
00087 llongFXfer( "Affiliate", Affiliate);
00088 llongFXfer( "Promotion", Promotion);
00089 stringFXfer( "Ordered_Ids", Ordered_Ids);
00090 dateFXfer( "Paid_Date", Paid_Date);
00091 stringFXfer( "Check_Number", Check_Number);
00092 stringFXfer( "Notes", Notes);
00093 }
00094
00095 bool dbf_action( string mode, changeMap & changes )
00096 {
00097 return db_action( mode, changes );
00098 }
00099
00100
00101 bool form_display( void )
00102 {
00103 bool breturn = true;
00104 ocString sql = "select Organization_Name from Affiliate where Id = ";
00105 sql.append(Affiliate);
00106 Title = "Commission Check";
00107 if( rs.open(sql) )
00108 {
00109 Title += " for ";
00110 Title += rs.getField(0).format();
00111 rs.close();
00112 }
00113
00114 script << makeTop("Commission_Check_Popup.cgi", Title)
00115 << formTemplate.getParagraph("advanced_begin");
00116 script << makeStaticBox("Id", "Id", Id ,"8");
00117 script << "<br class='clearall'>" << endl;
00118 script << formTemplate.getParagraph("advanced_end");
00119
00120 script << makeHiddenBox("Affiliate", Affiliate );
00121
00122 script << makeHiddenBox( "Promotion", Promotion );
00123
00124 script << makeHiddenBox("Ordered_Ids", Ordered_Ids );
00125 script << makeDateBox("Paid_Date", "Paid_Date", Paid_Date ,"10");
00126 script << "<br class='clearall'>" << endl;
00127
00128 script << makeTextBox("Check_Number", "Check_Number", Check_Number ,"125","35");
00129 script << "<br class='clearall'>" << endl;
00130
00131 script << makeTextBox("Notes", "Notes", Notes ,"125","35");
00132 script << "<br class='clearall'>" << endl;
00133 if( Ordered_Ids.length() )
00134 script << diaButtons( key() ,
00135 " Create a Record of Check Payment ",
00136 "",
00137 "",
00138 "",
00139 "");
00140 if( Ordered_Ids.length() )
00141 {
00142 commissions_report rep(script, formTemplate);
00143 string filter = " odr.Id in ( ";
00144 filter += Ordered_Ids;
00145 filter += " )";
00146 rep.setFilter(filter);
00147 rep.run( Affiliate, "Order Item Detail" );
00148 }
00149 script << makeBottom( m_result ) << endl;
00150 return breturn;
00151 }
00152 };
00153
00154
00155 int main( int argcount, char ** args )
00156 {
00157 cgiScript script( "text/html", false );
00158 Commission_Check_form myFrm(script);
00159
00160 if( oLogin.testLoginStatus() )
00161 {
00162 script.closeHeader();
00163 cgiTemplates pgTemplate;
00164 pgTemplate.load("Templates/childPane.htmp");
00165
00166 script << ocString(pgTemplate.getParagraph("top"))
00167 .replaceAll("$heading$","Commission_Check");
00168
00169 myFrm.loadControlTemplates("Templates/childdivform.htmp");
00170 myFrm.form_action();
00171 myFrm.form_display();
00172 if( myFrm.Affiliate )
00173 {
00174 Commission_Check_List Commission_CheckList(script);
00175 Commission_CheckList.Parent_Id.append(myFrm.Affiliate);
00176 Commission_CheckList.loadListTemplates("Templates/spawninglist.htmp");
00177 script << "<div class=\"ui\">" << endl;
00178 script << "<div class='heading'>Commission Check List:</div>" << endl;
00179 Commission_CheckList.list_display();
00180 script << "</div>" << endl;
00181 }
00182 ocString end = pgTemplate.getParagraph("bottom");
00183 script << end;
00184 }
00185 else
00186 {
00187 script << "<html><body>"
00188 << "<a href='javascript:window.close()'><h1>You are not logged in</h1></a>"
00189 << "</body></html>" << endl;
00190 }
00191 }
00192
00193 #include "read_write_base.cpp"
00194 #include "forms_base.cpp"