📄 balanceofpayment.cpp
字号:
#include "stdafx.h"
#include "BalanceOfPayment.h"
using namespace FAP;
//For Excel
#using <mscorlib.dll>
//#using "Office\11.0.0.0__71e9bce111e9429c\Office.dll"
//#using "Microsoft.Office.Interop.Excel\11.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll"
//#using "Microsoft.Vbe.Interop\11.0.0.0__71e9bce111e9429c\Microsoft.Vbe.Interop.dll"
using namespace System;
//using namespace System::Diagnostics;
using namespace System::Reflection;
using namespace Microsoft::Office::Core;
using namespace Microsoft::Office::Interop;
//begin //add by DongZhaoLiang in 2006/4/27
void BalanceOfPayment::InitComoboxYear(void)
{
DateTime dtNow;
dtNow = DateTime::Now;
comboBoxYear->Items->Add(String::Format("{0}", __box(dtNow.Year )));
comboBoxYear->Items->Add(String::Format("{0}", __box(dtNow.Year-1)));
comboBoxYear->Items->Add(String::Format("{0}", __box(dtNow.Year-2)));
comboBoxYear->Items->Add(String::Format("{0}", __box(dtNow.Year-3)));
}
//end //add by DongZhaoLiang in 2006/4/27
void BalanceOfPayment::InitDisp(void)
{
//Initialize Period ComboBox
InitPeriod(0);
//*******begin******* //add by DongZhaoLiang in 2006/4/27
//Initialize ComoboxYear
InitComoboxYear();
//Select Default
comboBoxYear->SelectedIndex = 0;
//******end *********//add by DongZhaoLiang in 2006/4/27
comboBoxPType->SelectedIndex = 0;
comboBoxPeriod->SelectedIndex = 0;
}
//******* begin ***************************//
//* change by DongZhaoLiang in 2006/4/27 *
//******* begin *******************************//
//void BalanceOfPayment::InitPeriod(int iPType)
//{
// DateTime dtNow;
// int i;
//
// comboBoxPeriod->Items->Clear();
// switch(iPType){
// case 0:
//
// dtNow = DateTime::Now;
// comboBoxPeriod->Items->Add(String::Format("{0}", __box(dtNow.Year )));
// comboBoxPeriod->Items->Add(String::Format("{0}", __box(dtNow.Year-1)));
// break;
//
//
// case 1:
// for(i = 0; i < 2; i++){
// comboBoxPeriod->Items->Add(oInf->saG_Half[iLanguage, i]);
// }
// break;
// case 2:
// for(i = 0; i < 4; i++){
// comboBoxPeriod->Items->Add(oInf->saG_Quarter[iLanguage, i]);
// }
// break;
// default:
// for(i = 0; i < 12; i++){
// comboBoxPeriod->Items->Add(oInf->saG_Month[iLanguage, i]);
// }
// }
// comboBoxPeriod->SelectedIndex = 0;
//}
void BalanceOfPayment::InitPeriod(int iPType)
{
DateTime dtNow;
int i;
comboBoxPeriod->Items->Clear();
switch(iPType){
case 0:
comboBoxPeriod->Items->Add(String::Format("{0}", S" "));
comboBoxPeriod->Enabled=false;
break;
case 1:
for(i = 0; i < 2; i++){
comboBoxPeriod->Items->Add(oInf->saG_Half[iLanguage, i]);
}
comboBoxPeriod->Enabled=true;
break;
case 2:
for(i = 0; i < 4; i++){
comboBoxPeriod->Items->Add(oInf->saG_Quarter[iLanguage, i]);
}
comboBoxPeriod->Enabled=true;
break;
default:
for(i = 0; i < 12; i++){
comboBoxPeriod->Items->Add(oInf->saG_Month[iLanguage, i]);
comboBoxPeriod->Enabled=true;
}
}
comboBoxPeriod->SelectedIndex = 0;
}
//*******end*******************************//
//* change by DongZhaoLiang in 2006/4/27 *
//*******end*******************************//
void BalanceOfPayment::InitGrid(void)
{
MargeDataGridTextBoxColumn *oDivision;
MargeDataGridTextBoxColumn *oSection;
MargeDataGridTextBoxColumn *oProcess;
DataGridTextBoxColumn *oProcessCode;
DataGridTextBoxColumn *oSellingPrice;
DataGridTextBoxColumn *oPriceCost;
DataGridTextBoxColumn *oQuantity;
DataGridTextBoxColumn *oTotalManDay;
DataGridTextBoxColumn *oManCost;
DataGridTextBoxColumn *oLossCost;
oDataSet = new DataSet();
oTableStyle = new DataGridTableStyle();
oTableStyle->MappingName = S"GridData";
oTableStyle->AllowSorting = false;
//Division
oDivision = new MargeDataGridTextBoxColumn();
oDivision->MappingName = S"DIVISION";
oDivision->HeaderText = oInf->saG_Division[iLanguage];
oDivision->Alignment = HorizontalAlignment::Center;
oDivision->Width = 100;
//Section
oSection = new MargeDataGridTextBoxColumn();
oSection->MappingName = S"SECTION";
oSection->HeaderText = oInf->saG_Section[iLanguage];
oSection->Alignment = HorizontalAlignment::Center;
oSection->Width = 140;
//Process
oProcess = new MargeDataGridTextBoxColumn();
oProcess->MappingName = S"PROCESS";
oProcess->HeaderText = oInf->saG_ProcessName[iLanguage];
oProcess->Alignment = HorizontalAlignment::Center;
oProcess->Width = 145;
//Process Code
oProcessCode = new DataGridTextBoxColumn();
oProcessCode->MappingName = S"PROCESS_NO";
oProcessCode->HeaderText = oInf->saG_StrArrayProcessNum[iLanguage];
oProcessCode->Alignment = HorizontalAlignment::Center;
oProcessCode->Width = 70;
//Selling Price
oSellingPrice = new DataGridTextBoxColumn();
oSellingPrice->MappingName = S"SELLING_PRICE";
oSellingPrice->HeaderText = oInf->saG_SellingPrice[iLanguage];
oSellingPrice->Alignment = HorizontalAlignment::Center;
oSellingPrice->Width = 90;
//Price Cost
oPriceCost = new DataGridTextBoxColumn();
oPriceCost->MappingName = S"PRICE_COST";
oPriceCost->HeaderText = oInf->saG_PriceCost[iLanguage];
oPriceCost->Alignment = HorizontalAlignment::Center;
oPriceCost->Width = 90;
//Quantity
oQuantity = new DataGridTextBoxColumn();
oQuantity->MappingName = S"QUANTITY";
oQuantity->HeaderText = oInf->saG_ProductQuantity[iLanguage];
oQuantity->Alignment = HorizontalAlignment::Center;
oQuantity->Width = 90;
//Total Man/Day
oTotalManDay = new DataGridTextBoxColumn();
oTotalManDay->MappingName = S"TOTAL_MAN_DAY";
oTotalManDay->HeaderText = oInf->saG_TotalM_D[iLanguage];
oTotalManDay->Alignment = HorizontalAlignment::Center;
oTotalManDay->Width = 90;
//Man Cost
oManCost = new DataGridTextBoxColumn();
oManCost->MappingName = S"MAN_COST";
oManCost->HeaderText = oInf->saG_ManCost[iLanguage];
oManCost->Alignment = HorizontalAlignment::Center;
oManCost->Width = 90;
//Loss Cost
oLossCost = new DataGridTextBoxColumn();
oLossCost->MappingName = S"LOSS_COST";
oLossCost->HeaderText = oInf->saG_LossCost[iLanguage];
oLossCost->Alignment = HorizontalAlignment::Center;
oLossCost->Width = 90;
oTableStyle->GridColumnStyles->Add(oDivision);
oTableStyle->GridColumnStyles->Add(oSection);
oTableStyle->GridColumnStyles->Add(oProcess);
oTableStyle->GridColumnStyles->Add(oProcessCode);
oTableStyle->GridColumnStyles->Add(oSellingPrice);
oTableStyle->GridColumnStyles->Add(oPriceCost);
oTableStyle->GridColumnStyles->Add(oQuantity);
oTableStyle->GridColumnStyles->Add(oTotalManDay);
oTableStyle->GridColumnStyles->Add(oManCost);
oTableStyle->GridColumnStyles->Add(oLossCost);
oTableStyle->RowHeadersVisible = false;
dataGridBalance->TableStyles->Add(oTableStyle);
}
void BalanceOfPayment::GetGridData(void)
{
double dSumSellingPrice = 0;
double dSumPriceCost = 0;
double dSumQuantity = 0;
double dSumTotalManDay = 0;
double dSumManCost = 0;
double dSumLossCost = 0;
int i, iRecCnt;
String* sSQL = S"";
String* saLang[] = {S"C", S"J", S"E"};
String* sSYear;
String* sEYear;
String* sSMonth;
String* sEMonth;
//********begin ********//change by DongZhaoLiang in 2006/4/27
/*int iaSYe[4][12] = {{-1,-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};*/
int iaSYe[4][12] = {{-1,-2, -3, -4, -5,-6,-7, -8, -9, -10, -11, -12},
{-1,-2, -3, -4, -5,-6,-7, -8, -9, -10, -11, -12},
{-1,-2, -3, -4, -5,-6,-7, -8, -9, -10, -11, -12},
{-1,-2, -3, -4, -5,-6,-7, -8, -9, -10, -11, -12}};
/*int iaEYe[4][12] = {{ 0,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -