Example #1
0
        private void CmdPreview_Click(object sender, RoutedEventArgs e)
        {
            MVPayrollDocumentItem di = new MVPayrollDocumentItem(mv.GetDbObject().CloneAll());
            MVPayrollDocument     pd = new MVPayrollDocument(mvParent.GetDbObject().CloneAll());

            String temp = pd.PayrollAccountNo;

            pd.PayrollAccountNo = temp; //Refresh AccountNo Digit

            pd.PayrollItems.Clear();
            pd.AddPayrollDocItem(di);

            WinFormPrinting w = new WinFormPrinting("grpHRSlip", pd);

            w.ShowDialog();
        }
        public void AddPayrollDocItem(MVPayrollDocumentItem m)
        {
            CTable    o   = GetDbObject();
            ArrayList arr = o.GetChildArray("PAYROLL_DOC_LIST");

            if (arr == null)
            {
                arr = new ArrayList();
                o.AddChildArray("PAYROLL_DOC_LIST", arr);
            }

            m.ExtFlag = "A";
            arr.Add(m.GetDbObject());
            docItems.Add(m);

            //m.Seq = internalSeq;
            //internalSeq++;
        }
        public void SumItem(MVPayrollDocumentItem accum, MVPayrollDocumentItem tx)
        {
            CTable a = accum.GetDbObject();
            CTable t = tx.GetDbObject();

            ArrayList fields = t.GetTableFields();

            foreach (CField field in fields)
            {
                String fname = field.getName();

                if (!isAccumField(fname))
                {
                    continue;
                }

                double txValue = CUtil.StringToDouble(t.GetFieldValue(fname));
                double acValue = CUtil.StringToDouble(a.GetFieldValue(fname));
                double sum     = txValue + acValue;

                SetFieldValue(fname, sum.ToString());
            }
        }