Sunday, April 30, 2006

Minimalist XML. Formula Script Generator

i created this XML to avoid creating database for sql server script generator, this would simplify adding formula to summary tables. code generator is written in c#, c#'s literal string are way too cool for this task :)


<?xml version="1.0" encoding="utf-8"?>

<TableSummary
nbsp;Comment="
nbsp;This is a summary table, there are two types of summary table, one is by actual count, and the other is count by trail">


<?xml version="1.0" encoding="utf-8"?>

<TableSummary
 Comment="
 This is a summary table, there are two types of summary table, one is by actual count, and the other is count by trail">


 <ByActualCount>

   <Tables Comment="the following tables have no date:">
     <BranchIndividualMotor/>
     <IndividualMotor/>
     <Motor/>
     <RptOnBranchMotor/>
   </Tables>

   
   <Formulas Comment="formulas of by actual count, no date trailing">
     <InQty>
       MIN_A_QTY
       + MFL_A_QTY
       + MRS_A_QTY
       + MRB_A_QTY
       + MRP_A_QTY
       + MSR_A_QTY
       + MRI_A_QTY
       + MNR_A_QTY
     </InQty>

     <OutQty>
       MPR_D_QTY
       + MMB_D_QTY
       + MSI_D_QTY
       + MSC_D_QTY
       + MMN_D_QTY
       + MAM_D_QTY
     </OutQty>


     <ActualQty>
       (
       MIN_A_QTY
       + MFL_A_QTY
       + MRS_A_QTY
       + MRB_A_QTY
       + MRP_A_QTY
       + MSR_A_QTY
       + MRI_A_QTY
       + MNR_A_QTY
       )
       -
       (
       MPR_D_QTY
       + MMB_D_QTY
       + MSI_D_QTY
       + MSC_D_QTY
       + MMN_D_QTY
       + MAM_D_QTY
       )
     </ActualQty>

     
     <InCost>
       MIN_A_COST
       + MFL_A_COST
       + MRS_A_COST
       + MRB_A_COST
       + MRP_A_COST
       + MSR_A_COST
       + MRI_A_COST
       + MNR_A_COST
     </InCost>




   </Formulas>




 </ByActualCount>



 <ByTrailCount>

   <Tables Comment="the following tables have date to facilitate trailing:">
     <RptOnBranchMotorDaily/>
     <RptOnBranchMotorMonthly/>
     <RptOnBranchMotorYearly/>
     <RptOnMotorDaily/>
     <RptOnMotorMonthly/>
     <RptOnMotorYearly/>
   </Tables>

   <Formulas Comment="formulas of bytrail count, with date:">
     <InQty>
       MIN_A_QTY
       + MFL_A_QTY
       + MRS_A_QTY
       + MRB_A_QTY
       + MRP_A_QTY
       + MSR_A_QTY
       + MRI_A_QTY
       + MNR_A_QTY
     </InQty>

     <OutQty>
       MPR_D_QTY
       + MMB_D_QTY
       + MSI_D_QTY
       + MSC_D_QTY
       + MMN_D_QTY
       + MAM_D_QTY
     </OutQty>

     <EndQty Comment="if sql server facilitates nested formula, we can simplify the formula below  with this: BeginQty + InQty - OutQty">

       BeginQty
       
       +
       
       (
       MIN_A_QTY
       + MFL_A_QTY
       + MRS_A_QTY
       + MRB_A_QTY
       + MRP_A_QTY
       + MSR_A_QTY
       + MRI_A_QTY
       + MNR_A_QTY
       )
       
       -
       
       (
       MPR_D_QTY
       + MMB_D_QTY
       + MSI_D_QTY
       + MSC_D_QTY
       + MMN_D_QTY
       + MAM_D_QTY
       )
     </EndQty>


     <InCost>
       MIN_A_COST
       + MFL_A_COST
       + MRS_A_COST
       + MRB_A_COST
       + MRP_A_COST
       + MSR_A_COST
       + MRI_A_COST
       + MNR_A_COST
     </InCost>

     <OutCost>
       MPR_D_COST
       + MMB_D_COST
       + MSI_D_COST
       + MSC_D_COST
       + MMN_D_COST
       + MAM_D_COST
     </OutCost>

     <EndCost>
       BeginCost
       
       +

       (
       MIN_A_COST
       + MFL_A_COST
       + MRS_A_COST
       + MRB_A_COST
       + MRP_A_COST
       + MSR_A_COST
       + MRI_A_COST
       + MNR_A_COST
       )

       -

       (
       MPR_D_COST
       + MMB_D_COST
       + MSI_D_COST
       + MSC_D_COST
       + MMN_D_COST
       + MAM_D_COST
       )
     </EndCost>

     <InstallmentProfit>
       MSI_D_PRICE - MSI_D_COST
     </InstallmentProfit>

     <CashProfit>
       MSC_D_PRICE - MSC_D_COST
     </CashProfit>

     <RepossessedProfit>
       MAM_D_PRICE - MAM_D_COST
     </RepossessedProfit>

     
     <TotalProfit Comment=
       "InstallmentProfit + CashProfit + RepossessedProfit">


       (MSI_D_PRICE - MSI_D_COST)
       +
       (MSC_D_PRICE - MSC_D_COST)
       +
       (MAM_D_PRICE - MAM_D_COST)

     </TotalProfit>


   </Formulas>


   
 </ByTrailCount>



</TableSummary>

No comments: